diff --git a/go.mod b/go.mod index 79d5e34ab4..264d48959b 100644 --- a/go.mod +++ b/go.mod @@ -39,17 +39,17 @@ require ( golang.org/x/sync v0.22.0 golang.org/x/time v0.15.0 google.golang.org/grpc v1.83.1 - k8s.io/api v0.36.4 - k8s.io/apiextensions-apiserver v0.36.4 - k8s.io/apimachinery v0.36.4 - k8s.io/apiserver v0.36.4 - k8s.io/client-go v0.36.4 - k8s.io/code-generator v0.36.4 - k8s.io/component-base v0.36.4 + k8s.io/api v0.37.0 + k8s.io/apiextensions-apiserver v0.37.0 + k8s.io/apimachinery v0.37.0 + k8s.io/apiserver v0.37.0 + k8s.io/client-go v0.37.0 + k8s.io/code-generator v0.37.0 + k8s.io/component-base v0.37.0 k8s.io/klog/v2 v2.140.0 - k8s.io/kube-aggregator v0.36.4 - k8s.io/kube-openapi v0.0.0-20260427204847-8949caaa1199 - k8s.io/utils v0.0.0-20260319190234-28399d86e0b5 + k8s.io/kube-aggregator v0.37.0 + k8s.io/kube-openapi v0.0.0-20260721132016-d427ff9ee9ad + k8s.io/utils v0.0.0-20260626114624-be93311217bd sigs.k8s.io/controller-runtime v0.24.1 sigs.k8s.io/controller-tools v0.21.0 ) @@ -96,20 +96,20 @@ require ( github.com/go-git/go-git/v5 v5.19.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-logr/zapr v1.3.0 // indirect - github.com/go-openapi/jsonpointer v0.23.1 // indirect - github.com/go-openapi/jsonreference v0.21.5 // indirect - github.com/go-openapi/swag v0.26.0 // indirect - github.com/go-openapi/swag/cmdutils v0.26.0 // indirect - github.com/go-openapi/swag/conv v0.26.0 // indirect - github.com/go-openapi/swag/fileutils v0.26.0 // indirect - github.com/go-openapi/swag/jsonname v0.26.0 // indirect - github.com/go-openapi/swag/jsonutils v0.26.0 // indirect - github.com/go-openapi/swag/loading v0.26.0 // indirect - github.com/go-openapi/swag/mangling v0.26.0 // indirect - github.com/go-openapi/swag/netutils v0.26.0 // indirect - github.com/go-openapi/swag/stringutils v0.26.0 // indirect - github.com/go-openapi/swag/typeutils v0.26.0 // indirect - github.com/go-openapi/swag/yamlutils v0.26.0 // indirect + github.com/go-openapi/jsonpointer v1.0.0 // indirect + github.com/go-openapi/jsonreference v1.0.0 // indirect + github.com/go-openapi/swag v0.27.1 // indirect + github.com/go-openapi/swag/cmdutils v0.27.1 // indirect + github.com/go-openapi/swag/conv v0.27.1 // indirect + github.com/go-openapi/swag/fileutils v0.27.1 // indirect + github.com/go-openapi/swag/jsonutils v0.27.1 // indirect + github.com/go-openapi/swag/loading v0.27.1 // indirect + github.com/go-openapi/swag/mangling v0.27.1 // indirect + github.com/go-openapi/swag/netutils v0.27.1 // indirect + github.com/go-openapi/swag/pools v0.27.1 // indirect + github.com/go-openapi/swag/stringutils v0.27.1 // indirect + github.com/go-openapi/swag/typeutils v0.27.1 // indirect + github.com/go-openapi/swag/yamlutils v0.27.1 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/gobuffalo/flect v1.0.3 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -123,7 +123,7 @@ require ( github.com/gorilla/mux v1.8.1 // indirect github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 // indirect github.com/h2non/filetype v1.1.3 // indirect github.com/h2non/go-is-svg v0.0.0-20160927212452-35e8c4b0612c // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect @@ -155,16 +155,16 @@ require ( github.com/tidwall/btree v1.8.1 // indirect github.com/x448/float16 v0.8.4 // indirect go.etcd.io/bbolt v1.5.0 // indirect - go.etcd.io/etcd/api/v3 v3.6.8 // indirect - go.etcd.io/etcd/client/pkg/v3 v3.6.8 // indirect - go.etcd.io/etcd/client/v3 v3.6.8 // indirect + go.etcd.io/etcd/api/v3 v3.7.0 // indirect + go.etcd.io/etcd/client/pkg/v3 v3.7.0 // indirect + go.etcd.io/etcd/client/v3 v3.7.0 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.65.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.68.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0 // indirect go.opentelemetry.io/otel v1.44.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.44.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.44.0 // indirect go.opentelemetry.io/otel/metric v1.44.0 // indirect go.opentelemetry.io/otel/sdk v1.44.0 // indirect go.opentelemetry.io/otel/trace v1.44.0 // indirect @@ -193,13 +193,13 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b // indirect - k8s.io/kms v0.36.4 // indirect - k8s.io/streaming v0.36.4 // indirect - sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 // indirect + k8s.io/gengo/v2 v2.0.0-20260408192533-25e2208e0dc3 // indirect + k8s.io/kms v0.37.0 // indirect + k8s.io/streaming v0.37.0 // indirect + sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.36.0 // indirect sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect sigs.k8s.io/randfill v1.0.0 // indirect - sigs.k8s.io/structured-merge-diff/v6 v6.4.0 // indirect + sigs.k8s.io/structured-merge-diff/v6 v6.4.2 // indirect sigs.k8s.io/yaml v1.6.0 // indirect ) diff --git a/go.sum b/go.sum index 31bc36a03d..a887971336 100644 --- a/go.sum +++ b/go.sum @@ -139,40 +139,40 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= -github.com/go-openapi/jsonpointer v0.23.1 h1:1HBACs7XIwR2RcmItfdSFlALhGbe6S92p0ry4d1GWg4= -github.com/go-openapi/jsonpointer v0.23.1/go.mod h1:iWRmZTrGn7XwYhtPt/fvdSFj1OfNBngqRT2UG3BxSqY= -github.com/go-openapi/jsonreference v0.21.5 h1:6uCGVXU/aNF13AQNggxfysJ+5ZcU4nEAe+pJyVWRdiE= -github.com/go-openapi/jsonreference v0.21.5/go.mod h1:u25Bw85sX4E2jzFodh1FOKMTZLcfifd1Q+iKKOUxExw= -github.com/go-openapi/swag v0.26.0 h1:GVDXCmfvhfu1BxiHo8/FA+BbKmhecHnG3varjON5/RI= -github.com/go-openapi/swag v0.26.0/go.mod h1:82g3193sZJRbocs7bNCqGfIgq8pkuwVwCfhKIRlEQF0= -github.com/go-openapi/swag/cmdutils v0.26.0 h1:iowihOcvq7y4egO8cOq0dmfohz6wfeQ63U1EnuhO2TU= -github.com/go-openapi/swag/cmdutils v0.26.0/go.mod h1:Sm1MVFMkF6guJJ+pQqHnQA3N0j9qALV3NxzDSv6bETM= -github.com/go-openapi/swag/conv v0.26.0 h1:5yGGsPYI1ZCva93U0AoKi/iZrNhaJEjr324YVsiD89I= -github.com/go-openapi/swag/conv v0.26.0/go.mod h1:tpAmIL7X58VPnHHiSO4uE3jBeRamGsFsfdDeDtb5ECE= -github.com/go-openapi/swag/fileutils v0.26.0 h1:WJoPRvsA7QRiiWluowkLJa9jaYR7FCuxmDvnCgaRRxU= -github.com/go-openapi/swag/fileutils v0.26.0/go.mod h1:0WDJ7lp67eNjPMO50wAWYlKvhOb6CQ37rzR7wrgI8Tc= -github.com/go-openapi/swag/jsonname v0.26.0 h1:gV1NFX9M8avo0YSpmWogqfQISigCmpaiNci8cGECU5w= -github.com/go-openapi/swag/jsonname v0.26.0/go.mod h1:urBBR8bZNoDYGr653ynhIx+gTeIz0ARZxHkAPktJK2M= -github.com/go-openapi/swag/jsonutils v0.26.0 h1:FawFML2iAXsPqmERscuMPIHmFsoP1tOqWkxBaKNMsnA= -github.com/go-openapi/swag/jsonutils v0.26.0/go.mod h1:2VmA0CJlyFqgawOaPI9psnjFDqzyivIqLYN34t9p91E= -github.com/go-openapi/swag/jsonutils/fixtures_test v0.26.0 h1:apqeINu/ICHouqiRZbyFvuDge5jCmmLTqGQ9V95EaOM= -github.com/go-openapi/swag/jsonutils/fixtures_test v0.26.0/go.mod h1:AyM6QT8uz5IdKxk5akv0y6u4QvcL9GWERt0Jx/F/R8Y= -github.com/go-openapi/swag/loading v0.26.0 h1:Apg6zaKhCJurpJer0DCxq99qwmhFddBhaMX7kilDcko= -github.com/go-openapi/swag/loading v0.26.0/go.mod h1:dBxQ/6V2uBaAQdevN18VELE6xSpJWZxLX4txe12JwDg= -github.com/go-openapi/swag/mangling v0.26.0 h1:Du2YC4YLA/Y5m/YKQd7AnY5qq0wRKSFZTTt8ktFaXcQ= -github.com/go-openapi/swag/mangling v0.26.0/go.mod h1:jifS7W9vbg+pw63bT+GI53otluMQL3CeemuyCHKwVx0= -github.com/go-openapi/swag/netutils v0.26.0 h1:CmZp+ZT7HrmFwrC3GdGsXBq2+42T1bjKBapcqVpIs3c= -github.com/go-openapi/swag/netutils v0.26.0/go.mod h1:5iK+Ok3ZohWWex1C50BFTPexi03UaPwjW4Oj8kgrpwo= -github.com/go-openapi/swag/stringutils v0.26.0 h1:qZQngLxs5s7SLijc3N2ZO+fUq2o8LjuWAASSrJuh+xg= -github.com/go-openapi/swag/stringutils v0.26.0/go.mod h1:sWn5uY+QIIspwPhvgnqJsH8xqFT2ZbYcvbcFanRyhFE= -github.com/go-openapi/swag/typeutils v0.26.0 h1:2kdEwdiNWy+JJdOvu5MA2IIg2SylWAFuuyQIKYybfq4= -github.com/go-openapi/swag/typeutils v0.26.0/go.mod h1:oovDuIUvTrEHVMqWilQzKzV4YlSKgyZmFh7AlfABNVE= -github.com/go-openapi/swag/yamlutils v0.26.0 h1:H7O8l/8NJJQ/oiReEN+oMpnGMyt8G0hl460nRZxhLMQ= -github.com/go-openapi/swag/yamlutils v0.26.0/go.mod h1:1evKEGAtP37Pkwcc7EWMF0hedX0/x3Rkvei2wtG/TbU= -github.com/go-openapi/testify/enable/yaml/v2 v2.4.2 h1:5zRca5jw7lzVREKCZVNBpysDNBjj74rBh0N2BGQbSR0= -github.com/go-openapi/testify/enable/yaml/v2 v2.4.2/go.mod h1:XVevPw5hUXuV+5AkI1u1PeAm27EQVrhXTTCPAF85LmE= -github.com/go-openapi/testify/v2 v2.4.2 h1:tiByHpvE9uHrrKjOszax7ZvKB7QOgizBWGBLuq0ePx4= -github.com/go-openapi/testify/v2 v2.4.2/go.mod h1:SgsVHtfooshd0tublTtJ50FPKhujf47YRqauXXOUxfw= +github.com/go-openapi/jsonpointer v1.0.0 h1:kR9tHqY0CtZaOPVFm622dPVNhrvYpwr4uCxgL3h1H8s= +github.com/go-openapi/jsonpointer v1.0.0/go.mod h1:Z3rw7dWu1p9IgitXCFamSlA5lmDiklEB6vkaxcNZW5Y= +github.com/go-openapi/jsonreference v1.0.0 h1:jlmTr6torcd1YgDQvSfNmRtKzYDO4FGBkrAdlAVWnpY= +github.com/go-openapi/jsonreference v1.0.0/go.mod h1:jtwdyGbJk0Xhe5Y+rwtglQP6Sb1WZST4rT32LWB+sv0= +github.com/go-openapi/swag v0.27.1 h1:VotvOLWW8q/EAxB0YdsBBGC8XYyeL1YwBj2ungAGPNg= +github.com/go-openapi/swag v0.27.1/go.mod h1:GTkJPwHfhJp6MWr4/rCh64HVI3Ofu+tcsbfjfHmTxpE= +github.com/go-openapi/swag/cmdutils v0.27.1 h1:I7sYqaWVl5mq0NEmNQkAmFDyNin9ufvMX/p2zwtQaOE= +github.com/go-openapi/swag/cmdutils v0.27.1/go.mod h1:Sm1MVFMkF6guJJ+pQqHnQA3N0j9qALV3NxzDSv6bETM= +github.com/go-openapi/swag/conv v0.27.1 h1:8wi9ZG+olmY1wXphl93EWniPtbSPkXM/feH7FgjsvrU= +github.com/go-openapi/swag/conv v0.27.1/go.mod h1:QbqMivkpKhC3g1B1GGGOJ6ANewI3S62dbzYu3Duowqs= +github.com/go-openapi/swag/fileutils v0.27.1 h1:QQqBSoi5mW4XpU85nS0mLcA+zAE6vLzrb0QkmLKf9oM= +github.com/go-openapi/swag/fileutils v0.27.1/go.mod h1:VvJFZLTZS0AI854gEQz5tk7dBESdLjiNUMSZ/th2ry8= +github.com/go-openapi/swag/jsonutils v0.27.1 h1:SVgK3i4USzCU5mibOOS/l4ea2h9UQXy7J7RNLTjuXjU= +github.com/go-openapi/swag/jsonutils v0.27.1/go.mod h1:tdlEpZqdcQ17uj6J4YdK9vd8It5qWMwjWXOs0tjpRlk= +github.com/go-openapi/swag/jsonutils/fixtures_test v0.27.1 h1:mJu3COL9WEaZVp/Kf2PRMi7tPszPEJfSr/OO75ynCs8= +github.com/go-openapi/swag/jsonutils/fixtures_test v0.27.1/go.mod h1:mofwUWx70wvskwESqRJ//k/9kURmCgyJl5m5Ppoh5kY= +github.com/go-openapi/swag/loading v0.27.1 h1:/DxUgDXKbBX4bcn7r9uEXfJyzN5XpiJmZplzQTjrRCY= +github.com/go-openapi/swag/loading v0.27.1/go.mod h1:jvGh3iA2+zyUUycB5fgJWzeHnhrpvGnJJM0RVE9ZShE= +github.com/go-openapi/swag/mangling v0.27.1 h1:yC9D0HyUE8gbP+BfmGx9+AA89ikwZTMjESK3OnnoaqA= +github.com/go-openapi/swag/mangling v0.27.1/go.mod h1:jtBE2+V+3pILxOR7Vgce+Cwp6A2PgZbvVqfNntbVs0w= +github.com/go-openapi/swag/netutils v0.27.1 h1:mICMFoS82F5TZ4Zy3cqmcQk+BFeCp3Uyq3Np7GI0/qU= +github.com/go-openapi/swag/netutils v0.27.1/go.mod h1:J+WYyFMLtvtCGqa6jLv+YNUmIKI3ZRQRrvfNDMoQoEQ= +github.com/go-openapi/swag/pools v0.27.1 h1:9LeadcMyb2GJCbXX5hVQDbZ2Lq9TL4dCs/nx1j5DO0E= +github.com/go-openapi/swag/pools v0.27.1/go.mod h1:kVQefhSK5RWuRe7BXsL8htgBPAMpN7HDGpGEknqugeE= +github.com/go-openapi/swag/stringutils v0.27.1 h1:ZXePZ0r2p1qSjo8tD3Un4vFj8+FqlCkczxDrJIhYUp8= +github.com/go-openapi/swag/stringutils v0.27.1/go.mod h1:lzRN95CxXmA03XcDWHLOb6nOMcxCqR5rGY0lOgsfRoM= +github.com/go-openapi/swag/typeutils v0.27.1 h1:KSTdFlfnse4r6dP9IrEnwMldjE+zs71UeEB3//PtVXc= +github.com/go-openapi/swag/typeutils v0.27.1/go.mod h1:Srm0xFNRZ1Y+vCxJclo5qzx8aj+1pAKda/YfFPrG0dQ= +github.com/go-openapi/swag/yamlutils v0.27.1 h1:ftxv6xvXb1E3zohUc+okZ9nSqNb9StQX/FXnKZ98sQA= +github.com/go-openapi/swag/yamlutils v0.27.1/go.mod h1:bnxFIB1qewGRiZHypXGZ3fNgf13/0HfRgnS/iZBDrOo= +github.com/go-openapi/testify/enable/yaml/v2 v2.6.0 h1:gGHwAJ0R/5jU8BEGDbfRNR3hL68dAVi84WuOApp29B0= +github.com/go-openapi/testify/enable/yaml/v2 v2.6.0/go.mod h1:tY+St1SGq4NFl0QIqdTY4aEdbChAHxhyB77XQi9iJCo= +github.com/go-openapi/testify/v2 v2.6.0 h1:5PKH2HE7YJ/LuRPQGvSxBRlFXNQhSetBLlGAgUEu3ug= +github.com/go-openapi/testify/v2 v2.6.0/go.mod h1:SgsVHtfooshd0tublTtJ50FPKhujf47YRqauXXOUxfw= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= @@ -205,8 +205,6 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= -github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/cel-go v0.29.2 h1:ZtDxkeiMmz0mxbKDYiNkE5Lk7V5edMRcaaDf2jX002k= github.com/google/cel-go v0.29.2/go.mod h1:X0bD6iVNR8pkROSOoHVdgTkzmRcosof7WQqCD6wcMc8= github.com/google/gnostic-models v0.7.1 h1:SisTfuFKJSKM5CPZkffwi6coztzzeYUhc3v4yxLWH8c= @@ -239,8 +237,8 @@ github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 h1:QGLs github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0/go.mod h1:hM2alZsMUni80N33RBe6J0e423LB+odMj7d3EMP9l20= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 h1:B+8ClL/kCQkRiU82d9xajRPKYMrB7E0MbtzWVi1K4ns= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3/go.mod h1:NbCUVmiS4foBGBHOYlCT25+YmGpJ32dZPi75pGEUpj4= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 h1:HWRh5R2+9EifMyIHV7ZV+MIZqgz+PMpZ14Jynv3O2Zs= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0/go.mod h1:JfhWUomR1baixubs02l85lZYYOm7LV6om4ceouMv45c= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 h1:5VipnvEpbqr2gA2VbM+nYVbkIF28c5ZQfqCBQ5g2xfk= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0/go.mod h1:Hyl3n6Twe1hvtd9XUXDec4pTvgMSEixRuQKPTMH2bNs= github.com/h2non/filetype v1.1.3 h1:FKkx9QbD7HR/zjK1Ia5XiBsq9zdLi5Kf3zGyFTAFkGg= github.com/h2non/filetype v1.1.3/go.mod h1:319b3zT68BvV+WRj7cwy856M2ehB3HqNOt6sy1HndBY= github.com/h2non/go-is-svg v0.0.0-20160927212452-35e8c4b0612c h1:fEE5/5VNnYUoBOj2I9TP8Jc+a7lge3QWn9DKE7NCwfc= @@ -439,18 +437,18 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.etcd.io/bbolt v1.5.0 h1:S7GAl7Fxv12yohbwFfIbQCGDWbQbtDGPET4P/bD4lxU= go.etcd.io/bbolt v1.5.0/go.mod h1:mkltfYE5aUHQxUct9N9V+Kp7aSjFqjgrhcXIS70Lrdk= -go.etcd.io/etcd/api/v3 v3.6.8 h1:gqb1VN92TAI6G2FiBvWcqKtHiIjr4SU2GdXxTwyexbM= -go.etcd.io/etcd/api/v3 v3.6.8/go.mod h1:qyQj1HZPUV3B5cbAL8scG62+fyz5dSxxu0w8pn28N6Q= -go.etcd.io/etcd/client/pkg/v3 v3.6.8 h1:Qs/5C0LNFiqXxYf2GU8MVjYUEXJ6sZaYOz0zEqQgy50= -go.etcd.io/etcd/client/pkg/v3 v3.6.8/go.mod h1:GsiTRUZE2318PggZkAo6sWb6l8JLVrnckTNfbG8PWtw= -go.etcd.io/etcd/client/v3 v3.6.8 h1:B3G76t1UykqAOrbio7s/EPatixQDkQBevN8/mwiplrY= -go.etcd.io/etcd/client/v3 v3.6.8/go.mod h1:MVG4BpSIuumPi+ELF7wYtySETmoTWBHVcDoHdVupwt8= -go.etcd.io/etcd/pkg/v3 v3.6.8 h1:Xe+LIL974spy8b4nEx3H0KMr1ofq3r0kh6FbU3aw4es= -go.etcd.io/etcd/pkg/v3 v3.6.8/go.mod h1:TRibVNe+FqJIe1abOAA1PsuQ4wqO87ZaOoprg09Tn8c= -go.etcd.io/etcd/server/v3 v3.6.8 h1:U2strdSEy1U8qcSzRIdkYpvOPtBy/9i/IfaaCI9flZ4= -go.etcd.io/etcd/server/v3 v3.6.8/go.mod h1:88dCtwUnSirkUoJbflQxxWXqtBSZa6lSG0Kuej+dois= -go.etcd.io/raft/v3 v3.6.0 h1:5NtvbDVYpnfZWcIHgGRk9DyzkBIXOi8j+DDp1IcnUWQ= -go.etcd.io/raft/v3 v3.6.0/go.mod h1:nLvLevg6+xrVtHUmVaTcTz603gQPHfh7kUAwV6YpfGo= +go.etcd.io/etcd/api/v3 v3.7.0 h1:WZlGK7pRtYGDB8ti8wkrQ5D2oWGMbtNL9VA5e+vF2Fg= +go.etcd.io/etcd/api/v3 v3.7.0/go.mod h1:EcTihnwAQ0BQNh5dfAdaFVFdchuo7EP0HlX7TV3jz/A= +go.etcd.io/etcd/client/pkg/v3 v3.7.0 h1:sW9njJzS3vXKcAJjjLQ4nk+avNUJ12Bcijcx8ehUskE= +go.etcd.io/etcd/client/pkg/v3 v3.7.0/go.mod h1:cnzZGIUzSfjEwLC6UBVsSXlEK1eepS/JUD7wE6PLRT0= +go.etcd.io/etcd/client/v3 v3.7.0 h1:5MHO37VbPB87VRPKUXEcicjeQWiTSjpPv3Ume8xPx20= +go.etcd.io/etcd/client/v3 v3.7.0/go.mod h1:DJ382WuwjmbowjPDyaaQ0idWXy4dh91XRhe4FOrb9vM= +go.etcd.io/etcd/pkg/v3 v3.7.0 h1:aUBHGzXnYL2m3AlZfKp0ZhHQLVZIKfu9QsIlYdr+mxc= +go.etcd.io/etcd/pkg/v3 v3.7.0/go.mod h1:fDQYyc8rOC1Yl4EZLh0O1OjHzwJW7jAly80+BpD1M9o= +go.etcd.io/etcd/server/v3 v3.7.0 h1:ScdUdN8ljuimp0lZaNq0otLMrHcFSFT+dQyT1j7JSFo= +go.etcd.io/etcd/server/v3 v3.7.0/go.mod h1:v7N1dPdSW2vzyxGsbDwK4X0sCe3SYNlQ+9eNIMGzdxQ= +go.etcd.io/raft/v3 v3.7.0 h1:BGzlwx07bLv8PW6OU5HObuz1y4hlPZUXA07pM1mPUh4= +go.etcd.io/raft/v3 v3.7.0/go.mod h1:6gX6T2X907DjnjsFLODnTxba77stjs84W9gTTI0GUNA= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= @@ -459,8 +457,8 @@ go.opentelemetry.io/contrib/bridges/prometheus v0.67.0 h1:dkBzNEAIKADEaFnuESzcXv go.opentelemetry.io/contrib/bridges/prometheus v0.67.0/go.mod h1:Z5RIwRkZgauOIfnG5IpidvLpERjhTninpP1dTG2jTl4= go.opentelemetry.io/contrib/exporters/autoexport v0.67.0 h1:4fnRcNpc6YFtG3zsFw9achKn3XgmxPxuMuqIL5rE8e8= go.opentelemetry.io/contrib/exporters/autoexport v0.67.0/go.mod h1:qTvIHMFKoxW7HXg02gm6/Wofhq5p3Ib/A/NNt1EoBSQ= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.65.0 h1:XmiuHzgJt067+a6kwyAzkhXooYVv3/TOw9cM2VfJgUM= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.65.0/go.mod h1:KDgtbWKTQs4bM+VPUr6WlL9m/WXcmkCcBlIzqxPGzmI= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.68.0 h1:0Qx7VGBacMm9ZENQ7TnNObTYI4ShC+lHI16seduaxZo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.68.0/go.mod h1:Sje3i3MjSPKTSPvVWCaL8ugBzJwik3u4smCjUeuupqg= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0 h1:8tvICD4vSTOOsNrsI4Ljf6C+6UKvpTEH5XY3JMoyPoo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0/go.mod h1:z9+yiacE0IHRqM4qFfkbt/JYlmYXgss8GY/jXoNuPJI= go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU= @@ -473,10 +471,10 @@ go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.42.0 h1:MdK go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.42.0/go.mod h1:RolT8tWtfHcjajEH5wFIZ4Dgh5jpPdFXYV9pTAk/qjc= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.43.0 h1:w1K+pCJoPpQifuVpsKamUdn9U0zM3xUziVOqsGksUrY= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.43.0/go.mod h1:HBy4BjzgVE8139ieRI75oXm3EcDN+6GhD88JT1Kjvxg= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 h1:88Y4s2C8oTui1LGM6bTWkw0ICGcOLCAI5l6zsD1j20k= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0/go.mod h1:Vl1/iaggsuRlrHf/hfPJPvVag77kKyvrLeD10kpMl+A= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 h1:zWWrB1U6nqhS/k6zYB74CjRpuiitRtLLi68VcgmOEto= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0/go.mod h1:2qXPNBX1OVRC0IwOnfo1ljoid+RD0QK3443EaqVlsOU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.44.0 h1:4YsVu3B8+3qtWYYrsUYgn0OG78pN0rnNPRGX4SbokQI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.44.0/go.mod h1:+wnlSn0mD1ADVMe3v9Z/WIaiz6q6gL2J/ejaAmdmv80= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.44.0 h1:qazEJlUOQzhCpzQpFETGby7EdqjI1wsd0W+6Gg1SCTU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.44.0/go.mod h1:fOD2Yefuxixkx3ahVNf0O/PERb6r4OlbxfATVnYvzCo= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0 h1:3iZJKlCZufyRzPzlQhUIWVmfltrXuGyfjREgGP3UUjc= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0/go.mod h1:/G+nUPfhq2e+qiXMGxMwumDrP5jtzU+mWN7/sjT2rak= go.opentelemetry.io/otel/exporters/prometheus v0.64.0 h1:g0LRDXMX/G1SEZtK8zl8Chm4K6GBwRkjPKE36LxiTYs= @@ -644,38 +642,38 @@ gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q= gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.36.4 h1:RxrvqCL6vgH5/+UnTeu1IIFqYmGfy0hnyrod1rn35Oo= -k8s.io/api v0.36.4/go.mod h1:S2B3orCFBDhrgyWbLeuKcT2QdHIpQesBkCYSlWtwUOw= -k8s.io/apiextensions-apiserver v0.36.4 h1:SfvCVt+4CqKWvzuVytYDT5g9hyb9MztoiYELIkPVrFc= -k8s.io/apiextensions-apiserver v0.36.4/go.mod h1:JT9V2Ju7ys1FY4zbSpmX9XOvKB3/BwsODc4hFQEa+Xo= -k8s.io/apimachinery v0.36.4 h1:PT2UzkupGuAx/+xT5XjiMJ1WGpY3fn9/hdAvjweRet4= -k8s.io/apimachinery v0.36.4/go.mod h1:p2I2dipt7JHG+quVwQ1d02d28O4GdDi77RByQ13MTpk= -k8s.io/apiserver v0.36.4 h1:AtKjaf2eUiX5G6TfF2IOlhuUuvMsHh49Ivr1+4fZ2gA= -k8s.io/apiserver v0.36.4/go.mod h1:RyiGghXP67hb0Ll+7iLJ6GGv2JpEzCn7ljbiA+L3cJ0= -k8s.io/client-go v0.36.4 h1:MDvfDNvMSt0Br94SK8neviVlwL9qifw9B26hJCpD1K0= -k8s.io/client-go v0.36.4/go.mod h1:pNK4WKELbwlEDvtbE8l22lEZL5THYF61H5EealokZmA= -k8s.io/code-generator v0.36.4 h1:KNW2Alv5LVoGiooEYh1GY982CGyg53u1inHu6Zi4bIA= -k8s.io/code-generator v0.36.4/go.mod h1:JmRrlYwTOn2glEuGOfNnlXTGbz3FfMg7t7Dq/8lHcc4= -k8s.io/component-base v0.36.4 h1:tz75yC2xgq3kd7vPdBtR8do5iMx0OHf6Zd1kuaxDB84= -k8s.io/component-base v0.36.4/go.mod h1:DCwb306U8ou89NNAp45Csuy8ok+1rp1ELDVPhzN5AWc= -k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b h1:gMplByicHV/TJBizHd9aVEsTYoJBnnUAT5MHlTkbjhQ= -k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b/go.mod h1:CgujABENc3KuTrcsdpGmrrASjtQsWCT7R99mEV4U/fM= +k8s.io/api v0.37.0 h1:Z//Vj9N7RA/yS2sDmxyeo7h+RR4zbUrd2vrd3Z0TbB4= +k8s.io/api v0.37.0/go.mod h1:LKXgcJWMc+f4OLbP5SFR8rulEg07zZhpi/zMULiBImk= +k8s.io/apiextensions-apiserver v0.37.0 h1:zRMQ3+/LIE5oZ0tVvXwYHC+dIkSP5cjNWju7AZU1LOI= +k8s.io/apiextensions-apiserver v0.37.0/go.mod h1:HU0PfSBwchHL5iDau6jjt9zU6ryWkDDlaVUiq91NK80= +k8s.io/apimachinery v0.37.0 h1:Np2AbDtf8x6RDHiD8T9LbKJ9gaegeVNa8yNm5FuGKm0= +k8s.io/apimachinery v0.37.0/go.mod h1:RN3nhprFSCxOi5Selxd7oMTXOe/c+ZbcE7Im+TS2zkE= +k8s.io/apiserver v0.37.0 h1:TXg7OxsOWrAH8J4Zi/gBAZuMw1Dfdd+6cca2h4qjRqo= +k8s.io/apiserver v0.37.0/go.mod h1:OddHDF4gy9qyIb8o/3+qaeP6S0vEObWLgOygVqXksv0= +k8s.io/client-go v0.37.0 h1:nsN31fy8wBySuZ+QRnKmrjRSQLOG2rvoGN0tKd12zhQ= +k8s.io/client-go v0.37.0/go.mod h1:FcGqw+Ll/gNQiq+nPGY1Oyt9y7SgDh1d3MW3RFDEbn0= +k8s.io/code-generator v0.37.0 h1:AC915wukzlVHHODAQYxvQ25WKibPh95faJ2kxf8dzuo= +k8s.io/code-generator v0.37.0/go.mod h1:qg7E/uDlyvevVRL1V8+h2z9UWmi/8gxaRka/lVXUBdk= +k8s.io/component-base v0.37.0 h1:3SdSa4+itMdFTDFTeR8CxKGmSTSMXFlKL4ky8OqjguM= +k8s.io/component-base v0.37.0/go.mod h1:LjOebp4R9y6LODWZQv102ZQxGheLcDO2ZJLAw6bbh4I= +k8s.io/gengo/v2 v2.0.0-20260408192533-25e2208e0dc3 h1:3L6PNkMLXkU/pz3jWzaaIUz0Rs2V9h+5O51AeRC7poc= +k8s.io/gengo/v2 v2.0.0-20260408192533-25e2208e0dc3/go.mod h1:yvyl3l9E+UxlqOMUULdKTAYB0rEhsmjr7+2Vb/1pCSo= k8s.io/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc= k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0= -k8s.io/kms v0.36.4 h1:PlAMpy4UhTEs+MhdDel7PbPuD0jiRdIgLzScvMfO0aw= -k8s.io/kms v0.36.4/go.mod h1:7GDHEJmWmfAJR4eBr4YzM272dPBmoVTgTkoCUOumzq4= -k8s.io/kube-aggregator v0.36.4 h1:B593UGiOA2ivyuWOSvgWly5lXkTPLcYpeZwkq4Y+ieA= -k8s.io/kube-aggregator v0.36.4/go.mod h1:05q7hjy8iKStLM1e+BOQ8mMVPnIfAqfpkhZDPGxS0xY= -k8s.io/kube-openapi v0.0.0-20260427204847-8949caaa1199 h1:sWu4Td5mgJlwunsUydnhKEAfNUHM7hm1wfKEQmD7G5c= -k8s.io/kube-openapi v0.0.0-20260427204847-8949caaa1199/go.mod h1:uGBT7iTA6c6MvqUvSXIaYZo9ukscABYi2btjhvgKGZ0= -k8s.io/streaming v0.36.4 h1:RS5YlhrdBN2pKGVjgygGntdu6SNdsduyjGWGe3cX0vo= -k8s.io/streaming v0.36.4/go.mod h1:tJ6S2bZa2HxIBauguBbCWSCYyd93Grfz1+z3tcOvlDE= -k8s.io/utils v0.0.0-20260319190234-28399d86e0b5 h1:kBawHLSnx/mYHmRnNUf9d4CpjREbeZuxoSGOX/J+aYM= -k8s.io/utils v0.0.0-20260319190234-28399d86e0b5/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= +k8s.io/kms v0.37.0 h1:WDW3pSc5yFB1Od4YXXL3i5oK+vXI2v++LAV82+Ks1Z0= +k8s.io/kms v0.37.0/go.mod h1:0U6zfwLkfJr9O/jLgz2GARnKLh2uIhkq2EeaU66J5ow= +k8s.io/kube-aggregator v0.37.0 h1:XCCpIDBzwM1s+FdQEiTuyFcPtByVLfJ7NyVrj8YDbTw= +k8s.io/kube-aggregator v0.37.0/go.mod h1:Uy1F5FUItTfFfsx1T+cP+7uqKvV3J8/jjBxVzc/ICYU= +k8s.io/kube-openapi v0.0.0-20260721132016-d427ff9ee9ad h1:oXImqH8mQNk7PmvzKhmN3ddJoY6OnyM225MXwGHPm0A= +k8s.io/kube-openapi v0.0.0-20260721132016-d427ff9ee9ad/go.mod h1:0/mqHCVhlumdJ3BhCfnjSZQE037nAhNodh1/hK0T8/I= +k8s.io/streaming v0.37.0 h1:iPBUZLZiKt5bV+lxJurASMOV07VuBhNpiwJt2//AWrM= +k8s.io/streaming v0.37.0/go.mod h1:APlJR26ZWRcVy5bIEj0QRrKUXROtBHPcxl2NT7EAzPU= +k8s.io/utils v0.0.0-20260626114624-be93311217bd h1:Ea7fgQ5we8Y9T0OX5o0dAHzQOBRI07D/dEYRaB9ZZEs= +k8s.io/utils v0.0.0-20260626114624-be93311217bd/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= oras.land/oras-go/v2 v2.6.2 h1:N04RXngAp1LJKTG6ifz3xHPipasEkWr+hFmInja5YKo= oras.land/oras-go/v2 v2.6.2/go.mod h1:PlTtg4JTDJkDe8yVHpM2wz7/YDc00GVas+i4jAW2TZ4= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 h1:hSfpvjjTQXQY2Fol2CS0QHMNs/WI1MOSGzCm1KhM5ec= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.36.0 h1:/YpDJ4vReG7ZmzSpBGxduXgywWkJU9zHubgJG03MT+Y= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.36.0/go.mod h1:tJo1aepTXyR+8Xs3sUsGBDk4Ub2AM5dPAPKJx0mpm5c= sigs.k8s.io/controller-runtime v0.24.1 h1:miPEwrmirImAvgME1L9qebGHrOnGJoVmVdtOU9fRfo4= sigs.k8s.io/controller-runtime v0.24.1/go.mod h1:vFkfY5fGt5xAC/sKb8IBFKgWPNKG9OUG29dR8Y2wImw= sigs.k8s.io/controller-tools v0.21.0 h1:KXDQza3bgjlPY6xLR63tI/40gzjhyUAvkCrwzd2/6cs= @@ -684,7 +682,7 @@ sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5E sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= -sigs.k8s.io/structured-merge-diff/v6 v6.4.0 h1:qmp2e3ZfFi1/jJbDGpD4mt3wyp6PE1NfKHCYLqgNQJo= -sigs.k8s.io/structured-merge-diff/v6 v6.4.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= +sigs.k8s.io/structured-merge-diff/v6 v6.4.2 h1:qdOxHwrl2Kaag1aQEarlYcOA9vSyGCp3CIki3aW8c4Q= +sigs.k8s.io/structured-merge-diff/v6 v6.4.2/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/vendor/github.com/go-openapi/jsonpointer/.golangci.yml b/vendor/github.com/go-openapi/jsonpointer/.golangci.yml index dc7c96053d..9d2733176e 100644 --- a/vendor/github.com/go-openapi/jsonpointer/.golangci.yml +++ b/vendor/github.com/go-openapi/jsonpointer/.golangci.yml @@ -4,7 +4,10 @@ linters: disable: - depguard - funlen + - goconst - godox + - gomodguard + - gomodguard_v2 - exhaustruct - nlreturn - nonamedreturns diff --git a/vendor/github.com/go-openapi/jsonpointer/CONTRIBUTORS.md b/vendor/github.com/go-openapi/jsonpointer/CONTRIBUTORS.md index 9990f4a354..de0bf5c04b 100644 --- a/vendor/github.com/go-openapi/jsonpointer/CONTRIBUTORS.md +++ b/vendor/github.com/go-openapi/jsonpointer/CONTRIBUTORS.md @@ -4,21 +4,21 @@ | Total Contributors | Total Contributions | | --- | --- | -| 13 | 111 | +| 13 | 132 | | Username | All Time Contribution Count | All Commits | | --- | --- | --- | -| @fredbi | 63 | | +| @fredbi | 83 | | | @casualjim | 33 | | | @magodo | 3 | | | @youyuanwu | 3 | | +| @alexandear | 2 | | | @gaiaz-iusipov | 1 | | | @gbjk | 1 | | | @gordallott | 1 | | | @ianlancetaylor | 1 | | | @mfleader | 1 | | | @Neo2308 | 1 | | -| @alexandear | 1 | | | @olivierlemasle | 1 | | | @testwill | 1 | | diff --git a/vendor/github.com/go-openapi/jsonpointer/README.md b/vendor/github.com/go-openapi/jsonpointer/README.md index 24fbe1bf68..6e7929c64b 100644 --- a/vendor/github.com/go-openapi/jsonpointer/README.md +++ b/vendor/github.com/go-openapi/jsonpointer/README.md @@ -16,6 +16,14 @@ An implementation of JSON Pointer for golang, which supports go `struct`. ## Announcements +* **2026-07-07** : landing v1.0.0 + * stable API pledge + +* **2026-06-29** : reinsourced external dependency to swag (v0.24.0) + * module `github.com/go-openapi/swag/jsonname` is source directly here, so we no longer have any external dependency + * `jsonname` was never really used by any other package, so it makes sense to deprecate it away from the `swag` family + and retrofit its functionality here. `jsonpointer` no longer get external dependencies, besides test dependencies. + * **2026-04-15** : added support for trailing "-" for arrays (v0.23.0) * this brings full support of [RFC6901][RFC6901] * this is supported for types relying on the reflection-based implemented @@ -30,12 +38,13 @@ An implementation of JSON Pointer for golang, which supports go `struct`. * the default name provider in use is not fully aligned with go JSON stdlib * exposed an option (or global setting) to change the provider that resolves a struct into json keys * the default behavior is not altered - * a new alternate name provider is added (imported from `go-openapi/swag/jsonname`), aligned with JSON stdlib behavior ## Status API is stable and feature-complete. +The project continues to receive regular updates, bug fixes and hygiene maintenance (CI, linting, etc). + ## Import this library in your project ```cmd diff --git a/vendor/github.com/go-openapi/jsonpointer/errors.go b/vendor/github.com/go-openapi/jsonpointer/errors.go index 8813474d44..2ae6e3cfb3 100644 --- a/vendor/github.com/go-openapi/jsonpointer/errors.go +++ b/vendor/github.com/go-openapi/jsonpointer/errors.go @@ -21,14 +21,15 @@ const ( // ErrUnsupportedValueType indicates that a value of the wrong type is being set. ErrUnsupportedValueType pointerError = "only structs, pointers, maps and slices are supported for setting values" - // ErrDashToken indicates use of the RFC 6901 "-" reference token - // in a context where it cannot be resolved. + // ErrDashToken indicates use of the RFC 6901 "-" reference token in a context where it cannot be + // resolved. // - // Per RFC 6901 §4 the "-" token refers to the (nonexistent) element - // after the last array element. It may only be used as the terminal - // token of a [Pointer.Set] against a slice, where it means "append". - // Any other use (get, offset, intermediate traversal, non-slice target) - // is an error condition that wraps this sentinel. + // Per RFC 6901 §4 the "-" token refers to the (nonexistent) element after the last array element. + // It may only be used as the terminal token of a [Pointer.Set] against a slice, where it means + // "append". + // + // Any other use (get, offset, intermediate traversal, non-slice target) is an error condition that + // wraps this sentinel. ErrDashToken pointerError = `the "-" array token cannot be resolved here` //nolint:gosec // G101 false positive: this is a JSON Pointer reference token, not a credential. ) diff --git a/vendor/github.com/go-openapi/jsonpointer/ifaces.go b/vendor/github.com/go-openapi/jsonpointer/ifaces.go index 1e56ac0442..31359c48fa 100644 --- a/vendor/github.com/go-openapi/jsonpointer/ifaces.go +++ b/vendor/github.com/go-openapi/jsonpointer/ifaces.go @@ -5,39 +5,42 @@ package jsonpointer import "reflect" -// JSONPointable is an interface for structs to implement, -// when they need to customize the json pointer process or want to avoid the use of reflection. +// JSONPointable is an interface for structs to implement, when they need to customize the json +// pointer process or want to avoid the use of reflection. type JSONPointable interface { // JSONLookup returns a value pointed at this (unescaped) key. JSONLookup(key string) (any, error) } -// JSONSetable is an interface for structs to implement, -// when they need to customize the json pointer process or want to avoid the use of reflection. +// JSONSetable is an interface for structs to implement, when they need to customize the json +// pointer process or want to avoid the use of reflection. // // # Handling of the RFC 6901 "-" token // -// When a type implementing JSONSetable is the terminal parent of a [Pointer.Set] -// call, the library passes the raw reference token to JSONSet without -// interpretation. In particular, the RFC 6901 "-" token (which conventionally -// means "append" for arrays, per RFC 6902) is forwarded verbatim as the key -// argument. Implementations that model an array-like container are expected -// to give "-" the append semantics; implementations that do not should return -// an error wrapping [ErrDashToken] (or [ErrPointer]) for clarity. +// When a type implementing JSONSetable is the terminal parent of a [Pointer.Set] call, the library +// passes the raw reference token to JSONSet without interpretation. // -// Implementations are responsible for any in-place mutation: the library does -// not attempt to rebind the result of JSONSet into a parent container. +// In particular, the RFC 6901 "-" token (which conventionally means "append" for arrays, per RFC +// 6902) is forwarded verbatim as the key argument. +// +// Implementations that model an array-like container are expected to give "-" the append semantics; +// implementations that do not should return an error wrapping [ErrDashToken] (or [ErrPointer]) for +// clarity. +// +// Implementations are responsible for any in-place mutation: the library does not attempt to rebind +// the result of JSONSet into a parent container. type JSONSetable interface { // JSONSet sets the value pointed at the (unescaped) key. // - // The key may be the RFC 6901 "-" token when the pointer targets a - // slice-like member; see the interface documentation for details. + // The key may be the RFC 6901 "-" token when the pointer targets a slice-like member; see the + // interface documentation for details. JSONSet(key string, value any) error } // NameProvider knows how to resolve go struct fields into json names. // -// The default provider is brought by [github.com/go-openapi/swag/jsonname.DefaultJSONNameProvider]. +// The default provider is brought by +// [github.com/go-openapi/jsonpointer/jsonname.DefaultJSONNameProvider]. type NameProvider interface { // GetGoName gets the go name for a json property name GetGoName(subject any, name string) (string, bool) diff --git a/vendor/github.com/go-openapi/swag/jsonname/doc.go b/vendor/github.com/go-openapi/jsonpointer/jsonname/doc.go similarity index 100% rename from vendor/github.com/go-openapi/swag/jsonname/doc.go rename to vendor/github.com/go-openapi/jsonpointer/jsonname/doc.go diff --git a/vendor/github.com/go-openapi/swag/jsonname/go_name_provider.go b/vendor/github.com/go-openapi/jsonpointer/jsonname/go_name_provider.go similarity index 88% rename from vendor/github.com/go-openapi/swag/jsonname/go_name_provider.go rename to vendor/github.com/go-openapi/jsonpointer/jsonname/go_name_provider.go index adc4426873..5eec18fbfd 100644 --- a/vendor/github.com/go-openapi/swag/jsonname/go_name_provider.go +++ b/vendor/github.com/go-openapi/jsonpointer/jsonname/go_name_provider.go @@ -11,11 +11,11 @@ import ( var _ providerIface = (*GoNameProvider)(nil) -// GoNameProvider resolves json property names to go struct field names following -// the same rules as the standard library's [encoding/json] package. +// GoNameProvider resolves json property names to go struct field names following the same rules as +// the standard library's [encoding/json] package. // -// Contrary to [NameProvider], it considers exported fields without a json tag, -// and promotes fields from anonymous embedded struct types. +// Contrary to [NameProvider], it considers exported fields without a json tag, and promotes fields +// from anonymous embedded struct types. // // Rules (aligned with encoding/json): // @@ -104,9 +104,9 @@ func (n *GoNameProvider) nameIndexFor(tpe reflect.Type) nameIndex { return names } -// fieldEntry captures a candidate field discovered while walking a struct -// along with the indirection path from the root type (used to resolve conflicts -// by depth in the same way encoding/json does). +// fieldEntry captures a candidate field discovered while walking a struct along with the +// indirection path from the root type (used to resolve conflicts by depth in the same way +// encoding/json does). type fieldEntry struct { goName string jsonName string @@ -129,6 +129,8 @@ func buildGoNameIndex(tpe reflect.Type) nameIndex { // collectGoFields walks tpe breadth-first along anonymous struct fields, // reproducing the field selection performed by encoding/json.typeFields. +// +//nolint:gocognit // everything is inlined to help the compiler determine what escapes and what doesn't func collectGoFields(tpe reflect.Type) []fieldEntry { if tpe.Kind() != reflect.Struct { return nil @@ -157,12 +159,12 @@ func collectGoFields(tpe reflect.Type) []fieldEntry { } for _, q := range current { - for i := 0; i < q.typ.NumField(); i++ { + for i := range q.typ.NumField() { sf := q.typ.Field(i) if sf.Anonymous { ft := sf.Type - if ft.Kind() == reflect.Ptr { + if ft.Kind() == reflect.Pointer { ft = ft.Elem() } if !sf.IsExported() && ft.Kind() != reflect.Struct { @@ -180,7 +182,7 @@ func collectGoFields(tpe reflect.Type) []fieldEntry { tagged := jsonName != "" ft := sf.Type - if ft.Kind() == reflect.Ptr { + if ft.Kind() == reflect.Pointer { ft = ft.Elem() } @@ -221,9 +223,9 @@ func collectGoFields(tpe reflect.Type) []fieldEntry { return dominantFields(candidates) } -// dominantFields applies the Go encoding/json conflict resolution rules: -// at each JSON name, the shallowest field wins; at equal depth, a uniquely -// tagged candidate wins; otherwise all candidates for that name are dropped. +// dominantFields applies the Go encoding/json conflict resolution rules: at each JSON name, the +// shallowest field wins; at equal depth, a uniquely tagged candidate wins; otherwise all candidates +// for that name are dropped. func dominantFields(candidates []fieldEntry) []fieldEntry { byName := make(map[string][]fieldEntry, len(candidates)) for _, c := range candidates { @@ -272,14 +274,14 @@ func dominantFields(candidates []fieldEntry) []fieldEntry { return out } -// parseJSONTag returns the name component of a json struct tag and whether -// it carried any non-name option (kept for future-proofing, e.g. "omitempty"). +// parseJSONTag returns the name component of a json struct tag and whether it carried any non-name +// option (kept for future-proofing, e.g. "omitempty"). func parseJSONTag(tag string) (string, string) { if tag == "" { return "", "" } - if idx := strings.IndexByte(tag, ','); idx >= 0 { - return tag[:idx], tag[idx+1:] + if before, after, ok := strings.Cut(tag, ","); ok { + return before, after } return tag, "" diff --git a/vendor/github.com/go-openapi/swag/jsonname/ifaces.go b/vendor/github.com/go-openapi/jsonpointer/jsonname/ifaces.go similarity index 77% rename from vendor/github.com/go-openapi/swag/jsonname/ifaces.go rename to vendor/github.com/go-openapi/jsonpointer/jsonname/ifaces.go index 812ace5639..64871f0d27 100644 --- a/vendor/github.com/go-openapi/swag/jsonname/ifaces.go +++ b/vendor/github.com/go-openapi/jsonpointer/jsonname/ifaces.go @@ -5,9 +5,11 @@ package jsonname import "reflect" -// providerIface is an unexported compile-time contract that every name provider -// in this package is expected to satisfy. -// It mirrors the interface declared by the main consumer of this module: [github.com/go-openapi/jsonpointer.NameProvider]. +// providerIface is an unexported compile-time contract that every name provider in this package is +// expected to satisfy. +// +// It mirrors the interface declared by the main consumer of this module: +// [github.com/go-openapi/jsonpointer.NameProvider]. type providerIface interface { GetGoName(subject any, name string) (string, bool) GetGoNameForType(tpe reflect.Type, name string) (string, bool) diff --git a/vendor/github.com/go-openapi/swag/jsonname/name_provider.go b/vendor/github.com/go-openapi/jsonpointer/jsonname/name_provider.go similarity index 83% rename from vendor/github.com/go-openapi/swag/jsonname/name_provider.go rename to vendor/github.com/go-openapi/jsonpointer/jsonname/name_provider.go index 9f5da7a016..1bec2406b5 100644 --- a/vendor/github.com/go-openapi/swag/jsonname/name_provider.go +++ b/vendor/github.com/go-openapi/jsonpointer/jsonname/name_provider.go @@ -10,12 +10,12 @@ import ( ) // DefaultJSONNameProvider is the default cache for types. -var DefaultJSONNameProvider = NewNameProvider() +var DefaultJSONNameProvider = NewNameProvider() //nolint:gochecknoglobals // default settings, for backward compatible package-level settings var _ providerIface = (*NameProvider)(nil) -// NameProvider represents an object capable of translating from go property names -// to json property names. +// NameProvider represents an object capable of translating from go property names to json property +// names. // // This type is thread-safe. // @@ -30,7 +30,7 @@ type nameIndex struct { goNames map[string]string } -// NewNameProvider creates a new name provider +// NewNameProvider creates a new name provider. func NewNameProvider() *NameProvider { return &NameProvider{ lock: &sync.Mutex{}, @@ -39,7 +39,7 @@ func NewNameProvider() *NameProvider { } func buildnameIndex(tpe reflect.Type, idx, reverseIdx map[string]string) { - for i := 0; i < tpe.NumField(); i++ { + for i := range tpe.NumField() { targetDes := tpe.Field(i) if targetDes.PkgPath != "" { // unexported @@ -73,14 +73,14 @@ func buildnameIndex(tpe reflect.Type, idx, reverseIdx map[string]string) { } func newNameIndex(tpe reflect.Type) nameIndex { - var idx = make(map[string]string, tpe.NumField()) - var reverseIdx = make(map[string]string, tpe.NumField()) + idx := make(map[string]string, tpe.NumField()) + reverseIdx := make(map[string]string, tpe.NumField()) buildnameIndex(tpe, idx, reverseIdx) return nameIndex{jsonNames: idx, goNames: reverseIdx} } -// GetJSONNames gets all the json property names for a type +// GetJSONNames gets all the json property names for a type. func (n *NameProvider) GetJSONNames(subject any) []string { n.lock.Lock() defer n.lock.Unlock() @@ -97,13 +97,13 @@ func (n *NameProvider) GetJSONNames(subject any) []string { return res } -// GetJSONName gets the json name for a go property name +// GetJSONName gets the json name for a go property name. func (n *NameProvider) GetJSONName(subject any, name string) (string, bool) { tpe := reflect.Indirect(reflect.ValueOf(subject)).Type() return n.GetJSONNameForType(tpe, name) } -// GetJSONNameForType gets the json name for a go property name on a given type +// GetJSONNameForType gets the json name for a go property name on a given type. func (n *NameProvider) GetJSONNameForType(tpe reflect.Type, name string) (string, bool) { n.lock.Lock() defer n.lock.Unlock() @@ -115,13 +115,13 @@ func (n *NameProvider) GetJSONNameForType(tpe reflect.Type, name string) (string return nme, ok } -// GetGoName gets the go name for a json property name +// GetGoName gets the go name for a json property name. func (n *NameProvider) GetGoName(subject any, name string) (string, bool) { tpe := reflect.Indirect(reflect.ValueOf(subject)).Type() return n.GetGoNameForType(tpe, name) } -// GetGoNameForType gets the go name for a given type for a json property name +// GetGoNameForType gets the go name for a given type for a json property name. func (n *NameProvider) GetGoNameForType(tpe reflect.Type, name string) (string, bool) { n.lock.Lock() defer n.lock.Unlock() diff --git a/vendor/github.com/go-openapi/jsonpointer/options.go b/vendor/github.com/go-openapi/jsonpointer/options.go index d52caab222..223c1e5ff0 100644 --- a/vendor/github.com/go-openapi/jsonpointer/options.go +++ b/vendor/github.com/go-openapi/jsonpointer/options.go @@ -6,7 +6,7 @@ package jsonpointer import ( "sync" - "github.com/go-openapi/swag/jsonname" + "github.com/go-openapi/jsonpointer/jsonname" ) // Option to tune the behavior of a JSON [Pointer]. @@ -25,9 +25,9 @@ var ( // // By default, the default provider is [jsonname.DefaultJSONNameProvider]. // -// It is safe to call concurrently with [Pointer.Get], [Pointer.Set], -// [GetForToken] and [SetForToken]. The typical usage is to call it once -// at initialization time. +// It is safe to call concurrently with [Pointer.Get], [Pointer.Set], [GetForToken] and +// [SetForToken]. +// The typical usage is to call it once at initialization time. // // A nil provider is ignored. func SetDefaultNameProvider(provider NameProvider) { @@ -41,16 +41,15 @@ func SetDefaultNameProvider(provider NameProvider) { defaultOptions.provider = provider } -// UseGoNameProvider sets the [NameProvider] as a package-level default -// to the alternative provider [jsonname.GoNameProvider], that covers a few areas -// not supported by the default name provider. +// UseGoNameProvider sets the [NameProvider] as a package-level default to the alternative provider +// [jsonname.GoNameProvider], that covers a few areas not supported by the default name provider. // // This implementation supports untagged exported fields and embedded types in go struct. // It follows strictly the behavior of the JSON standard library regarding field naming conventions. // -// It is safe to call concurrently with [Pointer.Get], [Pointer.Set], -// [GetForToken] and [SetForToken]. The typical usage is to call it once -// at initialization time. +// It is safe to call concurrently with [Pointer.Get], [Pointer.Set], [GetForToken] and +// [SetForToken]. +// The typical usage is to call it once at initialization time. func UseGoNameProvider() { SetDefaultNameProvider(jsonname.NewGoNameProvider()) } diff --git a/vendor/github.com/go-openapi/jsonpointer/pointer.go b/vendor/github.com/go-openapi/jsonpointer/pointer.go index 2369c1827e..05fc863ee6 100644 --- a/vendor/github.com/go-openapi/jsonpointer/pointer.go +++ b/vendor/github.com/go-openapi/jsonpointer/pointer.go @@ -34,7 +34,8 @@ const ( // // For struct s resolved by reflection, key mappings honor the conventional struct tag `json`. // -// Fields that do not specify a `json` tag, or specify an empty one, or are tagged as `json:"-"` are ignored. +// Fields that do not specify a `json` tag, or specify an empty one, or are tagged as `json:"-"` are +// ignored. // // # Limitations // @@ -61,23 +62,24 @@ func (p *Pointer) Get(document any, opts ...Option) (any, reflect.Kind, error) { return p.get(document, o.provider) } -// Set uses the pointer to set a value from a data type -// that represent a JSON document. +// Set uses the pointer to set a value from a data type that represent a JSON document. // // # Mutation contract // -// Set mutates the provided document in place whenever Go's type system allows -// it: when document is a map, a pointer, or when the targeted value is reached -// through an addressable ancestor (e.g. a struct field traversed via a pointer, -// a slice element). Callers that rely on this in-place behavior may continue -// to ignore the returned document. +// Set mutates the provided document in place whenever Go's type system allows it: when document is +// a map, a pointer, or when the targeted value is reached through an addressable ancestor (e.g. a +// struct field traversed via a pointer, a slice element). +// +// Callers that rely on this in-place behavior may continue to ignore the returned document. // // The returned document is only load-bearing when Set cannot mutate in place. -// This happens in one specific case: appending to a top-level slice passed by -// value (e.g. document of type []T rather than *[]T) via the RFC 6901 "-" -// terminal token. reflect.Append produces a new slice header that the library -// cannot rebind into the caller's variable; the updated document is returned -// instead. Pass *[]T if you want in-place rebind for that case as well. +// +// This happens in one specific case: appending to a top-level slice passed by value (e.g. document +// of type []T rather than *[]T) via the RFC 6901 "-" terminal token. reflect.Append produces a new +// slice header that the library cannot rebind into the caller's variable; the updated document is +// returned instead. +// +// Pass *[]T if you want in-place rebind for that case as well. // // See [ErrDashToken] for the semantics of the "-" token. func (p *Pointer) Set(document any, value any, opts ...Option) (any, error) { @@ -112,23 +114,23 @@ func (p *Pointer) String() string { return pointerSeparator + strings.Join(p.referenceTokens, pointerSeparator) } -// Offset returns the byte offset, in the raw JSON text of document, of the -// location referenced by this pointer's terminal token. +// Offset returns the byte offset, in the raw JSON text of document, of the location referenced by +// this pointer's terminal token. +// +// Unlike [Pointer.Get] and [Pointer.Set], which operate on a decoded Go value, Offset operates +// directly on the textual JSON source. // -// Unlike [Pointer.Get] and [Pointer.Set], which operate on a decoded Go value, -// Offset operates directly on the textual JSON source. It drives an -// [encoding/json.Decoder] over the string and stops at the terminal token, -// returning the position at which the decoder was about to read that token. +// It drives an [encoding/json.Decoder] over the string and stops at the terminal token, returning +// the position at which the decoder was about to read that token. // -// It is primarily intended for tooling that needs to map a pointer back to a -// region of the original source: reporting line/column for validation or -// parse diagnostics, extracting a sub-document by slicing the raw bytes, or -// highlighting the referenced span in an editor. +// It is primarily intended for tooling that needs to map a pointer back to a region of the original +// source: reporting line/column for validation or parse diagnostics, extracting a sub-document by +// slicing the raw bytes, or highlighting the referenced span in an editor. // // # Offset semantics // -// The meaning of the returned offset depends on whether the terminal token -// addresses an object property or an array element: +// The meaning of the returned offset depends on whether the terminal token addresses an object +// property or an array element: // // - Object property: the offset points to the first byte of the key (its // opening quote character), not to the associated value. For example, @@ -183,16 +185,15 @@ func (p *Pointer) Offset(document string) (int64, error) { return skipJSONSeparator(document, offset), nil } -// skipJSONSeparator advances offset past trailing JSON whitespace and at most -// one value separator (comma) in document, so the result points at the first -// byte of the next JSON token. +// skipJSONSeparator advances offset past trailing JSON whitespace and at most one value separator +// (comma) in document, so the result points at the first byte of the next JSON token. // -// The streaming decoder's InputOffset sits right after the most recently -// consumed token, which between values is the comma (or whitespace) — not -// the following token. Normalizing here keeps Offset's contract uniform: -// for both object keys and array elements, and regardless of position within -// the parent container, the returned offset always points at the first byte -// of the addressed token. +// The streaming decoder's InputOffset sits right after the most recently consumed token, which +// between values is the comma (or whitespace) — not the following token. +// +// Normalizing here keeps Offset's contract uniform: for both object keys and array elements, and +// regardless of position within the parent container, the returned offset always points at the +// first byte of the addressed token. func skipJSONSeparator(document string, offset int64) int64 { n := int64(len(document)) for offset < n && isJSONWhitespace(document[offset]) { @@ -279,14 +280,13 @@ func (p *Pointer) set(node, data any, nameProvider NameProvider) (any, error) { return p.setAt(node, p.referenceTokens, data, nameProvider) } -// setAt recursively walks the token list, setting the data at the terminal -// token and rebinding any new child reference (e.g. a slice header returned -// by an "-" append) into its parent on the way back up. +// setAt recursively walks the token list, setting the data at the terminal token and rebinding any +// new child reference (e.g. a slice header returned by an "-" append) into its parent on the way +// back up. // -// Returning the (possibly new) node at each level is what makes append work -// at any depth without requiring the caller to pass a pointer to the -// containing slice: the new slice header propagates up and each parent -// rebinds it via the appropriate kind-specific setter. +// Returning the (possibly new) node at each level is what makes append work at any depth without +// requiring the caller to pass a pointer to the containing slice: the new slice header propagates +// up and each parent rebinds it via the appropriate kind-specific setter. func (p *Pointer) setAt(node any, tokens []string, data any, nameProvider NameProvider) (any, error) { decodedToken := Unescape(tokens[0]) @@ -309,15 +309,14 @@ func (p *Pointer) setAt(node any, tokens []string, data any, nameProvider NamePr // rebindChild writes newChild back into node at decodedToken. // -// For cases where the child was already mutated in place (pointer aliasing, -// addressable slice elements) the rebind is a safe no-op. For cases where -// the child was returned by value (map entries holding a slice, slices -// reached through a non-addressable ancestor), the rebind propagates the -// new value into the parent. +// For cases where the child was already mutated in place (pointer aliasing, addressable slice +// elements) the rebind is a safe no-op. +// +// For cases where the child was returned by value (map entries holding a slice, slices reached +// through a non-addressable ancestor), the rebind propagates the new value into the parent. // -// Parents implementing [JSONPointable] are left alone: they took ownership -// of the child via JSONLookup and did not opt into a JSONSet-based rebind -// on intermediate tokens. +// Parents implementing [JSONPointable] are left alone: they took ownership of the child via +// JSONLookup and did not opt into a JSONSet-based rebind on intermediate tokens. func rebindChild(node any, decodedToken string, newChild any, nameProvider NameProvider) (any, error) { if _, ok := node.(JSONPointable); ok { return node, nil @@ -362,9 +361,9 @@ func rebindChild(node any, decodedToken string, newChild any, nameProvider NameP } } -// assignReflectValue assigns src into dst, unwrapping a pointer when dst -// expects the pointee type. This tolerates the pointer-wrapping performed -// by [typeFromValue] for addressable fields. +// assignReflectValue assigns src into dst, unwrapping a pointer when dst expects the pointee type. +// +// This tolerates the pointer-wrapping performed by [typeFromValue] for addressable fields. func assignReflectValue(dst reflect.Value, src any) { nv := reflect.ValueOf(src) if !nv.IsValid() { @@ -474,8 +473,8 @@ func GetForToken(document any, decodedToken string, opts ...Option) (any, reflec // SetForToken sets a value for a json pointer token 1 level deep. // -// See [Pointer.Set] for the mutation contract, in particular the handling of -// the RFC 6901 "-" token on slices. +// See [Pointer.Set] for the mutation contract, in particular the handling of the RFC 6901 "-" token +// on slices. func SetForToken(document any, decodedToken string, value any, opts ...Option) (any, error) { o := optionsWithDefaults(opts) @@ -586,10 +585,10 @@ func setSingleImpl(node, data any, decodedToken string, nameProvider NameProvide case reflect.Slice: if decodedToken == dashToken { - // RFC 6901 §4 / RFC 6902 append semantics: terminal "-" appends - // the value to the slice. We rebind in place when the slice is - // reachable via an addressable ancestor; otherwise we return the - // new slice header for the parent (or the public Set) to rebind. + // RFC 6901 §4 / RFC 6902 append semantics: terminal "-" appends the value to the slice. + // + // We rebind in place when the slice is reachable via an addressable ancestor; otherwise we + // return the new slice header for the parent (or the public Set) to rebind. value := reflect.ValueOf(data) elemType := rValue.Type().Elem() if !value.Type().AssignableTo(elemType) { @@ -650,8 +649,8 @@ func offsetSingleObject(dec *json.Decoder, decodedToken string) (int64, error) { return offset, nil } - // Consume the associated value. Scalars are fully read by a single - // Token() call; composite values must be drained. + // Consume the associated value. + // Scalars are fully read by a single Token() call; composite values must be drained. tk, err = dec.Token() if err != nil { return 0, err @@ -736,10 +735,7 @@ func drainSingle(dec *json.Decoder) error { return nil } -// JSON pointer encoding: -// ~0 => ~ -// ~1 => / -// ... and vice versa +// JSON pointer encoding: ~0 => ~ ~1 => / ... and vice versa. const ( encRefTok0 = `~0` diff --git a/vendor/github.com/go-openapi/jsonreference/.gitignore b/vendor/github.com/go-openapi/jsonreference/.gitignore index 885dc27ab0..d8f4186fe5 100644 --- a/vendor/github.com/go-openapi/jsonreference/.gitignore +++ b/vendor/github.com/go-openapi/jsonreference/.gitignore @@ -3,4 +3,3 @@ .idea .env .mcp.json -.claude/ diff --git a/vendor/github.com/go-openapi/jsonreference/CONTRIBUTORS.md b/vendor/github.com/go-openapi/jsonreference/CONTRIBUTORS.md index 7faeb83a77..d20737c946 100644 --- a/vendor/github.com/go-openapi/jsonreference/CONTRIBUTORS.md +++ b/vendor/github.com/go-openapi/jsonreference/CONTRIBUTORS.md @@ -4,18 +4,18 @@ | Total Contributors | Total Contributions | | --- | --- | -| 9 | 73 | +| 9 | 83 | | Username | All Time Contribution Count | All Commits | | --- | --- | --- | -| @fredbi | 36 | https://github.com/go-openapi/jsonreference/commits?author=fredbi | -| @casualjim | 25 | https://github.com/go-openapi/jsonreference/commits?author=casualjim | -| @youyuanwu | 5 | https://github.com/go-openapi/jsonreference/commits?author=youyuanwu | -| @olivierlemasle | 2 | https://github.com/go-openapi/jsonreference/commits?author=olivierlemasle | -| @apelisse | 1 | https://github.com/go-openapi/jsonreference/commits?author=apelisse | -| @gbjk | 1 | https://github.com/go-openapi/jsonreference/commits?author=gbjk | -| @honza | 1 | https://github.com/go-openapi/jsonreference/commits?author=honza | -| @Neo2308 | 1 | https://github.com/go-openapi/jsonreference/commits?author=Neo2308 | -| @erraggy | 1 | https://github.com/go-openapi/jsonreference/commits?author=erraggy | +| @fredbi | 46 | | +| @casualjim | 25 | | +| @youyuanwu | 5 | | +| @olivierlemasle | 2 | | +| @apelisse | 1 | | +| @gbjk | 1 | | +| @honza | 1 | | +| @Neo2308 | 1 | | +| @erraggy | 1 | | - _this file was generated by the [Contributors GitHub Action](https://github.com/github/contributors)_ + _this file was generated by the [Contributors GitHub Action](https://github.com/github-community-projects/contributors)_ diff --git a/vendor/github.com/go-openapi/jsonreference/README.md b/vendor/github.com/go-openapi/jsonreference/README.md index adea160619..fbd16cf892 100644 --- a/vendor/github.com/go-openapi/jsonreference/README.md +++ b/vendor/github.com/go-openapi/jsonreference/README.md @@ -16,13 +16,8 @@ An implementation of JSON Reference for golang. ## Announcements -* **2025-12-19** : new community chat on discord - * a new discord community channel is available to be notified of changes and support users - * our venerable Slack channel remains open, and will be eventually discontinued on **2026-03-31** - -You may join the discord community by clicking the invite link on the discord badge (also above). [![Discord Channel][discord-badge]][discord-url] - -Or join our Slack channel: [![Slack Channel][slack-logo]![slack-badge]][slack-url] +* **2026-07-07** : landing v1.0.0 + * stable API pledge ## Status @@ -74,9 +69,9 @@ on top of which it has been built. ## Other documentation * [All-time contributors](./CONTRIBUTORS.md) -* [Contributing guidelines](.github/CONTRIBUTING.md) -* [Maintainers documentation](docs/MAINTAINERS.md) -* [Code style](docs/STYLE.md) +* [Contributing guidelines][contributing-doc-site] +* [Maintainers documentation][maintainers-doc-site] +* [Code style][style-doc-site] ## Cutting a new release @@ -111,11 +106,8 @@ Maintainers can cut a new release by either: [doc-url]: https://goswagger.io/go-openapi [godoc-badge]: https://pkg.go.dev/badge/github.com/go-openapi/jsonreference [godoc-url]: http://pkg.go.dev/github.com/go-openapi/jsonreference -[slack-logo]: https://a.slack-edge.com/e6a93c1/img/icons/favicon-32.png -[slack-badge]: https://img.shields.io/badge/slack-blue?link=https%3A%2F%2Fgoswagger.slack.com%2Farchives%2FC04R30YM -[slack-url]: https://goswagger.slack.com/archives/C04R30YMU [discord-badge]: https://img.shields.io/discord/1446918742398341256?logo=discord&label=discord&color=blue -[discord-url]: https://discord.gg/twZ9BwT3 +[discord-url]: https://discord.gg/FfnFYaC3k5 [license-badge]: http://img.shields.io/badge/license-Apache%20v2-orange.svg @@ -125,3 +117,7 @@ Maintainers can cut a new release by either: [goversion-url]: https://github.com/go-openapi/jsonreference/blob/master/go.mod [top-badge]: https://img.shields.io/github/languages/top/go-openapi/jsonreference [commits-badge]: https://img.shields.io/github/commits-since/go-openapi/jsonreference/latest + +[contributing-doc-site]: https://go-openapi.github.io/doc-site/contributing/contributing/index.html +[maintainers-doc-site]: https://go-openapi.github.io/doc-site/maintainers/index.html +[style-doc-site]: https://go-openapi.github.io/doc-site/contributing/style/index.html diff --git a/vendor/github.com/go-openapi/swag/.gitignore b/vendor/github.com/go-openapi/swag/.gitignore index 1680db44c0..3ceb596fa2 100644 --- a/vendor/github.com/go-openapi/swag/.gitignore +++ b/vendor/github.com/go-openapi/swag/.gitignore @@ -4,3 +4,4 @@ Godeps .idea *.out .mcp.json +.worktrees diff --git a/vendor/github.com/go-openapi/swag/.golangci.yml b/vendor/github.com/go-openapi/swag/.golangci.yml index 126264a6b8..099c0a78c6 100644 --- a/vendor/github.com/go-openapi/swag/.golangci.yml +++ b/vendor/github.com/go-openapi/swag/.golangci.yml @@ -14,7 +14,10 @@ linters: - gocognit - godot - godox + - goconst - gomoddirectives + - gomodguard + - gomodguard_v2 - gosmopolitan - inamedparam - intrange diff --git a/vendor/github.com/go-openapi/swag/CONTRIBUTORS.md b/vendor/github.com/go-openapi/swag/CONTRIBUTORS.md index 286878acff..0f0711cd5f 100644 --- a/vendor/github.com/go-openapi/swag/CONTRIBUTORS.md +++ b/vendor/github.com/go-openapi/swag/CONTRIBUTORS.md @@ -4,11 +4,11 @@ | Total Contributors | Total Contributions | | --- | --- | -| 24 | 242 | +| 24 | 251 | | Username | All Time Contribution Count | All Commits | | --- | --- | --- | -| @fredbi | 112 | | +| @fredbi | 121 | | | @casualjim | 98 | | | @alexandear | 4 | | | @orisano | 3 | | diff --git a/vendor/github.com/go-openapi/swag/README.md b/vendor/github.com/go-openapi/swag/README.md index 64f6671039..c6c2d21e94 100644 --- a/vendor/github.com/go-openapi/swag/README.md +++ b/vendor/github.com/go-openapi/swag/README.md @@ -34,12 +34,9 @@ You may also use it standalone for your projects. * **2025-12-19** : new community chat on discord * a new discord community channel is available to be notified of changes and support users - * our venerable Slack channel remains open, and will be eventually discontinued on **2026-03-31** You may join the discord community by clicking the invite link on the discord badge (also above). [![Discord Channel][discord-badge]][discord-url] -Or join our Slack channel: [![Slack Channel][slack-logo]![slack-badge]][slack-url] - ## Status API is stable. @@ -70,11 +67,12 @@ Child modules will continue to evolve and some new ones may be added in the futu | `cmdutils` | utilities to work with CLIs || | `conv` | type conversion utilities | convert between values and pointers for any types
convert from string to builtin types (wraps `strconv`)
require `./typeutils` (test dependency)
| | `fileutils` | file utilities | | -| `jsonname` | JSON utilities | infer JSON names from `go` properties
| +| `jsonname` | JSON utilities (deprecated) | infer JSON names from `go` properties
use `github.com/go-openapi/jsonpointer/jsonname` instead | | `jsonutils` | JSON utilities | fast json concatenation
read and write JSON from and to dynamic `go` data structures
~require `github.com/mailru/easyjson`~
| | `loading` | file loading | load from file or http
require `./yamlutils`
| | `mangling` | safe name generation | name mangling for `go`
| | `netutils` | networking utilities | host, port from address
| +| `pools` | utilities to work with sync.Pools | | | `stringutils` | `string` utilities | search in slice (with case-insensitive)
split/join query parameters as arrays
| | `typeutils` | `go` types utilities | check the zero value for any type
safe check for a nil value
| | `yamlutils` | YAML utilities | converting YAML to JSON
loading YAML into a dynamic YAML document
maintaining the original order of keys in YAML objects
require `./jsonutils`
~require `github.com/mailru/easyjson`~
require `go.yaml.in/yaml/v3`
| @@ -171,9 +169,9 @@ on top of which it has been built. ## Other documentation * [All-time contributors](./CONTRIBUTORS.md) -* [Contributing guidelines](.github/CONTRIBUTING.md) -* [Maintainers documentation](docs/MAINTAINERS.md) -* [Code style](docs/STYLE.md) +* [Contributing guidelines][contributing-doc-site] +* [Maintainers documentation][maintainers-doc-site] +* [Code style][style-doc-site] ## Cutting a new release @@ -208,9 +206,6 @@ Maintainers can cut a new release by either: [doc-url]: https://goswagger.io/go-openapi [godoc-badge]: https://pkg.go.dev/badge/github.com/go-openapi/swag [godoc-url]: http://pkg.go.dev/github.com/go-openapi/swag -[slack-logo]: https://a.slack-edge.com/e6a93c1/img/icons/favicon-32.png -[slack-badge]: https://img.shields.io/badge/slack-blue?link=https%3A%2F%2Fgoswagger.slack.com%2Farchives%2FC04R30YM -[slack-url]: https://goswagger.slack.com/archives/C04R30YMU [discord-badge]: https://img.shields.io/discord/1446918742398341256?logo=discord&label=discord&color=blue [discord-url]: https://discord.gg/FfnFYaC3k5 @@ -222,3 +217,7 @@ Maintainers can cut a new release by either: [goversion-url]: https://github.com/go-openapi/swag/blob/master/go.mod [top-badge]: https://img.shields.io/github/languages/top/go-openapi/swag [commits-badge]: https://img.shields.io/github/commits-since/go-openapi/swag/latest + +[contributing-doc-site]: https://go-openapi.github.io/doc-site/contributing/contributing/index.html +[maintainers-doc-site]: https://go-openapi.github.io/doc-site/maintainers/index.html +[style-doc-site]: https://go-openapi.github.io/doc-site/contributing/style/index.html diff --git a/vendor/github.com/go-openapi/swag/go.work b/vendor/github.com/go-openapi/swag/go.work index 8537cb2a76..f1dddc436e 100644 --- a/vendor/github.com/go-openapi/swag/go.work +++ b/vendor/github.com/go-openapi/swag/go.work @@ -12,6 +12,7 @@ use ( ./loading ./mangling ./netutils + ./pools ./stringutils ./typeutils ./yamlutils diff --git a/vendor/github.com/go-openapi/swag/jsonname_iface.go b/vendor/github.com/go-openapi/swag/jsonname_iface.go index 303a007f6f..443560caad 100644 --- a/vendor/github.com/go-openapi/swag/jsonname_iface.go +++ b/vendor/github.com/go-openapi/swag/jsonname_iface.go @@ -4,21 +4,21 @@ package swag import ( - "github.com/go-openapi/swag/jsonname" + "github.com/go-openapi/jsonpointer/jsonname" ) // DefaultJSONNameProvider is the default cache for types // -// Deprecated: use [jsonname.DefaultJSONNameProvider] instead. +// Deprecated: use [github.com/go-openapi/jsonpointer/jsonname.DefaultJSONNameProvider] instead. var DefaultJSONNameProvider = jsonname.DefaultJSONNameProvider // NameProvider represents an object capable of translating from go property names // to json property names. // -// Deprecated: use [jsonname.NameProvider] instead. +// Deprecated: use [github.com/go-openapi/jsonpointer/jsonname.NameProvider] instead. type NameProvider = jsonname.NameProvider // NewNameProvider creates a new name provider // -// Deprecated: use [jsonname.NewNameProvider] instead. +// Deprecated: use [github.com/go-openapi/jsonpointer/jsonname.NewNameProvider] instead. func NewNameProvider() *NameProvider { return jsonname.NewNameProvider() } diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/adapter.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/adapter.go index 0213ff5c29..94185f79c1 100644 --- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/adapter.go +++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/adapter.go @@ -5,6 +5,7 @@ package json import ( stdjson "encoding/json" + "fmt" "github.com/go-openapi/swag/jsonutils/adapters/ifaces" "github.com/go-openapi/swag/typeutils" @@ -24,11 +25,16 @@ var ErrStdlib jsonError = "error from the JSON adapter stdlib" var _ ifaces.Adapter = &Adapter{} type Adapter struct { + options } // NewAdapter yields an [ifaces.Adapter] using the standard library. -func NewAdapter() *Adapter { - return &Adapter{} +func NewAdapter(opts ...Option) *Adapter { + var o options + + return &Adapter{ + options: buildOptions(o, opts), + } } func (a *Adapter) Marshal(value any) ([]byte, error) { @@ -40,45 +46,18 @@ func (a *Adapter) Unmarshal(data []byte, value any) error { } func (a *Adapter) OrderedMarshal(value ifaces.Ordered) ([]byte, error) { - w := poolOfWriters.Borrow() - defer func() { - poolOfWriters.Redeem(w) - }() - - if typeutils.IsNil(value) { - w.RawString("null") - - return w.BuildBytes() - } - - w.RawByte('{') - first := true - for k, v := range value.OrderedItems() { - if first { - first = false - } else { - w.RawByte(',') - } + w, redeem := poolOfWriters.BorrowWithRedeem() + defer redeem() + w.setBuf() - w.String(k) - w.RawByte(':') - - switch val := v.(type) { - case ifaces.Ordered: - w.Raw(a.OrderedMarshal(val)) - default: - w.Raw(stdjson.Marshal(v)) - } - } - - w.RawByte('}') + a.orderedMarshal(w, value, 1) return w.BuildBytes() } func (a *Adapter) OrderedUnmarshal(data []byte, value ifaces.SetOrdered) error { var m MapSlice - if err := m.OrderedUnmarshalJSON(data); err != nil { + if err := m.orderedUnmarshalJSON(data, a.maxDepth()); err != nil { return err } @@ -112,4 +91,43 @@ func (a *Adapter) Redeem() { } func (a *Adapter) Reset() { + a.options = options{} +} + +// orderedMarshal writes value to w, tracking the container nesting depth to guard +// against stack overflow on deeply nested structures. +func (a *Adapter) orderedMarshal(w *jwriter, value ifaces.Ordered, depth int) { + if typeutils.IsNil(value) { + w.RawString("null") + + return + } + + if maxDepth := a.maxDepth(); depth > maxDepth { + w.SetErr(fmt.Errorf("maximum nesting depth of %d exceeded: %w", maxDepth, ErrStdlib)) + + return + } + + w.RawByte('{') + first := true + for k, v := range value.OrderedItems() { + if first { + first = false + } else { + w.RawByte(',') + } + + w.String(k) + w.RawByte(':') + + switch val := v.(type) { + case ifaces.Ordered: + a.orderedMarshal(w, val, depth+1) + default: + w.Raw(stdjson.Marshal(v)) + } + } + + w.RawByte('}') } diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/lexer.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/lexer.go index b5aa1c7972..ac81cbc75f 100644 --- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/lexer.go +++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/lexer.go @@ -54,7 +54,7 @@ func (t token) Delim() byte { return 0 } - return byte(r) + return byte(r) //nolint:gosec // delimiter runes are single byte } type tokenKind uint8 @@ -91,6 +91,13 @@ type jlexer struct { // current token next token // started bool + + // depth tracks the current JSON container nesting level, and maxDepth caps it + // to guard against stack-overflow on adversarially deep documents. The standard + // library's streaming [encoding/json.Decoder.Token] API (used here) does not + // enforce the max-depth guard that [encoding/json.Unmarshal] provides, so we do. + depth int + maxDepth int } type bytesReader struct { @@ -130,7 +137,8 @@ var _ io.Reader = &bytesReader{} func newLexer(data []byte) *jlexer { l := &jlexer{ // current: undefToken, - next: undefToken, + next: undefToken, + maxDepth: defaultMaxNestingDepth, } l.buf = &bytesReader{ buf: data, @@ -143,7 +151,11 @@ func newLexer(data []byte) *jlexer { func (l *jlexer) Reset() { l.err = nil l.next = undefToken - // leave l.dec and l.buf alone, since they are replaced at every Borrow + l.depth = 0 + l.maxDepth = defaultMaxNestingDepth + l.dec = nil + // leave l.buf alone, since they are replaced at every Borrow + l.buf = nil } func (l *jlexer) Error() error { @@ -228,6 +240,21 @@ func (l *jlexer) Delim(c byte) { if tok.Delim() != c { l.err = fmt.Errorf("expected delimiter '%q' but got '%q': %w", c, tok.Delim(), ErrStdlib) + + return + } + + // Track container nesting depth centrally: every '{' or '[' opens a level and + // every '}' or ']' closes one. This guards the mutually-recursive unmarshal + // routines (unmarshalObject/unmarshalArray/asInterface) against stack overflow. + switch c { + case '{', '[': + l.depth++ + if l.maxDepth > 0 && l.depth > l.maxDepth { + l.err = fmt.Errorf("maximum nesting depth of %d exceeded: %w", l.maxDepth, ErrStdlib) + } + case '}', ']': + l.depth-- } } @@ -318,3 +345,12 @@ func (l *jlexer) fetchToken() token { return token{Token: jtok} } + +func (l *jlexer) setBuf(data []byte) func() { + rdr, redeemBuf := poolOfReaders.BorrowWithRedeem() + l.buf = rdr + l.buf.buf = data + l.dec = stdjson.NewDecoder(l.buf) // cannot pool, not exposed by the encoding/json API + + return redeemBuf +} diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/options.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/options.go new file mode 100644 index 0000000000..f114f1f1a1 --- /dev/null +++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/options.go @@ -0,0 +1,52 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + +package json + +// defaultMaxNestingDepth is the default maximum number of nested JSON containers +// ('{' or '[') that the ordered-JSON marshaler and unmarshaler will process before +// returning an error. +// +// It mirrors the limit enforced by the standard library's [encoding/json] decoder +// (see encoding/json's internal maxNestingDepth), which this adapter would otherwise +// not benefit from since it drives [encoding/json.Decoder.Token] directly. +const defaultMaxNestingDepth = 10000 + +// Option selects options for the stdlib adapter. +type Option func(o options) options + +type options struct { + maxNestingDepth int +} + +func buildOptions(o options, opts []Option) options { + for _, apply := range opts { + o = apply(o) + } + + return o +} + +// maxDepth returns the configured maximum nesting depth, or the default when unset. +func (o options) maxDepth() int { + if o.maxNestingDepth <= 0 { + return defaultMaxNestingDepth + } + + return o.maxNestingDepth +} + +// WithMaxNestingDepth sets the maximum number of nested JSON containers accepted +// when marshaling or unmarshaling ordered JSON. +// +// A value <= 0 selects the default (10,000). +// +// This guards against stack-overflow crashes on deeply nested (possibly adversarial) +// JSON documents or in-memory structures. +func WithMaxNestingDepth(depth int) Option { + return func(o options) options { + o.maxNestingDepth = depth + + return o + } +} diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/ordered_map.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/ordered_map.go index 54deef406f..a5a8f4b631 100644 --- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/ordered_map.go +++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/ordered_map.go @@ -70,12 +70,11 @@ func (s MapSlice) MarshalJSON() ([]byte, error) { } func (s MapSlice) OrderedMarshalJSON() ([]byte, error) { - w := poolOfWriters.Borrow() - defer func() { - poolOfWriters.Redeem(w) - }() + w, redeem := poolOfWriters.BorrowWithRedeem() + defer redeem() + w.setBuf() - s.marshalObject(w) + s.marshalObject(w, 1) return w.BuildBytes() // this clones data, so it's okay to redeem the writer and its buffer } @@ -88,23 +87,38 @@ func (s *MapSlice) UnmarshalJSON(data []byte) error { } func (s *MapSlice) OrderedUnmarshalJSON(data []byte) error { - l := poolOfLexers.Borrow(data) - defer func() { - poolOfLexers.Redeem(l) - }() + return s.orderedUnmarshalJSON(data, defaultMaxNestingDepth) +} + +func (s *MapSlice) orderedUnmarshalJSON(data []byte, maxDepth int) error { + l, redeem := poolOfLexers.BorrowWithRedeem() + defer redeem() + + redeemBuf := l.setBuf(data) + defer redeemBuf() + + if maxDepth > 0 { + l.maxDepth = maxDepth + } s.unmarshalObject(l) return l.Error() } -func (s MapSlice) marshalObject(w *jwriter) { +func (s MapSlice) marshalObject(w *jwriter, depth int) { if s == nil { w.RawString("null") return } + if depth > defaultMaxNestingDepth { + w.SetErr(fmt.Errorf("maximum nesting depth of %d exceeded: %w", defaultMaxNestingDepth, ErrStdlib)) + + return + } + w.RawByte('{') if len(s) == 0 { @@ -113,11 +127,11 @@ func (s MapSlice) marshalObject(w *jwriter) { return } - s[0].marshalJSON(w) + s[0].marshalJSON(w, depth) for i := 1; i < len(s); i++ { w.RawByte(',') - s[i].marshalJSON(w) + s[i].marshalJSON(w, depth) } w.RawByte('}') @@ -162,9 +176,18 @@ type MapItem struct { Value any } -func (s MapItem) marshalJSON(w *jwriter) { +func (s MapItem) marshalJSON(w *jwriter, depth int) { w.String(s.Key) w.RawByte(':') + + // Recurse internally for nested ordered maps so the depth guard is not lost across + // the stdjson.Marshal boundary (which would reset it and re-enable stack overflow). + if nested, ok := s.Value.(MapSlice); ok { + nested.marshalObject(w, depth+1) + + return + } + w.Raw(stdjson.Marshal(s.Value)) } diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/pool.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/pool.go index 709b97c304..2f06b88e80 100644 --- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/pool.go +++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/pool.go @@ -4,118 +4,15 @@ package json import ( - "encoding/json" - "sync" - "github.com/go-openapi/swag/jsonutils/adapters/ifaces" + "github.com/go-openapi/swag/pools" ) -type adaptersPool struct { - sync.Pool -} - -func (p *adaptersPool) Borrow() *Adapter { - return p.Get().(*Adapter) -} - -func (p *adaptersPool) BorrowIface() ifaces.Adapter { - return p.Get().(*Adapter) -} - -func (p *adaptersPool) Redeem(a *Adapter) { - p.Put(a) -} - -type writersPool struct { - sync.Pool -} - -func (p *writersPool) Borrow() *jwriter { - ptr := p.Get() - - jw := ptr.(*jwriter) - jw.Reset() - - return jw -} - -func (p *writersPool) Redeem(w *jwriter) { - p.Put(w) -} - -type lexersPool struct { - sync.Pool -} - -func (p *lexersPool) Borrow(data []byte) *jlexer { - ptr := p.Get() - - l := ptr.(*jlexer) - l.buf = poolOfReaders.Borrow(data) - l.dec = json.NewDecoder(l.buf) // cannot pool, not exposed by the encoding/json API - l.Reset() - - return l -} - -func (p *lexersPool) Redeem(l *jlexer) { - l.dec = nil - discard := l.buf - l.buf = nil - poolOfReaders.Redeem(discard) - p.Put(l) -} - -type readersPool struct { - sync.Pool -} - -func (p *readersPool) Borrow(data []byte) *bytesReader { - ptr := p.Get() - - b := ptr.(*bytesReader) - b.Reset() - b.buf = data - - return b -} - -func (p *readersPool) Redeem(b *bytesReader) { - p.Put(b) -} - var ( - poolOfAdapters = &adaptersPool{ - Pool: sync.Pool{ - New: func() any { - return NewAdapter() - }, - }, - } - - poolOfWriters = &writersPool{ - Pool: sync.Pool{ - New: func() any { - return newJWriter() - }, - }, - } - - poolOfLexers = &lexersPool{ - Pool: sync.Pool{ - New: func() any { - return newLexer(nil) - }, - }, - } - - poolOfReaders = &readersPool{ - Pool: sync.Pool{ - New: func() any { - return &bytesReader{} - }, - }, - } + poolOfAdapters = pools.New[Adapter]() + poolOfWriters = pools.NewRedeemable[jwriter]() + poolOfLexers = pools.NewRedeemable[jlexer]() + poolOfReaders = pools.NewRedeemable[bytesReader]() ) // BorrowAdapter borrows an [Adapter] from the pool, recycling already allocated instances. @@ -124,10 +21,12 @@ func BorrowAdapter() *Adapter { } // BorrowAdapterIface borrows a stdlib [Adapter] and converts it directly -// to [ifaces.Adapter]. This is useful to avoid further allocations when -// translating the concrete type into an interface. +// to [ifaces.Adapter]. +// +// This is useful to avoid further allocations when translating the concrete type into +// an interface. func BorrowAdapterIface() ifaces.Adapter { - return poolOfAdapters.BorrowIface() + return poolOfAdapters.Borrow() } // RedeemAdapter redeems an [Adapter] to the pool, so it may be recycled. diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/register.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/register.go index fc8818694e..0dec85425b 100644 --- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/register.go +++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/register.go @@ -10,14 +10,22 @@ import ( "github.com/go-openapi/swag/jsonutils/adapters/ifaces" ) -func Register(dispatcher ifaces.Registrar) { +func Register(dispatcher ifaces.Registrar, opts ...Option) { t := reflect.TypeOf(Adapter{}) + var o options + o = buildOptions(o, opts) + dispatcher.RegisterFor( ifaces.RegistryEntry{ - Who: fmt.Sprintf("%s.%s", t.PkgPath(), t.Name()), - What: ifaces.AllCapabilities, - Constructor: BorrowAdapterIface, - Support: support, + Who: fmt.Sprintf("%s.%s", t.PkgPath(), t.Name()), + What: ifaces.AllCapabilities, + Constructor: func() ifaces.Adapter { + a := BorrowAdapter() + a.options = o + + return a + }, + Support: support, }) } diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/writer.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/writer.go index dc2325c1a3..c84e02cd83 100644 --- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/writer.go +++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/writer.go @@ -14,17 +14,21 @@ type jwriter struct { err error } -func newJWriter() *jwriter { - buf := make([]byte, 0, sensibleBufferSize) - - return &jwriter{buf: bytes.NewBuffer(buf)} -} - func (w *jwriter) Reset() { - w.buf.Reset() + if w.buf != nil { + w.buf.Reset() + } w.err = nil } +// SetErr records the first error encountered while building the JSON output. +func (w *jwriter) SetErr(err error) { + if w.err != nil { + return + } + w.err = err +} + func (w *jwriter) RawString(s string) { if w.err != nil { return @@ -73,3 +77,12 @@ func (w *jwriter) BuildBytes() ([]byte, error) { return bytes.Clone(w.buf.Bytes()), nil } + +func (w *jwriter) setBuf() { + if w.buf != nil { + return + } + + buf := make([]byte, 0, sensibleBufferSize) + w.buf = bytes.NewBuffer(buf) +} diff --git a/vendor/github.com/go-openapi/swag/loading/doc.go b/vendor/github.com/go-openapi/swag/loading/doc.go index 8cf7bcb8b9..112c49968b 100644 --- a/vendor/github.com/go-openapi/swag/loading/doc.go +++ b/vendor/github.com/go-openapi/swag/loading/doc.go @@ -2,4 +2,28 @@ // SPDX-License-Identifier: Apache-2.0 // Package loading provides tools to load a file from http or from a local file system. +// +// # Security +// +// By default, the local loader reads any path the process can access, including absolute +// paths and "file://" URIs (for example "file:///etc/passwd"). Applications that pass +// untrusted input to [LoadFromFileOrHTTP], [JSONDoc] (or to downstream consumers such as +// go-openapi/loads) must confine local loading to a trusted directory. +// +// Use [WithRoot] to do so: it resolves every requested path relative to a chosen directory +// and rejects anything that escapes it, including via symlink. It is built on [os.Root] +// and is therefore safer than passing an [os.DirFS] to [WithFS], which does not block +// symlink escapes. +// +// Remote loading uses a standard [net/http] client. +// By default it follows redirects and performs no destination filtering — exactly like [net/http.DefaultClient]. +// +// A caller-controlled URL may therefore reach internal services or cloud metadata endpoints +// (server-side request forgery). +// +// This package does not, and should not, embed a network policy: +// when the URL may derive from untrusted input, supply a restricted client with +// [WithHTTPClient] whose transport rejects unwanted destinations at dial time — which also +// covers redirects and DNS rebinding. +// See the example on [LoadFromFileOrHTTP]. package loading diff --git a/vendor/github.com/go-openapi/swag/loading/loading.go b/vendor/github.com/go-openapi/swag/loading/loading.go index 269fb74d16..0b38ac1e38 100644 --- a/vendor/github.com/go-openapi/swag/loading/loading.go +++ b/vendor/github.com/go-openapi/swag/loading/loading.go @@ -17,7 +17,11 @@ import ( "strings" ) -// LoadFromFileOrHTTP loads the bytes from a file or a remote http server based on the path passed in +// LoadFromFileOrHTTP loads the bytes from a file or a remote http server based on the path passed in. +// +// Security: by default a local path is read with no confinement, so a caller-controlled path +// (including a "file://" URI or an absolute path) may read any file the process can access. +// When the path may derive from untrusted input, confine local loading with [WithRoot]. func LoadFromFileOrHTTP(pth string, opts ...Option) ([]byte, error) { o := optionsWithDefaults(opts) return LoadStrategy(pth, o.ReadFileFunc(), loadHTTPBytes(opts...), opts...)(pth) @@ -54,11 +58,14 @@ func LoadFromFileOrHTTP(pth string, opts ...Option) ([]byte, error) { // - `file:///c:/folder/file` becomes `C:\folder\file` // - `file://c:/folder/file` is tolerated (without leading `/`) and becomes `c:\folder\file` func LoadStrategy(pth string, local, remote func(string) ([]byte, error), opts ...Option) func(string) ([]byte, error) { - if strings.HasPrefix(pth, "http") { + if hasHTTPScheme(pth) { return remote } o := optionsWithDefaults(opts) _, isEmbedFS := o.fs.(embed.FS) + // any loader backed by an fs.FS or an os.Root consumes forward-slash paths on every + // platform, so it must not go through the windows-native file:// preprocessing below. + isFSBacked := o.fs != nil || o.root != "" return func(p string) ([]byte, error) { upth, err := url.PathUnescape(p) @@ -67,14 +74,20 @@ func LoadStrategy(pth string, local, remote func(string) ([]byte, error), opts . } cpth, hasPrefix := strings.CutPrefix(upth, "file://") - if !hasPrefix || isEmbedFS || runtime.GOOS != "windows" { + if !hasPrefix || isFSBacked || runtime.GOOS != "windows" { // crude processing: trim the file:// prefix. This leaves full URIs with a host with a (mostly) unexpected result // regular file path provided: just normalize slashes if isEmbedFS { - // on windows, we need to slash the path if FS is an embed FS. + // embed.FS always uses "/" as separator, even on windows, and rejects leading "./" or "/". return local(strings.TrimLeft(filepath.ToSlash(cpth), "./")) // remove invalid leading characters for embed FS } + if isFSBacked { + // other fs.FS (e.g. os.DirFS) and os.Root loaders also use "/" on every platform. + // Escaping paths (absolute, "..", escaping symlinks) are rejected by the loader, not rewritten here. + return local(filepath.ToSlash(cpth)) + } + return local(filepath.FromSlash(cpth)) } @@ -113,6 +126,21 @@ func LoadStrategy(pth string, local, remote func(string) ([]byte, error), opts . } } +// hasHTTPScheme reports whether pth is an absolute URL with an http or https scheme, +// selecting the remote loader. The comparison is case-insensitive, as URL schemes are. +// +// Requiring the "://" separator (rather than a bare "http" prefix) avoids misrouting a +// local file whose name merely starts with "http" (e.g. "httpbin.json") to the remote loader. +func hasHTTPScheme(pth string) bool { + for _, scheme := range [...]string{"http://", "https://"} { + if len(pth) >= len(scheme) && strings.EqualFold(pth[:len(scheme)], scheme) { + return true + } + } + + return false +} + func loadHTTPBytes(opts ...Option) func(path string) ([]byte, error) { o := optionsWithDefaults(opts) diff --git a/vendor/github.com/go-openapi/swag/loading/options.go b/vendor/github.com/go-openapi/swag/loading/options.go index 6674ac69e6..2c12823172 100644 --- a/vendor/github.com/go-openapi/swag/loading/options.go +++ b/vendor/github.com/go-openapi/swag/loading/options.go @@ -4,6 +4,7 @@ package loading import ( + "errors" "io/fs" "net/http" "os" @@ -23,7 +24,8 @@ type ( } fileOptions struct { - fs fs.ReadFileFS + fs fs.ReadFileFS + root string // when non-empty, local reads are confined to this directory via os.Root } options struct { @@ -33,6 +35,20 @@ type ( ) func (fo fileOptions) ReadFileFunc() func(string) ([]byte, error) { + if fo.root != "" { + root := fo.root + + return func(name string) ([]byte, error) { + r, err := os.OpenRoot(root) + if err != nil { + return nil, errors.Join(err, ErrLoader) + } + defer func() { _ = r.Close() }() + + return r.ReadFile(name) + } + } + if fo.fs == nil { return os.ReadFile } @@ -87,8 +103,15 @@ func WithHTTPClient(client *http.Client) Option { // By default, the file system is the one provided by the os package. // // For example, this may be set to consume from an embedded file system, or a rooted FS. +// +// WithFS and [WithRoot] are mutually exclusive: the last one applied wins. +// +// Security note: a file system built from [os.DirFS] confines paths but does NOT protect +// against symlinks that escape the root. To load from a directory derived from untrusted +// input, prefer [WithRoot], which is symlink-escape resistant. func WithFS(filesystem fs.FS) Option { return func(o *options) { + o.root = "" // last-wins vs WithRoot if rfs, ok := filesystem.(fs.ReadFileFS); ok { o.fs = rfs @@ -98,6 +121,28 @@ func WithFS(filesystem fs.FS) Option { } } +// WithRoot confines local file loading to dir. +// +// Every requested path is resolved relative to dir, and any path that would escape dir — +// whether through an absolute path, ".." traversal, or a symlink pointing outside dir — is +// rejected. This is built on [os.Root] and is therefore resistant to the symlink escapes +// that a plain [os.DirFS] does not prevent. +// +// WithRoot is the recommended option when loading specs from a location derived from +// untrusted input. It applies to local loading only and has no effect on remote +// (http/https) loading. WithRoot and [WithFS] are mutually exclusive: the last one applied +// wins. +// +// Note: [os.Root] confines path resolution but does not, by itself, protect against +// traversal of mount/bind boundaries, /proc special files, or device files. Point WithRoot +// at a directory that holds only the documents you intend to expose. +func WithRoot(dir string) Option { + return func(o *options) { + o.root = dir + o.fs = nil // last-wins vs WithFS + } +} + type readFileFS struct { fs.FS } diff --git a/vendor/github.com/go-openapi/swag/loading_iface.go b/vendor/github.com/go-openapi/swag/loading_iface.go index 27ec3fb8c3..78dadfccdf 100644 --- a/vendor/github.com/go-openapi/swag/loading_iface.go +++ b/vendor/github.com/go-openapi/swag/loading_iface.go @@ -80,11 +80,13 @@ func YAMLData(path string) (any, error) { // loadingOptionsWithDefaults bridges deprecated default settings that use package-level variables, // with the recommended use of loading.Option. func loadingOptionsWithDefaults(opts []loading.Option) []loading.Option { - o := []loading.Option{ + const defaultOptions = 3 + o := make([]loading.Option, 0, defaultOptions+len(opts)) + o = append(o, []loading.Option{ loading.WithTimeout(LoadHTTPTimeout), loading.WithBasicAuth(LoadHTTPBasicAuthUsername, LoadHTTPBasicAuthPassword), loading.WithCustomHeaders(LoadHTTPCustomHeaders), - } + }...) o = append(o, opts...) return o diff --git a/vendor/github.com/go-openapi/swag/jsonname/LICENSE b/vendor/github.com/go-openapi/swag/pools/LICENSE similarity index 100% rename from vendor/github.com/go-openapi/swag/jsonname/LICENSE rename to vendor/github.com/go-openapi/swag/pools/LICENSE diff --git a/vendor/github.com/go-openapi/swag/pools/README.md b/vendor/github.com/go-openapi/swag/pools/README.md new file mode 100644 index 0000000000..1966461cb5 --- /dev/null +++ b/vendor/github.com/go-openapi/swag/pools/README.md @@ -0,0 +1 @@ +# pools diff --git a/vendor/github.com/go-openapi/swag/pools/debug.go b/vendor/github.com/go-openapi/swag/pools/debug.go new file mode 100644 index 0000000000..94415e989e --- /dev/null +++ b/vendor/github.com/go-openapi/swag/pools/debug.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + +package pools + +// TB is the subset of [testing.TB] used by [AssertNoLeaks]. +// +// It is satisfied by *[testing.T] and *[testing.B]. +// +// A local interface is used (rather than importing "testing") so that the +// release build does not pull the testing package — and its flags — into +// production binaries. +type TB interface { + Helper() + Errorf(format string, args ...any) + Logf(format string, args ...any) +} diff --git a/vendor/github.com/go-openapi/swag/pools/debug_off.go b/vendor/github.com/go-openapi/swag/pools/debug_off.go new file mode 100644 index 0000000000..9163d6d60e --- /dev/null +++ b/vendor/github.com/go-openapi/swag/pools/debug_off.go @@ -0,0 +1,51 @@ +//go:build !poolsdebug + +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + +package pools + +// This is the release implementation of the pool instrumentation: it does +// nothing. +// +// tracker is an empty struct, so it adds no field to the pool types and its +// methods inline away to nothing. +// +// Build with -tags poolsdebug to get the instrumented variant (see +// debug_on.go). + +// debugBuild reports whether the pool instrumentation is compiled in (the +// poolsdebug tag). +const debugBuild = false + +// DebugBuild reports whether the pool instrumentation is compiled in (the +// poolsdebug build tag). +// +// It lets a test that must run in both modes skip the parts that are invalid +// under instrumentation — e.g. an allocation-count assertion, since the +// instrumented build allocates a per-borrow tracker. +const DebugBuild = debugBuild + +type tracker[T any] struct{} + +func (tracker[T]) register() {} + +func (tracker[T]) onBorrow(*T) {} + +func (tracker[T]) onRedeem(*T) {} + +func (tracker[T]) borrowRedeemer(_ *T, cached func()) func() { return cached } + +// AssertNoLeaks reports whether every borrowed object has been redeemed across +// all pools. +// +// It is only meaningful in the instrumented build (-tags poolsdebug). +// +// In a release build it is a no-op that always reports true, so the same test +// can run in both modes. +func AssertNoLeaks(TB) bool { return true } + +// ResetTracking clears all recorded borrow/redeem tracking. +// +// This is a no-op in a release build. +func ResetTracking() {} diff --git a/vendor/github.com/go-openapi/swag/pools/debug_on.go b/vendor/github.com/go-openapi/swag/pools/debug_on.go new file mode 100644 index 0000000000..64ccc57d38 --- /dev/null +++ b/vendor/github.com/go-openapi/swag/pools/debug_on.go @@ -0,0 +1,237 @@ +//go:build poolsdebug + +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + +package pools + +import ( + "fmt" + "runtime" + "sync" +) + +// This is the instrumented implementation of the pool tracking, enabled with +// -tags poolsdebug. +// +// Each pool carries a tracker that records, per recycled pointer, whether it is +// currently borrowed or redeemed, together with the call sites of the last +// borrow and redeem. +// It panics loudly (with those call sites) when it detects misuse: +// +// - a double redeem (the same object returned to the pool twice — corrupts sync.Pool); +// - for the redeemable pools, a redeem of a stale borrow (the slot was re-borrowed since — the +// ABA case the production atomic guard cannot catch), thanks to a per-borrow generation; +// - a redeem of an object the pool never handed out; +// - a borrow of an object still checked out (a symptom of an earlier double-Put). +// +// Borrowed-but-never-redeemed objects (leaks) are reported by [AssertNoLeaks]. + +// debugBuild reports whether the pool instrumentation is compiled in (the +// poolsdebug tag). +const debugBuild = true + +// DebugBuild reports whether the pool instrumentation is compiled in (the +// poolsdebug build tag). +// +// See the release-build doc for usage. +const DebugBuild = debugBuild + +type trackStatus uint8 + +const ( + trackBorrowed trackStatus = iota + 1 + trackRedeemed +) + +type trackEntry struct { + status trackStatus + gen uint64 // identifies the current borrow, to detect a redeem racing a re-borrow (ABA) + borrowedAt string + redeemedAt string +} + +type tracker[T any] struct { + mu sync.Mutex + entries map[*T]*trackEntry + nextGen uint64 +} + +func (t *tracker[T]) register() { + t.mu.Lock() + if t.entries == nil { + t.entries = make(map[*T]*trackEntry) + } + t.mu.Unlock() + + registerLeakChecker(t) +} + +// markBorrow records a borrow of ptr and returns its generation. +// +// Caller must hold no lock. +func (t *tracker[T]) markBorrow(ptr *T, site string) uint64 { + t.mu.Lock() + defer t.mu.Unlock() + + e := t.entries[ptr] + if e == nil { + e = &trackEntry{} + t.entries[ptr] = e + } else if e.status == trackBorrowed { + panic(fmt.Sprintf( + "pools: borrow of an object still checked out (borrowed at %s); "+ + "this usually means it was redeemed twice earlier", e.borrowedAt)) + } + + t.nextGen++ + e.status = trackBorrowed + e.gen = t.nextGen + e.borrowedAt = site + + return t.nextGen +} + +// markRedeem validates and records a redeem of ptr. gen is the borrow +// generation the caller is redeeming, or 0 to skip the ABA check (plain +// Pool[T], which has no per-borrow token). +func (t *tracker[T]) markRedeem(ptr *T, gen uint64, site string) { + t.mu.Lock() + defer t.mu.Unlock() + + e := t.entries[ptr] + switch { + case e == nil: + panic("pools: redeem of an object this pool never handed out") + case e.status != trackBorrowed: + panic(fmt.Sprintf("pools: double redeem (first redeemed at %s)", e.redeemedAt)) + case gen != 0 && e.gen != gen: + panic(fmt.Sprintf( + "pools: redeem of a stale borrow (the slot was re-borrowed at %s since this borrow); "+ + "a redeem is racing a re-borrow of the same slot (ABA)", e.borrowedAt)) + } + + e.status = trackRedeemed + e.redeemedAt = site +} + +const stackOffset = 3 + +func (t *tracker[T]) onBorrow(ptr *T) { + t.markBorrow(ptr, caller(stackOffset)) +} + +func (t *tracker[T]) onRedeem(ptr *T) { + t.markRedeem(ptr, 0, caller(stackOffset)) +} + +// borrowRedeemer records the borrow and returns a generation-stamped redeemer +// that validates the redeem (catching double-redeem and ABA) before delegating +// to the cached redeemer. +func (t *tracker[T]) borrowRedeemer(ptr *T, cached func()) func() { + gen := t.markBorrow(ptr, caller(stackOffset)) + + return func() { + t.markRedeem(ptr, gen, caller(stackOffset-1)) + cached() + } +} + +func (t *tracker[T]) checkLeaks(tb TB) bool { + t.mu.Lock() + defer t.mu.Unlock() + + ok := true + for _, e := range t.entries { + if e.status != trackRedeemed { + tb.Logf("pools: object borrowed but never redeemed (borrowed at %s)", e.borrowedAt) + ok = false + } + } + + return ok +} + +func (t *tracker[T]) resetTracking() { + t.mu.Lock() + t.entries = make(map[*T]*trackEntry) + t.nextGen = 0 + t.mu.Unlock() +} + +// leakChecker is the build-erased view of a tracker that the global registry +// holds, so trackers of different element types can be checked uniformly. +type leakChecker interface { + checkLeaks(tb TB) bool + resetTracking() +} + +var ( + registryMu sync.Mutex + registry []leakChecker +) + +func registerLeakChecker(c leakChecker) { + registryMu.Lock() + registry = append(registry, c) + registryMu.Unlock() +} + +// AssertNoLeaks reports whether every borrowed object has been redeemed across +// all pools created so far. +// +// It logs the borrow call site of each leaked object and fails tb when any are +// found. +// +// Typical use, with [ResetTracking] to isolate the test from earlier ones: +// +// func TestX(t *testing.T) { +// pools.ResetTracking() +// t.Cleanup(func() { pools.AssertNoLeaks(t) }) +// // ... exercise code that borrows/redeems ... +// } +func AssertNoLeaks(tb TB) bool { + tb.Helper() + registryMu.Lock() + defer registryMu.Unlock() + + ok := true + for _, c := range registry { + if !c.checkLeaks(tb) { + ok = false + } + } + if !ok { + tb.Errorf("pools: leaked pooled objects detected (borrowed but never redeemed)") + } + + return ok +} + +// ResetTracking clears all recorded borrow/redeem tracking across every pool. +// +// Call it at the start of a test so leaks from earlier tests are not attributed +// to it. +func ResetTracking() { + registryMu.Lock() + defer registryMu.Unlock() + + for _, c := range registry { + c.resetTracking() + } +} + +// caller returns "file:line" of the frame skip levels above caller itself. +func caller(skip int) string { + pc, _, _, ok := runtime.Caller(skip) + if !ok { + return "unknown" + } + fn := runtime.FuncForPC(pc) + if fn == nil { + return "unknown" + } + file, line := fn.FileLine(pc) + + return fmt.Sprintf("%s:%d", file, line) +} diff --git a/vendor/github.com/go-openapi/swag/pools/doc.go b/vendor/github.com/go-openapi/swag/pools/doc.go new file mode 100644 index 0000000000..395c24d29a --- /dev/null +++ b/vendor/github.com/go-openapi/swag/pools/doc.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + +// Package pools provide utilities to recycle allocated objects. +// +// This package provides: +// +// - a generic [Pool] type that wraps [sync.Pool], +// - a [PoolRedeemable] variant that hands out a cached redeem closure, +// - a [PoolSlice] for recycling slices without juggling pointers. +// +// # Debug build +// +// Building with the "poolsdebug" tag (go test -tags poolsdebug ./...) turns on +// instrumentation that tracks every borrow and redeem and panics on misuse: +// +// - double redeem (including the A -> B -> A case for the redeemable pools), +// - redeem of a foreign object, +// - borrow of an object still checked out +// +// It reports the offending call sites. +// +// [AssertNoLeaks] then reports any object borrowed but never redeemed. +// +// The instrumentation is a no-op with zero overhead when the tag is absent. +package pools diff --git a/vendor/github.com/go-openapi/swag/pools/pools.go b/vendor/github.com/go-openapi/swag/pools/pools.go new file mode 100644 index 0000000000..d78ea5790a --- /dev/null +++ b/vendor/github.com/go-openapi/swag/pools/pools.go @@ -0,0 +1,410 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + +package pools + +import ( + "iter" + "slices" + "sync" + "sync/atomic" +) + +// Resettable is an interface for types that want to recycle a clean instance +// from a [Pool]. +// +// When T (or rather *T) implements [Resettable], the pool calls Reset on an +// instance both when it is redeemed and when it is borrowed: +// +// - on redeem, so that no references held by the instance are retained while it sits idle in the +// pool (which would pin a reference graph alive across a GC cycle); +// - on borrow, so that the next borrower receives a clean object regardless of how the instance +// reached the pool. +// +// Reset must be safe to call more than once on the same instance (it runs at +// least twice per cycle). +type Resettable interface { + Reset() +} + +// resetIfResettable calls Reset on v when *T implements [Resettable]. +func resetIfResettable[T any](v *T) { + if r, ok := any(v).(Resettable); ok { + r.Reset() + } +} + +// borrow state of a [redeemable] wrapper, used to detect double-redeem. +const ( + stateIdle uint32 = iota // sitting in the pool (or freshly created), not checked out + stateBorrowed // checked out by a borrower +) + +type redeemable[T any] struct { + inner *T + redeemer func() + // state guards against a double-redeem (the same wrapper Put into the pool + // twice, which would let one object be handed to two borrowers). + // + // It is set to stateBorrowed on borrow and atomically flipped back to + // stateIdle on redeem; a redeem that finds it already idle panics. + state atomic.Uint32 +} + +// redeemPanic is the message raised when a slot is redeemed while already idle. +const redeemPanic = "pools: " + + "double redeem detected (object already returned to the pool); " + + "a borrowed object must be redeemed exactly once" + +// Pool wraps a [sync.Pool] to make it available for any type. +// +// T must be the value type of the pooled object (e.g. Pool[bytes.Buffer]): +// [Pool.Borrow] returns a *T. Using a pointer type as T (e.g. +// Pool[*bytes.Buffer]) would yield a **T and is almost certainly a mistake. +type Pool[T any] struct { + pool sync.Pool + tracker tracker[T] // empty (zero-cost) unless built with the poolsdebug tag +} + +// PoolRedeemable wraps a [sync.Pool] to make it available for any type. +// +// It differs from [Pool] in the way objects are redeemed to the pool: borrowing +// also yields a cached redeem closure, so no closure is allocated at redeem +// time. +type PoolRedeemable[T any] struct { + pool sync.Pool + tracker tracker[redeemable[T]] // empty (zero-cost) unless built with the poolsdebug tag +} + +// New builds a new [Pool] to recycle allocations of type T explicitly using +// [Pool.Redeem] and the allocated pointer. +// +// Freshly allocated instances of type T are set to their zero value; like +// recycled instances they are reset (if [Resettable]) when borrowed, so +// [Pool.Borrow] always yields a clean object. +func New[T any]() *Pool[T] { + p := &Pool[T]{} + p.pool = sync.Pool{ + New: func() any { + return new(T) + }, + } + p.tracker.register() + + return p +} + +// NewRedeemable builds a new redeemable [Pool] to recycle allocations of type +// T, and use the inner redeemer to relinquish objects to the pool. +func NewRedeemable[T any]() *PoolRedeemable[T] { + p := &PoolRedeemable[T]{} + p.pool = sync.Pool{ + New: func() any { + r := &redeemable[T]{inner: new(T)} + r.redeemer = func() { + if !r.state.CompareAndSwap(stateBorrowed, stateIdle) { + panic(redeemPanic) + } + resetIfResettable(r.inner) + p.pool.Put(r) + } + + return r + }, + } + p.tracker.register() + + return p +} + +// Borrow an instance from the pool. +// +// If the type implements [Resettable], the returned instance is reset before +// being handed out, so it is always clean. +func (p *Pool[T]) Borrow() *T { + target := p.pool.Get().(*T) + resetIfResettable(target) + p.tracker.onBorrow(target) + + return target +} + +// Redeem a borrowed instance to the pool. +// +// A nil pointer is ignored (it would otherwise corrupt the pool: a typed-nil +// boxed into an interface is not the nil interface that [sync.Pool.Put] skips). +// +// The instance is reset (if it implements [Resettable]) before being returned +// to the pool. +// After calling Redeem, the caller must drop its reference to ptr: continuing +// to use it is a use-after-redeem bug. +// +// Unlike [PoolRedeemable], this plain pool holds no per-object state, so it +// cannot detect a double-redeem of the same pointer (which corrupts the pool). +// +// Prefer [PoolRedeemable] when you want that guard, or the debug build for full +// tracking. +func (p *Pool[T]) Redeem(ptr *T) { + if ptr == nil { + return + } + p.tracker.onRedeem(ptr) + resetIfResettable(ptr) + p.pool.Put(ptr) +} + +// BorrowWithRedeem borrows an instance from the pool and provides the +// corresponding redeem function. +// +// This is useful for instance to use with defer. +// +// The instance is reset (if it implements [Resettable]) both when borrowed and +// when the returned redeem closure is called. +// After calling the redeem closure, the caller must drop its reference to the +// returned instance. +// +// Calling the redeem closure more than once panics (see [redeemable.state]): a +// borrowed instance must be redeemed exactly once. +func (p *PoolRedeemable[T]) BorrowWithRedeem() (*T, func()) { + container := p.pool.Get().(*redeemable[T]) + container.state.Store(stateBorrowed) + resetIfResettable(container.inner) + + // In release builds borrowRedeemer returns container.redeemer unchanged (zero + // cost). + // Under the poolsdebug tag it returns a generation-stamped wrapper that tracks + // the borrow and detects double-redeem (incl. + // + // ABA), foreign-redeem and leaks. + return container.inner, p.tracker.borrowRedeemer(container, container.redeemer) +} + +// Slice is a struct that wraps a slice []T. +// +// This is useful to borrow and redeem slices from a pool, without having to +// constantly manipulate pointers to the slice. +// +// The wrapper holds the authoritative slice header. +// +// Its mutating methods ([Slice.Append], [Slice.Concat], [Slice.Grow]) return +// the current backing slice for convenience, so it reads as an idiomatic []T. +// +// But the returned slice is only a snapshot of the wrapper's state at that +// moment: if you keep it and grow it yourself with the builtin append and it +// reallocates, the new backing array lives only in your local copy and is NOT +// tracked by the wrapper — it will not be recycled when the wrapper is +// redeemed (and a later borrower would get the old, smaller array). +// +// Rule of thumb: it is fine to read or pass the returned []T to a consumer; but +// if you plan to grow the slice, keep calling the wrapper's methods so the +// growth is tracked and recycled. +type Slice[T any] struct { + length int + inner []T +} + +// Slice returns the inner slice. +// +// Treat the result as a read-only view (for ranging or passing to a consumer), +// valid until the next mutation or redeem. +// To grow or append, use the wrapper methods so the new backing array is +// tracked and recycled (see [Slice]). +func (s *Slice[T]) Slice() []T { + return s.inner +} + +// Grow the inner slice so it can accommodate at least size more elements +// without reallocating, and return the current backing slice. +// +// Growth is tracked by the wrapper, so the enlarged backing array is recycled +// on redeem. +// See [Slice] for the caveat about growing the returned slice yourself. +func (s *Slice[T]) Grow(size int) []T { + s.inner = slices.Grow(s.inner, size) + + return s.inner +} + +func (s *Slice[T]) Len() int { + return len(s.inner) +} + +func (s *Slice[T]) Cap() int { + return cap(s.inner) +} + +// Append elements to the inner slice and return the current backing slice. +// +// This should be preferred to the append builtin if you plan that the slice will +// grow and you want the newly allocated space to be tracked and recycled. +// See [Slice] for the caveat about growing the returned slice yourself. +func (s *Slice[T]) Append(elems ...T) []T { + s.inner = append(s.inner, elems...) + + return s.inner +} + +// Concat another slice to the inner slice and return the current backing slice. +// +// Unlike [slices.Concat], this reuses the inner slice's capacity instead of +// always allocating a fresh backing array. +// See [Slice] for the caveat about growing the returned slice yourself. +func (s *Slice[T]) Concat(slice []T) []T { + s.inner = append(s.inner, slice...) + + return s.inner +} + +// IndexedElems iterates over the inner slice. +func (s *Slice[T]) IndexedElems() iter.Seq2[int, T] { + return func(yield func(int, T) bool) { + for i, elem := range s.inner { + if !yield(i, elem) { + return + } + } + } +} + +// Reset the inner slice to its configured initial length, keeping allocated +// capacity. +// +// All elements are zeroed, so the pool never retains stale element references +// (which would keep a referenced graph alive for slices of pointers) and so a +// [WithLength] slice is handed out clean rather than carrying data from a +// previous borrower. +func (s *Slice[T]) Reset() { + clear(s.inner) + if s.length > cap(s.inner) { + s.inner = slices.Grow(s.inner[:0], s.length) + } + s.inner = s.inner[:s.length] +} + +// Clip removes unused capacity from the inner slice. +func (s *Slice[T]) Clip() { + s.inner = slices.Clip(s.inner) +} + +// resetWithCapacity discards the current backing array and replaces it with a +// fresh one of the configured length and the given capacity. +// +// It is used by a capacity-capped pool to stop recycling an oversized backing +// array (the old array is left for the GC). +func (s *Slice[T]) resetWithCapacity(capacity int) { + s.inner = make([]T, s.length, max(s.length, capacity)) +} + +// PoolSlice is a pool of [Slice[T]]. +// +// [PoolSlice.BorrowWithRedeem] will return an empty inner slice by default. +// This default may be altered using [WithMinimumCapacity]. +// +// Use [PoolSlice.BorrowWithSizeAndRedeem] or [Slice.Grow] to grow the capacity +// of the inner slice. +type PoolSlice[T any] struct { + // redeemable is held as an unexported field rather than embedded, so the + // underlying [PoolRedeemable] and its [sync.Pool] are not part of PoolSlice's + // public surface. + redeemable *PoolRedeemable[Slice[T]] +} + +// PoolSliceOption alters the default settings to allocate new pooled slices +type PoolSliceOption func(*poolSliceOptions) + +type poolSliceOptions struct { + minCapacity int + length int + maxCapacity int +} + +func WithMinimumCapacity(size int) PoolSliceOption { + return func(o *poolSliceOptions) { + o.minCapacity = size + } +} + +// WithMaxCapacity bounds the capacity of recycled slices. +// +// When a borrowed slice has grown past size at redeem time, its (oversized) +// backing array is discarded and replaced with a fresh one sized to the minimum +// capacity, instead of being recycled. +// +// This stops the pool from accumulating large backing arrays after an +// occasional large request, keeping the steady-state memory bounded. +// +// The trade-off: a workload that genuinely needs slices larger than size will +// reallocate on every cycle. +// Set size from the high-water mark you actually expect, not below it. +// A size of 0 (the default) means no cap: grown slices are recycled as-is. +func WithMaxCapacity(size int) PoolSliceOption { + return func(o *poolSliceOptions) { + o.maxCapacity = size + } +} + +// WithLength ensures that the borrowed slices have a fixed given initial +// length. +// +// By default, the borrowed slices are reset to length 0. +func WithLength(size int) PoolSliceOption { + return func(o *poolSliceOptions) { + o.length = size + } +} + +// NewPoolSlice builds a pool to recycle slices of type []T. +func NewPoolSlice[T any](opts ...PoolSliceOption) *PoolSlice[T] { + var o poolSliceOptions + for _, apply := range opts { + apply(&o) + } + + rp := &PoolRedeemable[Slice[T]]{} + rp.pool = sync.Pool{ + New: func() any { + s := &redeemable[Slice[T]]{ + inner: &Slice[T]{ + length: o.length, + inner: make([]T, o.length, max(o.length, o.minCapacity)), + }, + } + + s.redeemer = func() { + if !s.state.CompareAndSwap(stateBorrowed, stateIdle) { + panic(redeemPanic) + } + if o.maxCapacity > 0 && s.inner.Cap() > o.maxCapacity { + s.inner.resetWithCapacity(o.minCapacity) + } else { + s.inner.Reset() + } + rp.pool.Put(s) + } + + return s + }, + } + rp.tracker.register() + + return &PoolSlice[T]{redeemable: rp} +} + +// BorrowWithRedeem returns the slice wrapper and the redeem closure to +// relinquish the allocated wrapper. +// +// The wrapper is reset (elements zeroed, length restored) both on borrow and +// when the redeem closure is called. +// Calling the redeem closure more than once panics. +func (p *PoolSlice[T]) BorrowWithRedeem() (*Slice[T], func()) { + return p.redeemable.BorrowWithRedeem() +} + +// BorrowWithSizeAndRedeem borrows a slice []T from the pool and ensures that +// its capacity is at least the provided size. +func (p *PoolSlice[T]) BorrowWithSizeAndRedeem(size int) (*Slice[T], func()) { + s, redeem := p.BorrowWithRedeem() + s.Grow(size) + + return s, redeem +} diff --git a/vendor/github.com/go-openapi/swag/yamlutils/ordered_map.go b/vendor/github.com/go-openapi/swag/yamlutils/ordered_map.go index 3daf68dbba..24d951f8de 100644 --- a/vendor/github.com/go-openapi/swag/yamlutils/ordered_map.go +++ b/vendor/github.com/go-openapi/swag/yamlutils/ordered_map.go @@ -123,7 +123,7 @@ func (s YAMLMapSlice) MarshalYAML() (any, error) { var nodes []*yaml.Node for _, item := range s { - nn, err := json2yaml(item.Value) + nn, err := json2yaml(item.Value, 1) if err != nil { return nil, err } @@ -153,6 +153,17 @@ func (s YAMLMapSlice) MarshalYAML() (any, error) { // // It implements [yaml.Unmarshaler]. func (s *YAMLMapSlice) UnmarshalYAML(node *yaml.Node) error { + return s.unmarshalYAML(newYAMLWalker(), node, 0) +} + +// unmarshalYAML builds the slice from a [yaml.Node], tracking the recursion depth (against +// stack-overflow) and threading the [yamlWalker] so anchor/alias expansion stays bounded +// across the whole document. +func (s *YAMLMapSlice) unmarshalYAML(w *yamlWalker, node *yaml.Node, depth int) error { + if depth > defaultMaxNestingDepth { + return errMaxNestingDepth + } + if typeutils.IsNil(*s) { // allow to unmarshal with a simple var declaration (nil slice) *s = YAMLMapSlice{} @@ -167,13 +178,17 @@ func (s *YAMLMapSlice) UnmarshalYAML(node *yaml.Node) error { m = m[:0] for i := 0; i < len(node.Content); i += 2 { + if err := w.account(); err != nil { // account the key node + return err + } + var nmi YAMLMapItem k, err := yamlStringScalarC(node.Content[i]) if err != nil { return fmt.Errorf("unable to decode YAML map key: %w: %w", err, ErrYAML) } nmi.Key = k - v, err := yamlNode(node.Content[i+1]) + v, err := w.node(node.Content[i+1], depth+1) if err != nil { return fmt.Errorf("unable to process YAML map value for key %q: %w: %w", k, err, ErrYAML) } @@ -186,7 +201,11 @@ func (s *YAMLMapSlice) UnmarshalYAML(node *yaml.Node) error { return nil } -func json2yaml(item any) (*yaml.Node, error) { +func json2yaml(item any, depth int) (*yaml.Node, error) { + if depth > defaultMaxNestingDepth { + return nil, errMaxNestingDepth + } + if typeutils.IsNil(item) { return &yaml.Node{ Kind: yaml.ScalarNode, @@ -196,7 +215,7 @@ func json2yaml(item any) (*yaml.Node, error) { switch val := item.(type) { case ifaces.Ordered: - return orderedYAML(val) + return orderedYAML(val, depth) case map[string]any: var n yaml.Node @@ -209,7 +228,7 @@ func json2yaml(item any) (*yaml.Node, error) { for _, k := range keys { v := val[k] - childNode, err := json2yaml(v) + childNode, err := json2yaml(v, depth+1) if err != nil { return nil, err } @@ -225,7 +244,7 @@ func json2yaml(item any) (*yaml.Node, error) { var n yaml.Node n.Kind = yaml.SequenceNode for i := range val { - childNode, err := json2yaml(val[i]) + childNode, err := json2yaml(val[i], depth+1) if err != nil { return nil, err } @@ -297,11 +316,11 @@ func uintegerNode[T conv.Unsigned](val T) (*yaml.Node, error) { }, nil } -func orderedYAML[T ifaces.Ordered](val T) (*yaml.Node, error) { +func orderedYAML[T ifaces.Ordered](val T, depth int) (*yaml.Node, error) { var n yaml.Node n.Kind = yaml.MappingNode for key, value := range val.OrderedItems() { - childNode, err := json2yaml(value) + childNode, err := json2yaml(value, depth+1) if err != nil { return nil, err } diff --git a/vendor/github.com/go-openapi/swag/yamlutils/yaml.go b/vendor/github.com/go-openapi/swag/yamlutils/yaml.go index e3aff3c2fd..d4b5335f6f 100644 --- a/vendor/github.com/go-openapi/swag/yamlutils/yaml.go +++ b/vendor/github.com/go-openapi/swag/yamlutils/yaml.go @@ -12,13 +12,99 @@ import ( yaml "go.yaml.in/yaml/v3" ) +// defaultMaxNestingDepth caps the recursion depth of the YAML<->JSON transforms to +// guard against stack-overflow on deeply nested (possibly adversarial) input. +// +// It matches the limit enforced by go.yaml.in/yaml/v3's own parser and by +// encoding/json's decoder. +const defaultMaxNestingDepth = 10000 + +// Bounds on YAML anchor/alias expansion. +// +// go.yaml.in/yaml/v3 enforces these when decoding into Go values, but that guard is +// coupled to the library's own tree walk: when we decode into a low-level [yaml.Node] +// (to preserve key order) and expand aliases ourselves in [yamlWalker.node], we bypass +// it. We therefore reproduce it here, with the same constants and ratio schedule as the +// library's decoder (see go.yaml.in/yaml/v3 decode.go, "excessive aliasing"). +const ( + aliasCountThreshold = 100 + decodeCountThreshold = 1000 + + // 400,000 decode operations is ~500kb of dense object declarations, or + // ~5kb of dense object declarations with 10000% alias expansion. + aliasRatioRangeLow = 400000 + // 4,000,000 decode operations is ~5MB of dense object declarations. + aliasRatioRangeHigh = 4000000 + aliasRatioRange = float64(aliasRatioRangeHigh - aliasRatioRangeLow) + + // tolerated share of alias-driven decodes: from aliasRatioSmall (small/medium documents) + // down to aliasRatioLarge (very large ones), interpolated with slope aliasRatioSlope. + aliasRatioSmall = 0.99 + aliasRatioLarge = 0.10 + aliasRatioSlope = aliasRatioSmall - aliasRatioLarge +) + +var ( + // errMaxNestingDepth is returned when a document nests deeper than [defaultMaxNestingDepth]. + errMaxNestingDepth = fmt.Errorf("maximum nesting depth of %d exceeded: %w", defaultMaxNestingDepth, ErrYAML) + + // errExcessiveAliasing is returned when anchor/alias expansion is disproportionate to the + // size of the document, i.e. an "alias bomb". + errExcessiveAliasing = fmt.Errorf("document contains excessive aliasing: %w", ErrYAML) +) + +// allowedAliasRatio scales the tolerated share of alias-driven decode operations from 99% +// for small-to-medium documents down to 10% for very large ones, mirroring go.yaml.in/yaml/v3. +func allowedAliasRatio(decodeCount int) float64 { + switch { + case decodeCount <= aliasRatioRangeLow: + return aliasRatioSmall + case decodeCount >= aliasRatioRangeHigh: + return aliasRatioLarge + default: + return aliasRatioSmall - aliasRatioSlope*(float64(decodeCount-aliasRatioRangeLow)/aliasRatioRange) + } +} + +// yamlWalker carries the state needed to bound a single YAML-tree traversal: +// anchor/alias expansion accounting and cycle detection. +// +// A fresh walker is created per top-level conversion; it is threaded (not copied) through +// the whole recursive walk so its counters accumulate across the entire document. +type yamlWalker struct { + decodeCount int + aliasCount int + aliasDepth int + aliases map[*yaml.Node]bool // anchors currently being expanded, for cycle detection +} + +func newYAMLWalker() *yamlWalker { + return &yamlWalker{aliases: make(map[*yaml.Node]bool)} +} + +// account records one processed node and fails if alias expansion has become excessive. +func (w *yamlWalker) account() error { + w.decodeCount++ + if w.aliasDepth > 0 { + w.aliasCount++ + } + + if w.aliasCount > aliasCountThreshold && + w.decodeCount > decodeCountThreshold && + float64(w.aliasCount)/float64(w.decodeCount) > allowedAliasRatio(w.decodeCount) { + return errExcessiveAliasing + } + + return nil +} + // YAMLToJSON converts a YAML document into JSON bytes. // // Note: a YAML document is the output from a [yaml.Marshaler], e.g a pointer to a [yaml.Node]. // // [YAMLToJSON] is typically called after [BytesToYAMLDoc]. func YAMLToJSON(value any) (json.RawMessage, error) { - jm, err := transformData(value) + jm, err := transformData(value, 0) if err != nil { return nil, err } @@ -44,46 +130,73 @@ func BytesToYAMLDoc(data []byte) (any, error) { return &document, nil } -func yamlNode(root *yaml.Node) (any, error) { +func (w *yamlWalker) node(root *yaml.Node, depth int) (any, error) { + if depth > defaultMaxNestingDepth { + return nil, errMaxNestingDepth + } + if err := w.account(); err != nil { + return nil, err + } + switch root.Kind { case yaml.DocumentNode: - return yamlDocument(root) + return w.document(root, depth) case yaml.SequenceNode: - return yamlSequence(root) + return w.sequence(root, depth) case yaml.MappingNode: - return yamlMapping(root) + return w.mapping(root, depth) case yaml.ScalarNode: return yamlScalar(root) case yaml.AliasNode: - return yamlNode(root.Alias) + return w.alias(root, depth) default: return nil, fmt.Errorf("unsupported YAML node type: %v: %w", root.Kind, ErrYAML) } } -func yamlDocument(node *yaml.Node) (any, error) { +// alias resolves an anchor reference, expanding the anchored subtree. It detects cycles +// (an anchor whose expansion transitively references itself) and accounts the expansion +// against the alias-bomb budget via [yamlWalker.aliasDepth]. +func (w *yamlWalker) alias(node *yaml.Node, depth int) (any, error) { + if node.Alias == nil { + return nil, fmt.Errorf("invalid YAML alias node %q: %w", node.Value, ErrYAML) + } + if w.aliases[node.Alias] { + return nil, fmt.Errorf("anchor %q contains itself: %w", node.Value, ErrYAML) + } + + w.aliases[node.Alias] = true + w.aliasDepth++ + out, err := w.node(node.Alias, depth+1) + w.aliasDepth-- + delete(w.aliases, node.Alias) + + return out, err +} + +func (w *yamlWalker) document(node *yaml.Node, depth int) (any, error) { if len(node.Content) != 1 { return nil, fmt.Errorf("unexpected YAML Document node content length: %d: %w", len(node.Content), ErrYAML) } - return yamlNode(node.Content[0]) + return w.node(node.Content[0], depth+1) } -func yamlMapping(node *yaml.Node) (any, error) { +func (w *yamlWalker) mapping(node *yaml.Node, depth int) (any, error) { const sensibleAllocDivider = 2 // nodes concatenate (key,value) sequences m := make(YAMLMapSlice, len(node.Content)/sensibleAllocDivider) - if err := m.UnmarshalYAML(node); err != nil { + if err := m.unmarshalYAML(w, node, depth); err != nil { return nil, err } return m, nil } -func yamlSequence(node *yaml.Node) (any, error) { +func (w *yamlWalker) sequence(node *yaml.Node, depth int) (any, error) { s := make([]any, 0) for i := range len(node.Content) { - v, err := yamlNode(node.Content[i]) + v, err := w.node(node.Content[i], depth+1) if err != nil { return nil, fmt.Errorf("unable to decode YAML sequence value: %w: %w", err, ErrYAML) } @@ -174,12 +287,16 @@ func format(t any) (string, error) { } } -func transformData(input any) (out any, err error) { +func transformData(input any, depth int) (out any, err error) { + if depth > defaultMaxNestingDepth { + return nil, errMaxNestingDepth + } + switch in := input.(type) { case yaml.Node: - return yamlNode(&in) + return newYAMLWalker().node(&in, depth) case *yaml.Node: - return yamlNode(in) + return newYAMLWalker().node(in, depth) case map[any]any: o := make(YAMLMapSlice, 0, len(in)) for ke, va := range in { @@ -188,7 +305,7 @@ func transformData(input any) (out any, err error) { return nil, err } - v, ert := transformData(va) + v, ert := transformData(va, depth+1) if ert != nil { return nil, ert } @@ -200,7 +317,7 @@ func transformData(input any) (out any, err error) { len1 := len(in) o := make([]any, len1) for i := range len1 { - o[i], err = transformData(in[i]) + o[i], err = transformData(in[i], depth+1) if err != nil { return nil, err } diff --git a/vendor/github.com/gogo/protobuf/gogoproto/Makefile b/vendor/github.com/gogo/protobuf/gogoproto/Makefile deleted file mode 100644 index 0b4659b731..0000000000 --- a/vendor/github.com/gogo/protobuf/gogoproto/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# Protocol Buffers for Go with Gadgets -# -# Copyright (c) 2013, The GoGo Authors. All rights reserved. -# http://github.com/gogo/protobuf -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -regenerate: - go install github.com/gogo/protobuf/protoc-gen-gogo - protoc --gogo_out=Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor:../../../../ --proto_path=../../../../:../protobuf/:. *.proto - -restore: - cp gogo.pb.golden gogo.pb.go - -preserve: - cp gogo.pb.go gogo.pb.golden diff --git a/vendor/github.com/gogo/protobuf/gogoproto/doc.go b/vendor/github.com/gogo/protobuf/gogoproto/doc.go deleted file mode 100644 index 081c86fa8e..0000000000 --- a/vendor/github.com/gogo/protobuf/gogoproto/doc.go +++ /dev/null @@ -1,169 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -/* -Package gogoproto provides extensions for protocol buffers to achieve: - - - fast marshalling and unmarshalling. - - peace of mind by optionally generating test and benchmark code. - - more canonical Go structures. - - less typing by optionally generating extra helper code. - - goprotobuf compatibility - -More Canonical Go Structures - -A lot of time working with a goprotobuf struct will lead you to a place where you create another struct that is easier to work with and then have a function to copy the values between the two structs. -You might also find that basic structs that started their life as part of an API need to be sent over the wire. With gob, you could just send it. With goprotobuf, you need to make a parallel struct. -Gogoprotobuf tries to fix these problems with the nullable, embed, customtype and customname field extensions. - - - nullable, if false, a field is generated without a pointer (see warning below). - - embed, if true, the field is generated as an embedded field. - - customtype, It works with the Marshal and Unmarshal methods, to allow you to have your own types in your struct, but marshal to bytes. For example, custom.Uuid or custom.Fixed128 - - customname (beta), Changes the generated fieldname. This is especially useful when generated methods conflict with fieldnames. - - casttype (beta), Changes the generated fieldtype. All generated code assumes that this type is castable to the protocol buffer field type. It does not work for structs or enums. - - castkey (beta), Changes the generated fieldtype for a map key. All generated code assumes that this type is castable to the protocol buffer field type. Only supported on maps. - - castvalue (beta), Changes the generated fieldtype for a map value. All generated code assumes that this type is castable to the protocol buffer field type. Only supported on maps. - -Warning about nullable: According to the Protocol Buffer specification, you should be able to tell whether a field is set or unset. With the option nullable=false this feature is lost, since your non-nullable fields will always be set. It can be seen as a layer on top of Protocol Buffers, where before and after marshalling all non-nullable fields are set and they cannot be unset. - -Let us look at: - - github.com/gogo/protobuf/test/example/example.proto - -for a quicker overview. - -The following message: - - package test; - - import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - - message A { - optional string Description = 1 [(gogoproto.nullable) = false]; - optional int64 Number = 2 [(gogoproto.nullable) = false]; - optional bytes Id = 3 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uuid", (gogoproto.nullable) = false]; - } - -Will generate a go struct which looks a lot like this: - - type A struct { - Description string - Number int64 - Id github_com_gogo_protobuf_test_custom.Uuid - } - -You will see there are no pointers, since all fields are non-nullable. -You will also see a custom type which marshals to a string. -Be warned it is your responsibility to test your custom types thoroughly. -You should think of every possible empty and nil case for your marshaling, unmarshaling and size methods. - -Next we will embed the message A in message B. - - message B { - optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; - repeated bytes G = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; - } - -See below that A is embedded in B. - - type B struct { - A - G []github_com_gogo_protobuf_test_custom.Uint128 - } - -Also see the repeated custom type. - - type Uint128 [2]uint64 - -Next we will create a custom name for one of our fields. - - message C { - optional int64 size = 1 [(gogoproto.customname) = "MySize"]; - } - -See below that the field's name is MySize and not Size. - - type C struct { - MySize *int64 - } - -The is useful when having a protocol buffer message with a field name which conflicts with a generated method. -As an example, having a field name size and using the sizer plugin to generate a Size method will cause a go compiler error. -Using customname you can fix this error without changing the field name. -This is typically useful when working with a protocol buffer that was designed before these methods and/or the go language were avialable. - -Gogoprotobuf also has some more subtle changes, these could be changed back: - - - the generated package name for imports do not have the extra /filename.pb, - but are actually the imports specified in the .proto file. - -Gogoprotobuf also has lost some features which should be brought back with time: - - - Marshalling and unmarshalling with reflect and without the unsafe package, - this requires work in pointer_reflect.go - -Why does nullable break protocol buffer specifications: - -The protocol buffer specification states, somewhere, that you should be able to tell whether a -field is set or unset. With the option nullable=false this feature is lost, -since your non-nullable fields will always be set. It can be seen as a layer on top of -protocol buffers, where before and after marshalling all non-nullable fields are set -and they cannot be unset. - -Goprotobuf Compatibility: - -Gogoprotobuf is compatible with Goprotobuf, because it is compatible with protocol buffers. -Gogoprotobuf generates the same code as goprotobuf if no extensions are used. -The enumprefix, getters and stringer extensions can be used to remove some of the unnecessary code generated by goprotobuf: - - - gogoproto_import, if false, the generated code imports github.com/golang/protobuf/proto instead of github.com/gogo/protobuf/proto. - - goproto_enum_prefix, if false, generates the enum constant names without the messagetype prefix - - goproto_enum_stringer (experimental), if false, the enum is generated without the default string method, this is useful for rather using enum_stringer, or allowing you to write your own string method. - - goproto_getters, if false, the message is generated without get methods, this is useful when you would rather want to use face - - goproto_stringer, if false, the message is generated without the default string method, this is useful for rather using stringer, or allowing you to write your own string method. - - goproto_extensions_map (beta), if false, the extensions field is generated as type []byte instead of type map[int32]proto.Extension - - goproto_unrecognized (beta), if false, XXX_unrecognized field is not generated. This is useful in conjunction with gogoproto.nullable=false, to generate structures completely devoid of pointers and reduce GC pressure at the cost of losing information about unrecognized fields. - - goproto_registration (beta), if true, the generated files will register all messages and types against both gogo/protobuf and golang/protobuf. This is necessary when using third-party packages which read registrations from golang/protobuf (such as the grpc-gateway). - -Less Typing and Peace of Mind is explained in their specific plugin folders godoc: - - - github.com/gogo/protobuf/plugin/ - -If you do not use any of these extension the code that is generated -will be the same as if goprotobuf has generated it. - -The most complete way to see examples is to look at - - github.com/gogo/protobuf/test/thetest.proto - -Gogoprototest is a seperate project, -because we want to keep gogoprotobuf independent of goprotobuf, -but we still want to test it thoroughly. - -*/ -package gogoproto diff --git a/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go b/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go deleted file mode 100644 index 1e91766aee..0000000000 --- a/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go +++ /dev/null @@ -1,874 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: gogo.proto - -package gogoproto - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -var E_GoprotoEnumPrefix = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62001, - Name: "gogoproto.goproto_enum_prefix", - Tag: "varint,62001,opt,name=goproto_enum_prefix", - Filename: "gogo.proto", -} - -var E_GoprotoEnumStringer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62021, - Name: "gogoproto.goproto_enum_stringer", - Tag: "varint,62021,opt,name=goproto_enum_stringer", - Filename: "gogo.proto", -} - -var E_EnumStringer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62022, - Name: "gogoproto.enum_stringer", - Tag: "varint,62022,opt,name=enum_stringer", - Filename: "gogo.proto", -} - -var E_EnumCustomname = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*string)(nil), - Field: 62023, - Name: "gogoproto.enum_customname", - Tag: "bytes,62023,opt,name=enum_customname", - Filename: "gogo.proto", -} - -var E_Enumdecl = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62024, - Name: "gogoproto.enumdecl", - Tag: "varint,62024,opt,name=enumdecl", - Filename: "gogo.proto", -} - -var E_EnumvalueCustomname = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumValueOptions)(nil), - ExtensionType: (*string)(nil), - Field: 66001, - Name: "gogoproto.enumvalue_customname", - Tag: "bytes,66001,opt,name=enumvalue_customname", - Filename: "gogo.proto", -} - -var E_GoprotoGettersAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63001, - Name: "gogoproto.goproto_getters_all", - Tag: "varint,63001,opt,name=goproto_getters_all", - Filename: "gogo.proto", -} - -var E_GoprotoEnumPrefixAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63002, - Name: "gogoproto.goproto_enum_prefix_all", - Tag: "varint,63002,opt,name=goproto_enum_prefix_all", - Filename: "gogo.proto", -} - -var E_GoprotoStringerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63003, - Name: "gogoproto.goproto_stringer_all", - Tag: "varint,63003,opt,name=goproto_stringer_all", - Filename: "gogo.proto", -} - -var E_VerboseEqualAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63004, - Name: "gogoproto.verbose_equal_all", - Tag: "varint,63004,opt,name=verbose_equal_all", - Filename: "gogo.proto", -} - -var E_FaceAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63005, - Name: "gogoproto.face_all", - Tag: "varint,63005,opt,name=face_all", - Filename: "gogo.proto", -} - -var E_GostringAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63006, - Name: "gogoproto.gostring_all", - Tag: "varint,63006,opt,name=gostring_all", - Filename: "gogo.proto", -} - -var E_PopulateAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63007, - Name: "gogoproto.populate_all", - Tag: "varint,63007,opt,name=populate_all", - Filename: "gogo.proto", -} - -var E_StringerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63008, - Name: "gogoproto.stringer_all", - Tag: "varint,63008,opt,name=stringer_all", - Filename: "gogo.proto", -} - -var E_OnlyoneAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63009, - Name: "gogoproto.onlyone_all", - Tag: "varint,63009,opt,name=onlyone_all", - Filename: "gogo.proto", -} - -var E_EqualAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63013, - Name: "gogoproto.equal_all", - Tag: "varint,63013,opt,name=equal_all", - Filename: "gogo.proto", -} - -var E_DescriptionAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63014, - Name: "gogoproto.description_all", - Tag: "varint,63014,opt,name=description_all", - Filename: "gogo.proto", -} - -var E_TestgenAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63015, - Name: "gogoproto.testgen_all", - Tag: "varint,63015,opt,name=testgen_all", - Filename: "gogo.proto", -} - -var E_BenchgenAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63016, - Name: "gogoproto.benchgen_all", - Tag: "varint,63016,opt,name=benchgen_all", - Filename: "gogo.proto", -} - -var E_MarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63017, - Name: "gogoproto.marshaler_all", - Tag: "varint,63017,opt,name=marshaler_all", - Filename: "gogo.proto", -} - -var E_UnmarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63018, - Name: "gogoproto.unmarshaler_all", - Tag: "varint,63018,opt,name=unmarshaler_all", - Filename: "gogo.proto", -} - -var E_StableMarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63019, - Name: "gogoproto.stable_marshaler_all", - Tag: "varint,63019,opt,name=stable_marshaler_all", - Filename: "gogo.proto", -} - -var E_SizerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63020, - Name: "gogoproto.sizer_all", - Tag: "varint,63020,opt,name=sizer_all", - Filename: "gogo.proto", -} - -var E_GoprotoEnumStringerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63021, - Name: "gogoproto.goproto_enum_stringer_all", - Tag: "varint,63021,opt,name=goproto_enum_stringer_all", - Filename: "gogo.proto", -} - -var E_EnumStringerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63022, - Name: "gogoproto.enum_stringer_all", - Tag: "varint,63022,opt,name=enum_stringer_all", - Filename: "gogo.proto", -} - -var E_UnsafeMarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63023, - Name: "gogoproto.unsafe_marshaler_all", - Tag: "varint,63023,opt,name=unsafe_marshaler_all", - Filename: "gogo.proto", -} - -var E_UnsafeUnmarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63024, - Name: "gogoproto.unsafe_unmarshaler_all", - Tag: "varint,63024,opt,name=unsafe_unmarshaler_all", - Filename: "gogo.proto", -} - -var E_GoprotoExtensionsMapAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63025, - Name: "gogoproto.goproto_extensions_map_all", - Tag: "varint,63025,opt,name=goproto_extensions_map_all", - Filename: "gogo.proto", -} - -var E_GoprotoUnrecognizedAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63026, - Name: "gogoproto.goproto_unrecognized_all", - Tag: "varint,63026,opt,name=goproto_unrecognized_all", - Filename: "gogo.proto", -} - -var E_GogoprotoImport = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63027, - Name: "gogoproto.gogoproto_import", - Tag: "varint,63027,opt,name=gogoproto_import", - Filename: "gogo.proto", -} - -var E_ProtosizerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63028, - Name: "gogoproto.protosizer_all", - Tag: "varint,63028,opt,name=protosizer_all", - Filename: "gogo.proto", -} - -var E_CompareAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63029, - Name: "gogoproto.compare_all", - Tag: "varint,63029,opt,name=compare_all", - Filename: "gogo.proto", -} - -var E_TypedeclAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63030, - Name: "gogoproto.typedecl_all", - Tag: "varint,63030,opt,name=typedecl_all", - Filename: "gogo.proto", -} - -var E_EnumdeclAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63031, - Name: "gogoproto.enumdecl_all", - Tag: "varint,63031,opt,name=enumdecl_all", - Filename: "gogo.proto", -} - -var E_GoprotoRegistration = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63032, - Name: "gogoproto.goproto_registration", - Tag: "varint,63032,opt,name=goproto_registration", - Filename: "gogo.proto", -} - -var E_MessagenameAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63033, - Name: "gogoproto.messagename_all", - Tag: "varint,63033,opt,name=messagename_all", - Filename: "gogo.proto", -} - -var E_GoprotoSizecacheAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63034, - Name: "gogoproto.goproto_sizecache_all", - Tag: "varint,63034,opt,name=goproto_sizecache_all", - Filename: "gogo.proto", -} - -var E_GoprotoUnkeyedAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63035, - Name: "gogoproto.goproto_unkeyed_all", - Tag: "varint,63035,opt,name=goproto_unkeyed_all", - Filename: "gogo.proto", -} - -var E_GoprotoGetters = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64001, - Name: "gogoproto.goproto_getters", - Tag: "varint,64001,opt,name=goproto_getters", - Filename: "gogo.proto", -} - -var E_GoprotoStringer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64003, - Name: "gogoproto.goproto_stringer", - Tag: "varint,64003,opt,name=goproto_stringer", - Filename: "gogo.proto", -} - -var E_VerboseEqual = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64004, - Name: "gogoproto.verbose_equal", - Tag: "varint,64004,opt,name=verbose_equal", - Filename: "gogo.proto", -} - -var E_Face = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64005, - Name: "gogoproto.face", - Tag: "varint,64005,opt,name=face", - Filename: "gogo.proto", -} - -var E_Gostring = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64006, - Name: "gogoproto.gostring", - Tag: "varint,64006,opt,name=gostring", - Filename: "gogo.proto", -} - -var E_Populate = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64007, - Name: "gogoproto.populate", - Tag: "varint,64007,opt,name=populate", - Filename: "gogo.proto", -} - -var E_Stringer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 67008, - Name: "gogoproto.stringer", - Tag: "varint,67008,opt,name=stringer", - Filename: "gogo.proto", -} - -var E_Onlyone = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64009, - Name: "gogoproto.onlyone", - Tag: "varint,64009,opt,name=onlyone", - Filename: "gogo.proto", -} - -var E_Equal = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64013, - Name: "gogoproto.equal", - Tag: "varint,64013,opt,name=equal", - Filename: "gogo.proto", -} - -var E_Description = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64014, - Name: "gogoproto.description", - Tag: "varint,64014,opt,name=description", - Filename: "gogo.proto", -} - -var E_Testgen = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64015, - Name: "gogoproto.testgen", - Tag: "varint,64015,opt,name=testgen", - Filename: "gogo.proto", -} - -var E_Benchgen = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64016, - Name: "gogoproto.benchgen", - Tag: "varint,64016,opt,name=benchgen", - Filename: "gogo.proto", -} - -var E_Marshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64017, - Name: "gogoproto.marshaler", - Tag: "varint,64017,opt,name=marshaler", - Filename: "gogo.proto", -} - -var E_Unmarshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64018, - Name: "gogoproto.unmarshaler", - Tag: "varint,64018,opt,name=unmarshaler", - Filename: "gogo.proto", -} - -var E_StableMarshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64019, - Name: "gogoproto.stable_marshaler", - Tag: "varint,64019,opt,name=stable_marshaler", - Filename: "gogo.proto", -} - -var E_Sizer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64020, - Name: "gogoproto.sizer", - Tag: "varint,64020,opt,name=sizer", - Filename: "gogo.proto", -} - -var E_UnsafeMarshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64023, - Name: "gogoproto.unsafe_marshaler", - Tag: "varint,64023,opt,name=unsafe_marshaler", - Filename: "gogo.proto", -} - -var E_UnsafeUnmarshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64024, - Name: "gogoproto.unsafe_unmarshaler", - Tag: "varint,64024,opt,name=unsafe_unmarshaler", - Filename: "gogo.proto", -} - -var E_GoprotoExtensionsMap = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64025, - Name: "gogoproto.goproto_extensions_map", - Tag: "varint,64025,opt,name=goproto_extensions_map", - Filename: "gogo.proto", -} - -var E_GoprotoUnrecognized = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64026, - Name: "gogoproto.goproto_unrecognized", - Tag: "varint,64026,opt,name=goproto_unrecognized", - Filename: "gogo.proto", -} - -var E_Protosizer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64028, - Name: "gogoproto.protosizer", - Tag: "varint,64028,opt,name=protosizer", - Filename: "gogo.proto", -} - -var E_Compare = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64029, - Name: "gogoproto.compare", - Tag: "varint,64029,opt,name=compare", - Filename: "gogo.proto", -} - -var E_Typedecl = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64030, - Name: "gogoproto.typedecl", - Tag: "varint,64030,opt,name=typedecl", - Filename: "gogo.proto", -} - -var E_Messagename = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64033, - Name: "gogoproto.messagename", - Tag: "varint,64033,opt,name=messagename", - Filename: "gogo.proto", -} - -var E_GoprotoSizecache = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64034, - Name: "gogoproto.goproto_sizecache", - Tag: "varint,64034,opt,name=goproto_sizecache", - Filename: "gogo.proto", -} - -var E_GoprotoUnkeyed = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64035, - Name: "gogoproto.goproto_unkeyed", - Tag: "varint,64035,opt,name=goproto_unkeyed", - Filename: "gogo.proto", -} - -var E_Nullable = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65001, - Name: "gogoproto.nullable", - Tag: "varint,65001,opt,name=nullable", - Filename: "gogo.proto", -} - -var E_Embed = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65002, - Name: "gogoproto.embed", - Tag: "varint,65002,opt,name=embed", - Filename: "gogo.proto", -} - -var E_Customtype = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65003, - Name: "gogoproto.customtype", - Tag: "bytes,65003,opt,name=customtype", - Filename: "gogo.proto", -} - -var E_Customname = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65004, - Name: "gogoproto.customname", - Tag: "bytes,65004,opt,name=customname", - Filename: "gogo.proto", -} - -var E_Jsontag = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65005, - Name: "gogoproto.jsontag", - Tag: "bytes,65005,opt,name=jsontag", - Filename: "gogo.proto", -} - -var E_Moretags = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65006, - Name: "gogoproto.moretags", - Tag: "bytes,65006,opt,name=moretags", - Filename: "gogo.proto", -} - -var E_Casttype = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65007, - Name: "gogoproto.casttype", - Tag: "bytes,65007,opt,name=casttype", - Filename: "gogo.proto", -} - -var E_Castkey = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65008, - Name: "gogoproto.castkey", - Tag: "bytes,65008,opt,name=castkey", - Filename: "gogo.proto", -} - -var E_Castvalue = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65009, - Name: "gogoproto.castvalue", - Tag: "bytes,65009,opt,name=castvalue", - Filename: "gogo.proto", -} - -var E_Stdtime = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65010, - Name: "gogoproto.stdtime", - Tag: "varint,65010,opt,name=stdtime", - Filename: "gogo.proto", -} - -var E_Stdduration = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65011, - Name: "gogoproto.stdduration", - Tag: "varint,65011,opt,name=stdduration", - Filename: "gogo.proto", -} - -var E_Wktpointer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65012, - Name: "gogoproto.wktpointer", - Tag: "varint,65012,opt,name=wktpointer", - Filename: "gogo.proto", -} - -func init() { - proto.RegisterExtension(E_GoprotoEnumPrefix) - proto.RegisterExtension(E_GoprotoEnumStringer) - proto.RegisterExtension(E_EnumStringer) - proto.RegisterExtension(E_EnumCustomname) - proto.RegisterExtension(E_Enumdecl) - proto.RegisterExtension(E_EnumvalueCustomname) - proto.RegisterExtension(E_GoprotoGettersAll) - proto.RegisterExtension(E_GoprotoEnumPrefixAll) - proto.RegisterExtension(E_GoprotoStringerAll) - proto.RegisterExtension(E_VerboseEqualAll) - proto.RegisterExtension(E_FaceAll) - proto.RegisterExtension(E_GostringAll) - proto.RegisterExtension(E_PopulateAll) - proto.RegisterExtension(E_StringerAll) - proto.RegisterExtension(E_OnlyoneAll) - proto.RegisterExtension(E_EqualAll) - proto.RegisterExtension(E_DescriptionAll) - proto.RegisterExtension(E_TestgenAll) - proto.RegisterExtension(E_BenchgenAll) - proto.RegisterExtension(E_MarshalerAll) - proto.RegisterExtension(E_UnmarshalerAll) - proto.RegisterExtension(E_StableMarshalerAll) - proto.RegisterExtension(E_SizerAll) - proto.RegisterExtension(E_GoprotoEnumStringerAll) - proto.RegisterExtension(E_EnumStringerAll) - proto.RegisterExtension(E_UnsafeMarshalerAll) - proto.RegisterExtension(E_UnsafeUnmarshalerAll) - proto.RegisterExtension(E_GoprotoExtensionsMapAll) - proto.RegisterExtension(E_GoprotoUnrecognizedAll) - proto.RegisterExtension(E_GogoprotoImport) - proto.RegisterExtension(E_ProtosizerAll) - proto.RegisterExtension(E_CompareAll) - proto.RegisterExtension(E_TypedeclAll) - proto.RegisterExtension(E_EnumdeclAll) - proto.RegisterExtension(E_GoprotoRegistration) - proto.RegisterExtension(E_MessagenameAll) - proto.RegisterExtension(E_GoprotoSizecacheAll) - proto.RegisterExtension(E_GoprotoUnkeyedAll) - proto.RegisterExtension(E_GoprotoGetters) - proto.RegisterExtension(E_GoprotoStringer) - proto.RegisterExtension(E_VerboseEqual) - proto.RegisterExtension(E_Face) - proto.RegisterExtension(E_Gostring) - proto.RegisterExtension(E_Populate) - proto.RegisterExtension(E_Stringer) - proto.RegisterExtension(E_Onlyone) - proto.RegisterExtension(E_Equal) - proto.RegisterExtension(E_Description) - proto.RegisterExtension(E_Testgen) - proto.RegisterExtension(E_Benchgen) - proto.RegisterExtension(E_Marshaler) - proto.RegisterExtension(E_Unmarshaler) - proto.RegisterExtension(E_StableMarshaler) - proto.RegisterExtension(E_Sizer) - proto.RegisterExtension(E_UnsafeMarshaler) - proto.RegisterExtension(E_UnsafeUnmarshaler) - proto.RegisterExtension(E_GoprotoExtensionsMap) - proto.RegisterExtension(E_GoprotoUnrecognized) - proto.RegisterExtension(E_Protosizer) - proto.RegisterExtension(E_Compare) - proto.RegisterExtension(E_Typedecl) - proto.RegisterExtension(E_Messagename) - proto.RegisterExtension(E_GoprotoSizecache) - proto.RegisterExtension(E_GoprotoUnkeyed) - proto.RegisterExtension(E_Nullable) - proto.RegisterExtension(E_Embed) - proto.RegisterExtension(E_Customtype) - proto.RegisterExtension(E_Customname) - proto.RegisterExtension(E_Jsontag) - proto.RegisterExtension(E_Moretags) - proto.RegisterExtension(E_Casttype) - proto.RegisterExtension(E_Castkey) - proto.RegisterExtension(E_Castvalue) - proto.RegisterExtension(E_Stdtime) - proto.RegisterExtension(E_Stdduration) - proto.RegisterExtension(E_Wktpointer) -} - -func init() { proto.RegisterFile("gogo.proto", fileDescriptor_592445b5231bc2b9) } - -var fileDescriptor_592445b5231bc2b9 = []byte{ - // 1328 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x98, 0x49, 0x6f, 0x1c, 0x45, - 0x14, 0x80, 0x85, 0x48, 0x64, 0x4f, 0x79, 0x8b, 0xc7, 0xc6, 0x84, 0x08, 0x44, 0xe0, 0xc4, 0xc9, - 0x3e, 0x45, 0x28, 0x65, 0x45, 0x96, 0x63, 0x39, 0x56, 0x10, 0x0e, 0xc6, 0x89, 0xc3, 0x76, 0x18, - 0xf5, 0xf4, 0x94, 0xdb, 0x8d, 0xbb, 0xbb, 0x9a, 0xee, 0xea, 0x10, 0xe7, 0x86, 0xc2, 0x22, 0x84, - 0xd8, 0x91, 0x20, 0x21, 0x09, 0x04, 0xc4, 0xbe, 0x86, 0x7d, 0xb9, 0x70, 0x61, 0xb9, 0xf2, 0x1f, - 0xb8, 0x00, 0x66, 0xf7, 0xcd, 0x17, 0xf4, 0xba, 0xdf, 0xeb, 0xa9, 0x69, 0x8f, 0x54, 0x35, 0xb7, - 0xf6, 0xb8, 0xbe, 0x6f, 0xaa, 0xdf, 0xeb, 0x7a, 0xef, 0x4d, 0x33, 0xe6, 0x49, 0x4f, 0x4e, 0xc6, - 0x89, 0x54, 0xb2, 0x5e, 0x83, 0xeb, 0xfc, 0x72, 0xdf, 0x7e, 0x4f, 0x4a, 0x2f, 0x10, 0x53, 0xf9, - 0x5f, 0xcd, 0x6c, 0x75, 0xaa, 0x25, 0x52, 0x37, 0xf1, 0x63, 0x25, 0x93, 0x62, 0x31, 0x3f, 0xc6, - 0xc6, 0x70, 0x71, 0x43, 0x44, 0x59, 0xd8, 0x88, 0x13, 0xb1, 0xea, 0x9f, 0xae, 0x5f, 0x3f, 0x59, - 0x90, 0x93, 0x44, 0x4e, 0xce, 0x47, 0x59, 0x78, 0x47, 0xac, 0x7c, 0x19, 0xa5, 0x7b, 0xaf, 0xfc, - 0x72, 0xf5, 0xfe, 0xab, 0x6e, 0xe9, 0x5f, 0x1e, 0x45, 0x14, 0xfe, 0xb7, 0x94, 0x83, 0x7c, 0x99, - 0x5d, 0xd3, 0xe1, 0x4b, 0x55, 0xe2, 0x47, 0x9e, 0x48, 0x0c, 0xc6, 0xef, 0xd1, 0x38, 0xa6, 0x19, - 0x8f, 0x23, 0xca, 0xe7, 0xd8, 0x50, 0x2f, 0xae, 0x1f, 0xd0, 0x35, 0x28, 0x74, 0xc9, 0x02, 0x1b, - 0xc9, 0x25, 0x6e, 0x96, 0x2a, 0x19, 0x46, 0x4e, 0x28, 0x0c, 0x9a, 0x1f, 0x73, 0x4d, 0x6d, 0x79, - 0x18, 0xb0, 0xb9, 0x92, 0xe2, 0x9c, 0xf5, 0xc3, 0x27, 0x2d, 0xe1, 0x06, 0x06, 0xc3, 0x4f, 0xb8, - 0x91, 0x72, 0x3d, 0x3f, 0xc9, 0xc6, 0xe1, 0xfa, 0x94, 0x13, 0x64, 0x42, 0xdf, 0xc9, 0x4d, 0x5d, - 0x3d, 0x27, 0x61, 0x19, 0xc9, 0x7e, 0x3e, 0xbb, 0x2b, 0xdf, 0xce, 0x58, 0x29, 0xd0, 0xf6, 0xa4, - 0x65, 0xd1, 0x13, 0x4a, 0x89, 0x24, 0x6d, 0x38, 0x41, 0xb7, 0xed, 0x1d, 0xf1, 0x83, 0xd2, 0x78, - 0x6e, 0xb3, 0x33, 0x8b, 0x0b, 0x05, 0x39, 0x1b, 0x04, 0x7c, 0x85, 0x5d, 0xdb, 0xe5, 0xa9, 0xb0, - 0x70, 0x9e, 0x47, 0xe7, 0xf8, 0x8e, 0x27, 0x03, 0xb4, 0x4b, 0x8c, 0x3e, 0x2f, 0x73, 0x69, 0xe1, - 0x7c, 0x19, 0x9d, 0x75, 0x64, 0x29, 0xa5, 0x60, 0xbc, 0x8d, 0x8d, 0x9e, 0x12, 0x49, 0x53, 0xa6, - 0xa2, 0x21, 0x1e, 0xc8, 0x9c, 0xc0, 0x42, 0x77, 0x01, 0x75, 0x23, 0x08, 0xce, 0x03, 0x07, 0xae, - 0x83, 0xac, 0x7f, 0xd5, 0x71, 0x85, 0x85, 0xe2, 0x22, 0x2a, 0xfa, 0x60, 0x3d, 0xa0, 0xb3, 0x6c, - 0xd0, 0x93, 0xc5, 0x2d, 0x59, 0xe0, 0x97, 0x10, 0x1f, 0x20, 0x06, 0x15, 0xb1, 0x8c, 0xb3, 0xc0, - 0x51, 0x36, 0x3b, 0x78, 0x85, 0x14, 0xc4, 0xa0, 0xa2, 0x87, 0xb0, 0xbe, 0x4a, 0x8a, 0x54, 0x8b, - 0xe7, 0x0c, 0x1b, 0x90, 0x51, 0xb0, 0x21, 0x23, 0x9b, 0x4d, 0x5c, 0x46, 0x03, 0x43, 0x04, 0x04, - 0xd3, 0xac, 0x66, 0x9b, 0x88, 0x37, 0x36, 0xe9, 0x78, 0x50, 0x06, 0x16, 0xd8, 0x08, 0x15, 0x28, - 0x5f, 0x46, 0x16, 0x8a, 0x37, 0x51, 0x31, 0xac, 0x61, 0x78, 0x1b, 0x4a, 0xa4, 0xca, 0x13, 0x36, - 0x92, 0xb7, 0xe8, 0x36, 0x10, 0xc1, 0x50, 0x36, 0x45, 0xe4, 0xae, 0xd9, 0x19, 0xde, 0xa6, 0x50, - 0x12, 0x03, 0x8a, 0x39, 0x36, 0x14, 0x3a, 0x49, 0xba, 0xe6, 0x04, 0x56, 0xe9, 0x78, 0x07, 0x1d, - 0x83, 0x25, 0x84, 0x11, 0xc9, 0xa2, 0x5e, 0x34, 0xef, 0x52, 0x44, 0x34, 0x0c, 0x8f, 0x5e, 0xaa, - 0x9c, 0x66, 0x20, 0x1a, 0xbd, 0xd8, 0xde, 0xa3, 0xa3, 0x57, 0xb0, 0x8b, 0xba, 0x71, 0x9a, 0xd5, - 0x52, 0xff, 0x8c, 0x95, 0xe6, 0x7d, 0xca, 0x74, 0x0e, 0x00, 0x7c, 0x0f, 0xbb, 0xae, 0x6b, 0x9b, - 0xb0, 0x90, 0x7d, 0x80, 0xb2, 0x89, 0x2e, 0xad, 0x02, 0x4b, 0x42, 0xaf, 0xca, 0x0f, 0xa9, 0x24, - 0x88, 0x8a, 0x6b, 0x89, 0x8d, 0x67, 0x51, 0xea, 0xac, 0xf6, 0x16, 0xb5, 0x8f, 0x28, 0x6a, 0x05, - 0xdb, 0x11, 0xb5, 0x13, 0x6c, 0x02, 0x8d, 0xbd, 0xe5, 0xf5, 0x63, 0x2a, 0xac, 0x05, 0xbd, 0xd2, - 0x99, 0xdd, 0xfb, 0xd8, 0xbe, 0x32, 0x9c, 0xa7, 0x95, 0x88, 0x52, 0x60, 0x1a, 0xa1, 0x13, 0x5b, - 0x98, 0xaf, 0xa0, 0x99, 0x2a, 0xfe, 0x7c, 0x29, 0x58, 0x74, 0x62, 0x90, 0xdf, 0xcd, 0xf6, 0x92, - 0x3c, 0x8b, 0x12, 0xe1, 0x4a, 0x2f, 0xf2, 0xcf, 0x88, 0x96, 0x85, 0xfa, 0x93, 0x4a, 0xaa, 0x56, - 0x34, 0x1c, 0xcc, 0x47, 0xd9, 0x9e, 0x72, 0x56, 0x69, 0xf8, 0x61, 0x2c, 0x13, 0x65, 0x30, 0x7e, - 0x4a, 0x99, 0x2a, 0xb9, 0xa3, 0x39, 0xc6, 0xe7, 0xd9, 0x70, 0xfe, 0xa7, 0xed, 0x23, 0xf9, 0x19, - 0x8a, 0x86, 0xda, 0x14, 0x16, 0x0e, 0x57, 0x86, 0xb1, 0x93, 0xd8, 0xd4, 0xbf, 0xcf, 0xa9, 0x70, - 0x20, 0x82, 0x85, 0x43, 0x6d, 0xc4, 0x02, 0xba, 0xbd, 0x85, 0xe1, 0x0b, 0x2a, 0x1c, 0xc4, 0xa0, - 0x82, 0x06, 0x06, 0x0b, 0xc5, 0x97, 0xa4, 0x20, 0x06, 0x14, 0x77, 0xb6, 0x1b, 0x6d, 0x22, 0x3c, - 0x3f, 0x55, 0x89, 0x03, 0xab, 0x0d, 0xaa, 0xaf, 0x36, 0x3b, 0x87, 0xb0, 0x65, 0x0d, 0x85, 0x4a, - 0x14, 0x8a, 0x34, 0x75, 0x3c, 0x01, 0x13, 0x87, 0xc5, 0xc6, 0xbe, 0xa6, 0x4a, 0xa4, 0x61, 0xb0, - 0x37, 0x6d, 0x42, 0x84, 0xb0, 0xbb, 0x8e, 0xbb, 0x66, 0xa3, 0xfb, 0xa6, 0xb2, 0xb9, 0xe3, 0xc4, - 0x82, 0x53, 0x9b, 0x7f, 0xb2, 0x68, 0x5d, 0x6c, 0x58, 0x3d, 0x9d, 0xdf, 0x56, 0xe6, 0x9f, 0x95, - 0x82, 0x2c, 0x6a, 0xc8, 0x48, 0x65, 0x9e, 0xaa, 0xdf, 0xb8, 0xc3, 0xb5, 0x58, 0xdc, 0x17, 0xe9, - 0x1e, 0xda, 0xc2, 0xfb, 0xed, 0x1c, 0xa7, 0xf8, 0xed, 0xf0, 0x90, 0x77, 0x0e, 0x3d, 0x66, 0xd9, - 0xd9, 0xad, 0xf2, 0x39, 0xef, 0x98, 0x79, 0xf8, 0x11, 0x36, 0xd4, 0x31, 0xf0, 0x98, 0x55, 0x0f, - 0xa3, 0x6a, 0x50, 0x9f, 0x77, 0xf8, 0x01, 0xb6, 0x0b, 0x86, 0x17, 0x33, 0xfe, 0x08, 0xe2, 0xf9, - 0x72, 0x7e, 0x88, 0xf5, 0xd3, 0xd0, 0x62, 0x46, 0x1f, 0x45, 0xb4, 0x44, 0x00, 0xa7, 0x81, 0xc5, - 0x8c, 0x3f, 0x46, 0x38, 0x21, 0x80, 0xdb, 0x87, 0xf0, 0xbb, 0x27, 0x76, 0x61, 0xd3, 0xa1, 0xd8, - 0x4d, 0xb3, 0x3e, 0x9c, 0x54, 0xcc, 0xf4, 0xe3, 0xf8, 0xe5, 0x44, 0xf0, 0x5b, 0xd9, 0x6e, 0xcb, - 0x80, 0x3f, 0x89, 0x68, 0xb1, 0x9e, 0xcf, 0xb1, 0x01, 0x6d, 0x3a, 0x31, 0xe3, 0x4f, 0x21, 0xae, - 0x53, 0xb0, 0x75, 0x9c, 0x4e, 0xcc, 0x82, 0xa7, 0x69, 0xeb, 0x48, 0x40, 0xd8, 0x68, 0x30, 0x31, - 0xd3, 0xcf, 0x50, 0xd4, 0x09, 0xe1, 0x33, 0xac, 0x56, 0x36, 0x1b, 0x33, 0xff, 0x2c, 0xf2, 0x6d, - 0x06, 0x22, 0xa0, 0x35, 0x3b, 0xb3, 0xe2, 0x39, 0x8a, 0x80, 0x46, 0xc1, 0x31, 0xaa, 0x0e, 0x30, - 0x66, 0xd3, 0xf3, 0x74, 0x8c, 0x2a, 0xf3, 0x0b, 0x64, 0x33, 0xaf, 0xf9, 0x66, 0xc5, 0x0b, 0x94, - 0xcd, 0x7c, 0x3d, 0x6c, 0xa3, 0x3a, 0x11, 0x98, 0x1d, 0x2f, 0xd2, 0x36, 0x2a, 0x03, 0x01, 0x5f, - 0x62, 0xf5, 0x9d, 0xd3, 0x80, 0xd9, 0xf7, 0x12, 0xfa, 0x46, 0x77, 0x0c, 0x03, 0xfc, 0x2e, 0x36, - 0xd1, 0x7d, 0x12, 0x30, 0x5b, 0xcf, 0x6d, 0x55, 0x7e, 0xbb, 0xe9, 0x83, 0x00, 0x3f, 0xd1, 0x6e, - 0x29, 0xfa, 0x14, 0x60, 0xd6, 0x9e, 0xdf, 0xea, 0x2c, 0xdc, 0xfa, 0x10, 0xc0, 0x67, 0x19, 0x6b, - 0x37, 0x60, 0xb3, 0xeb, 0x02, 0xba, 0x34, 0x08, 0x8e, 0x06, 0xf6, 0x5f, 0x33, 0x7f, 0x91, 0x8e, - 0x06, 0x12, 0x70, 0x34, 0xa8, 0xf5, 0x9a, 0xe9, 0x4b, 0x74, 0x34, 0x08, 0x81, 0x27, 0x5b, 0xeb, - 0x6e, 0x66, 0xc3, 0x65, 0x7a, 0xb2, 0x35, 0x8a, 0x1f, 0x63, 0xa3, 0x3b, 0x1a, 0xa2, 0x59, 0xf5, - 0x1a, 0xaa, 0xf6, 0x54, 0xfb, 0xa1, 0xde, 0xbc, 0xb0, 0x19, 0x9a, 0x6d, 0xaf, 0x57, 0x9a, 0x17, - 0xf6, 0x42, 0x3e, 0xcd, 0xfa, 0xa3, 0x2c, 0x08, 0xe0, 0xf0, 0xd4, 0x6f, 0xe8, 0xd2, 0x4d, 0x45, - 0xd0, 0x22, 0xc5, 0xaf, 0xdb, 0x18, 0x1d, 0x02, 0xf8, 0x01, 0xb6, 0x5b, 0x84, 0x4d, 0xd1, 0x32, - 0x91, 0xbf, 0x6d, 0x53, 0xc1, 0x84, 0xd5, 0x7c, 0x86, 0xb1, 0xe2, 0xd5, 0x08, 0x84, 0xd9, 0xc4, - 0xfe, 0xbe, 0x5d, 0xbc, 0xa5, 0xd1, 0x90, 0xb6, 0x20, 0x4f, 0x8a, 0x41, 0xb0, 0xd9, 0x29, 0xc8, - 0x33, 0x72, 0x90, 0xf5, 0xdd, 0x9f, 0xca, 0x48, 0x39, 0x9e, 0x89, 0xfe, 0x03, 0x69, 0x5a, 0x0f, - 0x01, 0x0b, 0x65, 0x22, 0x94, 0xe3, 0xa5, 0x26, 0xf6, 0x4f, 0x64, 0x4b, 0x00, 0x60, 0xd7, 0x49, - 0x95, 0xcd, 0x7d, 0xff, 0x45, 0x30, 0x01, 0xb0, 0x69, 0xb8, 0x5e, 0x17, 0x1b, 0x26, 0xf6, 0x6f, - 0xda, 0x34, 0xae, 0xe7, 0x87, 0x58, 0x0d, 0x2e, 0xf3, 0xb7, 0x4a, 0x26, 0xf8, 0x1f, 0x84, 0xdb, - 0x04, 0x7c, 0x73, 0xaa, 0x5a, 0xca, 0x37, 0x07, 0xfb, 0x5f, 0xcc, 0x34, 0xad, 0xe7, 0xb3, 0x6c, - 0x20, 0x55, 0xad, 0x56, 0x86, 0xf3, 0xa9, 0x01, 0xff, 0x6f, 0xbb, 0x7c, 0x65, 0x51, 0x32, 0x90, - 0xed, 0x07, 0xd7, 0x55, 0x2c, 0xfd, 0x48, 0x89, 0xc4, 0x64, 0xd8, 0x42, 0x83, 0x86, 0x1c, 0x9e, - 0x67, 0x63, 0xae, 0x0c, 0xab, 0xdc, 0x61, 0xb6, 0x20, 0x17, 0xe4, 0x52, 0x5e, 0x67, 0xee, 0xbd, - 0xd9, 0xf3, 0xd5, 0x5a, 0xd6, 0x9c, 0x74, 0x65, 0x38, 0x05, 0xbf, 0x3c, 0xda, 0x2f, 0x54, 0xcb, - 0xdf, 0x21, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0x9c, 0xaf, 0x70, 0x4e, 0x83, 0x15, 0x00, 0x00, -} diff --git a/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.golden b/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.golden deleted file mode 100644 index f6502e4b90..0000000000 --- a/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.golden +++ /dev/null @@ -1,45 +0,0 @@ -// Code generated by protoc-gen-go. -// source: gogo.proto -// DO NOT EDIT! - -package gogoproto - -import proto "github.com/gogo/protobuf/proto" -import json "encoding/json" -import math "math" -import google_protobuf "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - -// Reference proto, json, and math imports to suppress error if they are not otherwise used. -var _ = proto.Marshal -var _ = &json.SyntaxError{} -var _ = math.Inf - -var E_Nullable = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 51235, - Name: "gogoproto.nullable", - Tag: "varint,51235,opt,name=nullable", -} - -var E_Embed = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 51236, - Name: "gogoproto.embed", - Tag: "varint,51236,opt,name=embed", -} - -var E_Customtype = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 51237, - Name: "gogoproto.customtype", - Tag: "bytes,51237,opt,name=customtype", -} - -func init() { - proto.RegisterExtension(E_Nullable) - proto.RegisterExtension(E_Embed) - proto.RegisterExtension(E_Customtype) -} diff --git a/vendor/github.com/gogo/protobuf/gogoproto/gogo.proto b/vendor/github.com/gogo/protobuf/gogoproto/gogo.proto deleted file mode 100644 index b80c85653f..0000000000 --- a/vendor/github.com/gogo/protobuf/gogoproto/gogo.proto +++ /dev/null @@ -1,144 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto2"; -package gogoproto; - -import "google/protobuf/descriptor.proto"; - -option java_package = "com.google.protobuf"; -option java_outer_classname = "GoGoProtos"; -option go_package = "github.com/gogo/protobuf/gogoproto"; - -extend google.protobuf.EnumOptions { - optional bool goproto_enum_prefix = 62001; - optional bool goproto_enum_stringer = 62021; - optional bool enum_stringer = 62022; - optional string enum_customname = 62023; - optional bool enumdecl = 62024; -} - -extend google.protobuf.EnumValueOptions { - optional string enumvalue_customname = 66001; -} - -extend google.protobuf.FileOptions { - optional bool goproto_getters_all = 63001; - optional bool goproto_enum_prefix_all = 63002; - optional bool goproto_stringer_all = 63003; - optional bool verbose_equal_all = 63004; - optional bool face_all = 63005; - optional bool gostring_all = 63006; - optional bool populate_all = 63007; - optional bool stringer_all = 63008; - optional bool onlyone_all = 63009; - - optional bool equal_all = 63013; - optional bool description_all = 63014; - optional bool testgen_all = 63015; - optional bool benchgen_all = 63016; - optional bool marshaler_all = 63017; - optional bool unmarshaler_all = 63018; - optional bool stable_marshaler_all = 63019; - - optional bool sizer_all = 63020; - - optional bool goproto_enum_stringer_all = 63021; - optional bool enum_stringer_all = 63022; - - optional bool unsafe_marshaler_all = 63023; - optional bool unsafe_unmarshaler_all = 63024; - - optional bool goproto_extensions_map_all = 63025; - optional bool goproto_unrecognized_all = 63026; - optional bool gogoproto_import = 63027; - optional bool protosizer_all = 63028; - optional bool compare_all = 63029; - optional bool typedecl_all = 63030; - optional bool enumdecl_all = 63031; - - optional bool goproto_registration = 63032; - optional bool messagename_all = 63033; - - optional bool goproto_sizecache_all = 63034; - optional bool goproto_unkeyed_all = 63035; -} - -extend google.protobuf.MessageOptions { - optional bool goproto_getters = 64001; - optional bool goproto_stringer = 64003; - optional bool verbose_equal = 64004; - optional bool face = 64005; - optional bool gostring = 64006; - optional bool populate = 64007; - optional bool stringer = 67008; - optional bool onlyone = 64009; - - optional bool equal = 64013; - optional bool description = 64014; - optional bool testgen = 64015; - optional bool benchgen = 64016; - optional bool marshaler = 64017; - optional bool unmarshaler = 64018; - optional bool stable_marshaler = 64019; - - optional bool sizer = 64020; - - optional bool unsafe_marshaler = 64023; - optional bool unsafe_unmarshaler = 64024; - - optional bool goproto_extensions_map = 64025; - optional bool goproto_unrecognized = 64026; - - optional bool protosizer = 64028; - optional bool compare = 64029; - - optional bool typedecl = 64030; - - optional bool messagename = 64033; - - optional bool goproto_sizecache = 64034; - optional bool goproto_unkeyed = 64035; -} - -extend google.protobuf.FieldOptions { - optional bool nullable = 65001; - optional bool embed = 65002; - optional string customtype = 65003; - optional string customname = 65004; - optional string jsontag = 65005; - optional string moretags = 65006; - optional string casttype = 65007; - optional string castkey = 65008; - optional string castvalue = 65009; - - optional bool stdtime = 65010; - optional bool stdduration = 65011; - optional bool wktpointer = 65012; - -} diff --git a/vendor/github.com/gogo/protobuf/gogoproto/helper.go b/vendor/github.com/gogo/protobuf/gogoproto/helper.go deleted file mode 100644 index 390d4e4be6..0000000000 --- a/vendor/github.com/gogo/protobuf/gogoproto/helper.go +++ /dev/null @@ -1,415 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package gogoproto - -import google_protobuf "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" -import proto "github.com/gogo/protobuf/proto" - -func IsEmbed(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Embed, false) -} - -func IsNullable(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Nullable, true) -} - -func IsStdTime(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Stdtime, false) -} - -func IsStdDuration(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Stdduration, false) -} - -func IsStdDouble(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.DoubleValue" -} - -func IsStdFloat(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.FloatValue" -} - -func IsStdInt64(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.Int64Value" -} - -func IsStdUInt64(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.UInt64Value" -} - -func IsStdInt32(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.Int32Value" -} - -func IsStdUInt32(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.UInt32Value" -} - -func IsStdBool(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.BoolValue" -} - -func IsStdString(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.StringValue" -} - -func IsStdBytes(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.BytesValue" -} - -func IsStdType(field *google_protobuf.FieldDescriptorProto) bool { - return (IsStdTime(field) || IsStdDuration(field) || - IsStdDouble(field) || IsStdFloat(field) || - IsStdInt64(field) || IsStdUInt64(field) || - IsStdInt32(field) || IsStdUInt32(field) || - IsStdBool(field) || - IsStdString(field) || IsStdBytes(field)) -} - -func IsWktPtr(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) -} - -func NeedsNilCheck(proto3 bool, field *google_protobuf.FieldDescriptorProto) bool { - nullable := IsNullable(field) - if field.IsMessage() || IsCustomType(field) { - return nullable - } - if proto3 { - return false - } - return nullable || *field.Type == google_protobuf.FieldDescriptorProto_TYPE_BYTES -} - -func IsCustomType(field *google_protobuf.FieldDescriptorProto) bool { - typ := GetCustomType(field) - if len(typ) > 0 { - return true - } - return false -} - -func IsCastType(field *google_protobuf.FieldDescriptorProto) bool { - typ := GetCastType(field) - if len(typ) > 0 { - return true - } - return false -} - -func IsCastKey(field *google_protobuf.FieldDescriptorProto) bool { - typ := GetCastKey(field) - if len(typ) > 0 { - return true - } - return false -} - -func IsCastValue(field *google_protobuf.FieldDescriptorProto) bool { - typ := GetCastValue(field) - if len(typ) > 0 { - return true - } - return false -} - -func HasEnumDecl(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { - return proto.GetBoolExtension(enum.Options, E_Enumdecl, proto.GetBoolExtension(file.Options, E_EnumdeclAll, true)) -} - -func HasTypeDecl(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Typedecl, proto.GetBoolExtension(file.Options, E_TypedeclAll, true)) -} - -func GetCustomType(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Customtype) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetCastType(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Casttype) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetCastKey(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Castkey) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetCastValue(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Castvalue) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func IsCustomName(field *google_protobuf.FieldDescriptorProto) bool { - name := GetCustomName(field) - if len(name) > 0 { - return true - } - return false -} - -func IsEnumCustomName(field *google_protobuf.EnumDescriptorProto) bool { - name := GetEnumCustomName(field) - if len(name) > 0 { - return true - } - return false -} - -func IsEnumValueCustomName(field *google_protobuf.EnumValueDescriptorProto) bool { - name := GetEnumValueCustomName(field) - if len(name) > 0 { - return true - } - return false -} - -func GetCustomName(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Customname) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetEnumCustomName(field *google_protobuf.EnumDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_EnumCustomname) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetEnumValueCustomName(field *google_protobuf.EnumValueDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_EnumvalueCustomname) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetJsonTag(field *google_protobuf.FieldDescriptorProto) *string { - if field == nil { - return nil - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Jsontag) - if err == nil && v.(*string) != nil { - return (v.(*string)) - } - } - return nil -} - -func GetMoreTags(field *google_protobuf.FieldDescriptorProto) *string { - if field == nil { - return nil - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Moretags) - if err == nil && v.(*string) != nil { - return (v.(*string)) - } - } - return nil -} - -type EnableFunc func(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool - -func EnabledGoEnumPrefix(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { - return proto.GetBoolExtension(enum.Options, E_GoprotoEnumPrefix, proto.GetBoolExtension(file.Options, E_GoprotoEnumPrefixAll, true)) -} - -func EnabledGoStringer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoStringer, proto.GetBoolExtension(file.Options, E_GoprotoStringerAll, true)) -} - -func HasGoGetters(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoGetters, proto.GetBoolExtension(file.Options, E_GoprotoGettersAll, true)) -} - -func IsUnion(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Onlyone, proto.GetBoolExtension(file.Options, E_OnlyoneAll, false)) -} - -func HasGoString(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Gostring, proto.GetBoolExtension(file.Options, E_GostringAll, false)) -} - -func HasEqual(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Equal, proto.GetBoolExtension(file.Options, E_EqualAll, false)) -} - -func HasVerboseEqual(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_VerboseEqual, proto.GetBoolExtension(file.Options, E_VerboseEqualAll, false)) -} - -func IsStringer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Stringer, proto.GetBoolExtension(file.Options, E_StringerAll, false)) -} - -func IsFace(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Face, proto.GetBoolExtension(file.Options, E_FaceAll, false)) -} - -func HasDescription(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Description, proto.GetBoolExtension(file.Options, E_DescriptionAll, false)) -} - -func HasPopulate(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Populate, proto.GetBoolExtension(file.Options, E_PopulateAll, false)) -} - -func HasTestGen(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Testgen, proto.GetBoolExtension(file.Options, E_TestgenAll, false)) -} - -func HasBenchGen(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Benchgen, proto.GetBoolExtension(file.Options, E_BenchgenAll, false)) -} - -func IsMarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Marshaler, proto.GetBoolExtension(file.Options, E_MarshalerAll, false)) -} - -func IsUnmarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Unmarshaler, proto.GetBoolExtension(file.Options, E_UnmarshalerAll, false)) -} - -func IsStableMarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_StableMarshaler, proto.GetBoolExtension(file.Options, E_StableMarshalerAll, false)) -} - -func IsSizer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Sizer, proto.GetBoolExtension(file.Options, E_SizerAll, false)) -} - -func IsProtoSizer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Protosizer, proto.GetBoolExtension(file.Options, E_ProtosizerAll, false)) -} - -func IsGoEnumStringer(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { - return proto.GetBoolExtension(enum.Options, E_GoprotoEnumStringer, proto.GetBoolExtension(file.Options, E_GoprotoEnumStringerAll, true)) -} - -func IsEnumStringer(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { - return proto.GetBoolExtension(enum.Options, E_EnumStringer, proto.GetBoolExtension(file.Options, E_EnumStringerAll, false)) -} - -func IsUnsafeMarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_UnsafeMarshaler, proto.GetBoolExtension(file.Options, E_UnsafeMarshalerAll, false)) -} - -func IsUnsafeUnmarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_UnsafeUnmarshaler, proto.GetBoolExtension(file.Options, E_UnsafeUnmarshalerAll, false)) -} - -func HasExtensionsMap(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoExtensionsMap, proto.GetBoolExtension(file.Options, E_GoprotoExtensionsMapAll, true)) -} - -func HasUnrecognized(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoUnrecognized, proto.GetBoolExtension(file.Options, E_GoprotoUnrecognizedAll, true)) -} - -func IsProto3(file *google_protobuf.FileDescriptorProto) bool { - return file.GetSyntax() == "proto3" -} - -func ImportsGoGoProto(file *google_protobuf.FileDescriptorProto) bool { - return proto.GetBoolExtension(file.Options, E_GogoprotoImport, true) -} - -func HasCompare(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Compare, proto.GetBoolExtension(file.Options, E_CompareAll, false)) -} - -func RegistersGolangProto(file *google_protobuf.FileDescriptorProto) bool { - return proto.GetBoolExtension(file.Options, E_GoprotoRegistration, false) -} - -func HasMessageName(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Messagename, proto.GetBoolExtension(file.Options, E_MessagenameAll, false)) -} - -func HasSizecache(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoSizecache, proto.GetBoolExtension(file.Options, E_GoprotoSizecacheAll, true)) -} - -func HasUnkeyed(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoUnkeyed, proto.GetBoolExtension(file.Options, E_GoprotoUnkeyedAll, true)) -} diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/Makefile b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/Makefile deleted file mode 100644 index 3496dc99d5..0000000000 --- a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# Go support for Protocol Buffers - Google's data interchange format -# -# Copyright 2010 The Go Authors. All rights reserved. -# https://github.com/golang/protobuf -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -regenerate: - go install github.com/gogo/protobuf/protoc-gen-gogo - go install github.com/gogo/protobuf/protoc-gen-gostring - protoc --gogo_out=. -I=../../protobuf/google/protobuf ../../protobuf/google/protobuf/descriptor.proto - protoc --gostring_out=. -I=../../protobuf/google/protobuf ../../protobuf/google/protobuf/descriptor.proto diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go deleted file mode 100644 index a85bf1984c..0000000000 --- a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go +++ /dev/null @@ -1,118 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Package descriptor provides functions for obtaining protocol buffer -// descriptors for generated Go types. -// -// These functions cannot go in package proto because they depend on the -// generated protobuf descriptor messages, which themselves depend on proto. -package descriptor - -import ( - "bytes" - "compress/gzip" - "fmt" - "io/ioutil" - - "github.com/gogo/protobuf/proto" -) - -// extractFile extracts a FileDescriptorProto from a gzip'd buffer. -func extractFile(gz []byte) (*FileDescriptorProto, error) { - r, err := gzip.NewReader(bytes.NewReader(gz)) - if err != nil { - return nil, fmt.Errorf("failed to open gzip reader: %v", err) - } - defer r.Close() - - b, err := ioutil.ReadAll(r) - if err != nil { - return nil, fmt.Errorf("failed to uncompress descriptor: %v", err) - } - - fd := new(FileDescriptorProto) - if err := proto.Unmarshal(b, fd); err != nil { - return nil, fmt.Errorf("malformed FileDescriptorProto: %v", err) - } - - return fd, nil -} - -// Message is a proto.Message with a method to return its descriptor. -// -// Message types generated by the protocol compiler always satisfy -// the Message interface. -type Message interface { - proto.Message - Descriptor() ([]byte, []int) -} - -// ForMessage returns a FileDescriptorProto and a DescriptorProto from within it -// describing the given message. -func ForMessage(msg Message) (fd *FileDescriptorProto, md *DescriptorProto) { - gz, path := msg.Descriptor() - fd, err := extractFile(gz) - if err != nil { - panic(fmt.Sprintf("invalid FileDescriptorProto for %T: %v", msg, err)) - } - - md = fd.MessageType[path[0]] - for _, i := range path[1:] { - md = md.NestedType[i] - } - return fd, md -} - -// Is this field a scalar numeric type? -func (field *FieldDescriptorProto) IsScalar() bool { - if field.Type == nil { - return false - } - switch *field.Type { - case FieldDescriptorProto_TYPE_DOUBLE, - FieldDescriptorProto_TYPE_FLOAT, - FieldDescriptorProto_TYPE_INT64, - FieldDescriptorProto_TYPE_UINT64, - FieldDescriptorProto_TYPE_INT32, - FieldDescriptorProto_TYPE_FIXED64, - FieldDescriptorProto_TYPE_FIXED32, - FieldDescriptorProto_TYPE_BOOL, - FieldDescriptorProto_TYPE_UINT32, - FieldDescriptorProto_TYPE_ENUM, - FieldDescriptorProto_TYPE_SFIXED32, - FieldDescriptorProto_TYPE_SFIXED64, - FieldDescriptorProto_TYPE_SINT32, - FieldDescriptorProto_TYPE_SINT64: - return true - default: - return false - } -} diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go deleted file mode 100644 index 18b2a3318a..0000000000 --- a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go +++ /dev/null @@ -1,2865 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: descriptor.proto - -package descriptor - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type FieldDescriptorProto_Type int32 - -const ( - // 0 is reserved for errors. - // Order is weird for historical reasons. - FieldDescriptorProto_TYPE_DOUBLE FieldDescriptorProto_Type = 1 - FieldDescriptorProto_TYPE_FLOAT FieldDescriptorProto_Type = 2 - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - // negative values are likely. - FieldDescriptorProto_TYPE_INT64 FieldDescriptorProto_Type = 3 - FieldDescriptorProto_TYPE_UINT64 FieldDescriptorProto_Type = 4 - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - // negative values are likely. - FieldDescriptorProto_TYPE_INT32 FieldDescriptorProto_Type = 5 - FieldDescriptorProto_TYPE_FIXED64 FieldDescriptorProto_Type = 6 - FieldDescriptorProto_TYPE_FIXED32 FieldDescriptorProto_Type = 7 - FieldDescriptorProto_TYPE_BOOL FieldDescriptorProto_Type = 8 - FieldDescriptorProto_TYPE_STRING FieldDescriptorProto_Type = 9 - // Tag-delimited aggregate. - // Group type is deprecated and not supported in proto3. However, Proto3 - // implementations should still be able to parse the group wire format and - // treat group fields as unknown fields. - FieldDescriptorProto_TYPE_GROUP FieldDescriptorProto_Type = 10 - FieldDescriptorProto_TYPE_MESSAGE FieldDescriptorProto_Type = 11 - // New in version 2. - FieldDescriptorProto_TYPE_BYTES FieldDescriptorProto_Type = 12 - FieldDescriptorProto_TYPE_UINT32 FieldDescriptorProto_Type = 13 - FieldDescriptorProto_TYPE_ENUM FieldDescriptorProto_Type = 14 - FieldDescriptorProto_TYPE_SFIXED32 FieldDescriptorProto_Type = 15 - FieldDescriptorProto_TYPE_SFIXED64 FieldDescriptorProto_Type = 16 - FieldDescriptorProto_TYPE_SINT32 FieldDescriptorProto_Type = 17 - FieldDescriptorProto_TYPE_SINT64 FieldDescriptorProto_Type = 18 -) - -var FieldDescriptorProto_Type_name = map[int32]string{ - 1: "TYPE_DOUBLE", - 2: "TYPE_FLOAT", - 3: "TYPE_INT64", - 4: "TYPE_UINT64", - 5: "TYPE_INT32", - 6: "TYPE_FIXED64", - 7: "TYPE_FIXED32", - 8: "TYPE_BOOL", - 9: "TYPE_STRING", - 10: "TYPE_GROUP", - 11: "TYPE_MESSAGE", - 12: "TYPE_BYTES", - 13: "TYPE_UINT32", - 14: "TYPE_ENUM", - 15: "TYPE_SFIXED32", - 16: "TYPE_SFIXED64", - 17: "TYPE_SINT32", - 18: "TYPE_SINT64", -} - -var FieldDescriptorProto_Type_value = map[string]int32{ - "TYPE_DOUBLE": 1, - "TYPE_FLOAT": 2, - "TYPE_INT64": 3, - "TYPE_UINT64": 4, - "TYPE_INT32": 5, - "TYPE_FIXED64": 6, - "TYPE_FIXED32": 7, - "TYPE_BOOL": 8, - "TYPE_STRING": 9, - "TYPE_GROUP": 10, - "TYPE_MESSAGE": 11, - "TYPE_BYTES": 12, - "TYPE_UINT32": 13, - "TYPE_ENUM": 14, - "TYPE_SFIXED32": 15, - "TYPE_SFIXED64": 16, - "TYPE_SINT32": 17, - "TYPE_SINT64": 18, -} - -func (x FieldDescriptorProto_Type) Enum() *FieldDescriptorProto_Type { - p := new(FieldDescriptorProto_Type) - *p = x - return p -} - -func (x FieldDescriptorProto_Type) String() string { - return proto.EnumName(FieldDescriptorProto_Type_name, int32(x)) -} - -func (x *FieldDescriptorProto_Type) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Type_value, data, "FieldDescriptorProto_Type") - if err != nil { - return err - } - *x = FieldDescriptorProto_Type(value) - return nil -} - -func (FieldDescriptorProto_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{4, 0} -} - -type FieldDescriptorProto_Label int32 - -const ( - // 0 is reserved for errors - FieldDescriptorProto_LABEL_OPTIONAL FieldDescriptorProto_Label = 1 - FieldDescriptorProto_LABEL_REQUIRED FieldDescriptorProto_Label = 2 - FieldDescriptorProto_LABEL_REPEATED FieldDescriptorProto_Label = 3 -) - -var FieldDescriptorProto_Label_name = map[int32]string{ - 1: "LABEL_OPTIONAL", - 2: "LABEL_REQUIRED", - 3: "LABEL_REPEATED", -} - -var FieldDescriptorProto_Label_value = map[string]int32{ - "LABEL_OPTIONAL": 1, - "LABEL_REQUIRED": 2, - "LABEL_REPEATED": 3, -} - -func (x FieldDescriptorProto_Label) Enum() *FieldDescriptorProto_Label { - p := new(FieldDescriptorProto_Label) - *p = x - return p -} - -func (x FieldDescriptorProto_Label) String() string { - return proto.EnumName(FieldDescriptorProto_Label_name, int32(x)) -} - -func (x *FieldDescriptorProto_Label) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Label_value, data, "FieldDescriptorProto_Label") - if err != nil { - return err - } - *x = FieldDescriptorProto_Label(value) - return nil -} - -func (FieldDescriptorProto_Label) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{4, 1} -} - -// Generated classes can be optimized for speed or code size. -type FileOptions_OptimizeMode int32 - -const ( - FileOptions_SPEED FileOptions_OptimizeMode = 1 - // etc. - FileOptions_CODE_SIZE FileOptions_OptimizeMode = 2 - FileOptions_LITE_RUNTIME FileOptions_OptimizeMode = 3 -) - -var FileOptions_OptimizeMode_name = map[int32]string{ - 1: "SPEED", - 2: "CODE_SIZE", - 3: "LITE_RUNTIME", -} - -var FileOptions_OptimizeMode_value = map[string]int32{ - "SPEED": 1, - "CODE_SIZE": 2, - "LITE_RUNTIME": 3, -} - -func (x FileOptions_OptimizeMode) Enum() *FileOptions_OptimizeMode { - p := new(FileOptions_OptimizeMode) - *p = x - return p -} - -func (x FileOptions_OptimizeMode) String() string { - return proto.EnumName(FileOptions_OptimizeMode_name, int32(x)) -} - -func (x *FileOptions_OptimizeMode) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FileOptions_OptimizeMode_value, data, "FileOptions_OptimizeMode") - if err != nil { - return err - } - *x = FileOptions_OptimizeMode(value) - return nil -} - -func (FileOptions_OptimizeMode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{10, 0} -} - -type FieldOptions_CType int32 - -const ( - // Default mode. - FieldOptions_STRING FieldOptions_CType = 0 - FieldOptions_CORD FieldOptions_CType = 1 - FieldOptions_STRING_PIECE FieldOptions_CType = 2 -) - -var FieldOptions_CType_name = map[int32]string{ - 0: "STRING", - 1: "CORD", - 2: "STRING_PIECE", -} - -var FieldOptions_CType_value = map[string]int32{ - "STRING": 0, - "CORD": 1, - "STRING_PIECE": 2, -} - -func (x FieldOptions_CType) Enum() *FieldOptions_CType { - p := new(FieldOptions_CType) - *p = x - return p -} - -func (x FieldOptions_CType) String() string { - return proto.EnumName(FieldOptions_CType_name, int32(x)) -} - -func (x *FieldOptions_CType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldOptions_CType_value, data, "FieldOptions_CType") - if err != nil { - return err - } - *x = FieldOptions_CType(value) - return nil -} - -func (FieldOptions_CType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{12, 0} -} - -type FieldOptions_JSType int32 - -const ( - // Use the default type. - FieldOptions_JS_NORMAL FieldOptions_JSType = 0 - // Use JavaScript strings. - FieldOptions_JS_STRING FieldOptions_JSType = 1 - // Use JavaScript numbers. - FieldOptions_JS_NUMBER FieldOptions_JSType = 2 -) - -var FieldOptions_JSType_name = map[int32]string{ - 0: "JS_NORMAL", - 1: "JS_STRING", - 2: "JS_NUMBER", -} - -var FieldOptions_JSType_value = map[string]int32{ - "JS_NORMAL": 0, - "JS_STRING": 1, - "JS_NUMBER": 2, -} - -func (x FieldOptions_JSType) Enum() *FieldOptions_JSType { - p := new(FieldOptions_JSType) - *p = x - return p -} - -func (x FieldOptions_JSType) String() string { - return proto.EnumName(FieldOptions_JSType_name, int32(x)) -} - -func (x *FieldOptions_JSType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldOptions_JSType_value, data, "FieldOptions_JSType") - if err != nil { - return err - } - *x = FieldOptions_JSType(value) - return nil -} - -func (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{12, 1} -} - -// Is this method side-effect-free (or safe in HTTP parlance), or idempotent, -// or neither? HTTP based RPC implementation may choose GET verb for safe -// methods, and PUT verb for idempotent methods instead of the default POST. -type MethodOptions_IdempotencyLevel int32 - -const ( - MethodOptions_IDEMPOTENCY_UNKNOWN MethodOptions_IdempotencyLevel = 0 - MethodOptions_NO_SIDE_EFFECTS MethodOptions_IdempotencyLevel = 1 - MethodOptions_IDEMPOTENT MethodOptions_IdempotencyLevel = 2 -) - -var MethodOptions_IdempotencyLevel_name = map[int32]string{ - 0: "IDEMPOTENCY_UNKNOWN", - 1: "NO_SIDE_EFFECTS", - 2: "IDEMPOTENT", -} - -var MethodOptions_IdempotencyLevel_value = map[string]int32{ - "IDEMPOTENCY_UNKNOWN": 0, - "NO_SIDE_EFFECTS": 1, - "IDEMPOTENT": 2, -} - -func (x MethodOptions_IdempotencyLevel) Enum() *MethodOptions_IdempotencyLevel { - p := new(MethodOptions_IdempotencyLevel) - *p = x - return p -} - -func (x MethodOptions_IdempotencyLevel) String() string { - return proto.EnumName(MethodOptions_IdempotencyLevel_name, int32(x)) -} - -func (x *MethodOptions_IdempotencyLevel) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(MethodOptions_IdempotencyLevel_value, data, "MethodOptions_IdempotencyLevel") - if err != nil { - return err - } - *x = MethodOptions_IdempotencyLevel(value) - return nil -} - -func (MethodOptions_IdempotencyLevel) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{17, 0} -} - -// The protocol compiler can output a FileDescriptorSet containing the .proto -// files it parses. -type FileDescriptorSet struct { - File []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FileDescriptorSet) Reset() { *m = FileDescriptorSet{} } -func (m *FileDescriptorSet) String() string { return proto.CompactTextString(m) } -func (*FileDescriptorSet) ProtoMessage() {} -func (*FileDescriptorSet) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{0} -} -func (m *FileDescriptorSet) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FileDescriptorSet.Unmarshal(m, b) -} -func (m *FileDescriptorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FileDescriptorSet.Marshal(b, m, deterministic) -} -func (m *FileDescriptorSet) XXX_Merge(src proto.Message) { - xxx_messageInfo_FileDescriptorSet.Merge(m, src) -} -func (m *FileDescriptorSet) XXX_Size() int { - return xxx_messageInfo_FileDescriptorSet.Size(m) -} -func (m *FileDescriptorSet) XXX_DiscardUnknown() { - xxx_messageInfo_FileDescriptorSet.DiscardUnknown(m) -} - -var xxx_messageInfo_FileDescriptorSet proto.InternalMessageInfo - -func (m *FileDescriptorSet) GetFile() []*FileDescriptorProto { - if m != nil { - return m.File - } - return nil -} - -// Describes a complete .proto file. -type FileDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Package *string `protobuf:"bytes,2,opt,name=package" json:"package,omitempty"` - // Names of files imported by this file. - Dependency []string `protobuf:"bytes,3,rep,name=dependency" json:"dependency,omitempty"` - // Indexes of the public imported files in the dependency list above. - PublicDependency []int32 `protobuf:"varint,10,rep,name=public_dependency,json=publicDependency" json:"public_dependency,omitempty"` - // Indexes of the weak imported files in the dependency list. - // For Google-internal migration only. Do not use. - WeakDependency []int32 `protobuf:"varint,11,rep,name=weak_dependency,json=weakDependency" json:"weak_dependency,omitempty"` - // All top-level definitions in this file. - MessageType []*DescriptorProto `protobuf:"bytes,4,rep,name=message_type,json=messageType" json:"message_type,omitempty"` - EnumType []*EnumDescriptorProto `protobuf:"bytes,5,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` - Service []*ServiceDescriptorProto `protobuf:"bytes,6,rep,name=service" json:"service,omitempty"` - Extension []*FieldDescriptorProto `protobuf:"bytes,7,rep,name=extension" json:"extension,omitempty"` - Options *FileOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` - // This field contains optional information about the original source code. - // You may safely remove this entire field without harming runtime - // functionality of the descriptors -- the information is needed only by - // development tools. - SourceCodeInfo *SourceCodeInfo `protobuf:"bytes,9,opt,name=source_code_info,json=sourceCodeInfo" json:"source_code_info,omitempty"` - // The syntax of the proto file. - // The supported values are "proto2" and "proto3". - Syntax *string `protobuf:"bytes,12,opt,name=syntax" json:"syntax,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FileDescriptorProto) Reset() { *m = FileDescriptorProto{} } -func (m *FileDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*FileDescriptorProto) ProtoMessage() {} -func (*FileDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{1} -} -func (m *FileDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FileDescriptorProto.Unmarshal(m, b) -} -func (m *FileDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FileDescriptorProto.Marshal(b, m, deterministic) -} -func (m *FileDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_FileDescriptorProto.Merge(m, src) -} -func (m *FileDescriptorProto) XXX_Size() int { - return xxx_messageInfo_FileDescriptorProto.Size(m) -} -func (m *FileDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_FileDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_FileDescriptorProto proto.InternalMessageInfo - -func (m *FileDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *FileDescriptorProto) GetPackage() string { - if m != nil && m.Package != nil { - return *m.Package - } - return "" -} - -func (m *FileDescriptorProto) GetDependency() []string { - if m != nil { - return m.Dependency - } - return nil -} - -func (m *FileDescriptorProto) GetPublicDependency() []int32 { - if m != nil { - return m.PublicDependency - } - return nil -} - -func (m *FileDescriptorProto) GetWeakDependency() []int32 { - if m != nil { - return m.WeakDependency - } - return nil -} - -func (m *FileDescriptorProto) GetMessageType() []*DescriptorProto { - if m != nil { - return m.MessageType - } - return nil -} - -func (m *FileDescriptorProto) GetEnumType() []*EnumDescriptorProto { - if m != nil { - return m.EnumType - } - return nil -} - -func (m *FileDescriptorProto) GetService() []*ServiceDescriptorProto { - if m != nil { - return m.Service - } - return nil -} - -func (m *FileDescriptorProto) GetExtension() []*FieldDescriptorProto { - if m != nil { - return m.Extension - } - return nil -} - -func (m *FileDescriptorProto) GetOptions() *FileOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *FileDescriptorProto) GetSourceCodeInfo() *SourceCodeInfo { - if m != nil { - return m.SourceCodeInfo - } - return nil -} - -func (m *FileDescriptorProto) GetSyntax() string { - if m != nil && m.Syntax != nil { - return *m.Syntax - } - return "" -} - -// Describes a message type. -type DescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Field []*FieldDescriptorProto `protobuf:"bytes,2,rep,name=field" json:"field,omitempty"` - Extension []*FieldDescriptorProto `protobuf:"bytes,6,rep,name=extension" json:"extension,omitempty"` - NestedType []*DescriptorProto `protobuf:"bytes,3,rep,name=nested_type,json=nestedType" json:"nested_type,omitempty"` - EnumType []*EnumDescriptorProto `protobuf:"bytes,4,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` - ExtensionRange []*DescriptorProto_ExtensionRange `protobuf:"bytes,5,rep,name=extension_range,json=extensionRange" json:"extension_range,omitempty"` - OneofDecl []*OneofDescriptorProto `protobuf:"bytes,8,rep,name=oneof_decl,json=oneofDecl" json:"oneof_decl,omitempty"` - Options *MessageOptions `protobuf:"bytes,7,opt,name=options" json:"options,omitempty"` - ReservedRange []*DescriptorProto_ReservedRange `protobuf:"bytes,9,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` - // Reserved field names, which may not be used by fields in the same message. - // A given name may only be reserved once. - ReservedName []string `protobuf:"bytes,10,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DescriptorProto) Reset() { *m = DescriptorProto{} } -func (m *DescriptorProto) String() string { return proto.CompactTextString(m) } -func (*DescriptorProto) ProtoMessage() {} -func (*DescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{2} -} -func (m *DescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DescriptorProto.Unmarshal(m, b) -} -func (m *DescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DescriptorProto.Marshal(b, m, deterministic) -} -func (m *DescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_DescriptorProto.Merge(m, src) -} -func (m *DescriptorProto) XXX_Size() int { - return xxx_messageInfo_DescriptorProto.Size(m) -} -func (m *DescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_DescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_DescriptorProto proto.InternalMessageInfo - -func (m *DescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *DescriptorProto) GetField() []*FieldDescriptorProto { - if m != nil { - return m.Field - } - return nil -} - -func (m *DescriptorProto) GetExtension() []*FieldDescriptorProto { - if m != nil { - return m.Extension - } - return nil -} - -func (m *DescriptorProto) GetNestedType() []*DescriptorProto { - if m != nil { - return m.NestedType - } - return nil -} - -func (m *DescriptorProto) GetEnumType() []*EnumDescriptorProto { - if m != nil { - return m.EnumType - } - return nil -} - -func (m *DescriptorProto) GetExtensionRange() []*DescriptorProto_ExtensionRange { - if m != nil { - return m.ExtensionRange - } - return nil -} - -func (m *DescriptorProto) GetOneofDecl() []*OneofDescriptorProto { - if m != nil { - return m.OneofDecl - } - return nil -} - -func (m *DescriptorProto) GetOptions() *MessageOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *DescriptorProto) GetReservedRange() []*DescriptorProto_ReservedRange { - if m != nil { - return m.ReservedRange - } - return nil -} - -func (m *DescriptorProto) GetReservedName() []string { - if m != nil { - return m.ReservedName - } - return nil -} - -type DescriptorProto_ExtensionRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - Options *ExtensionRangeOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DescriptorProto_ExtensionRange) Reset() { *m = DescriptorProto_ExtensionRange{} } -func (m *DescriptorProto_ExtensionRange) String() string { return proto.CompactTextString(m) } -func (*DescriptorProto_ExtensionRange) ProtoMessage() {} -func (*DescriptorProto_ExtensionRange) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{2, 0} -} -func (m *DescriptorProto_ExtensionRange) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DescriptorProto_ExtensionRange.Unmarshal(m, b) -} -func (m *DescriptorProto_ExtensionRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DescriptorProto_ExtensionRange.Marshal(b, m, deterministic) -} -func (m *DescriptorProto_ExtensionRange) XXX_Merge(src proto.Message) { - xxx_messageInfo_DescriptorProto_ExtensionRange.Merge(m, src) -} -func (m *DescriptorProto_ExtensionRange) XXX_Size() int { - return xxx_messageInfo_DescriptorProto_ExtensionRange.Size(m) -} -func (m *DescriptorProto_ExtensionRange) XXX_DiscardUnknown() { - xxx_messageInfo_DescriptorProto_ExtensionRange.DiscardUnknown(m) -} - -var xxx_messageInfo_DescriptorProto_ExtensionRange proto.InternalMessageInfo - -func (m *DescriptorProto_ExtensionRange) GetStart() int32 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} - -func (m *DescriptorProto_ExtensionRange) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - -func (m *DescriptorProto_ExtensionRange) GetOptions() *ExtensionRangeOptions { - if m != nil { - return m.Options - } - return nil -} - -// Range of reserved tag numbers. Reserved tag numbers may not be used by -// fields or extension ranges in the same message. Reserved ranges may -// not overlap. -type DescriptorProto_ReservedRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DescriptorProto_ReservedRange) Reset() { *m = DescriptorProto_ReservedRange{} } -func (m *DescriptorProto_ReservedRange) String() string { return proto.CompactTextString(m) } -func (*DescriptorProto_ReservedRange) ProtoMessage() {} -func (*DescriptorProto_ReservedRange) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{2, 1} -} -func (m *DescriptorProto_ReservedRange) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DescriptorProto_ReservedRange.Unmarshal(m, b) -} -func (m *DescriptorProto_ReservedRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DescriptorProto_ReservedRange.Marshal(b, m, deterministic) -} -func (m *DescriptorProto_ReservedRange) XXX_Merge(src proto.Message) { - xxx_messageInfo_DescriptorProto_ReservedRange.Merge(m, src) -} -func (m *DescriptorProto_ReservedRange) XXX_Size() int { - return xxx_messageInfo_DescriptorProto_ReservedRange.Size(m) -} -func (m *DescriptorProto_ReservedRange) XXX_DiscardUnknown() { - xxx_messageInfo_DescriptorProto_ReservedRange.DiscardUnknown(m) -} - -var xxx_messageInfo_DescriptorProto_ReservedRange proto.InternalMessageInfo - -func (m *DescriptorProto_ReservedRange) GetStart() int32 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} - -func (m *DescriptorProto_ReservedRange) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - -type ExtensionRangeOptions struct { - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ExtensionRangeOptions) Reset() { *m = ExtensionRangeOptions{} } -func (m *ExtensionRangeOptions) String() string { return proto.CompactTextString(m) } -func (*ExtensionRangeOptions) ProtoMessage() {} -func (*ExtensionRangeOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{3} -} - -var extRange_ExtensionRangeOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*ExtensionRangeOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_ExtensionRangeOptions -} - -func (m *ExtensionRangeOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ExtensionRangeOptions.Unmarshal(m, b) -} -func (m *ExtensionRangeOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ExtensionRangeOptions.Marshal(b, m, deterministic) -} -func (m *ExtensionRangeOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExtensionRangeOptions.Merge(m, src) -} -func (m *ExtensionRangeOptions) XXX_Size() int { - return xxx_messageInfo_ExtensionRangeOptions.Size(m) -} -func (m *ExtensionRangeOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ExtensionRangeOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_ExtensionRangeOptions proto.InternalMessageInfo - -func (m *ExtensionRangeOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -// Describes a field within a message. -type FieldDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Number *int32 `protobuf:"varint,3,opt,name=number" json:"number,omitempty"` - Label *FieldDescriptorProto_Label `protobuf:"varint,4,opt,name=label,enum=google.protobuf.FieldDescriptorProto_Label" json:"label,omitempty"` - // If type_name is set, this need not be set. If both this and type_name - // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - Type *FieldDescriptorProto_Type `protobuf:"varint,5,opt,name=type,enum=google.protobuf.FieldDescriptorProto_Type" json:"type,omitempty"` - // For message and enum types, this is the name of the type. If the name - // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - // rules are used to find the type (i.e. first the nested types within this - // message are searched, then within the parent, on up to the root - // namespace). - TypeName *string `protobuf:"bytes,6,opt,name=type_name,json=typeName" json:"type_name,omitempty"` - // For extensions, this is the name of the type being extended. It is - // resolved in the same manner as type_name. - Extendee *string `protobuf:"bytes,2,opt,name=extendee" json:"extendee,omitempty"` - // For numeric types, contains the original text representation of the value. - // For booleans, "true" or "false". - // For strings, contains the default text contents (not escaped in any way). - // For bytes, contains the C escaped value. All bytes >= 128 are escaped. - // TODO(kenton): Base-64 encode? - DefaultValue *string `protobuf:"bytes,7,opt,name=default_value,json=defaultValue" json:"default_value,omitempty"` - // If set, gives the index of a oneof in the containing type's oneof_decl - // list. This field is a member of that oneof. - OneofIndex *int32 `protobuf:"varint,9,opt,name=oneof_index,json=oneofIndex" json:"oneof_index,omitempty"` - // JSON name of this field. The value is set by protocol compiler. If the - // user has set a "json_name" option on this field, that option's value - // will be used. Otherwise, it's deduced from the field's name by converting - // it to camelCase. - JsonName *string `protobuf:"bytes,10,opt,name=json_name,json=jsonName" json:"json_name,omitempty"` - Options *FieldOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FieldDescriptorProto) Reset() { *m = FieldDescriptorProto{} } -func (m *FieldDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*FieldDescriptorProto) ProtoMessage() {} -func (*FieldDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{4} -} -func (m *FieldDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FieldDescriptorProto.Unmarshal(m, b) -} -func (m *FieldDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FieldDescriptorProto.Marshal(b, m, deterministic) -} -func (m *FieldDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_FieldDescriptorProto.Merge(m, src) -} -func (m *FieldDescriptorProto) XXX_Size() int { - return xxx_messageInfo_FieldDescriptorProto.Size(m) -} -func (m *FieldDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_FieldDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_FieldDescriptorProto proto.InternalMessageInfo - -func (m *FieldDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *FieldDescriptorProto) GetNumber() int32 { - if m != nil && m.Number != nil { - return *m.Number - } - return 0 -} - -func (m *FieldDescriptorProto) GetLabel() FieldDescriptorProto_Label { - if m != nil && m.Label != nil { - return *m.Label - } - return FieldDescriptorProto_LABEL_OPTIONAL -} - -func (m *FieldDescriptorProto) GetType() FieldDescriptorProto_Type { - if m != nil && m.Type != nil { - return *m.Type - } - return FieldDescriptorProto_TYPE_DOUBLE -} - -func (m *FieldDescriptorProto) GetTypeName() string { - if m != nil && m.TypeName != nil { - return *m.TypeName - } - return "" -} - -func (m *FieldDescriptorProto) GetExtendee() string { - if m != nil && m.Extendee != nil { - return *m.Extendee - } - return "" -} - -func (m *FieldDescriptorProto) GetDefaultValue() string { - if m != nil && m.DefaultValue != nil { - return *m.DefaultValue - } - return "" -} - -func (m *FieldDescriptorProto) GetOneofIndex() int32 { - if m != nil && m.OneofIndex != nil { - return *m.OneofIndex - } - return 0 -} - -func (m *FieldDescriptorProto) GetJsonName() string { - if m != nil && m.JsonName != nil { - return *m.JsonName - } - return "" -} - -func (m *FieldDescriptorProto) GetOptions() *FieldOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes a oneof. -type OneofDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Options *OneofOptions `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OneofDescriptorProto) Reset() { *m = OneofDescriptorProto{} } -func (m *OneofDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*OneofDescriptorProto) ProtoMessage() {} -func (*OneofDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{5} -} -func (m *OneofDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OneofDescriptorProto.Unmarshal(m, b) -} -func (m *OneofDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OneofDescriptorProto.Marshal(b, m, deterministic) -} -func (m *OneofDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_OneofDescriptorProto.Merge(m, src) -} -func (m *OneofDescriptorProto) XXX_Size() int { - return xxx_messageInfo_OneofDescriptorProto.Size(m) -} -func (m *OneofDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_OneofDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_OneofDescriptorProto proto.InternalMessageInfo - -func (m *OneofDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *OneofDescriptorProto) GetOptions() *OneofOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes an enum type. -type EnumDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Value []*EnumValueDescriptorProto `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` - Options *EnumOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - // Range of reserved numeric values. Reserved numeric values may not be used - // by enum values in the same enum declaration. Reserved ranges may not - // overlap. - ReservedRange []*EnumDescriptorProto_EnumReservedRange `protobuf:"bytes,4,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` - // Reserved enum value names, which may not be reused. A given name may only - // be reserved once. - ReservedName []string `protobuf:"bytes,5,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumDescriptorProto) Reset() { *m = EnumDescriptorProto{} } -func (m *EnumDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*EnumDescriptorProto) ProtoMessage() {} -func (*EnumDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{6} -} -func (m *EnumDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumDescriptorProto.Unmarshal(m, b) -} -func (m *EnumDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumDescriptorProto.Marshal(b, m, deterministic) -} -func (m *EnumDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumDescriptorProto.Merge(m, src) -} -func (m *EnumDescriptorProto) XXX_Size() int { - return xxx_messageInfo_EnumDescriptorProto.Size(m) -} -func (m *EnumDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_EnumDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumDescriptorProto proto.InternalMessageInfo - -func (m *EnumDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *EnumDescriptorProto) GetValue() []*EnumValueDescriptorProto { - if m != nil { - return m.Value - } - return nil -} - -func (m *EnumDescriptorProto) GetOptions() *EnumOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *EnumDescriptorProto) GetReservedRange() []*EnumDescriptorProto_EnumReservedRange { - if m != nil { - return m.ReservedRange - } - return nil -} - -func (m *EnumDescriptorProto) GetReservedName() []string { - if m != nil { - return m.ReservedName - } - return nil -} - -// Range of reserved numeric values. Reserved values may not be used by -// entries in the same enum. Reserved ranges may not overlap. -// -// Note that this is distinct from DescriptorProto.ReservedRange in that it -// is inclusive such that it can appropriately represent the entire int32 -// domain. -type EnumDescriptorProto_EnumReservedRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumDescriptorProto_EnumReservedRange) Reset() { *m = EnumDescriptorProto_EnumReservedRange{} } -func (m *EnumDescriptorProto_EnumReservedRange) String() string { return proto.CompactTextString(m) } -func (*EnumDescriptorProto_EnumReservedRange) ProtoMessage() {} -func (*EnumDescriptorProto_EnumReservedRange) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{6, 0} -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Unmarshal(m, b) -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Marshal(b, m, deterministic) -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Merge(m, src) -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_Size() int { - return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Size(m) -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_DiscardUnknown() { - xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumDescriptorProto_EnumReservedRange proto.InternalMessageInfo - -func (m *EnumDescriptorProto_EnumReservedRange) GetStart() int32 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} - -func (m *EnumDescriptorProto_EnumReservedRange) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - -// Describes a value within an enum. -type EnumValueDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Number *int32 `protobuf:"varint,2,opt,name=number" json:"number,omitempty"` - Options *EnumValueOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumValueDescriptorProto) Reset() { *m = EnumValueDescriptorProto{} } -func (m *EnumValueDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*EnumValueDescriptorProto) ProtoMessage() {} -func (*EnumValueDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{7} -} -func (m *EnumValueDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumValueDescriptorProto.Unmarshal(m, b) -} -func (m *EnumValueDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumValueDescriptorProto.Marshal(b, m, deterministic) -} -func (m *EnumValueDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumValueDescriptorProto.Merge(m, src) -} -func (m *EnumValueDescriptorProto) XXX_Size() int { - return xxx_messageInfo_EnumValueDescriptorProto.Size(m) -} -func (m *EnumValueDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_EnumValueDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumValueDescriptorProto proto.InternalMessageInfo - -func (m *EnumValueDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *EnumValueDescriptorProto) GetNumber() int32 { - if m != nil && m.Number != nil { - return *m.Number - } - return 0 -} - -func (m *EnumValueDescriptorProto) GetOptions() *EnumValueOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes a service. -type ServiceDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Method []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method" json:"method,omitempty"` - Options *ServiceOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ServiceDescriptorProto) Reset() { *m = ServiceDescriptorProto{} } -func (m *ServiceDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*ServiceDescriptorProto) ProtoMessage() {} -func (*ServiceDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{8} -} -func (m *ServiceDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ServiceDescriptorProto.Unmarshal(m, b) -} -func (m *ServiceDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ServiceDescriptorProto.Marshal(b, m, deterministic) -} -func (m *ServiceDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServiceDescriptorProto.Merge(m, src) -} -func (m *ServiceDescriptorProto) XXX_Size() int { - return xxx_messageInfo_ServiceDescriptorProto.Size(m) -} -func (m *ServiceDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_ServiceDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_ServiceDescriptorProto proto.InternalMessageInfo - -func (m *ServiceDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *ServiceDescriptorProto) GetMethod() []*MethodDescriptorProto { - if m != nil { - return m.Method - } - return nil -} - -func (m *ServiceDescriptorProto) GetOptions() *ServiceOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes a method of a service. -type MethodDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - // Input and output type names. These are resolved in the same way as - // FieldDescriptorProto.type_name, but must refer to a message type. - InputType *string `protobuf:"bytes,2,opt,name=input_type,json=inputType" json:"input_type,omitempty"` - OutputType *string `protobuf:"bytes,3,opt,name=output_type,json=outputType" json:"output_type,omitempty"` - Options *MethodOptions `protobuf:"bytes,4,opt,name=options" json:"options,omitempty"` - // Identifies if client streams multiple client messages - ClientStreaming *bool `protobuf:"varint,5,opt,name=client_streaming,json=clientStreaming,def=0" json:"client_streaming,omitempty"` - // Identifies if server streams multiple server messages - ServerStreaming *bool `protobuf:"varint,6,opt,name=server_streaming,json=serverStreaming,def=0" json:"server_streaming,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MethodDescriptorProto) Reset() { *m = MethodDescriptorProto{} } -func (m *MethodDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*MethodDescriptorProto) ProtoMessage() {} -func (*MethodDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{9} -} -func (m *MethodDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MethodDescriptorProto.Unmarshal(m, b) -} -func (m *MethodDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MethodDescriptorProto.Marshal(b, m, deterministic) -} -func (m *MethodDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_MethodDescriptorProto.Merge(m, src) -} -func (m *MethodDescriptorProto) XXX_Size() int { - return xxx_messageInfo_MethodDescriptorProto.Size(m) -} -func (m *MethodDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_MethodDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_MethodDescriptorProto proto.InternalMessageInfo - -const Default_MethodDescriptorProto_ClientStreaming bool = false -const Default_MethodDescriptorProto_ServerStreaming bool = false - -func (m *MethodDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *MethodDescriptorProto) GetInputType() string { - if m != nil && m.InputType != nil { - return *m.InputType - } - return "" -} - -func (m *MethodDescriptorProto) GetOutputType() string { - if m != nil && m.OutputType != nil { - return *m.OutputType - } - return "" -} - -func (m *MethodDescriptorProto) GetOptions() *MethodOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *MethodDescriptorProto) GetClientStreaming() bool { - if m != nil && m.ClientStreaming != nil { - return *m.ClientStreaming - } - return Default_MethodDescriptorProto_ClientStreaming -} - -func (m *MethodDescriptorProto) GetServerStreaming() bool { - if m != nil && m.ServerStreaming != nil { - return *m.ServerStreaming - } - return Default_MethodDescriptorProto_ServerStreaming -} - -type FileOptions struct { - // Sets the Java package where classes generated from this .proto will be - // placed. By default, the proto package is used, but this is often - // inappropriate because proto packages do not normally start with backwards - // domain names. - JavaPackage *string `protobuf:"bytes,1,opt,name=java_package,json=javaPackage" json:"java_package,omitempty"` - // If set, all the classes from the .proto file are wrapped in a single - // outer class with the given name. This applies to both Proto1 - // (equivalent to the old "--one_java_file" option) and Proto2 (where - // a .proto always translates to a single class, but you may want to - // explicitly choose the class name). - JavaOuterClassname *string `protobuf:"bytes,8,opt,name=java_outer_classname,json=javaOuterClassname" json:"java_outer_classname,omitempty"` - // If set true, then the Java code generator will generate a separate .java - // file for each top-level message, enum, and service defined in the .proto - // file. Thus, these types will *not* be nested inside the outer class - // named by java_outer_classname. However, the outer class will still be - // generated to contain the file's getDescriptor() method as well as any - // top-level extensions defined in the file. - JavaMultipleFiles *bool `protobuf:"varint,10,opt,name=java_multiple_files,json=javaMultipleFiles,def=0" json:"java_multiple_files,omitempty"` - // This option does nothing. - JavaGenerateEqualsAndHash *bool `protobuf:"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash" json:"java_generate_equals_and_hash,omitempty"` // Deprecated: Do not use. - // If set true, then the Java2 code generator will generate code that - // throws an exception whenever an attempt is made to assign a non-UTF-8 - // byte sequence to a string field. - // Message reflection will do the same. - // However, an extension field still accepts non-UTF-8 byte sequences. - // This option has no effect on when used with the lite runtime. - JavaStringCheckUtf8 *bool `protobuf:"varint,27,opt,name=java_string_check_utf8,json=javaStringCheckUtf8,def=0" json:"java_string_check_utf8,omitempty"` - OptimizeFor *FileOptions_OptimizeMode `protobuf:"varint,9,opt,name=optimize_for,json=optimizeFor,enum=google.protobuf.FileOptions_OptimizeMode,def=1" json:"optimize_for,omitempty"` - // Sets the Go package where structs generated from this .proto will be - // placed. If omitted, the Go package will be derived from the following: - // - The basename of the package import path, if provided. - // - Otherwise, the package statement in the .proto file, if present. - // - Otherwise, the basename of the .proto file, without extension. - GoPackage *string `protobuf:"bytes,11,opt,name=go_package,json=goPackage" json:"go_package,omitempty"` - // Should generic services be generated in each language? "Generic" services - // are not specific to any particular RPC system. They are generated by the - // main code generators in each language (without additional plugins). - // Generic services were the only kind of service generation supported by - // early versions of google.protobuf. - // - // Generic services are now considered deprecated in favor of using plugins - // that generate code specific to your particular RPC system. Therefore, - // these default to false. Old code which depends on generic services should - // explicitly set them to true. - CcGenericServices *bool `protobuf:"varint,16,opt,name=cc_generic_services,json=ccGenericServices,def=0" json:"cc_generic_services,omitempty"` - JavaGenericServices *bool `protobuf:"varint,17,opt,name=java_generic_services,json=javaGenericServices,def=0" json:"java_generic_services,omitempty"` - PyGenericServices *bool `protobuf:"varint,18,opt,name=py_generic_services,json=pyGenericServices,def=0" json:"py_generic_services,omitempty"` - PhpGenericServices *bool `protobuf:"varint,42,opt,name=php_generic_services,json=phpGenericServices,def=0" json:"php_generic_services,omitempty"` - // Is this file deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for everything in the file, or it will be completely ignored; in the very - // least, this is a formalization for deprecating files. - Deprecated *bool `protobuf:"varint,23,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // Enables the use of arenas for the proto messages in this file. This applies - // only to generated classes for C++. - CcEnableArenas *bool `protobuf:"varint,31,opt,name=cc_enable_arenas,json=ccEnableArenas,def=0" json:"cc_enable_arenas,omitempty"` - // Sets the objective c class prefix which is prepended to all objective c - // generated classes from this .proto. There is no default. - ObjcClassPrefix *string `protobuf:"bytes,36,opt,name=objc_class_prefix,json=objcClassPrefix" json:"objc_class_prefix,omitempty"` - // Namespace for generated classes; defaults to the package. - CsharpNamespace *string `protobuf:"bytes,37,opt,name=csharp_namespace,json=csharpNamespace" json:"csharp_namespace,omitempty"` - // By default Swift generators will take the proto package and CamelCase it - // replacing '.' with underscore and use that to prefix the types/symbols - // defined. When this options is provided, they will use this value instead - // to prefix the types/symbols defined. - SwiftPrefix *string `protobuf:"bytes,39,opt,name=swift_prefix,json=swiftPrefix" json:"swift_prefix,omitempty"` - // Sets the php class prefix which is prepended to all php generated classes - // from this .proto. Default is empty. - PhpClassPrefix *string `protobuf:"bytes,40,opt,name=php_class_prefix,json=phpClassPrefix" json:"php_class_prefix,omitempty"` - // Use this option to change the namespace of php generated classes. Default - // is empty. When this option is empty, the package name will be used for - // determining the namespace. - PhpNamespace *string `protobuf:"bytes,41,opt,name=php_namespace,json=phpNamespace" json:"php_namespace,omitempty"` - // Use this option to change the namespace of php generated metadata classes. - // Default is empty. When this option is empty, the proto file name will be - // used for determining the namespace. - PhpMetadataNamespace *string `protobuf:"bytes,44,opt,name=php_metadata_namespace,json=phpMetadataNamespace" json:"php_metadata_namespace,omitempty"` - // Use this option to change the package of ruby generated classes. Default - // is empty. When this option is not set, the package name will be used for - // determining the ruby package. - RubyPackage *string `protobuf:"bytes,45,opt,name=ruby_package,json=rubyPackage" json:"ruby_package,omitempty"` - // The parser stores options it doesn't recognize here. - // See the documentation for the "Options" section above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FileOptions) Reset() { *m = FileOptions{} } -func (m *FileOptions) String() string { return proto.CompactTextString(m) } -func (*FileOptions) ProtoMessage() {} -func (*FileOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{10} -} - -var extRange_FileOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*FileOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_FileOptions -} - -func (m *FileOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FileOptions.Unmarshal(m, b) -} -func (m *FileOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FileOptions.Marshal(b, m, deterministic) -} -func (m *FileOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_FileOptions.Merge(m, src) -} -func (m *FileOptions) XXX_Size() int { - return xxx_messageInfo_FileOptions.Size(m) -} -func (m *FileOptions) XXX_DiscardUnknown() { - xxx_messageInfo_FileOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_FileOptions proto.InternalMessageInfo - -const Default_FileOptions_JavaMultipleFiles bool = false -const Default_FileOptions_JavaStringCheckUtf8 bool = false -const Default_FileOptions_OptimizeFor FileOptions_OptimizeMode = FileOptions_SPEED -const Default_FileOptions_CcGenericServices bool = false -const Default_FileOptions_JavaGenericServices bool = false -const Default_FileOptions_PyGenericServices bool = false -const Default_FileOptions_PhpGenericServices bool = false -const Default_FileOptions_Deprecated bool = false -const Default_FileOptions_CcEnableArenas bool = false - -func (m *FileOptions) GetJavaPackage() string { - if m != nil && m.JavaPackage != nil { - return *m.JavaPackage - } - return "" -} - -func (m *FileOptions) GetJavaOuterClassname() string { - if m != nil && m.JavaOuterClassname != nil { - return *m.JavaOuterClassname - } - return "" -} - -func (m *FileOptions) GetJavaMultipleFiles() bool { - if m != nil && m.JavaMultipleFiles != nil { - return *m.JavaMultipleFiles - } - return Default_FileOptions_JavaMultipleFiles -} - -// Deprecated: Do not use. -func (m *FileOptions) GetJavaGenerateEqualsAndHash() bool { - if m != nil && m.JavaGenerateEqualsAndHash != nil { - return *m.JavaGenerateEqualsAndHash - } - return false -} - -func (m *FileOptions) GetJavaStringCheckUtf8() bool { - if m != nil && m.JavaStringCheckUtf8 != nil { - return *m.JavaStringCheckUtf8 - } - return Default_FileOptions_JavaStringCheckUtf8 -} - -func (m *FileOptions) GetOptimizeFor() FileOptions_OptimizeMode { - if m != nil && m.OptimizeFor != nil { - return *m.OptimizeFor - } - return Default_FileOptions_OptimizeFor -} - -func (m *FileOptions) GetGoPackage() string { - if m != nil && m.GoPackage != nil { - return *m.GoPackage - } - return "" -} - -func (m *FileOptions) GetCcGenericServices() bool { - if m != nil && m.CcGenericServices != nil { - return *m.CcGenericServices - } - return Default_FileOptions_CcGenericServices -} - -func (m *FileOptions) GetJavaGenericServices() bool { - if m != nil && m.JavaGenericServices != nil { - return *m.JavaGenericServices - } - return Default_FileOptions_JavaGenericServices -} - -func (m *FileOptions) GetPyGenericServices() bool { - if m != nil && m.PyGenericServices != nil { - return *m.PyGenericServices - } - return Default_FileOptions_PyGenericServices -} - -func (m *FileOptions) GetPhpGenericServices() bool { - if m != nil && m.PhpGenericServices != nil { - return *m.PhpGenericServices - } - return Default_FileOptions_PhpGenericServices -} - -func (m *FileOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_FileOptions_Deprecated -} - -func (m *FileOptions) GetCcEnableArenas() bool { - if m != nil && m.CcEnableArenas != nil { - return *m.CcEnableArenas - } - return Default_FileOptions_CcEnableArenas -} - -func (m *FileOptions) GetObjcClassPrefix() string { - if m != nil && m.ObjcClassPrefix != nil { - return *m.ObjcClassPrefix - } - return "" -} - -func (m *FileOptions) GetCsharpNamespace() string { - if m != nil && m.CsharpNamespace != nil { - return *m.CsharpNamespace - } - return "" -} - -func (m *FileOptions) GetSwiftPrefix() string { - if m != nil && m.SwiftPrefix != nil { - return *m.SwiftPrefix - } - return "" -} - -func (m *FileOptions) GetPhpClassPrefix() string { - if m != nil && m.PhpClassPrefix != nil { - return *m.PhpClassPrefix - } - return "" -} - -func (m *FileOptions) GetPhpNamespace() string { - if m != nil && m.PhpNamespace != nil { - return *m.PhpNamespace - } - return "" -} - -func (m *FileOptions) GetPhpMetadataNamespace() string { - if m != nil && m.PhpMetadataNamespace != nil { - return *m.PhpMetadataNamespace - } - return "" -} - -func (m *FileOptions) GetRubyPackage() string { - if m != nil && m.RubyPackage != nil { - return *m.RubyPackage - } - return "" -} - -func (m *FileOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type MessageOptions struct { - // Set true to use the old proto1 MessageSet wire format for extensions. - // This is provided for backwards-compatibility with the MessageSet wire - // format. You should not use this for any other reason: It's less - // efficient, has fewer features, and is more complicated. - // - // The message must be defined exactly as follows: - // message Foo { - // option message_set_wire_format = true; - // extensions 4 to max; - // } - // Note that the message cannot have any defined fields; MessageSets only - // have extensions. - // - // All extensions of your type must be singular messages; e.g. they cannot - // be int32s, enums, or repeated messages. - // - // Because this is an option, the above two restrictions are not enforced by - // the protocol compiler. - MessageSetWireFormat *bool `protobuf:"varint,1,opt,name=message_set_wire_format,json=messageSetWireFormat,def=0" json:"message_set_wire_format,omitempty"` - // Disables the generation of the standard "descriptor()" accessor, which can - // conflict with a field of the same name. This is meant to make migration - // from proto1 easier; new code should avoid fields named "descriptor". - NoStandardDescriptorAccessor *bool `protobuf:"varint,2,opt,name=no_standard_descriptor_accessor,json=noStandardDescriptorAccessor,def=0" json:"no_standard_descriptor_accessor,omitempty"` - // Is this message deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the message, or it will be completely ignored; in the very least, - // this is a formalization for deprecating messages. - Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // Whether the message is an automatically generated map entry type for the - // maps field. - // - // For maps fields: - // map map_field = 1; - // The parsed descriptor looks like: - // message MapFieldEntry { - // option map_entry = true; - // optional KeyType key = 1; - // optional ValueType value = 2; - // } - // repeated MapFieldEntry map_field = 1; - // - // Implementations may choose not to generate the map_entry=true message, but - // use a native map in the target language to hold the keys and values. - // The reflection APIs in such implementations still need to work as - // if the field is a repeated message field. - // - // NOTE: Do not set the option in .proto files. Always use the maps syntax - // instead. The option should only be implicitly set by the proto compiler - // parser. - MapEntry *bool `protobuf:"varint,7,opt,name=map_entry,json=mapEntry" json:"map_entry,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MessageOptions) Reset() { *m = MessageOptions{} } -func (m *MessageOptions) String() string { return proto.CompactTextString(m) } -func (*MessageOptions) ProtoMessage() {} -func (*MessageOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{11} -} - -var extRange_MessageOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*MessageOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_MessageOptions -} - -func (m *MessageOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MessageOptions.Unmarshal(m, b) -} -func (m *MessageOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MessageOptions.Marshal(b, m, deterministic) -} -func (m *MessageOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_MessageOptions.Merge(m, src) -} -func (m *MessageOptions) XXX_Size() int { - return xxx_messageInfo_MessageOptions.Size(m) -} -func (m *MessageOptions) XXX_DiscardUnknown() { - xxx_messageInfo_MessageOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_MessageOptions proto.InternalMessageInfo - -const Default_MessageOptions_MessageSetWireFormat bool = false -const Default_MessageOptions_NoStandardDescriptorAccessor bool = false -const Default_MessageOptions_Deprecated bool = false - -func (m *MessageOptions) GetMessageSetWireFormat() bool { - if m != nil && m.MessageSetWireFormat != nil { - return *m.MessageSetWireFormat - } - return Default_MessageOptions_MessageSetWireFormat -} - -func (m *MessageOptions) GetNoStandardDescriptorAccessor() bool { - if m != nil && m.NoStandardDescriptorAccessor != nil { - return *m.NoStandardDescriptorAccessor - } - return Default_MessageOptions_NoStandardDescriptorAccessor -} - -func (m *MessageOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_MessageOptions_Deprecated -} - -func (m *MessageOptions) GetMapEntry() bool { - if m != nil && m.MapEntry != nil { - return *m.MapEntry - } - return false -} - -func (m *MessageOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type FieldOptions struct { - // The ctype option instructs the C++ code generator to use a different - // representation of the field than it normally would. See the specific - // options below. This option is not yet implemented in the open source - // release -- sorry, we'll try to include it in a future version! - Ctype *FieldOptions_CType `protobuf:"varint,1,opt,name=ctype,enum=google.protobuf.FieldOptions_CType,def=0" json:"ctype,omitempty"` - // The packed option can be enabled for repeated primitive fields to enable - // a more efficient representation on the wire. Rather than repeatedly - // writing the tag and type for each element, the entire array is encoded as - // a single length-delimited blob. In proto3, only explicit setting it to - // false will avoid using packed encoding. - Packed *bool `protobuf:"varint,2,opt,name=packed" json:"packed,omitempty"` - // The jstype option determines the JavaScript type used for values of the - // field. The option is permitted only for 64 bit integral and fixed types - // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING - // is represented as JavaScript string, which avoids loss of precision that - // can happen when a large value is converted to a floating point JavaScript. - // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to - // use the JavaScript "number" type. The behavior of the default option - // JS_NORMAL is implementation dependent. - // - // This option is an enum to permit additional types to be added, e.g. - // goog.math.Integer. - Jstype *FieldOptions_JSType `protobuf:"varint,6,opt,name=jstype,enum=google.protobuf.FieldOptions_JSType,def=0" json:"jstype,omitempty"` - // Should this field be parsed lazily? Lazy applies only to message-type - // fields. It means that when the outer message is initially parsed, the - // inner message's contents will not be parsed but instead stored in encoded - // form. The inner message will actually be parsed when it is first accessed. - // - // This is only a hint. Implementations are free to choose whether to use - // eager or lazy parsing regardless of the value of this option. However, - // setting this option true suggests that the protocol author believes that - // using lazy parsing on this field is worth the additional bookkeeping - // overhead typically needed to implement it. - // - // This option does not affect the public interface of any generated code; - // all method signatures remain the same. Furthermore, thread-safety of the - // interface is not affected by this option; const methods remain safe to - // call from multiple threads concurrently, while non-const methods continue - // to require exclusive access. - // - // - // Note that implementations may choose not to check required fields within - // a lazy sub-message. That is, calling IsInitialized() on the outer message - // may return true even if the inner message has missing required fields. - // This is necessary because otherwise the inner message would have to be - // parsed in order to perform the check, defeating the purpose of lazy - // parsing. An implementation which chooses not to check required fields - // must be consistent about it. That is, for any particular sub-message, the - // implementation must either *always* check its required fields, or *never* - // check its required fields, regardless of whether or not the message has - // been parsed. - Lazy *bool `protobuf:"varint,5,opt,name=lazy,def=0" json:"lazy,omitempty"` - // Is this field deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for accessors, or it will be completely ignored; in the very least, this - // is a formalization for deprecating fields. - Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // For Google-internal migration only. Do not use. - Weak *bool `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FieldOptions) Reset() { *m = FieldOptions{} } -func (m *FieldOptions) String() string { return proto.CompactTextString(m) } -func (*FieldOptions) ProtoMessage() {} -func (*FieldOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{12} -} - -var extRange_FieldOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*FieldOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_FieldOptions -} - -func (m *FieldOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FieldOptions.Unmarshal(m, b) -} -func (m *FieldOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FieldOptions.Marshal(b, m, deterministic) -} -func (m *FieldOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_FieldOptions.Merge(m, src) -} -func (m *FieldOptions) XXX_Size() int { - return xxx_messageInfo_FieldOptions.Size(m) -} -func (m *FieldOptions) XXX_DiscardUnknown() { - xxx_messageInfo_FieldOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_FieldOptions proto.InternalMessageInfo - -const Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING -const Default_FieldOptions_Jstype FieldOptions_JSType = FieldOptions_JS_NORMAL -const Default_FieldOptions_Lazy bool = false -const Default_FieldOptions_Deprecated bool = false -const Default_FieldOptions_Weak bool = false - -func (m *FieldOptions) GetCtype() FieldOptions_CType { - if m != nil && m.Ctype != nil { - return *m.Ctype - } - return Default_FieldOptions_Ctype -} - -func (m *FieldOptions) GetPacked() bool { - if m != nil && m.Packed != nil { - return *m.Packed - } - return false -} - -func (m *FieldOptions) GetJstype() FieldOptions_JSType { - if m != nil && m.Jstype != nil { - return *m.Jstype - } - return Default_FieldOptions_Jstype -} - -func (m *FieldOptions) GetLazy() bool { - if m != nil && m.Lazy != nil { - return *m.Lazy - } - return Default_FieldOptions_Lazy -} - -func (m *FieldOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_FieldOptions_Deprecated -} - -func (m *FieldOptions) GetWeak() bool { - if m != nil && m.Weak != nil { - return *m.Weak - } - return Default_FieldOptions_Weak -} - -func (m *FieldOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type OneofOptions struct { - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OneofOptions) Reset() { *m = OneofOptions{} } -func (m *OneofOptions) String() string { return proto.CompactTextString(m) } -func (*OneofOptions) ProtoMessage() {} -func (*OneofOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{13} -} - -var extRange_OneofOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*OneofOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_OneofOptions -} - -func (m *OneofOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OneofOptions.Unmarshal(m, b) -} -func (m *OneofOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OneofOptions.Marshal(b, m, deterministic) -} -func (m *OneofOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_OneofOptions.Merge(m, src) -} -func (m *OneofOptions) XXX_Size() int { - return xxx_messageInfo_OneofOptions.Size(m) -} -func (m *OneofOptions) XXX_DiscardUnknown() { - xxx_messageInfo_OneofOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_OneofOptions proto.InternalMessageInfo - -func (m *OneofOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type EnumOptions struct { - // Set this option to true to allow mapping different tag names to the same - // value. - AllowAlias *bool `protobuf:"varint,2,opt,name=allow_alias,json=allowAlias" json:"allow_alias,omitempty"` - // Is this enum deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum, or it will be completely ignored; in the very least, this - // is a formalization for deprecating enums. - Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumOptions) Reset() { *m = EnumOptions{} } -func (m *EnumOptions) String() string { return proto.CompactTextString(m) } -func (*EnumOptions) ProtoMessage() {} -func (*EnumOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{14} -} - -var extRange_EnumOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*EnumOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_EnumOptions -} - -func (m *EnumOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumOptions.Unmarshal(m, b) -} -func (m *EnumOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumOptions.Marshal(b, m, deterministic) -} -func (m *EnumOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumOptions.Merge(m, src) -} -func (m *EnumOptions) XXX_Size() int { - return xxx_messageInfo_EnumOptions.Size(m) -} -func (m *EnumOptions) XXX_DiscardUnknown() { - xxx_messageInfo_EnumOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumOptions proto.InternalMessageInfo - -const Default_EnumOptions_Deprecated bool = false - -func (m *EnumOptions) GetAllowAlias() bool { - if m != nil && m.AllowAlias != nil { - return *m.AllowAlias - } - return false -} - -func (m *EnumOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_EnumOptions_Deprecated -} - -func (m *EnumOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type EnumValueOptions struct { - // Is this enum value deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum value, or it will be completely ignored; in the very least, - // this is a formalization for deprecating enum values. - Deprecated *bool `protobuf:"varint,1,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumValueOptions) Reset() { *m = EnumValueOptions{} } -func (m *EnumValueOptions) String() string { return proto.CompactTextString(m) } -func (*EnumValueOptions) ProtoMessage() {} -func (*EnumValueOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{15} -} - -var extRange_EnumValueOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*EnumValueOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_EnumValueOptions -} - -func (m *EnumValueOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumValueOptions.Unmarshal(m, b) -} -func (m *EnumValueOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumValueOptions.Marshal(b, m, deterministic) -} -func (m *EnumValueOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumValueOptions.Merge(m, src) -} -func (m *EnumValueOptions) XXX_Size() int { - return xxx_messageInfo_EnumValueOptions.Size(m) -} -func (m *EnumValueOptions) XXX_DiscardUnknown() { - xxx_messageInfo_EnumValueOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumValueOptions proto.InternalMessageInfo - -const Default_EnumValueOptions_Deprecated bool = false - -func (m *EnumValueOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_EnumValueOptions_Deprecated -} - -func (m *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type ServiceOptions struct { - // Is this service deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the service, or it will be completely ignored; in the very least, - // this is a formalization for deprecating services. - Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ServiceOptions) Reset() { *m = ServiceOptions{} } -func (m *ServiceOptions) String() string { return proto.CompactTextString(m) } -func (*ServiceOptions) ProtoMessage() {} -func (*ServiceOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{16} -} - -var extRange_ServiceOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*ServiceOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_ServiceOptions -} - -func (m *ServiceOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ServiceOptions.Unmarshal(m, b) -} -func (m *ServiceOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ServiceOptions.Marshal(b, m, deterministic) -} -func (m *ServiceOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServiceOptions.Merge(m, src) -} -func (m *ServiceOptions) XXX_Size() int { - return xxx_messageInfo_ServiceOptions.Size(m) -} -func (m *ServiceOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ServiceOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_ServiceOptions proto.InternalMessageInfo - -const Default_ServiceOptions_Deprecated bool = false - -func (m *ServiceOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_ServiceOptions_Deprecated -} - -func (m *ServiceOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type MethodOptions struct { - // Is this method deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the method, or it will be completely ignored; in the very least, - // this is a formalization for deprecating methods. - Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - IdempotencyLevel *MethodOptions_IdempotencyLevel `protobuf:"varint,34,opt,name=idempotency_level,json=idempotencyLevel,enum=google.protobuf.MethodOptions_IdempotencyLevel,def=0" json:"idempotency_level,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MethodOptions) Reset() { *m = MethodOptions{} } -func (m *MethodOptions) String() string { return proto.CompactTextString(m) } -func (*MethodOptions) ProtoMessage() {} -func (*MethodOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{17} -} - -var extRange_MethodOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*MethodOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_MethodOptions -} - -func (m *MethodOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MethodOptions.Unmarshal(m, b) -} -func (m *MethodOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MethodOptions.Marshal(b, m, deterministic) -} -func (m *MethodOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_MethodOptions.Merge(m, src) -} -func (m *MethodOptions) XXX_Size() int { - return xxx_messageInfo_MethodOptions.Size(m) -} -func (m *MethodOptions) XXX_DiscardUnknown() { - xxx_messageInfo_MethodOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_MethodOptions proto.InternalMessageInfo - -const Default_MethodOptions_Deprecated bool = false -const Default_MethodOptions_IdempotencyLevel MethodOptions_IdempotencyLevel = MethodOptions_IDEMPOTENCY_UNKNOWN - -func (m *MethodOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_MethodOptions_Deprecated -} - -func (m *MethodOptions) GetIdempotencyLevel() MethodOptions_IdempotencyLevel { - if m != nil && m.IdempotencyLevel != nil { - return *m.IdempotencyLevel - } - return Default_MethodOptions_IdempotencyLevel -} - -func (m *MethodOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -// A message representing a option the parser does not recognize. This only -// appears in options protos created by the compiler::Parser class. -// DescriptorPool resolves these when building Descriptor objects. Therefore, -// options protos in descriptor objects (e.g. returned by Descriptor::options(), -// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions -// in them. -type UninterpretedOption struct { - Name []*UninterpretedOption_NamePart `protobuf:"bytes,2,rep,name=name" json:"name,omitempty"` - // The value of the uninterpreted option, in whatever type the tokenizer - // identified it as during parsing. Exactly one of these should be set. - IdentifierValue *string `protobuf:"bytes,3,opt,name=identifier_value,json=identifierValue" json:"identifier_value,omitempty"` - PositiveIntValue *uint64 `protobuf:"varint,4,opt,name=positive_int_value,json=positiveIntValue" json:"positive_int_value,omitempty"` - NegativeIntValue *int64 `protobuf:"varint,5,opt,name=negative_int_value,json=negativeIntValue" json:"negative_int_value,omitempty"` - DoubleValue *float64 `protobuf:"fixed64,6,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` - StringValue []byte `protobuf:"bytes,7,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` - AggregateValue *string `protobuf:"bytes,8,opt,name=aggregate_value,json=aggregateValue" json:"aggregate_value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UninterpretedOption) Reset() { *m = UninterpretedOption{} } -func (m *UninterpretedOption) String() string { return proto.CompactTextString(m) } -func (*UninterpretedOption) ProtoMessage() {} -func (*UninterpretedOption) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{18} -} -func (m *UninterpretedOption) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UninterpretedOption.Unmarshal(m, b) -} -func (m *UninterpretedOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UninterpretedOption.Marshal(b, m, deterministic) -} -func (m *UninterpretedOption) XXX_Merge(src proto.Message) { - xxx_messageInfo_UninterpretedOption.Merge(m, src) -} -func (m *UninterpretedOption) XXX_Size() int { - return xxx_messageInfo_UninterpretedOption.Size(m) -} -func (m *UninterpretedOption) XXX_DiscardUnknown() { - xxx_messageInfo_UninterpretedOption.DiscardUnknown(m) -} - -var xxx_messageInfo_UninterpretedOption proto.InternalMessageInfo - -func (m *UninterpretedOption) GetName() []*UninterpretedOption_NamePart { - if m != nil { - return m.Name - } - return nil -} - -func (m *UninterpretedOption) GetIdentifierValue() string { - if m != nil && m.IdentifierValue != nil { - return *m.IdentifierValue - } - return "" -} - -func (m *UninterpretedOption) GetPositiveIntValue() uint64 { - if m != nil && m.PositiveIntValue != nil { - return *m.PositiveIntValue - } - return 0 -} - -func (m *UninterpretedOption) GetNegativeIntValue() int64 { - if m != nil && m.NegativeIntValue != nil { - return *m.NegativeIntValue - } - return 0 -} - -func (m *UninterpretedOption) GetDoubleValue() float64 { - if m != nil && m.DoubleValue != nil { - return *m.DoubleValue - } - return 0 -} - -func (m *UninterpretedOption) GetStringValue() []byte { - if m != nil { - return m.StringValue - } - return nil -} - -func (m *UninterpretedOption) GetAggregateValue() string { - if m != nil && m.AggregateValue != nil { - return *m.AggregateValue - } - return "" -} - -// The name of the uninterpreted option. Each string represents a segment in -// a dot-separated name. is_extension is true iff a segment represents an -// extension (denoted with parentheses in options specs in .proto files). -// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents -// "foo.(bar.baz).qux". -type UninterpretedOption_NamePart struct { - NamePart *string `protobuf:"bytes,1,req,name=name_part,json=namePart" json:"name_part,omitempty"` - IsExtension *bool `protobuf:"varint,2,req,name=is_extension,json=isExtension" json:"is_extension,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UninterpretedOption_NamePart) Reset() { *m = UninterpretedOption_NamePart{} } -func (m *UninterpretedOption_NamePart) String() string { return proto.CompactTextString(m) } -func (*UninterpretedOption_NamePart) ProtoMessage() {} -func (*UninterpretedOption_NamePart) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{18, 0} -} -func (m *UninterpretedOption_NamePart) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UninterpretedOption_NamePart.Unmarshal(m, b) -} -func (m *UninterpretedOption_NamePart) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UninterpretedOption_NamePart.Marshal(b, m, deterministic) -} -func (m *UninterpretedOption_NamePart) XXX_Merge(src proto.Message) { - xxx_messageInfo_UninterpretedOption_NamePart.Merge(m, src) -} -func (m *UninterpretedOption_NamePart) XXX_Size() int { - return xxx_messageInfo_UninterpretedOption_NamePart.Size(m) -} -func (m *UninterpretedOption_NamePart) XXX_DiscardUnknown() { - xxx_messageInfo_UninterpretedOption_NamePart.DiscardUnknown(m) -} - -var xxx_messageInfo_UninterpretedOption_NamePart proto.InternalMessageInfo - -func (m *UninterpretedOption_NamePart) GetNamePart() string { - if m != nil && m.NamePart != nil { - return *m.NamePart - } - return "" -} - -func (m *UninterpretedOption_NamePart) GetIsExtension() bool { - if m != nil && m.IsExtension != nil { - return *m.IsExtension - } - return false -} - -// Encapsulates information about the original source file from which a -// FileDescriptorProto was generated. -type SourceCodeInfo struct { - // A Location identifies a piece of source code in a .proto file which - // corresponds to a particular definition. This information is intended - // to be useful to IDEs, code indexers, documentation generators, and similar - // tools. - // - // For example, say we have a file like: - // message Foo { - // optional string foo = 1; - // } - // Let's look at just the field definition: - // optional string foo = 1; - // ^ ^^ ^^ ^ ^^^ - // a bc de f ghi - // We have the following locations: - // span path represents - // [a,i) [ 4, 0, 2, 0 ] The whole field definition. - // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - // - // Notes: - // - A location may refer to a repeated field itself (i.e. not to any - // particular index within it). This is used whenever a set of elements are - // logically enclosed in a single code segment. For example, an entire - // extend block (possibly containing multiple extension definitions) will - // have an outer location whose path refers to the "extensions" repeated - // field without an index. - // - Multiple locations may have the same path. This happens when a single - // logical declaration is spread out across multiple places. The most - // obvious example is the "extend" block again -- there may be multiple - // extend blocks in the same scope, each of which will have the same path. - // - A location's span is not always a subset of its parent's span. For - // example, the "extendee" of an extension declaration appears at the - // beginning of the "extend" block and is shared by all extensions within - // the block. - // - Just because a location's span is a subset of some other location's span - // does not mean that it is a descendant. For example, a "group" defines - // both a type and a field in a single declaration. Thus, the locations - // corresponding to the type and field and their components will overlap. - // - Code which tries to interpret locations should probably be designed to - // ignore those that it doesn't understand, as more types of locations could - // be recorded in the future. - Location []*SourceCodeInfo_Location `protobuf:"bytes,1,rep,name=location" json:"location,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SourceCodeInfo) Reset() { *m = SourceCodeInfo{} } -func (m *SourceCodeInfo) String() string { return proto.CompactTextString(m) } -func (*SourceCodeInfo) ProtoMessage() {} -func (*SourceCodeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{19} -} -func (m *SourceCodeInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SourceCodeInfo.Unmarshal(m, b) -} -func (m *SourceCodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SourceCodeInfo.Marshal(b, m, deterministic) -} -func (m *SourceCodeInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_SourceCodeInfo.Merge(m, src) -} -func (m *SourceCodeInfo) XXX_Size() int { - return xxx_messageInfo_SourceCodeInfo.Size(m) -} -func (m *SourceCodeInfo) XXX_DiscardUnknown() { - xxx_messageInfo_SourceCodeInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_SourceCodeInfo proto.InternalMessageInfo - -func (m *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location { - if m != nil { - return m.Location - } - return nil -} - -type SourceCodeInfo_Location struct { - // Identifies which part of the FileDescriptorProto was defined at this - // location. - // - // Each element is a field number or an index. They form a path from - // the root FileDescriptorProto to the place where the definition. For - // example, this path: - // [ 4, 3, 2, 7, 1 ] - // refers to: - // file.message_type(3) // 4, 3 - // .field(7) // 2, 7 - // .name() // 1 - // This is because FileDescriptorProto.message_type has field number 4: - // repeated DescriptorProto message_type = 4; - // and DescriptorProto.field has field number 2: - // repeated FieldDescriptorProto field = 2; - // and FieldDescriptorProto.name has field number 1: - // optional string name = 1; - // - // Thus, the above path gives the location of a field name. If we removed - // the last element: - // [ 4, 3, 2, 7 ] - // this path refers to the whole field declaration (from the beginning - // of the label to the terminating semicolon). - Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` - // Always has exactly three or four elements: start line, start column, - // end line (optional, otherwise assumed same as start line), end column. - // These are packed into a single field for efficiency. Note that line - // and column numbers are zero-based -- typically you will want to add - // 1 to each before displaying to a user. - Span []int32 `protobuf:"varint,2,rep,packed,name=span" json:"span,omitempty"` - // If this SourceCodeInfo represents a complete declaration, these are any - // comments appearing before and after the declaration which appear to be - // attached to the declaration. - // - // A series of line comments appearing on consecutive lines, with no other - // tokens appearing on those lines, will be treated as a single comment. - // - // leading_detached_comments will keep paragraphs of comments that appear - // before (but not connected to) the current element. Each paragraph, - // separated by empty lines, will be one comment element in the repeated - // field. - // - // Only the comment content is provided; comment markers (e.g. //) are - // stripped out. For block comments, leading whitespace and an asterisk - // will be stripped from the beginning of each line other than the first. - // Newlines are included in the output. - // - // Examples: - // - // optional int32 foo = 1; // Comment attached to foo. - // // Comment attached to bar. - // optional int32 bar = 2; - // - // optional string baz = 3; - // // Comment attached to baz. - // // Another line attached to baz. - // - // // Comment attached to qux. - // // - // // Another line attached to qux. - // optional double qux = 4; - // - // // Detached comment for corge. This is not leading or trailing comments - // // to qux or corge because there are blank lines separating it from - // // both. - // - // // Detached comment for corge paragraph 2. - // - // optional string corge = 5; - // /* Block comment attached - // * to corge. Leading asterisks - // * will be removed. */ - // /* Block comment attached to - // * grault. */ - // optional int32 grault = 6; - // - // // ignored detached comments. - LeadingComments *string `protobuf:"bytes,3,opt,name=leading_comments,json=leadingComments" json:"leading_comments,omitempty"` - TrailingComments *string `protobuf:"bytes,4,opt,name=trailing_comments,json=trailingComments" json:"trailing_comments,omitempty"` - LeadingDetachedComments []string `protobuf:"bytes,6,rep,name=leading_detached_comments,json=leadingDetachedComments" json:"leading_detached_comments,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SourceCodeInfo_Location) Reset() { *m = SourceCodeInfo_Location{} } -func (m *SourceCodeInfo_Location) String() string { return proto.CompactTextString(m) } -func (*SourceCodeInfo_Location) ProtoMessage() {} -func (*SourceCodeInfo_Location) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{19, 0} -} -func (m *SourceCodeInfo_Location) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SourceCodeInfo_Location.Unmarshal(m, b) -} -func (m *SourceCodeInfo_Location) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SourceCodeInfo_Location.Marshal(b, m, deterministic) -} -func (m *SourceCodeInfo_Location) XXX_Merge(src proto.Message) { - xxx_messageInfo_SourceCodeInfo_Location.Merge(m, src) -} -func (m *SourceCodeInfo_Location) XXX_Size() int { - return xxx_messageInfo_SourceCodeInfo_Location.Size(m) -} -func (m *SourceCodeInfo_Location) XXX_DiscardUnknown() { - xxx_messageInfo_SourceCodeInfo_Location.DiscardUnknown(m) -} - -var xxx_messageInfo_SourceCodeInfo_Location proto.InternalMessageInfo - -func (m *SourceCodeInfo_Location) GetPath() []int32 { - if m != nil { - return m.Path - } - return nil -} - -func (m *SourceCodeInfo_Location) GetSpan() []int32 { - if m != nil { - return m.Span - } - return nil -} - -func (m *SourceCodeInfo_Location) GetLeadingComments() string { - if m != nil && m.LeadingComments != nil { - return *m.LeadingComments - } - return "" -} - -func (m *SourceCodeInfo_Location) GetTrailingComments() string { - if m != nil && m.TrailingComments != nil { - return *m.TrailingComments - } - return "" -} - -func (m *SourceCodeInfo_Location) GetLeadingDetachedComments() []string { - if m != nil { - return m.LeadingDetachedComments - } - return nil -} - -// Describes the relationship between generated code and its original source -// file. A GeneratedCodeInfo message is associated with only one generated -// source file, but may contain references to different source .proto files. -type GeneratedCodeInfo struct { - // An Annotation connects some span of text in generated code to an element - // of its generating .proto file. - Annotation []*GeneratedCodeInfo_Annotation `protobuf:"bytes,1,rep,name=annotation" json:"annotation,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GeneratedCodeInfo) Reset() { *m = GeneratedCodeInfo{} } -func (m *GeneratedCodeInfo) String() string { return proto.CompactTextString(m) } -func (*GeneratedCodeInfo) ProtoMessage() {} -func (*GeneratedCodeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{20} -} -func (m *GeneratedCodeInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GeneratedCodeInfo.Unmarshal(m, b) -} -func (m *GeneratedCodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GeneratedCodeInfo.Marshal(b, m, deterministic) -} -func (m *GeneratedCodeInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_GeneratedCodeInfo.Merge(m, src) -} -func (m *GeneratedCodeInfo) XXX_Size() int { - return xxx_messageInfo_GeneratedCodeInfo.Size(m) -} -func (m *GeneratedCodeInfo) XXX_DiscardUnknown() { - xxx_messageInfo_GeneratedCodeInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_GeneratedCodeInfo proto.InternalMessageInfo - -func (m *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation { - if m != nil { - return m.Annotation - } - return nil -} - -type GeneratedCodeInfo_Annotation struct { - // Identifies the element in the original source .proto file. This field - // is formatted the same as SourceCodeInfo.Location.path. - Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` - // Identifies the filesystem path to the original source .proto. - SourceFile *string `protobuf:"bytes,2,opt,name=source_file,json=sourceFile" json:"source_file,omitempty"` - // Identifies the starting offset in bytes in the generated code - // that relates to the identified object. - Begin *int32 `protobuf:"varint,3,opt,name=begin" json:"begin,omitempty"` - // Identifies the ending offset in bytes in the generated code that - // relates to the identified offset. The end offset should be one past - // the last relevant byte (so the length of the text = end - begin). - End *int32 `protobuf:"varint,4,opt,name=end" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GeneratedCodeInfo_Annotation) Reset() { *m = GeneratedCodeInfo_Annotation{} } -func (m *GeneratedCodeInfo_Annotation) String() string { return proto.CompactTextString(m) } -func (*GeneratedCodeInfo_Annotation) ProtoMessage() {} -func (*GeneratedCodeInfo_Annotation) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{20, 0} -} -func (m *GeneratedCodeInfo_Annotation) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GeneratedCodeInfo_Annotation.Unmarshal(m, b) -} -func (m *GeneratedCodeInfo_Annotation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GeneratedCodeInfo_Annotation.Marshal(b, m, deterministic) -} -func (m *GeneratedCodeInfo_Annotation) XXX_Merge(src proto.Message) { - xxx_messageInfo_GeneratedCodeInfo_Annotation.Merge(m, src) -} -func (m *GeneratedCodeInfo_Annotation) XXX_Size() int { - return xxx_messageInfo_GeneratedCodeInfo_Annotation.Size(m) -} -func (m *GeneratedCodeInfo_Annotation) XXX_DiscardUnknown() { - xxx_messageInfo_GeneratedCodeInfo_Annotation.DiscardUnknown(m) -} - -var xxx_messageInfo_GeneratedCodeInfo_Annotation proto.InternalMessageInfo - -func (m *GeneratedCodeInfo_Annotation) GetPath() []int32 { - if m != nil { - return m.Path - } - return nil -} - -func (m *GeneratedCodeInfo_Annotation) GetSourceFile() string { - if m != nil && m.SourceFile != nil { - return *m.SourceFile - } - return "" -} - -func (m *GeneratedCodeInfo_Annotation) GetBegin() int32 { - if m != nil && m.Begin != nil { - return *m.Begin - } - return 0 -} - -func (m *GeneratedCodeInfo_Annotation) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - -func init() { - proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Type", FieldDescriptorProto_Type_name, FieldDescriptorProto_Type_value) - proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Label", FieldDescriptorProto_Label_name, FieldDescriptorProto_Label_value) - proto.RegisterEnum("google.protobuf.FileOptions_OptimizeMode", FileOptions_OptimizeMode_name, FileOptions_OptimizeMode_value) - proto.RegisterEnum("google.protobuf.FieldOptions_CType", FieldOptions_CType_name, FieldOptions_CType_value) - proto.RegisterEnum("google.protobuf.FieldOptions_JSType", FieldOptions_JSType_name, FieldOptions_JSType_value) - proto.RegisterEnum("google.protobuf.MethodOptions_IdempotencyLevel", MethodOptions_IdempotencyLevel_name, MethodOptions_IdempotencyLevel_value) - proto.RegisterType((*FileDescriptorSet)(nil), "google.protobuf.FileDescriptorSet") - proto.RegisterType((*FileDescriptorProto)(nil), "google.protobuf.FileDescriptorProto") - proto.RegisterType((*DescriptorProto)(nil), "google.protobuf.DescriptorProto") - proto.RegisterType((*DescriptorProto_ExtensionRange)(nil), "google.protobuf.DescriptorProto.ExtensionRange") - proto.RegisterType((*DescriptorProto_ReservedRange)(nil), "google.protobuf.DescriptorProto.ReservedRange") - proto.RegisterType((*ExtensionRangeOptions)(nil), "google.protobuf.ExtensionRangeOptions") - proto.RegisterType((*FieldDescriptorProto)(nil), "google.protobuf.FieldDescriptorProto") - proto.RegisterType((*OneofDescriptorProto)(nil), "google.protobuf.OneofDescriptorProto") - proto.RegisterType((*EnumDescriptorProto)(nil), "google.protobuf.EnumDescriptorProto") - proto.RegisterType((*EnumDescriptorProto_EnumReservedRange)(nil), "google.protobuf.EnumDescriptorProto.EnumReservedRange") - proto.RegisterType((*EnumValueDescriptorProto)(nil), "google.protobuf.EnumValueDescriptorProto") - proto.RegisterType((*ServiceDescriptorProto)(nil), "google.protobuf.ServiceDescriptorProto") - proto.RegisterType((*MethodDescriptorProto)(nil), "google.protobuf.MethodDescriptorProto") - proto.RegisterType((*FileOptions)(nil), "google.protobuf.FileOptions") - proto.RegisterType((*MessageOptions)(nil), "google.protobuf.MessageOptions") - proto.RegisterType((*FieldOptions)(nil), "google.protobuf.FieldOptions") - proto.RegisterType((*OneofOptions)(nil), "google.protobuf.OneofOptions") - proto.RegisterType((*EnumOptions)(nil), "google.protobuf.EnumOptions") - proto.RegisterType((*EnumValueOptions)(nil), "google.protobuf.EnumValueOptions") - proto.RegisterType((*ServiceOptions)(nil), "google.protobuf.ServiceOptions") - proto.RegisterType((*MethodOptions)(nil), "google.protobuf.MethodOptions") - proto.RegisterType((*UninterpretedOption)(nil), "google.protobuf.UninterpretedOption") - proto.RegisterType((*UninterpretedOption_NamePart)(nil), "google.protobuf.UninterpretedOption.NamePart") - proto.RegisterType((*SourceCodeInfo)(nil), "google.protobuf.SourceCodeInfo") - proto.RegisterType((*SourceCodeInfo_Location)(nil), "google.protobuf.SourceCodeInfo.Location") - proto.RegisterType((*GeneratedCodeInfo)(nil), "google.protobuf.GeneratedCodeInfo") - proto.RegisterType((*GeneratedCodeInfo_Annotation)(nil), "google.protobuf.GeneratedCodeInfo.Annotation") -} - -func init() { proto.RegisterFile("descriptor.proto", fileDescriptor_308767df5ffe18af) } - -var fileDescriptor_308767df5ffe18af = []byte{ - // 2522 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0xcd, 0x6f, 0xdb, 0xc8, - 0x15, 0x5f, 0x7d, 0x5a, 0x7a, 0x92, 0x65, 0x7a, 0xec, 0x75, 0x18, 0xef, 0x47, 0x1c, 0xed, 0x66, - 0xe3, 0x24, 0xbb, 0xca, 0xc2, 0x49, 0x9c, 0xac, 0x53, 0x6c, 0x2b, 0x4b, 0x8c, 0x57, 0xa9, 0xbe, - 0x4a, 0xc9, 0xdd, 0x64, 0x8b, 0x82, 0x18, 0x93, 0x23, 0x89, 0x09, 0x45, 0x72, 0x49, 0x2a, 0x89, - 0x83, 0x1e, 0x02, 0xf4, 0x54, 0xa0, 0x7f, 0x40, 0x51, 0x14, 0x3d, 0xf4, 0xb2, 0x40, 0xff, 0x80, - 0x02, 0xed, 0xbd, 0xd7, 0x02, 0xbd, 0xf7, 0x50, 0xa0, 0x05, 0xda, 0x3f, 0xa1, 0xc7, 0x62, 0x66, - 0x48, 0x8a, 0xd4, 0x47, 0xe2, 0x5d, 0x20, 0xd9, 0x93, 0x3d, 0xef, 0xfd, 0xde, 0x9b, 0x37, 0x8f, - 0xbf, 0x79, 0xf3, 0x66, 0x04, 0x82, 0x46, 0x5c, 0xd5, 0xd1, 0x6d, 0xcf, 0x72, 0x2a, 0xb6, 0x63, - 0x79, 0x16, 0x5a, 0x1b, 0x5a, 0xd6, 0xd0, 0x20, 0x7c, 0x74, 0x32, 0x19, 0x94, 0x5b, 0xb0, 0x7e, - 0x4f, 0x37, 0x48, 0x3d, 0x04, 0xf6, 0x88, 0x87, 0xee, 0x40, 0x7a, 0xa0, 0x1b, 0x44, 0x4c, 0xec, - 0xa4, 0x76, 0x0b, 0x7b, 0x1f, 0x56, 0x66, 0x8c, 0x2a, 0x71, 0x8b, 0x2e, 0x15, 0xcb, 0xcc, 0xa2, - 0xfc, 0xef, 0x34, 0x6c, 0x2c, 0xd0, 0x22, 0x04, 0x69, 0x13, 0x8f, 0xa9, 0xc7, 0xc4, 0x6e, 0x5e, - 0x66, 0xff, 0x23, 0x11, 0x56, 0x6c, 0xac, 0x3e, 0xc6, 0x43, 0x22, 0x26, 0x99, 0x38, 0x18, 0xa2, - 0xf7, 0x01, 0x34, 0x62, 0x13, 0x53, 0x23, 0xa6, 0x7a, 0x2a, 0xa6, 0x76, 0x52, 0xbb, 0x79, 0x39, - 0x22, 0x41, 0xd7, 0x60, 0xdd, 0x9e, 0x9c, 0x18, 0xba, 0xaa, 0x44, 0x60, 0xb0, 0x93, 0xda, 0xcd, - 0xc8, 0x02, 0x57, 0xd4, 0xa7, 0xe0, 0xcb, 0xb0, 0xf6, 0x94, 0xe0, 0xc7, 0x51, 0x68, 0x81, 0x41, - 0x4b, 0x54, 0x1c, 0x01, 0xd6, 0xa0, 0x38, 0x26, 0xae, 0x8b, 0x87, 0x44, 0xf1, 0x4e, 0x6d, 0x22, - 0xa6, 0xd9, 0xea, 0x77, 0xe6, 0x56, 0x3f, 0xbb, 0xf2, 0x82, 0x6f, 0xd5, 0x3f, 0xb5, 0x09, 0xaa, - 0x42, 0x9e, 0x98, 0x93, 0x31, 0xf7, 0x90, 0x59, 0x92, 0x3f, 0xc9, 0x9c, 0x8c, 0x67, 0xbd, 0xe4, - 0xa8, 0x99, 0xef, 0x62, 0xc5, 0x25, 0xce, 0x13, 0x5d, 0x25, 0x62, 0x96, 0x39, 0xb8, 0x3c, 0xe7, - 0xa0, 0xc7, 0xf5, 0xb3, 0x3e, 0x02, 0x3b, 0x54, 0x83, 0x3c, 0x79, 0xe6, 0x11, 0xd3, 0xd5, 0x2d, - 0x53, 0x5c, 0x61, 0x4e, 0x2e, 0x2d, 0xf8, 0x8a, 0xc4, 0xd0, 0x66, 0x5d, 0x4c, 0xed, 0xd0, 0x3e, - 0xac, 0x58, 0xb6, 0xa7, 0x5b, 0xa6, 0x2b, 0xe6, 0x76, 0x12, 0xbb, 0x85, 0xbd, 0x77, 0x17, 0x12, - 0xa1, 0xc3, 0x31, 0x72, 0x00, 0x46, 0x0d, 0x10, 0x5c, 0x6b, 0xe2, 0xa8, 0x44, 0x51, 0x2d, 0x8d, - 0x28, 0xba, 0x39, 0xb0, 0xc4, 0x3c, 0x73, 0x70, 0x61, 0x7e, 0x21, 0x0c, 0x58, 0xb3, 0x34, 0xd2, - 0x30, 0x07, 0x96, 0x5c, 0x72, 0x63, 0x63, 0xb4, 0x05, 0x59, 0xf7, 0xd4, 0xf4, 0xf0, 0x33, 0xb1, - 0xc8, 0x18, 0xe2, 0x8f, 0xca, 0x7f, 0xce, 0xc2, 0xda, 0x59, 0x28, 0x76, 0x17, 0x32, 0x03, 0xba, - 0x4a, 0x31, 0xf9, 0x6d, 0x72, 0xc0, 0x6d, 0xe2, 0x49, 0xcc, 0x7e, 0xc7, 0x24, 0x56, 0xa1, 0x60, - 0x12, 0xd7, 0x23, 0x1a, 0x67, 0x44, 0xea, 0x8c, 0x9c, 0x02, 0x6e, 0x34, 0x4f, 0xa9, 0xf4, 0x77, - 0xa2, 0xd4, 0x03, 0x58, 0x0b, 0x43, 0x52, 0x1c, 0x6c, 0x0e, 0x03, 0x6e, 0x5e, 0x7f, 0x55, 0x24, - 0x15, 0x29, 0xb0, 0x93, 0xa9, 0x99, 0x5c, 0x22, 0xb1, 0x31, 0xaa, 0x03, 0x58, 0x26, 0xb1, 0x06, - 0x8a, 0x46, 0x54, 0x43, 0xcc, 0x2d, 0xc9, 0x52, 0x87, 0x42, 0xe6, 0xb2, 0x64, 0x71, 0xa9, 0x6a, - 0xa0, 0xcf, 0xa6, 0x54, 0x5b, 0x59, 0xc2, 0x94, 0x16, 0xdf, 0x64, 0x73, 0x6c, 0x3b, 0x86, 0x92, - 0x43, 0x28, 0xef, 0x89, 0xe6, 0xaf, 0x2c, 0xcf, 0x82, 0xa8, 0xbc, 0x72, 0x65, 0xb2, 0x6f, 0xc6, - 0x17, 0xb6, 0xea, 0x44, 0x87, 0xe8, 0x03, 0x08, 0x05, 0x0a, 0xa3, 0x15, 0xb0, 0x2a, 0x54, 0x0c, - 0x84, 0x6d, 0x3c, 0x26, 0xdb, 0xcf, 0xa1, 0x14, 0x4f, 0x0f, 0xda, 0x84, 0x8c, 0xeb, 0x61, 0xc7, - 0x63, 0x2c, 0xcc, 0xc8, 0x7c, 0x80, 0x04, 0x48, 0x11, 0x53, 0x63, 0x55, 0x2e, 0x23, 0xd3, 0x7f, - 0xd1, 0x8f, 0xa6, 0x0b, 0x4e, 0xb1, 0x05, 0x7f, 0x34, 0xff, 0x45, 0x63, 0x9e, 0x67, 0xd7, 0xbd, - 0x7d, 0x1b, 0x56, 0x63, 0x0b, 0x38, 0xeb, 0xd4, 0xe5, 0x5f, 0xc0, 0xdb, 0x0b, 0x5d, 0xa3, 0x07, - 0xb0, 0x39, 0x31, 0x75, 0xd3, 0x23, 0x8e, 0xed, 0x10, 0xca, 0x58, 0x3e, 0x95, 0xf8, 0x9f, 0x95, - 0x25, 0x9c, 0x3b, 0x8e, 0xa2, 0xb9, 0x17, 0x79, 0x63, 0x32, 0x2f, 0xbc, 0x9a, 0xcf, 0xfd, 0x77, - 0x45, 0x78, 0xf1, 0xe2, 0xc5, 0x8b, 0x64, 0xf9, 0x37, 0x59, 0xd8, 0x5c, 0xb4, 0x67, 0x16, 0x6e, - 0xdf, 0x2d, 0xc8, 0x9a, 0x93, 0xf1, 0x09, 0x71, 0x58, 0x92, 0x32, 0xb2, 0x3f, 0x42, 0x55, 0xc8, - 0x18, 0xf8, 0x84, 0x18, 0x62, 0x7a, 0x27, 0xb1, 0x5b, 0xda, 0xbb, 0x76, 0xa6, 0x5d, 0x59, 0x69, - 0x52, 0x13, 0x99, 0x5b, 0xa2, 0xcf, 0x21, 0xed, 0x97, 0x68, 0xea, 0xe1, 0xea, 0xd9, 0x3c, 0xd0, - 0xbd, 0x24, 0x33, 0x3b, 0xf4, 0x0e, 0xe4, 0xe9, 0x5f, 0xce, 0x8d, 0x2c, 0x8b, 0x39, 0x47, 0x05, - 0x94, 0x17, 0x68, 0x1b, 0x72, 0x6c, 0x9b, 0x68, 0x24, 0x38, 0xda, 0xc2, 0x31, 0x25, 0x96, 0x46, - 0x06, 0x78, 0x62, 0x78, 0xca, 0x13, 0x6c, 0x4c, 0x08, 0x23, 0x7c, 0x5e, 0x2e, 0xfa, 0xc2, 0x9f, - 0x52, 0x19, 0xba, 0x00, 0x05, 0xbe, 0xab, 0x74, 0x53, 0x23, 0xcf, 0x58, 0xf5, 0xcc, 0xc8, 0x7c, - 0xa3, 0x35, 0xa8, 0x84, 0x4e, 0xff, 0xc8, 0xb5, 0xcc, 0x80, 0x9a, 0x6c, 0x0a, 0x2a, 0x60, 0xd3, - 0xdf, 0x9e, 0x2d, 0xdc, 0xef, 0x2d, 0x5e, 0xde, 0x2c, 0xa7, 0xca, 0x7f, 0x4a, 0x42, 0x9a, 0xd5, - 0x8b, 0x35, 0x28, 0xf4, 0x1f, 0x76, 0x25, 0xa5, 0xde, 0x39, 0x3e, 0x6c, 0x4a, 0x42, 0x02, 0x95, - 0x00, 0x98, 0xe0, 0x5e, 0xb3, 0x53, 0xed, 0x0b, 0xc9, 0x70, 0xdc, 0x68, 0xf7, 0xf7, 0x6f, 0x0a, - 0xa9, 0xd0, 0xe0, 0x98, 0x0b, 0xd2, 0x51, 0xc0, 0x8d, 0x3d, 0x21, 0x83, 0x04, 0x28, 0x72, 0x07, - 0x8d, 0x07, 0x52, 0x7d, 0xff, 0xa6, 0x90, 0x8d, 0x4b, 0x6e, 0xec, 0x09, 0x2b, 0x68, 0x15, 0xf2, - 0x4c, 0x72, 0xd8, 0xe9, 0x34, 0x85, 0x5c, 0xe8, 0xb3, 0xd7, 0x97, 0x1b, 0xed, 0x23, 0x21, 0x1f, - 0xfa, 0x3c, 0x92, 0x3b, 0xc7, 0x5d, 0x01, 0x42, 0x0f, 0x2d, 0xa9, 0xd7, 0xab, 0x1e, 0x49, 0x42, - 0x21, 0x44, 0x1c, 0x3e, 0xec, 0x4b, 0x3d, 0xa1, 0x18, 0x0b, 0xeb, 0xc6, 0x9e, 0xb0, 0x1a, 0x4e, - 0x21, 0xb5, 0x8f, 0x5b, 0x42, 0x09, 0xad, 0xc3, 0x2a, 0x9f, 0x22, 0x08, 0x62, 0x6d, 0x46, 0xb4, - 0x7f, 0x53, 0x10, 0xa6, 0x81, 0x70, 0x2f, 0xeb, 0x31, 0xc1, 0xfe, 0x4d, 0x01, 0x95, 0x6b, 0x90, - 0x61, 0xec, 0x42, 0x08, 0x4a, 0xcd, 0xea, 0xa1, 0xd4, 0x54, 0x3a, 0xdd, 0x7e, 0xa3, 0xd3, 0xae, - 0x36, 0x85, 0xc4, 0x54, 0x26, 0x4b, 0x3f, 0x39, 0x6e, 0xc8, 0x52, 0x5d, 0x48, 0x46, 0x65, 0x5d, - 0xa9, 0xda, 0x97, 0xea, 0x42, 0xaa, 0xac, 0xc2, 0xe6, 0xa2, 0x3a, 0xb9, 0x70, 0x67, 0x44, 0x3e, - 0x71, 0x72, 0xc9, 0x27, 0x66, 0xbe, 0xe6, 0x3e, 0xf1, 0xbf, 0x92, 0xb0, 0xb1, 0xe0, 0xac, 0x58, - 0x38, 0xc9, 0x0f, 0x21, 0xc3, 0x29, 0xca, 0x4f, 0xcf, 0x2b, 0x0b, 0x0f, 0x1d, 0x46, 0xd8, 0xb9, - 0x13, 0x94, 0xd9, 0x45, 0x3b, 0x88, 0xd4, 0x92, 0x0e, 0x82, 0xba, 0x98, 0xab, 0xe9, 0x3f, 0x9f, - 0xab, 0xe9, 0xfc, 0xd8, 0xdb, 0x3f, 0xcb, 0xb1, 0xc7, 0x64, 0xdf, 0xae, 0xb6, 0x67, 0x16, 0xd4, - 0xf6, 0xbb, 0xb0, 0x3e, 0xe7, 0xe8, 0xcc, 0x35, 0xf6, 0x97, 0x09, 0x10, 0x97, 0x25, 0xe7, 0x15, - 0x95, 0x2e, 0x19, 0xab, 0x74, 0x77, 0x67, 0x33, 0x78, 0x71, 0xf9, 0x47, 0x98, 0xfb, 0xd6, 0xdf, - 0x24, 0x60, 0x6b, 0x71, 0xa7, 0xb8, 0x30, 0x86, 0xcf, 0x21, 0x3b, 0x26, 0xde, 0xc8, 0x0a, 0xba, - 0xa5, 0x8f, 0x16, 0x9c, 0xc1, 0x54, 0x3d, 0xfb, 0xb1, 0x7d, 0xab, 0xe8, 0x21, 0x9e, 0x5a, 0xd6, - 0xee, 0xf1, 0x68, 0xe6, 0x22, 0xfd, 0x55, 0x12, 0xde, 0x5e, 0xe8, 0x7c, 0x61, 0xa0, 0xef, 0x01, - 0xe8, 0xa6, 0x3d, 0xf1, 0x78, 0x47, 0xc4, 0x0b, 0x6c, 0x9e, 0x49, 0x58, 0xf1, 0xa2, 0xc5, 0x73, - 0xe2, 0x85, 0xfa, 0x14, 0xd3, 0x03, 0x17, 0x31, 0xc0, 0x9d, 0x69, 0xa0, 0x69, 0x16, 0xe8, 0xfb, - 0x4b, 0x56, 0x3a, 0x47, 0xcc, 0x4f, 0x41, 0x50, 0x0d, 0x9d, 0x98, 0x9e, 0xe2, 0x7a, 0x0e, 0xc1, - 0x63, 0xdd, 0x1c, 0xb2, 0x13, 0x24, 0x77, 0x90, 0x19, 0x60, 0xc3, 0x25, 0xf2, 0x1a, 0x57, 0xf7, - 0x02, 0x2d, 0xb5, 0x60, 0x04, 0x72, 0x22, 0x16, 0xd9, 0x98, 0x05, 0x57, 0x87, 0x16, 0xe5, 0x5f, - 0xe7, 0xa1, 0x10, 0xe9, 0xab, 0xd1, 0x45, 0x28, 0x3e, 0xc2, 0x4f, 0xb0, 0x12, 0xdc, 0x95, 0x78, - 0x26, 0x0a, 0x54, 0xd6, 0xf5, 0xef, 0x4b, 0x9f, 0xc2, 0x26, 0x83, 0x58, 0x13, 0x8f, 0x38, 0x8a, - 0x6a, 0x60, 0xd7, 0x65, 0x49, 0xcb, 0x31, 0x28, 0xa2, 0xba, 0x0e, 0x55, 0xd5, 0x02, 0x0d, 0xba, - 0x05, 0x1b, 0xcc, 0x62, 0x3c, 0x31, 0x3c, 0xdd, 0x36, 0x88, 0x42, 0x6f, 0x6f, 0x2e, 0x3b, 0x49, - 0xc2, 0xc8, 0xd6, 0x29, 0xa2, 0xe5, 0x03, 0x68, 0x44, 0x2e, 0xaa, 0xc3, 0x7b, 0xcc, 0x6c, 0x48, - 0x4c, 0xe2, 0x60, 0x8f, 0x28, 0xe4, 0xeb, 0x09, 0x36, 0x5c, 0x05, 0x9b, 0x9a, 0x32, 0xc2, 0xee, - 0x48, 0xdc, 0xa4, 0x0e, 0x0e, 0x93, 0x62, 0x42, 0x3e, 0x4f, 0x81, 0x47, 0x3e, 0x4e, 0x62, 0xb0, - 0xaa, 0xa9, 0x7d, 0x81, 0xdd, 0x11, 0x3a, 0x80, 0x2d, 0xe6, 0xc5, 0xf5, 0x1c, 0xdd, 0x1c, 0x2a, - 0xea, 0x88, 0xa8, 0x8f, 0x95, 0x89, 0x37, 0xb8, 0x23, 0xbe, 0x13, 0x9d, 0x9f, 0x45, 0xd8, 0x63, - 0x98, 0x1a, 0x85, 0x1c, 0x7b, 0x83, 0x3b, 0xa8, 0x07, 0x45, 0xfa, 0x31, 0xc6, 0xfa, 0x73, 0xa2, - 0x0c, 0x2c, 0x87, 0x1d, 0x8d, 0xa5, 0x05, 0xa5, 0x29, 0x92, 0xc1, 0x4a, 0xc7, 0x37, 0x68, 0x59, - 0x1a, 0x39, 0xc8, 0xf4, 0xba, 0x92, 0x54, 0x97, 0x0b, 0x81, 0x97, 0x7b, 0x96, 0x43, 0x09, 0x35, - 0xb4, 0xc2, 0x04, 0x17, 0x38, 0xa1, 0x86, 0x56, 0x90, 0xde, 0x5b, 0xb0, 0xa1, 0xaa, 0x7c, 0xcd, - 0xba, 0xaa, 0xf8, 0x77, 0x2c, 0x57, 0x14, 0x62, 0xc9, 0x52, 0xd5, 0x23, 0x0e, 0xf0, 0x39, 0xee, - 0xa2, 0xcf, 0xe0, 0xed, 0x69, 0xb2, 0xa2, 0x86, 0xeb, 0x73, 0xab, 0x9c, 0x35, 0xbd, 0x05, 0x1b, - 0xf6, 0xe9, 0xbc, 0x21, 0x8a, 0xcd, 0x68, 0x9f, 0xce, 0x9a, 0xdd, 0x86, 0x4d, 0x7b, 0x64, 0xcf, - 0xdb, 0x5d, 0x8d, 0xda, 0x21, 0x7b, 0x64, 0xcf, 0x1a, 0x5e, 0x62, 0x17, 0x6e, 0x87, 0xa8, 0xd8, - 0x23, 0x9a, 0x78, 0x2e, 0x0a, 0x8f, 0x28, 0xd0, 0x75, 0x10, 0x54, 0x55, 0x21, 0x26, 0x3e, 0x31, - 0x88, 0x82, 0x1d, 0x62, 0x62, 0x57, 0xbc, 0x10, 0x05, 0x97, 0x54, 0x55, 0x62, 0xda, 0x2a, 0x53, - 0xa2, 0xab, 0xb0, 0x6e, 0x9d, 0x3c, 0x52, 0x39, 0x25, 0x15, 0xdb, 0x21, 0x03, 0xfd, 0x99, 0xf8, - 0x21, 0xcb, 0xef, 0x1a, 0x55, 0x30, 0x42, 0x76, 0x99, 0x18, 0x5d, 0x01, 0x41, 0x75, 0x47, 0xd8, - 0xb1, 0x59, 0x4d, 0x76, 0x6d, 0xac, 0x12, 0xf1, 0x12, 0x87, 0x72, 0x79, 0x3b, 0x10, 0xd3, 0x2d, - 0xe1, 0x3e, 0xd5, 0x07, 0x5e, 0xe0, 0xf1, 0x32, 0xdf, 0x12, 0x4c, 0xe6, 0x7b, 0xdb, 0x05, 0x81, - 0xa6, 0x22, 0x36, 0xf1, 0x2e, 0x83, 0x95, 0xec, 0x91, 0x1d, 0x9d, 0xf7, 0x03, 0x58, 0xa5, 0xc8, - 0xe9, 0xa4, 0x57, 0x78, 0x43, 0x66, 0x8f, 0x22, 0x33, 0xde, 0x84, 0x2d, 0x0a, 0x1a, 0x13, 0x0f, - 0x6b, 0xd8, 0xc3, 0x11, 0xf4, 0xc7, 0x0c, 0x4d, 0xf3, 0xde, 0xf2, 0x95, 0xb1, 0x38, 0x9d, 0xc9, - 0xc9, 0x69, 0xc8, 0xac, 0x4f, 0x78, 0x9c, 0x54, 0x16, 0x70, 0xeb, 0xb5, 0x35, 0xdd, 0xe5, 0x03, - 0x28, 0x46, 0x89, 0x8f, 0xf2, 0xc0, 0xa9, 0x2f, 0x24, 0x68, 0x17, 0x54, 0xeb, 0xd4, 0x69, 0xff, - 0xf2, 0x95, 0x24, 0x24, 0x69, 0x1f, 0xd5, 0x6c, 0xf4, 0x25, 0x45, 0x3e, 0x6e, 0xf7, 0x1b, 0x2d, - 0x49, 0x48, 0x45, 0x1b, 0xf6, 0xbf, 0x26, 0xa1, 0x14, 0xbf, 0x7b, 0xa1, 0x1f, 0xc0, 0xb9, 0xe0, - 0xa1, 0xc4, 0x25, 0x9e, 0xf2, 0x54, 0x77, 0xd8, 0x5e, 0x1c, 0x63, 0x7e, 0x2e, 0x86, 0x6c, 0xd8, - 0xf4, 0x51, 0x3d, 0xe2, 0x7d, 0xa9, 0x3b, 0x74, 0xa7, 0x8d, 0xb1, 0x87, 0x9a, 0x70, 0xc1, 0xb4, - 0x14, 0xd7, 0xc3, 0xa6, 0x86, 0x1d, 0x4d, 0x99, 0x3e, 0x51, 0x29, 0x58, 0x55, 0x89, 0xeb, 0x5a, - 0xfc, 0x0c, 0x0c, 0xbd, 0xbc, 0x6b, 0x5a, 0x3d, 0x1f, 0x3c, 0x3d, 0x1c, 0xaa, 0x3e, 0x74, 0x86, - 0xb9, 0xa9, 0x65, 0xcc, 0x7d, 0x07, 0xf2, 0x63, 0x6c, 0x2b, 0xc4, 0xf4, 0x9c, 0x53, 0xd6, 0x71, - 0xe7, 0xe4, 0xdc, 0x18, 0xdb, 0x12, 0x1d, 0xbf, 0x99, 0x8b, 0xcf, 0x3f, 0x52, 0x50, 0x8c, 0x76, - 0xdd, 0xf4, 0x12, 0xa3, 0xb2, 0x03, 0x2a, 0xc1, 0x4a, 0xd8, 0x07, 0x2f, 0xed, 0xd1, 0x2b, 0x35, - 0x7a, 0x72, 0x1d, 0x64, 0x79, 0x2f, 0x2c, 0x73, 0x4b, 0xda, 0x35, 0x50, 0x6a, 0x11, 0xde, 0x7b, - 0xe4, 0x64, 0x7f, 0x84, 0x8e, 0x20, 0xfb, 0xc8, 0x65, 0xbe, 0xb3, 0xcc, 0xf7, 0x87, 0x2f, 0xf7, - 0x7d, 0xbf, 0xc7, 0x9c, 0xe7, 0xef, 0xf7, 0x94, 0x76, 0x47, 0x6e, 0x55, 0x9b, 0xb2, 0x6f, 0x8e, - 0xce, 0x43, 0xda, 0xc0, 0xcf, 0x4f, 0xe3, 0x67, 0x1c, 0x13, 0x9d, 0x35, 0xf1, 0xe7, 0x21, 0xfd, - 0x94, 0xe0, 0xc7, 0xf1, 0x93, 0x85, 0x89, 0x5e, 0x23, 0xf5, 0xaf, 0x43, 0x86, 0xe5, 0x0b, 0x01, - 0xf8, 0x19, 0x13, 0xde, 0x42, 0x39, 0x48, 0xd7, 0x3a, 0x32, 0xa5, 0xbf, 0x00, 0x45, 0x2e, 0x55, - 0xba, 0x0d, 0xa9, 0x26, 0x09, 0xc9, 0xf2, 0x2d, 0xc8, 0xf2, 0x24, 0xd0, 0xad, 0x11, 0xa6, 0x41, - 0x78, 0xcb, 0x1f, 0xfa, 0x3e, 0x12, 0x81, 0xf6, 0xb8, 0x75, 0x28, 0xc9, 0x42, 0x32, 0xfa, 0x79, - 0x5d, 0x28, 0x46, 0x1b, 0xee, 0x37, 0xc3, 0xa9, 0xbf, 0x24, 0xa0, 0x10, 0x69, 0xa0, 0x69, 0xe7, - 0x83, 0x0d, 0xc3, 0x7a, 0xaa, 0x60, 0x43, 0xc7, 0xae, 0x4f, 0x0a, 0x60, 0xa2, 0x2a, 0x95, 0x9c, - 0xf5, 0xa3, 0xbd, 0x91, 0xe0, 0x7f, 0x9f, 0x00, 0x61, 0xb6, 0x77, 0x9d, 0x09, 0x30, 0xf1, 0xbd, - 0x06, 0xf8, 0xbb, 0x04, 0x94, 0xe2, 0x0d, 0xeb, 0x4c, 0x78, 0x17, 0xbf, 0xd7, 0xf0, 0xfe, 0x99, - 0x84, 0xd5, 0x58, 0x9b, 0x7a, 0xd6, 0xe8, 0xbe, 0x86, 0x75, 0x5d, 0x23, 0x63, 0xdb, 0xf2, 0x88, - 0xa9, 0x9e, 0x2a, 0x06, 0x79, 0x42, 0x0c, 0xb1, 0xcc, 0x0a, 0xc5, 0xf5, 0x97, 0x37, 0xc2, 0x95, - 0xc6, 0xd4, 0xae, 0x49, 0xcd, 0x0e, 0x36, 0x1a, 0x75, 0xa9, 0xd5, 0xed, 0xf4, 0xa5, 0x76, 0xed, - 0xa1, 0x72, 0xdc, 0xfe, 0x71, 0xbb, 0xf3, 0x65, 0x5b, 0x16, 0xf4, 0x19, 0xd8, 0x6b, 0xdc, 0xea, - 0x5d, 0x10, 0x66, 0x83, 0x42, 0xe7, 0x60, 0x51, 0x58, 0xc2, 0x5b, 0x68, 0x03, 0xd6, 0xda, 0x1d, - 0xa5, 0xd7, 0xa8, 0x4b, 0x8a, 0x74, 0xef, 0x9e, 0x54, 0xeb, 0xf7, 0xf8, 0xd3, 0x46, 0x88, 0xee, - 0xc7, 0x37, 0xf5, 0x6f, 0x53, 0xb0, 0xb1, 0x20, 0x12, 0x54, 0xf5, 0x2f, 0x25, 0xfc, 0x9e, 0xf4, - 0xc9, 0x59, 0xa2, 0xaf, 0xd0, 0xae, 0xa0, 0x8b, 0x1d, 0xcf, 0xbf, 0xc3, 0x5c, 0x01, 0x9a, 0x25, - 0xd3, 0xd3, 0x07, 0x3a, 0x71, 0xfc, 0x97, 0x20, 0x7e, 0x53, 0x59, 0x9b, 0xca, 0xf9, 0x63, 0xd0, - 0xc7, 0x80, 0x6c, 0xcb, 0xd5, 0x3d, 0xfd, 0x09, 0x51, 0x74, 0x33, 0x78, 0x36, 0xa2, 0x37, 0x97, - 0xb4, 0x2c, 0x04, 0x9a, 0x86, 0xe9, 0x85, 0x68, 0x93, 0x0c, 0xf1, 0x0c, 0x9a, 0x16, 0xf0, 0x94, - 0x2c, 0x04, 0x9a, 0x10, 0x7d, 0x11, 0x8a, 0x9a, 0x35, 0xa1, 0xed, 0x1c, 0xc7, 0xd1, 0xf3, 0x22, - 0x21, 0x17, 0xb8, 0x2c, 0x84, 0xf8, 0x8d, 0xfa, 0xf4, 0xbd, 0xaa, 0x28, 0x17, 0xb8, 0x8c, 0x43, - 0x2e, 0xc3, 0x1a, 0x1e, 0x0e, 0x1d, 0xea, 0x3c, 0x70, 0xc4, 0xaf, 0x1e, 0xa5, 0x50, 0xcc, 0x80, - 0xdb, 0xf7, 0x21, 0x17, 0xe4, 0x81, 0x1e, 0xc9, 0x34, 0x13, 0x8a, 0xcd, 0xef, 0xd3, 0xc9, 0xdd, - 0xbc, 0x9c, 0x33, 0x03, 0xe5, 0x45, 0x28, 0xea, 0xae, 0x32, 0x7d, 0x7e, 0x4f, 0xee, 0x24, 0x77, - 0x73, 0x72, 0x41, 0x77, 0xc3, 0xa7, 0xcb, 0xf2, 0x37, 0x49, 0x28, 0xc5, 0x7f, 0x3e, 0x40, 0x75, - 0xc8, 0x19, 0x96, 0x8a, 0x19, 0xb5, 0xf8, 0x6f, 0x57, 0xbb, 0xaf, 0xf8, 0xc5, 0xa1, 0xd2, 0xf4, - 0xf1, 0x72, 0x68, 0xb9, 0xfd, 0xb7, 0x04, 0xe4, 0x02, 0x31, 0xda, 0x82, 0xb4, 0x8d, 0xbd, 0x11, - 0x73, 0x97, 0x39, 0x4c, 0x0a, 0x09, 0x99, 0x8d, 0xa9, 0xdc, 0xb5, 0xb1, 0xc9, 0x28, 0xe0, 0xcb, - 0xe9, 0x98, 0x7e, 0x57, 0x83, 0x60, 0x8d, 0xdd, 0x6b, 0xac, 0xf1, 0x98, 0x98, 0x9e, 0x1b, 0x7c, - 0x57, 0x5f, 0x5e, 0xf3, 0xc5, 0xe8, 0x1a, 0xac, 0x7b, 0x0e, 0xd6, 0x8d, 0x18, 0x36, 0xcd, 0xb0, - 0x42, 0xa0, 0x08, 0xc1, 0x07, 0x70, 0x3e, 0xf0, 0xab, 0x11, 0x0f, 0xab, 0x23, 0xa2, 0x4d, 0x8d, - 0xb2, 0xec, 0xfd, 0xe2, 0x9c, 0x0f, 0xa8, 0xfb, 0xfa, 0xc0, 0xb6, 0xfc, 0xf7, 0x04, 0xac, 0x07, - 0x37, 0x31, 0x2d, 0x4c, 0x56, 0x0b, 0x00, 0x9b, 0xa6, 0xe5, 0x45, 0xd3, 0x35, 0x4f, 0xe5, 0x39, - 0xbb, 0x4a, 0x35, 0x34, 0x92, 0x23, 0x0e, 0xb6, 0xc7, 0x00, 0x53, 0xcd, 0xd2, 0xb4, 0x5d, 0x80, - 0x82, 0xff, 0xdb, 0x10, 0xfb, 0x81, 0x91, 0xdf, 0xdd, 0x81, 0x8b, 0xe8, 0x95, 0x0d, 0x6d, 0x42, - 0xe6, 0x84, 0x0c, 0x75, 0xd3, 0x7f, 0xf1, 0xe5, 0x83, 0xe0, 0x85, 0x25, 0x1d, 0xbe, 0xb0, 0x1c, - 0xfe, 0x0c, 0x36, 0x54, 0x6b, 0x3c, 0x1b, 0xee, 0xa1, 0x30, 0xf3, 0x7e, 0xe0, 0x7e, 0x91, 0xf8, - 0x0a, 0xa6, 0x2d, 0xe6, 0xff, 0x12, 0x89, 0x3f, 0x24, 0x53, 0x47, 0xdd, 0xc3, 0x3f, 0x26, 0xb7, - 0x8f, 0xb8, 0x69, 0x37, 0x58, 0xa9, 0x4c, 0x06, 0x06, 0x51, 0x69, 0xf4, 0xff, 0x0f, 0x00, 0x00, - 0xff, 0xff, 0x88, 0x17, 0xc1, 0xbe, 0x38, 0x1d, 0x00, 0x00, -} diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go deleted file mode 100644 index 165b2110df..0000000000 --- a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go +++ /dev/null @@ -1,752 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: descriptor.proto - -package descriptor - -import ( - fmt "fmt" - github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - proto "github.com/gogo/protobuf/proto" - math "math" - reflect "reflect" - sort "sort" - strconv "strconv" - strings "strings" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -func (this *FileDescriptorSet) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.FileDescriptorSet{") - if this.File != nil { - s = append(s, "File: "+fmt.Sprintf("%#v", this.File)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FileDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 16) - s = append(s, "&descriptor.FileDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Package != nil { - s = append(s, "Package: "+valueToGoStringDescriptor(this.Package, "string")+",\n") - } - if this.Dependency != nil { - s = append(s, "Dependency: "+fmt.Sprintf("%#v", this.Dependency)+",\n") - } - if this.PublicDependency != nil { - s = append(s, "PublicDependency: "+fmt.Sprintf("%#v", this.PublicDependency)+",\n") - } - if this.WeakDependency != nil { - s = append(s, "WeakDependency: "+fmt.Sprintf("%#v", this.WeakDependency)+",\n") - } - if this.MessageType != nil { - s = append(s, "MessageType: "+fmt.Sprintf("%#v", this.MessageType)+",\n") - } - if this.EnumType != nil { - s = append(s, "EnumType: "+fmt.Sprintf("%#v", this.EnumType)+",\n") - } - if this.Service != nil { - s = append(s, "Service: "+fmt.Sprintf("%#v", this.Service)+",\n") - } - if this.Extension != nil { - s = append(s, "Extension: "+fmt.Sprintf("%#v", this.Extension)+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.SourceCodeInfo != nil { - s = append(s, "SourceCodeInfo: "+fmt.Sprintf("%#v", this.SourceCodeInfo)+",\n") - } - if this.Syntax != nil { - s = append(s, "Syntax: "+valueToGoStringDescriptor(this.Syntax, "string")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *DescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 14) - s = append(s, "&descriptor.DescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Field != nil { - s = append(s, "Field: "+fmt.Sprintf("%#v", this.Field)+",\n") - } - if this.Extension != nil { - s = append(s, "Extension: "+fmt.Sprintf("%#v", this.Extension)+",\n") - } - if this.NestedType != nil { - s = append(s, "NestedType: "+fmt.Sprintf("%#v", this.NestedType)+",\n") - } - if this.EnumType != nil { - s = append(s, "EnumType: "+fmt.Sprintf("%#v", this.EnumType)+",\n") - } - if this.ExtensionRange != nil { - s = append(s, "ExtensionRange: "+fmt.Sprintf("%#v", this.ExtensionRange)+",\n") - } - if this.OneofDecl != nil { - s = append(s, "OneofDecl: "+fmt.Sprintf("%#v", this.OneofDecl)+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.ReservedRange != nil { - s = append(s, "ReservedRange: "+fmt.Sprintf("%#v", this.ReservedRange)+",\n") - } - if this.ReservedName != nil { - s = append(s, "ReservedName: "+fmt.Sprintf("%#v", this.ReservedName)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *DescriptorProto_ExtensionRange) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.DescriptorProto_ExtensionRange{") - if this.Start != nil { - s = append(s, "Start: "+valueToGoStringDescriptor(this.Start, "int32")+",\n") - } - if this.End != nil { - s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *DescriptorProto_ReservedRange) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.DescriptorProto_ReservedRange{") - if this.Start != nil { - s = append(s, "Start: "+valueToGoStringDescriptor(this.Start, "int32")+",\n") - } - if this.End != nil { - s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *ExtensionRangeOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.ExtensionRangeOptions{") - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FieldDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 14) - s = append(s, "&descriptor.FieldDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Number != nil { - s = append(s, "Number: "+valueToGoStringDescriptor(this.Number, "int32")+",\n") - } - if this.Label != nil { - s = append(s, "Label: "+valueToGoStringDescriptor(this.Label, "FieldDescriptorProto_Label")+",\n") - } - if this.Type != nil { - s = append(s, "Type: "+valueToGoStringDescriptor(this.Type, "FieldDescriptorProto_Type")+",\n") - } - if this.TypeName != nil { - s = append(s, "TypeName: "+valueToGoStringDescriptor(this.TypeName, "string")+",\n") - } - if this.Extendee != nil { - s = append(s, "Extendee: "+valueToGoStringDescriptor(this.Extendee, "string")+",\n") - } - if this.DefaultValue != nil { - s = append(s, "DefaultValue: "+valueToGoStringDescriptor(this.DefaultValue, "string")+",\n") - } - if this.OneofIndex != nil { - s = append(s, "OneofIndex: "+valueToGoStringDescriptor(this.OneofIndex, "int32")+",\n") - } - if this.JsonName != nil { - s = append(s, "JsonName: "+valueToGoStringDescriptor(this.JsonName, "string")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *OneofDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.OneofDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 9) - s = append(s, "&descriptor.EnumDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Value != nil { - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.ReservedRange != nil { - s = append(s, "ReservedRange: "+fmt.Sprintf("%#v", this.ReservedRange)+",\n") - } - if this.ReservedName != nil { - s = append(s, "ReservedName: "+fmt.Sprintf("%#v", this.ReservedName)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumDescriptorProto_EnumReservedRange) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.EnumDescriptorProto_EnumReservedRange{") - if this.Start != nil { - s = append(s, "Start: "+valueToGoStringDescriptor(this.Start, "int32")+",\n") - } - if this.End != nil { - s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumValueDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.EnumValueDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Number != nil { - s = append(s, "Number: "+valueToGoStringDescriptor(this.Number, "int32")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *ServiceDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.ServiceDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Method != nil { - s = append(s, "Method: "+fmt.Sprintf("%#v", this.Method)+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *MethodDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 10) - s = append(s, "&descriptor.MethodDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.InputType != nil { - s = append(s, "InputType: "+valueToGoStringDescriptor(this.InputType, "string")+",\n") - } - if this.OutputType != nil { - s = append(s, "OutputType: "+valueToGoStringDescriptor(this.OutputType, "string")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.ClientStreaming != nil { - s = append(s, "ClientStreaming: "+valueToGoStringDescriptor(this.ClientStreaming, "bool")+",\n") - } - if this.ServerStreaming != nil { - s = append(s, "ServerStreaming: "+valueToGoStringDescriptor(this.ServerStreaming, "bool")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FileOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 25) - s = append(s, "&descriptor.FileOptions{") - if this.JavaPackage != nil { - s = append(s, "JavaPackage: "+valueToGoStringDescriptor(this.JavaPackage, "string")+",\n") - } - if this.JavaOuterClassname != nil { - s = append(s, "JavaOuterClassname: "+valueToGoStringDescriptor(this.JavaOuterClassname, "string")+",\n") - } - if this.JavaMultipleFiles != nil { - s = append(s, "JavaMultipleFiles: "+valueToGoStringDescriptor(this.JavaMultipleFiles, "bool")+",\n") - } - if this.JavaGenerateEqualsAndHash != nil { - s = append(s, "JavaGenerateEqualsAndHash: "+valueToGoStringDescriptor(this.JavaGenerateEqualsAndHash, "bool")+",\n") - } - if this.JavaStringCheckUtf8 != nil { - s = append(s, "JavaStringCheckUtf8: "+valueToGoStringDescriptor(this.JavaStringCheckUtf8, "bool")+",\n") - } - if this.OptimizeFor != nil { - s = append(s, "OptimizeFor: "+valueToGoStringDescriptor(this.OptimizeFor, "FileOptions_OptimizeMode")+",\n") - } - if this.GoPackage != nil { - s = append(s, "GoPackage: "+valueToGoStringDescriptor(this.GoPackage, "string")+",\n") - } - if this.CcGenericServices != nil { - s = append(s, "CcGenericServices: "+valueToGoStringDescriptor(this.CcGenericServices, "bool")+",\n") - } - if this.JavaGenericServices != nil { - s = append(s, "JavaGenericServices: "+valueToGoStringDescriptor(this.JavaGenericServices, "bool")+",\n") - } - if this.PyGenericServices != nil { - s = append(s, "PyGenericServices: "+valueToGoStringDescriptor(this.PyGenericServices, "bool")+",\n") - } - if this.PhpGenericServices != nil { - s = append(s, "PhpGenericServices: "+valueToGoStringDescriptor(this.PhpGenericServices, "bool")+",\n") - } - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.CcEnableArenas != nil { - s = append(s, "CcEnableArenas: "+valueToGoStringDescriptor(this.CcEnableArenas, "bool")+",\n") - } - if this.ObjcClassPrefix != nil { - s = append(s, "ObjcClassPrefix: "+valueToGoStringDescriptor(this.ObjcClassPrefix, "string")+",\n") - } - if this.CsharpNamespace != nil { - s = append(s, "CsharpNamespace: "+valueToGoStringDescriptor(this.CsharpNamespace, "string")+",\n") - } - if this.SwiftPrefix != nil { - s = append(s, "SwiftPrefix: "+valueToGoStringDescriptor(this.SwiftPrefix, "string")+",\n") - } - if this.PhpClassPrefix != nil { - s = append(s, "PhpClassPrefix: "+valueToGoStringDescriptor(this.PhpClassPrefix, "string")+",\n") - } - if this.PhpNamespace != nil { - s = append(s, "PhpNamespace: "+valueToGoStringDescriptor(this.PhpNamespace, "string")+",\n") - } - if this.PhpMetadataNamespace != nil { - s = append(s, "PhpMetadataNamespace: "+valueToGoStringDescriptor(this.PhpMetadataNamespace, "string")+",\n") - } - if this.RubyPackage != nil { - s = append(s, "RubyPackage: "+valueToGoStringDescriptor(this.RubyPackage, "string")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *MessageOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 9) - s = append(s, "&descriptor.MessageOptions{") - if this.MessageSetWireFormat != nil { - s = append(s, "MessageSetWireFormat: "+valueToGoStringDescriptor(this.MessageSetWireFormat, "bool")+",\n") - } - if this.NoStandardDescriptorAccessor != nil { - s = append(s, "NoStandardDescriptorAccessor: "+valueToGoStringDescriptor(this.NoStandardDescriptorAccessor, "bool")+",\n") - } - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.MapEntry != nil { - s = append(s, "MapEntry: "+valueToGoStringDescriptor(this.MapEntry, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FieldOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 11) - s = append(s, "&descriptor.FieldOptions{") - if this.Ctype != nil { - s = append(s, "Ctype: "+valueToGoStringDescriptor(this.Ctype, "FieldOptions_CType")+",\n") - } - if this.Packed != nil { - s = append(s, "Packed: "+valueToGoStringDescriptor(this.Packed, "bool")+",\n") - } - if this.Jstype != nil { - s = append(s, "Jstype: "+valueToGoStringDescriptor(this.Jstype, "FieldOptions_JSType")+",\n") - } - if this.Lazy != nil { - s = append(s, "Lazy: "+valueToGoStringDescriptor(this.Lazy, "bool")+",\n") - } - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.Weak != nil { - s = append(s, "Weak: "+valueToGoStringDescriptor(this.Weak, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *OneofOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.OneofOptions{") - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.EnumOptions{") - if this.AllowAlias != nil { - s = append(s, "AllowAlias: "+valueToGoStringDescriptor(this.AllowAlias, "bool")+",\n") - } - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumValueOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.EnumValueOptions{") - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *ServiceOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.ServiceOptions{") - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *MethodOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.MethodOptions{") - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.IdempotencyLevel != nil { - s = append(s, "IdempotencyLevel: "+valueToGoStringDescriptor(this.IdempotencyLevel, "MethodOptions_IdempotencyLevel")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *UninterpretedOption) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 11) - s = append(s, "&descriptor.UninterpretedOption{") - if this.Name != nil { - s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") - } - if this.IdentifierValue != nil { - s = append(s, "IdentifierValue: "+valueToGoStringDescriptor(this.IdentifierValue, "string")+",\n") - } - if this.PositiveIntValue != nil { - s = append(s, "PositiveIntValue: "+valueToGoStringDescriptor(this.PositiveIntValue, "uint64")+",\n") - } - if this.NegativeIntValue != nil { - s = append(s, "NegativeIntValue: "+valueToGoStringDescriptor(this.NegativeIntValue, "int64")+",\n") - } - if this.DoubleValue != nil { - s = append(s, "DoubleValue: "+valueToGoStringDescriptor(this.DoubleValue, "float64")+",\n") - } - if this.StringValue != nil { - s = append(s, "StringValue: "+valueToGoStringDescriptor(this.StringValue, "byte")+",\n") - } - if this.AggregateValue != nil { - s = append(s, "AggregateValue: "+valueToGoStringDescriptor(this.AggregateValue, "string")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *UninterpretedOption_NamePart) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.UninterpretedOption_NamePart{") - if this.NamePart != nil { - s = append(s, "NamePart: "+valueToGoStringDescriptor(this.NamePart, "string")+",\n") - } - if this.IsExtension != nil { - s = append(s, "IsExtension: "+valueToGoStringDescriptor(this.IsExtension, "bool")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *SourceCodeInfo) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.SourceCodeInfo{") - if this.Location != nil { - s = append(s, "Location: "+fmt.Sprintf("%#v", this.Location)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *SourceCodeInfo_Location) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 9) - s = append(s, "&descriptor.SourceCodeInfo_Location{") - if this.Path != nil { - s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") - } - if this.Span != nil { - s = append(s, "Span: "+fmt.Sprintf("%#v", this.Span)+",\n") - } - if this.LeadingComments != nil { - s = append(s, "LeadingComments: "+valueToGoStringDescriptor(this.LeadingComments, "string")+",\n") - } - if this.TrailingComments != nil { - s = append(s, "TrailingComments: "+valueToGoStringDescriptor(this.TrailingComments, "string")+",\n") - } - if this.LeadingDetachedComments != nil { - s = append(s, "LeadingDetachedComments: "+fmt.Sprintf("%#v", this.LeadingDetachedComments)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *GeneratedCodeInfo) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.GeneratedCodeInfo{") - if this.Annotation != nil { - s = append(s, "Annotation: "+fmt.Sprintf("%#v", this.Annotation)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *GeneratedCodeInfo_Annotation) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 8) - s = append(s, "&descriptor.GeneratedCodeInfo_Annotation{") - if this.Path != nil { - s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") - } - if this.SourceFile != nil { - s = append(s, "SourceFile: "+valueToGoStringDescriptor(this.SourceFile, "string")+",\n") - } - if this.Begin != nil { - s = append(s, "Begin: "+valueToGoStringDescriptor(this.Begin, "int32")+",\n") - } - if this.End != nil { - s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringDescriptor(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func extensionToGoStringDescriptor(m github_com_gogo_protobuf_proto.Message) string { - e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) - if e == nil { - return "nil" - } - s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" - keys := make([]int, 0, len(e)) - for k := range e { - keys = append(keys, int(k)) - } - sort.Ints(keys) - ss := []string{} - for _, k := range keys { - ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) - } - s += strings.Join(ss, ",") + "})" - return s -} diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go deleted file mode 100644 index e0846a357d..0000000000 --- a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go +++ /dev/null @@ -1,390 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package descriptor - -import ( - "strings" -) - -func (msg *DescriptorProto) GetMapFields() (*FieldDescriptorProto, *FieldDescriptorProto) { - if !msg.GetOptions().GetMapEntry() { - return nil, nil - } - return msg.GetField()[0], msg.GetField()[1] -} - -func dotToUnderscore(r rune) rune { - if r == '.' { - return '_' - } - return r -} - -func (field *FieldDescriptorProto) WireType() (wire int) { - switch *field.Type { - case FieldDescriptorProto_TYPE_DOUBLE: - return 1 - case FieldDescriptorProto_TYPE_FLOAT: - return 5 - case FieldDescriptorProto_TYPE_INT64: - return 0 - case FieldDescriptorProto_TYPE_UINT64: - return 0 - case FieldDescriptorProto_TYPE_INT32: - return 0 - case FieldDescriptorProto_TYPE_UINT32: - return 0 - case FieldDescriptorProto_TYPE_FIXED64: - return 1 - case FieldDescriptorProto_TYPE_FIXED32: - return 5 - case FieldDescriptorProto_TYPE_BOOL: - return 0 - case FieldDescriptorProto_TYPE_STRING: - return 2 - case FieldDescriptorProto_TYPE_GROUP: - return 2 - case FieldDescriptorProto_TYPE_MESSAGE: - return 2 - case FieldDescriptorProto_TYPE_BYTES: - return 2 - case FieldDescriptorProto_TYPE_ENUM: - return 0 - case FieldDescriptorProto_TYPE_SFIXED32: - return 5 - case FieldDescriptorProto_TYPE_SFIXED64: - return 1 - case FieldDescriptorProto_TYPE_SINT32: - return 0 - case FieldDescriptorProto_TYPE_SINT64: - return 0 - } - panic("unreachable") -} - -func (field *FieldDescriptorProto) GetKeyUint64() (x uint64) { - packed := field.IsPacked() - wireType := field.WireType() - fieldNumber := field.GetNumber() - if packed { - wireType = 2 - } - x = uint64(uint32(fieldNumber)<<3 | uint32(wireType)) - return x -} - -func (field *FieldDescriptorProto) GetKey3Uint64() (x uint64) { - packed := field.IsPacked3() - wireType := field.WireType() - fieldNumber := field.GetNumber() - if packed { - wireType = 2 - } - x = uint64(uint32(fieldNumber)<<3 | uint32(wireType)) - return x -} - -func (field *FieldDescriptorProto) GetKey() []byte { - x := field.GetKeyUint64() - i := 0 - keybuf := make([]byte, 0) - for i = 0; x > 127; i++ { - keybuf = append(keybuf, 0x80|uint8(x&0x7F)) - x >>= 7 - } - keybuf = append(keybuf, uint8(x)) - return keybuf -} - -func (field *FieldDescriptorProto) GetKey3() []byte { - x := field.GetKey3Uint64() - i := 0 - keybuf := make([]byte, 0) - for i = 0; x > 127; i++ { - keybuf = append(keybuf, 0x80|uint8(x&0x7F)) - x >>= 7 - } - keybuf = append(keybuf, uint8(x)) - return keybuf -} - -func (desc *FileDescriptorSet) GetField(packageName, messageName, fieldName string) *FieldDescriptorProto { - msg := desc.GetMessage(packageName, messageName) - if msg == nil { - return nil - } - for _, field := range msg.GetField() { - if field.GetName() == fieldName { - return field - } - } - return nil -} - -func (file *FileDescriptorProto) GetMessage(typeName string) *DescriptorProto { - for _, msg := range file.GetMessageType() { - if msg.GetName() == typeName { - return msg - } - nes := file.GetNestedMessage(msg, strings.TrimPrefix(typeName, msg.GetName()+".")) - if nes != nil { - return nes - } - } - return nil -} - -func (file *FileDescriptorProto) GetNestedMessage(msg *DescriptorProto, typeName string) *DescriptorProto { - for _, nes := range msg.GetNestedType() { - if nes.GetName() == typeName { - return nes - } - res := file.GetNestedMessage(nes, strings.TrimPrefix(typeName, nes.GetName()+".")) - if res != nil { - return res - } - } - return nil -} - -func (desc *FileDescriptorSet) GetMessage(packageName string, typeName string) *DescriptorProto { - for _, file := range desc.GetFile() { - if strings.Map(dotToUnderscore, file.GetPackage()) != strings.Map(dotToUnderscore, packageName) { - continue - } - for _, msg := range file.GetMessageType() { - if msg.GetName() == typeName { - return msg - } - } - for _, msg := range file.GetMessageType() { - for _, nes := range msg.GetNestedType() { - if nes.GetName() == typeName { - return nes - } - if msg.GetName()+"."+nes.GetName() == typeName { - return nes - } - } - } - } - return nil -} - -func (desc *FileDescriptorSet) IsProto3(packageName string, typeName string) bool { - for _, file := range desc.GetFile() { - if strings.Map(dotToUnderscore, file.GetPackage()) != strings.Map(dotToUnderscore, packageName) { - continue - } - for _, msg := range file.GetMessageType() { - if msg.GetName() == typeName { - return file.GetSyntax() == "proto3" - } - } - for _, msg := range file.GetMessageType() { - for _, nes := range msg.GetNestedType() { - if nes.GetName() == typeName { - return file.GetSyntax() == "proto3" - } - if msg.GetName()+"."+nes.GetName() == typeName { - return file.GetSyntax() == "proto3" - } - } - } - } - return false -} - -func (msg *DescriptorProto) IsExtendable() bool { - return len(msg.GetExtensionRange()) > 0 -} - -func (desc *FileDescriptorSet) FindExtension(packageName string, typeName string, fieldName string) (extPackageName string, field *FieldDescriptorProto) { - parent := desc.GetMessage(packageName, typeName) - if parent == nil { - return "", nil - } - if !parent.IsExtendable() { - return "", nil - } - extendee := "." + packageName + "." + typeName - for _, file := range desc.GetFile() { - for _, ext := range file.GetExtension() { - if strings.Map(dotToUnderscore, file.GetPackage()) == strings.Map(dotToUnderscore, packageName) { - if !(ext.GetExtendee() == typeName || ext.GetExtendee() == extendee) { - continue - } - } else { - if ext.GetExtendee() != extendee { - continue - } - } - if ext.GetName() == fieldName { - return file.GetPackage(), ext - } - } - } - return "", nil -} - -func (desc *FileDescriptorSet) FindExtensionByFieldNumber(packageName string, typeName string, fieldNum int32) (extPackageName string, field *FieldDescriptorProto) { - parent := desc.GetMessage(packageName, typeName) - if parent == nil { - return "", nil - } - if !parent.IsExtendable() { - return "", nil - } - extendee := "." + packageName + "." + typeName - for _, file := range desc.GetFile() { - for _, ext := range file.GetExtension() { - if strings.Map(dotToUnderscore, file.GetPackage()) == strings.Map(dotToUnderscore, packageName) { - if !(ext.GetExtendee() == typeName || ext.GetExtendee() == extendee) { - continue - } - } else { - if ext.GetExtendee() != extendee { - continue - } - } - if ext.GetNumber() == fieldNum { - return file.GetPackage(), ext - } - } - } - return "", nil -} - -func (desc *FileDescriptorSet) FindMessage(packageName string, typeName string, fieldName string) (msgPackageName string, msgName string) { - parent := desc.GetMessage(packageName, typeName) - if parent == nil { - return "", "" - } - field := parent.GetFieldDescriptor(fieldName) - if field == nil { - var extPackageName string - extPackageName, field = desc.FindExtension(packageName, typeName, fieldName) - if field == nil { - return "", "" - } - packageName = extPackageName - } - typeNames := strings.Split(field.GetTypeName(), ".") - if len(typeNames) == 1 { - msg := desc.GetMessage(packageName, typeName) - if msg == nil { - return "", "" - } - return packageName, msg.GetName() - } - if len(typeNames) > 2 { - for i := 1; i < len(typeNames)-1; i++ { - packageName = strings.Join(typeNames[1:len(typeNames)-i], ".") - typeName = strings.Join(typeNames[len(typeNames)-i:], ".") - msg := desc.GetMessage(packageName, typeName) - if msg != nil { - typeNames := strings.Split(msg.GetName(), ".") - if len(typeNames) == 1 { - return packageName, msg.GetName() - } - return strings.Join(typeNames[1:len(typeNames)-1], "."), typeNames[len(typeNames)-1] - } - } - } - return "", "" -} - -func (msg *DescriptorProto) GetFieldDescriptor(fieldName string) *FieldDescriptorProto { - for _, field := range msg.GetField() { - if field.GetName() == fieldName { - return field - } - } - return nil -} - -func (desc *FileDescriptorSet) GetEnum(packageName string, typeName string) *EnumDescriptorProto { - for _, file := range desc.GetFile() { - if strings.Map(dotToUnderscore, file.GetPackage()) != strings.Map(dotToUnderscore, packageName) { - continue - } - for _, enum := range file.GetEnumType() { - if enum.GetName() == typeName { - return enum - } - } - } - return nil -} - -func (f *FieldDescriptorProto) IsEnum() bool { - return *f.Type == FieldDescriptorProto_TYPE_ENUM -} - -func (f *FieldDescriptorProto) IsMessage() bool { - return *f.Type == FieldDescriptorProto_TYPE_MESSAGE -} - -func (f *FieldDescriptorProto) IsBytes() bool { - return *f.Type == FieldDescriptorProto_TYPE_BYTES -} - -func (f *FieldDescriptorProto) IsRepeated() bool { - return f.Label != nil && *f.Label == FieldDescriptorProto_LABEL_REPEATED -} - -func (f *FieldDescriptorProto) IsString() bool { - return *f.Type == FieldDescriptorProto_TYPE_STRING -} - -func (f *FieldDescriptorProto) IsBool() bool { - return *f.Type == FieldDescriptorProto_TYPE_BOOL -} - -func (f *FieldDescriptorProto) IsRequired() bool { - return f.Label != nil && *f.Label == FieldDescriptorProto_LABEL_REQUIRED -} - -func (f *FieldDescriptorProto) IsPacked() bool { - return f.Options != nil && f.GetOptions().GetPacked() -} - -func (f *FieldDescriptorProto) IsPacked3() bool { - if f.IsRepeated() && f.IsScalar() { - if f.Options == nil || f.GetOptions().Packed == nil { - return true - } - return f.Options != nil && f.GetOptions().GetPacked() - } - return false -} - -func (m *DescriptorProto) HasExtension() bool { - return len(m.ExtensionRange) > 0 -} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/BUILD.bazel b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/BUILD.bazel index d71991e6e8..58bdc76570 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/BUILD.bazel +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/BUILD.bazel @@ -1,6 +1,6 @@ +load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") -load("@rules_proto//proto:defs.bzl", "proto_library") package(default_visibility = ["//visibility:public"]) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/mux.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/mux.go index 4e684c7de6..69edf5eff8 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/mux.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/mux.go @@ -71,6 +71,7 @@ type ServeMux struct { streamErrorHandler StreamErrorHandlerFunc routingErrorHandler RoutingErrorHandlerFunc disablePathLengthFallback bool + disableHTTPMethodOverride bool unescapingMode UnescapingMode writeContentLength bool disableChunkedEncoding bool @@ -271,6 +272,19 @@ func WithDisablePathLengthFallback() ServeMuxOption { } } +// WithDisableHTTPMethodOverride returns a ServeMuxOption that disables the +// X-HTTP-Method-Override header handling. +// +// When this option is used, the mux will no longer allow POST requests with +// the X-HTTP-Method-Override header to override the HTTP method. The path +// length fallback (POST with application/x-www-form-urlencoded falling back +// to a matching GET handler) is not affected by this option. +func WithDisableHTTPMethodOverride() ServeMuxOption { + return func(serveMux *ServeMux) { + serveMux.disableHTTPMethodOverride = true + } +} + // WithWriteContentLength returns a ServeMuxOption to enable writing content length on non-streaming responses func WithWriteContentLength() ServeMuxOption { return func(serveMux *ServeMux) { @@ -405,7 +419,7 @@ func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { path = r.URL.RawPath } - if override := r.Header.Get("X-HTTP-Method-Override"); override != "" && s.isPathLengthFallback(r) { + if override := r.Header.Get("X-HTTP-Method-Override"); override != "" && !s.disableHTTPMethodOverride && s.isPathLengthFallback(r) { if err := r.ParseForm(); err != nil { _, outboundMarshaler := MarshalerForRequest(s, r) sterr := status.Error(codes.InvalidArgument, err.Error()) @@ -467,6 +481,7 @@ func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { HTTPStatus: http.StatusBadRequest, Err: mse, }) + return } continue } @@ -509,6 +524,7 @@ func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { HTTPStatus: http.StatusBadRequest, Err: mse, }) + return } continue } diff --git a/vendor/go.etcd.io/etcd/api/v3/LICENSE b/vendor/go.etcd.io/etcd/api/v3/LICENSE index d645695673..52fb9c29f2 100644 --- a/vendor/go.etcd.io/etcd/api/v3/LICENSE +++ b/vendor/go.etcd.io/etcd/api/v3/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2020 The etcd Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/go.etcd.io/etcd/api/v3/authpb/auth.pb.go b/vendor/go.etcd.io/etcd/api/v3/authpb/auth.pb.go index 37374c5a71..cf2471095f 100644 --- a/vendor/go.etcd.io/etcd/api/v3/authpb/auth.pb.go +++ b/vendor/go.etcd.io/etcd/api/v3/authpb/auth.pb.go @@ -1,1159 +1,383 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v3.20.3 // source: auth.proto package authpb import ( - fmt "fmt" - io "io" - math "math" - math_bits "math/bits" + reflect "reflect" + sync "sync" + unsafe "unsafe" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Permission_Type int32 const ( - READ Permission_Type = 0 - WRITE Permission_Type = 1 - READWRITE Permission_Type = 2 + Permission_READ Permission_Type = 0 + Permission_WRITE Permission_Type = 1 + Permission_READWRITE Permission_Type = 2 ) -var Permission_Type_name = map[int32]string{ - 0: "READ", - 1: "WRITE", - 2: "READWRITE", -} +// Enum value maps for Permission_Type. +var ( + Permission_Type_name = map[int32]string{ + 0: "READ", + 1: "WRITE", + 2: "READWRITE", + } + Permission_Type_value = map[string]int32{ + "READ": 0, + "WRITE": 1, + "READWRITE": 2, + } +) -var Permission_Type_value = map[string]int32{ - "READ": 0, - "WRITE": 1, - "READWRITE": 2, +func (x Permission_Type) Enum() *Permission_Type { + p := new(Permission_Type) + *p = x + return p } func (x Permission_Type) String() string { - return proto.EnumName(Permission_Type_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (Permission_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8bbd6f3875b0e874, []int{2, 0} +func (Permission_Type) Descriptor() protoreflect.EnumDescriptor { + return file_auth_proto_enumTypes[0].Descriptor() } -type UserAddOptions struct { - NoPassword bool `protobuf:"varint,1,opt,name=no_password,json=noPassword,proto3" json:"no_password,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (Permission_Type) Type() protoreflect.EnumType { + return &file_auth_proto_enumTypes[0] } -func (m *UserAddOptions) Reset() { *m = UserAddOptions{} } -func (m *UserAddOptions) String() string { return proto.CompactTextString(m) } -func (*UserAddOptions) ProtoMessage() {} -func (*UserAddOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_8bbd6f3875b0e874, []int{0} -} -func (m *UserAddOptions) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *UserAddOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UserAddOptions.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *UserAddOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserAddOptions.Merge(m, src) -} -func (m *UserAddOptions) XXX_Size() int { - return m.Size() -} -func (m *UserAddOptions) XXX_DiscardUnknown() { - xxx_messageInfo_UserAddOptions.DiscardUnknown(m) +func (x Permission_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } -var xxx_messageInfo_UserAddOptions proto.InternalMessageInfo - -// User is a single entry in the bucket authUsers -type User struct { - Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Password []byte `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` - Roles []string `protobuf:"bytes,3,rep,name=roles,proto3" json:"roles,omitempty"` - Options *UserAddOptions `protobuf:"bytes,4,opt,name=options,proto3" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Deprecated: Use Permission_Type.Descriptor instead. +func (Permission_Type) EnumDescriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{2, 0} } -func (m *User) Reset() { *m = User{} } -func (m *User) String() string { return proto.CompactTextString(m) } -func (*User) ProtoMessage() {} -func (*User) Descriptor() ([]byte, []int) { - return fileDescriptor_8bbd6f3875b0e874, []int{1} -} -func (m *User) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *User) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_User.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *User) XXX_Merge(src proto.Message) { - xxx_messageInfo_User.Merge(m, src) -} -func (m *User) XXX_Size() int { - return m.Size() -} -func (m *User) XXX_DiscardUnknown() { - xxx_messageInfo_User.DiscardUnknown(m) +type UserAddOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + NoPassword bool `protobuf:"varint,1,opt,name=no_password,json=noPassword,proto3" json:"no_password,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -var xxx_messageInfo_User proto.InternalMessageInfo - -// Permission is a single entity -type Permission struct { - PermType Permission_Type `protobuf:"varint,1,opt,name=permType,proto3,enum=authpb.Permission_Type" json:"permType,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - RangeEnd []byte `protobuf:"bytes,3,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *UserAddOptions) Reset() { + *x = UserAddOptions{} + mi := &file_auth_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *Permission) Reset() { *m = Permission{} } -func (m *Permission) String() string { return proto.CompactTextString(m) } -func (*Permission) ProtoMessage() {} -func (*Permission) Descriptor() ([]byte, []int) { - return fileDescriptor_8bbd6f3875b0e874, []int{2} -} -func (m *Permission) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) +func (x *UserAddOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Permission) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Permission.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*UserAddOptions) ProtoMessage() {} + +func (x *UserAddOptions) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *Permission) XXX_Merge(src proto.Message) { - xxx_messageInfo_Permission.Merge(m, src) -} -func (m *Permission) XXX_Size() int { - return m.Size() -} -func (m *Permission) XXX_DiscardUnknown() { - xxx_messageInfo_Permission.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_Permission proto.InternalMessageInfo - -// Role is a single entry in the bucket authRoles -type Role struct { - Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - KeyPermission []*Permission `protobuf:"bytes,2,rep,name=keyPermission,proto3" json:"keyPermission,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Deprecated: Use UserAddOptions.ProtoReflect.Descriptor instead. +func (*UserAddOptions) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{0} } -func (m *Role) Reset() { *m = Role{} } -func (m *Role) String() string { return proto.CompactTextString(m) } -func (*Role) ProtoMessage() {} -func (*Role) Descriptor() ([]byte, []int) { - return fileDescriptor_8bbd6f3875b0e874, []int{3} -} -func (m *Role) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Role) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Role.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *UserAddOptions) GetNoPassword() bool { + if x != nil { + return x.NoPassword } -} -func (m *Role) XXX_Merge(src proto.Message) { - xxx_messageInfo_Role.Merge(m, src) -} -func (m *Role) XXX_Size() int { - return m.Size() -} -func (m *Role) XXX_DiscardUnknown() { - xxx_messageInfo_Role.DiscardUnknown(m) + return false } -var xxx_messageInfo_Role proto.InternalMessageInfo - -func init() { - proto.RegisterEnum("authpb.Permission_Type", Permission_Type_name, Permission_Type_value) - proto.RegisterType((*UserAddOptions)(nil), "authpb.UserAddOptions") - proto.RegisterType((*User)(nil), "authpb.User") - proto.RegisterType((*Permission)(nil), "authpb.Permission") - proto.RegisterType((*Role)(nil), "authpb.Role") +// User is a single entry in the bucket authUsers +type User struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Password []byte `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + Roles []string `protobuf:"bytes,3,rep,name=roles,proto3" json:"roles,omitempty"` + Options *UserAddOptions `protobuf:"bytes,4,opt,name=options,proto3" json:"options,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func init() { proto.RegisterFile("auth.proto", fileDescriptor_8bbd6f3875b0e874) } - -var fileDescriptor_8bbd6f3875b0e874 = []byte{ - // 359 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xcf, 0x4e, 0xc2, 0x40, - 0x10, 0xc6, 0xbb, 0xb4, 0x60, 0x3b, 0x08, 0x21, 0x1b, 0xa2, 0x0d, 0xc6, 0xda, 0xf4, 0xd4, 0x78, - 0x68, 0x15, 0x0e, 0x7a, 0xc5, 0xc8, 0xc1, 0x93, 0x64, 0x83, 0x31, 0xf1, 0x42, 0x8a, 0xdd, 0xd4, - 0x06, 0xd8, 0x6d, 0xda, 0xaa, 0xe1, 0xe2, 0x73, 0x78, 0xf0, 0x81, 0x38, 0xf2, 0x08, 0x82, 0x2f, - 0x62, 0xba, 0xcb, 0x9f, 0x10, 0x3d, 0xed, 0x37, 0xdf, 0x7c, 0x33, 0xfb, 0xcb, 0x2e, 0x40, 0xf0, - 0x9a, 0xbf, 0x78, 0x49, 0xca, 0x73, 0x8e, 0x2b, 0x85, 0x4e, 0x46, 0xad, 0x66, 0xc4, 0x23, 0x2e, - 0x2c, 0xbf, 0x50, 0xb2, 0xeb, 0x5c, 0x42, 0xfd, 0x21, 0xa3, 0x69, 0x37, 0x0c, 0xef, 0x93, 0x3c, - 0xe6, 0x2c, 0xc3, 0x67, 0x50, 0x65, 0x7c, 0x98, 0x04, 0x59, 0xf6, 0xce, 0xd3, 0xd0, 0x44, 0x36, - 0x72, 0x75, 0x02, 0x8c, 0xf7, 0xd7, 0x8e, 0xf3, 0x01, 0x5a, 0x31, 0x82, 0x31, 0x68, 0x2c, 0x98, - 0x52, 0x91, 0x38, 0x24, 0x42, 0xe3, 0x16, 0xe8, 0xdb, 0xc9, 0x92, 0xf0, 0xb7, 0x35, 0x6e, 0x42, - 0x39, 0xe5, 0x13, 0x9a, 0x99, 0xaa, 0xad, 0xba, 0x06, 0x91, 0x05, 0xbe, 0x80, 0x03, 0x2e, 0x6f, - 0x36, 0x35, 0x1b, 0xb9, 0xd5, 0xf6, 0x91, 0x27, 0x81, 0xbd, 0x7d, 0x2e, 0xb2, 0x89, 0x39, 0x5f, - 0x08, 0xa0, 0x4f, 0xd3, 0x69, 0x9c, 0x65, 0x31, 0x67, 0xb8, 0x03, 0x7a, 0x42, 0xd3, 0xe9, 0x60, - 0x96, 0x48, 0x94, 0x7a, 0xfb, 0x78, 0xb3, 0x61, 0x97, 0xf2, 0x8a, 0x36, 0xd9, 0x06, 0x71, 0x03, - 0xd4, 0x31, 0x9d, 0xad, 0x11, 0x0b, 0x89, 0x4f, 0xc0, 0x48, 0x03, 0x16, 0xd1, 0x21, 0x65, 0xa1, - 0xa9, 0x4a, 0x74, 0x61, 0xf4, 0x58, 0xe8, 0x9c, 0x83, 0x26, 0xc6, 0x74, 0xd0, 0x48, 0xaf, 0x7b, - 0xdb, 0x50, 0xb0, 0x01, 0xe5, 0x47, 0x72, 0x37, 0xe8, 0x35, 0x10, 0xae, 0x81, 0x51, 0x98, 0xb2, - 0x2c, 0x39, 0x03, 0xd0, 0x08, 0x9f, 0xd0, 0x7f, 0x9f, 0xe7, 0x1a, 0x6a, 0x63, 0x3a, 0xdb, 0x61, - 0x99, 0x25, 0x5b, 0x75, 0xab, 0x6d, 0xfc, 0x17, 0x98, 0xec, 0x07, 0x6f, 0xae, 0xe6, 0x4b, 0x4b, - 0x59, 0x2c, 0x2d, 0x65, 0xbe, 0xb2, 0xd0, 0x62, 0x65, 0xa1, 0xef, 0x95, 0x85, 0x3e, 0x7f, 0x2c, - 0xe5, 0xe9, 0x34, 0xe2, 0x1e, 0xcd, 0x9f, 0x43, 0x2f, 0xe6, 0x7e, 0x71, 0xfa, 0x41, 0x12, 0xfb, - 0x6f, 0x1d, 0x5f, 0xae, 0x1c, 0x55, 0xc4, 0x3f, 0x77, 0x7e, 0x03, 0x00, 0x00, 0xff, 0xff, 0x61, - 0x5a, 0xfe, 0x48, 0x13, 0x02, 0x00, 0x00, +func (x *User) Reset() { + *x = User{} + mi := &file_auth_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *UserAddOptions) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (x *User) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *UserAddOptions) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} +func (*User) ProtoMessage() {} -func (m *UserAddOptions) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.NoPassword { - i-- - if m.NoPassword { - dAtA[i] = 1 - } else { - dAtA[i] = 0 +func (x *User) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - i-- - dAtA[i] = 0x8 + return ms } - return len(dAtA) - i, nil + return mi.MessageOf(x) } -func (m *User) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +// Deprecated: Use User.ProtoReflect.Descriptor instead. +func (*User) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{1} } -func (m *User) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (x *User) GetName() []byte { + if x != nil { + return x.Name + } + return nil } -func (m *User) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) +func (x *User) GetPassword() []byte { + if x != nil { + return x.Password } - if m.Options != nil { - { - size, err := m.Options.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAuth(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if len(m.Roles) > 0 { - for iNdEx := len(m.Roles) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Roles[iNdEx]) - copy(dAtA[i:], m.Roles[iNdEx]) - i = encodeVarintAuth(dAtA, i, uint64(len(m.Roles[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Password) > 0 { - i -= len(m.Password) - copy(dAtA[i:], m.Password) - i = encodeVarintAuth(dAtA, i, uint64(len(m.Password))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintAuth(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil + return nil } -func (m *Permission) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *User) GetRoles() []string { + if x != nil { + return x.Roles } - return dAtA[:n], nil + return nil } -func (m *Permission) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (x *User) GetOptions() *UserAddOptions { + if x != nil { + return x.Options + } + return nil } -func (m *Permission) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.RangeEnd) > 0 { - i -= len(m.RangeEnd) - copy(dAtA[i:], m.RangeEnd) - i = encodeVarintAuth(dAtA, i, uint64(len(m.RangeEnd))) - i-- - dAtA[i] = 0x1a - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintAuth(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0x12 - } - if m.PermType != 0 { - i = encodeVarintAuth(dAtA, i, uint64(m.PermType)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil +// Permission is a single entity +type Permission struct { + state protoimpl.MessageState `protogen:"open.v1"` + PermType Permission_Type `protobuf:"varint,1,opt,name=permType,proto3,enum=authpb.Permission_Type" json:"permType,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + RangeEnd []byte `protobuf:"bytes,3,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *Role) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (x *Permission) Reset() { + *x = Permission{} + mi := &file_auth_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *Role) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (x *Permission) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Role) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.KeyPermission) > 0 { - for iNdEx := len(m.KeyPermission) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.KeyPermission[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAuth(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 +func (*Permission) ProtoMessage() {} + +func (x *Permission) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } + return ms } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintAuth(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil + return mi.MessageOf(x) } -func encodeVarintAuth(dAtA []byte, offset int, v uint64) int { - offset -= sovAuth(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *UserAddOptions) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.NoPassword { - n += 2 - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n +// Deprecated: Use Permission.ProtoReflect.Descriptor instead. +func (*Permission) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{2} } -func (m *User) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovAuth(uint64(l)) +func (x *Permission) GetPermType() Permission_Type { + if x != nil { + return x.PermType } - l = len(m.Password) - if l > 0 { - n += 1 + l + sovAuth(uint64(l)) - } - if len(m.Roles) > 0 { - for _, s := range m.Roles { - l = len(s) - n += 1 + l + sovAuth(uint64(l)) - } - } - if m.Options != nil { - l = m.Options.Size() - n += 1 + l + sovAuth(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n + return Permission_READ } -func (m *Permission) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PermType != 0 { - n += 1 + sovAuth(uint64(m.PermType)) - } - l = len(m.Key) - if l > 0 { - n += 1 + l + sovAuth(uint64(l)) - } - l = len(m.RangeEnd) - if l > 0 { - n += 1 + l + sovAuth(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) +func (x *Permission) GetKey() []byte { + if x != nil { + return x.Key } - return n + return nil } -func (m *Role) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovAuth(uint64(l)) - } - if len(m.KeyPermission) > 0 { - for _, e := range m.KeyPermission { - l = e.Size() - n += 1 + l + sovAuth(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) +func (x *Permission) GetRangeEnd() []byte { + if x != nil { + return x.RangeEnd } - return n + return nil } -func sovAuth(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +// Role is a single entry in the bucket authRoles +type Role struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + KeyPermission []*Permission `protobuf:"bytes,2,rep,name=keyPermission,proto3" json:"keyPermission,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func sozAuth(x uint64) (n int) { - return sovAuth(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + +func (x *Role) Reset() { + *x = Role{} + mi := &file_auth_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *UserAddOptions) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: UserAddOptions: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UserAddOptions: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NoPassword", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.NoPassword = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipAuth(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAuth - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +func (x *Role) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *User) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: User: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: User: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAuth - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAuth - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = append(m.Name[:0], dAtA[iNdEx:postIndex]...) - if m.Name == nil { - m.Name = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Password", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAuth - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAuth - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Password = append(m.Password[:0], dAtA[iNdEx:postIndex]...) - if m.Password == nil { - m.Password = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Roles", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAuth - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAuth - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Roles = append(m.Roles, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuth - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuth - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Options == nil { - m.Options = &UserAddOptions{} - } - if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAuth(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAuth - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy + +func (*Role) ProtoMessage() {} + +func (x *Role) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } + return ms } + return mi.MessageOf(x) +} - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +// Deprecated: Use Role.ProtoReflect.Descriptor instead. +func (*Role) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{3} } -func (m *Permission) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Permission: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Permission: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PermType", wireType) - } - m.PermType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PermType |= Permission_Type(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAuth - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAuth - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RangeEnd", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAuth - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAuth - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RangeEnd = append(m.RangeEnd[:0], dAtA[iNdEx:postIndex]...) - if m.RangeEnd == nil { - m.RangeEnd = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAuth(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAuth - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *Role) GetName() []byte { + if x != nil { + return x.Name } return nil } -func (m *Role) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Role: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Role: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAuth - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAuth - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = append(m.Name[:0], dAtA[iNdEx:postIndex]...) - if m.Name == nil { - m.Name = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field KeyPermission", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuth - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuth - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.KeyPermission = append(m.KeyPermission, &Permission{}) - if err := m.KeyPermission[len(m.KeyPermission)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAuth(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAuth - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *Role) GetKeyPermission() []*Permission { + if x != nil { + return x.KeyPermission } return nil } -func skipAuth(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAuth - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAuth - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAuth - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthAuth - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupAuth - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthAuth - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} + +var File_auth_proto protoreflect.FileDescriptor + +const file_auth_proto_rawDesc = "" + + "\n" + + "\n" + + "auth.proto\x12\x06authpb\"1\n" + + "\x0eUserAddOptions\x12\x1f\n" + + "\vno_password\x18\x01 \x01(\bR\n" + + "noPassword\"~\n" + + "\x04User\x12\x12\n" + + "\x04name\x18\x01 \x01(\fR\x04name\x12\x1a\n" + + "\bpassword\x18\x02 \x01(\fR\bpassword\x12\x14\n" + + "\x05roles\x18\x03 \x03(\tR\x05roles\x120\n" + + "\aoptions\x18\x04 \x01(\v2\x16.authpb.UserAddOptionsR\aoptions\"\x9c\x01\n" + + "\n" + + "Permission\x123\n" + + "\bpermType\x18\x01 \x01(\x0e2\x17.authpb.Permission.TypeR\bpermType\x12\x10\n" + + "\x03key\x18\x02 \x01(\fR\x03key\x12\x1b\n" + + "\trange_end\x18\x03 \x01(\fR\brangeEnd\"*\n" + + "\x04Type\x12\b\n" + + "\x04READ\x10\x00\x12\t\n" + + "\x05WRITE\x10\x01\x12\r\n" + + "\tREADWRITE\x10\x02\"T\n" + + "\x04Role\x12\x12\n" + + "\x04name\x18\x01 \x01(\fR\x04name\x128\n" + + "\rkeyPermission\x18\x02 \x03(\v2\x12.authpb.PermissionR\rkeyPermissionB\x1fZ\x1dgo.etcd.io/etcd/api/v3/authpbb\x06proto3" var ( - ErrInvalidLengthAuth = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAuth = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupAuth = fmt.Errorf("proto: unexpected end of group") + file_auth_proto_rawDescOnce sync.Once + file_auth_proto_rawDescData []byte ) + +func file_auth_proto_rawDescGZIP() []byte { + file_auth_proto_rawDescOnce.Do(func() { + file_auth_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_auth_proto_rawDesc), len(file_auth_proto_rawDesc))) + }) + return file_auth_proto_rawDescData +} + +var file_auth_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_auth_proto_goTypes = []any{ + (Permission_Type)(0), // 0: authpb.Permission.Type + (*UserAddOptions)(nil), // 1: authpb.UserAddOptions + (*User)(nil), // 2: authpb.User + (*Permission)(nil), // 3: authpb.Permission + (*Role)(nil), // 4: authpb.Role +} +var file_auth_proto_depIdxs = []int32{ + 1, // 0: authpb.User.options:type_name -> authpb.UserAddOptions + 0, // 1: authpb.Permission.permType:type_name -> authpb.Permission.Type + 3, // 2: authpb.Role.keyPermission:type_name -> authpb.Permission + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_auth_proto_init() } +func file_auth_proto_init() { + if File_auth_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_auth_proto_rawDesc), len(file_auth_proto_rawDesc)), + NumEnums: 1, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_auth_proto_goTypes, + DependencyIndexes: file_auth_proto_depIdxs, + EnumInfos: file_auth_proto_enumTypes, + MessageInfos: file_auth_proto_msgTypes, + }.Build() + File_auth_proto = out.File + file_auth_proto_goTypes = nil + file_auth_proto_depIdxs = nil +} diff --git a/vendor/go.etcd.io/etcd/api/v3/authpb/auth.proto b/vendor/go.etcd.io/etcd/api/v3/authpb/auth.proto index 5a7856bb73..41bcaaecbf 100644 --- a/vendor/go.etcd.io/etcd/api/v3/authpb/auth.proto +++ b/vendor/go.etcd.io/etcd/api/v3/authpb/auth.proto @@ -1,16 +1,8 @@ syntax = "proto3"; package authpb; -import "gogoproto/gogo.proto"; - option go_package = "go.etcd.io/etcd/api/v3/authpb"; -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; -option (gogoproto.goproto_getters_all) = false; -option (gogoproto.goproto_enum_prefix_all) = false; - message UserAddOptions { bool no_password = 1; }; diff --git a/vendor/go.etcd.io/etcd/api/v3/authpb/deprecated.go b/vendor/go.etcd.io/etcd/api/v3/authpb/deprecated.go new file mode 100644 index 0000000000..df853b7b49 --- /dev/null +++ b/vendor/go.etcd.io/etcd/api/v3/authpb/deprecated.go @@ -0,0 +1,27 @@ +// Copyright 2026 The etcd 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 authpb + +const ( + // READ is an alias of Permission_READ + // Deprecated: use Permission_READ instead. Will be removed in v3.8. + READ = Permission_READ + // WRITE is an alias of Permission_WRITE + // Deprecated: use Permission_WRITE instead. Will be removed in v3.8. + WRITE = Permission_WRITE + // READWRITE is an alias of Permission_READWRITE + // Deprecated: use Permission_READWRITE instead. Will be removed in v3.8. + READWRITE = Permission_READWRITE +) diff --git a/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/etcdserver.pb.go b/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/etcdserver.pb.go index eaefa2d208..14dd9d114c 100644 --- a/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/etcdserver.pb.go +++ b/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/etcdserver.pb.go @@ -1,1004 +1,132 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v3.20.3 // source: etcdserver.proto package etcdserverpb import ( - fmt "fmt" - io "io" - math "math" - math_bits "math/bits" + reflect "reflect" + sync "sync" + unsafe "unsafe" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type Request struct { - ID uint64 `protobuf:"varint,1,opt,name=ID" json:"ID"` - Method string `protobuf:"bytes,2,opt,name=Method" json:"Method"` - Path string `protobuf:"bytes,3,opt,name=Path" json:"Path"` - Val string `protobuf:"bytes,4,opt,name=Val" json:"Val"` - Dir bool `protobuf:"varint,5,opt,name=Dir" json:"Dir"` - PrevValue string `protobuf:"bytes,6,opt,name=PrevValue" json:"PrevValue"` - PrevIndex uint64 `protobuf:"varint,7,opt,name=PrevIndex" json:"PrevIndex"` - PrevExist *bool `protobuf:"varint,8,opt,name=PrevExist" json:"PrevExist,omitempty"` - Expiration int64 `protobuf:"varint,9,opt,name=Expiration" json:"Expiration"` - Wait bool `protobuf:"varint,10,opt,name=Wait" json:"Wait"` - Since uint64 `protobuf:"varint,11,opt,name=Since" json:"Since"` - Recursive bool `protobuf:"varint,12,opt,name=Recursive" json:"Recursive"` - Sorted bool `protobuf:"varint,13,opt,name=Sorted" json:"Sorted"` - Quorum bool `protobuf:"varint,14,opt,name=Quorum" json:"Quorum"` - Time int64 `protobuf:"varint,15,opt,name=Time" json:"Time"` - Stream bool `protobuf:"varint,16,opt,name=Stream" json:"Stream"` - Refresh *bool `protobuf:"varint,17,opt,name=Refresh" json:"Refresh,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Request) Reset() { *m = Request{} } -func (m *Request) String() string { return proto.CompactTextString(m) } -func (*Request) ProtoMessage() {} -func (*Request) Descriptor() ([]byte, []int) { - return fileDescriptor_09ffbeb3bebbce7e, []int{0} -} -func (m *Request) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Request.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Request) XXX_Merge(src proto.Message) { - xxx_messageInfo_Request.Merge(m, src) -} -func (m *Request) XXX_Size() int { - return m.Size() -} -func (m *Request) XXX_DiscardUnknown() { - xxx_messageInfo_Request.DiscardUnknown(m) -} - -var xxx_messageInfo_Request proto.InternalMessageInfo +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Metadata struct { - NodeID uint64 `protobuf:"varint,1,opt,name=NodeID" json:"NodeID"` - ClusterID uint64 `protobuf:"varint,2,opt,name=ClusterID" json:"ClusterID"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + NodeID *uint64 `protobuf:"varint,1,opt,name=NodeID" json:"NodeID,omitempty"` + ClusterID *uint64 `protobuf:"varint,2,opt,name=ClusterID" json:"ClusterID,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *Metadata) Reset() { *m = Metadata{} } -func (m *Metadata) String() string { return proto.CompactTextString(m) } -func (*Metadata) ProtoMessage() {} -func (*Metadata) Descriptor() ([]byte, []int) { - return fileDescriptor_09ffbeb3bebbce7e, []int{1} -} -func (m *Metadata) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Metadata.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Metadata) XXX_Merge(src proto.Message) { - xxx_messageInfo_Metadata.Merge(m, src) -} -func (m *Metadata) XXX_Size() int { - return m.Size() -} -func (m *Metadata) XXX_DiscardUnknown() { - xxx_messageInfo_Metadata.DiscardUnknown(m) -} - -var xxx_messageInfo_Metadata proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Request)(nil), "etcdserverpb.Request") - proto.RegisterType((*Metadata)(nil), "etcdserverpb.Metadata") +func (x *Metadata) Reset() { + *x = Metadata{} + mi := &file_etcdserver_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func init() { proto.RegisterFile("etcdserver.proto", fileDescriptor_09ffbeb3bebbce7e) } - -var fileDescriptor_09ffbeb3bebbce7e = []byte{ - // 402 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0xd2, 0x41, 0xef, 0xd2, 0x30, - 0x14, 0x00, 0x70, 0x0a, 0xfb, 0xff, 0x81, 0x8a, 0x8a, 0x0d, 0x31, 0x2f, 0xc4, 0xcc, 0x05, 0x3d, - 0xec, 0xc4, 0x0e, 0x9e, 0xbc, 0xe2, 0x38, 0x2c, 0x11, 0x83, 0xc3, 0x60, 0xe2, 0xad, 0xb2, 0x27, - 0x34, 0x01, 0x3a, 0xbb, 0x6e, 0xe1, 0x1b, 0xf8, 0x15, 0xfc, 0x48, 0x1c, 0xfd, 0x04, 0x46, 0xf1, - 0x8b, 0x98, 0x8e, 0x8d, 0x55, 0x4f, 0x5b, 0x7e, 0xef, 0xf5, 0xf5, 0xb5, 0x7d, 0x74, 0x88, 0x7a, - 0x93, 0x64, 0xa8, 0x0a, 0x54, 0xd3, 0x54, 0x49, 0x2d, 0xd9, 0xa0, 0x91, 0xf4, 0xf3, 0x78, 0xb4, - 0x95, 0x5b, 0x59, 0x06, 0x02, 0xf3, 0x77, 0xcd, 0x99, 0x7c, 0x73, 0x68, 0x37, 0xc6, 0xaf, 0x39, - 0x66, 0x9a, 0x8d, 0x68, 0x3b, 0x0a, 0x81, 0x78, 0xc4, 0x77, 0x66, 0xce, 0xf9, 0xe7, 0xf3, 0x56, - 0xdc, 0x8e, 0x42, 0xf6, 0x8c, 0xde, 0x2f, 0x50, 0xef, 0x64, 0x02, 0x6d, 0x8f, 0xf8, 0xfd, 0x2a, - 0x52, 0x19, 0x03, 0xea, 0x2c, 0xb9, 0xde, 0x41, 0xc7, 0x8a, 0x95, 0xc2, 0x9e, 0xd2, 0xce, 0x9a, - 0xef, 0xc1, 0xb1, 0x02, 0x06, 0x8c, 0x87, 0x42, 0xc1, 0x9d, 0x47, 0xfc, 0x5e, 0xed, 0xa1, 0x50, - 0x6c, 0x42, 0xfb, 0x4b, 0x85, 0xc5, 0x9a, 0xef, 0x73, 0x84, 0x7b, 0x6b, 0x55, 0xc3, 0x75, 0x4e, - 0x74, 0x4c, 0xf0, 0x04, 0x5d, 0xab, 0xd1, 0x86, 0xeb, 0x9c, 0xf9, 0x49, 0x64, 0x1a, 0x7a, 0xb7, - 0x5d, 0x48, 0xdc, 0x30, 0x7b, 0x49, 0xe9, 0xfc, 0x94, 0x0a, 0xc5, 0xb5, 0x90, 0x47, 0xe8, 0x7b, - 0xc4, 0xef, 0x54, 0x85, 0x2c, 0x37, 0x67, 0xfb, 0xc8, 0x85, 0x06, 0x6a, 0xb5, 0x5a, 0x0a, 0x1b, - 0xd3, 0xbb, 0x95, 0x38, 0x6e, 0x10, 0x1e, 0x58, 0x3d, 0x5c, 0xc9, 0xec, 0x1f, 0xe3, 0x26, 0x57, - 0x99, 0x28, 0x10, 0x06, 0xd6, 0xd2, 0x86, 0xcd, 0x9d, 0xae, 0xa4, 0xd2, 0x98, 0xc0, 0x43, 0x2b, - 0xa1, 0x32, 0x13, 0x7d, 0x9f, 0x4b, 0x95, 0x1f, 0xe0, 0x91, 0x1d, 0xbd, 0x9a, 0xe9, 0xea, 0x83, - 0x38, 0x20, 0x3c, 0xb6, 0xba, 0x2e, 0xa5, 0xac, 0xaa, 0x15, 0xf2, 0x03, 0x0c, 0xff, 0xa9, 0x5a, - 0x1a, 0x73, 0xcd, 0x43, 0x7f, 0x51, 0x98, 0xed, 0xe0, 0x89, 0x75, 0x2b, 0x35, 0x4e, 0xde, 0xd2, - 0xde, 0x02, 0x35, 0x4f, 0xb8, 0xe6, 0xa6, 0xd2, 0x3b, 0x99, 0xe0, 0x7f, 0xd3, 0x50, 0x99, 0x39, - 0xe1, 0x9b, 0x7d, 0x9e, 0x69, 0x54, 0x51, 0x58, 0x0e, 0xc5, 0xed, 0x15, 0x6e, 0x3c, 0x7b, 0x7d, - 0xfe, 0xed, 0xb6, 0xce, 0x17, 0x97, 0xfc, 0xb8, 0xb8, 0xe4, 0xd7, 0xc5, 0x25, 0xdf, 0xff, 0xb8, - 0xad, 0x4f, 0x2f, 0xb6, 0x72, 0x6a, 0x86, 0x72, 0x2a, 0x64, 0x60, 0xbe, 0x01, 0x4f, 0x45, 0x50, - 0xbc, 0x0a, 0xec, 0x41, 0xfd, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x2b, 0x79, 0xf9, 0xf5, 0xc9, 0x02, - 0x00, 0x00, +func (x *Metadata) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Request) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Request) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} +func (*Metadata) ProtoMessage() {} -func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Refresh != nil { - i-- - if *m.Refresh { - dAtA[i] = 1 - } else { - dAtA[i] = 0 +func (x *Metadata) ProtoReflect() protoreflect.Message { + mi := &file_etcdserver_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x88 - } - i-- - if m.Stream { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x80 - i = encodeVarintEtcdserver(dAtA, i, uint64(m.Time)) - i-- - dAtA[i] = 0x78 - i-- - if m.Quorum { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x70 - i-- - if m.Sorted { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x68 - i-- - if m.Recursive { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x60 - i = encodeVarintEtcdserver(dAtA, i, uint64(m.Since)) - i-- - dAtA[i] = 0x58 - i-- - if m.Wait { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x50 - i = encodeVarintEtcdserver(dAtA, i, uint64(m.Expiration)) - i-- - dAtA[i] = 0x48 - if m.PrevExist != nil { - i-- - if *m.PrevExist { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - i = encodeVarintEtcdserver(dAtA, i, uint64(m.PrevIndex)) - i-- - dAtA[i] = 0x38 - i -= len(m.PrevValue) - copy(dAtA[i:], m.PrevValue) - i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.PrevValue))) - i-- - dAtA[i] = 0x32 - i-- - if m.Dir { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + return ms } - i-- - dAtA[i] = 0x28 - i -= len(m.Val) - copy(dAtA[i:], m.Val) - i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.Val))) - i-- - dAtA[i] = 0x22 - i -= len(m.Path) - copy(dAtA[i:], m.Path) - i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.Path))) - i-- - dAtA[i] = 0x1a - i -= len(m.Method) - copy(dAtA[i:], m.Method) - i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.Method))) - i-- - dAtA[i] = 0x12 - i = encodeVarintEtcdserver(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x8 - return len(dAtA) - i, nil + return mi.MessageOf(x) } -func (m *Metadata) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Metadata) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +// Deprecated: Use Metadata.ProtoReflect.Descriptor instead. +func (*Metadata) Descriptor() ([]byte, []int) { + return file_etcdserver_proto_rawDescGZIP(), []int{0} } -func (m *Metadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) +func (x *Metadata) GetNodeID() uint64 { + if x != nil && x.NodeID != nil { + return *x.NodeID } - i = encodeVarintEtcdserver(dAtA, i, uint64(m.ClusterID)) - i-- - dAtA[i] = 0x10 - i = encodeVarintEtcdserver(dAtA, i, uint64(m.NodeID)) - i-- - dAtA[i] = 0x8 - return len(dAtA) - i, nil + return 0 } -func encodeVarintEtcdserver(dAtA []byte, offset int, v uint64) int { - offset -= sovEtcdserver(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Request) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovEtcdserver(uint64(m.ID)) - l = len(m.Method) - n += 1 + l + sovEtcdserver(uint64(l)) - l = len(m.Path) - n += 1 + l + sovEtcdserver(uint64(l)) - l = len(m.Val) - n += 1 + l + sovEtcdserver(uint64(l)) - n += 2 - l = len(m.PrevValue) - n += 1 + l + sovEtcdserver(uint64(l)) - n += 1 + sovEtcdserver(uint64(m.PrevIndex)) - if m.PrevExist != nil { - n += 2 - } - n += 1 + sovEtcdserver(uint64(m.Expiration)) - n += 2 - n += 1 + sovEtcdserver(uint64(m.Since)) - n += 2 - n += 2 - n += 2 - n += 1 + sovEtcdserver(uint64(m.Time)) - n += 3 - if m.Refresh != nil { - n += 3 +func (x *Metadata) GetClusterID() uint64 { + if x != nil && x.ClusterID != nil { + return *x.ClusterID } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n + return 0 } -func (m *Metadata) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovEtcdserver(uint64(m.NodeID)) - n += 1 + sovEtcdserver(uint64(m.ClusterID)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovEtcdserver(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozEtcdserver(x uint64) (n int) { - return sovEtcdserver(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Request) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Request: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Request: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Method", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEtcdserver - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEtcdserver - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Method = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEtcdserver - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEtcdserver - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Path = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Val", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEtcdserver - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEtcdserver - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Val = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Dir", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Dir = bool(v != 0) - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevValue", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEtcdserver - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEtcdserver - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PrevValue = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevIndex", wireType) - } - m.PrevIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PrevIndex |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevExist", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.PrevExist = &b - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Expiration", wireType) - } - m.Expiration = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Expiration |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Wait", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Wait = bool(v != 0) - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Since", wireType) - } - m.Since = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Since |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Recursive", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Recursive = bool(v != 0) - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Sorted", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Sorted = bool(v != 0) - case 14: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Quorum = bool(v != 0) - case 15: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType) - } - m.Time = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Time |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 16: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Stream", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Stream = bool(v != 0) - case 17: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Refresh", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Refresh = &b - default: - iNdEx = preIndex - skippy, err := skipEtcdserver(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEtcdserver - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Metadata) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Metadata: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Metadata: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType) - } - m.NodeID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NodeID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ClusterID", wireType) - } - m.ClusterID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ClusterID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipEtcdserver(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEtcdserver - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } +var File_etcdserver_proto protoreflect.FileDescriptor - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipEtcdserver(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEtcdserver - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthEtcdserver - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupEtcdserver - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthEtcdserver - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} +const file_etcdserver_proto_rawDesc = "" + + "\n" + + "\x10etcdserver.proto\x12\fetcdserverpb\"@\n" + + "\bMetadata\x12\x16\n" + + "\x06NodeID\x18\x01 \x01(\x04R\x06NodeID\x12\x1c\n" + + "\tClusterID\x18\x02 \x01(\x04R\tClusterIDB%Z#go.etcd.io/etcd/api/v3/etcdserverpb" var ( - ErrInvalidLengthEtcdserver = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowEtcdserver = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupEtcdserver = fmt.Errorf("proto: unexpected end of group") + file_etcdserver_proto_rawDescOnce sync.Once + file_etcdserver_proto_rawDescData []byte ) + +func file_etcdserver_proto_rawDescGZIP() []byte { + file_etcdserver_proto_rawDescOnce.Do(func() { + file_etcdserver_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_etcdserver_proto_rawDesc), len(file_etcdserver_proto_rawDesc))) + }) + return file_etcdserver_proto_rawDescData +} + +var file_etcdserver_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_etcdserver_proto_goTypes = []any{ + (*Metadata)(nil), // 0: etcdserverpb.Metadata +} +var file_etcdserver_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_etcdserver_proto_init() } +func file_etcdserver_proto_init() { + if File_etcdserver_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_etcdserver_proto_rawDesc), len(file_etcdserver_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_etcdserver_proto_goTypes, + DependencyIndexes: file_etcdserver_proto_depIdxs, + MessageInfos: file_etcdserver_proto_msgTypes, + }.Build() + File_etcdserver_proto = out.File + file_etcdserver_proto_goTypes = nil + file_etcdserver_proto_depIdxs = nil +} diff --git a/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/etcdserver.proto b/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/etcdserver.proto index ff639b9c96..e824f71e5b 100644 --- a/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/etcdserver.proto +++ b/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/etcdserver.proto @@ -1,36 +1,9 @@ syntax = "proto2"; package etcdserverpb; -import "gogoproto/gogo.proto"; - option go_package = "go.etcd.io/etcd/api/v3/etcdserverpb"; -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; -option (gogoproto.goproto_getters_all) = false; - -message Request { - optional uint64 ID = 1 [(gogoproto.nullable) = false]; - optional string Method = 2 [(gogoproto.nullable) = false]; - optional string Path = 3 [(gogoproto.nullable) = false]; - optional string Val = 4 [(gogoproto.nullable) = false]; - optional bool Dir = 5 [(gogoproto.nullable) = false]; - optional string PrevValue = 6 [(gogoproto.nullable) = false]; - optional uint64 PrevIndex = 7 [(gogoproto.nullable) = false]; - optional bool PrevExist = 8 [(gogoproto.nullable) = true]; - optional int64 Expiration = 9 [(gogoproto.nullable) = false]; - optional bool Wait = 10 [(gogoproto.nullable) = false]; - optional uint64 Since = 11 [(gogoproto.nullable) = false]; - optional bool Recursive = 12 [(gogoproto.nullable) = false]; - optional bool Sorted = 13 [(gogoproto.nullable) = false]; - optional bool Quorum = 14 [(gogoproto.nullable) = false]; - optional int64 Time = 15 [(gogoproto.nullable) = false]; - optional bool Stream = 16 [(gogoproto.nullable) = false]; - optional bool Refresh = 17 [(gogoproto.nullable) = true]; -} - message Metadata { - optional uint64 NodeID = 1 [(gogoproto.nullable) = false]; - optional uint64 ClusterID = 2 [(gogoproto.nullable) = false]; + optional uint64 NodeID = 1; + optional uint64 ClusterID = 2; } diff --git a/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/raft_internal.pb.go b/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/raft_internal.pb.go index e1cd9ebecd..812183a768 100644 --- a/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/raft_internal.pb.go +++ b/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/raft_internal.pb.go @@ -1,81 +1,97 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v3.20.3 // source: raft_internal.proto package etcdserverpb import ( - fmt "fmt" - io "io" - math "math" - math_bits "math/bits" + reflect "reflect" + sync "sync" + unsafe "unsafe" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" membershippb "go.etcd.io/etcd/api/v3/membershippb" _ "go.etcd.io/etcd/api/v3/versionpb" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type RequestHeader struct { - ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` // username is a username that is associated with an auth token of gRPC connection Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` // auth_revision is a revision number of auth.authStore. It is not related to mvcc - AuthRevision uint64 `protobuf:"varint,3,opt,name=auth_revision,json=authRevision,proto3" json:"auth_revision,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + AuthRevision uint64 `protobuf:"varint,3,opt,name=auth_revision,json=authRevision,proto3" json:"auth_revision,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *RequestHeader) Reset() { *m = RequestHeader{} } -func (m *RequestHeader) String() string { return proto.CompactTextString(m) } -func (*RequestHeader) ProtoMessage() {} -func (*RequestHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_b4c9a9be0cfca103, []int{0} +func (x *RequestHeader) Reset() { + *x = RequestHeader{} + mi := &file_raft_internal_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *RequestHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *RequestHeader) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RequestHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RequestHeader.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*RequestHeader) ProtoMessage() {} + +func (x *RequestHeader) ProtoReflect() protoreflect.Message { + mi := &file_raft_internal_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } + return mi.MessageOf(x) } -func (m *RequestHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestHeader.Merge(m, src) + +// Deprecated: Use RequestHeader.ProtoReflect.Descriptor instead. +func (*RequestHeader) Descriptor() ([]byte, []int) { + return file_raft_internal_proto_rawDescGZIP(), []int{0} } -func (m *RequestHeader) XXX_Size() int { - return m.Size() + +func (x *RequestHeader) GetID() uint64 { + if x != nil { + return x.ID + } + return 0 } -func (m *RequestHeader) XXX_DiscardUnknown() { - xxx_messageInfo_RequestHeader.DiscardUnknown(m) + +func (x *RequestHeader) GetUsername() string { + if x != nil { + return x.Username + } + return "" } -var xxx_messageInfo_RequestHeader proto.InternalMessageInfo +func (x *RequestHeader) GetAuthRevision() uint64 { + if x != nil { + return x.AuthRevision + } + return 0 +} // An InternalRaftRequest is the union of all requests which can be // sent via raft. type InternalRaftRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` Header *RequestHeader `protobuf:"bytes,100,opt,name=header,proto3" json:"header,omitempty"` ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - V2 *Request `protobuf:"bytes,2,opt,name=v2,proto3" json:"v2,omitempty"` Range *RangeRequest `protobuf:"bytes,3,opt,name=range,proto3" json:"range,omitempty"` Put *PutRequest `protobuf:"bytes,4,opt,name=put,proto3" json:"put,omitempty"` DeleteRange *DeleteRangeRequest `protobuf:"bytes,5,opt,name=delete_range,json=deleteRange,proto3" json:"delete_range,omitempty"` @@ -106,2632 +122,529 @@ type InternalRaftRequest struct { ClusterMemberAttrSet *membershippb.ClusterMemberAttrSetRequest `protobuf:"bytes,1301,opt,name=cluster_member_attr_set,json=clusterMemberAttrSet,proto3" json:"cluster_member_attr_set,omitempty"` DowngradeInfoSet *membershippb.DowngradeInfoSetRequest `protobuf:"bytes,1302,opt,name=downgrade_info_set,json=downgradeInfoSet,proto3" json:"downgrade_info_set,omitempty"` DowngradeVersionTest *DowngradeVersionTestRequest `protobuf:"bytes,9900,opt,name=downgrade_version_test,json=downgradeVersionTest,proto3" json:"downgrade_version_test,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *InternalRaftRequest) Reset() { *m = InternalRaftRequest{} } -func (m *InternalRaftRequest) String() string { return proto.CompactTextString(m) } -func (*InternalRaftRequest) ProtoMessage() {} -func (*InternalRaftRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b4c9a9be0cfca103, []int{1} +func (x *InternalRaftRequest) Reset() { + *x = InternalRaftRequest{} + mi := &file_raft_internal_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *InternalRaftRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *InternalRaftRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *InternalRaftRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_InternalRaftRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*InternalRaftRequest) ProtoMessage() {} + +func (x *InternalRaftRequest) ProtoReflect() protoreflect.Message { + mi := &file_raft_internal_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } + return mi.MessageOf(x) } -func (m *InternalRaftRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_InternalRaftRequest.Merge(m, src) -} -func (m *InternalRaftRequest) XXX_Size() int { - return m.Size() -} -func (m *InternalRaftRequest) XXX_DiscardUnknown() { - xxx_messageInfo_InternalRaftRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_InternalRaftRequest proto.InternalMessageInfo -type EmptyResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Deprecated: Use InternalRaftRequest.ProtoReflect.Descriptor instead. +func (*InternalRaftRequest) Descriptor() ([]byte, []int) { + return file_raft_internal_proto_rawDescGZIP(), []int{1} } -func (m *EmptyResponse) Reset() { *m = EmptyResponse{} } -func (m *EmptyResponse) String() string { return proto.CompactTextString(m) } -func (*EmptyResponse) ProtoMessage() {} -func (*EmptyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b4c9a9be0cfca103, []int{2} -} -func (m *EmptyResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EmptyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EmptyResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *InternalRaftRequest) GetHeader() *RequestHeader { + if x != nil { + return x.Header } -} -func (m *EmptyResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_EmptyResponse.Merge(m, src) -} -func (m *EmptyResponse) XXX_Size() int { - return m.Size() -} -func (m *EmptyResponse) XXX_DiscardUnknown() { - xxx_messageInfo_EmptyResponse.DiscardUnknown(m) + return nil } -var xxx_messageInfo_EmptyResponse proto.InternalMessageInfo - -// What is the difference between AuthenticateRequest (defined in rpc.proto) and InternalAuthenticateRequest? -// InternalAuthenticateRequest has a member that is filled by etcdserver and shouldn't be user-facing. -// For avoiding misusage the field, we have an internal version of AuthenticateRequest. -type InternalAuthenticateRequest struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` - // simple_token is generated in API layer (etcdserver/v3_server.go) - SimpleToken string `protobuf:"bytes,3,opt,name=simple_token,json=simpleToken,proto3" json:"simple_token,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *InternalRaftRequest) GetID() uint64 { + if x != nil { + return x.ID + } + return 0 } -func (m *InternalAuthenticateRequest) Reset() { *m = InternalAuthenticateRequest{} } -func (m *InternalAuthenticateRequest) String() string { return proto.CompactTextString(m) } -func (*InternalAuthenticateRequest) ProtoMessage() {} -func (*InternalAuthenticateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b4c9a9be0cfca103, []int{3} -} -func (m *InternalAuthenticateRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *InternalAuthenticateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_InternalAuthenticateRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *InternalRaftRequest) GetRange() *RangeRequest { + if x != nil { + return x.Range } + return nil } -func (m *InternalAuthenticateRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_InternalAuthenticateRequest.Merge(m, src) -} -func (m *InternalAuthenticateRequest) XXX_Size() int { - return m.Size() -} -func (m *InternalAuthenticateRequest) XXX_DiscardUnknown() { - xxx_messageInfo_InternalAuthenticateRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_InternalAuthenticateRequest proto.InternalMessageInfo -func init() { - proto.RegisterType((*RequestHeader)(nil), "etcdserverpb.RequestHeader") - proto.RegisterType((*InternalRaftRequest)(nil), "etcdserverpb.InternalRaftRequest") - proto.RegisterType((*EmptyResponse)(nil), "etcdserverpb.EmptyResponse") - proto.RegisterType((*InternalAuthenticateRequest)(nil), "etcdserverpb.InternalAuthenticateRequest") +func (x *InternalRaftRequest) GetPut() *PutRequest { + if x != nil { + return x.Put + } + return nil } -func init() { proto.RegisterFile("raft_internal.proto", fileDescriptor_b4c9a9be0cfca103) } - -var fileDescriptor_b4c9a9be0cfca103 = []byte{ - // 1101 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x56, 0xcb, 0x72, 0x1b, 0x45, - 0x14, 0x8d, 0x6c, 0xc7, 0xb6, 0x5a, 0xb6, 0xe3, 0xb4, 0x9d, 0xa4, 0xb1, 0xab, 0x8c, 0xe3, 0x90, - 0x60, 0x20, 0xc8, 0xc1, 0x06, 0xaa, 0x60, 0x03, 0x8a, 0xe5, 0x72, 0x4c, 0x25, 0x29, 0xd7, 0xc4, - 0x50, 0x29, 0x28, 0x6a, 0x68, 0xcd, 0x5c, 0x4b, 0x13, 0x8f, 0x66, 0x86, 0xee, 0x96, 0xe2, 0x6c, - 0x59, 0xb2, 0x06, 0x8a, 0x8f, 0x60, 0xc1, 0x2b, 0xff, 0x90, 0x05, 0x8f, 0x00, 0x3f, 0x00, 0x66, - 0xc3, 0x1e, 0xd8, 0xa7, 0xfa, 0x31, 0x2f, 0xa9, 0xe5, 0xdd, 0xe8, 0xde, 0x73, 0xcf, 0x39, 0xdd, - 0x7d, 0xbb, 0x75, 0xd1, 0x02, 0xa3, 0x87, 0xc2, 0x0d, 0x22, 0x01, 0x2c, 0xa2, 0x61, 0x3d, 0x61, - 0xb1, 0x88, 0xf1, 0x0c, 0x08, 0xcf, 0xe7, 0xc0, 0xfa, 0xc0, 0x92, 0xd6, 0xd2, 0x62, 0x3b, 0x6e, - 0xc7, 0x2a, 0xb1, 0x21, 0xbf, 0x34, 0x66, 0x69, 0x3e, 0xc7, 0x98, 0x48, 0x95, 0x25, 0x9e, 0xf9, - 0x5c, 0x95, 0xc9, 0x0d, 0x9a, 0x04, 0x1b, 0x7d, 0x60, 0x3c, 0x88, 0xa3, 0xa4, 0x95, 0x7e, 0x19, - 0xc4, 0xb5, 0x0c, 0xd1, 0x85, 0x6e, 0x0b, 0x18, 0xef, 0x04, 0x49, 0xd2, 0x2a, 0xfc, 0xd0, 0xb8, - 0x35, 0x86, 0x66, 0x1d, 0xf8, 0xb4, 0x07, 0x5c, 0xdc, 0x02, 0xea, 0x03, 0xc3, 0x73, 0x68, 0x6c, - 0xaf, 0x49, 0x2a, 0xab, 0x95, 0xf5, 0x09, 0x67, 0x6c, 0xaf, 0x89, 0x97, 0xd0, 0x74, 0x8f, 0x4b, - 0xf3, 0x5d, 0x20, 0x63, 0xab, 0x95, 0xf5, 0xaa, 0x93, 0xfd, 0xc6, 0xd7, 0xd1, 0x2c, 0xed, 0x89, - 0x8e, 0xcb, 0xa0, 0x1f, 0x48, 0x6d, 0x32, 0x2e, 0xcb, 0x6e, 0x4e, 0x7d, 0xfe, 0x98, 0x8c, 0x6f, - 0xd5, 0x5f, 0x73, 0x66, 0x64, 0xd6, 0x31, 0xc9, 0xb7, 0xa7, 0x3e, 0x53, 0xe1, 0x1b, 0x6b, 0x8f, - 0x17, 0xd0, 0xc2, 0x9e, 0xd9, 0x11, 0x87, 0x1e, 0x0a, 0x63, 0x00, 0x6f, 0xa1, 0xc9, 0x8e, 0x32, - 0x41, 0xfc, 0xd5, 0xca, 0x7a, 0x6d, 0x73, 0xb9, 0x5e, 0xdc, 0xa7, 0x7a, 0xc9, 0xa7, 0x63, 0xa0, - 0x43, 0x7e, 0xaf, 0xa2, 0xb1, 0xfe, 0xa6, 0x72, 0x5a, 0xdb, 0xbc, 0x60, 0x25, 0x70, 0xc6, 0xfa, - 0x9b, 0xf8, 0x06, 0x3a, 0xcb, 0x68, 0xd4, 0x06, 0x65, 0xb9, 0xb6, 0xb9, 0x34, 0x80, 0x94, 0xa9, - 0x14, 0xae, 0x81, 0xf8, 0x65, 0x34, 0x9e, 0xf4, 0x04, 0x99, 0x50, 0x78, 0x52, 0xc6, 0xef, 0xf7, - 0xd2, 0x45, 0x38, 0x12, 0x84, 0xb7, 0xd1, 0x8c, 0x0f, 0x21, 0x08, 0x70, 0xb5, 0xc8, 0x59, 0x55, - 0xb4, 0x5a, 0x2e, 0x6a, 0x2a, 0x44, 0x49, 0xaa, 0xe6, 0xe7, 0x31, 0x29, 0x28, 0x8e, 0x23, 0x32, - 0x69, 0x13, 0x3c, 0x38, 0x8e, 0x32, 0x41, 0x71, 0x1c, 0xe1, 0x77, 0x10, 0xf2, 0xe2, 0x6e, 0x42, - 0x3d, 0x21, 0x8f, 0x61, 0x4a, 0x95, 0x3c, 0x5f, 0x2e, 0xd9, 0xce, 0xf2, 0x69, 0x65, 0xa1, 0x04, - 0xbf, 0x8b, 0x6a, 0x21, 0x50, 0x0e, 0x6e, 0x9b, 0xd1, 0x48, 0x90, 0x69, 0x1b, 0xc3, 0x6d, 0x09, - 0xd8, 0x95, 0xf9, 0x8c, 0x21, 0xcc, 0x42, 0x72, 0xcd, 0x9a, 0x81, 0x41, 0x3f, 0x3e, 0x02, 0x52, - 0xb5, 0xad, 0x59, 0x51, 0x38, 0x0a, 0x90, 0xad, 0x39, 0xcc, 0x63, 0xf2, 0x58, 0x68, 0x48, 0x59, - 0x97, 0x20, 0xdb, 0xb1, 0x34, 0x64, 0x2a, 0x3b, 0x16, 0x05, 0xc4, 0xf7, 0xd1, 0xbc, 0x96, 0xf5, - 0x3a, 0xe0, 0x1d, 0x25, 0x71, 0x10, 0x09, 0x52, 0x53, 0xc5, 0x2f, 0x58, 0xa4, 0xb7, 0x33, 0x90, - 0xa1, 0x49, 0x9b, 0xf5, 0x75, 0xe7, 0x5c, 0x58, 0x06, 0xe0, 0x06, 0xaa, 0xa9, 0xee, 0x86, 0x88, - 0xb6, 0x42, 0x20, 0xff, 0x58, 0x77, 0xb5, 0xd1, 0x13, 0x9d, 0x1d, 0x05, 0xc8, 0xf6, 0x84, 0x66, - 0x21, 0xdc, 0x44, 0xea, 0x0a, 0xb8, 0x7e, 0xc0, 0x15, 0xc7, 0xbf, 0x53, 0xb6, 0x4d, 0x91, 0x1c, - 0x4d, 0x8d, 0xc8, 0x36, 0x85, 0xe6, 0x31, 0xfc, 0x9e, 0x31, 0xc2, 0x05, 0x15, 0x3d, 0x4e, 0xfe, - 0x1f, 0x69, 0xe4, 0x9e, 0x02, 0x0c, 0xac, 0xec, 0x0d, 0xed, 0x48, 0xe7, 0xf0, 0x5d, 0xed, 0x08, - 0x22, 0x11, 0x78, 0x54, 0x00, 0xf9, 0x4f, 0x93, 0xbd, 0x54, 0x26, 0x4b, 0x6f, 0x67, 0xa3, 0x00, - 0x4d, 0xad, 0x95, 0xea, 0xf1, 0x8e, 0x79, 0x02, 0xe4, 0x9b, 0xe0, 0x52, 0xdf, 0x27, 0x3f, 0x4d, - 0x8f, 0x5a, 0xe2, 0xfb, 0x1c, 0x58, 0xc3, 0xf7, 0x4b, 0x4b, 0x34, 0x31, 0x7c, 0x17, 0xcd, 0xe7, - 0x34, 0xfa, 0x12, 0x90, 0x9f, 0x35, 0xd3, 0x15, 0x3b, 0x93, 0xb9, 0x3d, 0x86, 0x6c, 0x8e, 0x96, - 0xc2, 0x65, 0x5b, 0x6d, 0x10, 0xe4, 0x97, 0x53, 0x6d, 0xed, 0x82, 0x18, 0xb2, 0xb5, 0x0b, 0x02, - 0xb7, 0xd1, 0x73, 0x39, 0x8d, 0xd7, 0x91, 0xd7, 0xd2, 0x4d, 0x28, 0xe7, 0x0f, 0x63, 0xe6, 0x93, - 0x5f, 0x35, 0xe5, 0x2b, 0x76, 0xca, 0x6d, 0x85, 0xde, 0x37, 0xe0, 0x94, 0xfd, 0x22, 0xb5, 0xa6, - 0xf1, 0x7d, 0xb4, 0x58, 0xf0, 0x2b, 0xef, 0x93, 0xcb, 0xe2, 0x10, 0xc8, 0x53, 0xad, 0x71, 0x6d, - 0x84, 0x6d, 0x75, 0x17, 0xe3, 0xbc, 0x6d, 0xce, 0xd3, 0xc1, 0x0c, 0xfe, 0x08, 0x5d, 0xc8, 0x99, - 0xf5, 0xd5, 0xd4, 0xd4, 0xbf, 0x69, 0xea, 0x17, 0xed, 0xd4, 0xe6, 0x8e, 0x16, 0xb8, 0x31, 0x1d, - 0x4a, 0xe1, 0x5b, 0x68, 0x2e, 0x27, 0x0f, 0x03, 0x2e, 0xc8, 0xef, 0x9a, 0xf5, 0xb2, 0x9d, 0xf5, - 0x76, 0xc0, 0x45, 0xa9, 0x8f, 0xd2, 0x60, 0xc6, 0x24, 0xad, 0x69, 0xa6, 0x3f, 0x46, 0x32, 0x49, - 0xe9, 0x21, 0xa6, 0x34, 0x98, 0x1d, 0xbd, 0x62, 0x92, 0x1d, 0xf9, 0x6d, 0x75, 0xd4, 0xd1, 0xcb, - 0x9a, 0xc1, 0x8e, 0x34, 0xb1, 0xac, 0x23, 0x15, 0x8d, 0xe9, 0xc8, 0xef, 0xaa, 0xa3, 0x3a, 0x52, - 0x56, 0x59, 0x3a, 0x32, 0x0f, 0x97, 0x6d, 0xc9, 0x8e, 0xfc, 0xfe, 0x54, 0x5b, 0x83, 0x1d, 0x69, - 0x62, 0xf8, 0x01, 0x5a, 0x2a, 0xd0, 0xa8, 0x46, 0x49, 0x80, 0x75, 0x03, 0xae, 0xfe, 0x7f, 0x7f, - 0xd0, 0x9c, 0xd7, 0x47, 0x70, 0x4a, 0xf8, 0x7e, 0x86, 0x4e, 0xf9, 0x2f, 0x51, 0x7b, 0x1e, 0x77, - 0xd1, 0x72, 0xae, 0x65, 0x5a, 0xa7, 0x20, 0xf6, 0xa3, 0x16, 0x7b, 0xd5, 0x2e, 0xa6, 0xbb, 0x64, - 0x58, 0x8d, 0xd0, 0x11, 0x00, 0xfc, 0x09, 0x5a, 0xf0, 0xc2, 0x1e, 0x17, 0xc0, 0x5c, 0x33, 0xcb, - 0xb8, 0x1c, 0x04, 0xf9, 0x02, 0x99, 0x2b, 0x50, 0x1c, 0x64, 0xea, 0xdb, 0x1a, 0xf9, 0x81, 0x06, - 0xde, 0x03, 0x31, 0xf4, 0xea, 0x9d, 0xf7, 0x06, 0x21, 0xf8, 0x01, 0xba, 0x94, 0x2a, 0x68, 0x32, - 0x97, 0x0a, 0xc1, 0x94, 0xca, 0x97, 0xc8, 0xbc, 0x83, 0x36, 0x95, 0x3b, 0x2a, 0xd6, 0x10, 0x82, - 0xd9, 0x84, 0x16, 0x3d, 0x0b, 0x0a, 0x7f, 0x8c, 0xb0, 0x1f, 0x3f, 0x8c, 0xda, 0x8c, 0xfa, 0xe0, - 0x06, 0xd1, 0x61, 0xac, 0x64, 0xbe, 0xd2, 0x32, 0x57, 0xcb, 0x32, 0xcd, 0x14, 0xb8, 0x17, 0x1d, - 0xc6, 0x36, 0x89, 0x79, 0x7f, 0x00, 0x81, 0x03, 0x74, 0x31, 0xa7, 0x4f, 0xb7, 0x4b, 0x00, 0x17, - 0xe4, 0x9b, 0x3b, 0xb6, 0x17, 0x3d, 0x93, 0x30, 0xdb, 0x71, 0x00, 0x7c, 0x50, 0xe6, 0x4d, 0x67, - 0xd1, 0xb7, 0xa0, 0xf2, 0xb9, 0xed, 0x1c, 0x9a, 0xdd, 0xe9, 0x26, 0xe2, 0x91, 0x03, 0x3c, 0x89, - 0x23, 0x0e, 0x6b, 0x8f, 0xd0, 0xf2, 0x29, 0xff, 0x14, 0x18, 0xa3, 0x09, 0x35, 0x36, 0x56, 0xd4, - 0xd8, 0xa8, 0xbe, 0xe5, 0x38, 0x99, 0x3d, 0xa0, 0x66, 0x9c, 0x4c, 0x7f, 0xe3, 0xcb, 0x68, 0x86, - 0x07, 0xdd, 0x24, 0x04, 0x57, 0xc4, 0x47, 0xa0, 0xa7, 0xc9, 0xaa, 0x53, 0xd3, 0xb1, 0x03, 0x19, - 0xca, 0xbc, 0xdc, 0x7c, 0xeb, 0xc9, 0x5f, 0x2b, 0x67, 0x9e, 0x9c, 0xac, 0x54, 0x9e, 0x9e, 0xac, - 0x54, 0xfe, 0x3c, 0x59, 0xa9, 0x7c, 0xfd, 0xf7, 0xca, 0x99, 0x0f, 0xaf, 0xb4, 0x63, 0xb5, 0xec, - 0x7a, 0x10, 0x6f, 0xe4, 0x23, 0xf2, 0xd6, 0x46, 0x71, 0x2b, 0x5a, 0x93, 0x6a, 0xf2, 0xdd, 0x7a, - 0x16, 0x00, 0x00, 0xff, 0xff, 0xb2, 0xa0, 0x15, 0x1f, 0x9b, 0x0b, 0x00, 0x00, +func (x *InternalRaftRequest) GetDeleteRange() *DeleteRangeRequest { + if x != nil { + return x.DeleteRange + } + return nil } -func (m *RequestHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *InternalRaftRequest) GetTxn() *TxnRequest { + if x != nil { + return x.Txn } - return dAtA[:n], nil + return nil } -func (m *RequestHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (x *InternalRaftRequest) GetCompaction() *CompactionRequest { + if x != nil { + return x.Compaction + } + return nil } -func (m *RequestHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.AuthRevision != 0 { - i = encodeVarintRaftInternal(dAtA, i, uint64(m.AuthRevision)) - i-- - dAtA[i] = 0x18 +func (x *InternalRaftRequest) GetLeaseGrant() *LeaseGrantRequest { + if x != nil { + return x.LeaseGrant } - if len(m.Username) > 0 { - i -= len(m.Username) - copy(dAtA[i:], m.Username) - i = encodeVarintRaftInternal(dAtA, i, uint64(len(m.Username))) - i-- - dAtA[i] = 0x12 - } - if m.ID != 0 { - i = encodeVarintRaftInternal(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil + return nil } -func (m *InternalRaftRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *InternalRaftRequest) GetLeaseRevoke() *LeaseRevokeRequest { + if x != nil { + return x.LeaseRevoke } - return dAtA[:n], nil + return nil } -func (m *InternalRaftRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (x *InternalRaftRequest) GetAlarm() *AlarmRequest { + if x != nil { + return x.Alarm + } + return nil } -func (m *InternalRaftRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.DowngradeVersionTest != nil { - { - size, err := m.DowngradeVersionTest.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4 - i-- - dAtA[i] = 0xea - i-- - dAtA[i] = 0xe2 - } - if m.DowngradeInfoSet != nil { - { - size, err := m.DowngradeInfoSet.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x51 - i-- - dAtA[i] = 0xb2 - } - if m.ClusterMemberAttrSet != nil { - { - size, err := m.ClusterMemberAttrSet.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x51 - i-- - dAtA[i] = 0xaa - } - if m.ClusterVersionSet != nil { - { - size, err := m.ClusterVersionSet.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x51 - i-- - dAtA[i] = 0xa2 - } - if m.AuthRoleRevokePermission != nil { - { - size, err := m.AuthRoleRevokePermission.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4b - i-- - dAtA[i] = 0xa2 - } - if m.AuthRoleGrantPermission != nil { - { - size, err := m.AuthRoleGrantPermission.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4b - i-- - dAtA[i] = 0x9a - } - if m.AuthRoleGet != nil { - { - size, err := m.AuthRoleGet.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4b - i-- - dAtA[i] = 0x92 - } - if m.AuthRoleDelete != nil { - { - size, err := m.AuthRoleDelete.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4b - i-- - dAtA[i] = 0x8a - } - if m.AuthRoleAdd != nil { - { - size, err := m.AuthRoleAdd.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4b - i-- - dAtA[i] = 0x82 - } - if m.AuthRoleList != nil { - { - size, err := m.AuthRoleList.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x45 - i-- - dAtA[i] = 0x9a - } - if m.AuthUserList != nil { - { - size, err := m.AuthUserList.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x45 - i-- - dAtA[i] = 0x92 - } - if m.AuthUserRevokeRole != nil { - { - size, err := m.AuthUserRevokeRole.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x45 - i-- - dAtA[i] = 0x8a - } - if m.AuthUserGrantRole != nil { - { - size, err := m.AuthUserGrantRole.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x45 - i-- - dAtA[i] = 0x82 - } - if m.AuthUserChangePassword != nil { - { - size, err := m.AuthUserChangePassword.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x44 - i-- - dAtA[i] = 0xfa - } - if m.AuthUserGet != nil { - { - size, err := m.AuthUserGet.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x44 - i-- - dAtA[i] = 0xf2 - } - if m.AuthUserDelete != nil { - { - size, err := m.AuthUserDelete.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x44 - i-- - dAtA[i] = 0xea - } - if m.AuthUserAdd != nil { - { - size, err := m.AuthUserAdd.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x44 - i-- - dAtA[i] = 0xe2 - } - if m.AuthStatus != nil { - { - size, err := m.AuthStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3f - i-- - dAtA[i] = 0xaa - } - if m.Authenticate != nil { - { - size, err := m.Authenticate.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3f - i-- - dAtA[i] = 0xa2 - } - if m.AuthDisable != nil { - { - size, err := m.AuthDisable.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3f - i-- - dAtA[i] = 0x9a - } - if m.AuthEnable != nil { - { - size, err := m.AuthEnable.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3e - i-- - dAtA[i] = 0xc2 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0xa2 - } - if m.LeaseCheckpoint != nil { - { - size, err := m.LeaseCheckpoint.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x5a - } - if m.Alarm != nil { - { - size, err := m.Alarm.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x52 - } - if m.LeaseRevoke != nil { - { - size, err := m.LeaseRevoke.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - } - if m.LeaseGrant != nil { - { - size, err := m.LeaseGrant.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } - if m.Compaction != nil { - { - size, err := m.Compaction.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - if m.Txn != nil { - { - size, err := m.Txn.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - if m.DeleteRange != nil { - { - size, err := m.DeleteRange.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if m.Put != nil { - { - size, err := m.Put.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.Range != nil { - { - size, err := m.Range.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.V2 != nil { - { - size, err := m.V2.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRaftInternal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.ID != 0 { - i = encodeVarintRaftInternal(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x8 +func (x *InternalRaftRequest) GetLeaseCheckpoint() *LeaseCheckpointRequest { + if x != nil { + return x.LeaseCheckpoint } - return len(dAtA) - i, nil + return nil } -func (m *EmptyResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *InternalRaftRequest) GetAuthEnable() *AuthEnableRequest { + if x != nil { + return x.AuthEnable } - return dAtA[:n], nil + return nil } -func (m *EmptyResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (x *InternalRaftRequest) GetAuthDisable() *AuthDisableRequest { + if x != nil { + return x.AuthDisable + } + return nil } -func (m *EmptyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) +func (x *InternalRaftRequest) GetAuthStatus() *AuthStatusRequest { + if x != nil { + return x.AuthStatus } - return len(dAtA) - i, nil + return nil } -func (m *InternalAuthenticateRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *InternalRaftRequest) GetAuthenticate() *InternalAuthenticateRequest { + if x != nil { + return x.Authenticate } - return dAtA[:n], nil + return nil } -func (m *InternalAuthenticateRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (x *InternalRaftRequest) GetAuthUserAdd() *AuthUserAddRequest { + if x != nil { + return x.AuthUserAdd + } + return nil } -func (m *InternalAuthenticateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) +func (x *InternalRaftRequest) GetAuthUserDelete() *AuthUserDeleteRequest { + if x != nil { + return x.AuthUserDelete } - if len(m.SimpleToken) > 0 { - i -= len(m.SimpleToken) - copy(dAtA[i:], m.SimpleToken) - i = encodeVarintRaftInternal(dAtA, i, uint64(len(m.SimpleToken))) - i-- - dAtA[i] = 0x1a - } - if len(m.Password) > 0 { - i -= len(m.Password) - copy(dAtA[i:], m.Password) - i = encodeVarintRaftInternal(dAtA, i, uint64(len(m.Password))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintRaftInternal(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil + return nil } -func encodeVarintRaftInternal(dAtA []byte, offset int, v uint64) int { - offset -= sovRaftInternal(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (x *InternalRaftRequest) GetAuthUserGet() *AuthUserGetRequest { + if x != nil { + return x.AuthUserGet } - dAtA[offset] = uint8(v) - return base + return nil } -func (m *RequestHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ID != 0 { - n += 1 + sovRaftInternal(uint64(m.ID)) - } - l = len(m.Username) - if l > 0 { - n += 1 + l + sovRaftInternal(uint64(l)) - } - if m.AuthRevision != 0 { - n += 1 + sovRaftInternal(uint64(m.AuthRevision)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) + +func (x *InternalRaftRequest) GetAuthUserChangePassword() *AuthUserChangePasswordRequest { + if x != nil { + return x.AuthUserChangePassword } - return n + return nil } -func (m *InternalRaftRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ID != 0 { - n += 1 + sovRaftInternal(uint64(m.ID)) - } - if m.V2 != nil { - l = m.V2.Size() - n += 1 + l + sovRaftInternal(uint64(l)) - } - if m.Range != nil { - l = m.Range.Size() - n += 1 + l + sovRaftInternal(uint64(l)) - } - if m.Put != nil { - l = m.Put.Size() - n += 1 + l + sovRaftInternal(uint64(l)) - } - if m.DeleteRange != nil { - l = m.DeleteRange.Size() - n += 1 + l + sovRaftInternal(uint64(l)) - } - if m.Txn != nil { - l = m.Txn.Size() - n += 1 + l + sovRaftInternal(uint64(l)) - } - if m.Compaction != nil { - l = m.Compaction.Size() - n += 1 + l + sovRaftInternal(uint64(l)) - } - if m.LeaseGrant != nil { - l = m.LeaseGrant.Size() - n += 1 + l + sovRaftInternal(uint64(l)) - } - if m.LeaseRevoke != nil { - l = m.LeaseRevoke.Size() - n += 1 + l + sovRaftInternal(uint64(l)) - } - if m.Alarm != nil { - l = m.Alarm.Size() - n += 1 + l + sovRaftInternal(uint64(l)) - } - if m.LeaseCheckpoint != nil { - l = m.LeaseCheckpoint.Size() - n += 1 + l + sovRaftInternal(uint64(l)) - } - if m.Header != nil { - l = m.Header.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.AuthEnable != nil { - l = m.AuthEnable.Size() - n += 2 + l + sovRaftInternal(uint64(l)) +func (x *InternalRaftRequest) GetAuthUserGrantRole() *AuthUserGrantRoleRequest { + if x != nil { + return x.AuthUserGrantRole } - if m.AuthDisable != nil { - l = m.AuthDisable.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.Authenticate != nil { - l = m.Authenticate.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.AuthStatus != nil { - l = m.AuthStatus.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.AuthUserAdd != nil { - l = m.AuthUserAdd.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.AuthUserDelete != nil { - l = m.AuthUserDelete.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.AuthUserGet != nil { - l = m.AuthUserGet.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.AuthUserChangePassword != nil { - l = m.AuthUserChangePassword.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.AuthUserGrantRole != nil { - l = m.AuthUserGrantRole.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.AuthUserRevokeRole != nil { - l = m.AuthUserRevokeRole.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.AuthUserList != nil { - l = m.AuthUserList.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.AuthRoleList != nil { - l = m.AuthRoleList.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.AuthRoleAdd != nil { - l = m.AuthRoleAdd.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.AuthRoleDelete != nil { - l = m.AuthRoleDelete.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.AuthRoleGet != nil { - l = m.AuthRoleGet.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.AuthRoleGrantPermission != nil { - l = m.AuthRoleGrantPermission.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.AuthRoleRevokePermission != nil { - l = m.AuthRoleRevokePermission.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.ClusterVersionSet != nil { - l = m.ClusterVersionSet.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.ClusterMemberAttrSet != nil { - l = m.ClusterMemberAttrSet.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.DowngradeInfoSet != nil { - l = m.DowngradeInfoSet.Size() - n += 2 + l + sovRaftInternal(uint64(l)) - } - if m.DowngradeVersionTest != nil { - l = m.DowngradeVersionTest.Size() - n += 3 + l + sovRaftInternal(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n + return nil } -func (m *EmptyResponse) Size() (n int) { - if m == nil { - return 0 +func (x *InternalRaftRequest) GetAuthUserRevokeRole() *AuthUserRevokeRoleRequest { + if x != nil { + return x.AuthUserRevokeRole } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n + return nil } -func (m *InternalAuthenticateRequest) Size() (n int) { - if m == nil { - return 0 +func (x *InternalRaftRequest) GetAuthUserList() *AuthUserListRequest { + if x != nil { + return x.AuthUserList } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovRaftInternal(uint64(l)) - } - l = len(m.Password) - if l > 0 { - n += 1 + l + sovRaftInternal(uint64(l)) - } - l = len(m.SimpleToken) - if l > 0 { - n += 1 + l + sovRaftInternal(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n + return nil } -func sovRaftInternal(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +func (x *InternalRaftRequest) GetAuthRoleList() *AuthRoleListRequest { + if x != nil { + return x.AuthRoleList + } + return nil } -func sozRaftInternal(x uint64) (n int) { - return sovRaftInternal(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + +func (x *InternalRaftRequest) GetAuthRoleAdd() *AuthRoleAddRequest { + if x != nil { + return x.AuthRoleAdd + } + return nil } -func (m *RequestHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RequestHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RequestHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Username", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Username = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthRevision", wireType) - } - m.AuthRevision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AuthRevision |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRaftInternal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRaftInternal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } + +func (x *InternalRaftRequest) GetAuthRoleDelete() *AuthRoleDeleteRequest { + if x != nil { + return x.AuthRoleDelete } + return nil +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *InternalRaftRequest) GetAuthRoleGet() *AuthRoleGetRequest { + if x != nil { + return x.AuthRoleGet } return nil } -func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: InternalRaftRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: InternalRaftRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field V2", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.V2 == nil { - m.V2 = &Request{} - } - if err := m.V2.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Range == nil { - m.Range = &RangeRequest{} - } - if err := m.Range.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Put", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Put == nil { - m.Put = &PutRequest{} - } - if err := m.Put.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DeleteRange", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DeleteRange == nil { - m.DeleteRange = &DeleteRangeRequest{} - } - if err := m.DeleteRange.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Txn", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Txn == nil { - m.Txn = &TxnRequest{} - } - if err := m.Txn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Compaction", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Compaction == nil { - m.Compaction = &CompactionRequest{} - } - if err := m.Compaction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LeaseGrant", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.LeaseGrant == nil { - m.LeaseGrant = &LeaseGrantRequest{} - } - if err := m.LeaseGrant.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LeaseRevoke", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.LeaseRevoke == nil { - m.LeaseRevoke = &LeaseRevokeRequest{} - } - if err := m.LeaseRevoke.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Alarm", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Alarm == nil { - m.Alarm = &AlarmRequest{} - } - if err := m.Alarm.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LeaseCheckpoint", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.LeaseCheckpoint == nil { - m.LeaseCheckpoint = &LeaseCheckpointRequest{} - } - if err := m.LeaseCheckpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 100: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &RequestHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1000: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthEnable", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AuthEnable == nil { - m.AuthEnable = &AuthEnableRequest{} - } - if err := m.AuthEnable.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1011: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthDisable", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AuthDisable == nil { - m.AuthDisable = &AuthDisableRequest{} - } - if err := m.AuthDisable.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1012: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authenticate", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Authenticate == nil { - m.Authenticate = &InternalAuthenticateRequest{} - } - if err := m.Authenticate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1013: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AuthStatus == nil { - m.AuthStatus = &AuthStatusRequest{} - } - if err := m.AuthStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1100: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthUserAdd", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AuthUserAdd == nil { - m.AuthUserAdd = &AuthUserAddRequest{} - } - if err := m.AuthUserAdd.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1101: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthUserDelete", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AuthUserDelete == nil { - m.AuthUserDelete = &AuthUserDeleteRequest{} - } - if err := m.AuthUserDelete.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1102: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthUserGet", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AuthUserGet == nil { - m.AuthUserGet = &AuthUserGetRequest{} - } - if err := m.AuthUserGet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1103: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthUserChangePassword", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AuthUserChangePassword == nil { - m.AuthUserChangePassword = &AuthUserChangePasswordRequest{} - } - if err := m.AuthUserChangePassword.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1104: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthUserGrantRole", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AuthUserGrantRole == nil { - m.AuthUserGrantRole = &AuthUserGrantRoleRequest{} - } - if err := m.AuthUserGrantRole.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1105: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthUserRevokeRole", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AuthUserRevokeRole == nil { - m.AuthUserRevokeRole = &AuthUserRevokeRoleRequest{} - } - if err := m.AuthUserRevokeRole.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1106: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthUserList", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AuthUserList == nil { - m.AuthUserList = &AuthUserListRequest{} - } - if err := m.AuthUserList.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1107: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthRoleList", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AuthRoleList == nil { - m.AuthRoleList = &AuthRoleListRequest{} - } - if err := m.AuthRoleList.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1200: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthRoleAdd", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AuthRoleAdd == nil { - m.AuthRoleAdd = &AuthRoleAddRequest{} - } - if err := m.AuthRoleAdd.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1201: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthRoleDelete", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AuthRoleDelete == nil { - m.AuthRoleDelete = &AuthRoleDeleteRequest{} - } - if err := m.AuthRoleDelete.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1202: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthRoleGet", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AuthRoleGet == nil { - m.AuthRoleGet = &AuthRoleGetRequest{} - } - if err := m.AuthRoleGet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1203: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthRoleGrantPermission", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AuthRoleGrantPermission == nil { - m.AuthRoleGrantPermission = &AuthRoleGrantPermissionRequest{} - } - if err := m.AuthRoleGrantPermission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1204: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthRoleRevokePermission", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AuthRoleRevokePermission == nil { - m.AuthRoleRevokePermission = &AuthRoleRevokePermissionRequest{} - } - if err := m.AuthRoleRevokePermission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1300: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClusterVersionSet", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ClusterVersionSet == nil { - m.ClusterVersionSet = &membershippb.ClusterVersionSetRequest{} - } - if err := m.ClusterVersionSet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1301: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClusterMemberAttrSet", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ClusterMemberAttrSet == nil { - m.ClusterMemberAttrSet = &membershippb.ClusterMemberAttrSetRequest{} - } - if err := m.ClusterMemberAttrSet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1302: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DowngradeInfoSet", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DowngradeInfoSet == nil { - m.DowngradeInfoSet = &membershippb.DowngradeInfoSetRequest{} - } - if err := m.DowngradeInfoSet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9900: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DowngradeVersionTest", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DowngradeVersionTest == nil { - m.DowngradeVersionTest = &DowngradeVersionTestRequest{} - } - if err := m.DowngradeVersionTest.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftInternal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRaftInternal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } + +func (x *InternalRaftRequest) GetAuthRoleGrantPermission() *AuthRoleGrantPermissionRequest { + if x != nil { + return x.AuthRoleGrantPermission } + return nil +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *InternalRaftRequest) GetAuthRoleRevokePermission() *AuthRoleRevokePermissionRequest { + if x != nil { + return x.AuthRoleRevokePermission } return nil } -func (m *EmptyResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EmptyResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EmptyResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRaftInternal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRaftInternal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } + +func (x *InternalRaftRequest) GetClusterVersionSet() *membershippb.ClusterVersionSetRequest { + if x != nil { + return x.ClusterVersionSet } + return nil +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *InternalRaftRequest) GetClusterMemberAttrSet() *membershippb.ClusterMemberAttrSetRequest { + if x != nil { + return x.ClusterMemberAttrSet } return nil } -func (m *InternalAuthenticateRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: InternalAuthenticateRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: InternalAuthenticateRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Password", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Password = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SimpleToken", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRaftInternal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRaftInternal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SimpleToken = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftInternal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRaftInternal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } + +func (x *InternalRaftRequest) GetDowngradeInfoSet() *membershippb.DowngradeInfoSetRequest { + if x != nil { + return x.DowngradeInfoSet } + return nil +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *InternalRaftRequest) GetDowngradeVersionTest() *DowngradeVersionTestRequest { + if x != nil { + return x.DowngradeVersionTest } return nil } -func skipRaftInternal(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRaftInternal - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthRaftInternal - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupRaftInternal - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthRaftInternal + +type EmptyResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EmptyResponse) Reset() { + *x = EmptyResponse{} + mi := &file_raft_internal_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EmptyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EmptyResponse) ProtoMessage() {} + +func (x *EmptyResponse) ProtoReflect() protoreflect.Message { + mi := &file_raft_internal_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - if depth == 0 { - return iNdEx, nil + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EmptyResponse.ProtoReflect.Descriptor instead. +func (*EmptyResponse) Descriptor() ([]byte, []int) { + return file_raft_internal_proto_rawDescGZIP(), []int{2} +} + +// What is the difference between AuthenticateRequest (defined in rpc.proto) and InternalAuthenticateRequest? +// InternalAuthenticateRequest has a member that is filled by etcdserver and shouldn't be user-facing. +// For avoiding misusage the field, we have an internal version of AuthenticateRequest. +type InternalAuthenticateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + // simple_token is generated in API layer (etcdserver/v3_server.go) + SimpleToken string `protobuf:"bytes,3,opt,name=simple_token,json=simpleToken,proto3" json:"simple_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InternalAuthenticateRequest) Reset() { + *x = InternalAuthenticateRequest{} + mi := &file_raft_internal_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InternalAuthenticateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InternalAuthenticateRequest) ProtoMessage() {} + +func (x *InternalAuthenticateRequest) ProtoReflect() protoreflect.Message { + mi := &file_raft_internal_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } + return ms } - return 0, io.ErrUnexpectedEOF + return mi.MessageOf(x) } +// Deprecated: Use InternalAuthenticateRequest.ProtoReflect.Descriptor instead. +func (*InternalAuthenticateRequest) Descriptor() ([]byte, []int) { + return file_raft_internal_proto_rawDescGZIP(), []int{3} +} + +func (x *InternalAuthenticateRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *InternalAuthenticateRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *InternalAuthenticateRequest) GetSimpleToken() string { + if x != nil { + return x.SimpleToken + } + return "" +} + +var File_raft_internal_proto protoreflect.FileDescriptor + +const file_raft_internal_proto_rawDesc = "" + + "\n" + + "\x13raft_internal.proto\x12\fetcdserverpb\x1a\trpc.proto\x1a etcd/api/versionpb/version.proto\x1a&etcd/api/membershippb/membership.proto\"r\n" + + "\rRequestHeader\x12\x0e\n" + + "\x02ID\x18\x01 \x01(\x04R\x02ID\x12\x1a\n" + + "\busername\x18\x02 \x01(\tR\busername\x12,\n" + + "\rauth_revision\x18\x03 \x01(\x04B\a\x8a\xb5\x18\x033.1R\fauthRevision:\a\x82\xb5\x18\x033.0\"\x98\x13\n" + + "\x13InternalRaftRequest\x123\n" + + "\x06header\x18d \x01(\v2\x1b.etcdserverpb.RequestHeaderR\x06header\x12\x0e\n" + + "\x02ID\x18\x01 \x01(\x04R\x02ID\x120\n" + + "\x05range\x18\x03 \x01(\v2\x1a.etcdserverpb.RangeRequestR\x05range\x12*\n" + + "\x03put\x18\x04 \x01(\v2\x18.etcdserverpb.PutRequestR\x03put\x12C\n" + + "\fdelete_range\x18\x05 \x01(\v2 .etcdserverpb.DeleteRangeRequestR\vdeleteRange\x12*\n" + + "\x03txn\x18\x06 \x01(\v2\x18.etcdserverpb.TxnRequestR\x03txn\x12?\n" + + "\n" + + "compaction\x18\a \x01(\v2\x1f.etcdserverpb.CompactionRequestR\n" + + "compaction\x12@\n" + + "\vlease_grant\x18\b \x01(\v2\x1f.etcdserverpb.LeaseGrantRequestR\n" + + "leaseGrant\x12C\n" + + "\flease_revoke\x18\t \x01(\v2 .etcdserverpb.LeaseRevokeRequestR\vleaseRevoke\x120\n" + + "\x05alarm\x18\n" + + " \x01(\v2\x1a.etcdserverpb.AlarmRequestR\x05alarm\x12X\n" + + "\x10lease_checkpoint\x18\v \x01(\v2$.etcdserverpb.LeaseCheckpointRequestB\a\x8a\xb5\x18\x033.4R\x0fleaseCheckpoint\x12A\n" + + "\vauth_enable\x18\xe8\a \x01(\v2\x1f.etcdserverpb.AuthEnableRequestR\n" + + "authEnable\x12D\n" + + "\fauth_disable\x18\xf3\a \x01(\v2 .etcdserverpb.AuthDisableRequestR\vauthDisable\x12J\n" + + "\vauth_status\x18\xf5\a \x01(\v2\x1f.etcdserverpb.AuthStatusRequestB\a\x8a\xb5\x18\x033.5R\n" + + "authStatus\x12N\n" + + "\fauthenticate\x18\xf4\a \x01(\v2).etcdserverpb.InternalAuthenticateRequestR\fauthenticate\x12E\n" + + "\rauth_user_add\x18\xcc\b \x01(\v2 .etcdserverpb.AuthUserAddRequestR\vauthUserAdd\x12N\n" + + "\x10auth_user_delete\x18\xcd\b \x01(\v2#.etcdserverpb.AuthUserDeleteRequestR\x0eauthUserDelete\x12E\n" + + "\rauth_user_get\x18\xce\b \x01(\v2 .etcdserverpb.AuthUserGetRequestR\vauthUserGet\x12g\n" + + "\x19auth_user_change_password\x18\xcf\b \x01(\v2+.etcdserverpb.AuthUserChangePasswordRequestR\x16authUserChangePassword\x12X\n" + + "\x14auth_user_grant_role\x18\xd0\b \x01(\v2&.etcdserverpb.AuthUserGrantRoleRequestR\x11authUserGrantRole\x12[\n" + + "\x15auth_user_revoke_role\x18\xd1\b \x01(\v2'.etcdserverpb.AuthUserRevokeRoleRequestR\x12authUserRevokeRole\x12H\n" + + "\x0eauth_user_list\x18\xd2\b \x01(\v2!.etcdserverpb.AuthUserListRequestR\fauthUserList\x12H\n" + + "\x0eauth_role_list\x18\xd3\b \x01(\v2!.etcdserverpb.AuthRoleListRequestR\fauthRoleList\x12E\n" + + "\rauth_role_add\x18\xb0\t \x01(\v2 .etcdserverpb.AuthRoleAddRequestR\vauthRoleAdd\x12N\n" + + "\x10auth_role_delete\x18\xb1\t \x01(\v2#.etcdserverpb.AuthRoleDeleteRequestR\x0eauthRoleDelete\x12E\n" + + "\rauth_role_get\x18\xb2\t \x01(\v2 .etcdserverpb.AuthRoleGetRequestR\vauthRoleGet\x12j\n" + + "\x1aauth_role_grant_permission\x18\xb3\t \x01(\v2,.etcdserverpb.AuthRoleGrantPermissionRequestR\x17authRoleGrantPermission\x12m\n" + + "\x1bauth_role_revoke_permission\x18\xb4\t \x01(\v2-.etcdserverpb.AuthRoleRevokePermissionRequestR\x18authRoleRevokePermission\x12`\n" + + "\x13cluster_version_set\x18\x94\n" + + " \x01(\v2&.membershippb.ClusterVersionSetRequestB\a\x8a\xb5\x18\x033.5R\x11clusterVersionSet\x12j\n" + + "\x17cluster_member_attr_set\x18\x95\n" + + " \x01(\v2).membershippb.ClusterMemberAttrSetRequestB\a\x8a\xb5\x18\x033.5R\x14clusterMemberAttrSet\x12]\n" + + "\x12downgrade_info_set\x18\x96\n" + + " \x01(\v2%.membershippb.DowngradeInfoSetRequestB\a\x8a\xb5\x18\x033.5R\x10downgradeInfoSet\x12i\n" + + "\x16downgrade_version_test\x18\xacM \x01(\v2).etcdserverpb.DowngradeVersionTestRequestB\a\x8a\xb5\x18\x033.6R\x14downgradeVersionTest:\a\x82\xb5\x18\x033.0J\x04\b\x02\x10\x03R\x02v2\"\x0f\n" + + "\rEmptyResponse\"y\n" + + "\x1bInternalAuthenticateRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1a\n" + + "\bpassword\x18\x02 \x01(\tR\bpassword\x12!\n" + + "\fsimple_token\x18\x03 \x01(\tR\vsimpleToken:\a\x82\xb5\x18\x033.0B%Z#go.etcd.io/etcd/api/v3/etcdserverpbb\x06proto3" + var ( - ErrInvalidLengthRaftInternal = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowRaftInternal = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupRaftInternal = fmt.Errorf("proto: unexpected end of group") + file_raft_internal_proto_rawDescOnce sync.Once + file_raft_internal_proto_rawDescData []byte ) + +func file_raft_internal_proto_rawDescGZIP() []byte { + file_raft_internal_proto_rawDescOnce.Do(func() { + file_raft_internal_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_raft_internal_proto_rawDesc), len(file_raft_internal_proto_rawDesc))) + }) + return file_raft_internal_proto_rawDescData +} + +var file_raft_internal_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_raft_internal_proto_goTypes = []any{ + (*RequestHeader)(nil), // 0: etcdserverpb.RequestHeader + (*InternalRaftRequest)(nil), // 1: etcdserverpb.InternalRaftRequest + (*EmptyResponse)(nil), // 2: etcdserverpb.EmptyResponse + (*InternalAuthenticateRequest)(nil), // 3: etcdserverpb.InternalAuthenticateRequest + (*RangeRequest)(nil), // 4: etcdserverpb.RangeRequest + (*PutRequest)(nil), // 5: etcdserverpb.PutRequest + (*DeleteRangeRequest)(nil), // 6: etcdserverpb.DeleteRangeRequest + (*TxnRequest)(nil), // 7: etcdserverpb.TxnRequest + (*CompactionRequest)(nil), // 8: etcdserverpb.CompactionRequest + (*LeaseGrantRequest)(nil), // 9: etcdserverpb.LeaseGrantRequest + (*LeaseRevokeRequest)(nil), // 10: etcdserverpb.LeaseRevokeRequest + (*AlarmRequest)(nil), // 11: etcdserverpb.AlarmRequest + (*LeaseCheckpointRequest)(nil), // 12: etcdserverpb.LeaseCheckpointRequest + (*AuthEnableRequest)(nil), // 13: etcdserverpb.AuthEnableRequest + (*AuthDisableRequest)(nil), // 14: etcdserverpb.AuthDisableRequest + (*AuthStatusRequest)(nil), // 15: etcdserverpb.AuthStatusRequest + (*AuthUserAddRequest)(nil), // 16: etcdserverpb.AuthUserAddRequest + (*AuthUserDeleteRequest)(nil), // 17: etcdserverpb.AuthUserDeleteRequest + (*AuthUserGetRequest)(nil), // 18: etcdserverpb.AuthUserGetRequest + (*AuthUserChangePasswordRequest)(nil), // 19: etcdserverpb.AuthUserChangePasswordRequest + (*AuthUserGrantRoleRequest)(nil), // 20: etcdserverpb.AuthUserGrantRoleRequest + (*AuthUserRevokeRoleRequest)(nil), // 21: etcdserverpb.AuthUserRevokeRoleRequest + (*AuthUserListRequest)(nil), // 22: etcdserverpb.AuthUserListRequest + (*AuthRoleListRequest)(nil), // 23: etcdserverpb.AuthRoleListRequest + (*AuthRoleAddRequest)(nil), // 24: etcdserverpb.AuthRoleAddRequest + (*AuthRoleDeleteRequest)(nil), // 25: etcdserverpb.AuthRoleDeleteRequest + (*AuthRoleGetRequest)(nil), // 26: etcdserverpb.AuthRoleGetRequest + (*AuthRoleGrantPermissionRequest)(nil), // 27: etcdserverpb.AuthRoleGrantPermissionRequest + (*AuthRoleRevokePermissionRequest)(nil), // 28: etcdserverpb.AuthRoleRevokePermissionRequest + (*membershippb.ClusterVersionSetRequest)(nil), // 29: membershippb.ClusterVersionSetRequest + (*membershippb.ClusterMemberAttrSetRequest)(nil), // 30: membershippb.ClusterMemberAttrSetRequest + (*membershippb.DowngradeInfoSetRequest)(nil), // 31: membershippb.DowngradeInfoSetRequest + (*DowngradeVersionTestRequest)(nil), // 32: etcdserverpb.DowngradeVersionTestRequest +} +var file_raft_internal_proto_depIdxs = []int32{ + 0, // 0: etcdserverpb.InternalRaftRequest.header:type_name -> etcdserverpb.RequestHeader + 4, // 1: etcdserverpb.InternalRaftRequest.range:type_name -> etcdserverpb.RangeRequest + 5, // 2: etcdserverpb.InternalRaftRequest.put:type_name -> etcdserverpb.PutRequest + 6, // 3: etcdserverpb.InternalRaftRequest.delete_range:type_name -> etcdserverpb.DeleteRangeRequest + 7, // 4: etcdserverpb.InternalRaftRequest.txn:type_name -> etcdserverpb.TxnRequest + 8, // 5: etcdserverpb.InternalRaftRequest.compaction:type_name -> etcdserverpb.CompactionRequest + 9, // 6: etcdserverpb.InternalRaftRequest.lease_grant:type_name -> etcdserverpb.LeaseGrantRequest + 10, // 7: etcdserverpb.InternalRaftRequest.lease_revoke:type_name -> etcdserverpb.LeaseRevokeRequest + 11, // 8: etcdserverpb.InternalRaftRequest.alarm:type_name -> etcdserverpb.AlarmRequest + 12, // 9: etcdserverpb.InternalRaftRequest.lease_checkpoint:type_name -> etcdserverpb.LeaseCheckpointRequest + 13, // 10: etcdserverpb.InternalRaftRequest.auth_enable:type_name -> etcdserverpb.AuthEnableRequest + 14, // 11: etcdserverpb.InternalRaftRequest.auth_disable:type_name -> etcdserverpb.AuthDisableRequest + 15, // 12: etcdserverpb.InternalRaftRequest.auth_status:type_name -> etcdserverpb.AuthStatusRequest + 3, // 13: etcdserverpb.InternalRaftRequest.authenticate:type_name -> etcdserverpb.InternalAuthenticateRequest + 16, // 14: etcdserverpb.InternalRaftRequest.auth_user_add:type_name -> etcdserverpb.AuthUserAddRequest + 17, // 15: etcdserverpb.InternalRaftRequest.auth_user_delete:type_name -> etcdserverpb.AuthUserDeleteRequest + 18, // 16: etcdserverpb.InternalRaftRequest.auth_user_get:type_name -> etcdserverpb.AuthUserGetRequest + 19, // 17: etcdserverpb.InternalRaftRequest.auth_user_change_password:type_name -> etcdserverpb.AuthUserChangePasswordRequest + 20, // 18: etcdserverpb.InternalRaftRequest.auth_user_grant_role:type_name -> etcdserverpb.AuthUserGrantRoleRequest + 21, // 19: etcdserverpb.InternalRaftRequest.auth_user_revoke_role:type_name -> etcdserverpb.AuthUserRevokeRoleRequest + 22, // 20: etcdserverpb.InternalRaftRequest.auth_user_list:type_name -> etcdserverpb.AuthUserListRequest + 23, // 21: etcdserverpb.InternalRaftRequest.auth_role_list:type_name -> etcdserverpb.AuthRoleListRequest + 24, // 22: etcdserverpb.InternalRaftRequest.auth_role_add:type_name -> etcdserverpb.AuthRoleAddRequest + 25, // 23: etcdserverpb.InternalRaftRequest.auth_role_delete:type_name -> etcdserverpb.AuthRoleDeleteRequest + 26, // 24: etcdserverpb.InternalRaftRequest.auth_role_get:type_name -> etcdserverpb.AuthRoleGetRequest + 27, // 25: etcdserverpb.InternalRaftRequest.auth_role_grant_permission:type_name -> etcdserverpb.AuthRoleGrantPermissionRequest + 28, // 26: etcdserverpb.InternalRaftRequest.auth_role_revoke_permission:type_name -> etcdserverpb.AuthRoleRevokePermissionRequest + 29, // 27: etcdserverpb.InternalRaftRequest.cluster_version_set:type_name -> membershippb.ClusterVersionSetRequest + 30, // 28: etcdserverpb.InternalRaftRequest.cluster_member_attr_set:type_name -> membershippb.ClusterMemberAttrSetRequest + 31, // 29: etcdserverpb.InternalRaftRequest.downgrade_info_set:type_name -> membershippb.DowngradeInfoSetRequest + 32, // 30: etcdserverpb.InternalRaftRequest.downgrade_version_test:type_name -> etcdserverpb.DowngradeVersionTestRequest + 31, // [31:31] is the sub-list for method output_type + 31, // [31:31] is the sub-list for method input_type + 31, // [31:31] is the sub-list for extension type_name + 31, // [31:31] is the sub-list for extension extendee + 0, // [0:31] is the sub-list for field type_name +} + +func init() { file_raft_internal_proto_init() } +func file_raft_internal_proto_init() { + if File_raft_internal_proto != nil { + return + } + file_rpc_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_raft_internal_proto_rawDesc), len(file_raft_internal_proto_rawDesc)), + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_raft_internal_proto_goTypes, + DependencyIndexes: file_raft_internal_proto_depIdxs, + MessageInfos: file_raft_internal_proto_msgTypes, + }.Build() + File_raft_internal_proto = out.File + file_raft_internal_proto_goTypes = nil + file_raft_internal_proto_depIdxs = nil +} diff --git a/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/raft_internal.proto b/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/raft_internal.proto index 88b8ab5279..51767ea9ec 100644 --- a/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/raft_internal.proto +++ b/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/raft_internal.proto @@ -1,19 +1,12 @@ syntax = "proto3"; package etcdserverpb; -import "gogoproto/gogo.proto"; -import "etcdserver.proto"; import "rpc.proto"; import "etcd/api/versionpb/version.proto"; import "etcd/api/membershippb/membership.proto"; option go_package = "go.etcd.io/etcd/api/v3/etcdserverpb"; -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; -option (gogoproto.goproto_getters_all) = false; - message RequestHeader { option (versionpb.etcd_version_msg) = "3.0"; @@ -32,7 +25,8 @@ message InternalRaftRequest { RequestHeader header = 100; uint64 ID = 1; - Request v2 = 2; + reserved 2; + reserved "v2"; RangeRequest range = 3; PutRequest put = 4; diff --git a/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/raft_internal_stringer.go b/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/raft_internal_stringer.go index a9431d5254..05c4263ae9 100644 --- a/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/raft_internal_stringer.go +++ b/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/raft_internal_stringer.go @@ -18,7 +18,7 @@ import ( "fmt" "strings" - proto "github.com/golang/protobuf/proto" + proto "github.com/golang/protobuf/proto" //nolint:staticcheck // TODO: remove for a supported version ) // InternalRaftStringer implements custom proto Stringer: diff --git a/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/rpc.pb.go b/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/rpc.pb.go index 42bf641db6..5e13278953 100644 --- a/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/rpc.pb.go +++ b/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/rpc.pb.go @@ -1,92 +1,128 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v3.20.3 // source: rpc.proto package etcdserverpb import ( - context "context" - fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" + reflect "reflect" + sync "sync" + unsafe "unsafe" + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" authpb "go.etcd.io/etcd/api/v3/authpb" mvccpb "go.etcd.io/etcd/api/v3/mvccpb" _ "go.etcd.io/etcd/api/v3/versionpb" _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type AlarmType int32 const ( - AlarmType_NONE AlarmType = 0 - AlarmType_NOSPACE AlarmType = 1 - AlarmType_CORRUPT AlarmType = 2 + AlarmType_NONE AlarmType = 0 // default, used to query if any alarm is active + AlarmType_NOSPACE AlarmType = 1 // space quota is exhausted + AlarmType_CORRUPT AlarmType = 2 // kv store corruption detected ) -var AlarmType_name = map[int32]string{ - 0: "NONE", - 1: "NOSPACE", - 2: "CORRUPT", -} +// Enum value maps for AlarmType. +var ( + AlarmType_name = map[int32]string{ + 0: "NONE", + 1: "NOSPACE", + 2: "CORRUPT", + } + AlarmType_value = map[string]int32{ + "NONE": 0, + "NOSPACE": 1, + "CORRUPT": 2, + } +) -var AlarmType_value = map[string]int32{ - "NONE": 0, - "NOSPACE": 1, - "CORRUPT": 2, +func (x AlarmType) Enum() *AlarmType { + p := new(AlarmType) + *p = x + return p } func (x AlarmType) String() string { - return proto.EnumName(AlarmType_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (AlarmType) Descriptor() protoreflect.EnumDescriptor { + return file_rpc_proto_enumTypes[0].Descriptor() +} + +func (AlarmType) Type() protoreflect.EnumType { + return &file_rpc_proto_enumTypes[0] +} + +func (x AlarmType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } +// Deprecated: Use AlarmType.Descriptor instead. func (AlarmType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{0} + return file_rpc_proto_rawDescGZIP(), []int{0} } type RangeRequest_SortOrder int32 const ( - RangeRequest_NONE RangeRequest_SortOrder = 0 - RangeRequest_ASCEND RangeRequest_SortOrder = 1 - RangeRequest_DESCEND RangeRequest_SortOrder = 2 + RangeRequest_NONE RangeRequest_SortOrder = 0 // default, no sorting + RangeRequest_ASCEND RangeRequest_SortOrder = 1 // lowest target value first + RangeRequest_DESCEND RangeRequest_SortOrder = 2 // highest target value first ) -var RangeRequest_SortOrder_name = map[int32]string{ - 0: "NONE", - 1: "ASCEND", - 2: "DESCEND", -} +// Enum value maps for RangeRequest_SortOrder. +var ( + RangeRequest_SortOrder_name = map[int32]string{ + 0: "NONE", + 1: "ASCEND", + 2: "DESCEND", + } + RangeRequest_SortOrder_value = map[string]int32{ + "NONE": 0, + "ASCEND": 1, + "DESCEND": 2, + } +) -var RangeRequest_SortOrder_value = map[string]int32{ - "NONE": 0, - "ASCEND": 1, - "DESCEND": 2, +func (x RangeRequest_SortOrder) Enum() *RangeRequest_SortOrder { + p := new(RangeRequest_SortOrder) + *p = x + return p } func (x RangeRequest_SortOrder) String() string { - return proto.EnumName(RangeRequest_SortOrder_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RangeRequest_SortOrder) Descriptor() protoreflect.EnumDescriptor { + return file_rpc_proto_enumTypes[1].Descriptor() +} + +func (RangeRequest_SortOrder) Type() protoreflect.EnumType { + return &file_rpc_proto_enumTypes[1] } +func (x RangeRequest_SortOrder) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RangeRequest_SortOrder.Descriptor instead. func (RangeRequest_SortOrder) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{1, 0} + return file_rpc_proto_rawDescGZIP(), []int{1, 0} } type RangeRequest_SortTarget int32 @@ -99,28 +135,49 @@ const ( RangeRequest_VALUE RangeRequest_SortTarget = 4 ) -var RangeRequest_SortTarget_name = map[int32]string{ - 0: "KEY", - 1: "VERSION", - 2: "CREATE", - 3: "MOD", - 4: "VALUE", -} +// Enum value maps for RangeRequest_SortTarget. +var ( + RangeRequest_SortTarget_name = map[int32]string{ + 0: "KEY", + 1: "VERSION", + 2: "CREATE", + 3: "MOD", + 4: "VALUE", + } + RangeRequest_SortTarget_value = map[string]int32{ + "KEY": 0, + "VERSION": 1, + "CREATE": 2, + "MOD": 3, + "VALUE": 4, + } +) -var RangeRequest_SortTarget_value = map[string]int32{ - "KEY": 0, - "VERSION": 1, - "CREATE": 2, - "MOD": 3, - "VALUE": 4, +func (x RangeRequest_SortTarget) Enum() *RangeRequest_SortTarget { + p := new(RangeRequest_SortTarget) + *p = x + return p } func (x RangeRequest_SortTarget) String() string { - return proto.EnumName(RangeRequest_SortTarget_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RangeRequest_SortTarget) Descriptor() protoreflect.EnumDescriptor { + return file_rpc_proto_enumTypes[2].Descriptor() } +func (RangeRequest_SortTarget) Type() protoreflect.EnumType { + return &file_rpc_proto_enumTypes[2] +} + +func (x RangeRequest_SortTarget) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RangeRequest_SortTarget.Descriptor instead. func (RangeRequest_SortTarget) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{1, 1} + return file_rpc_proto_rawDescGZIP(), []int{1, 1} } type Compare_CompareResult int32 @@ -132,26 +189,47 @@ const ( Compare_NOT_EQUAL Compare_CompareResult = 3 ) -var Compare_CompareResult_name = map[int32]string{ - 0: "EQUAL", - 1: "GREATER", - 2: "LESS", - 3: "NOT_EQUAL", -} +// Enum value maps for Compare_CompareResult. +var ( + Compare_CompareResult_name = map[int32]string{ + 0: "EQUAL", + 1: "GREATER", + 2: "LESS", + 3: "NOT_EQUAL", + } + Compare_CompareResult_value = map[string]int32{ + "EQUAL": 0, + "GREATER": 1, + "LESS": 2, + "NOT_EQUAL": 3, + } +) -var Compare_CompareResult_value = map[string]int32{ - "EQUAL": 0, - "GREATER": 1, - "LESS": 2, - "NOT_EQUAL": 3, +func (x Compare_CompareResult) Enum() *Compare_CompareResult { + p := new(Compare_CompareResult) + *p = x + return p } func (x Compare_CompareResult) String() string { - return proto.EnumName(Compare_CompareResult_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (Compare_CompareResult) Descriptor() protoreflect.EnumDescriptor { + return file_rpc_proto_enumTypes[3].Descriptor() +} + +func (Compare_CompareResult) Type() protoreflect.EnumType { + return &file_rpc_proto_enumTypes[3] +} + +func (x Compare_CompareResult) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Compare_CompareResult.Descriptor instead. func (Compare_CompareResult) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{9, 0} + return file_rpc_proto_rawDescGZIP(), []int{9, 0} } type Compare_CompareTarget int32 @@ -164,28 +242,49 @@ const ( Compare_LEASE Compare_CompareTarget = 4 ) -var Compare_CompareTarget_name = map[int32]string{ - 0: "VERSION", - 1: "CREATE", - 2: "MOD", - 3: "VALUE", - 4: "LEASE", -} +// Enum value maps for Compare_CompareTarget. +var ( + Compare_CompareTarget_name = map[int32]string{ + 0: "VERSION", + 1: "CREATE", + 2: "MOD", + 3: "VALUE", + 4: "LEASE", + } + Compare_CompareTarget_value = map[string]int32{ + "VERSION": 0, + "CREATE": 1, + "MOD": 2, + "VALUE": 3, + "LEASE": 4, + } +) -var Compare_CompareTarget_value = map[string]int32{ - "VERSION": 0, - "CREATE": 1, - "MOD": 2, - "VALUE": 3, - "LEASE": 4, +func (x Compare_CompareTarget) Enum() *Compare_CompareTarget { + p := new(Compare_CompareTarget) + *p = x + return p } func (x Compare_CompareTarget) String() string { - return proto.EnumName(Compare_CompareTarget_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Compare_CompareTarget) Descriptor() protoreflect.EnumDescriptor { + return file_rpc_proto_enumTypes[4].Descriptor() +} + +func (Compare_CompareTarget) Type() protoreflect.EnumType { + return &file_rpc_proto_enumTypes[4] +} + +func (x Compare_CompareTarget) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } +// Deprecated: Use Compare_CompareTarget.Descriptor instead. func (Compare_CompareTarget) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{9, 1} + return file_rpc_proto_rawDescGZIP(), []int{9, 1} } type WatchCreateRequest_FilterType int32 @@ -197,22 +296,43 @@ const ( WatchCreateRequest_NODELETE WatchCreateRequest_FilterType = 1 ) -var WatchCreateRequest_FilterType_name = map[int32]string{ - 0: "NOPUT", - 1: "NODELETE", -} +// Enum value maps for WatchCreateRequest_FilterType. +var ( + WatchCreateRequest_FilterType_name = map[int32]string{ + 0: "NOPUT", + 1: "NODELETE", + } + WatchCreateRequest_FilterType_value = map[string]int32{ + "NOPUT": 0, + "NODELETE": 1, + } +) -var WatchCreateRequest_FilterType_value = map[string]int32{ - "NOPUT": 0, - "NODELETE": 1, +func (x WatchCreateRequest_FilterType) Enum() *WatchCreateRequest_FilterType { + p := new(WatchCreateRequest_FilterType) + *p = x + return p } func (x WatchCreateRequest_FilterType) String() string { - return proto.EnumName(WatchCreateRequest_FilterType_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (WatchCreateRequest_FilterType) Descriptor() protoreflect.EnumDescriptor { + return file_rpc_proto_enumTypes[5].Descriptor() +} + +func (WatchCreateRequest_FilterType) Type() protoreflect.EnumType { + return &file_rpc_proto_enumTypes[5] +} + +func (x WatchCreateRequest_FilterType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } +// Deprecated: Use WatchCreateRequest_FilterType.Descriptor instead. func (WatchCreateRequest_FilterType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{21, 0} + return file_rpc_proto_rawDescGZIP(), []int{21, 0} } type AlarmRequest_AlarmAction int32 @@ -223,24 +343,45 @@ const ( AlarmRequest_DEACTIVATE AlarmRequest_AlarmAction = 2 ) -var AlarmRequest_AlarmAction_name = map[int32]string{ - 0: "GET", - 1: "ACTIVATE", - 2: "DEACTIVATE", -} +// Enum value maps for AlarmRequest_AlarmAction. +var ( + AlarmRequest_AlarmAction_name = map[int32]string{ + 0: "GET", + 1: "ACTIVATE", + 2: "DEACTIVATE", + } + AlarmRequest_AlarmAction_value = map[string]int32{ + "GET": 0, + "ACTIVATE": 1, + "DEACTIVATE": 2, + } +) -var AlarmRequest_AlarmAction_value = map[string]int32{ - "GET": 0, - "ACTIVATE": 1, - "DEACTIVATE": 2, +func (x AlarmRequest_AlarmAction) Enum() *AlarmRequest_AlarmAction { + p := new(AlarmRequest_AlarmAction) + *p = x + return p } func (x AlarmRequest_AlarmAction) String() string { - return proto.EnumName(AlarmRequest_AlarmAction_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (AlarmRequest_AlarmAction) Descriptor() protoreflect.EnumDescriptor { + return file_rpc_proto_enumTypes[6].Descriptor() +} + +func (AlarmRequest_AlarmAction) Type() protoreflect.EnumType { + return &file_rpc_proto_enumTypes[6] +} + +func (x AlarmRequest_AlarmAction) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use AlarmRequest_AlarmAction.Descriptor instead. func (AlarmRequest_AlarmAction) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{54, 0} + return file_rpc_proto_rawDescGZIP(), []int{54, 0} } type DowngradeRequest_DowngradeAction int32 @@ -251,27 +392,49 @@ const ( DowngradeRequest_CANCEL DowngradeRequest_DowngradeAction = 2 ) -var DowngradeRequest_DowngradeAction_name = map[int32]string{ - 0: "VALIDATE", - 1: "ENABLE", - 2: "CANCEL", -} +// Enum value maps for DowngradeRequest_DowngradeAction. +var ( + DowngradeRequest_DowngradeAction_name = map[int32]string{ + 0: "VALIDATE", + 1: "ENABLE", + 2: "CANCEL", + } + DowngradeRequest_DowngradeAction_value = map[string]int32{ + "VALIDATE": 0, + "ENABLE": 1, + "CANCEL": 2, + } +) -var DowngradeRequest_DowngradeAction_value = map[string]int32{ - "VALIDATE": 0, - "ENABLE": 1, - "CANCEL": 2, +func (x DowngradeRequest_DowngradeAction) Enum() *DowngradeRequest_DowngradeAction { + p := new(DowngradeRequest_DowngradeAction) + *p = x + return p } func (x DowngradeRequest_DowngradeAction) String() string { - return proto.EnumName(DowngradeRequest_DowngradeAction_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DowngradeRequest_DowngradeAction) Descriptor() protoreflect.EnumDescriptor { + return file_rpc_proto_enumTypes[7].Descriptor() +} + +func (DowngradeRequest_DowngradeAction) Type() protoreflect.EnumType { + return &file_rpc_proto_enumTypes[7] +} + +func (x DowngradeRequest_DowngradeAction) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } +// Deprecated: Use DowngradeRequest_DowngradeAction.Descriptor instead. func (DowngradeRequest_DowngradeAction) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{57, 0} + return file_rpc_proto_rawDescGZIP(), []int{57, 0} } type ResponseHeader struct { + state protoimpl.MessageState `protogen:"open.v1"` // cluster_id is the ID of the cluster which sent the response. ClusterId uint64 `protobuf:"varint,1,opt,name=cluster_id,json=clusterId,proto3" json:"cluster_id,omitempty"` // member_id is the ID of the member which sent the response. @@ -283,74 +446,71 @@ type ResponseHeader struct { // header.revision number. Revision int64 `protobuf:"varint,3,opt,name=revision,proto3" json:"revision,omitempty"` // raft_term is the raft term when the request was applied. - RaftTerm uint64 `protobuf:"varint,4,opt,name=raft_term,json=raftTerm,proto3" json:"raft_term,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + RaftTerm uint64 `protobuf:"varint,4,opt,name=raft_term,json=raftTerm,proto3" json:"raft_term,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *ResponseHeader) Reset() { *m = ResponseHeader{} } -func (m *ResponseHeader) String() string { return proto.CompactTextString(m) } -func (*ResponseHeader) ProtoMessage() {} -func (*ResponseHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{0} -} -func (m *ResponseHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ResponseHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ResponseHeader.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *ResponseHeader) Reset() { + *x = ResponseHeader{} + mi := &file_rpc_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *ResponseHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseHeader.Merge(m, src) -} -func (m *ResponseHeader) XXX_Size() int { - return m.Size() + +func (x *ResponseHeader) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ResponseHeader) XXX_DiscardUnknown() { - xxx_messageInfo_ResponseHeader.DiscardUnknown(m) + +func (*ResponseHeader) ProtoMessage() {} + +func (x *ResponseHeader) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ResponseHeader proto.InternalMessageInfo +// Deprecated: Use ResponseHeader.ProtoReflect.Descriptor instead. +func (*ResponseHeader) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{0} +} -func (m *ResponseHeader) GetClusterId() uint64 { - if m != nil { - return m.ClusterId +func (x *ResponseHeader) GetClusterId() uint64 { + if x != nil { + return x.ClusterId } return 0 } -func (m *ResponseHeader) GetMemberId() uint64 { - if m != nil { - return m.MemberId +func (x *ResponseHeader) GetMemberId() uint64 { + if x != nil { + return x.MemberId } return 0 } -func (m *ResponseHeader) GetRevision() int64 { - if m != nil { - return m.Revision +func (x *ResponseHeader) GetRevision() int64 { + if x != nil { + return x.Revision } return 0 } -func (m *ResponseHeader) GetRaftTerm() uint64 { - if m != nil { - return m.RaftTerm +func (x *ResponseHeader) GetRaftTerm() uint64 { + if x != nil { + return x.RaftTerm } return 0 } type RangeRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // key is the first key for the range. If range_end is not given, the request only looks up key. Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // range_end is the upper bound on the requested range [key, range_end). @@ -392,138 +552,135 @@ type RangeRequest struct { MinCreateRevision int64 `protobuf:"varint,12,opt,name=min_create_revision,json=minCreateRevision,proto3" json:"min_create_revision,omitempty"` // max_create_revision is the upper bound for returned key create revisions; all keys with // greater create revisions will be filtered away. - MaxCreateRevision int64 `protobuf:"varint,13,opt,name=max_create_revision,json=maxCreateRevision,proto3" json:"max_create_revision,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + MaxCreateRevision int64 `protobuf:"varint,13,opt,name=max_create_revision,json=maxCreateRevision,proto3" json:"max_create_revision,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *RangeRequest) Reset() { *m = RangeRequest{} } -func (m *RangeRequest) String() string { return proto.CompactTextString(m) } -func (*RangeRequest) ProtoMessage() {} -func (*RangeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{1} -} -func (m *RangeRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RangeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RangeRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *RangeRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_RangeRequest.Merge(m, src) +func (x *RangeRequest) Reset() { + *x = RangeRequest{} + mi := &file_rpc_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *RangeRequest) XXX_Size() int { - return m.Size() + +func (x *RangeRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RangeRequest) XXX_DiscardUnknown() { - xxx_messageInfo_RangeRequest.DiscardUnknown(m) + +func (*RangeRequest) ProtoMessage() {} + +func (x *RangeRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RangeRequest proto.InternalMessageInfo +// Deprecated: Use RangeRequest.ProtoReflect.Descriptor instead. +func (*RangeRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{1} +} -func (m *RangeRequest) GetKey() []byte { - if m != nil { - return m.Key +func (x *RangeRequest) GetKey() []byte { + if x != nil { + return x.Key } return nil } -func (m *RangeRequest) GetRangeEnd() []byte { - if m != nil { - return m.RangeEnd +func (x *RangeRequest) GetRangeEnd() []byte { + if x != nil { + return x.RangeEnd } return nil } -func (m *RangeRequest) GetLimit() int64 { - if m != nil { - return m.Limit +func (x *RangeRequest) GetLimit() int64 { + if x != nil { + return x.Limit } return 0 } -func (m *RangeRequest) GetRevision() int64 { - if m != nil { - return m.Revision +func (x *RangeRequest) GetRevision() int64 { + if x != nil { + return x.Revision } return 0 } -func (m *RangeRequest) GetSortOrder() RangeRequest_SortOrder { - if m != nil { - return m.SortOrder +func (x *RangeRequest) GetSortOrder() RangeRequest_SortOrder { + if x != nil { + return x.SortOrder } return RangeRequest_NONE } -func (m *RangeRequest) GetSortTarget() RangeRequest_SortTarget { - if m != nil { - return m.SortTarget +func (x *RangeRequest) GetSortTarget() RangeRequest_SortTarget { + if x != nil { + return x.SortTarget } return RangeRequest_KEY } -func (m *RangeRequest) GetSerializable() bool { - if m != nil { - return m.Serializable +func (x *RangeRequest) GetSerializable() bool { + if x != nil { + return x.Serializable } return false } -func (m *RangeRequest) GetKeysOnly() bool { - if m != nil { - return m.KeysOnly +func (x *RangeRequest) GetKeysOnly() bool { + if x != nil { + return x.KeysOnly } return false } -func (m *RangeRequest) GetCountOnly() bool { - if m != nil { - return m.CountOnly +func (x *RangeRequest) GetCountOnly() bool { + if x != nil { + return x.CountOnly } return false } -func (m *RangeRequest) GetMinModRevision() int64 { - if m != nil { - return m.MinModRevision +func (x *RangeRequest) GetMinModRevision() int64 { + if x != nil { + return x.MinModRevision } return 0 } -func (m *RangeRequest) GetMaxModRevision() int64 { - if m != nil { - return m.MaxModRevision +func (x *RangeRequest) GetMaxModRevision() int64 { + if x != nil { + return x.MaxModRevision } return 0 } -func (m *RangeRequest) GetMinCreateRevision() int64 { - if m != nil { - return m.MinCreateRevision +func (x *RangeRequest) GetMinCreateRevision() int64 { + if x != nil { + return x.MinCreateRevision } return 0 } -func (m *RangeRequest) GetMaxCreateRevision() int64 { - if m != nil { - return m.MaxCreateRevision +func (x *RangeRequest) GetMaxCreateRevision() int64 { + if x != nil { + return x.MaxCreateRevision } return 0 } type RangeResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // kvs is the list of key-value pairs matched by the range request. // kvs is empty when count is requested. Kvs []*mvccpb.KeyValue `protobuf:"bytes,2,rep,name=kvs,proto3" json:"kvs,omitempty"` @@ -532,74 +689,71 @@ type RangeResponse struct { // count is set to the actual number of keys within the range when requested. // Unlike Kvs, it is unaffected by limits and filters (e.g., Min/Max, Create/Modify, Revisions) // and reflects the full count within the specified range. - Count int64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Count int64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *RangeResponse) Reset() { *m = RangeResponse{} } -func (m *RangeResponse) String() string { return proto.CompactTextString(m) } -func (*RangeResponse) ProtoMessage() {} -func (*RangeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{2} -} -func (m *RangeResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RangeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RangeResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *RangeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_RangeResponse.Merge(m, src) +func (x *RangeResponse) Reset() { + *x = RangeResponse{} + mi := &file_rpc_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *RangeResponse) XXX_Size() int { - return m.Size() + +func (x *RangeResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RangeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_RangeResponse.DiscardUnknown(m) + +func (*RangeResponse) ProtoMessage() {} + +func (x *RangeResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RangeResponse proto.InternalMessageInfo +// Deprecated: Use RangeResponse.ProtoReflect.Descriptor instead. +func (*RangeResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{2} +} -func (m *RangeResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *RangeResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *RangeResponse) GetKvs() []*mvccpb.KeyValue { - if m != nil { - return m.Kvs +func (x *RangeResponse) GetKvs() []*mvccpb.KeyValue { + if x != nil { + return x.Kvs } return nil } -func (m *RangeResponse) GetMore() bool { - if m != nil { - return m.More +func (x *RangeResponse) GetMore() bool { + if x != nil { + return x.More } return false } -func (m *RangeResponse) GetCount() int64 { - if m != nil { - return m.Count +func (x *RangeResponse) GetCount() int64 { + if x != nil { + return x.Count } return 0 } type PutRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // key is the key, in bytes, to put into the key-value store. Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // value is the value, in bytes, to associate with the key in the key-value store. @@ -615,144 +769,138 @@ type PutRequest struct { IgnoreValue bool `protobuf:"varint,5,opt,name=ignore_value,json=ignoreValue,proto3" json:"ignore_value,omitempty"` // If ignore_lease is set, etcd updates the key using its current lease. // Returns an error if the key does not exist. - IgnoreLease bool `protobuf:"varint,6,opt,name=ignore_lease,json=ignoreLease,proto3" json:"ignore_lease,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + IgnoreLease bool `protobuf:"varint,6,opt,name=ignore_lease,json=ignoreLease,proto3" json:"ignore_lease,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *PutRequest) Reset() { *m = PutRequest{} } -func (m *PutRequest) String() string { return proto.CompactTextString(m) } -func (*PutRequest) ProtoMessage() {} -func (*PutRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{3} -} -func (m *PutRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PutRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *PutRequest) Reset() { + *x = PutRequest{} + mi := &file_rpc_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *PutRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutRequest.Merge(m, src) -} -func (m *PutRequest) XXX_Size() int { - return m.Size() + +func (x *PutRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *PutRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PutRequest.DiscardUnknown(m) + +func (*PutRequest) ProtoMessage() {} + +func (x *PutRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_PutRequest proto.InternalMessageInfo +// Deprecated: Use PutRequest.ProtoReflect.Descriptor instead. +func (*PutRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{3} +} -func (m *PutRequest) GetKey() []byte { - if m != nil { - return m.Key +func (x *PutRequest) GetKey() []byte { + if x != nil { + return x.Key } return nil } -func (m *PutRequest) GetValue() []byte { - if m != nil { - return m.Value +func (x *PutRequest) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func (m *PutRequest) GetLease() int64 { - if m != nil { - return m.Lease +func (x *PutRequest) GetLease() int64 { + if x != nil { + return x.Lease } return 0 } -func (m *PutRequest) GetPrevKv() bool { - if m != nil { - return m.PrevKv +func (x *PutRequest) GetPrevKv() bool { + if x != nil { + return x.PrevKv } return false } -func (m *PutRequest) GetIgnoreValue() bool { - if m != nil { - return m.IgnoreValue +func (x *PutRequest) GetIgnoreValue() bool { + if x != nil { + return x.IgnoreValue } return false } -func (m *PutRequest) GetIgnoreLease() bool { - if m != nil { - return m.IgnoreLease +func (x *PutRequest) GetIgnoreLease() bool { + if x != nil { + return x.IgnoreLease } return false } type PutResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // if prev_kv is set in the request, the previous key-value pair will be returned. - PrevKv *mvccpb.KeyValue `protobuf:"bytes,2,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + PrevKv *mvccpb.KeyValue `protobuf:"bytes,2,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *PutResponse) Reset() { *m = PutResponse{} } -func (m *PutResponse) String() string { return proto.CompactTextString(m) } -func (*PutResponse) ProtoMessage() {} -func (*PutResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{4} -} -func (m *PutResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PutResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *PutResponse) Reset() { + *x = PutResponse{} + mi := &file_rpc_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *PutResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutResponse.Merge(m, src) -} -func (m *PutResponse) XXX_Size() int { - return m.Size() + +func (x *PutResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *PutResponse) XXX_DiscardUnknown() { - xxx_messageInfo_PutResponse.DiscardUnknown(m) + +func (*PutResponse) ProtoMessage() {} + +func (x *PutResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_PutResponse proto.InternalMessageInfo +// Deprecated: Use PutResponse.ProtoReflect.Descriptor instead. +func (*PutResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{4} +} -func (m *PutResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *PutResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *PutResponse) GetPrevKv() *mvccpb.KeyValue { - if m != nil { - return m.PrevKv +func (x *PutResponse) GetPrevKv() *mvccpb.KeyValue { + if x != nil { + return x.PrevKv } return nil } type DeleteRangeRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // key is the first key to delete in the range. Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // range_end is the key following the last key to delete for the range [key, range_end). @@ -763,371 +911,366 @@ type DeleteRangeRequest struct { RangeEnd []byte `protobuf:"bytes,2,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` // If prev_kv is set, etcd gets the previous key-value pairs before deleting it. // The previous key-value pairs will be returned in the delete response. - PrevKv bool `protobuf:"varint,3,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + PrevKv bool `protobuf:"varint,3,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *DeleteRangeRequest) Reset() { *m = DeleteRangeRequest{} } -func (m *DeleteRangeRequest) String() string { return proto.CompactTextString(m) } -func (*DeleteRangeRequest) ProtoMessage() {} -func (*DeleteRangeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{5} -} -func (m *DeleteRangeRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DeleteRangeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DeleteRangeRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DeleteRangeRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteRangeRequest.Merge(m, src) +func (x *DeleteRangeRequest) Reset() { + *x = DeleteRangeRequest{} + mi := &file_rpc_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *DeleteRangeRequest) XXX_Size() int { - return m.Size() + +func (x *DeleteRangeRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DeleteRangeRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteRangeRequest.DiscardUnknown(m) + +func (*DeleteRangeRequest) ProtoMessage() {} + +func (x *DeleteRangeRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_DeleteRangeRequest proto.InternalMessageInfo +// Deprecated: Use DeleteRangeRequest.ProtoReflect.Descriptor instead. +func (*DeleteRangeRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{5} +} -func (m *DeleteRangeRequest) GetKey() []byte { - if m != nil { - return m.Key +func (x *DeleteRangeRequest) GetKey() []byte { + if x != nil { + return x.Key } return nil } -func (m *DeleteRangeRequest) GetRangeEnd() []byte { - if m != nil { - return m.RangeEnd +func (x *DeleteRangeRequest) GetRangeEnd() []byte { + if x != nil { + return x.RangeEnd } return nil } -func (m *DeleteRangeRequest) GetPrevKv() bool { - if m != nil { - return m.PrevKv +func (x *DeleteRangeRequest) GetPrevKv() bool { + if x != nil { + return x.PrevKv } return false } type DeleteRangeResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // deleted is the number of keys deleted by the delete range request. Deleted int64 `protobuf:"varint,2,opt,name=deleted,proto3" json:"deleted,omitempty"` // if prev_kv is set in the request, the previous key-value pairs will be returned. - PrevKvs []*mvccpb.KeyValue `protobuf:"bytes,3,rep,name=prev_kvs,json=prevKvs,proto3" json:"prev_kvs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + PrevKvs []*mvccpb.KeyValue `protobuf:"bytes,3,rep,name=prev_kvs,json=prevKvs,proto3" json:"prev_kvs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *DeleteRangeResponse) Reset() { *m = DeleteRangeResponse{} } -func (m *DeleteRangeResponse) String() string { return proto.CompactTextString(m) } -func (*DeleteRangeResponse) ProtoMessage() {} -func (*DeleteRangeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{6} -} -func (m *DeleteRangeResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DeleteRangeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DeleteRangeResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DeleteRangeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteRangeResponse.Merge(m, src) +func (x *DeleteRangeResponse) Reset() { + *x = DeleteRangeResponse{} + mi := &file_rpc_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *DeleteRangeResponse) XXX_Size() int { - return m.Size() + +func (x *DeleteRangeResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DeleteRangeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteRangeResponse.DiscardUnknown(m) + +func (*DeleteRangeResponse) ProtoMessage() {} + +func (x *DeleteRangeResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_DeleteRangeResponse proto.InternalMessageInfo +// Deprecated: Use DeleteRangeResponse.ProtoReflect.Descriptor instead. +func (*DeleteRangeResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{6} +} -func (m *DeleteRangeResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *DeleteRangeResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *DeleteRangeResponse) GetDeleted() int64 { - if m != nil { - return m.Deleted +func (x *DeleteRangeResponse) GetDeleted() int64 { + if x != nil { + return x.Deleted } return 0 } -func (m *DeleteRangeResponse) GetPrevKvs() []*mvccpb.KeyValue { - if m != nil { - return m.PrevKvs +func (x *DeleteRangeResponse) GetPrevKvs() []*mvccpb.KeyValue { + if x != nil { + return x.PrevKvs } return nil } type RequestOp struct { + state protoimpl.MessageState `protogen:"open.v1"` // request is a union of request types accepted by a transaction. // // Types that are valid to be assigned to Request: + // // *RequestOp_RequestRange // *RequestOp_RequestPut // *RequestOp_RequestDeleteRange // *RequestOp_RequestTxn - Request isRequestOp_Request `protobuf_oneof:"request"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Request isRequestOp_Request `protobuf_oneof:"request"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *RequestOp) Reset() { *m = RequestOp{} } -func (m *RequestOp) String() string { return proto.CompactTextString(m) } -func (*RequestOp) ProtoMessage() {} -func (*RequestOp) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{7} -} -func (m *RequestOp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RequestOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RequestOp.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *RequestOp) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestOp.Merge(m, src) +func (x *RequestOp) Reset() { + *x = RequestOp{} + mi := &file_rpc_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *RequestOp) XXX_Size() int { - return m.Size() -} -func (m *RequestOp) XXX_DiscardUnknown() { - xxx_messageInfo_RequestOp.DiscardUnknown(m) + +func (x *RequestOp) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_RequestOp proto.InternalMessageInfo +func (*RequestOp) ProtoMessage() {} -type isRequestOp_Request interface { - isRequestOp_Request() - MarshalTo([]byte) (int, error) - Size() int +func (x *RequestOp) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -type RequestOp_RequestRange struct { - RequestRange *RangeRequest `protobuf:"bytes,1,opt,name=request_range,json=requestRange,proto3,oneof" json:"request_range,omitempty"` -} -type RequestOp_RequestPut struct { - RequestPut *PutRequest `protobuf:"bytes,2,opt,name=request_put,json=requestPut,proto3,oneof" json:"request_put,omitempty"` -} -type RequestOp_RequestDeleteRange struct { - RequestDeleteRange *DeleteRangeRequest `protobuf:"bytes,3,opt,name=request_delete_range,json=requestDeleteRange,proto3,oneof" json:"request_delete_range,omitempty"` -} -type RequestOp_RequestTxn struct { - RequestTxn *TxnRequest `protobuf:"bytes,4,opt,name=request_txn,json=requestTxn,proto3,oneof" json:"request_txn,omitempty"` +// Deprecated: Use RequestOp.ProtoReflect.Descriptor instead. +func (*RequestOp) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{7} } -func (*RequestOp_RequestRange) isRequestOp_Request() {} -func (*RequestOp_RequestPut) isRequestOp_Request() {} -func (*RequestOp_RequestDeleteRange) isRequestOp_Request() {} -func (*RequestOp_RequestTxn) isRequestOp_Request() {} - -func (m *RequestOp) GetRequest() isRequestOp_Request { - if m != nil { - return m.Request +func (x *RequestOp) GetRequest() isRequestOp_Request { + if x != nil { + return x.Request } return nil } -func (m *RequestOp) GetRequestRange() *RangeRequest { - if x, ok := m.GetRequest().(*RequestOp_RequestRange); ok { - return x.RequestRange +func (x *RequestOp) GetRequestRange() *RangeRequest { + if x != nil { + if x, ok := x.Request.(*RequestOp_RequestRange); ok { + return x.RequestRange + } } return nil } -func (m *RequestOp) GetRequestPut() *PutRequest { - if x, ok := m.GetRequest().(*RequestOp_RequestPut); ok { - return x.RequestPut +func (x *RequestOp) GetRequestPut() *PutRequest { + if x != nil { + if x, ok := x.Request.(*RequestOp_RequestPut); ok { + return x.RequestPut + } } return nil } -func (m *RequestOp) GetRequestDeleteRange() *DeleteRangeRequest { - if x, ok := m.GetRequest().(*RequestOp_RequestDeleteRange); ok { - return x.RequestDeleteRange +func (x *RequestOp) GetRequestDeleteRange() *DeleteRangeRequest { + if x != nil { + if x, ok := x.Request.(*RequestOp_RequestDeleteRange); ok { + return x.RequestDeleteRange + } } return nil } -func (m *RequestOp) GetRequestTxn() *TxnRequest { - if x, ok := m.GetRequest().(*RequestOp_RequestTxn); ok { - return x.RequestTxn +func (x *RequestOp) GetRequestTxn() *TxnRequest { + if x != nil { + if x, ok := x.Request.(*RequestOp_RequestTxn); ok { + return x.RequestTxn + } } return nil } -// XXX_OneofWrappers is for the internal use of the proto package. -func (*RequestOp) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*RequestOp_RequestRange)(nil), - (*RequestOp_RequestPut)(nil), - (*RequestOp_RequestDeleteRange)(nil), - (*RequestOp_RequestTxn)(nil), - } +type isRequestOp_Request interface { + isRequestOp_Request() +} + +type RequestOp_RequestRange struct { + RequestRange *RangeRequest `protobuf:"bytes,1,opt,name=request_range,json=requestRange,proto3,oneof"` +} + +type RequestOp_RequestPut struct { + RequestPut *PutRequest `protobuf:"bytes,2,opt,name=request_put,json=requestPut,proto3,oneof"` +} + +type RequestOp_RequestDeleteRange struct { + RequestDeleteRange *DeleteRangeRequest `protobuf:"bytes,3,opt,name=request_delete_range,json=requestDeleteRange,proto3,oneof"` } +type RequestOp_RequestTxn struct { + RequestTxn *TxnRequest `protobuf:"bytes,4,opt,name=request_txn,json=requestTxn,proto3,oneof"` +} + +func (*RequestOp_RequestRange) isRequestOp_Request() {} + +func (*RequestOp_RequestPut) isRequestOp_Request() {} + +func (*RequestOp_RequestDeleteRange) isRequestOp_Request() {} + +func (*RequestOp_RequestTxn) isRequestOp_Request() {} + type ResponseOp struct { + state protoimpl.MessageState `protogen:"open.v1"` // response is a union of response types returned by a transaction. // // Types that are valid to be assigned to Response: + // // *ResponseOp_ResponseRange // *ResponseOp_ResponsePut // *ResponseOp_ResponseDeleteRange // *ResponseOp_ResponseTxn - Response isResponseOp_Response `protobuf_oneof:"response"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Response isResponseOp_Response `protobuf_oneof:"response"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *ResponseOp) Reset() { *m = ResponseOp{} } -func (m *ResponseOp) String() string { return proto.CompactTextString(m) } -func (*ResponseOp) ProtoMessage() {} -func (*ResponseOp) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{8} -} -func (m *ResponseOp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ResponseOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ResponseOp.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *ResponseOp) Reset() { + *x = ResponseOp{} + mi := &file_rpc_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *ResponseOp) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseOp.Merge(m, src) -} -func (m *ResponseOp) XXX_Size() int { - return m.Size() -} -func (m *ResponseOp) XXX_DiscardUnknown() { - xxx_messageInfo_ResponseOp.DiscardUnknown(m) + +func (x *ResponseOp) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_ResponseOp proto.InternalMessageInfo +func (*ResponseOp) ProtoMessage() {} -type isResponseOp_Response interface { - isResponseOp_Response() - MarshalTo([]byte) (int, error) - Size() int +func (x *ResponseOp) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -type ResponseOp_ResponseRange struct { - ResponseRange *RangeResponse `protobuf:"bytes,1,opt,name=response_range,json=responseRange,proto3,oneof" json:"response_range,omitempty"` -} -type ResponseOp_ResponsePut struct { - ResponsePut *PutResponse `protobuf:"bytes,2,opt,name=response_put,json=responsePut,proto3,oneof" json:"response_put,omitempty"` -} -type ResponseOp_ResponseDeleteRange struct { - ResponseDeleteRange *DeleteRangeResponse `protobuf:"bytes,3,opt,name=response_delete_range,json=responseDeleteRange,proto3,oneof" json:"response_delete_range,omitempty"` -} -type ResponseOp_ResponseTxn struct { - ResponseTxn *TxnResponse `protobuf:"bytes,4,opt,name=response_txn,json=responseTxn,proto3,oneof" json:"response_txn,omitempty"` +// Deprecated: Use ResponseOp.ProtoReflect.Descriptor instead. +func (*ResponseOp) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{8} } -func (*ResponseOp_ResponseRange) isResponseOp_Response() {} -func (*ResponseOp_ResponsePut) isResponseOp_Response() {} -func (*ResponseOp_ResponseDeleteRange) isResponseOp_Response() {} -func (*ResponseOp_ResponseTxn) isResponseOp_Response() {} - -func (m *ResponseOp) GetResponse() isResponseOp_Response { - if m != nil { - return m.Response +func (x *ResponseOp) GetResponse() isResponseOp_Response { + if x != nil { + return x.Response } return nil } -func (m *ResponseOp) GetResponseRange() *RangeResponse { - if x, ok := m.GetResponse().(*ResponseOp_ResponseRange); ok { - return x.ResponseRange +func (x *ResponseOp) GetResponseRange() *RangeResponse { + if x != nil { + if x, ok := x.Response.(*ResponseOp_ResponseRange); ok { + return x.ResponseRange + } } return nil } -func (m *ResponseOp) GetResponsePut() *PutResponse { - if x, ok := m.GetResponse().(*ResponseOp_ResponsePut); ok { - return x.ResponsePut +func (x *ResponseOp) GetResponsePut() *PutResponse { + if x != nil { + if x, ok := x.Response.(*ResponseOp_ResponsePut); ok { + return x.ResponsePut + } } return nil } -func (m *ResponseOp) GetResponseDeleteRange() *DeleteRangeResponse { - if x, ok := m.GetResponse().(*ResponseOp_ResponseDeleteRange); ok { - return x.ResponseDeleteRange +func (x *ResponseOp) GetResponseDeleteRange() *DeleteRangeResponse { + if x != nil { + if x, ok := x.Response.(*ResponseOp_ResponseDeleteRange); ok { + return x.ResponseDeleteRange + } } return nil } -func (m *ResponseOp) GetResponseTxn() *TxnResponse { - if x, ok := m.GetResponse().(*ResponseOp_ResponseTxn); ok { - return x.ResponseTxn +func (x *ResponseOp) GetResponseTxn() *TxnResponse { + if x != nil { + if x, ok := x.Response.(*ResponseOp_ResponseTxn); ok { + return x.ResponseTxn + } } return nil } -// XXX_OneofWrappers is for the internal use of the proto package. -func (*ResponseOp) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*ResponseOp_ResponseRange)(nil), - (*ResponseOp_ResponsePut)(nil), - (*ResponseOp_ResponseDeleteRange)(nil), - (*ResponseOp_ResponseTxn)(nil), - } +type isResponseOp_Response interface { + isResponseOp_Response() } -type Compare struct { - // result is logical comparison operation for this comparison. - Result Compare_CompareResult `protobuf:"varint,1,opt,name=result,proto3,enum=etcdserverpb.Compare_CompareResult" json:"result,omitempty"` - // target is the key-value field to inspect for the comparison. +type ResponseOp_ResponseRange struct { + ResponseRange *RangeResponse `protobuf:"bytes,1,opt,name=response_range,json=responseRange,proto3,oneof"` +} + +type ResponseOp_ResponsePut struct { + ResponsePut *PutResponse `protobuf:"bytes,2,opt,name=response_put,json=responsePut,proto3,oneof"` +} + +type ResponseOp_ResponseDeleteRange struct { + ResponseDeleteRange *DeleteRangeResponse `protobuf:"bytes,3,opt,name=response_delete_range,json=responseDeleteRange,proto3,oneof"` +} + +type ResponseOp_ResponseTxn struct { + ResponseTxn *TxnResponse `protobuf:"bytes,4,opt,name=response_txn,json=responseTxn,proto3,oneof"` +} + +func (*ResponseOp_ResponseRange) isResponseOp_Response() {} + +func (*ResponseOp_ResponsePut) isResponseOp_Response() {} + +func (*ResponseOp_ResponseDeleteRange) isResponseOp_Response() {} + +func (*ResponseOp_ResponseTxn) isResponseOp_Response() {} + +type Compare struct { + state protoimpl.MessageState `protogen:"open.v1"` + // result is logical comparison operation for this comparison. + Result Compare_CompareResult `protobuf:"varint,1,opt,name=result,proto3,enum=etcdserverpb.Compare_CompareResult" json:"result,omitempty"` + // target is the key-value field to inspect for the comparison. Target Compare_CompareTarget `protobuf:"varint,2,opt,name=target,proto3,enum=etcdserverpb.Compare_CompareTarget" json:"target,omitempty"` // key is the subject key for the comparison operation. Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` // Types that are valid to be assigned to TargetUnion: + // // *Compare_Version // *Compare_CreateRevision // *Compare_ModRevision @@ -1136,154 +1279,160 @@ type Compare struct { TargetUnion isCompare_TargetUnion `protobuf_oneof:"target_union"` // range_end compares the given target to all keys in the range [key, range_end). // See RangeRequest for more details on key ranges. - RangeEnd []byte `protobuf:"bytes,64,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + RangeEnd []byte `protobuf:"bytes,64,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` // TODO: fill out with most of the rest of RangeRequest fields when needed. + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *Compare) Reset() { *m = Compare{} } -func (m *Compare) String() string { return proto.CompactTextString(m) } -func (*Compare) ProtoMessage() {} -func (*Compare) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{9} -} -func (m *Compare) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Compare) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Compare.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Compare) XXX_Merge(src proto.Message) { - xxx_messageInfo_Compare.Merge(m, src) +func (x *Compare) Reset() { + *x = Compare{} + mi := &file_rpc_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *Compare) XXX_Size() int { - return m.Size() -} -func (m *Compare) XXX_DiscardUnknown() { - xxx_messageInfo_Compare.DiscardUnknown(m) + +func (x *Compare) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_Compare proto.InternalMessageInfo +func (*Compare) ProtoMessage() {} -type isCompare_TargetUnion interface { - isCompare_TargetUnion() - MarshalTo([]byte) (int, error) - Size() int +func (x *Compare) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -type Compare_Version struct { - Version int64 `protobuf:"varint,4,opt,name=version,proto3,oneof" json:"version,omitempty"` -} -type Compare_CreateRevision struct { - CreateRevision int64 `protobuf:"varint,5,opt,name=create_revision,json=createRevision,proto3,oneof" json:"create_revision,omitempty"` -} -type Compare_ModRevision struct { - ModRevision int64 `protobuf:"varint,6,opt,name=mod_revision,json=modRevision,proto3,oneof" json:"mod_revision,omitempty"` -} -type Compare_Value struct { - Value []byte `protobuf:"bytes,7,opt,name=value,proto3,oneof" json:"value,omitempty"` -} -type Compare_Lease struct { - Lease int64 `protobuf:"varint,8,opt,name=lease,proto3,oneof" json:"lease,omitempty"` +// Deprecated: Use Compare.ProtoReflect.Descriptor instead. +func (*Compare) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{9} } -func (*Compare_Version) isCompare_TargetUnion() {} -func (*Compare_CreateRevision) isCompare_TargetUnion() {} -func (*Compare_ModRevision) isCompare_TargetUnion() {} -func (*Compare_Value) isCompare_TargetUnion() {} -func (*Compare_Lease) isCompare_TargetUnion() {} - -func (m *Compare) GetTargetUnion() isCompare_TargetUnion { - if m != nil { - return m.TargetUnion +func (x *Compare) GetResult() Compare_CompareResult { + if x != nil { + return x.Result } - return nil + return Compare_EQUAL } -func (m *Compare) GetResult() Compare_CompareResult { - if m != nil { - return m.Result +func (x *Compare) GetTarget() Compare_CompareTarget { + if x != nil { + return x.Target } - return Compare_EQUAL + return Compare_VERSION } -func (m *Compare) GetTarget() Compare_CompareTarget { - if m != nil { - return m.Target +func (x *Compare) GetKey() []byte { + if x != nil { + return x.Key } - return Compare_VERSION + return nil } -func (m *Compare) GetKey() []byte { - if m != nil { - return m.Key +func (x *Compare) GetTargetUnion() isCompare_TargetUnion { + if x != nil { + return x.TargetUnion } return nil } -func (m *Compare) GetVersion() int64 { - if x, ok := m.GetTargetUnion().(*Compare_Version); ok { - return x.Version +func (x *Compare) GetVersion() int64 { + if x != nil { + if x, ok := x.TargetUnion.(*Compare_Version); ok { + return x.Version + } } return 0 } -func (m *Compare) GetCreateRevision() int64 { - if x, ok := m.GetTargetUnion().(*Compare_CreateRevision); ok { - return x.CreateRevision +func (x *Compare) GetCreateRevision() int64 { + if x != nil { + if x, ok := x.TargetUnion.(*Compare_CreateRevision); ok { + return x.CreateRevision + } } return 0 } -func (m *Compare) GetModRevision() int64 { - if x, ok := m.GetTargetUnion().(*Compare_ModRevision); ok { - return x.ModRevision +func (x *Compare) GetModRevision() int64 { + if x != nil { + if x, ok := x.TargetUnion.(*Compare_ModRevision); ok { + return x.ModRevision + } } return 0 } -func (m *Compare) GetValue() []byte { - if x, ok := m.GetTargetUnion().(*Compare_Value); ok { - return x.Value +func (x *Compare) GetValue() []byte { + if x != nil { + if x, ok := x.TargetUnion.(*Compare_Value); ok { + return x.Value + } } return nil } -func (m *Compare) GetLease() int64 { - if x, ok := m.GetTargetUnion().(*Compare_Lease); ok { - return x.Lease +func (x *Compare) GetLease() int64 { + if x != nil { + if x, ok := x.TargetUnion.(*Compare_Lease); ok { + return x.Lease + } } return 0 } -func (m *Compare) GetRangeEnd() []byte { - if m != nil { - return m.RangeEnd +func (x *Compare) GetRangeEnd() []byte { + if x != nil { + return x.RangeEnd } return nil } -// XXX_OneofWrappers is for the internal use of the proto package. -func (*Compare) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*Compare_Version)(nil), - (*Compare_CreateRevision)(nil), - (*Compare_ModRevision)(nil), - (*Compare_Value)(nil), - (*Compare_Lease)(nil), - } +type isCompare_TargetUnion interface { + isCompare_TargetUnion() +} + +type Compare_Version struct { + // version is the version of the given key + Version int64 `protobuf:"varint,4,opt,name=version,proto3,oneof"` +} + +type Compare_CreateRevision struct { + // create_revision is the creation revision of the given key + CreateRevision int64 `protobuf:"varint,5,opt,name=create_revision,json=createRevision,proto3,oneof"` +} + +type Compare_ModRevision struct { + // mod_revision is the last modified revision of the given key. + ModRevision int64 `protobuf:"varint,6,opt,name=mod_revision,json=modRevision,proto3,oneof"` +} + +type Compare_Value struct { + // value is the value of the given key, in bytes. + Value []byte `protobuf:"bytes,7,opt,name=value,proto3,oneof"` +} + +type Compare_Lease struct { + // lease is the lease id of the given key. + Lease int64 `protobuf:"varint,8,opt,name=lease,proto3,oneof"` // leave room for more target_union field tags, jump to 64 } +func (*Compare_Version) isCompare_TargetUnion() {} + +func (*Compare_CreateRevision) isCompare_TargetUnion() {} + +func (*Compare_ModRevision) isCompare_TargetUnion() {} + +func (*Compare_Value) isCompare_TargetUnion() {} + +func (*Compare_Lease) isCompare_TargetUnion() {} + // From google paxosdb paper: // Our implementation hinges around a powerful primitive which we call MultiOp. All other database // operations except for iteration are implemented as a single call to MultiOp. A MultiOp is applied atomically @@ -1300,6 +1449,7 @@ func (*Compare) XXX_OneofWrappers() []interface{} { // true. // 3. A list of database operations called f op. Like t op, but executed if guard evaluates to false. type TxnRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // compare is a list of predicates representing a conjunction of terms. // If the comparisons succeed, then the success requests will be processed in order, // and the response will contain their respective responses in order. @@ -1309,128 +1459,121 @@ type TxnRequest struct { // success is a list of requests which will be applied when compare evaluates to true. Success []*RequestOp `protobuf:"bytes,2,rep,name=success,proto3" json:"success,omitempty"` // failure is a list of requests which will be applied when compare evaluates to false. - Failure []*RequestOp `protobuf:"bytes,3,rep,name=failure,proto3" json:"failure,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Failure []*RequestOp `protobuf:"bytes,3,rep,name=failure,proto3" json:"failure,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *TxnRequest) Reset() { *m = TxnRequest{} } -func (m *TxnRequest) String() string { return proto.CompactTextString(m) } -func (*TxnRequest) ProtoMessage() {} -func (*TxnRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{10} -} -func (m *TxnRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TxnRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TxnRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *TxnRequest) Reset() { + *x = TxnRequest{} + mi := &file_rpc_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *TxnRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_TxnRequest.Merge(m, src) -} -func (m *TxnRequest) XXX_Size() int { - return m.Size() + +func (x *TxnRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TxnRequest) XXX_DiscardUnknown() { - xxx_messageInfo_TxnRequest.DiscardUnknown(m) + +func (*TxnRequest) ProtoMessage() {} + +func (x *TxnRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TxnRequest proto.InternalMessageInfo +// Deprecated: Use TxnRequest.ProtoReflect.Descriptor instead. +func (*TxnRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{10} +} -func (m *TxnRequest) GetCompare() []*Compare { - if m != nil { - return m.Compare +func (x *TxnRequest) GetCompare() []*Compare { + if x != nil { + return x.Compare } return nil } -func (m *TxnRequest) GetSuccess() []*RequestOp { - if m != nil { - return m.Success +func (x *TxnRequest) GetSuccess() []*RequestOp { + if x != nil { + return x.Success } return nil } -func (m *TxnRequest) GetFailure() []*RequestOp { - if m != nil { - return m.Failure +func (x *TxnRequest) GetFailure() []*RequestOp { + if x != nil { + return x.Failure } return nil } type TxnResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // succeeded is set to true if the compare evaluated to true or false otherwise. Succeeded bool `protobuf:"varint,2,opt,name=succeeded,proto3" json:"succeeded,omitempty"` // responses is a list of responses corresponding to the results from applying // success if succeeded is true or failure if succeeded is false. - Responses []*ResponseOp `protobuf:"bytes,3,rep,name=responses,proto3" json:"responses,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Responses []*ResponseOp `protobuf:"bytes,3,rep,name=responses,proto3" json:"responses,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *TxnResponse) Reset() { *m = TxnResponse{} } -func (m *TxnResponse) String() string { return proto.CompactTextString(m) } -func (*TxnResponse) ProtoMessage() {} -func (*TxnResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{11} -} -func (m *TxnResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TxnResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TxnResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *TxnResponse) Reset() { + *x = TxnResponse{} + mi := &file_rpc_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *TxnResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_TxnResponse.Merge(m, src) -} -func (m *TxnResponse) XXX_Size() int { - return m.Size() + +func (x *TxnResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TxnResponse) XXX_DiscardUnknown() { - xxx_messageInfo_TxnResponse.DiscardUnknown(m) + +func (*TxnResponse) ProtoMessage() {} + +func (x *TxnResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TxnResponse proto.InternalMessageInfo +// Deprecated: Use TxnResponse.ProtoReflect.Descriptor instead. +func (*TxnResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{11} +} -func (m *TxnResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *TxnResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *TxnResponse) GetSucceeded() bool { - if m != nil { - return m.Succeeded +func (x *TxnResponse) GetSucceeded() bool { + if x != nil { + return x.Succeeded } return false } -func (m *TxnResponse) GetResponses() []*ResponseOp { - if m != nil { - return m.Responses +func (x *TxnResponse) GetResponses() []*ResponseOp { + if x != nil { + return x.Responses } return nil } @@ -1438,368 +1581,348 @@ func (m *TxnResponse) GetResponses() []*ResponseOp { // CompactionRequest compacts the key-value store up to a given revision. All superseded keys // with a revision less than the compaction revision will be removed. type CompactionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // revision is the key-value store revision for the compaction operation. Revision int64 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"` // physical is set so the RPC will wait until the compaction is physically // applied to the local database such that compacted entries are totally // removed from the backend database. - Physical bool `protobuf:"varint,2,opt,name=physical,proto3" json:"physical,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Physical bool `protobuf:"varint,2,opt,name=physical,proto3" json:"physical,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *CompactionRequest) Reset() { *m = CompactionRequest{} } -func (m *CompactionRequest) String() string { return proto.CompactTextString(m) } -func (*CompactionRequest) ProtoMessage() {} -func (*CompactionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{12} -} -func (m *CompactionRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CompactionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CompactionRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CompactionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompactionRequest.Merge(m, src) +func (x *CompactionRequest) Reset() { + *x = CompactionRequest{} + mi := &file_rpc_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *CompactionRequest) XXX_Size() int { - return m.Size() + +func (x *CompactionRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CompactionRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CompactionRequest.DiscardUnknown(m) + +func (*CompactionRequest) ProtoMessage() {} + +func (x *CompactionRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_CompactionRequest proto.InternalMessageInfo +// Deprecated: Use CompactionRequest.ProtoReflect.Descriptor instead. +func (*CompactionRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{12} +} -func (m *CompactionRequest) GetRevision() int64 { - if m != nil { - return m.Revision +func (x *CompactionRequest) GetRevision() int64 { + if x != nil { + return x.Revision } return 0 } -func (m *CompactionRequest) GetPhysical() bool { - if m != nil { - return m.Physical +func (x *CompactionRequest) GetPhysical() bool { + if x != nil { + return x.Physical } return false } type CompactionResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *CompactionResponse) Reset() { *m = CompactionResponse{} } -func (m *CompactionResponse) String() string { return proto.CompactTextString(m) } -func (*CompactionResponse) ProtoMessage() {} -func (*CompactionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{13} -} -func (m *CompactionResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CompactionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CompactionResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *CompactionResponse) Reset() { + *x = CompactionResponse{} + mi := &file_rpc_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *CompactionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompactionResponse.Merge(m, src) -} -func (m *CompactionResponse) XXX_Size() int { - return m.Size() + +func (x *CompactionResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CompactionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CompactionResponse.DiscardUnknown(m) + +func (*CompactionResponse) ProtoMessage() {} + +func (x *CompactionResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_CompactionResponse proto.InternalMessageInfo +// Deprecated: Use CompactionResponse.ProtoReflect.Descriptor instead. +func (*CompactionResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{13} +} -func (m *CompactionResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *CompactionResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } type HashRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *HashRequest) Reset() { *m = HashRequest{} } -func (m *HashRequest) String() string { return proto.CompactTextString(m) } -func (*HashRequest) ProtoMessage() {} -func (*HashRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{14} -} -func (m *HashRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HashRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HashRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *HashRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_HashRequest.Merge(m, src) +func (x *HashRequest) Reset() { + *x = HashRequest{} + mi := &file_rpc_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *HashRequest) XXX_Size() int { - return m.Size() + +func (x *HashRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *HashRequest) XXX_DiscardUnknown() { - xxx_messageInfo_HashRequest.DiscardUnknown(m) + +func (*HashRequest) ProtoMessage() {} + +func (x *HashRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_HashRequest proto.InternalMessageInfo +// Deprecated: Use HashRequest.ProtoReflect.Descriptor instead. +func (*HashRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{14} +} type HashKVRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // revision is the key-value store revision for the hash operation. - Revision int64 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Revision int64 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *HashKVRequest) Reset() { *m = HashKVRequest{} } -func (m *HashKVRequest) String() string { return proto.CompactTextString(m) } -func (*HashKVRequest) ProtoMessage() {} -func (*HashKVRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{15} -} -func (m *HashKVRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HashKVRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HashKVRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *HashKVRequest) Reset() { + *x = HashKVRequest{} + mi := &file_rpc_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *HashKVRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_HashKVRequest.Merge(m, src) -} -func (m *HashKVRequest) XXX_Size() int { - return m.Size() + +func (x *HashKVRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *HashKVRequest) XXX_DiscardUnknown() { - xxx_messageInfo_HashKVRequest.DiscardUnknown(m) + +func (*HashKVRequest) ProtoMessage() {} + +func (x *HashKVRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_HashKVRequest proto.InternalMessageInfo +// Deprecated: Use HashKVRequest.ProtoReflect.Descriptor instead. +func (*HashKVRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{15} +} -func (m *HashKVRequest) GetRevision() int64 { - if m != nil { - return m.Revision +func (x *HashKVRequest) GetRevision() int64 { + if x != nil { + return x.Revision } return 0 } type HashKVResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // hash is the hash value computed from the responding member's MVCC keys up to a given revision. Hash uint32 `protobuf:"varint,2,opt,name=hash,proto3" json:"hash,omitempty"` // compact_revision is the compacted revision of key-value store when hash begins. CompactRevision int64 `protobuf:"varint,3,opt,name=compact_revision,json=compactRevision,proto3" json:"compact_revision,omitempty"` // hash_revision is the revision up to which the hash is calculated. - HashRevision int64 `protobuf:"varint,4,opt,name=hash_revision,json=hashRevision,proto3" json:"hash_revision,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + HashRevision int64 `protobuf:"varint,4,opt,name=hash_revision,json=hashRevision,proto3" json:"hash_revision,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *HashKVResponse) Reset() { *m = HashKVResponse{} } -func (m *HashKVResponse) String() string { return proto.CompactTextString(m) } -func (*HashKVResponse) ProtoMessage() {} -func (*HashKVResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{16} -} -func (m *HashKVResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HashKVResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HashKVResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *HashKVResponse) Reset() { + *x = HashKVResponse{} + mi := &file_rpc_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *HashKVResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_HashKVResponse.Merge(m, src) -} -func (m *HashKVResponse) XXX_Size() int { - return m.Size() + +func (x *HashKVResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *HashKVResponse) XXX_DiscardUnknown() { - xxx_messageInfo_HashKVResponse.DiscardUnknown(m) + +func (*HashKVResponse) ProtoMessage() {} + +func (x *HashKVResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_HashKVResponse proto.InternalMessageInfo +// Deprecated: Use HashKVResponse.ProtoReflect.Descriptor instead. +func (*HashKVResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{16} +} -func (m *HashKVResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *HashKVResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *HashKVResponse) GetHash() uint32 { - if m != nil { - return m.Hash +func (x *HashKVResponse) GetHash() uint32 { + if x != nil { + return x.Hash } return 0 } -func (m *HashKVResponse) GetCompactRevision() int64 { - if m != nil { - return m.CompactRevision +func (x *HashKVResponse) GetCompactRevision() int64 { + if x != nil { + return x.CompactRevision } return 0 } -func (m *HashKVResponse) GetHashRevision() int64 { - if m != nil { - return m.HashRevision +func (x *HashKVResponse) GetHashRevision() int64 { + if x != nil { + return x.HashRevision } return 0 } type HashResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // hash is the hash value computed from the responding member's KV's backend. - Hash uint32 `protobuf:"varint,2,opt,name=hash,proto3" json:"hash,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Hash uint32 `protobuf:"varint,2,opt,name=hash,proto3" json:"hash,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *HashResponse) Reset() { *m = HashResponse{} } -func (m *HashResponse) String() string { return proto.CompactTextString(m) } -func (*HashResponse) ProtoMessage() {} -func (*HashResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{17} -} -func (m *HashResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HashResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HashResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *HashResponse) Reset() { + *x = HashResponse{} + mi := &file_rpc_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *HashResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_HashResponse.Merge(m, src) -} -func (m *HashResponse) XXX_Size() int { - return m.Size() + +func (x *HashResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *HashResponse) XXX_DiscardUnknown() { - xxx_messageInfo_HashResponse.DiscardUnknown(m) + +func (*HashResponse) ProtoMessage() {} + +func (x *HashResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_HashResponse proto.InternalMessageInfo +// Deprecated: Use HashResponse.ProtoReflect.Descriptor instead. +func (*HashResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{17} +} -func (m *HashResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *HashResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *HashResponse) GetHash() uint32 { - if m != nil { - return m.Hash +func (x *HashResponse) GetHash() uint32 { + if x != nil { + return x.Hash } return 0 } type SnapshotRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *SnapshotRequest) Reset() { *m = SnapshotRequest{} } -func (m *SnapshotRequest) String() string { return proto.CompactTextString(m) } -func (*SnapshotRequest) ProtoMessage() {} -func (*SnapshotRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{18} -} -func (m *SnapshotRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SnapshotRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SnapshotRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SnapshotRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SnapshotRequest.Merge(m, src) +func (x *SnapshotRequest) Reset() { + *x = SnapshotRequest{} + mi := &file_rpc_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *SnapshotRequest) XXX_Size() int { - return m.Size() + +func (x *SnapshotRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *SnapshotRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SnapshotRequest.DiscardUnknown(m) + +func (*SnapshotRequest) ProtoMessage() {} + +func (x *SnapshotRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_SnapshotRequest proto.InternalMessageInfo +// Deprecated: Use SnapshotRequest.ProtoReflect.Descriptor instead. +func (*SnapshotRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{18} +} type SnapshotResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` // header has the current key-value store information. The first header in the snapshot // stream indicates the point in time of the snapshot. Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` @@ -1810,177 +1933,171 @@ type SnapshotResponse struct { // local version of server that created the snapshot. // In cluster with binaries with different version, each cluster can return different result. // Informs which etcd server version should be used when restoring the snapshot. - Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *SnapshotResponse) Reset() { *m = SnapshotResponse{} } -func (m *SnapshotResponse) String() string { return proto.CompactTextString(m) } -func (*SnapshotResponse) ProtoMessage() {} -func (*SnapshotResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{19} -} -func (m *SnapshotResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SnapshotResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SnapshotResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *SnapshotResponse) Reset() { + *x = SnapshotResponse{} + mi := &file_rpc_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *SnapshotResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SnapshotResponse.Merge(m, src) -} -func (m *SnapshotResponse) XXX_Size() int { - return m.Size() + +func (x *SnapshotResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *SnapshotResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SnapshotResponse.DiscardUnknown(m) + +func (*SnapshotResponse) ProtoMessage() {} + +func (x *SnapshotResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_SnapshotResponse proto.InternalMessageInfo +// Deprecated: Use SnapshotResponse.ProtoReflect.Descriptor instead. +func (*SnapshotResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{19} +} -func (m *SnapshotResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *SnapshotResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *SnapshotResponse) GetRemainingBytes() uint64 { - if m != nil { - return m.RemainingBytes +func (x *SnapshotResponse) GetRemainingBytes() uint64 { + if x != nil { + return x.RemainingBytes } return 0 } -func (m *SnapshotResponse) GetBlob() []byte { - if m != nil { - return m.Blob +func (x *SnapshotResponse) GetBlob() []byte { + if x != nil { + return x.Blob } return nil } -func (m *SnapshotResponse) GetVersion() string { - if m != nil { - return m.Version +func (x *SnapshotResponse) GetVersion() string { + if x != nil { + return x.Version } return "" } type WatchRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // request_union is a request to either create a new watcher or cancel an existing watcher. // // Types that are valid to be assigned to RequestUnion: + // // *WatchRequest_CreateRequest // *WatchRequest_CancelRequest // *WatchRequest_ProgressRequest - RequestUnion isWatchRequest_RequestUnion `protobuf_oneof:"request_union"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + RequestUnion isWatchRequest_RequestUnion `protobuf_oneof:"request_union"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *WatchRequest) Reset() { *m = WatchRequest{} } -func (m *WatchRequest) String() string { return proto.CompactTextString(m) } -func (*WatchRequest) ProtoMessage() {} -func (*WatchRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{20} -} -func (m *WatchRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *WatchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_WatchRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *WatchRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_WatchRequest.Merge(m, src) +func (x *WatchRequest) Reset() { + *x = WatchRequest{} + mi := &file_rpc_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *WatchRequest) XXX_Size() int { - return m.Size() -} -func (m *WatchRequest) XXX_DiscardUnknown() { - xxx_messageInfo_WatchRequest.DiscardUnknown(m) + +func (x *WatchRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_WatchRequest proto.InternalMessageInfo +func (*WatchRequest) ProtoMessage() {} -type isWatchRequest_RequestUnion interface { - isWatchRequest_RequestUnion() - MarshalTo([]byte) (int, error) - Size() int +func (x *WatchRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -type WatchRequest_CreateRequest struct { - CreateRequest *WatchCreateRequest `protobuf:"bytes,1,opt,name=create_request,json=createRequest,proto3,oneof" json:"create_request,omitempty"` -} -type WatchRequest_CancelRequest struct { - CancelRequest *WatchCancelRequest `protobuf:"bytes,2,opt,name=cancel_request,json=cancelRequest,proto3,oneof" json:"cancel_request,omitempty"` -} -type WatchRequest_ProgressRequest struct { - ProgressRequest *WatchProgressRequest `protobuf:"bytes,3,opt,name=progress_request,json=progressRequest,proto3,oneof" json:"progress_request,omitempty"` +// Deprecated: Use WatchRequest.ProtoReflect.Descriptor instead. +func (*WatchRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{20} } -func (*WatchRequest_CreateRequest) isWatchRequest_RequestUnion() {} -func (*WatchRequest_CancelRequest) isWatchRequest_RequestUnion() {} -func (*WatchRequest_ProgressRequest) isWatchRequest_RequestUnion() {} - -func (m *WatchRequest) GetRequestUnion() isWatchRequest_RequestUnion { - if m != nil { - return m.RequestUnion +func (x *WatchRequest) GetRequestUnion() isWatchRequest_RequestUnion { + if x != nil { + return x.RequestUnion } return nil } -func (m *WatchRequest) GetCreateRequest() *WatchCreateRequest { - if x, ok := m.GetRequestUnion().(*WatchRequest_CreateRequest); ok { - return x.CreateRequest +func (x *WatchRequest) GetCreateRequest() *WatchCreateRequest { + if x != nil { + if x, ok := x.RequestUnion.(*WatchRequest_CreateRequest); ok { + return x.CreateRequest + } } return nil } -func (m *WatchRequest) GetCancelRequest() *WatchCancelRequest { - if x, ok := m.GetRequestUnion().(*WatchRequest_CancelRequest); ok { - return x.CancelRequest +func (x *WatchRequest) GetCancelRequest() *WatchCancelRequest { + if x != nil { + if x, ok := x.RequestUnion.(*WatchRequest_CancelRequest); ok { + return x.CancelRequest + } } return nil } -func (m *WatchRequest) GetProgressRequest() *WatchProgressRequest { - if x, ok := m.GetRequestUnion().(*WatchRequest_ProgressRequest); ok { - return x.ProgressRequest +func (x *WatchRequest) GetProgressRequest() *WatchProgressRequest { + if x != nil { + if x, ok := x.RequestUnion.(*WatchRequest_ProgressRequest); ok { + return x.ProgressRequest + } } return nil } -// XXX_OneofWrappers is for the internal use of the proto package. -func (*WatchRequest) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*WatchRequest_CreateRequest)(nil), - (*WatchRequest_CancelRequest)(nil), - (*WatchRequest_ProgressRequest)(nil), - } +type isWatchRequest_RequestUnion interface { + isWatchRequest_RequestUnion() +} + +type WatchRequest_CreateRequest struct { + CreateRequest *WatchCreateRequest `protobuf:"bytes,1,opt,name=create_request,json=createRequest,proto3,oneof"` } +type WatchRequest_CancelRequest struct { + CancelRequest *WatchCancelRequest `protobuf:"bytes,2,opt,name=cancel_request,json=cancelRequest,proto3,oneof"` +} + +type WatchRequest_ProgressRequest struct { + ProgressRequest *WatchProgressRequest `protobuf:"bytes,3,opt,name=progress_request,json=progressRequest,proto3,oneof"` +} + +func (*WatchRequest_CreateRequest) isWatchRequest_RequestUnion() {} + +func (*WatchRequest_CancelRequest) isWatchRequest_RequestUnion() {} + +func (*WatchRequest_ProgressRequest) isWatchRequest_RequestUnion() {} + type WatchCreateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // key is the key to register for watching. Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // range_end is the end of the range [key, range_end) to watch. If range_end is not given, @@ -2008,145 +2125,138 @@ type WatchCreateRequest struct { // use on the stream will cause an error to be returned. WatchId int64 `protobuf:"varint,7,opt,name=watch_id,json=watchId,proto3" json:"watch_id,omitempty"` // fragment enables splitting large revisions into multiple watch responses. - Fragment bool `protobuf:"varint,8,opt,name=fragment,proto3" json:"fragment,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Fragment bool `protobuf:"varint,8,opt,name=fragment,proto3" json:"fragment,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *WatchCreateRequest) Reset() { *m = WatchCreateRequest{} } -func (m *WatchCreateRequest) String() string { return proto.CompactTextString(m) } -func (*WatchCreateRequest) ProtoMessage() {} -func (*WatchCreateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{21} -} -func (m *WatchCreateRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *WatchCreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_WatchCreateRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *WatchCreateRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_WatchCreateRequest.Merge(m, src) +func (x *WatchCreateRequest) Reset() { + *x = WatchCreateRequest{} + mi := &file_rpc_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *WatchCreateRequest) XXX_Size() int { - return m.Size() + +func (x *WatchCreateRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WatchCreateRequest) XXX_DiscardUnknown() { - xxx_messageInfo_WatchCreateRequest.DiscardUnknown(m) + +func (*WatchCreateRequest) ProtoMessage() {} + +func (x *WatchCreateRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WatchCreateRequest proto.InternalMessageInfo +// Deprecated: Use WatchCreateRequest.ProtoReflect.Descriptor instead. +func (*WatchCreateRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{21} +} -func (m *WatchCreateRequest) GetKey() []byte { - if m != nil { - return m.Key +func (x *WatchCreateRequest) GetKey() []byte { + if x != nil { + return x.Key } return nil } -func (m *WatchCreateRequest) GetRangeEnd() []byte { - if m != nil { - return m.RangeEnd +func (x *WatchCreateRequest) GetRangeEnd() []byte { + if x != nil { + return x.RangeEnd } return nil } -func (m *WatchCreateRequest) GetStartRevision() int64 { - if m != nil { - return m.StartRevision +func (x *WatchCreateRequest) GetStartRevision() int64 { + if x != nil { + return x.StartRevision } return 0 } -func (m *WatchCreateRequest) GetProgressNotify() bool { - if m != nil { - return m.ProgressNotify +func (x *WatchCreateRequest) GetProgressNotify() bool { + if x != nil { + return x.ProgressNotify } return false } -func (m *WatchCreateRequest) GetFilters() []WatchCreateRequest_FilterType { - if m != nil { - return m.Filters +func (x *WatchCreateRequest) GetFilters() []WatchCreateRequest_FilterType { + if x != nil { + return x.Filters } return nil } -func (m *WatchCreateRequest) GetPrevKv() bool { - if m != nil { - return m.PrevKv +func (x *WatchCreateRequest) GetPrevKv() bool { + if x != nil { + return x.PrevKv } return false } -func (m *WatchCreateRequest) GetWatchId() int64 { - if m != nil { - return m.WatchId +func (x *WatchCreateRequest) GetWatchId() int64 { + if x != nil { + return x.WatchId } return 0 } -func (m *WatchCreateRequest) GetFragment() bool { - if m != nil { - return m.Fragment +func (x *WatchCreateRequest) GetFragment() bool { + if x != nil { + return x.Fragment } return false } type WatchCancelRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // watch_id is the watcher id to cancel so that no more events are transmitted. - WatchId int64 `protobuf:"varint,1,opt,name=watch_id,json=watchId,proto3" json:"watch_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + WatchId int64 `protobuf:"varint,1,opt,name=watch_id,json=watchId,proto3" json:"watch_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *WatchCancelRequest) Reset() { *m = WatchCancelRequest{} } -func (m *WatchCancelRequest) String() string { return proto.CompactTextString(m) } -func (*WatchCancelRequest) ProtoMessage() {} -func (*WatchCancelRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{22} -} -func (m *WatchCancelRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *WatchCancelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_WatchCancelRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *WatchCancelRequest) Reset() { + *x = WatchCancelRequest{} + mi := &file_rpc_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *WatchCancelRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_WatchCancelRequest.Merge(m, src) -} -func (m *WatchCancelRequest) XXX_Size() int { - return m.Size() + +func (x *WatchCancelRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WatchCancelRequest) XXX_DiscardUnknown() { - xxx_messageInfo_WatchCancelRequest.DiscardUnknown(m) + +func (*WatchCancelRequest) ProtoMessage() {} + +func (x *WatchCancelRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WatchCancelRequest proto.InternalMessageInfo +// Deprecated: Use WatchCancelRequest.ProtoReflect.Descriptor instead. +func (*WatchCancelRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{22} +} -func (m *WatchCancelRequest) GetWatchId() int64 { - if m != nil { - return m.WatchId +func (x *WatchCancelRequest) GetWatchId() int64 { + if x != nil { + return x.WatchId } return 0 } @@ -2154,46 +2264,44 @@ func (m *WatchCancelRequest) GetWatchId() int64 { // Requests the a watch stream progress status be sent in the watch response stream as soon as // possible. type WatchProgressRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *WatchProgressRequest) Reset() { *m = WatchProgressRequest{} } -func (m *WatchProgressRequest) String() string { return proto.CompactTextString(m) } -func (*WatchProgressRequest) ProtoMessage() {} -func (*WatchProgressRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{23} -} -func (m *WatchProgressRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *WatchProgressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_WatchProgressRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *WatchProgressRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_WatchProgressRequest.Merge(m, src) +func (x *WatchProgressRequest) Reset() { + *x = WatchProgressRequest{} + mi := &file_rpc_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *WatchProgressRequest) XXX_Size() int { - return m.Size() + +func (x *WatchProgressRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WatchProgressRequest) XXX_DiscardUnknown() { - xxx_messageInfo_WatchProgressRequest.DiscardUnknown(m) + +func (*WatchProgressRequest) ProtoMessage() {} + +func (x *WatchProgressRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WatchProgressRequest proto.InternalMessageInfo +// Deprecated: Use WatchProgressRequest.ProtoReflect.Descriptor instead. +func (*WatchProgressRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{23} +} type WatchResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // watch_id is the ID of the watcher that corresponds to the response. WatchId int64 `protobuf:"varint,2,opt,name=watch_id,json=watchId,proto3" json:"watch_id,omitempty"` // created is set to true if the response is for a create watch request. @@ -2217,650 +2325,617 @@ type WatchResponse struct { // cancel_reason indicates the reason for canceling the watcher. CancelReason string `protobuf:"bytes,6,opt,name=cancel_reason,json=cancelReason,proto3" json:"cancel_reason,omitempty"` // framgment is true if large watch response was split over multiple responses. - Fragment bool `protobuf:"varint,7,opt,name=fragment,proto3" json:"fragment,omitempty"` - Events []*mvccpb.Event `protobuf:"bytes,11,rep,name=events,proto3" json:"events,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Fragment bool `protobuf:"varint,7,opt,name=fragment,proto3" json:"fragment,omitempty"` + Events []*mvccpb.Event `protobuf:"bytes,11,rep,name=events,proto3" json:"events,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *WatchResponse) Reset() { *m = WatchResponse{} } -func (m *WatchResponse) String() string { return proto.CompactTextString(m) } -func (*WatchResponse) ProtoMessage() {} -func (*WatchResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{24} -} -func (m *WatchResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *WatchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_WatchResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *WatchResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_WatchResponse.Merge(m, src) +func (x *WatchResponse) Reset() { + *x = WatchResponse{} + mi := &file_rpc_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *WatchResponse) XXX_Size() int { - return m.Size() + +func (x *WatchResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WatchResponse) XXX_DiscardUnknown() { - xxx_messageInfo_WatchResponse.DiscardUnknown(m) + +func (*WatchResponse) ProtoMessage() {} + +func (x *WatchResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WatchResponse proto.InternalMessageInfo +// Deprecated: Use WatchResponse.ProtoReflect.Descriptor instead. +func (*WatchResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{24} +} -func (m *WatchResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *WatchResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *WatchResponse) GetWatchId() int64 { - if m != nil { - return m.WatchId +func (x *WatchResponse) GetWatchId() int64 { + if x != nil { + return x.WatchId } return 0 } -func (m *WatchResponse) GetCreated() bool { - if m != nil { - return m.Created +func (x *WatchResponse) GetCreated() bool { + if x != nil { + return x.Created } return false } -func (m *WatchResponse) GetCanceled() bool { - if m != nil { - return m.Canceled +func (x *WatchResponse) GetCanceled() bool { + if x != nil { + return x.Canceled } return false } -func (m *WatchResponse) GetCompactRevision() int64 { - if m != nil { - return m.CompactRevision +func (x *WatchResponse) GetCompactRevision() int64 { + if x != nil { + return x.CompactRevision } return 0 } -func (m *WatchResponse) GetCancelReason() string { - if m != nil { - return m.CancelReason +func (x *WatchResponse) GetCancelReason() string { + if x != nil { + return x.CancelReason } return "" } -func (m *WatchResponse) GetFragment() bool { - if m != nil { - return m.Fragment +func (x *WatchResponse) GetFragment() bool { + if x != nil { + return x.Fragment } return false } -func (m *WatchResponse) GetEvents() []*mvccpb.Event { - if m != nil { - return m.Events +func (x *WatchResponse) GetEvents() []*mvccpb.Event { + if x != nil { + return x.Events } return nil } type LeaseGrantRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // TTL is the advisory time-to-live in seconds. Expired lease will return -1. TTL int64 `protobuf:"varint,1,opt,name=TTL,proto3" json:"TTL,omitempty"` // ID is the requested ID for the lease. If ID is set to 0, the lessor chooses an ID. - ID int64 `protobuf:"varint,2,opt,name=ID,proto3" json:"ID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ID int64 `protobuf:"varint,2,opt,name=ID,proto3" json:"ID,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *LeaseGrantRequest) Reset() { *m = LeaseGrantRequest{} } -func (m *LeaseGrantRequest) String() string { return proto.CompactTextString(m) } -func (*LeaseGrantRequest) ProtoMessage() {} -func (*LeaseGrantRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{25} -} -func (m *LeaseGrantRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LeaseGrantRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LeaseGrantRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *LeaseGrantRequest) Reset() { + *x = LeaseGrantRequest{} + mi := &file_rpc_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *LeaseGrantRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_LeaseGrantRequest.Merge(m, src) -} -func (m *LeaseGrantRequest) XXX_Size() int { - return m.Size() + +func (x *LeaseGrantRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *LeaseGrantRequest) XXX_DiscardUnknown() { - xxx_messageInfo_LeaseGrantRequest.DiscardUnknown(m) + +func (*LeaseGrantRequest) ProtoMessage() {} + +func (x *LeaseGrantRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_LeaseGrantRequest proto.InternalMessageInfo +// Deprecated: Use LeaseGrantRequest.ProtoReflect.Descriptor instead. +func (*LeaseGrantRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{25} +} -func (m *LeaseGrantRequest) GetTTL() int64 { - if m != nil { - return m.TTL +func (x *LeaseGrantRequest) GetTTL() int64 { + if x != nil { + return x.TTL } return 0 } -func (m *LeaseGrantRequest) GetID() int64 { - if m != nil { - return m.ID +func (x *LeaseGrantRequest) GetID() int64 { + if x != nil { + return x.ID } return 0 } type LeaseGrantResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // ID is the lease ID for the granted lease. ID int64 `protobuf:"varint,2,opt,name=ID,proto3" json:"ID,omitempty"` // TTL is the server chosen lease time-to-live in seconds. - TTL int64 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` - Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + TTL int64 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` + Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *LeaseGrantResponse) Reset() { *m = LeaseGrantResponse{} } -func (m *LeaseGrantResponse) String() string { return proto.CompactTextString(m) } -func (*LeaseGrantResponse) ProtoMessage() {} -func (*LeaseGrantResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{26} -} -func (m *LeaseGrantResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LeaseGrantResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LeaseGrantResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *LeaseGrantResponse) Reset() { + *x = LeaseGrantResponse{} + mi := &file_rpc_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *LeaseGrantResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_LeaseGrantResponse.Merge(m, src) -} -func (m *LeaseGrantResponse) XXX_Size() int { - return m.Size() + +func (x *LeaseGrantResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *LeaseGrantResponse) XXX_DiscardUnknown() { - xxx_messageInfo_LeaseGrantResponse.DiscardUnknown(m) + +func (*LeaseGrantResponse) ProtoMessage() {} + +func (x *LeaseGrantResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_LeaseGrantResponse proto.InternalMessageInfo +// Deprecated: Use LeaseGrantResponse.ProtoReflect.Descriptor instead. +func (*LeaseGrantResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{26} +} -func (m *LeaseGrantResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *LeaseGrantResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *LeaseGrantResponse) GetID() int64 { - if m != nil { - return m.ID +func (x *LeaseGrantResponse) GetID() int64 { + if x != nil { + return x.ID } return 0 } -func (m *LeaseGrantResponse) GetTTL() int64 { - if m != nil { - return m.TTL +func (x *LeaseGrantResponse) GetTTL() int64 { + if x != nil { + return x.TTL } return 0 } -func (m *LeaseGrantResponse) GetError() string { - if m != nil { - return m.Error +func (x *LeaseGrantResponse) GetError() string { + if x != nil { + return x.Error } return "" } type LeaseRevokeRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // ID is the lease ID to revoke. When the ID is revoked, all associated keys will be deleted. - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *LeaseRevokeRequest) Reset() { *m = LeaseRevokeRequest{} } -func (m *LeaseRevokeRequest) String() string { return proto.CompactTextString(m) } -func (*LeaseRevokeRequest) ProtoMessage() {} -func (*LeaseRevokeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{27} -} -func (m *LeaseRevokeRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LeaseRevokeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LeaseRevokeRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *LeaseRevokeRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_LeaseRevokeRequest.Merge(m, src) +func (x *LeaseRevokeRequest) Reset() { + *x = LeaseRevokeRequest{} + mi := &file_rpc_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *LeaseRevokeRequest) XXX_Size() int { - return m.Size() + +func (x *LeaseRevokeRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *LeaseRevokeRequest) XXX_DiscardUnknown() { - xxx_messageInfo_LeaseRevokeRequest.DiscardUnknown(m) + +func (*LeaseRevokeRequest) ProtoMessage() {} + +func (x *LeaseRevokeRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_LeaseRevokeRequest proto.InternalMessageInfo +// Deprecated: Use LeaseRevokeRequest.ProtoReflect.Descriptor instead. +func (*LeaseRevokeRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{27} +} -func (m *LeaseRevokeRequest) GetID() int64 { - if m != nil { - return m.ID +func (x *LeaseRevokeRequest) GetID() int64 { + if x != nil { + return x.ID } return 0 } type LeaseRevokeResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *LeaseRevokeResponse) Reset() { *m = LeaseRevokeResponse{} } -func (m *LeaseRevokeResponse) String() string { return proto.CompactTextString(m) } -func (*LeaseRevokeResponse) ProtoMessage() {} -func (*LeaseRevokeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{28} -} -func (m *LeaseRevokeResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LeaseRevokeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LeaseRevokeResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *LeaseRevokeResponse) Reset() { + *x = LeaseRevokeResponse{} + mi := &file_rpc_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *LeaseRevokeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_LeaseRevokeResponse.Merge(m, src) -} -func (m *LeaseRevokeResponse) XXX_Size() int { - return m.Size() + +func (x *LeaseRevokeResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *LeaseRevokeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_LeaseRevokeResponse.DiscardUnknown(m) + +func (*LeaseRevokeResponse) ProtoMessage() {} + +func (x *LeaseRevokeResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_LeaseRevokeResponse proto.InternalMessageInfo +// Deprecated: Use LeaseRevokeResponse.ProtoReflect.Descriptor instead. +func (*LeaseRevokeResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{28} +} -func (m *LeaseRevokeResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *LeaseRevokeResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } type LeaseCheckpoint struct { + state protoimpl.MessageState `protogen:"open.v1"` // ID is the lease ID to checkpoint. ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` // Remaining_TTL is the remaining time until expiry of the lease. - Remaining_TTL int64 `protobuf:"varint,2,opt,name=remaining_TTL,json=remainingTTL,proto3" json:"remaining_TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Remaining_TTL int64 `protobuf:"varint,2,opt,name=remaining_TTL,json=remainingTTL,proto3" json:"remaining_TTL,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *LeaseCheckpoint) Reset() { *m = LeaseCheckpoint{} } -func (m *LeaseCheckpoint) String() string { return proto.CompactTextString(m) } -func (*LeaseCheckpoint) ProtoMessage() {} -func (*LeaseCheckpoint) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{29} -} -func (m *LeaseCheckpoint) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LeaseCheckpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LeaseCheckpoint.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *LeaseCheckpoint) XXX_Merge(src proto.Message) { - xxx_messageInfo_LeaseCheckpoint.Merge(m, src) +func (x *LeaseCheckpoint) Reset() { + *x = LeaseCheckpoint{} + mi := &file_rpc_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *LeaseCheckpoint) XXX_Size() int { - return m.Size() + +func (x *LeaseCheckpoint) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *LeaseCheckpoint) XXX_DiscardUnknown() { - xxx_messageInfo_LeaseCheckpoint.DiscardUnknown(m) + +func (*LeaseCheckpoint) ProtoMessage() {} + +func (x *LeaseCheckpoint) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[29] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_LeaseCheckpoint proto.InternalMessageInfo +// Deprecated: Use LeaseCheckpoint.ProtoReflect.Descriptor instead. +func (*LeaseCheckpoint) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{29} +} -func (m *LeaseCheckpoint) GetID() int64 { - if m != nil { - return m.ID +func (x *LeaseCheckpoint) GetID() int64 { + if x != nil { + return x.ID } return 0 } -func (m *LeaseCheckpoint) GetRemaining_TTL() int64 { - if m != nil { - return m.Remaining_TTL +func (x *LeaseCheckpoint) GetRemaining_TTL() int64 { + if x != nil { + return x.Remaining_TTL } return 0 } type LeaseCheckpointRequest struct { - Checkpoints []*LeaseCheckpoint `protobuf:"bytes,1,rep,name=checkpoints,proto3" json:"checkpoints,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + Checkpoints []*LeaseCheckpoint `protobuf:"bytes,1,rep,name=checkpoints,proto3" json:"checkpoints,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *LeaseCheckpointRequest) Reset() { *m = LeaseCheckpointRequest{} } -func (m *LeaseCheckpointRequest) String() string { return proto.CompactTextString(m) } -func (*LeaseCheckpointRequest) ProtoMessage() {} -func (*LeaseCheckpointRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{30} -} -func (m *LeaseCheckpointRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LeaseCheckpointRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LeaseCheckpointRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *LeaseCheckpointRequest) Reset() { + *x = LeaseCheckpointRequest{} + mi := &file_rpc_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *LeaseCheckpointRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_LeaseCheckpointRequest.Merge(m, src) -} -func (m *LeaseCheckpointRequest) XXX_Size() int { - return m.Size() + +func (x *LeaseCheckpointRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *LeaseCheckpointRequest) XXX_DiscardUnknown() { - xxx_messageInfo_LeaseCheckpointRequest.DiscardUnknown(m) + +func (*LeaseCheckpointRequest) ProtoMessage() {} + +func (x *LeaseCheckpointRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_LeaseCheckpointRequest proto.InternalMessageInfo +// Deprecated: Use LeaseCheckpointRequest.ProtoReflect.Descriptor instead. +func (*LeaseCheckpointRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{30} +} -func (m *LeaseCheckpointRequest) GetCheckpoints() []*LeaseCheckpoint { - if m != nil { - return m.Checkpoints +func (x *LeaseCheckpointRequest) GetCheckpoints() []*LeaseCheckpoint { + if x != nil { + return x.Checkpoints } return nil } type LeaseCheckpointResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *LeaseCheckpointResponse) Reset() { *m = LeaseCheckpointResponse{} } -func (m *LeaseCheckpointResponse) String() string { return proto.CompactTextString(m) } -func (*LeaseCheckpointResponse) ProtoMessage() {} -func (*LeaseCheckpointResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{31} -} -func (m *LeaseCheckpointResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LeaseCheckpointResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LeaseCheckpointResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *LeaseCheckpointResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_LeaseCheckpointResponse.Merge(m, src) +func (x *LeaseCheckpointResponse) Reset() { + *x = LeaseCheckpointResponse{} + mi := &file_rpc_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *LeaseCheckpointResponse) XXX_Size() int { - return m.Size() + +func (x *LeaseCheckpointResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *LeaseCheckpointResponse) XXX_DiscardUnknown() { - xxx_messageInfo_LeaseCheckpointResponse.DiscardUnknown(m) + +func (*LeaseCheckpointResponse) ProtoMessage() {} + +func (x *LeaseCheckpointResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_LeaseCheckpointResponse proto.InternalMessageInfo +// Deprecated: Use LeaseCheckpointResponse.ProtoReflect.Descriptor instead. +func (*LeaseCheckpointResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{31} +} -func (m *LeaseCheckpointResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *LeaseCheckpointResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } type LeaseKeepAliveRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // ID is the lease ID for the lease to keep alive. - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *LeaseKeepAliveRequest) Reset() { *m = LeaseKeepAliveRequest{} } -func (m *LeaseKeepAliveRequest) String() string { return proto.CompactTextString(m) } -func (*LeaseKeepAliveRequest) ProtoMessage() {} -func (*LeaseKeepAliveRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{32} -} -func (m *LeaseKeepAliveRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LeaseKeepAliveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LeaseKeepAliveRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *LeaseKeepAliveRequest) Reset() { + *x = LeaseKeepAliveRequest{} + mi := &file_rpc_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *LeaseKeepAliveRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_LeaseKeepAliveRequest.Merge(m, src) -} -func (m *LeaseKeepAliveRequest) XXX_Size() int { - return m.Size() + +func (x *LeaseKeepAliveRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *LeaseKeepAliveRequest) XXX_DiscardUnknown() { - xxx_messageInfo_LeaseKeepAliveRequest.DiscardUnknown(m) + +func (*LeaseKeepAliveRequest) ProtoMessage() {} + +func (x *LeaseKeepAliveRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_LeaseKeepAliveRequest proto.InternalMessageInfo +// Deprecated: Use LeaseKeepAliveRequest.ProtoReflect.Descriptor instead. +func (*LeaseKeepAliveRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{32} +} -func (m *LeaseKeepAliveRequest) GetID() int64 { - if m != nil { - return m.ID +func (x *LeaseKeepAliveRequest) GetID() int64 { + if x != nil { + return x.ID } return 0 } type LeaseKeepAliveResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // ID is the lease ID from the keep alive request. ID int64 `protobuf:"varint,2,opt,name=ID,proto3" json:"ID,omitempty"` // TTL is the new time-to-live for the lease. - TTL int64 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + TTL int64 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *LeaseKeepAliveResponse) Reset() { *m = LeaseKeepAliveResponse{} } -func (m *LeaseKeepAliveResponse) String() string { return proto.CompactTextString(m) } -func (*LeaseKeepAliveResponse) ProtoMessage() {} -func (*LeaseKeepAliveResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{33} -} -func (m *LeaseKeepAliveResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LeaseKeepAliveResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LeaseKeepAliveResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *LeaseKeepAliveResponse) Reset() { + *x = LeaseKeepAliveResponse{} + mi := &file_rpc_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *LeaseKeepAliveResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_LeaseKeepAliveResponse.Merge(m, src) -} -func (m *LeaseKeepAliveResponse) XXX_Size() int { - return m.Size() + +func (x *LeaseKeepAliveResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *LeaseKeepAliveResponse) XXX_DiscardUnknown() { - xxx_messageInfo_LeaseKeepAliveResponse.DiscardUnknown(m) + +func (*LeaseKeepAliveResponse) ProtoMessage() {} + +func (x *LeaseKeepAliveResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[33] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_LeaseKeepAliveResponse proto.InternalMessageInfo +// Deprecated: Use LeaseKeepAliveResponse.ProtoReflect.Descriptor instead. +func (*LeaseKeepAliveResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{33} +} -func (m *LeaseKeepAliveResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *LeaseKeepAliveResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *LeaseKeepAliveResponse) GetID() int64 { - if m != nil { - return m.ID +func (x *LeaseKeepAliveResponse) GetID() int64 { + if x != nil { + return x.ID } return 0 } -func (m *LeaseKeepAliveResponse) GetTTL() int64 { - if m != nil { - return m.TTL +func (x *LeaseKeepAliveResponse) GetTTL() int64 { + if x != nil { + return x.TTL } return 0 } type LeaseTimeToLiveRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // ID is the lease ID for the lease. ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` // keys is true to query all the keys attached to this lease. - Keys bool `protobuf:"varint,2,opt,name=keys,proto3" json:"keys,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Keys bool `protobuf:"varint,2,opt,name=keys,proto3" json:"keys,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *LeaseTimeToLiveRequest) Reset() { *m = LeaseTimeToLiveRequest{} } -func (m *LeaseTimeToLiveRequest) String() string { return proto.CompactTextString(m) } -func (*LeaseTimeToLiveRequest) ProtoMessage() {} -func (*LeaseTimeToLiveRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{34} -} -func (m *LeaseTimeToLiveRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LeaseTimeToLiveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LeaseTimeToLiveRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *LeaseTimeToLiveRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_LeaseTimeToLiveRequest.Merge(m, src) +func (x *LeaseTimeToLiveRequest) Reset() { + *x = LeaseTimeToLiveRequest{} + mi := &file_rpc_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *LeaseTimeToLiveRequest) XXX_Size() int { - return m.Size() + +func (x *LeaseTimeToLiveRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *LeaseTimeToLiveRequest) XXX_DiscardUnknown() { - xxx_messageInfo_LeaseTimeToLiveRequest.DiscardUnknown(m) + +func (*LeaseTimeToLiveRequest) ProtoMessage() {} + +func (x *LeaseTimeToLiveRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[34] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_LeaseTimeToLiveRequest proto.InternalMessageInfo +// Deprecated: Use LeaseTimeToLiveRequest.ProtoReflect.Descriptor instead. +func (*LeaseTimeToLiveRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{34} +} -func (m *LeaseTimeToLiveRequest) GetID() int64 { - if m != nil { - return m.ID +func (x *LeaseTimeToLiveRequest) GetID() int64 { + if x != nil { + return x.ID } return 0 } -func (m *LeaseTimeToLiveRequest) GetKeys() bool { - if m != nil { - return m.Keys +func (x *LeaseTimeToLiveRequest) GetKeys() bool { + if x != nil { + return x.Keys } return false } type LeaseTimeToLiveResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // ID is the lease ID from the keep alive request. ID int64 `protobuf:"varint,2,opt,name=ID,proto3" json:"ID,omitempty"` // TTL is the remaining TTL in seconds for the lease; the lease will expire in under TTL+1 seconds. @@ -2868,222 +2943,210 @@ type LeaseTimeToLiveResponse struct { // GrantedTTL is the initial granted time in seconds upon lease creation/renewal. GrantedTTL int64 `protobuf:"varint,4,opt,name=grantedTTL,proto3" json:"grantedTTL,omitempty"` // Keys is the list of keys attached to this lease. - Keys [][]byte `protobuf:"bytes,5,rep,name=keys,proto3" json:"keys,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Keys [][]byte `protobuf:"bytes,5,rep,name=keys,proto3" json:"keys,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *LeaseTimeToLiveResponse) Reset() { *m = LeaseTimeToLiveResponse{} } -func (m *LeaseTimeToLiveResponse) String() string { return proto.CompactTextString(m) } -func (*LeaseTimeToLiveResponse) ProtoMessage() {} -func (*LeaseTimeToLiveResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{35} -} -func (m *LeaseTimeToLiveResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LeaseTimeToLiveResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LeaseTimeToLiveResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *LeaseTimeToLiveResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_LeaseTimeToLiveResponse.Merge(m, src) +func (x *LeaseTimeToLiveResponse) Reset() { + *x = LeaseTimeToLiveResponse{} + mi := &file_rpc_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *LeaseTimeToLiveResponse) XXX_Size() int { - return m.Size() + +func (x *LeaseTimeToLiveResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *LeaseTimeToLiveResponse) XXX_DiscardUnknown() { - xxx_messageInfo_LeaseTimeToLiveResponse.DiscardUnknown(m) + +func (*LeaseTimeToLiveResponse) ProtoMessage() {} + +func (x *LeaseTimeToLiveResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_LeaseTimeToLiveResponse proto.InternalMessageInfo +// Deprecated: Use LeaseTimeToLiveResponse.ProtoReflect.Descriptor instead. +func (*LeaseTimeToLiveResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{35} +} -func (m *LeaseTimeToLiveResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *LeaseTimeToLiveResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *LeaseTimeToLiveResponse) GetID() int64 { - if m != nil { - return m.ID +func (x *LeaseTimeToLiveResponse) GetID() int64 { + if x != nil { + return x.ID } return 0 } -func (m *LeaseTimeToLiveResponse) GetTTL() int64 { - if m != nil { - return m.TTL +func (x *LeaseTimeToLiveResponse) GetTTL() int64 { + if x != nil { + return x.TTL } return 0 } -func (m *LeaseTimeToLiveResponse) GetGrantedTTL() int64 { - if m != nil { - return m.GrantedTTL +func (x *LeaseTimeToLiveResponse) GetGrantedTTL() int64 { + if x != nil { + return x.GrantedTTL } return 0 } -func (m *LeaseTimeToLiveResponse) GetKeys() [][]byte { - if m != nil { - return m.Keys +func (x *LeaseTimeToLiveResponse) GetKeys() [][]byte { + if x != nil { + return x.Keys } return nil } type LeaseLeasesRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *LeaseLeasesRequest) Reset() { *m = LeaseLeasesRequest{} } -func (m *LeaseLeasesRequest) String() string { return proto.CompactTextString(m) } -func (*LeaseLeasesRequest) ProtoMessage() {} -func (*LeaseLeasesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{36} -} -func (m *LeaseLeasesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LeaseLeasesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LeaseLeasesRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (x *LeaseLeasesRequest) Reset() { + *x = LeaseLeasesRequest{} + mi := &file_rpc_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaseLeasesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaseLeasesRequest) ProtoMessage() {} + +func (x *LeaseLeasesRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[36] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } + return mi.MessageOf(x) } -func (m *LeaseLeasesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_LeaseLeasesRequest.Merge(m, src) -} -func (m *LeaseLeasesRequest) XXX_Size() int { - return m.Size() + +// Deprecated: Use LeaseLeasesRequest.ProtoReflect.Descriptor instead. +func (*LeaseLeasesRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{36} } -func (m *LeaseLeasesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_LeaseLeasesRequest.DiscardUnknown(m) + +type LeaseStatus struct { + state protoimpl.MessageState `protogen:"open.v1"` + ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` // TODO: int64 TTL = 2; + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -var xxx_messageInfo_LeaseLeasesRequest proto.InternalMessageInfo +func (x *LeaseStatus) Reset() { + *x = LeaseStatus{} + mi := &file_rpc_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} -type LeaseStatus struct { - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *LeaseStatus) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *LeaseStatus) Reset() { *m = LeaseStatus{} } -func (m *LeaseStatus) String() string { return proto.CompactTextString(m) } -func (*LeaseStatus) ProtoMessage() {} -func (*LeaseStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{37} -} -func (m *LeaseStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LeaseStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LeaseStatus.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (*LeaseStatus) ProtoMessage() {} + +func (x *LeaseStatus) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[37] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *LeaseStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_LeaseStatus.Merge(m, src) -} -func (m *LeaseStatus) XXX_Size() int { - return m.Size() -} -func (m *LeaseStatus) XXX_DiscardUnknown() { - xxx_messageInfo_LeaseStatus.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_LeaseStatus proto.InternalMessageInfo +// Deprecated: Use LeaseStatus.ProtoReflect.Descriptor instead. +func (*LeaseStatus) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{37} +} -func (m *LeaseStatus) GetID() int64 { - if m != nil { - return m.ID +func (x *LeaseStatus) GetID() int64 { + if x != nil { + return x.ID } return 0 } type LeaseLeasesResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - Leases []*LeaseStatus `protobuf:"bytes,2,rep,name=leases,proto3" json:"leases,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Leases []*LeaseStatus `protobuf:"bytes,2,rep,name=leases,proto3" json:"leases,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *LeaseLeasesResponse) Reset() { *m = LeaseLeasesResponse{} } -func (m *LeaseLeasesResponse) String() string { return proto.CompactTextString(m) } -func (*LeaseLeasesResponse) ProtoMessage() {} -func (*LeaseLeasesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{38} -} -func (m *LeaseLeasesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LeaseLeasesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LeaseLeasesResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *LeaseLeasesResponse) Reset() { + *x = LeaseLeasesResponse{} + mi := &file_rpc_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *LeaseLeasesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_LeaseLeasesResponse.Merge(m, src) -} -func (m *LeaseLeasesResponse) XXX_Size() int { - return m.Size() + +func (x *LeaseLeasesResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *LeaseLeasesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_LeaseLeasesResponse.DiscardUnknown(m) + +func (*LeaseLeasesResponse) ProtoMessage() {} + +func (x *LeaseLeasesResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[38] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_LeaseLeasesResponse proto.InternalMessageInfo +// Deprecated: Use LeaseLeasesResponse.ProtoReflect.Descriptor instead. +func (*LeaseLeasesResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{38} +} -func (m *LeaseLeasesResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *LeaseLeasesResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *LeaseLeasesResponse) GetLeases() []*LeaseStatus { - if m != nil { - return m.Leases +func (x *LeaseLeasesResponse) GetLeases() []*LeaseStatus { + if x != nil { + return x.Leases } return nil } type Member struct { + state protoimpl.MessageState `protogen:"open.v1"` // ID is the member ID for this member. ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` // name is the human-readable name of the member. If the member is not started, the name will be an empty string. @@ -3093,808 +3156,763 @@ type Member struct { // clientURLs is the list of URLs the member exposes to clients for communication. If the member is not started, clientURLs will be empty. ClientURLs []string `protobuf:"bytes,4,rep,name=clientURLs,proto3" json:"clientURLs,omitempty"` // isLearner indicates if the member is raft learner. - IsLearner bool `protobuf:"varint,5,opt,name=isLearner,proto3" json:"isLearner,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + IsLearner bool `protobuf:"varint,5,opt,name=isLearner,proto3" json:"isLearner,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *Member) Reset() { *m = Member{} } -func (m *Member) String() string { return proto.CompactTextString(m) } -func (*Member) ProtoMessage() {} -func (*Member) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{39} -} -func (m *Member) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Member) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Member.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Member) XXX_Merge(src proto.Message) { - xxx_messageInfo_Member.Merge(m, src) +func (x *Member) Reset() { + *x = Member{} + mi := &file_rpc_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *Member) XXX_Size() int { - return m.Size() + +func (x *Member) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Member) XXX_DiscardUnknown() { - xxx_messageInfo_Member.DiscardUnknown(m) + +func (*Member) ProtoMessage() {} + +func (x *Member) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_Member proto.InternalMessageInfo +// Deprecated: Use Member.ProtoReflect.Descriptor instead. +func (*Member) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{39} +} -func (m *Member) GetID() uint64 { - if m != nil { - return m.ID +func (x *Member) GetID() uint64 { + if x != nil { + return x.ID } return 0 } -func (m *Member) GetName() string { - if m != nil { - return m.Name +func (x *Member) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *Member) GetPeerURLs() []string { - if m != nil { - return m.PeerURLs +func (x *Member) GetPeerURLs() []string { + if x != nil { + return x.PeerURLs } return nil } -func (m *Member) GetClientURLs() []string { - if m != nil { - return m.ClientURLs +func (x *Member) GetClientURLs() []string { + if x != nil { + return x.ClientURLs } return nil } -func (m *Member) GetIsLearner() bool { - if m != nil { - return m.IsLearner +func (x *Member) GetIsLearner() bool { + if x != nil { + return x.IsLearner } return false } type MemberAddRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // peerURLs is the list of URLs the added member will use to communicate with the cluster. PeerURLs []string `protobuf:"bytes,1,rep,name=peerURLs,proto3" json:"peerURLs,omitempty"` // isLearner indicates if the added member is raft learner. - IsLearner bool `protobuf:"varint,2,opt,name=isLearner,proto3" json:"isLearner,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + IsLearner bool `protobuf:"varint,2,opt,name=isLearner,proto3" json:"isLearner,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *MemberAddRequest) Reset() { *m = MemberAddRequest{} } -func (m *MemberAddRequest) String() string { return proto.CompactTextString(m) } -func (*MemberAddRequest) ProtoMessage() {} -func (*MemberAddRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{40} -} -func (m *MemberAddRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MemberAddRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MemberAddRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *MemberAddRequest) Reset() { + *x = MemberAddRequest{} + mi := &file_rpc_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *MemberAddRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemberAddRequest.Merge(m, src) -} -func (m *MemberAddRequest) XXX_Size() int { - return m.Size() + +func (x *MemberAddRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MemberAddRequest) XXX_DiscardUnknown() { - xxx_messageInfo_MemberAddRequest.DiscardUnknown(m) + +func (*MemberAddRequest) ProtoMessage() {} + +func (x *MemberAddRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[40] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MemberAddRequest proto.InternalMessageInfo +// Deprecated: Use MemberAddRequest.ProtoReflect.Descriptor instead. +func (*MemberAddRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{40} +} -func (m *MemberAddRequest) GetPeerURLs() []string { - if m != nil { - return m.PeerURLs +func (x *MemberAddRequest) GetPeerURLs() []string { + if x != nil { + return x.PeerURLs } return nil } -func (m *MemberAddRequest) GetIsLearner() bool { - if m != nil { - return m.IsLearner +func (x *MemberAddRequest) GetIsLearner() bool { + if x != nil { + return x.IsLearner } return false } type MemberAddResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // member is the member information for the added member. Member *Member `protobuf:"bytes,2,opt,name=member,proto3" json:"member,omitempty"` // members is a list of all members after adding the new member. - Members []*Member `protobuf:"bytes,3,rep,name=members,proto3" json:"members,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Members []*Member `protobuf:"bytes,3,rep,name=members,proto3" json:"members,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *MemberAddResponse) Reset() { *m = MemberAddResponse{} } -func (m *MemberAddResponse) String() string { return proto.CompactTextString(m) } -func (*MemberAddResponse) ProtoMessage() {} -func (*MemberAddResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{41} -} -func (m *MemberAddResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MemberAddResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MemberAddResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *MemberAddResponse) Reset() { + *x = MemberAddResponse{} + mi := &file_rpc_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *MemberAddResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemberAddResponse.Merge(m, src) -} -func (m *MemberAddResponse) XXX_Size() int { - return m.Size() + +func (x *MemberAddResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MemberAddResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MemberAddResponse.DiscardUnknown(m) + +func (*MemberAddResponse) ProtoMessage() {} + +func (x *MemberAddResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[41] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MemberAddResponse proto.InternalMessageInfo +// Deprecated: Use MemberAddResponse.ProtoReflect.Descriptor instead. +func (*MemberAddResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{41} +} -func (m *MemberAddResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *MemberAddResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *MemberAddResponse) GetMember() *Member { - if m != nil { - return m.Member +func (x *MemberAddResponse) GetMember() *Member { + if x != nil { + return x.Member } return nil } -func (m *MemberAddResponse) GetMembers() []*Member { - if m != nil { - return m.Members +func (x *MemberAddResponse) GetMembers() []*Member { + if x != nil { + return x.Members } return nil } type MemberRemoveRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // ID is the member ID of the member to remove. - ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *MemberRemoveRequest) Reset() { *m = MemberRemoveRequest{} } -func (m *MemberRemoveRequest) String() string { return proto.CompactTextString(m) } -func (*MemberRemoveRequest) ProtoMessage() {} -func (*MemberRemoveRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{42} -} -func (m *MemberRemoveRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MemberRemoveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MemberRemoveRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MemberRemoveRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemberRemoveRequest.Merge(m, src) +func (x *MemberRemoveRequest) Reset() { + *x = MemberRemoveRequest{} + mi := &file_rpc_proto_msgTypes[42] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *MemberRemoveRequest) XXX_Size() int { - return m.Size() + +func (x *MemberRemoveRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MemberRemoveRequest) XXX_DiscardUnknown() { - xxx_messageInfo_MemberRemoveRequest.DiscardUnknown(m) + +func (*MemberRemoveRequest) ProtoMessage() {} + +func (x *MemberRemoveRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[42] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MemberRemoveRequest proto.InternalMessageInfo +// Deprecated: Use MemberRemoveRequest.ProtoReflect.Descriptor instead. +func (*MemberRemoveRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{42} +} -func (m *MemberRemoveRequest) GetID() uint64 { - if m != nil { - return m.ID +func (x *MemberRemoveRequest) GetID() uint64 { + if x != nil { + return x.ID } return 0 } type MemberRemoveResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // members is a list of all members after removing the member. - Members []*Member `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Members []*Member `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *MemberRemoveResponse) Reset() { *m = MemberRemoveResponse{} } -func (m *MemberRemoveResponse) String() string { return proto.CompactTextString(m) } -func (*MemberRemoveResponse) ProtoMessage() {} -func (*MemberRemoveResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{43} -} -func (m *MemberRemoveResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MemberRemoveResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MemberRemoveResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MemberRemoveResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemberRemoveResponse.Merge(m, src) +func (x *MemberRemoveResponse) Reset() { + *x = MemberRemoveResponse{} + mi := &file_rpc_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *MemberRemoveResponse) XXX_Size() int { - return m.Size() + +func (x *MemberRemoveResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MemberRemoveResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MemberRemoveResponse.DiscardUnknown(m) + +func (*MemberRemoveResponse) ProtoMessage() {} + +func (x *MemberRemoveResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[43] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MemberRemoveResponse proto.InternalMessageInfo +// Deprecated: Use MemberRemoveResponse.ProtoReflect.Descriptor instead. +func (*MemberRemoveResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{43} +} -func (m *MemberRemoveResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *MemberRemoveResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *MemberRemoveResponse) GetMembers() []*Member { - if m != nil { - return m.Members +func (x *MemberRemoveResponse) GetMembers() []*Member { + if x != nil { + return x.Members } return nil } type MemberUpdateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // ID is the member ID of the member to update. ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` // peerURLs is the new list of URLs the member will use to communicate with the cluster. - PeerURLs []string `protobuf:"bytes,2,rep,name=peerURLs,proto3" json:"peerURLs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + PeerURLs []string `protobuf:"bytes,2,rep,name=peerURLs,proto3" json:"peerURLs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *MemberUpdateRequest) Reset() { *m = MemberUpdateRequest{} } -func (m *MemberUpdateRequest) String() string { return proto.CompactTextString(m) } -func (*MemberUpdateRequest) ProtoMessage() {} -func (*MemberUpdateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{44} -} -func (m *MemberUpdateRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MemberUpdateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MemberUpdateRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *MemberUpdateRequest) Reset() { + *x = MemberUpdateRequest{} + mi := &file_rpc_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *MemberUpdateRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemberUpdateRequest.Merge(m, src) -} -func (m *MemberUpdateRequest) XXX_Size() int { - return m.Size() + +func (x *MemberUpdateRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MemberUpdateRequest) XXX_DiscardUnknown() { - xxx_messageInfo_MemberUpdateRequest.DiscardUnknown(m) + +func (*MemberUpdateRequest) ProtoMessage() {} + +func (x *MemberUpdateRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[44] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MemberUpdateRequest proto.InternalMessageInfo +// Deprecated: Use MemberUpdateRequest.ProtoReflect.Descriptor instead. +func (*MemberUpdateRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{44} +} -func (m *MemberUpdateRequest) GetID() uint64 { - if m != nil { - return m.ID +func (x *MemberUpdateRequest) GetID() uint64 { + if x != nil { + return x.ID } return 0 } -func (m *MemberUpdateRequest) GetPeerURLs() []string { - if m != nil { - return m.PeerURLs +func (x *MemberUpdateRequest) GetPeerURLs() []string { + if x != nil { + return x.PeerURLs } return nil } type MemberUpdateResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // members is a list of all members after updating the member. - Members []*Member `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Members []*Member `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *MemberUpdateResponse) Reset() { *m = MemberUpdateResponse{} } -func (m *MemberUpdateResponse) String() string { return proto.CompactTextString(m) } -func (*MemberUpdateResponse) ProtoMessage() {} -func (*MemberUpdateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{45} -} -func (m *MemberUpdateResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MemberUpdateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MemberUpdateResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *MemberUpdateResponse) Reset() { + *x = MemberUpdateResponse{} + mi := &file_rpc_proto_msgTypes[45] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *MemberUpdateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemberUpdateResponse.Merge(m, src) -} -func (m *MemberUpdateResponse) XXX_Size() int { - return m.Size() + +func (x *MemberUpdateResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MemberUpdateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MemberUpdateResponse.DiscardUnknown(m) + +func (*MemberUpdateResponse) ProtoMessage() {} + +func (x *MemberUpdateResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[45] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MemberUpdateResponse proto.InternalMessageInfo +// Deprecated: Use MemberUpdateResponse.ProtoReflect.Descriptor instead. +func (*MemberUpdateResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{45} +} -func (m *MemberUpdateResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *MemberUpdateResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *MemberUpdateResponse) GetMembers() []*Member { - if m != nil { - return m.Members +func (x *MemberUpdateResponse) GetMembers() []*Member { + if x != nil { + return x.Members } return nil } type MemberListRequest struct { - Linearizable bool `protobuf:"varint,1,opt,name=linearizable,proto3" json:"linearizable,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + Linearizable bool `protobuf:"varint,1,opt,name=linearizable,proto3" json:"linearizable,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *MemberListRequest) Reset() { *m = MemberListRequest{} } -func (m *MemberListRequest) String() string { return proto.CompactTextString(m) } -func (*MemberListRequest) ProtoMessage() {} -func (*MemberListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{46} -} -func (m *MemberListRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MemberListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MemberListRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MemberListRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemberListRequest.Merge(m, src) +func (x *MemberListRequest) Reset() { + *x = MemberListRequest{} + mi := &file_rpc_proto_msgTypes[46] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *MemberListRequest) XXX_Size() int { - return m.Size() + +func (x *MemberListRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MemberListRequest) XXX_DiscardUnknown() { - xxx_messageInfo_MemberListRequest.DiscardUnknown(m) + +func (*MemberListRequest) ProtoMessage() {} + +func (x *MemberListRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[46] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MemberListRequest proto.InternalMessageInfo +// Deprecated: Use MemberListRequest.ProtoReflect.Descriptor instead. +func (*MemberListRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{46} +} -func (m *MemberListRequest) GetLinearizable() bool { - if m != nil { - return m.Linearizable +func (x *MemberListRequest) GetLinearizable() bool { + if x != nil { + return x.Linearizable } return false } type MemberListResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // members is a list of all members associated with the cluster. - Members []*Member `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Members []*Member `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *MemberListResponse) Reset() { *m = MemberListResponse{} } -func (m *MemberListResponse) String() string { return proto.CompactTextString(m) } -func (*MemberListResponse) ProtoMessage() {} -func (*MemberListResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{47} -} -func (m *MemberListResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MemberListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MemberListResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MemberListResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemberListResponse.Merge(m, src) +func (x *MemberListResponse) Reset() { + *x = MemberListResponse{} + mi := &file_rpc_proto_msgTypes[47] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *MemberListResponse) XXX_Size() int { - return m.Size() + +func (x *MemberListResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MemberListResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MemberListResponse.DiscardUnknown(m) + +func (*MemberListResponse) ProtoMessage() {} + +func (x *MemberListResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[47] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MemberListResponse proto.InternalMessageInfo +// Deprecated: Use MemberListResponse.ProtoReflect.Descriptor instead. +func (*MemberListResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{47} +} -func (m *MemberListResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *MemberListResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *MemberListResponse) GetMembers() []*Member { - if m != nil { - return m.Members +func (x *MemberListResponse) GetMembers() []*Member { + if x != nil { + return x.Members } return nil } type MemberPromoteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // ID is the member ID of the member to promote. - ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *MemberPromoteRequest) Reset() { *m = MemberPromoteRequest{} } -func (m *MemberPromoteRequest) String() string { return proto.CompactTextString(m) } -func (*MemberPromoteRequest) ProtoMessage() {} -func (*MemberPromoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{48} -} -func (m *MemberPromoteRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MemberPromoteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MemberPromoteRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *MemberPromoteRequest) Reset() { + *x = MemberPromoteRequest{} + mi := &file_rpc_proto_msgTypes[48] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *MemberPromoteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemberPromoteRequest.Merge(m, src) -} -func (m *MemberPromoteRequest) XXX_Size() int { - return m.Size() + +func (x *MemberPromoteRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MemberPromoteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_MemberPromoteRequest.DiscardUnknown(m) + +func (*MemberPromoteRequest) ProtoMessage() {} + +func (x *MemberPromoteRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[48] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MemberPromoteRequest proto.InternalMessageInfo +// Deprecated: Use MemberPromoteRequest.ProtoReflect.Descriptor instead. +func (*MemberPromoteRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{48} +} -func (m *MemberPromoteRequest) GetID() uint64 { - if m != nil { - return m.ID +func (x *MemberPromoteRequest) GetID() uint64 { + if x != nil { + return x.ID } return 0 } type MemberPromoteResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // members is a list of all members after promoting the member. - Members []*Member `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Members []*Member `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *MemberPromoteResponse) Reset() { *m = MemberPromoteResponse{} } -func (m *MemberPromoteResponse) String() string { return proto.CompactTextString(m) } -func (*MemberPromoteResponse) ProtoMessage() {} -func (*MemberPromoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{49} -} -func (m *MemberPromoteResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MemberPromoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MemberPromoteResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *MemberPromoteResponse) Reset() { + *x = MemberPromoteResponse{} + mi := &file_rpc_proto_msgTypes[49] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *MemberPromoteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemberPromoteResponse.Merge(m, src) -} -func (m *MemberPromoteResponse) XXX_Size() int { - return m.Size() + +func (x *MemberPromoteResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MemberPromoteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MemberPromoteResponse.DiscardUnknown(m) + +func (*MemberPromoteResponse) ProtoMessage() {} + +func (x *MemberPromoteResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[49] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MemberPromoteResponse proto.InternalMessageInfo +// Deprecated: Use MemberPromoteResponse.ProtoReflect.Descriptor instead. +func (*MemberPromoteResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{49} +} -func (m *MemberPromoteResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *MemberPromoteResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *MemberPromoteResponse) GetMembers() []*Member { - if m != nil { - return m.Members +func (x *MemberPromoteResponse) GetMembers() []*Member { + if x != nil { + return x.Members } return nil } type DefragmentRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *DefragmentRequest) Reset() { *m = DefragmentRequest{} } -func (m *DefragmentRequest) String() string { return proto.CompactTextString(m) } -func (*DefragmentRequest) ProtoMessage() {} -func (*DefragmentRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{50} -} -func (m *DefragmentRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DefragmentRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DefragmentRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (x *DefragmentRequest) Reset() { + *x = DefragmentRequest{} + mi := &file_rpc_proto_msgTypes[50] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DefragmentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DefragmentRequest) ProtoMessage() {} + +func (x *DefragmentRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[50] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } + return mi.MessageOf(x) } -func (m *DefragmentRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DefragmentRequest.Merge(m, src) -} -func (m *DefragmentRequest) XXX_Size() int { - return m.Size() + +// Deprecated: Use DefragmentRequest.ProtoReflect.Descriptor instead. +func (*DefragmentRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{50} } -func (m *DefragmentRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DefragmentRequest.DiscardUnknown(m) + +type DefragmentResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -var xxx_messageInfo_DefragmentRequest proto.InternalMessageInfo +func (x *DefragmentResponse) Reset() { + *x = DefragmentResponse{} + mi := &file_rpc_proto_msgTypes[51] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} -type DefragmentResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *DefragmentResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DefragmentResponse) Reset() { *m = DefragmentResponse{} } -func (m *DefragmentResponse) String() string { return proto.CompactTextString(m) } -func (*DefragmentResponse) ProtoMessage() {} -func (*DefragmentResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{51} -} -func (m *DefragmentResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DefragmentResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DefragmentResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (*DefragmentResponse) ProtoMessage() {} + +func (x *DefragmentResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[51] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *DefragmentResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DefragmentResponse.Merge(m, src) -} -func (m *DefragmentResponse) XXX_Size() int { - return m.Size() -} -func (m *DefragmentResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DefragmentResponse.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_DefragmentResponse proto.InternalMessageInfo +// Deprecated: Use DefragmentResponse.ProtoReflect.Descriptor instead. +func (*DefragmentResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{51} +} -func (m *DefragmentResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *DefragmentResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } type MoveLeaderRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // targetID is the node ID for the new leader. - TargetID uint64 `protobuf:"varint,1,opt,name=targetID,proto3" json:"targetID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + TargetID uint64 `protobuf:"varint,1,opt,name=targetID,proto3" json:"targetID,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *MoveLeaderRequest) Reset() { *m = MoveLeaderRequest{} } -func (m *MoveLeaderRequest) String() string { return proto.CompactTextString(m) } -func (*MoveLeaderRequest) ProtoMessage() {} -func (*MoveLeaderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{52} -} -func (m *MoveLeaderRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MoveLeaderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MoveLeaderRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MoveLeaderRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_MoveLeaderRequest.Merge(m, src) +func (x *MoveLeaderRequest) Reset() { + *x = MoveLeaderRequest{} + mi := &file_rpc_proto_msgTypes[52] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *MoveLeaderRequest) XXX_Size() int { - return m.Size() + +func (x *MoveLeaderRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MoveLeaderRequest) XXX_DiscardUnknown() { - xxx_messageInfo_MoveLeaderRequest.DiscardUnknown(m) + +func (*MoveLeaderRequest) ProtoMessage() {} + +func (x *MoveLeaderRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[52] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MoveLeaderRequest proto.InternalMessageInfo +// Deprecated: Use MoveLeaderRequest.ProtoReflect.Descriptor instead. +func (*MoveLeaderRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{52} +} -func (m *MoveLeaderRequest) GetTargetID() uint64 { - if m != nil { - return m.TargetID +func (x *MoveLeaderRequest) GetTargetID() uint64 { + if x != nil { + return x.TargetID } return 0 } type MoveLeaderResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *MoveLeaderResponse) Reset() { *m = MoveLeaderResponse{} } -func (m *MoveLeaderResponse) String() string { return proto.CompactTextString(m) } -func (*MoveLeaderResponse) ProtoMessage() {} -func (*MoveLeaderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{53} -} -func (m *MoveLeaderResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MoveLeaderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MoveLeaderResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *MoveLeaderResponse) Reset() { + *x = MoveLeaderResponse{} + mi := &file_rpc_proto_msgTypes[53] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *MoveLeaderResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MoveLeaderResponse.Merge(m, src) -} -func (m *MoveLeaderResponse) XXX_Size() int { - return m.Size() + +func (x *MoveLeaderResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MoveLeaderResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MoveLeaderResponse.DiscardUnknown(m) + +func (*MoveLeaderResponse) ProtoMessage() {} + +func (x *MoveLeaderResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[53] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MoveLeaderResponse proto.InternalMessageInfo +// Deprecated: Use MoveLeaderResponse.ProtoReflect.Descriptor instead. +func (*MoveLeaderResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{53} +} -func (m *MoveLeaderResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *MoveLeaderResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } type AlarmRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // action is the kind of alarm request to issue. The action // may GET alarm statuses, ACTIVATE an alarm, or DEACTIVATE a // raised alarm. @@ -3903,290 +3921,274 @@ type AlarmRequest struct { // alarm request covers all members. MemberID uint64 `protobuf:"varint,2,opt,name=memberID,proto3" json:"memberID,omitempty"` // alarm is the type of alarm to consider for this request. - Alarm AlarmType `protobuf:"varint,3,opt,name=alarm,proto3,enum=etcdserverpb.AlarmType" json:"alarm,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Alarm AlarmType `protobuf:"varint,3,opt,name=alarm,proto3,enum=etcdserverpb.AlarmType" json:"alarm,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AlarmRequest) Reset() { *m = AlarmRequest{} } -func (m *AlarmRequest) String() string { return proto.CompactTextString(m) } -func (*AlarmRequest) ProtoMessage() {} -func (*AlarmRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{54} -} -func (m *AlarmRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AlarmRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AlarmRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AlarmRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AlarmRequest.Merge(m, src) +func (x *AlarmRequest) Reset() { + *x = AlarmRequest{} + mi := &file_rpc_proto_msgTypes[54] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AlarmRequest) XXX_Size() int { - return m.Size() + +func (x *AlarmRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AlarmRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AlarmRequest.DiscardUnknown(m) + +func (*AlarmRequest) ProtoMessage() {} + +func (x *AlarmRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[54] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AlarmRequest proto.InternalMessageInfo +// Deprecated: Use AlarmRequest.ProtoReflect.Descriptor instead. +func (*AlarmRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{54} +} -func (m *AlarmRequest) GetAction() AlarmRequest_AlarmAction { - if m != nil { - return m.Action +func (x *AlarmRequest) GetAction() AlarmRequest_AlarmAction { + if x != nil { + return x.Action } return AlarmRequest_GET } -func (m *AlarmRequest) GetMemberID() uint64 { - if m != nil { - return m.MemberID +func (x *AlarmRequest) GetMemberID() uint64 { + if x != nil { + return x.MemberID } return 0 } -func (m *AlarmRequest) GetAlarm() AlarmType { - if m != nil { - return m.Alarm +func (x *AlarmRequest) GetAlarm() AlarmType { + if x != nil { + return x.Alarm } return AlarmType_NONE } type AlarmMember struct { + state protoimpl.MessageState `protogen:"open.v1"` // memberID is the ID of the member associated with the raised alarm. MemberID uint64 `protobuf:"varint,1,opt,name=memberID,proto3" json:"memberID,omitempty"` // alarm is the type of alarm which has been raised. - Alarm AlarmType `protobuf:"varint,2,opt,name=alarm,proto3,enum=etcdserverpb.AlarmType" json:"alarm,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Alarm AlarmType `protobuf:"varint,2,opt,name=alarm,proto3,enum=etcdserverpb.AlarmType" json:"alarm,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AlarmMember) Reset() { *m = AlarmMember{} } -func (m *AlarmMember) String() string { return proto.CompactTextString(m) } -func (*AlarmMember) ProtoMessage() {} -func (*AlarmMember) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{55} -} -func (m *AlarmMember) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AlarmMember) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AlarmMember.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *AlarmMember) Reset() { + *x = AlarmMember{} + mi := &file_rpc_proto_msgTypes[55] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AlarmMember) XXX_Merge(src proto.Message) { - xxx_messageInfo_AlarmMember.Merge(m, src) -} -func (m *AlarmMember) XXX_Size() int { - return m.Size() + +func (x *AlarmMember) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AlarmMember) XXX_DiscardUnknown() { - xxx_messageInfo_AlarmMember.DiscardUnknown(m) + +func (*AlarmMember) ProtoMessage() {} + +func (x *AlarmMember) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[55] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AlarmMember proto.InternalMessageInfo +// Deprecated: Use AlarmMember.ProtoReflect.Descriptor instead. +func (*AlarmMember) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{55} +} -func (m *AlarmMember) GetMemberID() uint64 { - if m != nil { - return m.MemberID +func (x *AlarmMember) GetMemberID() uint64 { + if x != nil { + return x.MemberID } return 0 } -func (m *AlarmMember) GetAlarm() AlarmType { - if m != nil { - return m.Alarm +func (x *AlarmMember) GetAlarm() AlarmType { + if x != nil { + return x.Alarm } return AlarmType_NONE } type AlarmResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // alarms is a list of alarms associated with the alarm request. - Alarms []*AlarmMember `protobuf:"bytes,2,rep,name=alarms,proto3" json:"alarms,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Alarms []*AlarmMember `protobuf:"bytes,2,rep,name=alarms,proto3" json:"alarms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AlarmResponse) Reset() { *m = AlarmResponse{} } -func (m *AlarmResponse) String() string { return proto.CompactTextString(m) } -func (*AlarmResponse) ProtoMessage() {} -func (*AlarmResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{56} -} -func (m *AlarmResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AlarmResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AlarmResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *AlarmResponse) Reset() { + *x = AlarmResponse{} + mi := &file_rpc_proto_msgTypes[56] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AlarmResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AlarmResponse.Merge(m, src) -} -func (m *AlarmResponse) XXX_Size() int { - return m.Size() + +func (x *AlarmResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AlarmResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AlarmResponse.DiscardUnknown(m) + +func (*AlarmResponse) ProtoMessage() {} + +func (x *AlarmResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[56] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AlarmResponse proto.InternalMessageInfo +// Deprecated: Use AlarmResponse.ProtoReflect.Descriptor instead. +func (*AlarmResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{56} +} -func (m *AlarmResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *AlarmResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *AlarmResponse) GetAlarms() []*AlarmMember { - if m != nil { - return m.Alarms +func (x *AlarmResponse) GetAlarms() []*AlarmMember { + if x != nil { + return x.Alarms } return nil } type DowngradeRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // action is the kind of downgrade request to issue. The action may // VALIDATE the target version, DOWNGRADE the cluster version, // or CANCEL the current downgrading job. Action DowngradeRequest_DowngradeAction `protobuf:"varint,1,opt,name=action,proto3,enum=etcdserverpb.DowngradeRequest_DowngradeAction" json:"action,omitempty"` // version is the target version to downgrade. - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *DowngradeRequest) Reset() { *m = DowngradeRequest{} } -func (m *DowngradeRequest) String() string { return proto.CompactTextString(m) } -func (*DowngradeRequest) ProtoMessage() {} -func (*DowngradeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{57} -} -func (m *DowngradeRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DowngradeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DowngradeRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DowngradeRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DowngradeRequest.Merge(m, src) +func (x *DowngradeRequest) Reset() { + *x = DowngradeRequest{} + mi := &file_rpc_proto_msgTypes[57] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *DowngradeRequest) XXX_Size() int { - return m.Size() + +func (x *DowngradeRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DowngradeRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DowngradeRequest.DiscardUnknown(m) + +func (*DowngradeRequest) ProtoMessage() {} + +func (x *DowngradeRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[57] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_DowngradeRequest proto.InternalMessageInfo +// Deprecated: Use DowngradeRequest.ProtoReflect.Descriptor instead. +func (*DowngradeRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{57} +} -func (m *DowngradeRequest) GetAction() DowngradeRequest_DowngradeAction { - if m != nil { - return m.Action +func (x *DowngradeRequest) GetAction() DowngradeRequest_DowngradeAction { + if x != nil { + return x.Action } return DowngradeRequest_VALIDATE } -func (m *DowngradeRequest) GetVersion() string { - if m != nil { - return m.Version +func (x *DowngradeRequest) GetVersion() string { + if x != nil { + return x.Version } return "" } type DowngradeResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // version is the current cluster version. - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *DowngradeResponse) Reset() { *m = DowngradeResponse{} } -func (m *DowngradeResponse) String() string { return proto.CompactTextString(m) } -func (*DowngradeResponse) ProtoMessage() {} -func (*DowngradeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{58} -} -func (m *DowngradeResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DowngradeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DowngradeResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *DowngradeResponse) Reset() { + *x = DowngradeResponse{} + mi := &file_rpc_proto_msgTypes[58] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *DowngradeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DowngradeResponse.Merge(m, src) -} -func (m *DowngradeResponse) XXX_Size() int { - return m.Size() + +func (x *DowngradeResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DowngradeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DowngradeResponse.DiscardUnknown(m) + +func (*DowngradeResponse) ProtoMessage() {} + +func (x *DowngradeResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[58] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_DowngradeResponse proto.InternalMessageInfo +// Deprecated: Use DowngradeResponse.ProtoReflect.Descriptor instead. +func (*DowngradeResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{58} +} -func (m *DowngradeResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *DowngradeResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *DowngradeResponse) GetVersion() string { - if m != nil { - return m.Version +func (x *DowngradeResponse) GetVersion() string { + if x != nil { + return x.Version } return "" } @@ -4196,93 +4198,88 @@ func (m *DowngradeResponse) GetVersion() string { // target version is less than this version, then the downgrade(online) // or migration(offline) isn't safe, so shouldn't be allowed. type DowngradeVersionTestRequest struct { - Ver string `protobuf:"bytes,1,opt,name=ver,proto3" json:"ver,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + Ver string `protobuf:"bytes,1,opt,name=ver,proto3" json:"ver,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *DowngradeVersionTestRequest) Reset() { *m = DowngradeVersionTestRequest{} } -func (m *DowngradeVersionTestRequest) String() string { return proto.CompactTextString(m) } -func (*DowngradeVersionTestRequest) ProtoMessage() {} -func (*DowngradeVersionTestRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{59} -} -func (m *DowngradeVersionTestRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DowngradeVersionTestRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DowngradeVersionTestRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *DowngradeVersionTestRequest) Reset() { + *x = DowngradeVersionTestRequest{} + mi := &file_rpc_proto_msgTypes[59] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *DowngradeVersionTestRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DowngradeVersionTestRequest.Merge(m, src) -} -func (m *DowngradeVersionTestRequest) XXX_Size() int { - return m.Size() + +func (x *DowngradeVersionTestRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DowngradeVersionTestRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DowngradeVersionTestRequest.DiscardUnknown(m) + +func (*DowngradeVersionTestRequest) ProtoMessage() {} + +func (x *DowngradeVersionTestRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[59] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_DowngradeVersionTestRequest proto.InternalMessageInfo +// Deprecated: Use DowngradeVersionTestRequest.ProtoReflect.Descriptor instead. +func (*DowngradeVersionTestRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{59} +} -func (m *DowngradeVersionTestRequest) GetVer() string { - if m != nil { - return m.Ver +func (x *DowngradeVersionTestRequest) GetVer() string { + if x != nil { + return x.Ver } return "" } type StatusRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *StatusRequest) Reset() { *m = StatusRequest{} } -func (m *StatusRequest) String() string { return proto.CompactTextString(m) } -func (*StatusRequest) ProtoMessage() {} -func (*StatusRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{60} -} -func (m *StatusRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_StatusRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *StatusRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_StatusRequest.Merge(m, src) +func (x *StatusRequest) Reset() { + *x = StatusRequest{} + mi := &file_rpc_proto_msgTypes[60] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *StatusRequest) XXX_Size() int { - return m.Size() + +func (x *StatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StatusRequest) XXX_DiscardUnknown() { - xxx_messageInfo_StatusRequest.DiscardUnknown(m) + +func (*StatusRequest) ProtoMessage() {} + +func (x *StatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[60] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_StatusRequest proto.InternalMessageInfo +// Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead. +func (*StatusRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{60} +} type StatusResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // version is the cluster protocol version used by the responding member. Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // dbSize is the size of the backend database physically allocated, in bytes, of the responding member. @@ -4306,22240 +4303,2650 @@ type StatusResponse struct { // dbSizeQuota is the configured etcd storage quota in bytes (the value passed to etcd instance by flag --quota-backend-bytes) DbSizeQuota int64 `protobuf:"varint,12,opt,name=dbSizeQuota,proto3" json:"dbSizeQuota,omitempty"` // downgradeInfo indicates if there is downgrade process. - DowngradeInfo *DowngradeInfo `protobuf:"bytes,13,opt,name=downgradeInfo,proto3" json:"downgradeInfo,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + DowngradeInfo *DowngradeInfo `protobuf:"bytes,13,opt,name=downgradeInfo,proto3" json:"downgradeInfo,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *StatusResponse) Reset() { *m = StatusResponse{} } -func (m *StatusResponse) String() string { return proto.CompactTextString(m) } -func (*StatusResponse) ProtoMessage() {} -func (*StatusResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{61} -} -func (m *StatusResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_StatusResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *StatusResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_StatusResponse.Merge(m, src) +func (x *StatusResponse) Reset() { + *x = StatusResponse{} + mi := &file_rpc_proto_msgTypes[61] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *StatusResponse) XXX_Size() int { - return m.Size() + +func (x *StatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StatusResponse) XXX_DiscardUnknown() { - xxx_messageInfo_StatusResponse.DiscardUnknown(m) + +func (*StatusResponse) ProtoMessage() {} + +func (x *StatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[61] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_StatusResponse proto.InternalMessageInfo +// Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead. +func (*StatusResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{61} +} -func (m *StatusResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *StatusResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *StatusResponse) GetVersion() string { - if m != nil { - return m.Version +func (x *StatusResponse) GetVersion() string { + if x != nil { + return x.Version } return "" } -func (m *StatusResponse) GetDbSize() int64 { - if m != nil { - return m.DbSize +func (x *StatusResponse) GetDbSize() int64 { + if x != nil { + return x.DbSize } return 0 } -func (m *StatusResponse) GetLeader() uint64 { - if m != nil { - return m.Leader +func (x *StatusResponse) GetLeader() uint64 { + if x != nil { + return x.Leader } return 0 } -func (m *StatusResponse) GetRaftIndex() uint64 { - if m != nil { - return m.RaftIndex +func (x *StatusResponse) GetRaftIndex() uint64 { + if x != nil { + return x.RaftIndex } return 0 } -func (m *StatusResponse) GetRaftTerm() uint64 { - if m != nil { - return m.RaftTerm +func (x *StatusResponse) GetRaftTerm() uint64 { + if x != nil { + return x.RaftTerm } return 0 } -func (m *StatusResponse) GetRaftAppliedIndex() uint64 { - if m != nil { - return m.RaftAppliedIndex +func (x *StatusResponse) GetRaftAppliedIndex() uint64 { + if x != nil { + return x.RaftAppliedIndex } return 0 } -func (m *StatusResponse) GetErrors() []string { - if m != nil { - return m.Errors +func (x *StatusResponse) GetErrors() []string { + if x != nil { + return x.Errors } return nil } -func (m *StatusResponse) GetDbSizeInUse() int64 { - if m != nil { - return m.DbSizeInUse +func (x *StatusResponse) GetDbSizeInUse() int64 { + if x != nil { + return x.DbSizeInUse } return 0 } -func (m *StatusResponse) GetIsLearner() bool { - if m != nil { - return m.IsLearner +func (x *StatusResponse) GetIsLearner() bool { + if x != nil { + return x.IsLearner } return false } -func (m *StatusResponse) GetStorageVersion() string { - if m != nil { - return m.StorageVersion +func (x *StatusResponse) GetStorageVersion() string { + if x != nil { + return x.StorageVersion } return "" } -func (m *StatusResponse) GetDbSizeQuota() int64 { - if m != nil { - return m.DbSizeQuota +func (x *StatusResponse) GetDbSizeQuota() int64 { + if x != nil { + return x.DbSizeQuota } return 0 } -func (m *StatusResponse) GetDowngradeInfo() *DowngradeInfo { - if m != nil { - return m.DowngradeInfo +func (x *StatusResponse) GetDowngradeInfo() *DowngradeInfo { + if x != nil { + return x.DowngradeInfo } return nil } type DowngradeInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` // enabled indicates whether the cluster is enabled to downgrade. Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` // targetVersion is the target downgrade version. - TargetVersion string `protobuf:"bytes,2,opt,name=targetVersion,proto3" json:"targetVersion,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + TargetVersion string `protobuf:"bytes,2,opt,name=targetVersion,proto3" json:"targetVersion,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *DowngradeInfo) Reset() { *m = DowngradeInfo{} } -func (m *DowngradeInfo) String() string { return proto.CompactTextString(m) } -func (*DowngradeInfo) ProtoMessage() {} -func (*DowngradeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{62} -} -func (m *DowngradeInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DowngradeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DowngradeInfo.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DowngradeInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_DowngradeInfo.Merge(m, src) +func (x *DowngradeInfo) Reset() { + *x = DowngradeInfo{} + mi := &file_rpc_proto_msgTypes[62] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *DowngradeInfo) XXX_Size() int { - return m.Size() + +func (x *DowngradeInfo) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DowngradeInfo) XXX_DiscardUnknown() { - xxx_messageInfo_DowngradeInfo.DiscardUnknown(m) + +func (*DowngradeInfo) ProtoMessage() {} + +func (x *DowngradeInfo) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[62] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_DowngradeInfo proto.InternalMessageInfo +// Deprecated: Use DowngradeInfo.ProtoReflect.Descriptor instead. +func (*DowngradeInfo) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{62} +} -func (m *DowngradeInfo) GetEnabled() bool { - if m != nil { - return m.Enabled +func (x *DowngradeInfo) GetEnabled() bool { + if x != nil { + return x.Enabled } return false } -func (m *DowngradeInfo) GetTargetVersion() string { - if m != nil { - return m.TargetVersion +func (x *DowngradeInfo) GetTargetVersion() string { + if x != nil { + return x.TargetVersion } return "" } type AuthEnableRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthEnableRequest) Reset() { *m = AuthEnableRequest{} } -func (m *AuthEnableRequest) String() string { return proto.CompactTextString(m) } -func (*AuthEnableRequest) ProtoMessage() {} -func (*AuthEnableRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{63} -} -func (m *AuthEnableRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthEnableRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthEnableRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (x *AuthEnableRequest) Reset() { + *x = AuthEnableRequest{} + mi := &file_rpc_proto_msgTypes[63] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuthEnableRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthEnableRequest) ProtoMessage() {} + +func (x *AuthEnableRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[63] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } + return mi.MessageOf(x) } -func (m *AuthEnableRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthEnableRequest.Merge(m, src) -} -func (m *AuthEnableRequest) XXX_Size() int { - return m.Size() + +// Deprecated: Use AuthEnableRequest.ProtoReflect.Descriptor instead. +func (*AuthEnableRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{63} } -func (m *AuthEnableRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthEnableRequest.DiscardUnknown(m) + +type AuthDisableRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -var xxx_messageInfo_AuthEnableRequest proto.InternalMessageInfo +func (x *AuthDisableRequest) Reset() { + *x = AuthDisableRequest{} + mi := &file_rpc_proto_msgTypes[64] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} -type AuthDisableRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *AuthDisableRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthDisableRequest) Reset() { *m = AuthDisableRequest{} } -func (m *AuthDisableRequest) String() string { return proto.CompactTextString(m) } -func (*AuthDisableRequest) ProtoMessage() {} -func (*AuthDisableRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{64} -} -func (m *AuthDisableRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthDisableRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthDisableRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (*AuthDisableRequest) ProtoMessage() {} + +func (x *AuthDisableRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[64] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } + return mi.MessageOf(x) } -func (m *AuthDisableRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthDisableRequest.Merge(m, src) -} -func (m *AuthDisableRequest) XXX_Size() int { - return m.Size() + +// Deprecated: Use AuthDisableRequest.ProtoReflect.Descriptor instead. +func (*AuthDisableRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{64} } -func (m *AuthDisableRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthDisableRequest.DiscardUnknown(m) + +type AuthStatusRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -var xxx_messageInfo_AuthDisableRequest proto.InternalMessageInfo +func (x *AuthStatusRequest) Reset() { + *x = AuthStatusRequest{} + mi := &file_rpc_proto_msgTypes[65] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} -type AuthStatusRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *AuthStatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthStatusRequest) Reset() { *m = AuthStatusRequest{} } -func (m *AuthStatusRequest) String() string { return proto.CompactTextString(m) } -func (*AuthStatusRequest) ProtoMessage() {} -func (*AuthStatusRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{65} -} -func (m *AuthStatusRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthStatusRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (*AuthStatusRequest) ProtoMessage() {} + +func (x *AuthStatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[65] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } + return mi.MessageOf(x) } -func (m *AuthStatusRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthStatusRequest.Merge(m, src) -} -func (m *AuthStatusRequest) XXX_Size() int { - return m.Size() + +// Deprecated: Use AuthStatusRequest.ProtoReflect.Descriptor instead. +func (*AuthStatusRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{65} } -func (m *AuthStatusRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthStatusRequest.DiscardUnknown(m) + +type AuthenticateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -var xxx_messageInfo_AuthStatusRequest proto.InternalMessageInfo +func (x *AuthenticateRequest) Reset() { + *x = AuthenticateRequest{} + mi := &file_rpc_proto_msgTypes[66] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} -type AuthenticateRequest struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *AuthenticateRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthenticateRequest) Reset() { *m = AuthenticateRequest{} } -func (m *AuthenticateRequest) String() string { return proto.CompactTextString(m) } -func (*AuthenticateRequest) ProtoMessage() {} -func (*AuthenticateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{66} -} -func (m *AuthenticateRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthenticateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthenticateRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (*AuthenticateRequest) ProtoMessage() {} + +func (x *AuthenticateRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[66] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *AuthenticateRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthenticateRequest.Merge(m, src) -} -func (m *AuthenticateRequest) XXX_Size() int { - return m.Size() -} -func (m *AuthenticateRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthenticateRequest.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_AuthenticateRequest proto.InternalMessageInfo +// Deprecated: Use AuthenticateRequest.ProtoReflect.Descriptor instead. +func (*AuthenticateRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{66} +} -func (m *AuthenticateRequest) GetName() string { - if m != nil { - return m.Name +func (x *AuthenticateRequest) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *AuthenticateRequest) GetPassword() string { - if m != nil { - return m.Password +func (x *AuthenticateRequest) GetPassword() string { + if x != nil { + return x.Password } return "" } type AuthUserAddRequest struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` - Options *authpb.UserAddOptions `protobuf:"bytes,3,opt,name=options,proto3" json:"options,omitempty"` - HashedPassword string `protobuf:"bytes,4,opt,name=hashedPassword,proto3" json:"hashedPassword,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AuthUserAddRequest) Reset() { *m = AuthUserAddRequest{} } -func (m *AuthUserAddRequest) String() string { return proto.CompactTextString(m) } -func (*AuthUserAddRequest) ProtoMessage() {} -func (*AuthUserAddRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{67} -} -func (m *AuthUserAddRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthUserAddRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthUserAddRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + Options *authpb.UserAddOptions `protobuf:"bytes,3,opt,name=options,proto3" json:"options,omitempty"` + HashedPassword string `protobuf:"bytes,4,opt,name=hashedPassword,proto3" json:"hashedPassword,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthUserAddRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthUserAddRequest.Merge(m, src) + +func (x *AuthUserAddRequest) Reset() { + *x = AuthUserAddRequest{} + mi := &file_rpc_proto_msgTypes[67] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthUserAddRequest) XXX_Size() int { - return m.Size() + +func (x *AuthUserAddRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthUserAddRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthUserAddRequest.DiscardUnknown(m) + +func (*AuthUserAddRequest) ProtoMessage() {} + +func (x *AuthUserAddRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[67] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AuthUserAddRequest proto.InternalMessageInfo +// Deprecated: Use AuthUserAddRequest.ProtoReflect.Descriptor instead. +func (*AuthUserAddRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{67} +} -func (m *AuthUserAddRequest) GetName() string { - if m != nil { - return m.Name +func (x *AuthUserAddRequest) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *AuthUserAddRequest) GetPassword() string { - if m != nil { - return m.Password +func (x *AuthUserAddRequest) GetPassword() string { + if x != nil { + return x.Password } return "" } -func (m *AuthUserAddRequest) GetOptions() *authpb.UserAddOptions { - if m != nil { - return m.Options +func (x *AuthUserAddRequest) GetOptions() *authpb.UserAddOptions { + if x != nil { + return x.Options } return nil } -func (m *AuthUserAddRequest) GetHashedPassword() string { - if m != nil { - return m.HashedPassword +func (x *AuthUserAddRequest) GetHashedPassword() string { + if x != nil { + return x.HashedPassword } return "" } type AuthUserGetRequest struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthUserGetRequest) Reset() { *m = AuthUserGetRequest{} } -func (m *AuthUserGetRequest) String() string { return proto.CompactTextString(m) } -func (*AuthUserGetRequest) ProtoMessage() {} -func (*AuthUserGetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{68} -} -func (m *AuthUserGetRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthUserGetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthUserGetRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *AuthUserGetRequest) Reset() { + *x = AuthUserGetRequest{} + mi := &file_rpc_proto_msgTypes[68] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthUserGetRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthUserGetRequest.Merge(m, src) + +func (x *AuthUserGetRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthUserGetRequest) XXX_Size() int { - return m.Size() -} -func (m *AuthUserGetRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthUserGetRequest.DiscardUnknown(m) + +func (*AuthUserGetRequest) ProtoMessage() {} + +func (x *AuthUserGetRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[68] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AuthUserGetRequest proto.InternalMessageInfo +// Deprecated: Use AuthUserGetRequest.ProtoReflect.Descriptor instead. +func (*AuthUserGetRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{68} +} -func (m *AuthUserGetRequest) GetName() string { - if m != nil { - return m.Name +func (x *AuthUserGetRequest) GetName() string { + if x != nil { + return x.Name } return "" } type AuthUserDeleteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // name is the name of the user to delete. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthUserDeleteRequest) Reset() { *m = AuthUserDeleteRequest{} } -func (m *AuthUserDeleteRequest) String() string { return proto.CompactTextString(m) } -func (*AuthUserDeleteRequest) ProtoMessage() {} -func (*AuthUserDeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{69} -} -func (m *AuthUserDeleteRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthUserDeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthUserDeleteRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *AuthUserDeleteRequest) Reset() { + *x = AuthUserDeleteRequest{} + mi := &file_rpc_proto_msgTypes[69] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthUserDeleteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthUserDeleteRequest.Merge(m, src) -} -func (m *AuthUserDeleteRequest) XXX_Size() int { - return m.Size() + +func (x *AuthUserDeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthUserDeleteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthUserDeleteRequest.DiscardUnknown(m) + +func (*AuthUserDeleteRequest) ProtoMessage() {} + +func (x *AuthUserDeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[69] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AuthUserDeleteRequest proto.InternalMessageInfo +// Deprecated: Use AuthUserDeleteRequest.ProtoReflect.Descriptor instead. +func (*AuthUserDeleteRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{69} +} -func (m *AuthUserDeleteRequest) GetName() string { - if m != nil { - return m.Name +func (x *AuthUserDeleteRequest) GetName() string { + if x != nil { + return x.Name } return "" } type AuthUserChangePasswordRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // name is the name of the user whose password is being changed. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // password is the new password for the user. Note that this field will be removed in the API layer. Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` // hashedPassword is the new password for the user. Note that this field will be initialized in the API layer. - HashedPassword string `protobuf:"bytes,3,opt,name=hashedPassword,proto3" json:"hashedPassword,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + HashedPassword string `protobuf:"bytes,3,opt,name=hashedPassword,proto3" json:"hashedPassword,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthUserChangePasswordRequest) Reset() { *m = AuthUserChangePasswordRequest{} } -func (m *AuthUserChangePasswordRequest) String() string { return proto.CompactTextString(m) } -func (*AuthUserChangePasswordRequest) ProtoMessage() {} -func (*AuthUserChangePasswordRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{70} -} -func (m *AuthUserChangePasswordRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthUserChangePasswordRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthUserChangePasswordRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AuthUserChangePasswordRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthUserChangePasswordRequest.Merge(m, src) +func (x *AuthUserChangePasswordRequest) Reset() { + *x = AuthUserChangePasswordRequest{} + mi := &file_rpc_proto_msgTypes[70] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthUserChangePasswordRequest) XXX_Size() int { - return m.Size() + +func (x *AuthUserChangePasswordRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthUserChangePasswordRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthUserChangePasswordRequest.DiscardUnknown(m) + +func (*AuthUserChangePasswordRequest) ProtoMessage() {} + +func (x *AuthUserChangePasswordRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[70] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AuthUserChangePasswordRequest proto.InternalMessageInfo +// Deprecated: Use AuthUserChangePasswordRequest.ProtoReflect.Descriptor instead. +func (*AuthUserChangePasswordRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{70} +} -func (m *AuthUserChangePasswordRequest) GetName() string { - if m != nil { - return m.Name +func (x *AuthUserChangePasswordRequest) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *AuthUserChangePasswordRequest) GetPassword() string { - if m != nil { - return m.Password +func (x *AuthUserChangePasswordRequest) GetPassword() string { + if x != nil { + return x.Password } return "" } -func (m *AuthUserChangePasswordRequest) GetHashedPassword() string { - if m != nil { - return m.HashedPassword +func (x *AuthUserChangePasswordRequest) GetHashedPassword() string { + if x != nil { + return x.HashedPassword } return "" } type AuthUserGrantRoleRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // user is the name of the user which should be granted a given role. User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` // role is the name of the role to grant to the user. - Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthUserGrantRoleRequest) Reset() { *m = AuthUserGrantRoleRequest{} } -func (m *AuthUserGrantRoleRequest) String() string { return proto.CompactTextString(m) } -func (*AuthUserGrantRoleRequest) ProtoMessage() {} -func (*AuthUserGrantRoleRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{71} -} -func (m *AuthUserGrantRoleRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthUserGrantRoleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthUserGrantRoleRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *AuthUserGrantRoleRequest) Reset() { + *x = AuthUserGrantRoleRequest{} + mi := &file_rpc_proto_msgTypes[71] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthUserGrantRoleRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthUserGrantRoleRequest.Merge(m, src) -} -func (m *AuthUserGrantRoleRequest) XXX_Size() int { - return m.Size() + +func (x *AuthUserGrantRoleRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthUserGrantRoleRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthUserGrantRoleRequest.DiscardUnknown(m) + +func (*AuthUserGrantRoleRequest) ProtoMessage() {} + +func (x *AuthUserGrantRoleRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[71] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AuthUserGrantRoleRequest proto.InternalMessageInfo +// Deprecated: Use AuthUserGrantRoleRequest.ProtoReflect.Descriptor instead. +func (*AuthUserGrantRoleRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{71} +} -func (m *AuthUserGrantRoleRequest) GetUser() string { - if m != nil { - return m.User +func (x *AuthUserGrantRoleRequest) GetUser() string { + if x != nil { + return x.User } return "" } -func (m *AuthUserGrantRoleRequest) GetRole() string { - if m != nil { - return m.Role +func (x *AuthUserGrantRoleRequest) GetRole() string { + if x != nil { + return x.Role } return "" } type AuthUserRevokeRoleRequest struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthUserRevokeRoleRequest) Reset() { *m = AuthUserRevokeRoleRequest{} } -func (m *AuthUserRevokeRoleRequest) String() string { return proto.CompactTextString(m) } -func (*AuthUserRevokeRoleRequest) ProtoMessage() {} -func (*AuthUserRevokeRoleRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{72} -} -func (m *AuthUserRevokeRoleRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthUserRevokeRoleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthUserRevokeRoleRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AuthUserRevokeRoleRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthUserRevokeRoleRequest.Merge(m, src) +func (x *AuthUserRevokeRoleRequest) Reset() { + *x = AuthUserRevokeRoleRequest{} + mi := &file_rpc_proto_msgTypes[72] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthUserRevokeRoleRequest) XXX_Size() int { - return m.Size() + +func (x *AuthUserRevokeRoleRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthUserRevokeRoleRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthUserRevokeRoleRequest.DiscardUnknown(m) + +func (*AuthUserRevokeRoleRequest) ProtoMessage() {} + +func (x *AuthUserRevokeRoleRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[72] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AuthUserRevokeRoleRequest proto.InternalMessageInfo +// Deprecated: Use AuthUserRevokeRoleRequest.ProtoReflect.Descriptor instead. +func (*AuthUserRevokeRoleRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{72} +} -func (m *AuthUserRevokeRoleRequest) GetName() string { - if m != nil { - return m.Name +func (x *AuthUserRevokeRoleRequest) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *AuthUserRevokeRoleRequest) GetRole() string { - if m != nil { - return m.Role +func (x *AuthUserRevokeRoleRequest) GetRole() string { + if x != nil { + return x.Role } return "" } type AuthRoleAddRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // name is the name of the role to add to the authentication system. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthRoleAddRequest) Reset() { *m = AuthRoleAddRequest{} } -func (m *AuthRoleAddRequest) String() string { return proto.CompactTextString(m) } -func (*AuthRoleAddRequest) ProtoMessage() {} -func (*AuthRoleAddRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{73} -} -func (m *AuthRoleAddRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthRoleAddRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthRoleAddRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *AuthRoleAddRequest) Reset() { + *x = AuthRoleAddRequest{} + mi := &file_rpc_proto_msgTypes[73] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthRoleAddRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthRoleAddRequest.Merge(m, src) -} -func (m *AuthRoleAddRequest) XXX_Size() int { - return m.Size() + +func (x *AuthRoleAddRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthRoleAddRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthRoleAddRequest.DiscardUnknown(m) + +func (*AuthRoleAddRequest) ProtoMessage() {} + +func (x *AuthRoleAddRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[73] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AuthRoleAddRequest proto.InternalMessageInfo +// Deprecated: Use AuthRoleAddRequest.ProtoReflect.Descriptor instead. +func (*AuthRoleAddRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{73} +} -func (m *AuthRoleAddRequest) GetName() string { - if m != nil { - return m.Name +func (x *AuthRoleAddRequest) GetName() string { + if x != nil { + return x.Name } return "" } type AuthRoleGetRequest struct { - Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthRoleGetRequest) Reset() { *m = AuthRoleGetRequest{} } -func (m *AuthRoleGetRequest) String() string { return proto.CompactTextString(m) } -func (*AuthRoleGetRequest) ProtoMessage() {} -func (*AuthRoleGetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{74} -} -func (m *AuthRoleGetRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthRoleGetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthRoleGetRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AuthRoleGetRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthRoleGetRequest.Merge(m, src) +func (x *AuthRoleGetRequest) Reset() { + *x = AuthRoleGetRequest{} + mi := &file_rpc_proto_msgTypes[74] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthRoleGetRequest) XXX_Size() int { - return m.Size() + +func (x *AuthRoleGetRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthRoleGetRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthRoleGetRequest.DiscardUnknown(m) + +func (*AuthRoleGetRequest) ProtoMessage() {} + +func (x *AuthRoleGetRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[74] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AuthRoleGetRequest proto.InternalMessageInfo +// Deprecated: Use AuthRoleGetRequest.ProtoReflect.Descriptor instead. +func (*AuthRoleGetRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{74} +} -func (m *AuthRoleGetRequest) GetRole() string { - if m != nil { - return m.Role +func (x *AuthRoleGetRequest) GetRole() string { + if x != nil { + return x.Role } return "" } type AuthUserListRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthUserListRequest) Reset() { *m = AuthUserListRequest{} } -func (m *AuthUserListRequest) String() string { return proto.CompactTextString(m) } -func (*AuthUserListRequest) ProtoMessage() {} -func (*AuthUserListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{75} -} -func (m *AuthUserListRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthUserListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthUserListRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (x *AuthUserListRequest) Reset() { + *x = AuthUserListRequest{} + mi := &file_rpc_proto_msgTypes[75] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuthUserListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthUserListRequest) ProtoMessage() {} + +func (x *AuthUserListRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[75] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } + return mi.MessageOf(x) } -func (m *AuthUserListRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthUserListRequest.Merge(m, src) -} -func (m *AuthUserListRequest) XXX_Size() int { - return m.Size() + +// Deprecated: Use AuthUserListRequest.ProtoReflect.Descriptor instead. +func (*AuthUserListRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{75} } -func (m *AuthUserListRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthUserListRequest.DiscardUnknown(m) + +type AuthRoleListRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -var xxx_messageInfo_AuthUserListRequest proto.InternalMessageInfo +func (x *AuthRoleListRequest) Reset() { + *x = AuthRoleListRequest{} + mi := &file_rpc_proto_msgTypes[76] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} -type AuthRoleListRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *AuthRoleListRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthRoleListRequest) Reset() { *m = AuthRoleListRequest{} } -func (m *AuthRoleListRequest) String() string { return proto.CompactTextString(m) } -func (*AuthRoleListRequest) ProtoMessage() {} -func (*AuthRoleListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{76} -} -func (m *AuthRoleListRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthRoleListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthRoleListRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (*AuthRoleListRequest) ProtoMessage() {} + +func (x *AuthRoleListRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[76] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } + return mi.MessageOf(x) } -func (m *AuthRoleListRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthRoleListRequest.Merge(m, src) -} -func (m *AuthRoleListRequest) XXX_Size() int { - return m.Size() + +// Deprecated: Use AuthRoleListRequest.ProtoReflect.Descriptor instead. +func (*AuthRoleListRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{76} } -func (m *AuthRoleListRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthRoleListRequest.DiscardUnknown(m) + +type AuthRoleDeleteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -var xxx_messageInfo_AuthRoleListRequest proto.InternalMessageInfo +func (x *AuthRoleDeleteRequest) Reset() { + *x = AuthRoleDeleteRequest{} + mi := &file_rpc_proto_msgTypes[77] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} -type AuthRoleDeleteRequest struct { - Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *AuthRoleDeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthRoleDeleteRequest) Reset() { *m = AuthRoleDeleteRequest{} } -func (m *AuthRoleDeleteRequest) String() string { return proto.CompactTextString(m) } -func (*AuthRoleDeleteRequest) ProtoMessage() {} -func (*AuthRoleDeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{77} -} -func (m *AuthRoleDeleteRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthRoleDeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthRoleDeleteRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (*AuthRoleDeleteRequest) ProtoMessage() {} + +func (x *AuthRoleDeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[77] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *AuthRoleDeleteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthRoleDeleteRequest.Merge(m, src) -} -func (m *AuthRoleDeleteRequest) XXX_Size() int { - return m.Size() -} -func (m *AuthRoleDeleteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthRoleDeleteRequest.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_AuthRoleDeleteRequest proto.InternalMessageInfo +// Deprecated: Use AuthRoleDeleteRequest.ProtoReflect.Descriptor instead. +func (*AuthRoleDeleteRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{77} +} -func (m *AuthRoleDeleteRequest) GetRole() string { - if m != nil { - return m.Role +func (x *AuthRoleDeleteRequest) GetRole() string { + if x != nil { + return x.Role } return "" } type AuthRoleGrantPermissionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` // name is the name of the role which will be granted the permission. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // perm is the permission to grant to the role. - Perm *authpb.Permission `protobuf:"bytes,2,opt,name=perm,proto3" json:"perm,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Perm *authpb.Permission `protobuf:"bytes,2,opt,name=perm,proto3" json:"perm,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthRoleGrantPermissionRequest) Reset() { *m = AuthRoleGrantPermissionRequest{} } -func (m *AuthRoleGrantPermissionRequest) String() string { return proto.CompactTextString(m) } -func (*AuthRoleGrantPermissionRequest) ProtoMessage() {} -func (*AuthRoleGrantPermissionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{78} -} -func (m *AuthRoleGrantPermissionRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthRoleGrantPermissionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthRoleGrantPermissionRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AuthRoleGrantPermissionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthRoleGrantPermissionRequest.Merge(m, src) +func (x *AuthRoleGrantPermissionRequest) Reset() { + *x = AuthRoleGrantPermissionRequest{} + mi := &file_rpc_proto_msgTypes[78] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthRoleGrantPermissionRequest) XXX_Size() int { - return m.Size() + +func (x *AuthRoleGrantPermissionRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthRoleGrantPermissionRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthRoleGrantPermissionRequest.DiscardUnknown(m) + +func (*AuthRoleGrantPermissionRequest) ProtoMessage() {} + +func (x *AuthRoleGrantPermissionRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[78] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AuthRoleGrantPermissionRequest proto.InternalMessageInfo +// Deprecated: Use AuthRoleGrantPermissionRequest.ProtoReflect.Descriptor instead. +func (*AuthRoleGrantPermissionRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{78} +} -func (m *AuthRoleGrantPermissionRequest) GetName() string { - if m != nil { - return m.Name +func (x *AuthRoleGrantPermissionRequest) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *AuthRoleGrantPermissionRequest) GetPerm() *authpb.Permission { - if m != nil { - return m.Perm +func (x *AuthRoleGrantPermissionRequest) GetPerm() *authpb.Permission { + if x != nil { + return x.Perm } return nil } type AuthRoleRevokePermissionRequest struct { - Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - RangeEnd []byte `protobuf:"bytes,3,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + RangeEnd []byte `protobuf:"bytes,3,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthRoleRevokePermissionRequest) Reset() { *m = AuthRoleRevokePermissionRequest{} } -func (m *AuthRoleRevokePermissionRequest) String() string { return proto.CompactTextString(m) } -func (*AuthRoleRevokePermissionRequest) ProtoMessage() {} -func (*AuthRoleRevokePermissionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{79} -} -func (m *AuthRoleRevokePermissionRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthRoleRevokePermissionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthRoleRevokePermissionRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *AuthRoleRevokePermissionRequest) Reset() { + *x = AuthRoleRevokePermissionRequest{} + mi := &file_rpc_proto_msgTypes[79] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthRoleRevokePermissionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthRoleRevokePermissionRequest.Merge(m, src) -} -func (m *AuthRoleRevokePermissionRequest) XXX_Size() int { - return m.Size() + +func (x *AuthRoleRevokePermissionRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthRoleRevokePermissionRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthRoleRevokePermissionRequest.DiscardUnknown(m) + +func (*AuthRoleRevokePermissionRequest) ProtoMessage() {} + +func (x *AuthRoleRevokePermissionRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[79] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AuthRoleRevokePermissionRequest proto.InternalMessageInfo +// Deprecated: Use AuthRoleRevokePermissionRequest.ProtoReflect.Descriptor instead. +func (*AuthRoleRevokePermissionRequest) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{79} +} -func (m *AuthRoleRevokePermissionRequest) GetRole() string { - if m != nil { - return m.Role +func (x *AuthRoleRevokePermissionRequest) GetRole() string { + if x != nil { + return x.Role } return "" } -func (m *AuthRoleRevokePermissionRequest) GetKey() []byte { - if m != nil { - return m.Key +func (x *AuthRoleRevokePermissionRequest) GetKey() []byte { + if x != nil { + return x.Key } return nil } -func (m *AuthRoleRevokePermissionRequest) GetRangeEnd() []byte { - if m != nil { - return m.RangeEnd +func (x *AuthRoleRevokePermissionRequest) GetRangeEnd() []byte { + if x != nil { + return x.RangeEnd } return nil } type AuthEnableResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthEnableResponse) Reset() { *m = AuthEnableResponse{} } -func (m *AuthEnableResponse) String() string { return proto.CompactTextString(m) } -func (*AuthEnableResponse) ProtoMessage() {} -func (*AuthEnableResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{80} -} -func (m *AuthEnableResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthEnableResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthEnableResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AuthEnableResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthEnableResponse.Merge(m, src) +func (x *AuthEnableResponse) Reset() { + *x = AuthEnableResponse{} + mi := &file_rpc_proto_msgTypes[80] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthEnableResponse) XXX_Size() int { - return m.Size() + +func (x *AuthEnableResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthEnableResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthEnableResponse.DiscardUnknown(m) + +func (*AuthEnableResponse) ProtoMessage() {} + +func (x *AuthEnableResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[80] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AuthEnableResponse proto.InternalMessageInfo +// Deprecated: Use AuthEnableResponse.ProtoReflect.Descriptor instead. +func (*AuthEnableResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{80} +} -func (m *AuthEnableResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *AuthEnableResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } type AuthDisableResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthDisableResponse) Reset() { *m = AuthDisableResponse{} } -func (m *AuthDisableResponse) String() string { return proto.CompactTextString(m) } -func (*AuthDisableResponse) ProtoMessage() {} -func (*AuthDisableResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{81} -} -func (m *AuthDisableResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthDisableResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthDisableResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *AuthDisableResponse) Reset() { + *x = AuthDisableResponse{} + mi := &file_rpc_proto_msgTypes[81] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthDisableResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthDisableResponse.Merge(m, src) -} -func (m *AuthDisableResponse) XXX_Size() int { - return m.Size() + +func (x *AuthDisableResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthDisableResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthDisableResponse.DiscardUnknown(m) + +func (*AuthDisableResponse) ProtoMessage() {} + +func (x *AuthDisableResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[81] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AuthDisableResponse proto.InternalMessageInfo +// Deprecated: Use AuthDisableResponse.ProtoReflect.Descriptor instead. +func (*AuthDisableResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{81} +} -func (m *AuthDisableResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *AuthDisableResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } type AuthStatusResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - Enabled bool `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Enabled bool `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"` // authRevision is the current revision of auth store - AuthRevision uint64 `protobuf:"varint,3,opt,name=authRevision,proto3" json:"authRevision,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + AuthRevision uint64 `protobuf:"varint,3,opt,name=authRevision,proto3" json:"authRevision,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthStatusResponse) Reset() { *m = AuthStatusResponse{} } -func (m *AuthStatusResponse) String() string { return proto.CompactTextString(m) } -func (*AuthStatusResponse) ProtoMessage() {} -func (*AuthStatusResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{82} -} -func (m *AuthStatusResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthStatusResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AuthStatusResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthStatusResponse.Merge(m, src) +func (x *AuthStatusResponse) Reset() { + *x = AuthStatusResponse{} + mi := &file_rpc_proto_msgTypes[82] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthStatusResponse) XXX_Size() int { - return m.Size() + +func (x *AuthStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthStatusResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthStatusResponse.DiscardUnknown(m) + +func (*AuthStatusResponse) ProtoMessage() {} + +func (x *AuthStatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[82] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AuthStatusResponse proto.InternalMessageInfo +// Deprecated: Use AuthStatusResponse.ProtoReflect.Descriptor instead. +func (*AuthStatusResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{82} +} -func (m *AuthStatusResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *AuthStatusResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *AuthStatusResponse) GetEnabled() bool { - if m != nil { - return m.Enabled +func (x *AuthStatusResponse) GetEnabled() bool { + if x != nil { + return x.Enabled } return false } -func (m *AuthStatusResponse) GetAuthRevision() uint64 { - if m != nil { - return m.AuthRevision +func (x *AuthStatusResponse) GetAuthRevision() uint64 { + if x != nil { + return x.AuthRevision } return 0 } type AuthenticateResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // token is an authorized token that can be used in succeeding RPCs - Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthenticateResponse) Reset() { *m = AuthenticateResponse{} } -func (m *AuthenticateResponse) String() string { return proto.CompactTextString(m) } -func (*AuthenticateResponse) ProtoMessage() {} -func (*AuthenticateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{83} -} -func (m *AuthenticateResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthenticateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthenticateResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AuthenticateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthenticateResponse.Merge(m, src) +func (x *AuthenticateResponse) Reset() { + *x = AuthenticateResponse{} + mi := &file_rpc_proto_msgTypes[83] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthenticateResponse) XXX_Size() int { - return m.Size() + +func (x *AuthenticateResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthenticateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthenticateResponse.DiscardUnknown(m) + +func (*AuthenticateResponse) ProtoMessage() {} + +func (x *AuthenticateResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[83] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AuthenticateResponse proto.InternalMessageInfo +// Deprecated: Use AuthenticateResponse.ProtoReflect.Descriptor instead. +func (*AuthenticateResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{83} +} -func (m *AuthenticateResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *AuthenticateResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *AuthenticateResponse) GetToken() string { - if m != nil { - return m.Token +func (x *AuthenticateResponse) GetToken() string { + if x != nil { + return x.Token } return "" } type AuthUserAddResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthUserAddResponse) Reset() { *m = AuthUserAddResponse{} } -func (m *AuthUserAddResponse) String() string { return proto.CompactTextString(m) } -func (*AuthUserAddResponse) ProtoMessage() {} -func (*AuthUserAddResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{84} -} -func (m *AuthUserAddResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthUserAddResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthUserAddResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +func (x *AuthUserAddResponse) Reset() { + *x = AuthUserAddResponse{} + mi := &file_rpc_proto_msgTypes[84] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthUserAddResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthUserAddResponse.Merge(m, src) -} -func (m *AuthUserAddResponse) XXX_Size() int { - return m.Size() + +func (x *AuthUserAddResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthUserAddResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthUserAddResponse.DiscardUnknown(m) + +func (*AuthUserAddResponse) ProtoMessage() {} + +func (x *AuthUserAddResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[84] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AuthUserAddResponse proto.InternalMessageInfo +// Deprecated: Use AuthUserAddResponse.ProtoReflect.Descriptor instead. +func (*AuthUserAddResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{84} +} -func (m *AuthUserAddResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *AuthUserAddResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } type AuthUserGetResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - Roles []string `protobuf:"bytes,2,rep,name=roles,proto3" json:"roles,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Roles []string `protobuf:"bytes,2,rep,name=roles,proto3" json:"roles,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthUserGetResponse) Reset() { *m = AuthUserGetResponse{} } -func (m *AuthUserGetResponse) String() string { return proto.CompactTextString(m) } -func (*AuthUserGetResponse) ProtoMessage() {} -func (*AuthUserGetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{85} -} -func (m *AuthUserGetResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthUserGetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthUserGetResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AuthUserGetResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthUserGetResponse.Merge(m, src) +func (x *AuthUserGetResponse) Reset() { + *x = AuthUserGetResponse{} + mi := &file_rpc_proto_msgTypes[85] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthUserGetResponse) XXX_Size() int { - return m.Size() + +func (x *AuthUserGetResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AuthUserGetResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthUserGetResponse.DiscardUnknown(m) + +func (*AuthUserGetResponse) ProtoMessage() {} + +func (x *AuthUserGetResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[85] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AuthUserGetResponse proto.InternalMessageInfo +// Deprecated: Use AuthUserGetResponse.ProtoReflect.Descriptor instead. +func (*AuthUserGetResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{85} +} -func (m *AuthUserGetResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *AuthUserGetResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *AuthUserGetResponse) GetRoles() []string { - if m != nil { - return m.Roles +func (x *AuthUserGetResponse) GetRoles() []string { + if x != nil { + return x.Roles } return nil } type AuthUserDeleteResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthUserDeleteResponse) Reset() { *m = AuthUserDeleteResponse{} } -func (m *AuthUserDeleteResponse) String() string { return proto.CompactTextString(m) } -func (*AuthUserDeleteResponse) ProtoMessage() {} -func (*AuthUserDeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{86} -} -func (m *AuthUserDeleteResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthUserDeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthUserDeleteResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AuthUserDeleteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthUserDeleteResponse.Merge(m, src) -} -func (m *AuthUserDeleteResponse) XXX_Size() int { - return m.Size() +func (x *AuthUserDeleteResponse) Reset() { + *x = AuthUserDeleteResponse{} + mi := &file_rpc_proto_msgTypes[86] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthUserDeleteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthUserDeleteResponse.DiscardUnknown(m) + +func (x *AuthUserDeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_AuthUserDeleteResponse proto.InternalMessageInfo +func (*AuthUserDeleteResponse) ProtoMessage() {} -func (m *AuthUserDeleteResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *AuthUserDeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[86] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return nil + return mi.MessageOf(x) } -type AuthUserChangePasswordResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Deprecated: Use AuthUserDeleteResponse.ProtoReflect.Descriptor instead. +func (*AuthUserDeleteResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{86} } -func (m *AuthUserChangePasswordResponse) Reset() { *m = AuthUserChangePasswordResponse{} } -func (m *AuthUserChangePasswordResponse) String() string { return proto.CompactTextString(m) } -func (*AuthUserChangePasswordResponse) ProtoMessage() {} -func (*AuthUserChangePasswordResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{87} -} -func (m *AuthUserChangePasswordResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthUserChangePasswordResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthUserChangePasswordResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *AuthUserDeleteResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } + return nil } -func (m *AuthUserChangePasswordResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthUserChangePasswordResponse.Merge(m, src) + +type AuthUserChangePasswordResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthUserChangePasswordResponse) XXX_Size() int { - return m.Size() + +func (x *AuthUserChangePasswordResponse) Reset() { + *x = AuthUserChangePasswordResponse{} + mi := &file_rpc_proto_msgTypes[87] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthUserChangePasswordResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthUserChangePasswordResponse.DiscardUnknown(m) + +func (x *AuthUserChangePasswordResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_AuthUserChangePasswordResponse proto.InternalMessageInfo +func (*AuthUserChangePasswordResponse) ProtoMessage() {} -func (m *AuthUserChangePasswordResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *AuthUserChangePasswordResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[87] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return nil + return mi.MessageOf(x) } -type AuthUserGrantRoleResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Deprecated: Use AuthUserChangePasswordResponse.ProtoReflect.Descriptor instead. +func (*AuthUserChangePasswordResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{87} } -func (m *AuthUserGrantRoleResponse) Reset() { *m = AuthUserGrantRoleResponse{} } -func (m *AuthUserGrantRoleResponse) String() string { return proto.CompactTextString(m) } -func (*AuthUserGrantRoleResponse) ProtoMessage() {} -func (*AuthUserGrantRoleResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{88} -} -func (m *AuthUserGrantRoleResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthUserGrantRoleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthUserGrantRoleResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *AuthUserChangePasswordResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } + return nil } -func (m *AuthUserGrantRoleResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthUserGrantRoleResponse.Merge(m, src) + +type AuthUserGrantRoleResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthUserGrantRoleResponse) XXX_Size() int { - return m.Size() + +func (x *AuthUserGrantRoleResponse) Reset() { + *x = AuthUserGrantRoleResponse{} + mi := &file_rpc_proto_msgTypes[88] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthUserGrantRoleResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthUserGrantRoleResponse.DiscardUnknown(m) + +func (x *AuthUserGrantRoleResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_AuthUserGrantRoleResponse proto.InternalMessageInfo +func (*AuthUserGrantRoleResponse) ProtoMessage() {} -func (m *AuthUserGrantRoleResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *AuthUserGrantRoleResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[88] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return nil + return mi.MessageOf(x) } -type AuthUserRevokeRoleResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Deprecated: Use AuthUserGrantRoleResponse.ProtoReflect.Descriptor instead. +func (*AuthUserGrantRoleResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{88} } -func (m *AuthUserRevokeRoleResponse) Reset() { *m = AuthUserRevokeRoleResponse{} } -func (m *AuthUserRevokeRoleResponse) String() string { return proto.CompactTextString(m) } -func (*AuthUserRevokeRoleResponse) ProtoMessage() {} -func (*AuthUserRevokeRoleResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{89} -} -func (m *AuthUserRevokeRoleResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthUserRevokeRoleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthUserRevokeRoleResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *AuthUserGrantRoleResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } + return nil } -func (m *AuthUserRevokeRoleResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthUserRevokeRoleResponse.Merge(m, src) + +type AuthUserRevokeRoleResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthUserRevokeRoleResponse) XXX_Size() int { - return m.Size() + +func (x *AuthUserRevokeRoleResponse) Reset() { + *x = AuthUserRevokeRoleResponse{} + mi := &file_rpc_proto_msgTypes[89] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthUserRevokeRoleResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthUserRevokeRoleResponse.DiscardUnknown(m) + +func (x *AuthUserRevokeRoleResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_AuthUserRevokeRoleResponse proto.InternalMessageInfo +func (*AuthUserRevokeRoleResponse) ProtoMessage() {} -func (m *AuthUserRevokeRoleResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *AuthUserRevokeRoleResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[89] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return nil + return mi.MessageOf(x) } -type AuthRoleAddResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Deprecated: Use AuthUserRevokeRoleResponse.ProtoReflect.Descriptor instead. +func (*AuthUserRevokeRoleResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{89} } -func (m *AuthRoleAddResponse) Reset() { *m = AuthRoleAddResponse{} } -func (m *AuthRoleAddResponse) String() string { return proto.CompactTextString(m) } -func (*AuthRoleAddResponse) ProtoMessage() {} -func (*AuthRoleAddResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{90} -} -func (m *AuthRoleAddResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthRoleAddResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthRoleAddResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *AuthUserRevokeRoleResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } + return nil } -func (m *AuthRoleAddResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthRoleAddResponse.Merge(m, src) + +type AuthRoleAddResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthRoleAddResponse) XXX_Size() int { - return m.Size() + +func (x *AuthRoleAddResponse) Reset() { + *x = AuthRoleAddResponse{} + mi := &file_rpc_proto_msgTypes[90] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthRoleAddResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthRoleAddResponse.DiscardUnknown(m) + +func (x *AuthRoleAddResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_AuthRoleAddResponse proto.InternalMessageInfo +func (*AuthRoleAddResponse) ProtoMessage() {} -func (m *AuthRoleAddResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *AuthRoleAddResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[90] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return nil + return mi.MessageOf(x) } -type AuthRoleGetResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - Perm []*authpb.Permission `protobuf:"bytes,2,rep,name=perm,proto3" json:"perm,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Deprecated: Use AuthRoleAddResponse.ProtoReflect.Descriptor instead. +func (*AuthRoleAddResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{90} } -func (m *AuthRoleGetResponse) Reset() { *m = AuthRoleGetResponse{} } -func (m *AuthRoleGetResponse) String() string { return proto.CompactTextString(m) } -func (*AuthRoleGetResponse) ProtoMessage() {} -func (*AuthRoleGetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{91} -} -func (m *AuthRoleGetResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthRoleGetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthRoleGetResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *AuthRoleAddResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } + return nil } -func (m *AuthRoleGetResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthRoleGetResponse.Merge(m, src) + +type AuthRoleGetResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Perm []*authpb.Permission `protobuf:"bytes,2,rep,name=perm,proto3" json:"perm,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *AuthRoleGetResponse) XXX_Size() int { - return m.Size() + +func (x *AuthRoleGetResponse) Reset() { + *x = AuthRoleGetResponse{} + mi := &file_rpc_proto_msgTypes[91] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthRoleGetResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthRoleGetResponse.DiscardUnknown(m) + +func (x *AuthRoleGetResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_AuthRoleGetResponse proto.InternalMessageInfo +func (*AuthRoleGetResponse) ProtoMessage() {} -func (m *AuthRoleGetResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *AuthRoleGetResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[91] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return nil + return mi.MessageOf(x) } -func (m *AuthRoleGetResponse) GetPerm() []*authpb.Permission { - if m != nil { - return m.Perm - } - return nil -} - -type AuthRoleListResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - Roles []string `protobuf:"bytes,2,rep,name=roles,proto3" json:"roles,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AuthRoleListResponse) Reset() { *m = AuthRoleListResponse{} } -func (m *AuthRoleListResponse) String() string { return proto.CompactTextString(m) } -func (*AuthRoleListResponse) ProtoMessage() {} -func (*AuthRoleListResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{92} -} -func (m *AuthRoleListResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthRoleListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthRoleListResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AuthRoleListResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthRoleListResponse.Merge(m, src) -} -func (m *AuthRoleListResponse) XXX_Size() int { - return m.Size() -} -func (m *AuthRoleListResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthRoleListResponse.DiscardUnknown(m) +// Deprecated: Use AuthRoleGetResponse.ProtoReflect.Descriptor instead. +func (*AuthRoleGetResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{91} } -var xxx_messageInfo_AuthRoleListResponse proto.InternalMessageInfo - -func (m *AuthRoleListResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *AuthRoleGetResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -func (m *AuthRoleListResponse) GetRoles() []string { - if m != nil { - return m.Roles +func (x *AuthRoleGetResponse) GetPerm() []*authpb.Permission { + if x != nil { + return x.Perm } return nil } -type AuthUserListResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - Users []string `protobuf:"bytes,2,rep,name=users,proto3" json:"users,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AuthUserListResponse) Reset() { *m = AuthUserListResponse{} } -func (m *AuthUserListResponse) String() string { return proto.CompactTextString(m) } -func (*AuthUserListResponse) ProtoMessage() {} -func (*AuthUserListResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{93} -} -func (m *AuthUserListResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthUserListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthUserListResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AuthUserListResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthUserListResponse.Merge(m, src) -} -func (m *AuthUserListResponse) XXX_Size() int { - return m.Size() -} -func (m *AuthUserListResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthUserListResponse.DiscardUnknown(m) +type AuthRoleListResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Roles []string `protobuf:"bytes,2,rep,name=roles,proto3" json:"roles,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -var xxx_messageInfo_AuthUserListResponse proto.InternalMessageInfo - -func (m *AuthUserListResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header - } - return nil +func (x *AuthRoleListResponse) Reset() { + *x = AuthRoleListResponse{} + mi := &file_rpc_proto_msgTypes[92] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *AuthUserListResponse) GetUsers() []string { - if m != nil { - return m.Users - } - return nil +func (x *AuthRoleListResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -type AuthRoleDeleteResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +func (*AuthRoleListResponse) ProtoMessage() {} -func (m *AuthRoleDeleteResponse) Reset() { *m = AuthRoleDeleteResponse{} } -func (m *AuthRoleDeleteResponse) String() string { return proto.CompactTextString(m) } -func (*AuthRoleDeleteResponse) ProtoMessage() {} -func (*AuthRoleDeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{94} -} -func (m *AuthRoleDeleteResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthRoleDeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthRoleDeleteResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (x *AuthRoleListResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[92] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil - } -} -func (m *AuthRoleDeleteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthRoleDeleteResponse.Merge(m, src) -} -func (m *AuthRoleDeleteResponse) XXX_Size() int { - return m.Size() -} -func (m *AuthRoleDeleteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthRoleDeleteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_AuthRoleDeleteResponse proto.InternalMessageInfo - -func (m *AuthRoleDeleteResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header + return ms } - return nil -} - -type AuthRoleGrantPermissionResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + return mi.MessageOf(x) } -func (m *AuthRoleGrantPermissionResponse) Reset() { *m = AuthRoleGrantPermissionResponse{} } -func (m *AuthRoleGrantPermissionResponse) String() string { return proto.CompactTextString(m) } -func (*AuthRoleGrantPermissionResponse) ProtoMessage() {} -func (*AuthRoleGrantPermissionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{95} -} -func (m *AuthRoleGrantPermissionResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthRoleGrantPermissionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthRoleGrantPermissionResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AuthRoleGrantPermissionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthRoleGrantPermissionResponse.Merge(m, src) -} -func (m *AuthRoleGrantPermissionResponse) XXX_Size() int { - return m.Size() -} -func (m *AuthRoleGrantPermissionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthRoleGrantPermissionResponse.DiscardUnknown(m) +// Deprecated: Use AuthRoleListResponse.ProtoReflect.Descriptor instead. +func (*AuthRoleListResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{92} } -var xxx_messageInfo_AuthRoleGrantPermissionResponse proto.InternalMessageInfo - -func (m *AuthRoleGrantPermissionResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *AuthRoleListResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } return nil } -type AuthRoleRevokePermissionResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AuthRoleRevokePermissionResponse) Reset() { *m = AuthRoleRevokePermissionResponse{} } -func (m *AuthRoleRevokePermissionResponse) String() string { return proto.CompactTextString(m) } -func (*AuthRoleRevokePermissionResponse) ProtoMessage() {} -func (*AuthRoleRevokePermissionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{96} -} -func (m *AuthRoleRevokePermissionResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthRoleRevokePermissionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthRoleRevokePermissionResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AuthRoleRevokePermissionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthRoleRevokePermissionResponse.Merge(m, src) -} -func (m *AuthRoleRevokePermissionResponse) XXX_Size() int { - return m.Size() -} -func (m *AuthRoleRevokePermissionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthRoleRevokePermissionResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_AuthRoleRevokePermissionResponse proto.InternalMessageInfo - -func (m *AuthRoleRevokePermissionResponse) GetHeader() *ResponseHeader { - if m != nil { - return m.Header +func (x *AuthRoleListResponse) GetRoles() []string { + if x != nil { + return x.Roles } return nil } -func init() { - proto.RegisterEnum("etcdserverpb.AlarmType", AlarmType_name, AlarmType_value) - proto.RegisterEnum("etcdserverpb.RangeRequest_SortOrder", RangeRequest_SortOrder_name, RangeRequest_SortOrder_value) - proto.RegisterEnum("etcdserverpb.RangeRequest_SortTarget", RangeRequest_SortTarget_name, RangeRequest_SortTarget_value) - proto.RegisterEnum("etcdserverpb.Compare_CompareResult", Compare_CompareResult_name, Compare_CompareResult_value) - proto.RegisterEnum("etcdserverpb.Compare_CompareTarget", Compare_CompareTarget_name, Compare_CompareTarget_value) - proto.RegisterEnum("etcdserverpb.WatchCreateRequest_FilterType", WatchCreateRequest_FilterType_name, WatchCreateRequest_FilterType_value) - proto.RegisterEnum("etcdserverpb.AlarmRequest_AlarmAction", AlarmRequest_AlarmAction_name, AlarmRequest_AlarmAction_value) - proto.RegisterEnum("etcdserverpb.DowngradeRequest_DowngradeAction", DowngradeRequest_DowngradeAction_name, DowngradeRequest_DowngradeAction_value) - proto.RegisterType((*ResponseHeader)(nil), "etcdserverpb.ResponseHeader") - proto.RegisterType((*RangeRequest)(nil), "etcdserverpb.RangeRequest") - proto.RegisterType((*RangeResponse)(nil), "etcdserverpb.RangeResponse") - proto.RegisterType((*PutRequest)(nil), "etcdserverpb.PutRequest") - proto.RegisterType((*PutResponse)(nil), "etcdserverpb.PutResponse") - proto.RegisterType((*DeleteRangeRequest)(nil), "etcdserverpb.DeleteRangeRequest") - proto.RegisterType((*DeleteRangeResponse)(nil), "etcdserverpb.DeleteRangeResponse") - proto.RegisterType((*RequestOp)(nil), "etcdserverpb.RequestOp") - proto.RegisterType((*ResponseOp)(nil), "etcdserverpb.ResponseOp") - proto.RegisterType((*Compare)(nil), "etcdserverpb.Compare") - proto.RegisterType((*TxnRequest)(nil), "etcdserverpb.TxnRequest") - proto.RegisterType((*TxnResponse)(nil), "etcdserverpb.TxnResponse") - proto.RegisterType((*CompactionRequest)(nil), "etcdserverpb.CompactionRequest") - proto.RegisterType((*CompactionResponse)(nil), "etcdserverpb.CompactionResponse") - proto.RegisterType((*HashRequest)(nil), "etcdserverpb.HashRequest") - proto.RegisterType((*HashKVRequest)(nil), "etcdserverpb.HashKVRequest") - proto.RegisterType((*HashKVResponse)(nil), "etcdserverpb.HashKVResponse") - proto.RegisterType((*HashResponse)(nil), "etcdserverpb.HashResponse") - proto.RegisterType((*SnapshotRequest)(nil), "etcdserverpb.SnapshotRequest") - proto.RegisterType((*SnapshotResponse)(nil), "etcdserverpb.SnapshotResponse") - proto.RegisterType((*WatchRequest)(nil), "etcdserverpb.WatchRequest") - proto.RegisterType((*WatchCreateRequest)(nil), "etcdserverpb.WatchCreateRequest") - proto.RegisterType((*WatchCancelRequest)(nil), "etcdserverpb.WatchCancelRequest") - proto.RegisterType((*WatchProgressRequest)(nil), "etcdserverpb.WatchProgressRequest") - proto.RegisterType((*WatchResponse)(nil), "etcdserverpb.WatchResponse") - proto.RegisterType((*LeaseGrantRequest)(nil), "etcdserverpb.LeaseGrantRequest") - proto.RegisterType((*LeaseGrantResponse)(nil), "etcdserverpb.LeaseGrantResponse") - proto.RegisterType((*LeaseRevokeRequest)(nil), "etcdserverpb.LeaseRevokeRequest") - proto.RegisterType((*LeaseRevokeResponse)(nil), "etcdserverpb.LeaseRevokeResponse") - proto.RegisterType((*LeaseCheckpoint)(nil), "etcdserverpb.LeaseCheckpoint") - proto.RegisterType((*LeaseCheckpointRequest)(nil), "etcdserverpb.LeaseCheckpointRequest") - proto.RegisterType((*LeaseCheckpointResponse)(nil), "etcdserverpb.LeaseCheckpointResponse") - proto.RegisterType((*LeaseKeepAliveRequest)(nil), "etcdserverpb.LeaseKeepAliveRequest") - proto.RegisterType((*LeaseKeepAliveResponse)(nil), "etcdserverpb.LeaseKeepAliveResponse") - proto.RegisterType((*LeaseTimeToLiveRequest)(nil), "etcdserverpb.LeaseTimeToLiveRequest") - proto.RegisterType((*LeaseTimeToLiveResponse)(nil), "etcdserverpb.LeaseTimeToLiveResponse") - proto.RegisterType((*LeaseLeasesRequest)(nil), "etcdserverpb.LeaseLeasesRequest") - proto.RegisterType((*LeaseStatus)(nil), "etcdserverpb.LeaseStatus") - proto.RegisterType((*LeaseLeasesResponse)(nil), "etcdserverpb.LeaseLeasesResponse") - proto.RegisterType((*Member)(nil), "etcdserverpb.Member") - proto.RegisterType((*MemberAddRequest)(nil), "etcdserverpb.MemberAddRequest") - proto.RegisterType((*MemberAddResponse)(nil), "etcdserverpb.MemberAddResponse") - proto.RegisterType((*MemberRemoveRequest)(nil), "etcdserverpb.MemberRemoveRequest") - proto.RegisterType((*MemberRemoveResponse)(nil), "etcdserverpb.MemberRemoveResponse") - proto.RegisterType((*MemberUpdateRequest)(nil), "etcdserverpb.MemberUpdateRequest") - proto.RegisterType((*MemberUpdateResponse)(nil), "etcdserverpb.MemberUpdateResponse") - proto.RegisterType((*MemberListRequest)(nil), "etcdserverpb.MemberListRequest") - proto.RegisterType((*MemberListResponse)(nil), "etcdserverpb.MemberListResponse") - proto.RegisterType((*MemberPromoteRequest)(nil), "etcdserverpb.MemberPromoteRequest") - proto.RegisterType((*MemberPromoteResponse)(nil), "etcdserverpb.MemberPromoteResponse") - proto.RegisterType((*DefragmentRequest)(nil), "etcdserverpb.DefragmentRequest") - proto.RegisterType((*DefragmentResponse)(nil), "etcdserverpb.DefragmentResponse") - proto.RegisterType((*MoveLeaderRequest)(nil), "etcdserverpb.MoveLeaderRequest") - proto.RegisterType((*MoveLeaderResponse)(nil), "etcdserverpb.MoveLeaderResponse") - proto.RegisterType((*AlarmRequest)(nil), "etcdserverpb.AlarmRequest") - proto.RegisterType((*AlarmMember)(nil), "etcdserverpb.AlarmMember") - proto.RegisterType((*AlarmResponse)(nil), "etcdserverpb.AlarmResponse") - proto.RegisterType((*DowngradeRequest)(nil), "etcdserverpb.DowngradeRequest") - proto.RegisterType((*DowngradeResponse)(nil), "etcdserverpb.DowngradeResponse") - proto.RegisterType((*DowngradeVersionTestRequest)(nil), "etcdserverpb.DowngradeVersionTestRequest") - proto.RegisterType((*StatusRequest)(nil), "etcdserverpb.StatusRequest") - proto.RegisterType((*StatusResponse)(nil), "etcdserverpb.StatusResponse") - proto.RegisterType((*DowngradeInfo)(nil), "etcdserverpb.DowngradeInfo") - proto.RegisterType((*AuthEnableRequest)(nil), "etcdserverpb.AuthEnableRequest") - proto.RegisterType((*AuthDisableRequest)(nil), "etcdserverpb.AuthDisableRequest") - proto.RegisterType((*AuthStatusRequest)(nil), "etcdserverpb.AuthStatusRequest") - proto.RegisterType((*AuthenticateRequest)(nil), "etcdserverpb.AuthenticateRequest") - proto.RegisterType((*AuthUserAddRequest)(nil), "etcdserverpb.AuthUserAddRequest") - proto.RegisterType((*AuthUserGetRequest)(nil), "etcdserverpb.AuthUserGetRequest") - proto.RegisterType((*AuthUserDeleteRequest)(nil), "etcdserverpb.AuthUserDeleteRequest") - proto.RegisterType((*AuthUserChangePasswordRequest)(nil), "etcdserverpb.AuthUserChangePasswordRequest") - proto.RegisterType((*AuthUserGrantRoleRequest)(nil), "etcdserverpb.AuthUserGrantRoleRequest") - proto.RegisterType((*AuthUserRevokeRoleRequest)(nil), "etcdserverpb.AuthUserRevokeRoleRequest") - proto.RegisterType((*AuthRoleAddRequest)(nil), "etcdserverpb.AuthRoleAddRequest") - proto.RegisterType((*AuthRoleGetRequest)(nil), "etcdserverpb.AuthRoleGetRequest") - proto.RegisterType((*AuthUserListRequest)(nil), "etcdserverpb.AuthUserListRequest") - proto.RegisterType((*AuthRoleListRequest)(nil), "etcdserverpb.AuthRoleListRequest") - proto.RegisterType((*AuthRoleDeleteRequest)(nil), "etcdserverpb.AuthRoleDeleteRequest") - proto.RegisterType((*AuthRoleGrantPermissionRequest)(nil), "etcdserverpb.AuthRoleGrantPermissionRequest") - proto.RegisterType((*AuthRoleRevokePermissionRequest)(nil), "etcdserverpb.AuthRoleRevokePermissionRequest") - proto.RegisterType((*AuthEnableResponse)(nil), "etcdserverpb.AuthEnableResponse") - proto.RegisterType((*AuthDisableResponse)(nil), "etcdserverpb.AuthDisableResponse") - proto.RegisterType((*AuthStatusResponse)(nil), "etcdserverpb.AuthStatusResponse") - proto.RegisterType((*AuthenticateResponse)(nil), "etcdserverpb.AuthenticateResponse") - proto.RegisterType((*AuthUserAddResponse)(nil), "etcdserverpb.AuthUserAddResponse") - proto.RegisterType((*AuthUserGetResponse)(nil), "etcdserverpb.AuthUserGetResponse") - proto.RegisterType((*AuthUserDeleteResponse)(nil), "etcdserverpb.AuthUserDeleteResponse") - proto.RegisterType((*AuthUserChangePasswordResponse)(nil), "etcdserverpb.AuthUserChangePasswordResponse") - proto.RegisterType((*AuthUserGrantRoleResponse)(nil), "etcdserverpb.AuthUserGrantRoleResponse") - proto.RegisterType((*AuthUserRevokeRoleResponse)(nil), "etcdserverpb.AuthUserRevokeRoleResponse") - proto.RegisterType((*AuthRoleAddResponse)(nil), "etcdserverpb.AuthRoleAddResponse") - proto.RegisterType((*AuthRoleGetResponse)(nil), "etcdserverpb.AuthRoleGetResponse") - proto.RegisterType((*AuthRoleListResponse)(nil), "etcdserverpb.AuthRoleListResponse") - proto.RegisterType((*AuthUserListResponse)(nil), "etcdserverpb.AuthUserListResponse") - proto.RegisterType((*AuthRoleDeleteResponse)(nil), "etcdserverpb.AuthRoleDeleteResponse") - proto.RegisterType((*AuthRoleGrantPermissionResponse)(nil), "etcdserverpb.AuthRoleGrantPermissionResponse") - proto.RegisterType((*AuthRoleRevokePermissionResponse)(nil), "etcdserverpb.AuthRoleRevokePermissionResponse") -} - -func init() { proto.RegisterFile("rpc.proto", fileDescriptor_77a6da22d6a3feb1) } - -var fileDescriptor_77a6da22d6a3feb1 = []byte{ - // 4574 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x3c, 0x5d, 0x6f, 0x1b, 0x57, - 0x76, 0x1a, 0x92, 0x12, 0xc9, 0xc3, 0x0f, 0xd1, 0xd7, 0xb2, 0x4d, 0xd3, 0xb6, 0xac, 0x8c, 0xed, - 0xc4, 0x71, 0x62, 0xd1, 0x96, 0xec, 0x64, 0xeb, 0x22, 0xe9, 0xd2, 0x12, 0x63, 0x6b, 0x2d, 0x4b, - 0xca, 0x88, 0x76, 0x36, 0x2e, 0xb0, 0xea, 0x88, 0xbc, 0xa6, 0x66, 0x45, 0xce, 0x70, 0x67, 0x86, - 0xb4, 0x94, 0x3e, 0x6c, 0xba, 0xed, 0x76, 0xb1, 0x2d, 0xb0, 0x40, 0x53, 0xa0, 0x58, 0x14, 0xed, - 0x4b, 0x5b, 0xa0, 0x7d, 0x68, 0x8b, 0xf6, 0xa1, 0x0f, 0x45, 0x0b, 0xf4, 0xa1, 0x7d, 0x68, 0x1f, - 0x0a, 0x14, 0xe8, 0x1f, 0x68, 0xd3, 0x7d, 0xea, 0xaf, 0x58, 0xdc, 0xaf, 0xb9, 0x77, 0xbe, 0x24, - 0x67, 0xa5, 0x60, 0x5f, 0x62, 0xce, 0x3d, 0x9f, 0xf7, 0x9c, 0x7b, 0xcf, 0xb9, 0xf7, 0x9c, 0x1b, - 0x41, 0xd1, 0x1d, 0x75, 0x17, 0x47, 0xae, 0xe3, 0x3b, 0xa8, 0x8c, 0xfd, 0x6e, 0xcf, 0xc3, 0xee, - 0x04, 0xbb, 0xa3, 0xdd, 0xc6, 0x5c, 0xdf, 0xe9, 0x3b, 0x14, 0xd0, 0x24, 0xbf, 0x18, 0x4e, 0xa3, - 0x4e, 0x70, 0x9a, 0xe6, 0xc8, 0x6a, 0x0e, 0x27, 0xdd, 0xee, 0x68, 0xb7, 0xb9, 0x3f, 0xe1, 0x90, - 0x46, 0x00, 0x31, 0xc7, 0xfe, 0xde, 0x68, 0x97, 0xfe, 0xc3, 0x61, 0x0b, 0x01, 0x6c, 0x82, 0x5d, - 0xcf, 0x72, 0xec, 0xd1, 0xae, 0xf8, 0xc5, 0x31, 0x2e, 0xf7, 0x1d, 0xa7, 0x3f, 0xc0, 0x8c, 0xde, - 0xb6, 0x1d, 0xdf, 0xf4, 0x2d, 0xc7, 0xf6, 0x38, 0x94, 0xfd, 0xd3, 0xbd, 0xdd, 0xc7, 0xf6, 0x6d, - 0x67, 0x84, 0x6d, 0x73, 0x64, 0x4d, 0x96, 0x9a, 0xce, 0x88, 0xe2, 0xc4, 0xf1, 0xf5, 0x9f, 0x68, - 0x50, 0x35, 0xb0, 0x37, 0x72, 0x6c, 0x0f, 0x3f, 0xc6, 0x66, 0x0f, 0xbb, 0xe8, 0x0a, 0x40, 0x77, - 0x30, 0xf6, 0x7c, 0xec, 0xee, 0x58, 0xbd, 0xba, 0xb6, 0xa0, 0xdd, 0xcc, 0x19, 0x45, 0x3e, 0xb2, - 0xd6, 0x43, 0x97, 0xa0, 0x38, 0xc4, 0xc3, 0x5d, 0x06, 0xcd, 0x50, 0x68, 0x81, 0x0d, 0xac, 0xf5, - 0x50, 0x03, 0x0a, 0x2e, 0x9e, 0x58, 0x44, 0xdd, 0x7a, 0x76, 0x41, 0xbb, 0x99, 0x35, 0x82, 0x6f, - 0x42, 0xe8, 0x9a, 0x2f, 0xfd, 0x1d, 0x1f, 0xbb, 0xc3, 0x7a, 0x8e, 0x11, 0x92, 0x81, 0x0e, 0x76, - 0x87, 0x0f, 0xf2, 0x3f, 0xf8, 0x87, 0x7a, 0x76, 0x79, 0xf1, 0x8e, 0xfe, 0xaf, 0xd3, 0x50, 0x36, - 0x4c, 0xbb, 0x8f, 0x0d, 0xfc, 0xbd, 0x31, 0xf6, 0x7c, 0x54, 0x83, 0xec, 0x3e, 0x3e, 0xa4, 0x7a, - 0x94, 0x0d, 0xf2, 0x93, 0x31, 0xb2, 0xfb, 0x78, 0x07, 0xdb, 0x4c, 0x83, 0x32, 0x61, 0x64, 0xf7, - 0x71, 0xdb, 0xee, 0xa1, 0x39, 0x98, 0x1e, 0x58, 0x43, 0xcb, 0xe7, 0xe2, 0xd9, 0x47, 0x48, 0xaf, - 0x5c, 0x44, 0xaf, 0x15, 0x00, 0xcf, 0x71, 0xfd, 0x1d, 0xc7, 0xed, 0x61, 0xb7, 0x3e, 0xbd, 0xa0, - 0xdd, 0xac, 0x2e, 0x5d, 0x5f, 0x54, 0x3d, 0xbc, 0xa8, 0x2a, 0xb4, 0xb8, 0xed, 0xb8, 0xfe, 0x26, - 0xc1, 0x35, 0x8a, 0x9e, 0xf8, 0x89, 0x3e, 0x82, 0x12, 0x65, 0xe2, 0x9b, 0x6e, 0x1f, 0xfb, 0xf5, - 0x19, 0xca, 0xe5, 0xc6, 0x31, 0x5c, 0x3a, 0x14, 0xd9, 0xa0, 0xe2, 0xd9, 0x6f, 0xa4, 0x43, 0xd9, - 0xc3, 0xae, 0x65, 0x0e, 0xac, 0xcf, 0xcc, 0xdd, 0x01, 0xae, 0xe7, 0x17, 0xb4, 0x9b, 0x05, 0x23, - 0x34, 0x46, 0xe6, 0xbf, 0x8f, 0x0f, 0xbd, 0x1d, 0xc7, 0x1e, 0x1c, 0xd6, 0x0b, 0x14, 0xa1, 0x40, - 0x06, 0x36, 0xed, 0xc1, 0x21, 0xf5, 0x9e, 0x33, 0xb6, 0x7d, 0x06, 0x2d, 0x52, 0x68, 0x91, 0x8e, - 0x50, 0xf0, 0x5d, 0xa8, 0x0d, 0x2d, 0x7b, 0x67, 0xe8, 0xf4, 0x76, 0x02, 0x83, 0x00, 0x31, 0xc8, - 0xc3, 0xfc, 0xef, 0x51, 0x0f, 0xdc, 0x35, 0xaa, 0x43, 0xcb, 0x7e, 0xea, 0xf4, 0x0c, 0x61, 0x1f, - 0x42, 0x62, 0x1e, 0x84, 0x49, 0x4a, 0x51, 0x12, 0xf3, 0x40, 0x25, 0x79, 0x1f, 0xce, 0x12, 0x29, - 0x5d, 0x17, 0x9b, 0x3e, 0x96, 0x54, 0xe5, 0x30, 0xd5, 0x99, 0xa1, 0x65, 0xaf, 0x50, 0x94, 0x10, - 0xa1, 0x79, 0x10, 0x23, 0xac, 0x44, 0x09, 0xcd, 0x83, 0x30, 0xa1, 0xfe, 0x3e, 0x14, 0x03, 0xbf, - 0xa0, 0x02, 0xe4, 0x36, 0x36, 0x37, 0xda, 0xb5, 0x29, 0x04, 0x30, 0xd3, 0xda, 0x5e, 0x69, 0x6f, - 0xac, 0xd6, 0x34, 0x54, 0x82, 0xfc, 0x6a, 0x9b, 0x7d, 0x64, 0x1a, 0xf9, 0x2f, 0xf8, 0x7a, 0x7b, - 0x02, 0x20, 0x5d, 0x81, 0xf2, 0x90, 0x7d, 0xd2, 0xfe, 0xb4, 0x36, 0x45, 0x90, 0x9f, 0xb7, 0x8d, - 0xed, 0xb5, 0xcd, 0x8d, 0x9a, 0x46, 0xb8, 0xac, 0x18, 0xed, 0x56, 0xa7, 0x5d, 0xcb, 0x10, 0x8c, - 0xa7, 0x9b, 0xab, 0xb5, 0x2c, 0x2a, 0xc2, 0xf4, 0xf3, 0xd6, 0xfa, 0xb3, 0x76, 0x2d, 0x17, 0x30, - 0x93, 0xab, 0xf8, 0x4f, 0x34, 0xa8, 0x70, 0x77, 0xb3, 0xbd, 0x85, 0xee, 0xc1, 0xcc, 0x1e, 0xdd, - 0x5f, 0x74, 0x25, 0x97, 0x96, 0x2e, 0x47, 0xd6, 0x46, 0x68, 0x0f, 0x1a, 0x1c, 0x17, 0xe9, 0x90, - 0xdd, 0x9f, 0x78, 0xf5, 0xcc, 0x42, 0xf6, 0x66, 0x69, 0xa9, 0xb6, 0xc8, 0x22, 0xc9, 0xe2, 0x13, - 0x7c, 0xf8, 0xdc, 0x1c, 0x8c, 0xb1, 0x41, 0x80, 0x08, 0x41, 0x6e, 0xe8, 0xb8, 0x98, 0x2e, 0xf8, - 0x82, 0x41, 0x7f, 0x93, 0x5d, 0x40, 0x7d, 0xce, 0x17, 0x3b, 0xfb, 0x90, 0xea, 0xfd, 0xa7, 0x06, - 0xb0, 0x35, 0xf6, 0xd3, 0xb7, 0xd8, 0x1c, 0x4c, 0x4f, 0x88, 0x04, 0xbe, 0xbd, 0xd8, 0x07, 0xdd, - 0x5b, 0xd8, 0xf4, 0x70, 0xb0, 0xb7, 0xc8, 0x07, 0x5a, 0x80, 0xfc, 0xc8, 0xc5, 0x93, 0x9d, 0xfd, - 0x09, 0x95, 0x56, 0x90, 0x7e, 0x9a, 0x21, 0xe3, 0x4f, 0x26, 0xe8, 0x16, 0x94, 0xad, 0xbe, 0xed, - 0xb8, 0x78, 0x87, 0x31, 0x9d, 0x56, 0xd1, 0x96, 0x8c, 0x12, 0x03, 0xd2, 0x29, 0x29, 0xb8, 0x4c, - 0xd4, 0x4c, 0x22, 0xee, 0x3a, 0x81, 0xc9, 0xf9, 0x7c, 0xae, 0x41, 0x89, 0xce, 0xe7, 0x44, 0xc6, - 0x5e, 0x92, 0x13, 0xc9, 0x50, 0xb2, 0x98, 0xc1, 0x63, 0x53, 0x93, 0x2a, 0xd8, 0x80, 0x56, 0xf1, - 0x00, 0xfb, 0xf8, 0x24, 0xc1, 0x4b, 0x31, 0x65, 0x36, 0xd1, 0x94, 0x52, 0xde, 0x5f, 0x68, 0x70, - 0x36, 0x24, 0xf0, 0x44, 0x53, 0xaf, 0x43, 0xbe, 0x47, 0x99, 0x31, 0x9d, 0xb2, 0x86, 0xf8, 0x44, - 0xf7, 0xa0, 0xc0, 0x55, 0xf2, 0xea, 0xd9, 0xe4, 0x65, 0x28, 0xb5, 0xcc, 0x33, 0x2d, 0x3d, 0xa9, - 0xe6, 0x3f, 0x65, 0xa0, 0xc8, 0x8d, 0xb1, 0x39, 0x42, 0x2d, 0xa8, 0xb8, 0xec, 0x63, 0x87, 0xce, - 0x99, 0xeb, 0xd8, 0x48, 0x8f, 0x93, 0x8f, 0xa7, 0x8c, 0x32, 0x27, 0xa1, 0xc3, 0xe8, 0x57, 0xa1, - 0x24, 0x58, 0x8c, 0xc6, 0x3e, 0x77, 0x54, 0x3d, 0xcc, 0x40, 0x2e, 0xed, 0xc7, 0x53, 0x06, 0x70, - 0xf4, 0xad, 0xb1, 0x8f, 0x3a, 0x30, 0x27, 0x88, 0xd9, 0xfc, 0xb8, 0x1a, 0x59, 0xca, 0x65, 0x21, - 0xcc, 0x25, 0xee, 0xce, 0xc7, 0x53, 0x06, 0xe2, 0xf4, 0x0a, 0x10, 0xad, 0x4a, 0x95, 0xfc, 0x03, - 0x96, 0x5f, 0x62, 0x2a, 0x75, 0x0e, 0x6c, 0xce, 0x44, 0x58, 0x6b, 0x59, 0xd1, 0xad, 0x73, 0x60, - 0x07, 0x26, 0x7b, 0x58, 0x84, 0x3c, 0x1f, 0xd6, 0xff, 0x23, 0x03, 0x20, 0x3c, 0xb6, 0x39, 0x42, - 0xab, 0x50, 0x75, 0xf9, 0x57, 0xc8, 0x7e, 0x97, 0x12, 0xed, 0xc7, 0x1d, 0x3d, 0x65, 0x54, 0x04, - 0x11, 0x53, 0xf7, 0x43, 0x28, 0x07, 0x5c, 0xa4, 0x09, 0x2f, 0x26, 0x98, 0x30, 0xe0, 0x50, 0x12, - 0x04, 0xc4, 0x88, 0x9f, 0xc0, 0xb9, 0x80, 0x3e, 0xc1, 0x8a, 0x6f, 0x1c, 0x61, 0xc5, 0x80, 0xe1, - 0x59, 0xc1, 0x41, 0xb5, 0xe3, 0x23, 0x45, 0x31, 0x69, 0xc8, 0x8b, 0x09, 0x86, 0x64, 0x48, 0xaa, - 0x25, 0x03, 0x0d, 0x43, 0xa6, 0x04, 0x92, 0xf6, 0xd9, 0xb8, 0xfe, 0x57, 0x39, 0xc8, 0xaf, 0x38, - 0xc3, 0x91, 0xe9, 0x92, 0x45, 0x34, 0xe3, 0x62, 0x6f, 0x3c, 0xf0, 0xa9, 0x01, 0xab, 0x4b, 0xd7, - 0xc2, 0x32, 0x38, 0x9a, 0xf8, 0xd7, 0xa0, 0xa8, 0x06, 0x27, 0x21, 0xc4, 0x3c, 0xcb, 0x67, 0x5e, - 0x83, 0x98, 0xe7, 0x78, 0x4e, 0x22, 0x02, 0x42, 0x56, 0x06, 0x84, 0x06, 0xe4, 0xf9, 0x01, 0x8f, - 0x05, 0xeb, 0xc7, 0x53, 0x86, 0x18, 0x40, 0x6f, 0xc3, 0x6c, 0x34, 0x15, 0x4e, 0x73, 0x9c, 0x6a, - 0x37, 0x9c, 0x39, 0xaf, 0x41, 0x39, 0x94, 0xa1, 0x67, 0x38, 0x5e, 0x69, 0xa8, 0xe4, 0xe5, 0xf3, - 0x22, 0xac, 0x93, 0x63, 0x45, 0xf9, 0xf1, 0x94, 0x08, 0xec, 0x57, 0x45, 0x60, 0x2f, 0xa8, 0x89, - 0x96, 0xd8, 0x95, 0xc7, 0xf8, 0xeb, 0x6a, 0xd4, 0xfa, 0x26, 0x21, 0x0e, 0x90, 0x64, 0xf8, 0xd2, - 0x0d, 0xa8, 0x84, 0x4c, 0x46, 0x72, 0x64, 0xfb, 0xe3, 0x67, 0xad, 0x75, 0x96, 0x50, 0x1f, 0xd1, - 0x1c, 0x6a, 0xd4, 0x34, 0x92, 0xa0, 0xd7, 0xdb, 0xdb, 0xdb, 0xb5, 0x0c, 0x3a, 0x0f, 0xc5, 0x8d, - 0xcd, 0xce, 0x0e, 0xc3, 0xca, 0x36, 0xf2, 0x7f, 0xcc, 0x22, 0x89, 0xcc, 0xcf, 0x9f, 0x06, 0x3c, - 0x79, 0x8a, 0x56, 0x32, 0xf3, 0x94, 0x92, 0x99, 0x35, 0x91, 0x99, 0x33, 0x32, 0x33, 0x67, 0x11, - 0x82, 0xe9, 0xf5, 0x76, 0x6b, 0x9b, 0x26, 0x69, 0xc6, 0x7a, 0x39, 0x9e, 0xad, 0x1f, 0x56, 0xa1, - 0xcc, 0xdc, 0xb3, 0x33, 0xb6, 0xc9, 0x61, 0xe2, 0xaf, 0x35, 0x00, 0xb9, 0x61, 0x51, 0x13, 0xf2, - 0x5d, 0xa6, 0x42, 0x5d, 0xa3, 0x11, 0xf0, 0x5c, 0xa2, 0xc7, 0x0d, 0x81, 0x85, 0xee, 0x42, 0xde, - 0x1b, 0x77, 0xbb, 0xd8, 0x13, 0x99, 0xfb, 0x42, 0x34, 0x08, 0xf3, 0x80, 0x68, 0x08, 0x3c, 0x42, - 0xf2, 0xd2, 0xb4, 0x06, 0x63, 0x9a, 0xc7, 0x8f, 0x26, 0xe1, 0x78, 0x32, 0xc6, 0xfe, 0x99, 0x06, - 0x25, 0x65, 0x5b, 0xfc, 0x82, 0x29, 0xe0, 0x32, 0x14, 0xa9, 0x32, 0xb8, 0xc7, 0x93, 0x40, 0xc1, - 0x90, 0x03, 0xe8, 0x3d, 0x28, 0x8a, 0x9d, 0x24, 0xf2, 0x40, 0x3d, 0x99, 0xed, 0xe6, 0xc8, 0x90, - 0xa8, 0x52, 0xc9, 0x0e, 0x9c, 0xa1, 0x76, 0xea, 0x92, 0xdb, 0x87, 0xb0, 0xac, 0x7a, 0x2c, 0xd7, - 0x22, 0xc7, 0xf2, 0x06, 0x14, 0x46, 0x7b, 0x87, 0x9e, 0xd5, 0x35, 0x07, 0x5c, 0x9d, 0xe0, 0x5b, - 0x72, 0xdd, 0x06, 0xa4, 0x72, 0x3d, 0x89, 0x01, 0x24, 0xd3, 0xf3, 0x50, 0x7a, 0x6c, 0x7a, 0x7b, - 0x5c, 0x49, 0x39, 0x7e, 0x0f, 0x2a, 0x64, 0xfc, 0xc9, 0xf3, 0xd7, 0x50, 0x5f, 0x50, 0x2d, 0xeb, - 0xff, 0xac, 0x41, 0x55, 0x90, 0x9d, 0xc8, 0x41, 0x08, 0x72, 0x7b, 0xa6, 0xb7, 0x47, 0x8d, 0x51, - 0x31, 0xe8, 0x6f, 0xf4, 0x36, 0xd4, 0xba, 0x6c, 0xfe, 0x3b, 0x91, 0x7b, 0xd7, 0x2c, 0x1f, 0x0f, - 0xf6, 0xfe, 0xbb, 0x50, 0x21, 0x24, 0x3b, 0xe1, 0x7b, 0x90, 0xd8, 0xc6, 0xef, 0x19, 0xe5, 0x3d, - 0x3a, 0xe7, 0xa8, 0xfa, 0x26, 0x94, 0x99, 0x31, 0x4e, 0x5b, 0x77, 0x69, 0xd7, 0x06, 0xcc, 0x6e, - 0xdb, 0xe6, 0xc8, 0xdb, 0x73, 0xfc, 0x88, 0xcd, 0x97, 0xf5, 0xbf, 0xd7, 0xa0, 0x26, 0x81, 0x27, - 0xd2, 0xe1, 0x2d, 0x98, 0x75, 0xf1, 0xd0, 0xb4, 0x6c, 0xcb, 0xee, 0xef, 0xec, 0x1e, 0xfa, 0xd8, - 0xe3, 0xd7, 0xd7, 0x6a, 0x30, 0xfc, 0x90, 0x8c, 0x12, 0x65, 0x77, 0x07, 0xce, 0x2e, 0x0f, 0xd2, - 0xf4, 0x37, 0x7a, 0x23, 0x1c, 0xa5, 0x8b, 0xd2, 0x6e, 0x62, 0x5c, 0xea, 0xfc, 0xd3, 0x0c, 0x94, - 0x3f, 0x31, 0xfd, 0xae, 0x58, 0x41, 0x68, 0x0d, 0xaa, 0x41, 0x18, 0xa7, 0x23, 0x5c, 0xef, 0xc8, - 0x81, 0x83, 0xd2, 0x88, 0x7b, 0x8d, 0x38, 0x70, 0x54, 0xba, 0xea, 0x00, 0x65, 0x65, 0xda, 0x5d, - 0x3c, 0x08, 0x58, 0x65, 0xd2, 0x59, 0x51, 0x44, 0x95, 0x95, 0x3a, 0x80, 0xbe, 0x0d, 0xb5, 0x91, - 0xeb, 0xf4, 0x5d, 0xec, 0x79, 0x01, 0x33, 0x96, 0xc2, 0xf5, 0x04, 0x66, 0x5b, 0x1c, 0x35, 0x72, - 0x8a, 0xb9, 0xf7, 0x78, 0xca, 0x98, 0x1d, 0x85, 0x61, 0x32, 0xb0, 0xce, 0xca, 0xf3, 0x1e, 0x8b, - 0xac, 0x3f, 0xca, 0x02, 0x8a, 0x4f, 0xf3, 0xab, 0x1e, 0x93, 0x6f, 0x40, 0xd5, 0xf3, 0x4d, 0x37, - 0xb6, 0xe6, 0x2b, 0x74, 0x34, 0x58, 0xf1, 0x6f, 0x41, 0xa0, 0xd9, 0x8e, 0xed, 0xf8, 0xd6, 0xcb, - 0x43, 0x76, 0x41, 0x31, 0xaa, 0x62, 0x78, 0x83, 0x8e, 0xa2, 0x0d, 0xc8, 0xbf, 0xb4, 0x06, 0x3e, - 0x76, 0xbd, 0xfa, 0xf4, 0x42, 0xf6, 0x66, 0x75, 0xe9, 0x9d, 0xe3, 0x1c, 0xb3, 0xf8, 0x11, 0xc5, - 0xef, 0x1c, 0x8e, 0xd4, 0xd3, 0x2f, 0x67, 0xa2, 0x1e, 0xe3, 0x67, 0x92, 0x6f, 0x44, 0x3a, 0x14, - 0x5e, 0x11, 0xa6, 0x3b, 0x56, 0x8f, 0xe6, 0xe2, 0x60, 0x1f, 0xde, 0x33, 0xf2, 0x14, 0xb0, 0xd6, - 0x43, 0xd7, 0xa0, 0xf0, 0xd2, 0x35, 0xfb, 0x43, 0x6c, 0xfb, 0xec, 0x96, 0x2f, 0x71, 0x02, 0x80, - 0xbe, 0x08, 0x20, 0x55, 0x21, 0x99, 0x6f, 0x63, 0x73, 0xeb, 0x59, 0xa7, 0x36, 0x85, 0xca, 0x50, - 0xd8, 0xd8, 0x5c, 0x6d, 0xaf, 0xb7, 0x49, 0x6e, 0x14, 0x39, 0xef, 0xae, 0xdc, 0x74, 0x2d, 0xe1, - 0x88, 0xd0, 0x9a, 0x50, 0xf5, 0xd2, 0xc2, 0x97, 0x6e, 0xa1, 0x97, 0x60, 0x71, 0x57, 0xbf, 0x0a, - 0x73, 0x49, 0x4b, 0x43, 0x20, 0xdc, 0xd3, 0xff, 0x2d, 0x03, 0x15, 0xbe, 0x11, 0x4e, 0xb4, 0x73, - 0x2f, 0x2a, 0x5a, 0xf1, 0xeb, 0x89, 0x30, 0x52, 0x1d, 0xf2, 0x6c, 0x83, 0xf4, 0xf8, 0xfd, 0x57, - 0x7c, 0x92, 0xe0, 0xcc, 0xd6, 0x3b, 0xee, 0x71, 0xb7, 0x07, 0xdf, 0x89, 0x61, 0x73, 0x3a, 0x35, - 0x6c, 0x06, 0x1b, 0xce, 0xf4, 0xf8, 0xc1, 0xaa, 0x28, 0x5d, 0x51, 0x16, 0x9b, 0x8a, 0x00, 0x43, - 0x3e, 0xcb, 0xa7, 0xf8, 0x0c, 0xdd, 0x80, 0x19, 0x3c, 0xc1, 0xb6, 0xef, 0xd5, 0x4b, 0x34, 0x91, - 0x56, 0xc4, 0x85, 0xaa, 0x4d, 0x46, 0x0d, 0x0e, 0x94, 0xae, 0xfa, 0x10, 0xce, 0xd0, 0xfb, 0xee, - 0x23, 0xd7, 0xb4, 0xd5, 0x3b, 0x7b, 0xa7, 0xb3, 0xce, 0xd3, 0x0e, 0xf9, 0x89, 0xaa, 0x90, 0x59, - 0x5b, 0xe5, 0xf6, 0xc9, 0xac, 0xad, 0x4a, 0xfa, 0xdf, 0xd7, 0x00, 0xa9, 0x0c, 0x4e, 0xe4, 0x8b, - 0x88, 0x14, 0xa1, 0x47, 0x56, 0xea, 0x31, 0x07, 0xd3, 0xd8, 0x75, 0x1d, 0x97, 0x05, 0x4a, 0x83, - 0x7d, 0x48, 0x6d, 0x6e, 0x73, 0x65, 0x0c, 0x3c, 0x71, 0xf6, 0x83, 0x08, 0xc0, 0xd8, 0x6a, 0x71, - 0xe5, 0x3b, 0x70, 0x36, 0x84, 0x7e, 0x3a, 0x29, 0x7e, 0x13, 0x66, 0x29, 0xd7, 0x95, 0x3d, 0xdc, - 0xdd, 0x1f, 0x39, 0x96, 0x1d, 0xd3, 0x00, 0x5d, 0x23, 0xb1, 0x4b, 0xa4, 0x0b, 0x32, 0x45, 0x36, - 0xe7, 0x72, 0x30, 0xd8, 0xe9, 0xac, 0xcb, 0xa5, 0xbe, 0x0b, 0xe7, 0x23, 0x0c, 0xc5, 0xcc, 0x7e, - 0x0d, 0x4a, 0xdd, 0x60, 0xd0, 0xe3, 0x27, 0xc8, 0x2b, 0x61, 0x75, 0xa3, 0xa4, 0x2a, 0x85, 0x94, - 0xf1, 0x6d, 0xb8, 0x10, 0x93, 0x71, 0x1a, 0xe6, 0xb8, 0xa7, 0xdf, 0x81, 0x73, 0x94, 0xf3, 0x13, - 0x8c, 0x47, 0xad, 0x81, 0x35, 0x39, 0xde, 0x2d, 0x87, 0x7c, 0xbe, 0x0a, 0xc5, 0xd7, 0xbb, 0xac, - 0xa4, 0xe8, 0x36, 0x17, 0xdd, 0xb1, 0x86, 0xb8, 0xe3, 0xac, 0xa7, 0x6b, 0x4b, 0x12, 0xf9, 0x3e, - 0x3e, 0xf4, 0xf8, 0xf1, 0x91, 0xfe, 0x96, 0xd1, 0xeb, 0x6f, 0x35, 0x6e, 0x4e, 0x95, 0xcf, 0xd7, - 0xbc, 0x35, 0xe6, 0x01, 0xfa, 0x64, 0x0f, 0xe2, 0x1e, 0x01, 0xb0, 0xda, 0x9c, 0x32, 0x12, 0x28, - 0x4c, 0xb2, 0x50, 0x39, 0xaa, 0xf0, 0x15, 0xbe, 0x71, 0xe8, 0x7f, 0xbc, 0xd8, 0x49, 0xe9, 0x4d, - 0x28, 0x51, 0xc8, 0xb6, 0x6f, 0xfa, 0x63, 0x2f, 0xcd, 0x73, 0xcb, 0xfa, 0x8f, 0x34, 0xbe, 0xa3, - 0x04, 0x9f, 0x13, 0xcd, 0xf9, 0x2e, 0xcc, 0xd0, 0x1b, 0xa2, 0xb8, 0xe9, 0x5c, 0x4c, 0x58, 0xd8, - 0x4c, 0x23, 0x83, 0x23, 0x2a, 0xe7, 0x24, 0x0d, 0x66, 0x9e, 0xd2, 0xce, 0x81, 0xa2, 0x6d, 0x4e, - 0x78, 0xce, 0x36, 0x87, 0xac, 0xfc, 0x58, 0x34, 0xe8, 0x6f, 0x7a, 0x21, 0xc0, 0xd8, 0x7d, 0x66, - 0xac, 0xb3, 0x1b, 0x48, 0xd1, 0x08, 0xbe, 0x89, 0x61, 0xbb, 0x03, 0x0b, 0xdb, 0x3e, 0x85, 0xe6, - 0x28, 0x54, 0x19, 0x41, 0x37, 0xa0, 0x68, 0x79, 0xeb, 0xd8, 0x74, 0x6d, 0x5e, 0xe2, 0x57, 0x02, - 0xb3, 0x84, 0xc8, 0x35, 0xf6, 0x1d, 0xa8, 0x31, 0xcd, 0x5a, 0xbd, 0x9e, 0x72, 0xda, 0x0f, 0xe4, - 0x6b, 0x11, 0xf9, 0x21, 0xfe, 0x99, 0xe3, 0xf9, 0xff, 0x9d, 0x06, 0x67, 0x14, 0x01, 0x27, 0x72, - 0xc1, 0xbb, 0x30, 0xc3, 0xfa, 0x2f, 0xfc, 0x28, 0x38, 0x17, 0xa6, 0x62, 0x62, 0x0c, 0x8e, 0x83, - 0x16, 0x21, 0xcf, 0x7e, 0x89, 0x6b, 0x5c, 0x32, 0xba, 0x40, 0x92, 0x2a, 0x2f, 0xc2, 0x59, 0x0e, - 0xc3, 0x43, 0x27, 0x69, 0xcf, 0xe5, 0xc2, 0x11, 0xe2, 0x87, 0x1a, 0xcc, 0x85, 0x09, 0x4e, 0x34, - 0x4b, 0x45, 0xef, 0xcc, 0x57, 0xd2, 0xfb, 0x5b, 0x42, 0xef, 0x67, 0xa3, 0x9e, 0x72, 0xe4, 0x8c, - 0xae, 0x38, 0xd5, 0xbb, 0x99, 0xb0, 0x77, 0x25, 0xaf, 0x9f, 0x04, 0x73, 0x12, 0xcc, 0x4e, 0x34, - 0xa7, 0xf7, 0x5f, 0x6b, 0x4e, 0xca, 0x11, 0x2c, 0x36, 0xb9, 0x35, 0xb1, 0x8c, 0xd6, 0x2d, 0x2f, - 0xc8, 0x38, 0xef, 0x40, 0x79, 0x60, 0xd9, 0xd8, 0x74, 0x79, 0x0f, 0x49, 0x53, 0xd7, 0xe3, 0x7d, - 0x23, 0x04, 0x94, 0xac, 0x7e, 0x5b, 0x03, 0xa4, 0xf2, 0xfa, 0xe5, 0x78, 0xab, 0x29, 0x0c, 0xbc, - 0xe5, 0x3a, 0x43, 0xc7, 0x3f, 0x6e, 0x99, 0xdd, 0xd3, 0x7f, 0x57, 0x83, 0x73, 0x11, 0x8a, 0x5f, - 0x86, 0xe6, 0xf7, 0xf4, 0xcb, 0x70, 0x66, 0x15, 0x8b, 0x33, 0x5e, 0xac, 0x76, 0xb0, 0x0d, 0x48, - 0x85, 0x9e, 0xce, 0x29, 0xe6, 0x1b, 0x70, 0xe6, 0xa9, 0x33, 0x21, 0x81, 0x9c, 0x80, 0x65, 0x98, - 0x62, 0xc5, 0xac, 0xc0, 0x5e, 0xc1, 0xb7, 0x0c, 0xbd, 0xdb, 0x80, 0x54, 0xca, 0xd3, 0x50, 0x67, - 0x59, 0xff, 0x5f, 0x0d, 0xca, 0xad, 0x81, 0xe9, 0x0e, 0x85, 0x2a, 0x1f, 0xc2, 0x0c, 0xab, 0xcc, - 0xf0, 0x32, 0xeb, 0x9b, 0x61, 0x7e, 0x2a, 0x2e, 0xfb, 0x68, 0xb1, 0x3a, 0x0e, 0xa7, 0x22, 0x53, - 0xe1, 0x9d, 0xe5, 0xd5, 0x48, 0xa7, 0x79, 0x15, 0xdd, 0x86, 0x69, 0x93, 0x90, 0xd0, 0xf4, 0x5a, - 0x8d, 0x96, 0xcb, 0x28, 0x37, 0x72, 0x25, 0x32, 0x18, 0x96, 0xfe, 0x01, 0x94, 0x14, 0x09, 0x28, - 0x0f, 0xd9, 0x47, 0x6d, 0x7e, 0x4d, 0x6a, 0xad, 0x74, 0xd6, 0x9e, 0xb3, 0x12, 0x62, 0x15, 0x60, - 0xb5, 0x1d, 0x7c, 0x67, 0x12, 0x1a, 0x7b, 0x26, 0xe7, 0xc3, 0xf3, 0x96, 0xaa, 0xa1, 0x96, 0xa6, - 0x61, 0xe6, 0x75, 0x34, 0x94, 0x22, 0x7e, 0x4b, 0x83, 0x0a, 0x37, 0xcd, 0x49, 0x53, 0x33, 0xe5, - 0x9c, 0x92, 0x9a, 0x95, 0x69, 0x18, 0x1c, 0x51, 0xea, 0xf0, 0x2f, 0x1a, 0xd4, 0x56, 0x9d, 0x57, - 0x76, 0xdf, 0x35, 0x7b, 0xc1, 0x1e, 0xfc, 0x28, 0xe2, 0xce, 0xc5, 0x48, 0xa5, 0x3f, 0x82, 0x2f, - 0x07, 0x22, 0x6e, 0xad, 0xcb, 0x5a, 0x0a, 0xcb, 0xef, 0xe2, 0x53, 0xff, 0x26, 0xcc, 0x46, 0x88, - 0x88, 0x83, 0x9e, 0xb7, 0xd6, 0xd7, 0x56, 0x89, 0x43, 0x68, 0xbd, 0xb7, 0xbd, 0xd1, 0x7a, 0xb8, - 0xde, 0xe6, 0x5d, 0xd9, 0xd6, 0xc6, 0x4a, 0x7b, 0x5d, 0x3a, 0xea, 0xbe, 0x98, 0xc1, 0x7d, 0x7d, - 0x00, 0x67, 0x14, 0x85, 0x4e, 0xda, 0x1c, 0x4b, 0xd6, 0x57, 0x4a, 0xfb, 0x06, 0x5c, 0x0a, 0xa4, - 0x3d, 0x67, 0xc0, 0x0e, 0xf6, 0xd4, 0xcb, 0xda, 0x84, 0x0b, 0x2d, 0x1a, 0xe4, 0xa7, 0xa0, 0x7c, - 0x4f, 0xaf, 0x43, 0x85, 0x9f, 0x8f, 0xa2, 0x21, 0xe3, 0xcf, 0x73, 0x50, 0x15, 0xa0, 0xaf, 0x47, - 0x7f, 0x74, 0x1e, 0x66, 0x7a, 0xbb, 0xdb, 0xd6, 0x67, 0xa2, 0xa3, 0xcb, 0xbf, 0xc8, 0xf8, 0x80, - 0xc9, 0x61, 0xef, 0x34, 0xf8, 0x17, 0xba, 0xcc, 0x9e, 0x70, 0xac, 0xd9, 0x3d, 0x7c, 0x40, 0x8f, - 0x51, 0x39, 0x43, 0x0e, 0xd0, 0x72, 0x28, 0x7f, 0xcf, 0x41, 0x6f, 0xc9, 0xca, 0xfb, 0x0e, 0xb4, - 0x0c, 0x35, 0xf2, 0xbb, 0x35, 0x1a, 0x0d, 0x2c, 0xdc, 0x63, 0x0c, 0xc8, 0x05, 0x39, 0x27, 0xcf, - 0x49, 0x31, 0x04, 0x74, 0x15, 0x66, 0xe8, 0xe5, 0xd1, 0xab, 0x17, 0x48, 0x46, 0x96, 0xa8, 0x7c, - 0x18, 0xbd, 0x0d, 0x25, 0xa6, 0xf1, 0x9a, 0xfd, 0xcc, 0xc3, 0xf4, 0xb5, 0x83, 0x52, 0x49, 0x51, - 0x61, 0xe1, 0x13, 0x1a, 0xa4, 0x9d, 0xd0, 0x50, 0x13, 0xaa, 0x9e, 0xef, 0xb8, 0x66, 0x5f, 0xb8, - 0x91, 0x3e, 0x75, 0x50, 0xca, 0x7d, 0x11, 0xb0, 0x54, 0xe1, 0xe3, 0xb1, 0xe3, 0x9b, 0xe1, 0x27, - 0x0e, 0xef, 0x19, 0x2a, 0x0c, 0x7d, 0x0b, 0x2a, 0x3d, 0xb1, 0x48, 0xd6, 0xec, 0x97, 0x0e, 0x7d, - 0xd6, 0x10, 0xeb, 0xde, 0xad, 0xaa, 0x28, 0x92, 0x53, 0x98, 0x54, 0xbd, 0xc9, 0x56, 0x42, 0x14, - 0xc4, 0xdb, 0xd8, 0x26, 0xa9, 0x9d, 0x55, 0x70, 0x0a, 0x86, 0xf8, 0x44, 0xd7, 0xa1, 0xc2, 0x32, - 0xc1, 0xf3, 0xd0, 0x6a, 0x08, 0x0f, 0x92, 0x3c, 0xd6, 0x1a, 0xfb, 0x7b, 0x6d, 0x4a, 0x14, 0x5b, - 0x94, 0x57, 0x00, 0x11, 0xe8, 0xaa, 0xe5, 0x25, 0x82, 0x39, 0x71, 0xe2, 0x8a, 0xbe, 0xaf, 0x6f, - 0xc0, 0x59, 0x02, 0xc5, 0xb6, 0x6f, 0x75, 0x95, 0xa3, 0x98, 0x38, 0xec, 0x6b, 0x91, 0xc3, 0xbe, - 0xe9, 0x79, 0xaf, 0x1c, 0xb7, 0xc7, 0xd5, 0x0c, 0xbe, 0xa5, 0xb4, 0x7f, 0xd4, 0x98, 0x36, 0xcf, - 0xbc, 0xd0, 0x41, 0xfd, 0x2b, 0xf2, 0x43, 0xbf, 0x02, 0x79, 0xfe, 0x40, 0x8a, 0xd7, 0x3f, 0xcf, - 0x2f, 0xb2, 0x87, 0x59, 0x8b, 0x9c, 0xf1, 0x26, 0x83, 0x2a, 0x35, 0x3a, 0x8e, 0x4f, 0x96, 0xcb, - 0x9e, 0xe9, 0xed, 0xe1, 0xde, 0x96, 0x60, 0x1e, 0xaa, 0x0e, 0xdf, 0x37, 0x22, 0x60, 0xa9, 0xfb, - 0x5d, 0xa9, 0xfa, 0x23, 0xec, 0x1f, 0xa1, 0xba, 0xda, 0x7f, 0x38, 0x27, 0x48, 0x78, 0xdb, 0xf4, - 0x75, 0xa8, 0x7e, 0xac, 0xc1, 0x15, 0x41, 0xb6, 0xb2, 0x67, 0xda, 0x7d, 0x2c, 0x94, 0xf9, 0x45, - 0xed, 0x15, 0x9f, 0x74, 0xf6, 0x35, 0x27, 0xfd, 0x04, 0xea, 0xc1, 0xa4, 0x69, 0x2d, 0xca, 0x19, - 0xa8, 0x93, 0x18, 0x7b, 0x41, 0x90, 0xa4, 0xbf, 0xc9, 0x98, 0xeb, 0x0c, 0x82, 0x6b, 0x20, 0xf9, - 0x2d, 0x99, 0xad, 0xc3, 0x45, 0xc1, 0x8c, 0x17, 0x87, 0xc2, 0xdc, 0x62, 0x73, 0x3a, 0x92, 0x1b, - 0xf7, 0x07, 0xe1, 0x71, 0xf4, 0x52, 0x4a, 0x24, 0x09, 0xbb, 0x90, 0x4a, 0xd1, 0x92, 0xa4, 0xcc, - 0xb3, 0x1d, 0x40, 0x74, 0x56, 0x4e, 0xec, 0x31, 0x38, 0x61, 0x99, 0x08, 0xe7, 0x4b, 0x80, 0xc0, - 0x63, 0x4b, 0x20, 0x5d, 0x2a, 0x86, 0xf9, 0x40, 0x51, 0x62, 0xf6, 0x2d, 0xec, 0x0e, 0x2d, 0xcf, - 0x53, 0x1a, 0x71, 0x49, 0xe6, 0x7a, 0x13, 0x72, 0x23, 0xcc, 0x8f, 0x2f, 0xa5, 0x25, 0x24, 0xf6, - 0x84, 0x42, 0x4c, 0xe1, 0x52, 0xcc, 0x10, 0xae, 0x0a, 0x31, 0xcc, 0x21, 0x89, 0x72, 0xa2, 0x6a, - 0x8a, 0xe2, 0x7f, 0x26, 0xa5, 0xf8, 0x9f, 0x0d, 0x17, 0xff, 0x43, 0x47, 0x6a, 0x35, 0x50, 0x9d, - 0xce, 0x91, 0xba, 0xc3, 0x1c, 0x10, 0xc4, 0xb7, 0xd3, 0xe1, 0xfa, 0x07, 0x3c, 0x50, 0x9d, 0x56, - 0x3a, 0x17, 0x01, 0x3e, 0x13, 0x0e, 0xf0, 0x3a, 0x94, 0x89, 0x93, 0x0c, 0xb5, 0x2b, 0x92, 0x33, - 0x42, 0x63, 0x32, 0x18, 0xef, 0xc3, 0x5c, 0x38, 0x18, 0x9f, 0x48, 0xa9, 0x39, 0x98, 0xf6, 0x9d, - 0x7d, 0x2c, 0x72, 0x0a, 0xfb, 0x88, 0x99, 0x35, 0x08, 0xd4, 0xa7, 0x63, 0xd6, 0xef, 0x4a, 0xae, - 0x74, 0x03, 0x9e, 0x74, 0x06, 0x64, 0x39, 0x8a, 0xdb, 0x3f, 0xfb, 0x90, 0xb2, 0x3e, 0x81, 0xf3, - 0xd1, 0xe0, 0x7b, 0x3a, 0x93, 0xd8, 0x61, 0x9b, 0x33, 0x29, 0x3c, 0x9f, 0x8e, 0x80, 0x17, 0x32, - 0x4e, 0x2a, 0x41, 0xf7, 0x74, 0x78, 0xff, 0x3a, 0x34, 0x92, 0x62, 0xf0, 0xa9, 0xee, 0xc5, 0x20, - 0x24, 0x9f, 0x0e, 0xd7, 0x1f, 0x6a, 0x92, 0xad, 0xba, 0x6a, 0x3e, 0xf8, 0x2a, 0x6c, 0x45, 0xae, - 0xbb, 0x13, 0x2c, 0x9f, 0x66, 0x10, 0x2d, 0xb3, 0xc9, 0xd1, 0x52, 0x92, 0x50, 0x44, 0xb1, 0xff, - 0x64, 0xa8, 0xff, 0x3a, 0x57, 0x2f, 0x17, 0x26, 0xf3, 0xce, 0x49, 0x85, 0x91, 0xf4, 0x1c, 0x08, - 0xa3, 0x1f, 0xb1, 0xad, 0xa2, 0x26, 0xa9, 0xd3, 0x71, 0xdd, 0x6f, 0xc8, 0x04, 0x13, 0xcb, 0x63, - 0xa7, 0x23, 0xc1, 0x84, 0x85, 0xf4, 0x14, 0x76, 0x2a, 0x22, 0x6e, 0xb5, 0xa0, 0x18, 0xdc, 0xfd, - 0x95, 0x97, 0xca, 0x25, 0xc8, 0x6f, 0x6c, 0x6e, 0x6f, 0xb5, 0x56, 0xc8, 0xd5, 0x76, 0x0e, 0xf2, - 0x2b, 0x9b, 0x86, 0xf1, 0x6c, 0xab, 0x43, 0xee, 0xb6, 0xd1, 0x87, 0x4b, 0x4b, 0x3f, 0xcb, 0x42, - 0xe6, 0xc9, 0x73, 0xf4, 0x29, 0x4c, 0xb3, 0x87, 0x73, 0x47, 0xbc, 0x9f, 0x6c, 0x1c, 0xf5, 0x36, - 0x50, 0xbf, 0xf0, 0x83, 0xff, 0xfe, 0xd9, 0x1f, 0x66, 0xce, 0xe8, 0xe5, 0xe6, 0x64, 0xb9, 0xb9, - 0x3f, 0x69, 0xd2, 0x24, 0xfb, 0x40, 0xbb, 0x85, 0x3e, 0x86, 0xec, 0xd6, 0xd8, 0x47, 0xa9, 0xef, - 0x2a, 0x1b, 0xe9, 0xcf, 0x05, 0xf5, 0x73, 0x94, 0xe9, 0xac, 0x0e, 0x9c, 0xe9, 0x68, 0xec, 0x13, - 0x96, 0xdf, 0x83, 0x92, 0xfa, 0xd8, 0xef, 0xd8, 0xc7, 0x96, 0x8d, 0xe3, 0x1f, 0x12, 0xea, 0x57, - 0xa8, 0xa8, 0x0b, 0x3a, 0xe2, 0xa2, 0xd8, 0x73, 0x44, 0x75, 0x16, 0x9d, 0x03, 0x1b, 0xa5, 0x3e, - 0xc5, 0x6c, 0xa4, 0xbf, 0x2d, 0x8c, 0xcd, 0xc2, 0x3f, 0xb0, 0x09, 0xcb, 0xef, 0xf2, 0x47, 0x84, - 0x5d, 0x1f, 0x5d, 0x4d, 0x78, 0x05, 0xa6, 0xbe, 0x6e, 0x6a, 0x2c, 0xa4, 0x23, 0x70, 0x21, 0x97, - 0xa9, 0x90, 0xf3, 0xfa, 0x19, 0x2e, 0xa4, 0x1b, 0xa0, 0x3c, 0xd0, 0x6e, 0x2d, 0x75, 0x61, 0x9a, - 0x76, 0xcf, 0xd1, 0x0b, 0xf1, 0xa3, 0x91, 0xf0, 0x2e, 0x21, 0xc5, 0xd1, 0xa1, 0xbe, 0xbb, 0x3e, - 0x47, 0x05, 0x55, 0xf5, 0x22, 0x11, 0x44, 0x7b, 0xe7, 0x0f, 0xb4, 0x5b, 0x37, 0xb5, 0x3b, 0xda, - 0xd2, 0xdf, 0x4c, 0xc3, 0x34, 0xed, 0xd2, 0xa0, 0x7d, 0x00, 0xd9, 0x25, 0x8e, 0xce, 0x2e, 0xd6, - 0x80, 0x8e, 0xce, 0x2e, 0xde, 0x60, 0xd6, 0x1b, 0x54, 0xe8, 0x9c, 0x3e, 0x4b, 0x84, 0xd2, 0xe6, - 0x4f, 0x93, 0xf6, 0xba, 0x88, 0x1d, 0x7f, 0xac, 0xf1, 0x76, 0x15, 0xdb, 0x66, 0x28, 0x89, 0x5b, - 0xa8, 0x43, 0x1c, 0x5d, 0x0e, 0x09, 0x4d, 0x61, 0xfd, 0x3e, 0x15, 0xd8, 0xd4, 0x6b, 0x52, 0xa0, - 0x4b, 0x31, 0x1e, 0x68, 0xb7, 0x5e, 0xd4, 0xf5, 0xb3, 0xdc, 0xca, 0x11, 0x08, 0xfa, 0x3e, 0x54, - 0xc3, 0xbd, 0x4c, 0x74, 0x2d, 0x41, 0x56, 0xb4, 0x37, 0xda, 0xb8, 0x7e, 0x34, 0x12, 0xd7, 0x69, - 0x9e, 0xea, 0xc4, 0x85, 0x33, 0xc9, 0xfb, 0x18, 0x8f, 0x4c, 0x82, 0xc4, 0x7d, 0x80, 0xfe, 0x54, - 0xe3, 0xed, 0x68, 0xd9, 0x8a, 0x44, 0x49, 0xdc, 0x63, 0x1d, 0xcf, 0xc6, 0x8d, 0x63, 0xb0, 0xb8, - 0x12, 0x1f, 0x50, 0x25, 0xde, 0xd7, 0xe7, 0xa4, 0x12, 0xbe, 0x35, 0xc4, 0xbe, 0xc3, 0xb5, 0x78, - 0x71, 0x59, 0xbf, 0x10, 0x32, 0x4e, 0x08, 0x2a, 0x9d, 0xc5, 0x5a, 0x86, 0x89, 0xce, 0x0a, 0x75, - 0x25, 0x13, 0x9d, 0x15, 0xee, 0x37, 0x26, 0x39, 0x8b, 0x37, 0x08, 0x13, 0x9c, 0x15, 0x40, 0x96, - 0xfe, 0x3f, 0x07, 0xf9, 0x15, 0xf6, 0x3f, 0x23, 0x21, 0x07, 0x8a, 0x41, 0x13, 0x0d, 0xcd, 0x27, - 0xd5, 0xe9, 0xe5, 0x55, 0xae, 0x71, 0x35, 0x15, 0xce, 0x15, 0x7a, 0x83, 0x2a, 0x74, 0x49, 0x3f, - 0x4f, 0x24, 0xf3, 0xff, 0xdf, 0xa9, 0xc9, 0xaa, 0xb9, 0x4d, 0xb3, 0xd7, 0x23, 0x86, 0xf8, 0x4d, - 0x28, 0xab, 0x2d, 0x2d, 0xf4, 0x46, 0x62, 0x6f, 0x40, 0xed, 0x8f, 0x35, 0xf4, 0xa3, 0x50, 0xb8, - 0xe4, 0xeb, 0x54, 0xf2, 0xbc, 0x7e, 0x31, 0x41, 0xb2, 0x4b, 0x51, 0x43, 0xc2, 0x59, 0xef, 0x29, - 0x59, 0x78, 0xa8, 0xc9, 0x95, 0x2c, 0x3c, 0xdc, 0xba, 0x3a, 0x52, 0xf8, 0x98, 0xa2, 0x12, 0xe1, - 0x1e, 0x80, 0x6c, 0x0e, 0xa1, 0x44, 0x5b, 0x2a, 0x17, 0xd6, 0x68, 0x70, 0x88, 0xf7, 0x95, 0x74, - 0x9d, 0x8a, 0xe5, 0xeb, 0x2e, 0x22, 0x76, 0x60, 0x79, 0x3e, 0xdb, 0x98, 0x95, 0x50, 0x6b, 0x07, - 0x25, 0xce, 0x27, 0xdc, 0x29, 0x6a, 0x5c, 0x3b, 0x12, 0x87, 0x4b, 0xbf, 0x41, 0xa5, 0x5f, 0xd5, - 0x1b, 0x09, 0xd2, 0x47, 0x0c, 0x97, 0x2c, 0xb6, 0xcf, 0xf3, 0x50, 0x7a, 0x6a, 0x5a, 0xb6, 0x8f, - 0x6d, 0xd3, 0xee, 0x62, 0xb4, 0x0b, 0xd3, 0x34, 0x77, 0x47, 0x03, 0xb1, 0xda, 0xc9, 0x88, 0x06, - 0xe2, 0x50, 0x29, 0x5f, 0x5f, 0xa0, 0x82, 0x1b, 0xfa, 0x39, 0x22, 0x78, 0x28, 0x59, 0x37, 0x59, - 0x13, 0x40, 0xbb, 0x85, 0x5e, 0xc2, 0x0c, 0x6f, 0xe1, 0x47, 0x18, 0x85, 0x8a, 0x6a, 0x8d, 0xcb, - 0xc9, 0xc0, 0xa4, 0xb5, 0xac, 0x8a, 0xf1, 0x28, 0x1e, 0x91, 0x33, 0x01, 0x90, 0x1d, 0xa9, 0xa8, - 0x47, 0x63, 0x9d, 0xac, 0xc6, 0x42, 0x3a, 0x42, 0x92, 0x4d, 0x55, 0x99, 0xbd, 0x00, 0x97, 0xc8, - 0xfd, 0x0e, 0xe4, 0x1e, 0x9b, 0xde, 0x1e, 0x8a, 0xe4, 0x5e, 0xe5, 0xc5, 0x6d, 0xa3, 0x91, 0x04, - 0xe2, 0x52, 0xae, 0x52, 0x29, 0x17, 0x59, 0x28, 0x53, 0xa5, 0xd0, 0x37, 0xa5, 0xcc, 0x7e, 0xec, - 0xb9, 0x6d, 0xd4, 0x7e, 0xa1, 0xb7, 0xbb, 0x51, 0xfb, 0x85, 0x5f, 0xe8, 0xa6, 0xdb, 0x8f, 0x48, - 0xd9, 0x9f, 0x10, 0x39, 0x23, 0x28, 0x88, 0x87, 0xa9, 0x28, 0xf2, 0x9c, 0x27, 0xf2, 0x9a, 0xb5, - 0x31, 0x9f, 0x06, 0xe6, 0xd2, 0xae, 0x51, 0x69, 0x57, 0xf4, 0x7a, 0xcc, 0x5b, 0x1c, 0xf3, 0x81, - 0x76, 0xeb, 0x8e, 0x86, 0xbe, 0x0f, 0x20, 0x9b, 0x76, 0xb1, 0x3d, 0x18, 0x6d, 0x04, 0xc6, 0xf6, - 0x60, 0xac, 0xdf, 0xa7, 0x2f, 0x52, 0xb9, 0x37, 0xf5, 0x6b, 0x51, 0xb9, 0xbe, 0x6b, 0xda, 0xde, - 0x4b, 0xec, 0xde, 0x66, 0x75, 0x7f, 0x6f, 0xcf, 0x1a, 0x91, 0x29, 0xbb, 0x50, 0x0c, 0x6a, 0xcd, - 0xd1, 0x78, 0x1b, 0xed, 0xfe, 0x44, 0xe3, 0x6d, 0xac, 0x19, 0x13, 0x0e, 0x3c, 0xa1, 0xf5, 0x22, - 0x50, 0xc9, 0x16, 0xfc, 0xcb, 0x1a, 0xe4, 0xc8, 0x91, 0x9c, 0x1c, 0x4f, 0x64, 0xb9, 0x27, 0x3a, - 0xfb, 0x58, 0xc5, 0x3a, 0x3a, 0xfb, 0x78, 0xa5, 0x28, 0x7c, 0x3c, 0x21, 0xd7, 0xb5, 0x26, 0xab, - 0xa3, 0x90, 0x99, 0x3a, 0x50, 0x52, 0xca, 0x40, 0x28, 0x81, 0x59, 0xb8, 0x02, 0x1e, 0x4d, 0x78, - 0x09, 0x35, 0x24, 0xfd, 0x12, 0x95, 0x77, 0x8e, 0x25, 0x3c, 0x2a, 0xaf, 0xc7, 0x30, 0x88, 0x40, - 0x3e, 0x3b, 0xbe, 0xf3, 0x13, 0x66, 0x17, 0xde, 0xfd, 0x0b, 0xe9, 0x08, 0xa9, 0xb3, 0x93, 0x5b, - 0xff, 0x15, 0x94, 0xd5, 0xd2, 0x0f, 0x4a, 0x50, 0x3e, 0x52, 0xa3, 0x8f, 0x66, 0x92, 0xa4, 0xca, - 0x51, 0x38, 0xb6, 0x51, 0x91, 0xa6, 0x82, 0x46, 0x04, 0x0f, 0x20, 0xcf, 0x4b, 0x40, 0x49, 0x26, - 0x0d, 0x97, 0xf1, 0x93, 0x4c, 0x1a, 0xa9, 0x1f, 0x85, 0xcf, 0xcf, 0x54, 0x22, 0xb9, 0x8a, 0x8a, - 0x6c, 0xcd, 0xa5, 0x3d, 0xc2, 0x7e, 0x9a, 0x34, 0x59, 0xb6, 0x4d, 0x93, 0xa6, 0x54, 0x08, 0xd2, - 0xa4, 0xf5, 0xb1, 0xcf, 0xe3, 0x81, 0xb8, 0x5e, 0xa3, 0x14, 0x66, 0x6a, 0x86, 0xd4, 0x8f, 0x42, - 0x49, 0xba, 0xde, 0x48, 0x81, 0x22, 0x3d, 0x1e, 0x00, 0xc8, 0x72, 0x54, 0xf4, 0xcc, 0x9a, 0xd8, - 0x29, 0x88, 0x9e, 0x59, 0x93, 0x2b, 0x5a, 0xe1, 0x18, 0x2b, 0xe5, 0xb2, 0xdb, 0x15, 0x91, 0xfc, - 0x85, 0x06, 0x28, 0x5e, 0xb0, 0x42, 0xef, 0x24, 0x73, 0x4f, 0xec, 0x3a, 0x34, 0xde, 0x7d, 0x3d, - 0xe4, 0xa4, 0x80, 0x2c, 0x55, 0xea, 0x52, 0xec, 0xd1, 0x2b, 0xa2, 0xd4, 0xe7, 0x1a, 0x54, 0x42, - 0x45, 0x2e, 0xf4, 0x66, 0x8a, 0x4f, 0x23, 0xad, 0x87, 0xc6, 0x5b, 0xc7, 0xe2, 0x25, 0x1d, 0xe6, - 0x95, 0x15, 0x20, 0x6e, 0x35, 0xbf, 0xa3, 0x41, 0x35, 0x5c, 0x0b, 0x43, 0x29, 0xbc, 0x63, 0x1d, - 0x8b, 0xc6, 0xcd, 0xe3, 0x11, 0x8f, 0x76, 0x8f, 0xbc, 0xd0, 0x0c, 0x20, 0xcf, 0x8b, 0x66, 0x49, - 0x0b, 0x3f, 0xdc, 0xe2, 0x48, 0x5a, 0xf8, 0x91, 0x8a, 0x5b, 0xc2, 0xc2, 0x77, 0x9d, 0x01, 0x56, - 0xb6, 0x19, 0xaf, 0xa5, 0xa5, 0x49, 0x3b, 0x7a, 0x9b, 0x45, 0x0a, 0x71, 0x69, 0xd2, 0xe4, 0x36, - 0x13, 0x25, 0x33, 0x94, 0xc2, 0xec, 0x98, 0x6d, 0x16, 0xad, 0xb8, 0x25, 0x6c, 0x33, 0x2a, 0x50, - 0xd9, 0x66, 0xb2, 0x94, 0x95, 0xb4, 0xcd, 0x62, 0xdd, 0x98, 0xa4, 0x6d, 0x16, 0xaf, 0x86, 0x25, - 0xf8, 0x91, 0xca, 0x0d, 0x6d, 0xb3, 0xb3, 0x09, 0xc5, 0x2e, 0xf4, 0x6e, 0x8a, 0x11, 0x13, 0x7b, - 0x3b, 0x8d, 0xdb, 0xaf, 0x89, 0x9d, 0xba, 0xc6, 0x99, 0xf9, 0xc5, 0x1a, 0xff, 0x23, 0x0d, 0xe6, - 0x92, 0xea, 0x63, 0x28, 0x45, 0x4e, 0x4a, 0x2b, 0xa8, 0xb1, 0xf8, 0xba, 0xe8, 0x47, 0x5b, 0x2b, - 0x58, 0xf5, 0x0f, 0xfb, 0x5f, 0xb4, 0x9a, 0x2f, 0xae, 0xc2, 0x15, 0x98, 0x69, 0x8d, 0xac, 0x27, - 0xf8, 0x10, 0x9d, 0x2d, 0x64, 0x1a, 0x15, 0xc2, 0xd7, 0x71, 0xad, 0xcf, 0xe8, 0x5f, 0xbd, 0x58, - 0xc8, 0xec, 0x96, 0x01, 0x02, 0x84, 0xa9, 0x7f, 0xff, 0x72, 0x5e, 0xfb, 0xaf, 0x2f, 0xe7, 0xb5, - 0xff, 0xf9, 0x72, 0x5e, 0xfb, 0xe9, 0xff, 0xcd, 0x4f, 0xbd, 0xb8, 0xd6, 0x77, 0xa8, 0x5a, 0x8b, - 0x96, 0xd3, 0x94, 0x7f, 0x89, 0x63, 0xb9, 0xa9, 0xaa, 0xba, 0x3b, 0x43, 0xff, 0x74, 0xc6, 0xf2, - 0xcf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x82, 0x9b, 0xab, 0xde, 0x11, 0x44, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// KVClient is the client API for KV service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type KVClient interface { - // Range gets the keys in the range from the key-value store. - Range(ctx context.Context, in *RangeRequest, opts ...grpc.CallOption) (*RangeResponse, error) - // Put puts the given key into the key-value store. - // A put request increments the revision of the key-value store - // and generates one event in the event history. - Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) - // DeleteRange deletes the given range from the key-value store. - // A delete request increments the revision of the key-value store - // and generates a delete event in the event history for every deleted key. - DeleteRange(ctx context.Context, in *DeleteRangeRequest, opts ...grpc.CallOption) (*DeleteRangeResponse, error) - // Txn processes multiple requests in a single transaction. - // A txn request increments the revision of the key-value store - // and generates events with the same revision for every completed request. - // It is not allowed to modify the same key several times within one txn. - Txn(ctx context.Context, in *TxnRequest, opts ...grpc.CallOption) (*TxnResponse, error) - // Compact compacts the event history in the etcd key-value store. The key-value - // store should be periodically compacted or the event history will continue to grow - // indefinitely. - Compact(ctx context.Context, in *CompactionRequest, opts ...grpc.CallOption) (*CompactionResponse, error) -} - -type kVClient struct { - cc *grpc.ClientConn -} - -func NewKVClient(cc *grpc.ClientConn) KVClient { - return &kVClient{cc} -} - -func (c *kVClient) Range(ctx context.Context, in *RangeRequest, opts ...grpc.CallOption) (*RangeResponse, error) { - out := new(RangeResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.KV/Range", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *kVClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) { - out := new(PutResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.KV/Put", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *kVClient) DeleteRange(ctx context.Context, in *DeleteRangeRequest, opts ...grpc.CallOption) (*DeleteRangeResponse, error) { - out := new(DeleteRangeResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.KV/DeleteRange", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *kVClient) Txn(ctx context.Context, in *TxnRequest, opts ...grpc.CallOption) (*TxnResponse, error) { - out := new(TxnResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.KV/Txn", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *kVClient) Compact(ctx context.Context, in *CompactionRequest, opts ...grpc.CallOption) (*CompactionResponse, error) { - out := new(CompactionResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.KV/Compact", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// KVServer is the server API for KV service. -type KVServer interface { - // Range gets the keys in the range from the key-value store. - Range(context.Context, *RangeRequest) (*RangeResponse, error) - // Put puts the given key into the key-value store. - // A put request increments the revision of the key-value store - // and generates one event in the event history. - Put(context.Context, *PutRequest) (*PutResponse, error) - // DeleteRange deletes the given range from the key-value store. - // A delete request increments the revision of the key-value store - // and generates a delete event in the event history for every deleted key. - DeleteRange(context.Context, *DeleteRangeRequest) (*DeleteRangeResponse, error) - // Txn processes multiple requests in a single transaction. - // A txn request increments the revision of the key-value store - // and generates events with the same revision for every completed request. - // It is not allowed to modify the same key several times within one txn. - Txn(context.Context, *TxnRequest) (*TxnResponse, error) - // Compact compacts the event history in the etcd key-value store. The key-value - // store should be periodically compacted or the event history will continue to grow - // indefinitely. - Compact(context.Context, *CompactionRequest) (*CompactionResponse, error) -} - -// UnimplementedKVServer can be embedded to have forward compatible implementations. -type UnimplementedKVServer struct { +type AuthUserListResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Users []string `protobuf:"bytes,2,rep,name=users,proto3" json:"users,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (*UnimplementedKVServer) Range(ctx context.Context, req *RangeRequest) (*RangeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Range not implemented") -} -func (*UnimplementedKVServer) Put(ctx context.Context, req *PutRequest) (*PutResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Put not implemented") -} -func (*UnimplementedKVServer) DeleteRange(ctx context.Context, req *DeleteRangeRequest) (*DeleteRangeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteRange not implemented") -} -func (*UnimplementedKVServer) Txn(ctx context.Context, req *TxnRequest) (*TxnResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Txn not implemented") -} -func (*UnimplementedKVServer) Compact(ctx context.Context, req *CompactionRequest) (*CompactionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Compact not implemented") +func (x *AuthUserListResponse) Reset() { + *x = AuthUserListResponse{} + mi := &file_rpc_proto_msgTypes[93] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func RegisterKVServer(s *grpc.Server, srv KVServer) { - s.RegisterService(&_KV_serviceDesc, srv) +func (x *AuthUserListResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func _KV_Range_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RangeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(KVServer).Range(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.KV/Range", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KVServer).Range(ctx, req.(*RangeRequest)) - } - return interceptor(ctx, in, info, handler) -} +func (*AuthUserListResponse) ProtoMessage() {} -func _KV_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PutRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(KVServer).Put(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.KV/Put", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KVServer).Put(ctx, req.(*PutRequest)) +func (x *AuthUserListResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[93] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return interceptor(ctx, in, info, handler) + return mi.MessageOf(x) } -func _KV_DeleteRange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteRangeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(KVServer).DeleteRange(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.KV/DeleteRange", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KVServer).DeleteRange(ctx, req.(*DeleteRangeRequest)) - } - return interceptor(ctx, in, info, handler) +// Deprecated: Use AuthUserListResponse.ProtoReflect.Descriptor instead. +func (*AuthUserListResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{93} } -func _KV_Txn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(TxnRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(KVServer).Txn(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.KV/Txn", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KVServer).Txn(ctx, req.(*TxnRequest)) +func (x *AuthUserListResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } - return interceptor(ctx, in, info, handler) + return nil } -func _KV_Compact_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CompactionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(KVServer).Compact(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.KV/Compact", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KVServer).Compact(ctx, req.(*CompactionRequest)) +func (x *AuthUserListResponse) GetUsers() []string { + if x != nil { + return x.Users } - return interceptor(ctx, in, info, handler) -} - -var _KV_serviceDesc = grpc.ServiceDesc{ - ServiceName: "etcdserverpb.KV", - HandlerType: (*KVServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Range", - Handler: _KV_Range_Handler, - }, - { - MethodName: "Put", - Handler: _KV_Put_Handler, - }, - { - MethodName: "DeleteRange", - Handler: _KV_DeleteRange_Handler, - }, - { - MethodName: "Txn", - Handler: _KV_Txn_Handler, - }, - { - MethodName: "Compact", - Handler: _KV_Compact_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "rpc.proto", -} - -// WatchClient is the client API for Watch service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type WatchClient interface { - // Watch watches for events happening or that have happened. Both input and output - // are streams; the input stream is for creating and canceling watchers and the output - // stream sends events. One watch RPC can watch on multiple key ranges, streaming events - // for several watches at once. The entire event history can be watched starting from the - // last compaction revision. - Watch(ctx context.Context, opts ...grpc.CallOption) (Watch_WatchClient, error) -} - -type watchClient struct { - cc *grpc.ClientConn -} - -func NewWatchClient(cc *grpc.ClientConn) WatchClient { - return &watchClient{cc} + return nil } -func (c *watchClient) Watch(ctx context.Context, opts ...grpc.CallOption) (Watch_WatchClient, error) { - stream, err := c.cc.NewStream(ctx, &_Watch_serviceDesc.Streams[0], "/etcdserverpb.Watch/Watch", opts...) - if err != nil { - return nil, err - } - x := &watchWatchClient{stream} - return x, nil +type AuthRoleDeleteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -type Watch_WatchClient interface { - Send(*WatchRequest) error - Recv() (*WatchResponse, error) - grpc.ClientStream +func (x *AuthRoleDeleteResponse) Reset() { + *x = AuthRoleDeleteResponse{} + mi := &file_rpc_proto_msgTypes[94] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -type watchWatchClient struct { - grpc.ClientStream +func (x *AuthRoleDeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (x *watchWatchClient) Send(m *WatchRequest) error { - return x.ClientStream.SendMsg(m) -} +func (*AuthRoleDeleteResponse) ProtoMessage() {} -func (x *watchWatchClient) Recv() (*WatchResponse, error) { - m := new(WatchResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err +func (x *AuthRoleDeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[94] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return m, nil -} - -// WatchServer is the server API for Watch service. -type WatchServer interface { - // Watch watches for events happening or that have happened. Both input and output - // are streams; the input stream is for creating and canceling watchers and the output - // stream sends events. One watch RPC can watch on multiple key ranges, streaming events - // for several watches at once. The entire event history can be watched starting from the - // last compaction revision. - Watch(Watch_WatchServer) error -} - -// UnimplementedWatchServer can be embedded to have forward compatible implementations. -type UnimplementedWatchServer struct { -} - -func (*UnimplementedWatchServer) Watch(srv Watch_WatchServer) error { - return status.Errorf(codes.Unimplemented, "method Watch not implemented") -} - -func RegisterWatchServer(s *grpc.Server, srv WatchServer) { - s.RegisterService(&_Watch_serviceDesc, srv) -} - -func _Watch_Watch_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(WatchServer).Watch(&watchWatchServer{stream}) -} - -type Watch_WatchServer interface { - Send(*WatchResponse) error - Recv() (*WatchRequest, error) - grpc.ServerStream -} - -type watchWatchServer struct { - grpc.ServerStream + return mi.MessageOf(x) } -func (x *watchWatchServer) Send(m *WatchResponse) error { - return x.ServerStream.SendMsg(m) +// Deprecated: Use AuthRoleDeleteResponse.ProtoReflect.Descriptor instead. +func (*AuthRoleDeleteResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{94} } -func (x *watchWatchServer) Recv() (*WatchRequest, error) { - m := new(WatchRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err +func (x *AuthRoleDeleteResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } - return m, nil + return nil } -var _Watch_serviceDesc = grpc.ServiceDesc{ - ServiceName: "etcdserverpb.Watch", - HandlerType: (*WatchServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "Watch", - Handler: _Watch_Watch_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "rpc.proto", +type AuthRoleGrantPermissionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -// LeaseClient is the client API for Lease service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type LeaseClient interface { - // LeaseGrant creates a lease which expires if the server does not receive a keepAlive - // within a given time to live period. All keys attached to the lease will be expired and - // deleted if the lease expires. Each expired key generates a delete event in the event history. - LeaseGrant(ctx context.Context, in *LeaseGrantRequest, opts ...grpc.CallOption) (*LeaseGrantResponse, error) - // LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted. - LeaseRevoke(ctx context.Context, in *LeaseRevokeRequest, opts ...grpc.CallOption) (*LeaseRevokeResponse, error) - // LeaseKeepAlive keeps the lease alive by streaming keep alive requests from the client - // to the server and streaming keep alive responses from the server to the client. - LeaseKeepAlive(ctx context.Context, opts ...grpc.CallOption) (Lease_LeaseKeepAliveClient, error) - // LeaseTimeToLive retrieves lease information. - LeaseTimeToLive(ctx context.Context, in *LeaseTimeToLiveRequest, opts ...grpc.CallOption) (*LeaseTimeToLiveResponse, error) - // LeaseLeases lists all existing leases. - LeaseLeases(ctx context.Context, in *LeaseLeasesRequest, opts ...grpc.CallOption) (*LeaseLeasesResponse, error) +func (x *AuthRoleGrantPermissionResponse) Reset() { + *x = AuthRoleGrantPermissionResponse{} + mi := &file_rpc_proto_msgTypes[95] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -type leaseClient struct { - cc *grpc.ClientConn +func (x *AuthRoleGrantPermissionResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func NewLeaseClient(cc *grpc.ClientConn) LeaseClient { - return &leaseClient{cc} -} +func (*AuthRoleGrantPermissionResponse) ProtoMessage() {} -func (c *leaseClient) LeaseGrant(ctx context.Context, in *LeaseGrantRequest, opts ...grpc.CallOption) (*LeaseGrantResponse, error) { - out := new(LeaseGrantResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Lease/LeaseGrant", in, out, opts...) - if err != nil { - return nil, err +func (x *AuthRoleGrantPermissionResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[95] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return out, nil + return mi.MessageOf(x) } -func (c *leaseClient) LeaseRevoke(ctx context.Context, in *LeaseRevokeRequest, opts ...grpc.CallOption) (*LeaseRevokeResponse, error) { - out := new(LeaseRevokeResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Lease/LeaseRevoke", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +// Deprecated: Use AuthRoleGrantPermissionResponse.ProtoReflect.Descriptor instead. +func (*AuthRoleGrantPermissionResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{95} } -func (c *leaseClient) LeaseKeepAlive(ctx context.Context, opts ...grpc.CallOption) (Lease_LeaseKeepAliveClient, error) { - stream, err := c.cc.NewStream(ctx, &_Lease_serviceDesc.Streams[0], "/etcdserverpb.Lease/LeaseKeepAlive", opts...) - if err != nil { - return nil, err +func (x *AuthRoleGrantPermissionResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } - x := &leaseLeaseKeepAliveClient{stream} - return x, nil -} - -type Lease_LeaseKeepAliveClient interface { - Send(*LeaseKeepAliveRequest) error - Recv() (*LeaseKeepAliveResponse, error) - grpc.ClientStream + return nil } -type leaseLeaseKeepAliveClient struct { - grpc.ClientStream +type AuthRoleRevokePermissionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *leaseLeaseKeepAliveClient) Send(m *LeaseKeepAliveRequest) error { - return x.ClientStream.SendMsg(m) +func (x *AuthRoleRevokePermissionResponse) Reset() { + *x = AuthRoleRevokePermissionResponse{} + mi := &file_rpc_proto_msgTypes[96] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *leaseLeaseKeepAliveClient) Recv() (*LeaseKeepAliveResponse, error) { - m := new(LeaseKeepAliveResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil +func (x *AuthRoleRevokePermissionResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (c *leaseClient) LeaseTimeToLive(ctx context.Context, in *LeaseTimeToLiveRequest, opts ...grpc.CallOption) (*LeaseTimeToLiveResponse, error) { - out := new(LeaseTimeToLiveResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Lease/LeaseTimeToLive", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} +func (*AuthRoleRevokePermissionResponse) ProtoMessage() {} -func (c *leaseClient) LeaseLeases(ctx context.Context, in *LeaseLeasesRequest, opts ...grpc.CallOption) (*LeaseLeasesResponse, error) { - out := new(LeaseLeasesResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Lease/LeaseLeases", in, out, opts...) - if err != nil { - return nil, err +func (x *AuthRoleRevokePermissionResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[96] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return out, nil + return mi.MessageOf(x) } -// LeaseServer is the server API for Lease service. -type LeaseServer interface { - // LeaseGrant creates a lease which expires if the server does not receive a keepAlive - // within a given time to live period. All keys attached to the lease will be expired and - // deleted if the lease expires. Each expired key generates a delete event in the event history. - LeaseGrant(context.Context, *LeaseGrantRequest) (*LeaseGrantResponse, error) - // LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted. - LeaseRevoke(context.Context, *LeaseRevokeRequest) (*LeaseRevokeResponse, error) - // LeaseKeepAlive keeps the lease alive by streaming keep alive requests from the client - // to the server and streaming keep alive responses from the server to the client. - LeaseKeepAlive(Lease_LeaseKeepAliveServer) error - // LeaseTimeToLive retrieves lease information. - LeaseTimeToLive(context.Context, *LeaseTimeToLiveRequest) (*LeaseTimeToLiveResponse, error) - // LeaseLeases lists all existing leases. - LeaseLeases(context.Context, *LeaseLeasesRequest) (*LeaseLeasesResponse, error) -} - -// UnimplementedLeaseServer can be embedded to have forward compatible implementations. -type UnimplementedLeaseServer struct { -} - -func (*UnimplementedLeaseServer) LeaseGrant(ctx context.Context, req *LeaseGrantRequest) (*LeaseGrantResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LeaseGrant not implemented") -} -func (*UnimplementedLeaseServer) LeaseRevoke(ctx context.Context, req *LeaseRevokeRequest) (*LeaseRevokeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LeaseRevoke not implemented") -} -func (*UnimplementedLeaseServer) LeaseKeepAlive(srv Lease_LeaseKeepAliveServer) error { - return status.Errorf(codes.Unimplemented, "method LeaseKeepAlive not implemented") -} -func (*UnimplementedLeaseServer) LeaseTimeToLive(ctx context.Context, req *LeaseTimeToLiveRequest) (*LeaseTimeToLiveResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LeaseTimeToLive not implemented") -} -func (*UnimplementedLeaseServer) LeaseLeases(ctx context.Context, req *LeaseLeasesRequest) (*LeaseLeasesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LeaseLeases not implemented") -} - -func RegisterLeaseServer(s *grpc.Server, srv LeaseServer) { - s.RegisterService(&_Lease_serviceDesc, srv) -} - -func _Lease_LeaseGrant_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LeaseGrantRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LeaseServer).LeaseGrant(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Lease/LeaseGrant", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LeaseServer).LeaseGrant(ctx, req.(*LeaseGrantRequest)) - } - return interceptor(ctx, in, info, handler) +// Deprecated: Use AuthRoleRevokePermissionResponse.ProtoReflect.Descriptor instead. +func (*AuthRoleRevokePermissionResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{96} } -func _Lease_LeaseRevoke_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LeaseRevokeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LeaseServer).LeaseRevoke(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Lease/LeaseRevoke", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LeaseServer).LeaseRevoke(ctx, req.(*LeaseRevokeRequest)) +func (x *AuthRoleRevokePermissionResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header } - return interceptor(ctx, in, info, handler) -} - -func _Lease_LeaseKeepAlive_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(LeaseServer).LeaseKeepAlive(&leaseLeaseKeepAliveServer{stream}) -} - -type Lease_LeaseKeepAliveServer interface { - Send(*LeaseKeepAliveResponse) error - Recv() (*LeaseKeepAliveRequest, error) - grpc.ServerStream -} - -type leaseLeaseKeepAliveServer struct { - grpc.ServerStream -} - -func (x *leaseLeaseKeepAliveServer) Send(m *LeaseKeepAliveResponse) error { - return x.ServerStream.SendMsg(m) + return nil } -func (x *leaseLeaseKeepAliveServer) Recv() (*LeaseKeepAliveRequest, error) { - m := new(LeaseKeepAliveRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// RangeStreamResponse is the response for the RangeStream RPC. +type RangeStreamResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // range_response is a partial response for the KV.RangeStream RPC. + // The result of proto.Merge() applied on all responses should result in the + // same RangeResponse response as to the Range() method. + // + // Field population across chunks: + // - kvs: each chunk carries a disjoint slice of the result. Concatenating + // them in order yields the full key set. + // - header, more, count: set only on the final chunk. Non-merge clients + // can rely on io.EOF (end of stream) to detect completion. These + // fields are provided for clients that merge all responses into a + // single RangeResponse. + RangeResponse *RangeResponse `protobuf:"bytes,1,opt,name=range_response,json=rangeResponse,proto3" json:"range_response,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RangeStreamResponse) Reset() { + *x = RangeStreamResponse{} + mi := &file_rpc_proto_msgTypes[97] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RangeStreamResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RangeStreamResponse) ProtoMessage() {} + +func (x *RangeStreamResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[97] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RangeStreamResponse.ProtoReflect.Descriptor instead. +func (*RangeStreamResponse) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{97} +} + +func (x *RangeStreamResponse) GetRangeResponse() *RangeResponse { + if x != nil { + return x.RangeResponse + } + return nil +} + +var File_rpc_proto protoreflect.FileDescriptor + +const file_rpc_proto_rawDesc = "" + + "\n" + + "\trpc.proto\x12\fetcdserverpb\x1a\x18etcd/api/mvccpb/kv.proto\x1a\x1aetcd/api/authpb/auth.proto\x1a etcd/api/versionpb/version.proto\x1a\x1cgoogle/api/annotations.proto\x1a.protoc-gen-openapiv2/options/annotations.proto\"\x8e\x01\n" + + "\x0eResponseHeader\x12\x1d\n" + + "\n" + + "cluster_id\x18\x01 \x01(\x04R\tclusterId\x12\x1b\n" + + "\tmember_id\x18\x02 \x01(\x04R\bmemberId\x12\x1a\n" + + "\brevision\x18\x03 \x01(\x03R\brevision\x12\x1b\n" + + "\traft_term\x18\x04 \x01(\x04R\braftTerm:\a\x82\xb5\x18\x033.0\"\xc3\x05\n" + + "\fRangeRequest\x12\x10\n" + + "\x03key\x18\x01 \x01(\fR\x03key\x12\x1b\n" + + "\trange_end\x18\x02 \x01(\fR\brangeEnd\x12\x14\n" + + "\x05limit\x18\x03 \x01(\x03R\x05limit\x12\x1a\n" + + "\brevision\x18\x04 \x01(\x03R\brevision\x12C\n" + + "\n" + + "sort_order\x18\x05 \x01(\x0e2$.etcdserverpb.RangeRequest.SortOrderR\tsortOrder\x12F\n" + + "\vsort_target\x18\x06 \x01(\x0e2%.etcdserverpb.RangeRequest.SortTargetR\n" + + "sortTarget\x12\"\n" + + "\fserializable\x18\a \x01(\bR\fserializable\x12\x1b\n" + + "\tkeys_only\x18\b \x01(\bR\bkeysOnly\x12\x1d\n" + + "\n" + + "count_only\x18\t \x01(\bR\tcountOnly\x121\n" + + "\x10min_mod_revision\x18\n" + + " \x01(\x03B\a\x8a\xb5\x18\x033.1R\x0eminModRevision\x121\n" + + "\x10max_mod_revision\x18\v \x01(\x03B\a\x8a\xb5\x18\x033.1R\x0emaxModRevision\x127\n" + + "\x13min_create_revision\x18\f \x01(\x03B\a\x8a\xb5\x18\x033.1R\x11minCreateRevision\x127\n" + + "\x13max_create_revision\x18\r \x01(\x03B\a\x8a\xb5\x18\x033.1R\x11maxCreateRevision\"7\n" + + "\tSortOrder\x12\b\n" + + "\x04NONE\x10\x00\x12\n" + + "\n" + + "\x06ASCEND\x10\x01\x12\v\n" + + "\aDESCEND\x10\x02\x1a\a\x92\xb5\x18\x033.0\"K\n" + + "\n" + + "SortTarget\x12\a\n" + + "\x03KEY\x10\x00\x12\v\n" + + "\aVERSION\x10\x01\x12\n" + + "\n" + + "\x06CREATE\x10\x02\x12\a\n" + + "\x03MOD\x10\x03\x12\t\n" + + "\x05VALUE\x10\x04\x1a\a\x92\xb5\x18\x033.0:\a\x82\xb5\x18\x033.0\"\x9c\x01\n" + + "\rRangeResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12\"\n" + + "\x03kvs\x18\x02 \x03(\v2\x10.mvccpb.KeyValueR\x03kvs\x12\x12\n" + + "\x04more\x18\x03 \x01(\bR\x04more\x12\x14\n" + + "\x05count\x18\x04 \x01(\x03R\x05count:\a\x82\xb5\x18\x033.0\"\xcd\x01\n" + + "\n" + + "PutRequest\x12\x10\n" + + "\x03key\x18\x01 \x01(\fR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\fR\x05value\x12\x14\n" + + "\x05lease\x18\x03 \x01(\x03R\x05lease\x12 \n" + + "\aprev_kv\x18\x04 \x01(\bB\a\x8a\xb5\x18\x033.1R\x06prevKv\x12*\n" + + "\fignore_value\x18\x05 \x01(\bB\a\x8a\xb5\x18\x033.2R\vignoreValue\x12*\n" + + "\fignore_lease\x18\x06 \x01(\bB\a\x8a\xb5\x18\x033.2R\vignoreLease:\a\x82\xb5\x18\x033.0\"\x80\x01\n" + + "\vPutResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x122\n" + + "\aprev_kv\x18\x02 \x01(\v2\x10.mvccpb.KeyValueB\a\x8a\xb5\x18\x033.1R\x06prevKv:\a\x82\xb5\x18\x033.0\"n\n" + + "\x12DeleteRangeRequest\x12\x10\n" + + "\x03key\x18\x01 \x01(\fR\x03key\x12\x1b\n" + + "\trange_end\x18\x02 \x01(\fR\brangeEnd\x12 \n" + + "\aprev_kv\x18\x03 \x01(\bB\a\x8a\xb5\x18\x033.1R\x06prevKv:\a\x82\xb5\x18\x033.0\"\xa4\x01\n" + + "\x13DeleteRangeResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12\x18\n" + + "\adeleted\x18\x02 \x01(\x03R\adeleted\x124\n" + + "\bprev_kvs\x18\x03 \x03(\v2\x10.mvccpb.KeyValueB\a\x8a\xb5\x18\x033.1R\aprevKvs:\a\x82\xb5\x18\x033.0\"\xbb\x02\n" + + "\tRequestOp\x12A\n" + + "\rrequest_range\x18\x01 \x01(\v2\x1a.etcdserverpb.RangeRequestH\x00R\frequestRange\x12;\n" + + "\vrequest_put\x18\x02 \x01(\v2\x18.etcdserverpb.PutRequestH\x00R\n" + + "requestPut\x12T\n" + + "\x14request_delete_range\x18\x03 \x01(\v2 .etcdserverpb.DeleteRangeRequestH\x00R\x12requestDeleteRange\x12D\n" + + "\vrequest_txn\x18\x04 \x01(\v2\x18.etcdserverpb.TxnRequestB\a\x8a\xb5\x18\x033.3H\x00R\n" + + "requestTxn:\a\x82\xb5\x18\x033.0B\t\n" + + "\arequest\"\xc9\x02\n" + + "\n" + + "ResponseOp\x12D\n" + + "\x0eresponse_range\x18\x01 \x01(\v2\x1b.etcdserverpb.RangeResponseH\x00R\rresponseRange\x12>\n" + + "\fresponse_put\x18\x02 \x01(\v2\x19.etcdserverpb.PutResponseH\x00R\vresponsePut\x12W\n" + + "\x15response_delete_range\x18\x03 \x01(\v2!.etcdserverpb.DeleteRangeResponseH\x00R\x13responseDeleteRange\x12G\n" + + "\fresponse_txn\x18\x04 \x01(\v2\x19.etcdserverpb.TxnResponseB\a\x8a\xb5\x18\x033.3H\x00R\vresponseTxn:\a\x82\xb5\x18\x033.0B\n" + + "\n" + + "\bresponse\"\xa8\x04\n" + + "\aCompare\x12;\n" + + "\x06result\x18\x01 \x01(\x0e2#.etcdserverpb.Compare.CompareResultR\x06result\x12;\n" + + "\x06target\x18\x02 \x01(\x0e2#.etcdserverpb.Compare.CompareTargetR\x06target\x12\x10\n" + + "\x03key\x18\x03 \x01(\fR\x03key\x12\x1a\n" + + "\aversion\x18\x04 \x01(\x03H\x00R\aversion\x12)\n" + + "\x0fcreate_revision\x18\x05 \x01(\x03H\x00R\x0ecreateRevision\x12#\n" + + "\fmod_revision\x18\x06 \x01(\x03H\x00R\vmodRevision\x12\x16\n" + + "\x05value\x18\a \x01(\fH\x00R\x05value\x12\x1f\n" + + "\x05lease\x18\b \x01(\x03B\a\x8a\xb5\x18\x033.3H\x00R\x05lease\x12$\n" + + "\trange_end\x18@ \x01(\fB\a\x8a\xb5\x18\x033.3R\brangeEnd\"R\n" + + "\rCompareResult\x12\t\n" + + "\x05EQUAL\x10\x00\x12\v\n" + + "\aGREATER\x10\x01\x12\b\n" + + "\x04LESS\x10\x02\x12\x16\n" + + "\tNOT_EQUAL\x10\x03\x1a\a\x9a\xb5\x18\x033.1\x1a\a\x92\xb5\x18\x033.0\"Y\n" + + "\rCompareTarget\x12\v\n" + + "\aVERSION\x10\x00\x12\n" + + "\n" + + "\x06CREATE\x10\x01\x12\a\n" + + "\x03MOD\x10\x02\x12\t\n" + + "\x05VALUE\x10\x03\x12\x12\n" + + "\x05LEASE\x10\x04\x1a\a\x9a\xb5\x18\x033.3\x1a\a\x92\xb5\x18\x033.0:\a\x82\xb5\x18\x033.0B\x0e\n" + + "\ftarget_union\"\xac\x01\n" + + "\n" + + "TxnRequest\x12/\n" + + "\acompare\x18\x01 \x03(\v2\x15.etcdserverpb.CompareR\acompare\x121\n" + + "\asuccess\x18\x02 \x03(\v2\x17.etcdserverpb.RequestOpR\asuccess\x121\n" + + "\afailure\x18\x03 \x03(\v2\x17.etcdserverpb.RequestOpR\afailure:\a\x82\xb5\x18\x033.0\"\xa2\x01\n" + + "\vTxnResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12\x1c\n" + + "\tsucceeded\x18\x02 \x01(\bR\tsucceeded\x126\n" + + "\tresponses\x18\x03 \x03(\v2\x18.etcdserverpb.ResponseOpR\tresponses:\a\x82\xb5\x18\x033.0\"T\n" + + "\x11CompactionRequest\x12\x1a\n" + + "\brevision\x18\x01 \x01(\x03R\brevision\x12\x1a\n" + + "\bphysical\x18\x02 \x01(\bR\bphysical:\a\x82\xb5\x18\x033.0\"S\n" + + "\x12CompactionResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header:\a\x82\xb5\x18\x033.0\"\x16\n" + + "\vHashRequest:\a\x82\xb5\x18\x033.0\"4\n" + + "\rHashKVRequest\x12\x1a\n" + + "\brevision\x18\x01 \x01(\x03R\brevision:\a\x82\xb5\x18\x033.3\"\xbc\x01\n" + + "\x0eHashKVResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12\x12\n" + + "\x04hash\x18\x02 \x01(\rR\x04hash\x12)\n" + + "\x10compact_revision\x18\x03 \x01(\x03R\x0fcompactRevision\x12,\n" + + "\rhash_revision\x18\x04 \x01(\x03B\a\x8a\xb5\x18\x033.6R\fhashRevision:\a\x82\xb5\x18\x033.3\"a\n" + + "\fHashResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12\x12\n" + + "\x04hash\x18\x02 \x01(\rR\x04hash:\a\x82\xb5\x18\x033.0\"\x1a\n" + + "\x0fSnapshotRequest:\a\x82\xb5\x18\x033.3\"\xb1\x01\n" + + "\x10SnapshotResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12'\n" + + "\x0fremaining_bytes\x18\x02 \x01(\x04R\x0eremainingBytes\x12\x12\n" + + "\x04blob\x18\x03 \x01(\fR\x04blob\x12!\n" + + "\aversion\x18\x04 \x01(\tB\a\x8a\xb5\x18\x033.6R\aversion:\a\x82\xb5\x18\x033.3\"\x98\x02\n" + + "\fWatchRequest\x12I\n" + + "\x0ecreate_request\x18\x01 \x01(\v2 .etcdserverpb.WatchCreateRequestH\x00R\rcreateRequest\x12I\n" + + "\x0ecancel_request\x18\x02 \x01(\v2 .etcdserverpb.WatchCancelRequestH\x00R\rcancelRequest\x12X\n" + + "\x10progress_request\x18\x03 \x01(\v2\".etcdserverpb.WatchProgressRequestB\a\x8a\xb5\x18\x033.4H\x00R\x0fprogressRequest:\a\x82\xb5\x18\x033.0B\x0f\n" + + "\rrequest_union\"\x87\x03\n" + + "\x12WatchCreateRequest\x12\x10\n" + + "\x03key\x18\x01 \x01(\fR\x03key\x12\x1b\n" + + "\trange_end\x18\x02 \x01(\fR\brangeEnd\x12%\n" + + "\x0estart_revision\x18\x03 \x01(\x03R\rstartRevision\x12'\n" + + "\x0fprogress_notify\x18\x04 \x01(\bR\x0eprogressNotify\x12N\n" + + "\afilters\x18\x05 \x03(\x0e2+.etcdserverpb.WatchCreateRequest.FilterTypeB\a\x8a\xb5\x18\x033.1R\afilters\x12 \n" + + "\aprev_kv\x18\x06 \x01(\bB\a\x8a\xb5\x18\x033.1R\x06prevKv\x12\"\n" + + "\bwatch_id\x18\a \x01(\x03B\a\x8a\xb5\x18\x033.4R\awatchId\x12#\n" + + "\bfragment\x18\b \x01(\bB\a\x8a\xb5\x18\x033.4R\bfragment\".\n" + + "\n" + + "FilterType\x12\t\n" + + "\x05NOPUT\x10\x00\x12\f\n" + + "\bNODELETE\x10\x01\x1a\a\x92\xb5\x18\x033.1:\a\x82\xb5\x18\x033.0\"A\n" + + "\x12WatchCancelRequest\x12\"\n" + + "\bwatch_id\x18\x01 \x01(\x03B\a\x8a\xb5\x18\x033.1R\awatchId:\a\x82\xb5\x18\x033.1\"\x1f\n" + + "\x14WatchProgressRequest:\a\x82\xb5\x18\x033.4\"\xc4\x02\n" + + "\rWatchResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12\x19\n" + + "\bwatch_id\x18\x02 \x01(\x03R\awatchId\x12\x18\n" + + "\acreated\x18\x03 \x01(\bR\acreated\x12\x1a\n" + + "\bcanceled\x18\x04 \x01(\bR\bcanceled\x12)\n" + + "\x10compact_revision\x18\x05 \x01(\x03R\x0fcompactRevision\x12,\n" + + "\rcancel_reason\x18\x06 \x01(\tB\a\x8a\xb5\x18\x033.4R\fcancelReason\x12#\n" + + "\bfragment\x18\a \x01(\bB\a\x8a\xb5\x18\x033.4R\bfragment\x12%\n" + + "\x06events\x18\v \x03(\v2\r.mvccpb.EventR\x06events:\a\x82\xb5\x18\x033.0\">\n" + + "\x11LeaseGrantRequest\x12\x10\n" + + "\x03TTL\x18\x01 \x01(\x03R\x03TTL\x12\x0e\n" + + "\x02ID\x18\x02 \x01(\x03R\x02ID:\a\x82\xb5\x18\x033.0\"\x8b\x01\n" + + "\x12LeaseGrantResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12\x0e\n" + + "\x02ID\x18\x02 \x01(\x03R\x02ID\x12\x10\n" + + "\x03TTL\x18\x03 \x01(\x03R\x03TTL\x12\x14\n" + + "\x05error\x18\x04 \x01(\tR\x05error:\a\x82\xb5\x18\x033.0\"-\n" + + "\x12LeaseRevokeRequest\x12\x0e\n" + + "\x02ID\x18\x01 \x01(\x03R\x02ID:\a\x82\xb5\x18\x033.0\"T\n" + + "\x13LeaseRevokeResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header:\a\x82\xb5\x18\x033.0\"O\n" + + "\x0fLeaseCheckpoint\x12\x0e\n" + + "\x02ID\x18\x01 \x01(\x03R\x02ID\x12#\n" + + "\rremaining_TTL\x18\x02 \x01(\x03R\fremainingTTL:\a\x82\xb5\x18\x033.4\"b\n" + + "\x16LeaseCheckpointRequest\x12?\n" + + "\vcheckpoints\x18\x01 \x03(\v2\x1d.etcdserverpb.LeaseCheckpointR\vcheckpoints:\a\x82\xb5\x18\x033.4\"X\n" + + "\x17LeaseCheckpointResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header:\a\x82\xb5\x18\x033.4\"0\n" + + "\x15LeaseKeepAliveRequest\x12\x0e\n" + + "\x02ID\x18\x01 \x01(\x03R\x02ID:\a\x82\xb5\x18\x033.0\"y\n" + + "\x16LeaseKeepAliveResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12\x0e\n" + + "\x02ID\x18\x02 \x01(\x03R\x02ID\x12\x10\n" + + "\x03TTL\x18\x03 \x01(\x03R\x03TTL:\a\x82\xb5\x18\x033.0\"E\n" + + "\x16LeaseTimeToLiveRequest\x12\x0e\n" + + "\x02ID\x18\x01 \x01(\x03R\x02ID\x12\x12\n" + + "\x04keys\x18\x02 \x01(\bR\x04keys:\a\x82\xb5\x18\x033.1\"\xae\x01\n" + + "\x17LeaseTimeToLiveResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12\x0e\n" + + "\x02ID\x18\x02 \x01(\x03R\x02ID\x12\x10\n" + + "\x03TTL\x18\x03 \x01(\x03R\x03TTL\x12\x1e\n" + + "\n" + + "grantedTTL\x18\x04 \x01(\x03R\n" + + "grantedTTL\x12\x12\n" + + "\x04keys\x18\x05 \x03(\fR\x04keys:\a\x82\xb5\x18\x033.1\"\x1d\n" + + "\x12LeaseLeasesRequest:\a\x82\xb5\x18\x033.3\"&\n" + + "\vLeaseStatus\x12\x0e\n" + + "\x02ID\x18\x01 \x01(\x03R\x02ID:\a\x82\xb5\x18\x033.3\"\x87\x01\n" + + "\x13LeaseLeasesResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x121\n" + + "\x06leases\x18\x02 \x03(\v2\x19.etcdserverpb.LeaseStatusR\x06leases:\a\x82\xb5\x18\x033.3\"\x98\x01\n" + + "\x06Member\x12\x0e\n" + + "\x02ID\x18\x01 \x01(\x04R\x02ID\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x1a\n" + + "\bpeerURLs\x18\x03 \x03(\tR\bpeerURLs\x12\x1e\n" + + "\n" + + "clientURLs\x18\x04 \x03(\tR\n" + + "clientURLs\x12%\n" + + "\tisLearner\x18\x05 \x01(\bB\a\x8a\xb5\x18\x033.4R\tisLearner:\a\x82\xb5\x18\x033.0\"^\n" + + "\x10MemberAddRequest\x12\x1a\n" + + "\bpeerURLs\x18\x01 \x03(\tR\bpeerURLs\x12%\n" + + "\tisLearner\x18\x02 \x01(\bB\a\x8a\xb5\x18\x033.4R\tisLearner:\a\x82\xb5\x18\x033.0\"\xb0\x01\n" + + "\x11MemberAddResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12,\n" + + "\x06member\x18\x02 \x01(\v2\x14.etcdserverpb.MemberR\x06member\x12.\n" + + "\amembers\x18\x03 \x03(\v2\x14.etcdserverpb.MemberR\amembers:\a\x82\xb5\x18\x033.0\".\n" + + "\x13MemberRemoveRequest\x12\x0e\n" + + "\x02ID\x18\x01 \x01(\x04R\x02ID:\a\x82\xb5\x18\x033.0\"\x85\x01\n" + + "\x14MemberRemoveResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12.\n" + + "\amembers\x18\x02 \x03(\v2\x14.etcdserverpb.MemberR\amembers:\a\x82\xb5\x18\x033.0\"J\n" + + "\x13MemberUpdateRequest\x12\x0e\n" + + "\x02ID\x18\x01 \x01(\x04R\x02ID\x12\x1a\n" + + "\bpeerURLs\x18\x02 \x03(\tR\bpeerURLs:\a\x82\xb5\x18\x033.0\"\x8e\x01\n" + + "\x14MemberUpdateResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x127\n" + + "\amembers\x18\x02 \x03(\v2\x14.etcdserverpb.MemberB\a\x8a\xb5\x18\x033.1R\amembers:\a\x82\xb5\x18\x033.0\"I\n" + + "\x11MemberListRequest\x12+\n" + + "\flinearizable\x18\x01 \x01(\bB\a\x8a\xb5\x18\x033.5R\flinearizable:\a\x82\xb5\x18\x033.0\"\x83\x01\n" + + "\x12MemberListResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12.\n" + + "\amembers\x18\x02 \x03(\v2\x14.etcdserverpb.MemberR\amembers:\a\x82\xb5\x18\x033.0\"/\n" + + "\x14MemberPromoteRequest\x12\x0e\n" + + "\x02ID\x18\x01 \x01(\x04R\x02ID:\a\x82\xb5\x18\x033.4\"\x86\x01\n" + + "\x15MemberPromoteResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12.\n" + + "\amembers\x18\x02 \x03(\v2\x14.etcdserverpb.MemberR\amembers:\a\x82\xb5\x18\x033.4\"\x1c\n" + + "\x11DefragmentRequest:\a\x82\xb5\x18\x033.0\"S\n" + + "\x12DefragmentResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header:\a\x82\xb5\x18\x033.0\"8\n" + + "\x11MoveLeaderRequest\x12\x1a\n" + + "\btargetID\x18\x01 \x01(\x04R\btargetID:\a\x82\xb5\x18\x033.3\"S\n" + + "\x12MoveLeaderResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header:\a\x82\xb5\x18\x033.3\"\xe1\x01\n" + + "\fAlarmRequest\x12>\n" + + "\x06action\x18\x01 \x01(\x0e2&.etcdserverpb.AlarmRequest.AlarmActionR\x06action\x12\x1a\n" + + "\bmemberID\x18\x02 \x01(\x04R\bmemberID\x12-\n" + + "\x05alarm\x18\x03 \x01(\x0e2\x17.etcdserverpb.AlarmTypeR\x05alarm\"=\n" + + "\vAlarmAction\x12\a\n" + + "\x03GET\x10\x00\x12\f\n" + + "\bACTIVATE\x10\x01\x12\x0e\n" + + "\n" + + "DEACTIVATE\x10\x02\x1a\a\x92\xb5\x18\x033.0:\a\x82\xb5\x18\x033.0\"a\n" + + "\vAlarmMember\x12\x1a\n" + + "\bmemberID\x18\x01 \x01(\x04R\bmemberID\x12-\n" + + "\x05alarm\x18\x02 \x01(\x0e2\x17.etcdserverpb.AlarmTypeR\x05alarm:\a\x82\xb5\x18\x033.0\"\x81\x01\n" + + "\rAlarmResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x121\n" + + "\x06alarms\x18\x02 \x03(\v2\x19.etcdserverpb.AlarmMemberR\x06alarms:\a\x82\xb5\x18\x033.0\"\xbf\x01\n" + + "\x10DowngradeRequest\x12F\n" + + "\x06action\x18\x01 \x01(\x0e2..etcdserverpb.DowngradeRequest.DowngradeActionR\x06action\x12\x18\n" + + "\aversion\x18\x02 \x01(\tR\aversion\"@\n" + + "\x0fDowngradeAction\x12\f\n" + + "\bVALIDATE\x10\x00\x12\n" + + "\n" + + "\x06ENABLE\x10\x01\x12\n" + + "\n" + + "\x06CANCEL\x10\x02\x1a\a\x92\xb5\x18\x033.5:\a\x82\xb5\x18\x033.5\"l\n" + + "\x11DowngradeResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12\x18\n" + + "\aversion\x18\x02 \x01(\tR\aversion:\a\x82\xb5\x18\x033.5\"8\n" + + "\x1bDowngradeVersionTestRequest\x12\x10\n" + + "\x03ver\x18\x01 \x01(\tR\x03ver:\a\x82\xb5\x18\x033.6\"\x18\n" + + "\rStatusRequest:\a\x82\xb5\x18\x033.0\"\xa3\x04\n" + + "\x0eStatusResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12\x18\n" + + "\aversion\x18\x02 \x01(\tR\aversion\x12\x16\n" + + "\x06dbSize\x18\x03 \x01(\x03R\x06dbSize\x12\x16\n" + + "\x06leader\x18\x04 \x01(\x04R\x06leader\x12\x1c\n" + + "\traftIndex\x18\x05 \x01(\x04R\traftIndex\x12\x1a\n" + + "\braftTerm\x18\x06 \x01(\x04R\braftTerm\x123\n" + + "\x10raftAppliedIndex\x18\a \x01(\x04B\a\x8a\xb5\x18\x033.4R\x10raftAppliedIndex\x12\x1f\n" + + "\x06errors\x18\b \x03(\tB\a\x8a\xb5\x18\x033.4R\x06errors\x12)\n" + + "\vdbSizeInUse\x18\t \x01(\x03B\a\x8a\xb5\x18\x033.4R\vdbSizeInUse\x12%\n" + + "\tisLearner\x18\n" + + " \x01(\bB\a\x8a\xb5\x18\x033.4R\tisLearner\x12/\n" + + "\x0estorageVersion\x18\v \x01(\tB\a\x8a\xb5\x18\x033.6R\x0estorageVersion\x12)\n" + + "\vdbSizeQuota\x18\f \x01(\x03B\a\x8a\xb5\x18\x033.6R\vdbSizeQuota\x12J\n" + + "\rdowngradeInfo\x18\r \x01(\v2\x1b.etcdserverpb.DowngradeInfoB\a\x8a\xb5\x18\x033.6R\rdowngradeInfo:\a\x82\xb5\x18\x033.0\"O\n" + + "\rDowngradeInfo\x12\x18\n" + + "\aenabled\x18\x01 \x01(\bR\aenabled\x12$\n" + + "\rtargetVersion\x18\x02 \x01(\tR\rtargetVersion\"\x1c\n" + + "\x11AuthEnableRequest:\a\x82\xb5\x18\x033.0\"\x1d\n" + + "\x12AuthDisableRequest:\a\x82\xb5\x18\x033.0\"\x1c\n" + + "\x11AuthStatusRequest:\a\x82\xb5\x18\x033.5\"N\n" + + "\x13AuthenticateRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1a\n" + + "\bpassword\x18\x02 \x01(\tR\bpassword:\a\x82\xb5\x18\x033.0\"\xb9\x01\n" + + "\x12AuthUserAddRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1a\n" + + "\bpassword\x18\x02 \x01(\tR\bpassword\x129\n" + + "\aoptions\x18\x03 \x01(\v2\x16.authpb.UserAddOptionsB\a\x8a\xb5\x18\x033.4R\aoptions\x12/\n" + + "\x0ehashedPassword\x18\x04 \x01(\tB\a\x8a\xb5\x18\x033.5R\x0ehashedPassword:\a\x82\xb5\x18\x033.0\"1\n" + + "\x12AuthUserGetRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name:\a\x82\xb5\x18\x033.0\"4\n" + + "\x15AuthUserDeleteRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name:\a\x82\xb5\x18\x033.0\"\x89\x01\n" + + "\x1dAuthUserChangePasswordRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1a\n" + + "\bpassword\x18\x02 \x01(\tR\bpassword\x12/\n" + + "\x0ehashedPassword\x18\x03 \x01(\tB\a\x8a\xb5\x18\x033.5R\x0ehashedPassword:\a\x82\xb5\x18\x033.0\"K\n" + + "\x18AuthUserGrantRoleRequest\x12\x12\n" + + "\x04user\x18\x01 \x01(\tR\x04user\x12\x12\n" + + "\x04role\x18\x02 \x01(\tR\x04role:\a\x82\xb5\x18\x033.0\"L\n" + + "\x19AuthUserRevokeRoleRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" + + "\x04role\x18\x02 \x01(\tR\x04role:\a\x82\xb5\x18\x033.0\"1\n" + + "\x12AuthRoleAddRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name:\a\x82\xb5\x18\x033.0\"1\n" + + "\x12AuthRoleGetRequest\x12\x12\n" + + "\x04role\x18\x01 \x01(\tR\x04role:\a\x82\xb5\x18\x033.0\"\x1e\n" + + "\x13AuthUserListRequest:\a\x82\xb5\x18\x033.0\"\x1e\n" + + "\x13AuthRoleListRequest:\a\x82\xb5\x18\x033.0\"4\n" + + "\x15AuthRoleDeleteRequest\x12\x12\n" + + "\x04role\x18\x01 \x01(\tR\x04role:\a\x82\xb5\x18\x033.0\"e\n" + + "\x1eAuthRoleGrantPermissionRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12&\n" + + "\x04perm\x18\x02 \x01(\v2\x12.authpb.PermissionR\x04perm:\a\x82\xb5\x18\x033.0\"m\n" + + "\x1fAuthRoleRevokePermissionRequest\x12\x12\n" + + "\x04role\x18\x01 \x01(\tR\x04role\x12\x10\n" + + "\x03key\x18\x02 \x01(\fR\x03key\x12\x1b\n" + + "\trange_end\x18\x03 \x01(\fR\brangeEnd:\a\x82\xb5\x18\x033.0\"S\n" + + "\x12AuthEnableResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header:\a\x82\xb5\x18\x033.0\"T\n" + + "\x13AuthDisableResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header:\a\x82\xb5\x18\x033.0\"\x91\x01\n" + + "\x12AuthStatusResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12\x18\n" + + "\aenabled\x18\x02 \x01(\bR\aenabled\x12\"\n" + + "\fauthRevision\x18\x03 \x01(\x04R\fauthRevision:\a\x82\xb5\x18\x033.5\"k\n" + + "\x14AuthenticateResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12\x14\n" + + "\x05token\x18\x02 \x01(\tR\x05token:\a\x82\xb5\x18\x033.0\"T\n" + + "\x13AuthUserAddResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header:\a\x82\xb5\x18\x033.0\"j\n" + + "\x13AuthUserGetResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12\x14\n" + + "\x05roles\x18\x02 \x03(\tR\x05roles:\a\x82\xb5\x18\x033.0\"W\n" + + "\x16AuthUserDeleteResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header:\a\x82\xb5\x18\x033.0\"_\n" + + "\x1eAuthUserChangePasswordResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header:\a\x82\xb5\x18\x033.0\"Z\n" + + "\x19AuthUserGrantRoleResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header:\a\x82\xb5\x18\x033.0\"[\n" + + "\x1aAuthUserRevokeRoleResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header:\a\x82\xb5\x18\x033.0\"T\n" + + "\x13AuthRoleAddResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header:\a\x82\xb5\x18\x033.0\"\x85\x01\n" + + "\x13AuthRoleGetResponse\x12=\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderB\a\x8a\xb5\x18\x033.0R\x06header\x12/\n" + + "\x04perm\x18\x02 \x03(\v2\x12.authpb.PermissionB\a\x8a\xb5\x18\x033.0R\x04perm\"k\n" + + "\x14AuthRoleListResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12\x14\n" + + "\x05roles\x18\x02 \x03(\tR\x05roles:\a\x82\xb5\x18\x033.0\"k\n" + + "\x14AuthUserListResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header\x12\x14\n" + + "\x05users\x18\x02 \x03(\tR\x05users:\a\x82\xb5\x18\x033.0\"W\n" + + "\x16AuthRoleDeleteResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header:\a\x82\xb5\x18\x033.0\"`\n" + + "\x1fAuthRoleGrantPermissionResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header:\a\x82\xb5\x18\x033.0\"a\n" + + " AuthRoleRevokePermissionResponse\x124\n" + + "\x06header\x18\x01 \x01(\v2\x1c.etcdserverpb.ResponseHeaderR\x06header:\a\x82\xb5\x18\x033.0\"b\n" + + "\x13RangeStreamResponse\x12B\n" + + "\x0erange_response\x18\x01 \x01(\v2\x1b.etcdserverpb.RangeResponseR\rrangeResponse:\a\x82\xb5\x18\x033.7*A\n" + + "\tAlarmType\x12\b\n" + + "\x04NONE\x10\x00\x12\v\n" + + "\aNOSPACE\x10\x01\x12\x14\n" + + "\aCORRUPT\x10\x02\x1a\a\x9a\xb5\x18\x033.3\x1a\a\x92\xb5\x18\x033.02\xb6\x04\n" + + "\x02KV\x12Y\n" + + "\x05Range\x12\x1a.etcdserverpb.RangeRequest\x1a\x1b.etcdserverpb.RangeResponse\"\x17\x82\xd3\xe4\x93\x02\x11:\x01*\"\f/v3/kv/range\x12P\n" + + "\vRangeStream\x12\x1a.etcdserverpb.RangeRequest\x1a!.etcdserverpb.RangeStreamResponse\"\x000\x01\x12Q\n" + + "\x03Put\x12\x18.etcdserverpb.PutRequest\x1a\x19.etcdserverpb.PutResponse\"\x15\x82\xd3\xe4\x93\x02\x0f:\x01*\"\n" + + "/v3/kv/put\x12q\n" + + "\vDeleteRange\x12 .etcdserverpb.DeleteRangeRequest\x1a!.etcdserverpb.DeleteRangeResponse\"\x1d\x82\xd3\xe4\x93\x02\x17:\x01*\"\x12/v3/kv/deleterange\x12Q\n" + + "\x03Txn\x12\x18.etcdserverpb.TxnRequest\x1a\x19.etcdserverpb.TxnResponse\"\x15\x82\xd3\xe4\x93\x02\x0f:\x01*\"\n" + + "/v3/kv/txn\x12j\n" + + "\aCompact\x12\x1f.etcdserverpb.CompactionRequest\x1a .etcdserverpb.CompactionResponse\"\x1c\x82\xd3\xe4\x93\x02\x16:\x01*\"\x11/v3/kv/compaction2c\n" + + "\x05Watch\x12Z\n" + + "\x05Watch\x12\x1a.etcdserverpb.WatchRequest\x1a\x1b.etcdserverpb.WatchResponse\"\x14\x82\xd3\xe4\x93\x02\x0e:\x01*\"\t/v3/watch(\x010\x012\xad\x05\n" + + "\x05Lease\x12k\n" + + "\n" + + "LeaseGrant\x12\x1f.etcdserverpb.LeaseGrantRequest\x1a .etcdserverpb.LeaseGrantResponse\"\x1a\x82\xd3\xe4\x93\x02\x14:\x01*\"\x0f/v3/lease/grant\x12\x89\x01\n" + + "\vLeaseRevoke\x12 .etcdserverpb.LeaseRevokeRequest\x1a!.etcdserverpb.LeaseRevokeResponse\"5\x82\xd3\xe4\x93\x02/:\x01*Z\x18:\x01*\"\x13/v3/kv/lease/revoke\"\x10/v3/lease/revoke\x12\x7f\n" + + "\x0eLeaseKeepAlive\x12#.etcdserverpb.LeaseKeepAliveRequest\x1a$.etcdserverpb.LeaseKeepAliveResponse\"\x1e\x82\xd3\xe4\x93\x02\x18:\x01*\"\x13/v3/lease/keepalive(\x010\x01\x12\x9d\x01\n" + + "\x0fLeaseTimeToLive\x12$.etcdserverpb.LeaseTimeToLiveRequest\x1a%.etcdserverpb.LeaseTimeToLiveResponse\"=\x82\xd3\xe4\x93\x027:\x01*Z\x1c:\x01*\"\x17/v3/kv/lease/timetolive\"\x14/v3/lease/timetolive\x12\x89\x01\n" + + "\vLeaseLeases\x12 .etcdserverpb.LeaseLeasesRequest\x1a!.etcdserverpb.LeaseLeasesResponse\"5\x82\xd3\xe4\x93\x02/:\x01*Z\x18:\x01*\"\x13/v3/kv/lease/leases\"\x10/v3/lease/leases2\xea\x04\n" + + "\aCluster\x12o\n" + + "\tMemberAdd\x12\x1e.etcdserverpb.MemberAddRequest\x1a\x1f.etcdserverpb.MemberAddResponse\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/v3/cluster/member/add\x12{\n" + + "\fMemberRemove\x12!.etcdserverpb.MemberRemoveRequest\x1a\".etcdserverpb.MemberRemoveResponse\"$\x82\xd3\xe4\x93\x02\x1e:\x01*\"\x19/v3/cluster/member/remove\x12{\n" + + "\fMemberUpdate\x12!.etcdserverpb.MemberUpdateRequest\x1a\".etcdserverpb.MemberUpdateResponse\"$\x82\xd3\xe4\x93\x02\x1e:\x01*\"\x19/v3/cluster/member/update\x12s\n" + + "\n" + + "MemberList\x12\x1f.etcdserverpb.MemberListRequest\x1a .etcdserverpb.MemberListResponse\"\"\x82\xd3\xe4\x93\x02\x1c:\x01*\"\x17/v3/cluster/member/list\x12\x7f\n" + + "\rMemberPromote\x12\".etcdserverpb.MemberPromoteRequest\x1a#.etcdserverpb.MemberPromoteResponse\"%\x82\xd3\xe4\x93\x02\x1f:\x01*\"\x1a/v3/cluster/member/promote2\x80\a\n" + + "\vMaintenance\x12b\n" + + "\x05Alarm\x12\x1a.etcdserverpb.AlarmRequest\x1a\x1b.etcdserverpb.AlarmResponse\" \x82\xd3\xe4\x93\x02\x1a:\x01*\"\x15/v3/maintenance/alarm\x12f\n" + + "\x06Status\x12\x1b.etcdserverpb.StatusRequest\x1a\x1c.etcdserverpb.StatusResponse\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/v3/maintenance/status\x12v\n" + + "\n" + + "Defragment\x12\x1f.etcdserverpb.DefragmentRequest\x1a .etcdserverpb.DefragmentResponse\"%\x82\xd3\xe4\x93\x02\x1f:\x01*\"\x1a/v3/maintenance/defragment\x12^\n" + + "\x04Hash\x12\x19.etcdserverpb.HashRequest\x1a\x1a.etcdserverpb.HashResponse\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\"\x14/v3/maintenance/hash\x12f\n" + + "\x06HashKV\x12\x1b.etcdserverpb.HashKVRequest\x1a\x1c.etcdserverpb.HashKVResponse\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/v3/maintenance/hashkv\x12p\n" + + "\bSnapshot\x12\x1d.etcdserverpb.SnapshotRequest\x1a\x1e.etcdserverpb.SnapshotResponse\"#\x82\xd3\xe4\x93\x02\x1d:\x01*\"\x18/v3/maintenance/snapshot0\x01\x12\x7f\n" + + "\n" + + "MoveLeader\x12\x1f.etcdserverpb.MoveLeaderRequest\x1a .etcdserverpb.MoveLeaderResponse\".\x82\xd3\xe4\x93\x02(:\x01*\"#/v3/maintenance/transfer-leadership\x12r\n" + + "\tDowngrade\x12\x1e.etcdserverpb.DowngradeRequest\x1a\x1f.etcdserverpb.DowngradeResponse\"$\x82\xd3\xe4\x93\x02\x1e:\x01*\"\x19/v3/maintenance/downgrade2\xa7\x10\n" + + "\x04Auth\x12k\n" + + "\n" + + "AuthEnable\x12\x1f.etcdserverpb.AuthEnableRequest\x1a .etcdserverpb.AuthEnableResponse\"\x1a\x82\xd3\xe4\x93\x02\x14:\x01*\"\x0f/v3/auth/enable\x12o\n" + + "\vAuthDisable\x12 .etcdserverpb.AuthDisableRequest\x1a!.etcdserverpb.AuthDisableResponse\"\x1b\x82\xd3\xe4\x93\x02\x15:\x01*\"\x10/v3/auth/disable\x12k\n" + + "\n" + + "AuthStatus\x12\x1f.etcdserverpb.AuthStatusRequest\x1a .etcdserverpb.AuthStatusResponse\"\x1a\x82\xd3\xe4\x93\x02\x14:\x01*\"\x0f/v3/auth/status\x12w\n" + + "\fAuthenticate\x12!.etcdserverpb.AuthenticateRequest\x1a\".etcdserverpb.AuthenticateResponse\" \x82\xd3\xe4\x93\x02\x1a:\x01*\"\x15/v3/auth/authenticate\x12l\n" + + "\aUserAdd\x12 .etcdserverpb.AuthUserAddRequest\x1a!.etcdserverpb.AuthUserAddResponse\"\x1c\x82\xd3\xe4\x93\x02\x16:\x01*\"\x11/v3/auth/user/add\x12l\n" + + "\aUserGet\x12 .etcdserverpb.AuthUserGetRequest\x1a!.etcdserverpb.AuthUserGetResponse\"\x1c\x82\xd3\xe4\x93\x02\x16:\x01*\"\x11/v3/auth/user/get\x12p\n" + + "\bUserList\x12!.etcdserverpb.AuthUserListRequest\x1a\".etcdserverpb.AuthUserListResponse\"\x1d\x82\xd3\xe4\x93\x02\x17:\x01*\"\x12/v3/auth/user/list\x12x\n" + + "\n" + + "UserDelete\x12#.etcdserverpb.AuthUserDeleteRequest\x1a$.etcdserverpb.AuthUserDeleteResponse\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\"\x14/v3/auth/user/delete\x12\x92\x01\n" + + "\x12UserChangePassword\x12+.etcdserverpb.AuthUserChangePasswordRequest\x1a,.etcdserverpb.AuthUserChangePasswordResponse\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/v3/auth/user/changepw\x12\x80\x01\n" + + "\rUserGrantRole\x12&.etcdserverpb.AuthUserGrantRoleRequest\x1a'.etcdserverpb.AuthUserGrantRoleResponse\"\x1e\x82\xd3\xe4\x93\x02\x18:\x01*\"\x13/v3/auth/user/grant\x12\x84\x01\n" + + "\x0eUserRevokeRole\x12'.etcdserverpb.AuthUserRevokeRoleRequest\x1a(.etcdserverpb.AuthUserRevokeRoleResponse\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\"\x14/v3/auth/user/revoke\x12l\n" + + "\aRoleAdd\x12 .etcdserverpb.AuthRoleAddRequest\x1a!.etcdserverpb.AuthRoleAddResponse\"\x1c\x82\xd3\xe4\x93\x02\x16:\x01*\"\x11/v3/auth/role/add\x12l\n" + + "\aRoleGet\x12 .etcdserverpb.AuthRoleGetRequest\x1a!.etcdserverpb.AuthRoleGetResponse\"\x1c\x82\xd3\xe4\x93\x02\x16:\x01*\"\x11/v3/auth/role/get\x12p\n" + + "\bRoleList\x12!.etcdserverpb.AuthRoleListRequest\x1a\".etcdserverpb.AuthRoleListResponse\"\x1d\x82\xd3\xe4\x93\x02\x17:\x01*\"\x12/v3/auth/role/list\x12x\n" + + "\n" + + "RoleDelete\x12#.etcdserverpb.AuthRoleDeleteRequest\x1a$.etcdserverpb.AuthRoleDeleteResponse\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\"\x14/v3/auth/role/delete\x12\x92\x01\n" + + "\x13RoleGrantPermission\x12,.etcdserverpb.AuthRoleGrantPermissionRequest\x1a-.etcdserverpb.AuthRoleGrantPermissionResponse\"\x1e\x82\xd3\xe4\x93\x02\x18:\x01*\"\x13/v3/auth/role/grant\x12\x96\x01\n" + + "\x14RoleRevokePermission\x12-.etcdserverpb.AuthRoleRevokePermissionRequest\x1a..etcdserverpb.AuthRoleRevokePermissionResponse\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\"\x14/v3/auth/role/revokeBW\x92A/Z\x1f\n" + + "\x1d\n" + + "\x06ApiKey\x12\x13\b\x02\x1a\rAuthorization \x02b\f\n" + + "\n" + + "\n" + + "\x06ApiKey\x12\x00Z#go.etcd.io/etcd/api/v3/etcdserverpbb\x06proto3" -func _Lease_LeaseTimeToLive_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LeaseTimeToLiveRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LeaseServer).LeaseTimeToLive(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Lease/LeaseTimeToLive", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LeaseServer).LeaseTimeToLive(ctx, req.(*LeaseTimeToLiveRequest)) - } - return interceptor(ctx, in, info, handler) -} +var ( + file_rpc_proto_rawDescOnce sync.Once + file_rpc_proto_rawDescData []byte +) -func _Lease_LeaseLeases_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LeaseLeasesRequest) - if err := dec(in); err != nil { - return nil, err +func file_rpc_proto_rawDescGZIP() []byte { + file_rpc_proto_rawDescOnce.Do(func() { + file_rpc_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_rpc_proto_rawDesc), len(file_rpc_proto_rawDesc))) + }) + return file_rpc_proto_rawDescData +} + +var file_rpc_proto_enumTypes = make([]protoimpl.EnumInfo, 8) +var file_rpc_proto_msgTypes = make([]protoimpl.MessageInfo, 98) +var file_rpc_proto_goTypes = []any{ + (AlarmType)(0), // 0: etcdserverpb.AlarmType + (RangeRequest_SortOrder)(0), // 1: etcdserverpb.RangeRequest.SortOrder + (RangeRequest_SortTarget)(0), // 2: etcdserverpb.RangeRequest.SortTarget + (Compare_CompareResult)(0), // 3: etcdserverpb.Compare.CompareResult + (Compare_CompareTarget)(0), // 4: etcdserverpb.Compare.CompareTarget + (WatchCreateRequest_FilterType)(0), // 5: etcdserverpb.WatchCreateRequest.FilterType + (AlarmRequest_AlarmAction)(0), // 6: etcdserverpb.AlarmRequest.AlarmAction + (DowngradeRequest_DowngradeAction)(0), // 7: etcdserverpb.DowngradeRequest.DowngradeAction + (*ResponseHeader)(nil), // 8: etcdserverpb.ResponseHeader + (*RangeRequest)(nil), // 9: etcdserverpb.RangeRequest + (*RangeResponse)(nil), // 10: etcdserverpb.RangeResponse + (*PutRequest)(nil), // 11: etcdserverpb.PutRequest + (*PutResponse)(nil), // 12: etcdserverpb.PutResponse + (*DeleteRangeRequest)(nil), // 13: etcdserverpb.DeleteRangeRequest + (*DeleteRangeResponse)(nil), // 14: etcdserverpb.DeleteRangeResponse + (*RequestOp)(nil), // 15: etcdserverpb.RequestOp + (*ResponseOp)(nil), // 16: etcdserverpb.ResponseOp + (*Compare)(nil), // 17: etcdserverpb.Compare + (*TxnRequest)(nil), // 18: etcdserverpb.TxnRequest + (*TxnResponse)(nil), // 19: etcdserverpb.TxnResponse + (*CompactionRequest)(nil), // 20: etcdserverpb.CompactionRequest + (*CompactionResponse)(nil), // 21: etcdserverpb.CompactionResponse + (*HashRequest)(nil), // 22: etcdserverpb.HashRequest + (*HashKVRequest)(nil), // 23: etcdserverpb.HashKVRequest + (*HashKVResponse)(nil), // 24: etcdserverpb.HashKVResponse + (*HashResponse)(nil), // 25: etcdserverpb.HashResponse + (*SnapshotRequest)(nil), // 26: etcdserverpb.SnapshotRequest + (*SnapshotResponse)(nil), // 27: etcdserverpb.SnapshotResponse + (*WatchRequest)(nil), // 28: etcdserverpb.WatchRequest + (*WatchCreateRequest)(nil), // 29: etcdserverpb.WatchCreateRequest + (*WatchCancelRequest)(nil), // 30: etcdserverpb.WatchCancelRequest + (*WatchProgressRequest)(nil), // 31: etcdserverpb.WatchProgressRequest + (*WatchResponse)(nil), // 32: etcdserverpb.WatchResponse + (*LeaseGrantRequest)(nil), // 33: etcdserverpb.LeaseGrantRequest + (*LeaseGrantResponse)(nil), // 34: etcdserverpb.LeaseGrantResponse + (*LeaseRevokeRequest)(nil), // 35: etcdserverpb.LeaseRevokeRequest + (*LeaseRevokeResponse)(nil), // 36: etcdserverpb.LeaseRevokeResponse + (*LeaseCheckpoint)(nil), // 37: etcdserverpb.LeaseCheckpoint + (*LeaseCheckpointRequest)(nil), // 38: etcdserverpb.LeaseCheckpointRequest + (*LeaseCheckpointResponse)(nil), // 39: etcdserverpb.LeaseCheckpointResponse + (*LeaseKeepAliveRequest)(nil), // 40: etcdserverpb.LeaseKeepAliveRequest + (*LeaseKeepAliveResponse)(nil), // 41: etcdserverpb.LeaseKeepAliveResponse + (*LeaseTimeToLiveRequest)(nil), // 42: etcdserverpb.LeaseTimeToLiveRequest + (*LeaseTimeToLiveResponse)(nil), // 43: etcdserverpb.LeaseTimeToLiveResponse + (*LeaseLeasesRequest)(nil), // 44: etcdserverpb.LeaseLeasesRequest + (*LeaseStatus)(nil), // 45: etcdserverpb.LeaseStatus + (*LeaseLeasesResponse)(nil), // 46: etcdserverpb.LeaseLeasesResponse + (*Member)(nil), // 47: etcdserverpb.Member + (*MemberAddRequest)(nil), // 48: etcdserverpb.MemberAddRequest + (*MemberAddResponse)(nil), // 49: etcdserverpb.MemberAddResponse + (*MemberRemoveRequest)(nil), // 50: etcdserverpb.MemberRemoveRequest + (*MemberRemoveResponse)(nil), // 51: etcdserverpb.MemberRemoveResponse + (*MemberUpdateRequest)(nil), // 52: etcdserverpb.MemberUpdateRequest + (*MemberUpdateResponse)(nil), // 53: etcdserverpb.MemberUpdateResponse + (*MemberListRequest)(nil), // 54: etcdserverpb.MemberListRequest + (*MemberListResponse)(nil), // 55: etcdserverpb.MemberListResponse + (*MemberPromoteRequest)(nil), // 56: etcdserverpb.MemberPromoteRequest + (*MemberPromoteResponse)(nil), // 57: etcdserverpb.MemberPromoteResponse + (*DefragmentRequest)(nil), // 58: etcdserverpb.DefragmentRequest + (*DefragmentResponse)(nil), // 59: etcdserverpb.DefragmentResponse + (*MoveLeaderRequest)(nil), // 60: etcdserverpb.MoveLeaderRequest + (*MoveLeaderResponse)(nil), // 61: etcdserverpb.MoveLeaderResponse + (*AlarmRequest)(nil), // 62: etcdserverpb.AlarmRequest + (*AlarmMember)(nil), // 63: etcdserverpb.AlarmMember + (*AlarmResponse)(nil), // 64: etcdserverpb.AlarmResponse + (*DowngradeRequest)(nil), // 65: etcdserverpb.DowngradeRequest + (*DowngradeResponse)(nil), // 66: etcdserverpb.DowngradeResponse + (*DowngradeVersionTestRequest)(nil), // 67: etcdserverpb.DowngradeVersionTestRequest + (*StatusRequest)(nil), // 68: etcdserverpb.StatusRequest + (*StatusResponse)(nil), // 69: etcdserverpb.StatusResponse + (*DowngradeInfo)(nil), // 70: etcdserverpb.DowngradeInfo + (*AuthEnableRequest)(nil), // 71: etcdserverpb.AuthEnableRequest + (*AuthDisableRequest)(nil), // 72: etcdserverpb.AuthDisableRequest + (*AuthStatusRequest)(nil), // 73: etcdserverpb.AuthStatusRequest + (*AuthenticateRequest)(nil), // 74: etcdserverpb.AuthenticateRequest + (*AuthUserAddRequest)(nil), // 75: etcdserverpb.AuthUserAddRequest + (*AuthUserGetRequest)(nil), // 76: etcdserverpb.AuthUserGetRequest + (*AuthUserDeleteRequest)(nil), // 77: etcdserverpb.AuthUserDeleteRequest + (*AuthUserChangePasswordRequest)(nil), // 78: etcdserverpb.AuthUserChangePasswordRequest + (*AuthUserGrantRoleRequest)(nil), // 79: etcdserverpb.AuthUserGrantRoleRequest + (*AuthUserRevokeRoleRequest)(nil), // 80: etcdserverpb.AuthUserRevokeRoleRequest + (*AuthRoleAddRequest)(nil), // 81: etcdserverpb.AuthRoleAddRequest + (*AuthRoleGetRequest)(nil), // 82: etcdserverpb.AuthRoleGetRequest + (*AuthUserListRequest)(nil), // 83: etcdserverpb.AuthUserListRequest + (*AuthRoleListRequest)(nil), // 84: etcdserverpb.AuthRoleListRequest + (*AuthRoleDeleteRequest)(nil), // 85: etcdserverpb.AuthRoleDeleteRequest + (*AuthRoleGrantPermissionRequest)(nil), // 86: etcdserverpb.AuthRoleGrantPermissionRequest + (*AuthRoleRevokePermissionRequest)(nil), // 87: etcdserverpb.AuthRoleRevokePermissionRequest + (*AuthEnableResponse)(nil), // 88: etcdserverpb.AuthEnableResponse + (*AuthDisableResponse)(nil), // 89: etcdserverpb.AuthDisableResponse + (*AuthStatusResponse)(nil), // 90: etcdserverpb.AuthStatusResponse + (*AuthenticateResponse)(nil), // 91: etcdserverpb.AuthenticateResponse + (*AuthUserAddResponse)(nil), // 92: etcdserverpb.AuthUserAddResponse + (*AuthUserGetResponse)(nil), // 93: etcdserverpb.AuthUserGetResponse + (*AuthUserDeleteResponse)(nil), // 94: etcdserverpb.AuthUserDeleteResponse + (*AuthUserChangePasswordResponse)(nil), // 95: etcdserverpb.AuthUserChangePasswordResponse + (*AuthUserGrantRoleResponse)(nil), // 96: etcdserverpb.AuthUserGrantRoleResponse + (*AuthUserRevokeRoleResponse)(nil), // 97: etcdserverpb.AuthUserRevokeRoleResponse + (*AuthRoleAddResponse)(nil), // 98: etcdserverpb.AuthRoleAddResponse + (*AuthRoleGetResponse)(nil), // 99: etcdserverpb.AuthRoleGetResponse + (*AuthRoleListResponse)(nil), // 100: etcdserverpb.AuthRoleListResponse + (*AuthUserListResponse)(nil), // 101: etcdserverpb.AuthUserListResponse + (*AuthRoleDeleteResponse)(nil), // 102: etcdserverpb.AuthRoleDeleteResponse + (*AuthRoleGrantPermissionResponse)(nil), // 103: etcdserverpb.AuthRoleGrantPermissionResponse + (*AuthRoleRevokePermissionResponse)(nil), // 104: etcdserverpb.AuthRoleRevokePermissionResponse + (*RangeStreamResponse)(nil), // 105: etcdserverpb.RangeStreamResponse + (*mvccpb.KeyValue)(nil), // 106: mvccpb.KeyValue + (*mvccpb.Event)(nil), // 107: mvccpb.Event + (*authpb.UserAddOptions)(nil), // 108: authpb.UserAddOptions + (*authpb.Permission)(nil), // 109: authpb.Permission +} +var file_rpc_proto_depIdxs = []int32{ + 1, // 0: etcdserverpb.RangeRequest.sort_order:type_name -> etcdserverpb.RangeRequest.SortOrder + 2, // 1: etcdserverpb.RangeRequest.sort_target:type_name -> etcdserverpb.RangeRequest.SortTarget + 8, // 2: etcdserverpb.RangeResponse.header:type_name -> etcdserverpb.ResponseHeader + 106, // 3: etcdserverpb.RangeResponse.kvs:type_name -> mvccpb.KeyValue + 8, // 4: etcdserverpb.PutResponse.header:type_name -> etcdserverpb.ResponseHeader + 106, // 5: etcdserverpb.PutResponse.prev_kv:type_name -> mvccpb.KeyValue + 8, // 6: etcdserverpb.DeleteRangeResponse.header:type_name -> etcdserverpb.ResponseHeader + 106, // 7: etcdserverpb.DeleteRangeResponse.prev_kvs:type_name -> mvccpb.KeyValue + 9, // 8: etcdserverpb.RequestOp.request_range:type_name -> etcdserverpb.RangeRequest + 11, // 9: etcdserverpb.RequestOp.request_put:type_name -> etcdserverpb.PutRequest + 13, // 10: etcdserverpb.RequestOp.request_delete_range:type_name -> etcdserverpb.DeleteRangeRequest + 18, // 11: etcdserverpb.RequestOp.request_txn:type_name -> etcdserverpb.TxnRequest + 10, // 12: etcdserverpb.ResponseOp.response_range:type_name -> etcdserverpb.RangeResponse + 12, // 13: etcdserverpb.ResponseOp.response_put:type_name -> etcdserverpb.PutResponse + 14, // 14: etcdserverpb.ResponseOp.response_delete_range:type_name -> etcdserverpb.DeleteRangeResponse + 19, // 15: etcdserverpb.ResponseOp.response_txn:type_name -> etcdserverpb.TxnResponse + 3, // 16: etcdserverpb.Compare.result:type_name -> etcdserverpb.Compare.CompareResult + 4, // 17: etcdserverpb.Compare.target:type_name -> etcdserverpb.Compare.CompareTarget + 17, // 18: etcdserverpb.TxnRequest.compare:type_name -> etcdserverpb.Compare + 15, // 19: etcdserverpb.TxnRequest.success:type_name -> etcdserverpb.RequestOp + 15, // 20: etcdserverpb.TxnRequest.failure:type_name -> etcdserverpb.RequestOp + 8, // 21: etcdserverpb.TxnResponse.header:type_name -> etcdserverpb.ResponseHeader + 16, // 22: etcdserverpb.TxnResponse.responses:type_name -> etcdserverpb.ResponseOp + 8, // 23: etcdserverpb.CompactionResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 24: etcdserverpb.HashKVResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 25: etcdserverpb.HashResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 26: etcdserverpb.SnapshotResponse.header:type_name -> etcdserverpb.ResponseHeader + 29, // 27: etcdserverpb.WatchRequest.create_request:type_name -> etcdserverpb.WatchCreateRequest + 30, // 28: etcdserverpb.WatchRequest.cancel_request:type_name -> etcdserverpb.WatchCancelRequest + 31, // 29: etcdserverpb.WatchRequest.progress_request:type_name -> etcdserverpb.WatchProgressRequest + 5, // 30: etcdserverpb.WatchCreateRequest.filters:type_name -> etcdserverpb.WatchCreateRequest.FilterType + 8, // 31: etcdserverpb.WatchResponse.header:type_name -> etcdserverpb.ResponseHeader + 107, // 32: etcdserverpb.WatchResponse.events:type_name -> mvccpb.Event + 8, // 33: etcdserverpb.LeaseGrantResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 34: etcdserverpb.LeaseRevokeResponse.header:type_name -> etcdserverpb.ResponseHeader + 37, // 35: etcdserverpb.LeaseCheckpointRequest.checkpoints:type_name -> etcdserverpb.LeaseCheckpoint + 8, // 36: etcdserverpb.LeaseCheckpointResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 37: etcdserverpb.LeaseKeepAliveResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 38: etcdserverpb.LeaseTimeToLiveResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 39: etcdserverpb.LeaseLeasesResponse.header:type_name -> etcdserverpb.ResponseHeader + 45, // 40: etcdserverpb.LeaseLeasesResponse.leases:type_name -> etcdserverpb.LeaseStatus + 8, // 41: etcdserverpb.MemberAddResponse.header:type_name -> etcdserverpb.ResponseHeader + 47, // 42: etcdserverpb.MemberAddResponse.member:type_name -> etcdserverpb.Member + 47, // 43: etcdserverpb.MemberAddResponse.members:type_name -> etcdserverpb.Member + 8, // 44: etcdserverpb.MemberRemoveResponse.header:type_name -> etcdserverpb.ResponseHeader + 47, // 45: etcdserverpb.MemberRemoveResponse.members:type_name -> etcdserverpb.Member + 8, // 46: etcdserverpb.MemberUpdateResponse.header:type_name -> etcdserverpb.ResponseHeader + 47, // 47: etcdserverpb.MemberUpdateResponse.members:type_name -> etcdserverpb.Member + 8, // 48: etcdserverpb.MemberListResponse.header:type_name -> etcdserverpb.ResponseHeader + 47, // 49: etcdserverpb.MemberListResponse.members:type_name -> etcdserverpb.Member + 8, // 50: etcdserverpb.MemberPromoteResponse.header:type_name -> etcdserverpb.ResponseHeader + 47, // 51: etcdserverpb.MemberPromoteResponse.members:type_name -> etcdserverpb.Member + 8, // 52: etcdserverpb.DefragmentResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 53: etcdserverpb.MoveLeaderResponse.header:type_name -> etcdserverpb.ResponseHeader + 6, // 54: etcdserverpb.AlarmRequest.action:type_name -> etcdserverpb.AlarmRequest.AlarmAction + 0, // 55: etcdserverpb.AlarmRequest.alarm:type_name -> etcdserverpb.AlarmType + 0, // 56: etcdserverpb.AlarmMember.alarm:type_name -> etcdserverpb.AlarmType + 8, // 57: etcdserverpb.AlarmResponse.header:type_name -> etcdserverpb.ResponseHeader + 63, // 58: etcdserverpb.AlarmResponse.alarms:type_name -> etcdserverpb.AlarmMember + 7, // 59: etcdserverpb.DowngradeRequest.action:type_name -> etcdserverpb.DowngradeRequest.DowngradeAction + 8, // 60: etcdserverpb.DowngradeResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 61: etcdserverpb.StatusResponse.header:type_name -> etcdserverpb.ResponseHeader + 70, // 62: etcdserverpb.StatusResponse.downgradeInfo:type_name -> etcdserverpb.DowngradeInfo + 108, // 63: etcdserverpb.AuthUserAddRequest.options:type_name -> authpb.UserAddOptions + 109, // 64: etcdserverpb.AuthRoleGrantPermissionRequest.perm:type_name -> authpb.Permission + 8, // 65: etcdserverpb.AuthEnableResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 66: etcdserverpb.AuthDisableResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 67: etcdserverpb.AuthStatusResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 68: etcdserverpb.AuthenticateResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 69: etcdserverpb.AuthUserAddResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 70: etcdserverpb.AuthUserGetResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 71: etcdserverpb.AuthUserDeleteResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 72: etcdserverpb.AuthUserChangePasswordResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 73: etcdserverpb.AuthUserGrantRoleResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 74: etcdserverpb.AuthUserRevokeRoleResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 75: etcdserverpb.AuthRoleAddResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 76: etcdserverpb.AuthRoleGetResponse.header:type_name -> etcdserverpb.ResponseHeader + 109, // 77: etcdserverpb.AuthRoleGetResponse.perm:type_name -> authpb.Permission + 8, // 78: etcdserverpb.AuthRoleListResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 79: etcdserverpb.AuthUserListResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 80: etcdserverpb.AuthRoleDeleteResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 81: etcdserverpb.AuthRoleGrantPermissionResponse.header:type_name -> etcdserverpb.ResponseHeader + 8, // 82: etcdserverpb.AuthRoleRevokePermissionResponse.header:type_name -> etcdserverpb.ResponseHeader + 10, // 83: etcdserverpb.RangeStreamResponse.range_response:type_name -> etcdserverpb.RangeResponse + 9, // 84: etcdserverpb.KV.Range:input_type -> etcdserverpb.RangeRequest + 9, // 85: etcdserverpb.KV.RangeStream:input_type -> etcdserverpb.RangeRequest + 11, // 86: etcdserverpb.KV.Put:input_type -> etcdserverpb.PutRequest + 13, // 87: etcdserverpb.KV.DeleteRange:input_type -> etcdserverpb.DeleteRangeRequest + 18, // 88: etcdserverpb.KV.Txn:input_type -> etcdserverpb.TxnRequest + 20, // 89: etcdserverpb.KV.Compact:input_type -> etcdserverpb.CompactionRequest + 28, // 90: etcdserverpb.Watch.Watch:input_type -> etcdserverpb.WatchRequest + 33, // 91: etcdserverpb.Lease.LeaseGrant:input_type -> etcdserverpb.LeaseGrantRequest + 35, // 92: etcdserverpb.Lease.LeaseRevoke:input_type -> etcdserverpb.LeaseRevokeRequest + 40, // 93: etcdserverpb.Lease.LeaseKeepAlive:input_type -> etcdserverpb.LeaseKeepAliveRequest + 42, // 94: etcdserverpb.Lease.LeaseTimeToLive:input_type -> etcdserverpb.LeaseTimeToLiveRequest + 44, // 95: etcdserverpb.Lease.LeaseLeases:input_type -> etcdserverpb.LeaseLeasesRequest + 48, // 96: etcdserverpb.Cluster.MemberAdd:input_type -> etcdserverpb.MemberAddRequest + 50, // 97: etcdserverpb.Cluster.MemberRemove:input_type -> etcdserverpb.MemberRemoveRequest + 52, // 98: etcdserverpb.Cluster.MemberUpdate:input_type -> etcdserverpb.MemberUpdateRequest + 54, // 99: etcdserverpb.Cluster.MemberList:input_type -> etcdserverpb.MemberListRequest + 56, // 100: etcdserverpb.Cluster.MemberPromote:input_type -> etcdserverpb.MemberPromoteRequest + 62, // 101: etcdserverpb.Maintenance.Alarm:input_type -> etcdserverpb.AlarmRequest + 68, // 102: etcdserverpb.Maintenance.Status:input_type -> etcdserverpb.StatusRequest + 58, // 103: etcdserverpb.Maintenance.Defragment:input_type -> etcdserverpb.DefragmentRequest + 22, // 104: etcdserverpb.Maintenance.Hash:input_type -> etcdserverpb.HashRequest + 23, // 105: etcdserverpb.Maintenance.HashKV:input_type -> etcdserverpb.HashKVRequest + 26, // 106: etcdserverpb.Maintenance.Snapshot:input_type -> etcdserverpb.SnapshotRequest + 60, // 107: etcdserverpb.Maintenance.MoveLeader:input_type -> etcdserverpb.MoveLeaderRequest + 65, // 108: etcdserverpb.Maintenance.Downgrade:input_type -> etcdserverpb.DowngradeRequest + 71, // 109: etcdserverpb.Auth.AuthEnable:input_type -> etcdserverpb.AuthEnableRequest + 72, // 110: etcdserverpb.Auth.AuthDisable:input_type -> etcdserverpb.AuthDisableRequest + 73, // 111: etcdserverpb.Auth.AuthStatus:input_type -> etcdserverpb.AuthStatusRequest + 74, // 112: etcdserverpb.Auth.Authenticate:input_type -> etcdserverpb.AuthenticateRequest + 75, // 113: etcdserverpb.Auth.UserAdd:input_type -> etcdserverpb.AuthUserAddRequest + 76, // 114: etcdserverpb.Auth.UserGet:input_type -> etcdserverpb.AuthUserGetRequest + 83, // 115: etcdserverpb.Auth.UserList:input_type -> etcdserverpb.AuthUserListRequest + 77, // 116: etcdserverpb.Auth.UserDelete:input_type -> etcdserverpb.AuthUserDeleteRequest + 78, // 117: etcdserverpb.Auth.UserChangePassword:input_type -> etcdserverpb.AuthUserChangePasswordRequest + 79, // 118: etcdserverpb.Auth.UserGrantRole:input_type -> etcdserverpb.AuthUserGrantRoleRequest + 80, // 119: etcdserverpb.Auth.UserRevokeRole:input_type -> etcdserverpb.AuthUserRevokeRoleRequest + 81, // 120: etcdserverpb.Auth.RoleAdd:input_type -> etcdserverpb.AuthRoleAddRequest + 82, // 121: etcdserverpb.Auth.RoleGet:input_type -> etcdserverpb.AuthRoleGetRequest + 84, // 122: etcdserverpb.Auth.RoleList:input_type -> etcdserverpb.AuthRoleListRequest + 85, // 123: etcdserverpb.Auth.RoleDelete:input_type -> etcdserverpb.AuthRoleDeleteRequest + 86, // 124: etcdserverpb.Auth.RoleGrantPermission:input_type -> etcdserverpb.AuthRoleGrantPermissionRequest + 87, // 125: etcdserverpb.Auth.RoleRevokePermission:input_type -> etcdserverpb.AuthRoleRevokePermissionRequest + 10, // 126: etcdserverpb.KV.Range:output_type -> etcdserverpb.RangeResponse + 105, // 127: etcdserverpb.KV.RangeStream:output_type -> etcdserverpb.RangeStreamResponse + 12, // 128: etcdserverpb.KV.Put:output_type -> etcdserverpb.PutResponse + 14, // 129: etcdserverpb.KV.DeleteRange:output_type -> etcdserverpb.DeleteRangeResponse + 19, // 130: etcdserverpb.KV.Txn:output_type -> etcdserverpb.TxnResponse + 21, // 131: etcdserverpb.KV.Compact:output_type -> etcdserverpb.CompactionResponse + 32, // 132: etcdserverpb.Watch.Watch:output_type -> etcdserverpb.WatchResponse + 34, // 133: etcdserverpb.Lease.LeaseGrant:output_type -> etcdserverpb.LeaseGrantResponse + 36, // 134: etcdserverpb.Lease.LeaseRevoke:output_type -> etcdserverpb.LeaseRevokeResponse + 41, // 135: etcdserverpb.Lease.LeaseKeepAlive:output_type -> etcdserverpb.LeaseKeepAliveResponse + 43, // 136: etcdserverpb.Lease.LeaseTimeToLive:output_type -> etcdserverpb.LeaseTimeToLiveResponse + 46, // 137: etcdserverpb.Lease.LeaseLeases:output_type -> etcdserverpb.LeaseLeasesResponse + 49, // 138: etcdserverpb.Cluster.MemberAdd:output_type -> etcdserverpb.MemberAddResponse + 51, // 139: etcdserverpb.Cluster.MemberRemove:output_type -> etcdserverpb.MemberRemoveResponse + 53, // 140: etcdserverpb.Cluster.MemberUpdate:output_type -> etcdserverpb.MemberUpdateResponse + 55, // 141: etcdserverpb.Cluster.MemberList:output_type -> etcdserverpb.MemberListResponse + 57, // 142: etcdserverpb.Cluster.MemberPromote:output_type -> etcdserverpb.MemberPromoteResponse + 64, // 143: etcdserverpb.Maintenance.Alarm:output_type -> etcdserverpb.AlarmResponse + 69, // 144: etcdserverpb.Maintenance.Status:output_type -> etcdserverpb.StatusResponse + 59, // 145: etcdserverpb.Maintenance.Defragment:output_type -> etcdserverpb.DefragmentResponse + 25, // 146: etcdserverpb.Maintenance.Hash:output_type -> etcdserverpb.HashResponse + 24, // 147: etcdserverpb.Maintenance.HashKV:output_type -> etcdserverpb.HashKVResponse + 27, // 148: etcdserverpb.Maintenance.Snapshot:output_type -> etcdserverpb.SnapshotResponse + 61, // 149: etcdserverpb.Maintenance.MoveLeader:output_type -> etcdserverpb.MoveLeaderResponse + 66, // 150: etcdserverpb.Maintenance.Downgrade:output_type -> etcdserverpb.DowngradeResponse + 88, // 151: etcdserverpb.Auth.AuthEnable:output_type -> etcdserverpb.AuthEnableResponse + 89, // 152: etcdserverpb.Auth.AuthDisable:output_type -> etcdserverpb.AuthDisableResponse + 90, // 153: etcdserverpb.Auth.AuthStatus:output_type -> etcdserverpb.AuthStatusResponse + 91, // 154: etcdserverpb.Auth.Authenticate:output_type -> etcdserverpb.AuthenticateResponse + 92, // 155: etcdserverpb.Auth.UserAdd:output_type -> etcdserverpb.AuthUserAddResponse + 93, // 156: etcdserverpb.Auth.UserGet:output_type -> etcdserverpb.AuthUserGetResponse + 101, // 157: etcdserverpb.Auth.UserList:output_type -> etcdserverpb.AuthUserListResponse + 94, // 158: etcdserverpb.Auth.UserDelete:output_type -> etcdserverpb.AuthUserDeleteResponse + 95, // 159: etcdserverpb.Auth.UserChangePassword:output_type -> etcdserverpb.AuthUserChangePasswordResponse + 96, // 160: etcdserverpb.Auth.UserGrantRole:output_type -> etcdserverpb.AuthUserGrantRoleResponse + 97, // 161: etcdserverpb.Auth.UserRevokeRole:output_type -> etcdserverpb.AuthUserRevokeRoleResponse + 98, // 162: etcdserverpb.Auth.RoleAdd:output_type -> etcdserverpb.AuthRoleAddResponse + 99, // 163: etcdserverpb.Auth.RoleGet:output_type -> etcdserverpb.AuthRoleGetResponse + 100, // 164: etcdserverpb.Auth.RoleList:output_type -> etcdserverpb.AuthRoleListResponse + 102, // 165: etcdserverpb.Auth.RoleDelete:output_type -> etcdserverpb.AuthRoleDeleteResponse + 103, // 166: etcdserverpb.Auth.RoleGrantPermission:output_type -> etcdserverpb.AuthRoleGrantPermissionResponse + 104, // 167: etcdserverpb.Auth.RoleRevokePermission:output_type -> etcdserverpb.AuthRoleRevokePermissionResponse + 126, // [126:168] is the sub-list for method output_type + 84, // [84:126] is the sub-list for method input_type + 84, // [84:84] is the sub-list for extension type_name + 84, // [84:84] is the sub-list for extension extendee + 0, // [0:84] is the sub-list for field type_name +} + +func init() { file_rpc_proto_init() } +func file_rpc_proto_init() { + if File_rpc_proto != nil { + return + } + file_rpc_proto_msgTypes[7].OneofWrappers = []any{ + (*RequestOp_RequestRange)(nil), + (*RequestOp_RequestPut)(nil), + (*RequestOp_RequestDeleteRange)(nil), + (*RequestOp_RequestTxn)(nil), } - if interceptor == nil { - return srv.(LeaseServer).LeaseLeases(ctx, in) + file_rpc_proto_msgTypes[8].OneofWrappers = []any{ + (*ResponseOp_ResponseRange)(nil), + (*ResponseOp_ResponsePut)(nil), + (*ResponseOp_ResponseDeleteRange)(nil), + (*ResponseOp_ResponseTxn)(nil), } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Lease/LeaseLeases", + file_rpc_proto_msgTypes[9].OneofWrappers = []any{ + (*Compare_Version)(nil), + (*Compare_CreateRevision)(nil), + (*Compare_ModRevision)(nil), + (*Compare_Value)(nil), + (*Compare_Lease)(nil), } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LeaseServer).LeaseLeases(ctx, req.(*LeaseLeasesRequest)) + file_rpc_proto_msgTypes[20].OneofWrappers = []any{ + (*WatchRequest_CreateRequest)(nil), + (*WatchRequest_CancelRequest)(nil), + (*WatchRequest_ProgressRequest)(nil), } - return interceptor(ctx, in, info, handler) -} - -var _Lease_serviceDesc = grpc.ServiceDesc{ - ServiceName: "etcdserverpb.Lease", - HandlerType: (*LeaseServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "LeaseGrant", - Handler: _Lease_LeaseGrant_Handler, - }, - { - MethodName: "LeaseRevoke", - Handler: _Lease_LeaseRevoke_Handler, - }, - { - MethodName: "LeaseTimeToLive", - Handler: _Lease_LeaseTimeToLive_Handler, - }, - { - MethodName: "LeaseLeases", - Handler: _Lease_LeaseLeases_Handler, + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_rpc_proto_rawDesc), len(file_rpc_proto_rawDesc)), + NumEnums: 8, + NumMessages: 98, + NumExtensions: 0, + NumServices: 6, }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "LeaseKeepAlive", - Handler: _Lease_LeaseKeepAlive_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "rpc.proto", -} - -// ClusterClient is the client API for Cluster service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ClusterClient interface { - // MemberAdd adds a member into the cluster. - MemberAdd(ctx context.Context, in *MemberAddRequest, opts ...grpc.CallOption) (*MemberAddResponse, error) - // MemberRemove removes an existing member from the cluster. - MemberRemove(ctx context.Context, in *MemberRemoveRequest, opts ...grpc.CallOption) (*MemberRemoveResponse, error) - // MemberUpdate updates the member configuration. - MemberUpdate(ctx context.Context, in *MemberUpdateRequest, opts ...grpc.CallOption) (*MemberUpdateResponse, error) - // MemberList lists all the members in the cluster. - MemberList(ctx context.Context, in *MemberListRequest, opts ...grpc.CallOption) (*MemberListResponse, error) - // MemberPromote promotes a member from raft learner (non-voting) to raft voting member. - MemberPromote(ctx context.Context, in *MemberPromoteRequest, opts ...grpc.CallOption) (*MemberPromoteResponse, error) -} - -type clusterClient struct { - cc *grpc.ClientConn -} - -func NewClusterClient(cc *grpc.ClientConn) ClusterClient { - return &clusterClient{cc} -} - -func (c *clusterClient) MemberAdd(ctx context.Context, in *MemberAddRequest, opts ...grpc.CallOption) (*MemberAddResponse, error) { - out := new(MemberAddResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Cluster/MemberAdd", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *clusterClient) MemberRemove(ctx context.Context, in *MemberRemoveRequest, opts ...grpc.CallOption) (*MemberRemoveResponse, error) { - out := new(MemberRemoveResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Cluster/MemberRemove", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *clusterClient) MemberUpdate(ctx context.Context, in *MemberUpdateRequest, opts ...grpc.CallOption) (*MemberUpdateResponse, error) { - out := new(MemberUpdateResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Cluster/MemberUpdate", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *clusterClient) MemberList(ctx context.Context, in *MemberListRequest, opts ...grpc.CallOption) (*MemberListResponse, error) { - out := new(MemberListResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Cluster/MemberList", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *clusterClient) MemberPromote(ctx context.Context, in *MemberPromoteRequest, opts ...grpc.CallOption) (*MemberPromoteResponse, error) { - out := new(MemberPromoteResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Cluster/MemberPromote", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ClusterServer is the server API for Cluster service. -type ClusterServer interface { - // MemberAdd adds a member into the cluster. - MemberAdd(context.Context, *MemberAddRequest) (*MemberAddResponse, error) - // MemberRemove removes an existing member from the cluster. - MemberRemove(context.Context, *MemberRemoveRequest) (*MemberRemoveResponse, error) - // MemberUpdate updates the member configuration. - MemberUpdate(context.Context, *MemberUpdateRequest) (*MemberUpdateResponse, error) - // MemberList lists all the members in the cluster. - MemberList(context.Context, *MemberListRequest) (*MemberListResponse, error) - // MemberPromote promotes a member from raft learner (non-voting) to raft voting member. - MemberPromote(context.Context, *MemberPromoteRequest) (*MemberPromoteResponse, error) -} - -// UnimplementedClusterServer can be embedded to have forward compatible implementations. -type UnimplementedClusterServer struct { -} - -func (*UnimplementedClusterServer) MemberAdd(ctx context.Context, req *MemberAddRequest) (*MemberAddResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method MemberAdd not implemented") -} -func (*UnimplementedClusterServer) MemberRemove(ctx context.Context, req *MemberRemoveRequest) (*MemberRemoveResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method MemberRemove not implemented") -} -func (*UnimplementedClusterServer) MemberUpdate(ctx context.Context, req *MemberUpdateRequest) (*MemberUpdateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method MemberUpdate not implemented") -} -func (*UnimplementedClusterServer) MemberList(ctx context.Context, req *MemberListRequest) (*MemberListResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method MemberList not implemented") -} -func (*UnimplementedClusterServer) MemberPromote(ctx context.Context, req *MemberPromoteRequest) (*MemberPromoteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method MemberPromote not implemented") -} - -func RegisterClusterServer(s *grpc.Server, srv ClusterServer) { - s.RegisterService(&_Cluster_serviceDesc, srv) -} - -func _Cluster_MemberAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MemberAddRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ClusterServer).MemberAdd(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Cluster/MemberAdd", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ClusterServer).MemberAdd(ctx, req.(*MemberAddRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Cluster_MemberRemove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MemberRemoveRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ClusterServer).MemberRemove(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Cluster/MemberRemove", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ClusterServer).MemberRemove(ctx, req.(*MemberRemoveRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Cluster_MemberUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MemberUpdateRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ClusterServer).MemberUpdate(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Cluster/MemberUpdate", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ClusterServer).MemberUpdate(ctx, req.(*MemberUpdateRequest)) - } - return interceptor(ctx, in, info, handler) + GoTypes: file_rpc_proto_goTypes, + DependencyIndexes: file_rpc_proto_depIdxs, + EnumInfos: file_rpc_proto_enumTypes, + MessageInfos: file_rpc_proto_msgTypes, + }.Build() + File_rpc_proto = out.File + file_rpc_proto_goTypes = nil + file_rpc_proto_depIdxs = nil } - -func _Cluster_MemberList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MemberListRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ClusterServer).MemberList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Cluster/MemberList", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ClusterServer).MemberList(ctx, req.(*MemberListRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Cluster_MemberPromote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MemberPromoteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ClusterServer).MemberPromote(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Cluster/MemberPromote", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ClusterServer).MemberPromote(ctx, req.(*MemberPromoteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Cluster_serviceDesc = grpc.ServiceDesc{ - ServiceName: "etcdserverpb.Cluster", - HandlerType: (*ClusterServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "MemberAdd", - Handler: _Cluster_MemberAdd_Handler, - }, - { - MethodName: "MemberRemove", - Handler: _Cluster_MemberRemove_Handler, - }, - { - MethodName: "MemberUpdate", - Handler: _Cluster_MemberUpdate_Handler, - }, - { - MethodName: "MemberList", - Handler: _Cluster_MemberList_Handler, - }, - { - MethodName: "MemberPromote", - Handler: _Cluster_MemberPromote_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "rpc.proto", -} - -// MaintenanceClient is the client API for Maintenance service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MaintenanceClient interface { - // Alarm activates, deactivates, and queries alarms regarding cluster health. - Alarm(ctx context.Context, in *AlarmRequest, opts ...grpc.CallOption) (*AlarmResponse, error) - // Status gets the status of the member. - Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) - // Defragment defragments a member's backend database to recover storage space. - Defragment(ctx context.Context, in *DefragmentRequest, opts ...grpc.CallOption) (*DefragmentResponse, error) - // Hash computes the hash of whole backend keyspace, - // including key, lease, and other buckets in storage. - // This is designed for testing ONLY! - // Do not rely on this in production with ongoing transactions, - // since Hash operation does not hold MVCC locks. - // Use "HashKV" API instead for "key" bucket consistency checks. - Hash(ctx context.Context, in *HashRequest, opts ...grpc.CallOption) (*HashResponse, error) - // HashKV computes the hash of all MVCC keys up to a given revision. - // It only iterates "key" bucket in backend storage. - HashKV(ctx context.Context, in *HashKVRequest, opts ...grpc.CallOption) (*HashKVResponse, error) - // Snapshot sends a snapshot of the entire backend from a member over a stream to a client. - Snapshot(ctx context.Context, in *SnapshotRequest, opts ...grpc.CallOption) (Maintenance_SnapshotClient, error) - // MoveLeader requests current leader node to transfer its leadership to transferee. - MoveLeader(ctx context.Context, in *MoveLeaderRequest, opts ...grpc.CallOption) (*MoveLeaderResponse, error) - // Downgrade requests downgrades, verifies feasibility or cancels downgrade - // on the cluster version. - // Supported since etcd 3.5. - Downgrade(ctx context.Context, in *DowngradeRequest, opts ...grpc.CallOption) (*DowngradeResponse, error) -} - -type maintenanceClient struct { - cc *grpc.ClientConn -} - -func NewMaintenanceClient(cc *grpc.ClientConn) MaintenanceClient { - return &maintenanceClient{cc} -} - -func (c *maintenanceClient) Alarm(ctx context.Context, in *AlarmRequest, opts ...grpc.CallOption) (*AlarmResponse, error) { - out := new(AlarmResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Maintenance/Alarm", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *maintenanceClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) { - out := new(StatusResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Maintenance/Status", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *maintenanceClient) Defragment(ctx context.Context, in *DefragmentRequest, opts ...grpc.CallOption) (*DefragmentResponse, error) { - out := new(DefragmentResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Maintenance/Defragment", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *maintenanceClient) Hash(ctx context.Context, in *HashRequest, opts ...grpc.CallOption) (*HashResponse, error) { - out := new(HashResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Maintenance/Hash", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *maintenanceClient) HashKV(ctx context.Context, in *HashKVRequest, opts ...grpc.CallOption) (*HashKVResponse, error) { - out := new(HashKVResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Maintenance/HashKV", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *maintenanceClient) Snapshot(ctx context.Context, in *SnapshotRequest, opts ...grpc.CallOption) (Maintenance_SnapshotClient, error) { - stream, err := c.cc.NewStream(ctx, &_Maintenance_serviceDesc.Streams[0], "/etcdserverpb.Maintenance/Snapshot", opts...) - if err != nil { - return nil, err - } - x := &maintenanceSnapshotClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Maintenance_SnapshotClient interface { - Recv() (*SnapshotResponse, error) - grpc.ClientStream -} - -type maintenanceSnapshotClient struct { - grpc.ClientStream -} - -func (x *maintenanceSnapshotClient) Recv() (*SnapshotResponse, error) { - m := new(SnapshotResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *maintenanceClient) MoveLeader(ctx context.Context, in *MoveLeaderRequest, opts ...grpc.CallOption) (*MoveLeaderResponse, error) { - out := new(MoveLeaderResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Maintenance/MoveLeader", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *maintenanceClient) Downgrade(ctx context.Context, in *DowngradeRequest, opts ...grpc.CallOption) (*DowngradeResponse, error) { - out := new(DowngradeResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Maintenance/Downgrade", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MaintenanceServer is the server API for Maintenance service. -type MaintenanceServer interface { - // Alarm activates, deactivates, and queries alarms regarding cluster health. - Alarm(context.Context, *AlarmRequest) (*AlarmResponse, error) - // Status gets the status of the member. - Status(context.Context, *StatusRequest) (*StatusResponse, error) - // Defragment defragments a member's backend database to recover storage space. - Defragment(context.Context, *DefragmentRequest) (*DefragmentResponse, error) - // Hash computes the hash of whole backend keyspace, - // including key, lease, and other buckets in storage. - // This is designed for testing ONLY! - // Do not rely on this in production with ongoing transactions, - // since Hash operation does not hold MVCC locks. - // Use "HashKV" API instead for "key" bucket consistency checks. - Hash(context.Context, *HashRequest) (*HashResponse, error) - // HashKV computes the hash of all MVCC keys up to a given revision. - // It only iterates "key" bucket in backend storage. - HashKV(context.Context, *HashKVRequest) (*HashKVResponse, error) - // Snapshot sends a snapshot of the entire backend from a member over a stream to a client. - Snapshot(*SnapshotRequest, Maintenance_SnapshotServer) error - // MoveLeader requests current leader node to transfer its leadership to transferee. - MoveLeader(context.Context, *MoveLeaderRequest) (*MoveLeaderResponse, error) - // Downgrade requests downgrades, verifies feasibility or cancels downgrade - // on the cluster version. - // Supported since etcd 3.5. - Downgrade(context.Context, *DowngradeRequest) (*DowngradeResponse, error) -} - -// UnimplementedMaintenanceServer can be embedded to have forward compatible implementations. -type UnimplementedMaintenanceServer struct { -} - -func (*UnimplementedMaintenanceServer) Alarm(ctx context.Context, req *AlarmRequest) (*AlarmResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Alarm not implemented") -} -func (*UnimplementedMaintenanceServer) Status(ctx context.Context, req *StatusRequest) (*StatusResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") -} -func (*UnimplementedMaintenanceServer) Defragment(ctx context.Context, req *DefragmentRequest) (*DefragmentResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Defragment not implemented") -} -func (*UnimplementedMaintenanceServer) Hash(ctx context.Context, req *HashRequest) (*HashResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Hash not implemented") -} -func (*UnimplementedMaintenanceServer) HashKV(ctx context.Context, req *HashKVRequest) (*HashKVResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method HashKV not implemented") -} -func (*UnimplementedMaintenanceServer) Snapshot(req *SnapshotRequest, srv Maintenance_SnapshotServer) error { - return status.Errorf(codes.Unimplemented, "method Snapshot not implemented") -} -func (*UnimplementedMaintenanceServer) MoveLeader(ctx context.Context, req *MoveLeaderRequest) (*MoveLeaderResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method MoveLeader not implemented") -} -func (*UnimplementedMaintenanceServer) Downgrade(ctx context.Context, req *DowngradeRequest) (*DowngradeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Downgrade not implemented") -} - -func RegisterMaintenanceServer(s *grpc.Server, srv MaintenanceServer) { - s.RegisterService(&_Maintenance_serviceDesc, srv) -} - -func _Maintenance_Alarm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AlarmRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MaintenanceServer).Alarm(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Maintenance/Alarm", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MaintenanceServer).Alarm(ctx, req.(*AlarmRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Maintenance_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StatusRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MaintenanceServer).Status(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Maintenance/Status", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MaintenanceServer).Status(ctx, req.(*StatusRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Maintenance_Defragment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DefragmentRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MaintenanceServer).Defragment(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Maintenance/Defragment", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MaintenanceServer).Defragment(ctx, req.(*DefragmentRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Maintenance_Hash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(HashRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MaintenanceServer).Hash(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Maintenance/Hash", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MaintenanceServer).Hash(ctx, req.(*HashRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Maintenance_HashKV_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(HashKVRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MaintenanceServer).HashKV(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Maintenance/HashKV", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MaintenanceServer).HashKV(ctx, req.(*HashKVRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Maintenance_Snapshot_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(SnapshotRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(MaintenanceServer).Snapshot(m, &maintenanceSnapshotServer{stream}) -} - -type Maintenance_SnapshotServer interface { - Send(*SnapshotResponse) error - grpc.ServerStream -} - -type maintenanceSnapshotServer struct { - grpc.ServerStream -} - -func (x *maintenanceSnapshotServer) Send(m *SnapshotResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _Maintenance_MoveLeader_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MoveLeaderRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MaintenanceServer).MoveLeader(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Maintenance/MoveLeader", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MaintenanceServer).MoveLeader(ctx, req.(*MoveLeaderRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Maintenance_Downgrade_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DowngradeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MaintenanceServer).Downgrade(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Maintenance/Downgrade", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MaintenanceServer).Downgrade(ctx, req.(*DowngradeRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Maintenance_serviceDesc = grpc.ServiceDesc{ - ServiceName: "etcdserverpb.Maintenance", - HandlerType: (*MaintenanceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Alarm", - Handler: _Maintenance_Alarm_Handler, - }, - { - MethodName: "Status", - Handler: _Maintenance_Status_Handler, - }, - { - MethodName: "Defragment", - Handler: _Maintenance_Defragment_Handler, - }, - { - MethodName: "Hash", - Handler: _Maintenance_Hash_Handler, - }, - { - MethodName: "HashKV", - Handler: _Maintenance_HashKV_Handler, - }, - { - MethodName: "MoveLeader", - Handler: _Maintenance_MoveLeader_Handler, - }, - { - MethodName: "Downgrade", - Handler: _Maintenance_Downgrade_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Snapshot", - Handler: _Maintenance_Snapshot_Handler, - ServerStreams: true, - }, - }, - Metadata: "rpc.proto", -} - -// AuthClient is the client API for Auth service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type AuthClient interface { - // AuthEnable enables authentication. - AuthEnable(ctx context.Context, in *AuthEnableRequest, opts ...grpc.CallOption) (*AuthEnableResponse, error) - // AuthDisable disables authentication. - AuthDisable(ctx context.Context, in *AuthDisableRequest, opts ...grpc.CallOption) (*AuthDisableResponse, error) - // AuthStatus displays authentication status. - AuthStatus(ctx context.Context, in *AuthStatusRequest, opts ...grpc.CallOption) (*AuthStatusResponse, error) - // Authenticate processes an authenticate request. - Authenticate(ctx context.Context, in *AuthenticateRequest, opts ...grpc.CallOption) (*AuthenticateResponse, error) - // UserAdd adds a new user. User name cannot be empty. - UserAdd(ctx context.Context, in *AuthUserAddRequest, opts ...grpc.CallOption) (*AuthUserAddResponse, error) - // UserGet gets detailed user information. - UserGet(ctx context.Context, in *AuthUserGetRequest, opts ...grpc.CallOption) (*AuthUserGetResponse, error) - // UserList gets a list of all users. - UserList(ctx context.Context, in *AuthUserListRequest, opts ...grpc.CallOption) (*AuthUserListResponse, error) - // UserDelete deletes a specified user. - UserDelete(ctx context.Context, in *AuthUserDeleteRequest, opts ...grpc.CallOption) (*AuthUserDeleteResponse, error) - // UserChangePassword changes the password of a specified user. - UserChangePassword(ctx context.Context, in *AuthUserChangePasswordRequest, opts ...grpc.CallOption) (*AuthUserChangePasswordResponse, error) - // UserGrant grants a role to a specified user. - UserGrantRole(ctx context.Context, in *AuthUserGrantRoleRequest, opts ...grpc.CallOption) (*AuthUserGrantRoleResponse, error) - // UserRevokeRole revokes a role of specified user. - UserRevokeRole(ctx context.Context, in *AuthUserRevokeRoleRequest, opts ...grpc.CallOption) (*AuthUserRevokeRoleResponse, error) - // RoleAdd adds a new role. Role name cannot be empty. - RoleAdd(ctx context.Context, in *AuthRoleAddRequest, opts ...grpc.CallOption) (*AuthRoleAddResponse, error) - // RoleGet gets detailed role information. - RoleGet(ctx context.Context, in *AuthRoleGetRequest, opts ...grpc.CallOption) (*AuthRoleGetResponse, error) - // RoleList gets lists of all roles. - RoleList(ctx context.Context, in *AuthRoleListRequest, opts ...grpc.CallOption) (*AuthRoleListResponse, error) - // RoleDelete deletes a specified role. - RoleDelete(ctx context.Context, in *AuthRoleDeleteRequest, opts ...grpc.CallOption) (*AuthRoleDeleteResponse, error) - // RoleGrantPermission grants a permission of a specified key or range to a specified role. - RoleGrantPermission(ctx context.Context, in *AuthRoleGrantPermissionRequest, opts ...grpc.CallOption) (*AuthRoleGrantPermissionResponse, error) - // RoleRevokePermission revokes a key or range permission of a specified role. - RoleRevokePermission(ctx context.Context, in *AuthRoleRevokePermissionRequest, opts ...grpc.CallOption) (*AuthRoleRevokePermissionResponse, error) -} - -type authClient struct { - cc *grpc.ClientConn -} - -func NewAuthClient(cc *grpc.ClientConn) AuthClient { - return &authClient{cc} -} - -func (c *authClient) AuthEnable(ctx context.Context, in *AuthEnableRequest, opts ...grpc.CallOption) (*AuthEnableResponse, error) { - out := new(AuthEnableResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/AuthEnable", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *authClient) AuthDisable(ctx context.Context, in *AuthDisableRequest, opts ...grpc.CallOption) (*AuthDisableResponse, error) { - out := new(AuthDisableResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/AuthDisable", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *authClient) AuthStatus(ctx context.Context, in *AuthStatusRequest, opts ...grpc.CallOption) (*AuthStatusResponse, error) { - out := new(AuthStatusResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/AuthStatus", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *authClient) Authenticate(ctx context.Context, in *AuthenticateRequest, opts ...grpc.CallOption) (*AuthenticateResponse, error) { - out := new(AuthenticateResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/Authenticate", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *authClient) UserAdd(ctx context.Context, in *AuthUserAddRequest, opts ...grpc.CallOption) (*AuthUserAddResponse, error) { - out := new(AuthUserAddResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/UserAdd", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *authClient) UserGet(ctx context.Context, in *AuthUserGetRequest, opts ...grpc.CallOption) (*AuthUserGetResponse, error) { - out := new(AuthUserGetResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/UserGet", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *authClient) UserList(ctx context.Context, in *AuthUserListRequest, opts ...grpc.CallOption) (*AuthUserListResponse, error) { - out := new(AuthUserListResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/UserList", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *authClient) UserDelete(ctx context.Context, in *AuthUserDeleteRequest, opts ...grpc.CallOption) (*AuthUserDeleteResponse, error) { - out := new(AuthUserDeleteResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/UserDelete", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *authClient) UserChangePassword(ctx context.Context, in *AuthUserChangePasswordRequest, opts ...grpc.CallOption) (*AuthUserChangePasswordResponse, error) { - out := new(AuthUserChangePasswordResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/UserChangePassword", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *authClient) UserGrantRole(ctx context.Context, in *AuthUserGrantRoleRequest, opts ...grpc.CallOption) (*AuthUserGrantRoleResponse, error) { - out := new(AuthUserGrantRoleResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/UserGrantRole", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *authClient) UserRevokeRole(ctx context.Context, in *AuthUserRevokeRoleRequest, opts ...grpc.CallOption) (*AuthUserRevokeRoleResponse, error) { - out := new(AuthUserRevokeRoleResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/UserRevokeRole", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *authClient) RoleAdd(ctx context.Context, in *AuthRoleAddRequest, opts ...grpc.CallOption) (*AuthRoleAddResponse, error) { - out := new(AuthRoleAddResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/RoleAdd", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *authClient) RoleGet(ctx context.Context, in *AuthRoleGetRequest, opts ...grpc.CallOption) (*AuthRoleGetResponse, error) { - out := new(AuthRoleGetResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/RoleGet", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *authClient) RoleList(ctx context.Context, in *AuthRoleListRequest, opts ...grpc.CallOption) (*AuthRoleListResponse, error) { - out := new(AuthRoleListResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/RoleList", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *authClient) RoleDelete(ctx context.Context, in *AuthRoleDeleteRequest, opts ...grpc.CallOption) (*AuthRoleDeleteResponse, error) { - out := new(AuthRoleDeleteResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/RoleDelete", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *authClient) RoleGrantPermission(ctx context.Context, in *AuthRoleGrantPermissionRequest, opts ...grpc.CallOption) (*AuthRoleGrantPermissionResponse, error) { - out := new(AuthRoleGrantPermissionResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/RoleGrantPermission", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *authClient) RoleRevokePermission(ctx context.Context, in *AuthRoleRevokePermissionRequest, opts ...grpc.CallOption) (*AuthRoleRevokePermissionResponse, error) { - out := new(AuthRoleRevokePermissionResponse) - err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/RoleRevokePermission", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// AuthServer is the server API for Auth service. -type AuthServer interface { - // AuthEnable enables authentication. - AuthEnable(context.Context, *AuthEnableRequest) (*AuthEnableResponse, error) - // AuthDisable disables authentication. - AuthDisable(context.Context, *AuthDisableRequest) (*AuthDisableResponse, error) - // AuthStatus displays authentication status. - AuthStatus(context.Context, *AuthStatusRequest) (*AuthStatusResponse, error) - // Authenticate processes an authenticate request. - Authenticate(context.Context, *AuthenticateRequest) (*AuthenticateResponse, error) - // UserAdd adds a new user. User name cannot be empty. - UserAdd(context.Context, *AuthUserAddRequest) (*AuthUserAddResponse, error) - // UserGet gets detailed user information. - UserGet(context.Context, *AuthUserGetRequest) (*AuthUserGetResponse, error) - // UserList gets a list of all users. - UserList(context.Context, *AuthUserListRequest) (*AuthUserListResponse, error) - // UserDelete deletes a specified user. - UserDelete(context.Context, *AuthUserDeleteRequest) (*AuthUserDeleteResponse, error) - // UserChangePassword changes the password of a specified user. - UserChangePassword(context.Context, *AuthUserChangePasswordRequest) (*AuthUserChangePasswordResponse, error) - // UserGrant grants a role to a specified user. - UserGrantRole(context.Context, *AuthUserGrantRoleRequest) (*AuthUserGrantRoleResponse, error) - // UserRevokeRole revokes a role of specified user. - UserRevokeRole(context.Context, *AuthUserRevokeRoleRequest) (*AuthUserRevokeRoleResponse, error) - // RoleAdd adds a new role. Role name cannot be empty. - RoleAdd(context.Context, *AuthRoleAddRequest) (*AuthRoleAddResponse, error) - // RoleGet gets detailed role information. - RoleGet(context.Context, *AuthRoleGetRequest) (*AuthRoleGetResponse, error) - // RoleList gets lists of all roles. - RoleList(context.Context, *AuthRoleListRequest) (*AuthRoleListResponse, error) - // RoleDelete deletes a specified role. - RoleDelete(context.Context, *AuthRoleDeleteRequest) (*AuthRoleDeleteResponse, error) - // RoleGrantPermission grants a permission of a specified key or range to a specified role. - RoleGrantPermission(context.Context, *AuthRoleGrantPermissionRequest) (*AuthRoleGrantPermissionResponse, error) - // RoleRevokePermission revokes a key or range permission of a specified role. - RoleRevokePermission(context.Context, *AuthRoleRevokePermissionRequest) (*AuthRoleRevokePermissionResponse, error) -} - -// UnimplementedAuthServer can be embedded to have forward compatible implementations. -type UnimplementedAuthServer struct { -} - -func (*UnimplementedAuthServer) AuthEnable(ctx context.Context, req *AuthEnableRequest) (*AuthEnableResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AuthEnable not implemented") -} -func (*UnimplementedAuthServer) AuthDisable(ctx context.Context, req *AuthDisableRequest) (*AuthDisableResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AuthDisable not implemented") -} -func (*UnimplementedAuthServer) AuthStatus(ctx context.Context, req *AuthStatusRequest) (*AuthStatusResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AuthStatus not implemented") -} -func (*UnimplementedAuthServer) Authenticate(ctx context.Context, req *AuthenticateRequest) (*AuthenticateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Authenticate not implemented") -} -func (*UnimplementedAuthServer) UserAdd(ctx context.Context, req *AuthUserAddRequest) (*AuthUserAddResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UserAdd not implemented") -} -func (*UnimplementedAuthServer) UserGet(ctx context.Context, req *AuthUserGetRequest) (*AuthUserGetResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UserGet not implemented") -} -func (*UnimplementedAuthServer) UserList(ctx context.Context, req *AuthUserListRequest) (*AuthUserListResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UserList not implemented") -} -func (*UnimplementedAuthServer) UserDelete(ctx context.Context, req *AuthUserDeleteRequest) (*AuthUserDeleteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UserDelete not implemented") -} -func (*UnimplementedAuthServer) UserChangePassword(ctx context.Context, req *AuthUserChangePasswordRequest) (*AuthUserChangePasswordResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UserChangePassword not implemented") -} -func (*UnimplementedAuthServer) UserGrantRole(ctx context.Context, req *AuthUserGrantRoleRequest) (*AuthUserGrantRoleResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UserGrantRole not implemented") -} -func (*UnimplementedAuthServer) UserRevokeRole(ctx context.Context, req *AuthUserRevokeRoleRequest) (*AuthUserRevokeRoleResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UserRevokeRole not implemented") -} -func (*UnimplementedAuthServer) RoleAdd(ctx context.Context, req *AuthRoleAddRequest) (*AuthRoleAddResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RoleAdd not implemented") -} -func (*UnimplementedAuthServer) RoleGet(ctx context.Context, req *AuthRoleGetRequest) (*AuthRoleGetResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RoleGet not implemented") -} -func (*UnimplementedAuthServer) RoleList(ctx context.Context, req *AuthRoleListRequest) (*AuthRoleListResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RoleList not implemented") -} -func (*UnimplementedAuthServer) RoleDelete(ctx context.Context, req *AuthRoleDeleteRequest) (*AuthRoleDeleteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RoleDelete not implemented") -} -func (*UnimplementedAuthServer) RoleGrantPermission(ctx context.Context, req *AuthRoleGrantPermissionRequest) (*AuthRoleGrantPermissionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RoleGrantPermission not implemented") -} -func (*UnimplementedAuthServer) RoleRevokePermission(ctx context.Context, req *AuthRoleRevokePermissionRequest) (*AuthRoleRevokePermissionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RoleRevokePermission not implemented") -} - -func RegisterAuthServer(s *grpc.Server, srv AuthServer) { - s.RegisterService(&_Auth_serviceDesc, srv) -} - -func _Auth_AuthEnable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthEnableRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServer).AuthEnable(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Auth/AuthEnable", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).AuthEnable(ctx, req.(*AuthEnableRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Auth_AuthDisable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthDisableRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServer).AuthDisable(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Auth/AuthDisable", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).AuthDisable(ctx, req.(*AuthDisableRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Auth_AuthStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthStatusRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServer).AuthStatus(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Auth/AuthStatus", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).AuthStatus(ctx, req.(*AuthStatusRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Auth_Authenticate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthenticateRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServer).Authenticate(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Auth/Authenticate", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).Authenticate(ctx, req.(*AuthenticateRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Auth_UserAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthUserAddRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServer).UserAdd(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Auth/UserAdd", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).UserAdd(ctx, req.(*AuthUserAddRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Auth_UserGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthUserGetRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServer).UserGet(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Auth/UserGet", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).UserGet(ctx, req.(*AuthUserGetRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Auth_UserList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthUserListRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServer).UserList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Auth/UserList", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).UserList(ctx, req.(*AuthUserListRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Auth_UserDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthUserDeleteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServer).UserDelete(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Auth/UserDelete", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).UserDelete(ctx, req.(*AuthUserDeleteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Auth_UserChangePassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthUserChangePasswordRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServer).UserChangePassword(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Auth/UserChangePassword", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).UserChangePassword(ctx, req.(*AuthUserChangePasswordRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Auth_UserGrantRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthUserGrantRoleRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServer).UserGrantRole(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Auth/UserGrantRole", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).UserGrantRole(ctx, req.(*AuthUserGrantRoleRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Auth_UserRevokeRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthUserRevokeRoleRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServer).UserRevokeRole(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Auth/UserRevokeRole", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).UserRevokeRole(ctx, req.(*AuthUserRevokeRoleRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Auth_RoleAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthRoleAddRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServer).RoleAdd(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Auth/RoleAdd", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).RoleAdd(ctx, req.(*AuthRoleAddRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Auth_RoleGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthRoleGetRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServer).RoleGet(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Auth/RoleGet", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).RoleGet(ctx, req.(*AuthRoleGetRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Auth_RoleList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthRoleListRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServer).RoleList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Auth/RoleList", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).RoleList(ctx, req.(*AuthRoleListRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Auth_RoleDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthRoleDeleteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServer).RoleDelete(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Auth/RoleDelete", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).RoleDelete(ctx, req.(*AuthRoleDeleteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Auth_RoleGrantPermission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthRoleGrantPermissionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServer).RoleGrantPermission(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Auth/RoleGrantPermission", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).RoleGrantPermission(ctx, req.(*AuthRoleGrantPermissionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Auth_RoleRevokePermission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthRoleRevokePermissionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServer).RoleRevokePermission(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/etcdserverpb.Auth/RoleRevokePermission", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).RoleRevokePermission(ctx, req.(*AuthRoleRevokePermissionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Auth_serviceDesc = grpc.ServiceDesc{ - ServiceName: "etcdserverpb.Auth", - HandlerType: (*AuthServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "AuthEnable", - Handler: _Auth_AuthEnable_Handler, - }, - { - MethodName: "AuthDisable", - Handler: _Auth_AuthDisable_Handler, - }, - { - MethodName: "AuthStatus", - Handler: _Auth_AuthStatus_Handler, - }, - { - MethodName: "Authenticate", - Handler: _Auth_Authenticate_Handler, - }, - { - MethodName: "UserAdd", - Handler: _Auth_UserAdd_Handler, - }, - { - MethodName: "UserGet", - Handler: _Auth_UserGet_Handler, - }, - { - MethodName: "UserList", - Handler: _Auth_UserList_Handler, - }, - { - MethodName: "UserDelete", - Handler: _Auth_UserDelete_Handler, - }, - { - MethodName: "UserChangePassword", - Handler: _Auth_UserChangePassword_Handler, - }, - { - MethodName: "UserGrantRole", - Handler: _Auth_UserGrantRole_Handler, - }, - { - MethodName: "UserRevokeRole", - Handler: _Auth_UserRevokeRole_Handler, - }, - { - MethodName: "RoleAdd", - Handler: _Auth_RoleAdd_Handler, - }, - { - MethodName: "RoleGet", - Handler: _Auth_RoleGet_Handler, - }, - { - MethodName: "RoleList", - Handler: _Auth_RoleList_Handler, - }, - { - MethodName: "RoleDelete", - Handler: _Auth_RoleDelete_Handler, - }, - { - MethodName: "RoleGrantPermission", - Handler: _Auth_RoleGrantPermission_Handler, - }, - { - MethodName: "RoleRevokePermission", - Handler: _Auth_RoleRevokePermission_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "rpc.proto", -} - -func (m *ResponseHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ResponseHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ResponseHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.RaftTerm != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.RaftTerm)) - i-- - dAtA[i] = 0x20 - } - if m.Revision != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Revision)) - i-- - dAtA[i] = 0x18 - } - if m.MemberId != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.MemberId)) - i-- - dAtA[i] = 0x10 - } - if m.ClusterId != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.ClusterId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *RangeRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RangeRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RangeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.MaxCreateRevision != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.MaxCreateRevision)) - i-- - dAtA[i] = 0x68 - } - if m.MinCreateRevision != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.MinCreateRevision)) - i-- - dAtA[i] = 0x60 - } - if m.MaxModRevision != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.MaxModRevision)) - i-- - dAtA[i] = 0x58 - } - if m.MinModRevision != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.MinModRevision)) - i-- - dAtA[i] = 0x50 - } - if m.CountOnly { - i-- - if m.CountOnly { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x48 - } - if m.KeysOnly { - i-- - if m.KeysOnly { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - if m.Serializable { - i-- - if m.Serializable { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if m.SortTarget != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.SortTarget)) - i-- - dAtA[i] = 0x30 - } - if m.SortOrder != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.SortOrder)) - i-- - dAtA[i] = 0x28 - } - if m.Revision != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Revision)) - i-- - dAtA[i] = 0x20 - } - if m.Limit != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Limit)) - i-- - dAtA[i] = 0x18 - } - if len(m.RangeEnd) > 0 { - i -= len(m.RangeEnd) - copy(dAtA[i:], m.RangeEnd) - i = encodeVarintRpc(dAtA, i, uint64(len(m.RangeEnd))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *RangeResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RangeResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RangeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Count != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Count)) - i-- - dAtA[i] = 0x20 - } - if m.More { - i-- - if m.More { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(m.Kvs) > 0 { - for iNdEx := len(m.Kvs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Kvs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PutRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.IgnoreLease { - i-- - if m.IgnoreLease { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x30 - } - if m.IgnoreValue { - i-- - if m.IgnoreValue { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if m.PrevKv { - i-- - if m.PrevKv { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.Lease != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Lease)) - i-- - dAtA[i] = 0x18 - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PutResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.PrevKv != nil { - { - size, err := m.PrevKv.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DeleteRangeRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteRangeRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DeleteRangeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.PrevKv { - i-- - if m.PrevKv { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(m.RangeEnd) > 0 { - i -= len(m.RangeEnd) - copy(dAtA[i:], m.RangeEnd) - i = encodeVarintRpc(dAtA, i, uint64(len(m.RangeEnd))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DeleteRangeResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteRangeResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DeleteRangeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.PrevKvs) > 0 { - for iNdEx := len(m.PrevKvs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PrevKvs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if m.Deleted != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Deleted)) - i-- - dAtA[i] = 0x10 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *RequestOp) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RequestOp) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RequestOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Request != nil { - { - size := m.Request.Size() - i -= size - if _, err := m.Request.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *RequestOp_RequestRange) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RequestOp_RequestRange) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.RequestRange != nil { - { - size, err := m.RequestRange.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *RequestOp_RequestPut) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RequestOp_RequestPut) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.RequestPut != nil { - { - size, err := m.RequestPut.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *RequestOp_RequestDeleteRange) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RequestOp_RequestDeleteRange) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.RequestDeleteRange != nil { - { - size, err := m.RequestDeleteRange.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *RequestOp_RequestTxn) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RequestOp_RequestTxn) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.RequestTxn != nil { - { - size, err := m.RequestTxn.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - return len(dAtA) - i, nil -} -func (m *ResponseOp) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ResponseOp) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ResponseOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Response != nil { - { - size := m.Response.Size() - i -= size - if _, err := m.Response.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *ResponseOp_ResponseRange) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ResponseOp_ResponseRange) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ResponseRange != nil { - { - size, err := m.ResponseRange.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *ResponseOp_ResponsePut) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ResponseOp_ResponsePut) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ResponsePut != nil { - { - size, err := m.ResponsePut.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *ResponseOp_ResponseDeleteRange) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ResponseOp_ResponseDeleteRange) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ResponseDeleteRange != nil { - { - size, err := m.ResponseDeleteRange.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *ResponseOp_ResponseTxn) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ResponseOp_ResponseTxn) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ResponseTxn != nil { - { - size, err := m.ResponseTxn.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - return len(dAtA) - i, nil -} -func (m *Compare) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Compare) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Compare) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.RangeEnd) > 0 { - i -= len(m.RangeEnd) - copy(dAtA[i:], m.RangeEnd) - i = encodeVarintRpc(dAtA, i, uint64(len(m.RangeEnd))) - i-- - dAtA[i] = 0x4 - i-- - dAtA[i] = 0x82 - } - if m.TargetUnion != nil { - { - size := m.TargetUnion.Size() - i -= size - if _, err := m.TargetUnion.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0x1a - } - if m.Target != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Target)) - i-- - dAtA[i] = 0x10 - } - if m.Result != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Result)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Compare_Version) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Compare_Version) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - i = encodeVarintRpc(dAtA, i, uint64(m.Version)) - i-- - dAtA[i] = 0x20 - return len(dAtA) - i, nil -} -func (m *Compare_CreateRevision) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Compare_CreateRevision) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - i = encodeVarintRpc(dAtA, i, uint64(m.CreateRevision)) - i-- - dAtA[i] = 0x28 - return len(dAtA) - i, nil -} -func (m *Compare_ModRevision) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Compare_ModRevision) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - i = encodeVarintRpc(dAtA, i, uint64(m.ModRevision)) - i-- - dAtA[i] = 0x30 - return len(dAtA) - i, nil -} -func (m *Compare_Value) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Compare_Value) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Value != nil { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x3a - } - return len(dAtA) - i, nil -} -func (m *Compare_Lease) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Compare_Lease) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - i = encodeVarintRpc(dAtA, i, uint64(m.Lease)) - i-- - dAtA[i] = 0x40 - return len(dAtA) - i, nil -} -func (m *TxnRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TxnRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TxnRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Failure) > 0 { - for iNdEx := len(m.Failure) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Failure[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Success) > 0 { - for iNdEx := len(m.Success) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Success[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Compare) > 0 { - for iNdEx := len(m.Compare) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Compare[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *TxnResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TxnResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TxnResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Responses) > 0 { - for iNdEx := len(m.Responses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Responses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if m.Succeeded { - i-- - if m.Succeeded { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CompactionRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CompactionRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CompactionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Physical { - i-- - if m.Physical { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.Revision != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Revision)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *CompactionResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CompactionResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CompactionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *HashRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HashRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func (m *HashKVRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HashKVRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HashKVRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Revision != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Revision)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *HashKVResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HashKVResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HashKVResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.HashRevision != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.HashRevision)) - i-- - dAtA[i] = 0x20 - } - if m.CompactRevision != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.CompactRevision)) - i-- - dAtA[i] = 0x18 - } - if m.Hash != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Hash)) - i-- - dAtA[i] = 0x10 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *HashResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HashResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Hash != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Hash)) - i-- - dAtA[i] = 0x10 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SnapshotRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SnapshotRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SnapshotRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func (m *SnapshotResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SnapshotResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SnapshotResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Version) > 0 { - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Version))) - i-- - dAtA[i] = 0x22 - } - if len(m.Blob) > 0 { - i -= len(m.Blob) - copy(dAtA[i:], m.Blob) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Blob))) - i-- - dAtA[i] = 0x1a - } - if m.RemainingBytes != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.RemainingBytes)) - i-- - dAtA[i] = 0x10 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *WatchRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WatchRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WatchRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.RequestUnion != nil { - { - size := m.RequestUnion.Size() - i -= size - if _, err := m.RequestUnion.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *WatchRequest_CreateRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WatchRequest_CreateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.CreateRequest != nil { - { - size, err := m.CreateRequest.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *WatchRequest_CancelRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WatchRequest_CancelRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.CancelRequest != nil { - { - size, err := m.CancelRequest.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *WatchRequest_ProgressRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WatchRequest_ProgressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ProgressRequest != nil { - { - size, err := m.ProgressRequest.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *WatchCreateRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WatchCreateRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WatchCreateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Fragment { - i-- - if m.Fragment { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - if m.WatchId != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.WatchId)) - i-- - dAtA[i] = 0x38 - } - if m.PrevKv { - i-- - if m.PrevKv { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x30 - } - if len(m.Filters) > 0 { - dAtA22 := make([]byte, len(m.Filters)*10) - var j21 int - for _, num := range m.Filters { - for num >= 1<<7 { - dAtA22[j21] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j21++ - } - dAtA22[j21] = uint8(num) - j21++ - } - i -= j21 - copy(dAtA[i:], dAtA22[:j21]) - i = encodeVarintRpc(dAtA, i, uint64(j21)) - i-- - dAtA[i] = 0x2a - } - if m.ProgressNotify { - i-- - if m.ProgressNotify { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.StartRevision != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.StartRevision)) - i-- - dAtA[i] = 0x18 - } - if len(m.RangeEnd) > 0 { - i -= len(m.RangeEnd) - copy(dAtA[i:], m.RangeEnd) - i = encodeVarintRpc(dAtA, i, uint64(len(m.RangeEnd))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *WatchCancelRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WatchCancelRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WatchCancelRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.WatchId != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.WatchId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *WatchProgressRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WatchProgressRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WatchProgressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func (m *WatchResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WatchResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WatchResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Events) > 0 { - for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x5a - } - } - if m.Fragment { - i-- - if m.Fragment { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if len(m.CancelReason) > 0 { - i -= len(m.CancelReason) - copy(dAtA[i:], m.CancelReason) - i = encodeVarintRpc(dAtA, i, uint64(len(m.CancelReason))) - i-- - dAtA[i] = 0x32 - } - if m.CompactRevision != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.CompactRevision)) - i-- - dAtA[i] = 0x28 - } - if m.Canceled { - i-- - if m.Canceled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.Created { - i-- - if m.Created { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.WatchId != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.WatchId)) - i-- - dAtA[i] = 0x10 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *LeaseGrantRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LeaseGrantRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LeaseGrantRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.ID != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x10 - } - if m.TTL != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *LeaseGrantResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LeaseGrantResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LeaseGrantResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Error) > 0 { - i -= len(m.Error) - copy(dAtA[i:], m.Error) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Error))) - i-- - dAtA[i] = 0x22 - } - if m.TTL != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x18 - } - if m.ID != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x10 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *LeaseRevokeRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LeaseRevokeRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LeaseRevokeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.ID != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *LeaseRevokeResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LeaseRevokeResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LeaseRevokeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *LeaseCheckpoint) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LeaseCheckpoint) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LeaseCheckpoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Remaining_TTL != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Remaining_TTL)) - i-- - dAtA[i] = 0x10 - } - if m.ID != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *LeaseCheckpointRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LeaseCheckpointRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LeaseCheckpointRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Checkpoints) > 0 { - for iNdEx := len(m.Checkpoints) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Checkpoints[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *LeaseCheckpointResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LeaseCheckpointResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LeaseCheckpointResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *LeaseKeepAliveRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LeaseKeepAliveRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LeaseKeepAliveRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.ID != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *LeaseKeepAliveResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LeaseKeepAliveResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LeaseKeepAliveResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.TTL != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x18 - } - if m.ID != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x10 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *LeaseTimeToLiveRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LeaseTimeToLiveRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LeaseTimeToLiveRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Keys { - i-- - if m.Keys { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.ID != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *LeaseTimeToLiveResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LeaseTimeToLiveResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LeaseTimeToLiveResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Keys) > 0 { - for iNdEx := len(m.Keys) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Keys[iNdEx]) - copy(dAtA[i:], m.Keys[iNdEx]) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Keys[iNdEx]))) - i-- - dAtA[i] = 0x2a - } - } - if m.GrantedTTL != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.GrantedTTL)) - i-- - dAtA[i] = 0x20 - } - if m.TTL != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x18 - } - if m.ID != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x10 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *LeaseLeasesRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LeaseLeasesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LeaseLeasesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func (m *LeaseStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LeaseStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LeaseStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.ID != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *LeaseLeasesResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LeaseLeasesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LeaseLeasesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Leases) > 0 { - for iNdEx := len(m.Leases) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Leases[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Member) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Member) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Member) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.IsLearner { - i-- - if m.IsLearner { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if len(m.ClientURLs) > 0 { - for iNdEx := len(m.ClientURLs) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ClientURLs[iNdEx]) - copy(dAtA[i:], m.ClientURLs[iNdEx]) - i = encodeVarintRpc(dAtA, i, uint64(len(m.ClientURLs[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - if len(m.PeerURLs) > 0 { - for iNdEx := len(m.PeerURLs) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.PeerURLs[iNdEx]) - copy(dAtA[i:], m.PeerURLs[iNdEx]) - i = encodeVarintRpc(dAtA, i, uint64(len(m.PeerURLs[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if m.ID != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MemberAddRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MemberAddRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MemberAddRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.IsLearner { - i-- - if m.IsLearner { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if len(m.PeerURLs) > 0 { - for iNdEx := len(m.PeerURLs) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.PeerURLs[iNdEx]) - copy(dAtA[i:], m.PeerURLs[iNdEx]) - i = encodeVarintRpc(dAtA, i, uint64(len(m.PeerURLs[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *MemberAddResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MemberAddResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MemberAddResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Members) > 0 { - for iNdEx := len(m.Members) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Members[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if m.Member != nil { - { - size, err := m.Member.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MemberRemoveRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MemberRemoveRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MemberRemoveRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.ID != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MemberRemoveResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MemberRemoveResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MemberRemoveResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Members) > 0 { - for iNdEx := len(m.Members) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Members[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MemberUpdateRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MemberUpdateRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MemberUpdateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.PeerURLs) > 0 { - for iNdEx := len(m.PeerURLs) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.PeerURLs[iNdEx]) - copy(dAtA[i:], m.PeerURLs[iNdEx]) - i = encodeVarintRpc(dAtA, i, uint64(len(m.PeerURLs[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if m.ID != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MemberUpdateResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MemberUpdateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MemberUpdateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Members) > 0 { - for iNdEx := len(m.Members) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Members[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MemberListRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MemberListRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MemberListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Linearizable { - i-- - if m.Linearizable { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MemberListResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MemberListResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MemberListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Members) > 0 { - for iNdEx := len(m.Members) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Members[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MemberPromoteRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MemberPromoteRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MemberPromoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.ID != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MemberPromoteResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MemberPromoteResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MemberPromoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Members) > 0 { - for iNdEx := len(m.Members) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Members[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DefragmentRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DefragmentRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DefragmentRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func (m *DefragmentResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DefragmentResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DefragmentResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MoveLeaderRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MoveLeaderRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MoveLeaderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.TargetID != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.TargetID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MoveLeaderResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MoveLeaderResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MoveLeaderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AlarmRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AlarmRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AlarmRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Alarm != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Alarm)) - i-- - dAtA[i] = 0x18 - } - if m.MemberID != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.MemberID)) - i-- - dAtA[i] = 0x10 - } - if m.Action != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Action)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *AlarmMember) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AlarmMember) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AlarmMember) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Alarm != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Alarm)) - i-- - dAtA[i] = 0x10 - } - if m.MemberID != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.MemberID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *AlarmResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AlarmResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AlarmResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Alarms) > 0 { - for iNdEx := len(m.Alarms) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Alarms[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DowngradeRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DowngradeRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DowngradeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Version) > 0 { - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Version))) - i-- - dAtA[i] = 0x12 - } - if m.Action != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Action)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *DowngradeResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DowngradeResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DowngradeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Version) > 0 { - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Version))) - i-- - dAtA[i] = 0x12 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DowngradeVersionTestRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DowngradeVersionTestRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DowngradeVersionTestRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Ver) > 0 { - i -= len(m.Ver) - copy(dAtA[i:], m.Ver) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Ver))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *StatusRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StatusRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func (m *StatusResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StatusResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.DowngradeInfo != nil { - { - size, err := m.DowngradeInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6a - } - if m.DbSizeQuota != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.DbSizeQuota)) - i-- - dAtA[i] = 0x60 - } - if len(m.StorageVersion) > 0 { - i -= len(m.StorageVersion) - copy(dAtA[i:], m.StorageVersion) - i = encodeVarintRpc(dAtA, i, uint64(len(m.StorageVersion))) - i-- - dAtA[i] = 0x5a - } - if m.IsLearner { - i-- - if m.IsLearner { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x50 - } - if m.DbSizeInUse != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.DbSizeInUse)) - i-- - dAtA[i] = 0x48 - } - if len(m.Errors) > 0 { - for iNdEx := len(m.Errors) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Errors[iNdEx]) - copy(dAtA[i:], m.Errors[iNdEx]) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Errors[iNdEx]))) - i-- - dAtA[i] = 0x42 - } - } - if m.RaftAppliedIndex != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.RaftAppliedIndex)) - i-- - dAtA[i] = 0x38 - } - if m.RaftTerm != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.RaftTerm)) - i-- - dAtA[i] = 0x30 - } - if m.RaftIndex != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.RaftIndex)) - i-- - dAtA[i] = 0x28 - } - if m.Leader != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Leader)) - i-- - dAtA[i] = 0x20 - } - if m.DbSize != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.DbSize)) - i-- - dAtA[i] = 0x18 - } - if len(m.Version) > 0 { - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Version))) - i-- - dAtA[i] = 0x12 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DowngradeInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DowngradeInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DowngradeInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.TargetVersion) > 0 { - i -= len(m.TargetVersion) - copy(dAtA[i:], m.TargetVersion) - i = encodeVarintRpc(dAtA, i, uint64(len(m.TargetVersion))) - i-- - dAtA[i] = 0x12 - } - if m.Enabled { - i-- - if m.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *AuthEnableRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthEnableRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthEnableRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func (m *AuthDisableRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthDisableRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthDisableRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func (m *AuthStatusRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthStatusRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthStatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func (m *AuthenticateRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthenticateRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthenticateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Password) > 0 { - i -= len(m.Password) - copy(dAtA[i:], m.Password) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Password))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthUserAddRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthUserAddRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthUserAddRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.HashedPassword) > 0 { - i -= len(m.HashedPassword) - copy(dAtA[i:], m.HashedPassword) - i = encodeVarintRpc(dAtA, i, uint64(len(m.HashedPassword))) - i-- - dAtA[i] = 0x22 - } - if m.Options != nil { - { - size, err := m.Options.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.Password) > 0 { - i -= len(m.Password) - copy(dAtA[i:], m.Password) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Password))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthUserGetRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthUserGetRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthUserGetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthUserDeleteRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthUserDeleteRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthUserDeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthUserChangePasswordRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthUserChangePasswordRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthUserChangePasswordRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.HashedPassword) > 0 { - i -= len(m.HashedPassword) - copy(dAtA[i:], m.HashedPassword) - i = encodeVarintRpc(dAtA, i, uint64(len(m.HashedPassword))) - i-- - dAtA[i] = 0x1a - } - if len(m.Password) > 0 { - i -= len(m.Password) - copy(dAtA[i:], m.Password) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Password))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthUserGrantRoleRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthUserGrantRoleRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthUserGrantRoleRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Role) > 0 { - i -= len(m.Role) - copy(dAtA[i:], m.Role) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Role))) - i-- - dAtA[i] = 0x12 - } - if len(m.User) > 0 { - i -= len(m.User) - copy(dAtA[i:], m.User) - i = encodeVarintRpc(dAtA, i, uint64(len(m.User))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthUserRevokeRoleRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthUserRevokeRoleRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthUserRevokeRoleRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Role) > 0 { - i -= len(m.Role) - copy(dAtA[i:], m.Role) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Role))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthRoleAddRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthRoleAddRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthRoleAddRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthRoleGetRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthRoleGetRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthRoleGetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Role) > 0 { - i -= len(m.Role) - copy(dAtA[i:], m.Role) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Role))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthUserListRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthUserListRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthUserListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func (m *AuthRoleListRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthRoleListRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthRoleListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func (m *AuthRoleDeleteRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthRoleDeleteRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthRoleDeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Role) > 0 { - i -= len(m.Role) - copy(dAtA[i:], m.Role) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Role))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthRoleGrantPermissionRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthRoleGrantPermissionRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthRoleGrantPermissionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Perm != nil { - { - size, err := m.Perm.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthRoleRevokePermissionRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthRoleRevokePermissionRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthRoleRevokePermissionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.RangeEnd) > 0 { - i -= len(m.RangeEnd) - copy(dAtA[i:], m.RangeEnd) - i = encodeVarintRpc(dAtA, i, uint64(len(m.RangeEnd))) - i-- - dAtA[i] = 0x1a - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0x12 - } - if len(m.Role) > 0 { - i -= len(m.Role) - copy(dAtA[i:], m.Role) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Role))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthEnableResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthEnableResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthEnableResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthDisableResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthDisableResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthDisableResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthStatusResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthStatusResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.AuthRevision != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.AuthRevision)) - i-- - dAtA[i] = 0x18 - } - if m.Enabled { - i-- - if m.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthenticateResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthenticateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthenticateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Token) > 0 { - i -= len(m.Token) - copy(dAtA[i:], m.Token) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Token))) - i-- - dAtA[i] = 0x12 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthUserAddResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthUserAddResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthUserAddResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthUserGetResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthUserGetResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthUserGetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Roles) > 0 { - for iNdEx := len(m.Roles) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Roles[iNdEx]) - copy(dAtA[i:], m.Roles[iNdEx]) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Roles[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthUserDeleteResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthUserDeleteResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthUserDeleteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthUserChangePasswordResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthUserChangePasswordResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthUserChangePasswordResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthUserGrantRoleResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthUserGrantRoleResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthUserGrantRoleResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthUserRevokeRoleResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthUserRevokeRoleResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthUserRevokeRoleResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthRoleAddResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthRoleAddResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthRoleAddResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthRoleGetResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthRoleGetResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthRoleGetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Perm) > 0 { - for iNdEx := len(m.Perm) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Perm[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthRoleListResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthRoleListResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthRoleListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Roles) > 0 { - for iNdEx := len(m.Roles) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Roles[iNdEx]) - copy(dAtA[i:], m.Roles[iNdEx]) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Roles[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthUserListResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthUserListResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthUserListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Users) > 0 { - for iNdEx := len(m.Users) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Users[iNdEx]) - copy(dAtA[i:], m.Users[iNdEx]) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Users[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthRoleDeleteResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthRoleDeleteResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthRoleDeleteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthRoleGrantPermissionResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthRoleGrantPermissionResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthRoleGrantPermissionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AuthRoleRevokePermissionResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AuthRoleRevokePermissionResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthRoleRevokePermissionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintRpc(dAtA []byte, offset int, v uint64) int { - offset -= sovRpc(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ResponseHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ClusterId != 0 { - n += 1 + sovRpc(uint64(m.ClusterId)) - } - if m.MemberId != 0 { - n += 1 + sovRpc(uint64(m.MemberId)) - } - if m.Revision != 0 { - n += 1 + sovRpc(uint64(m.Revision)) - } - if m.RaftTerm != 0 { - n += 1 + sovRpc(uint64(m.RaftTerm)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RangeRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.RangeEnd) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.Limit != 0 { - n += 1 + sovRpc(uint64(m.Limit)) - } - if m.Revision != 0 { - n += 1 + sovRpc(uint64(m.Revision)) - } - if m.SortOrder != 0 { - n += 1 + sovRpc(uint64(m.SortOrder)) - } - if m.SortTarget != 0 { - n += 1 + sovRpc(uint64(m.SortTarget)) - } - if m.Serializable { - n += 2 - } - if m.KeysOnly { - n += 2 - } - if m.CountOnly { - n += 2 - } - if m.MinModRevision != 0 { - n += 1 + sovRpc(uint64(m.MinModRevision)) - } - if m.MaxModRevision != 0 { - n += 1 + sovRpc(uint64(m.MaxModRevision)) - } - if m.MinCreateRevision != 0 { - n += 1 + sovRpc(uint64(m.MinCreateRevision)) - } - if m.MaxCreateRevision != 0 { - n += 1 + sovRpc(uint64(m.MaxCreateRevision)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RangeResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if len(m.Kvs) > 0 { - for _, e := range m.Kvs { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.More { - n += 2 - } - if m.Count != 0 { - n += 1 + sovRpc(uint64(m.Count)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PutRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.Lease != 0 { - n += 1 + sovRpc(uint64(m.Lease)) - } - if m.PrevKv { - n += 2 - } - if m.IgnoreValue { - n += 2 - } - if m.IgnoreLease { - n += 2 - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PutResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.PrevKv != nil { - l = m.PrevKv.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteRangeRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.RangeEnd) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.PrevKv { - n += 2 - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteRangeResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.Deleted != 0 { - n += 1 + sovRpc(uint64(m.Deleted)) - } - if len(m.PrevKvs) > 0 { - for _, e := range m.PrevKvs { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RequestOp) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Request != nil { - n += m.Request.Size() - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RequestOp_RequestRange) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RequestRange != nil { - l = m.RequestRange.Size() - n += 1 + l + sovRpc(uint64(l)) - } - return n -} -func (m *RequestOp_RequestPut) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RequestPut != nil { - l = m.RequestPut.Size() - n += 1 + l + sovRpc(uint64(l)) - } - return n -} -func (m *RequestOp_RequestDeleteRange) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RequestDeleteRange != nil { - l = m.RequestDeleteRange.Size() - n += 1 + l + sovRpc(uint64(l)) - } - return n -} -func (m *RequestOp_RequestTxn) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RequestTxn != nil { - l = m.RequestTxn.Size() - n += 1 + l + sovRpc(uint64(l)) - } - return n -} -func (m *ResponseOp) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Response != nil { - n += m.Response.Size() - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ResponseOp_ResponseRange) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ResponseRange != nil { - l = m.ResponseRange.Size() - n += 1 + l + sovRpc(uint64(l)) - } - return n -} -func (m *ResponseOp_ResponsePut) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ResponsePut != nil { - l = m.ResponsePut.Size() - n += 1 + l + sovRpc(uint64(l)) - } - return n -} -func (m *ResponseOp_ResponseDeleteRange) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ResponseDeleteRange != nil { - l = m.ResponseDeleteRange.Size() - n += 1 + l + sovRpc(uint64(l)) - } - return n -} -func (m *ResponseOp_ResponseTxn) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ResponseTxn != nil { - l = m.ResponseTxn.Size() - n += 1 + l + sovRpc(uint64(l)) - } - return n -} -func (m *Compare) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Result != 0 { - n += 1 + sovRpc(uint64(m.Result)) - } - if m.Target != 0 { - n += 1 + sovRpc(uint64(m.Target)) - } - l = len(m.Key) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.TargetUnion != nil { - n += m.TargetUnion.Size() - } - l = len(m.RangeEnd) - if l > 0 { - n += 2 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Compare_Version) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovRpc(uint64(m.Version)) - return n -} -func (m *Compare_CreateRevision) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovRpc(uint64(m.CreateRevision)) - return n -} -func (m *Compare_ModRevision) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovRpc(uint64(m.ModRevision)) - return n -} -func (m *Compare_Value) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Value != nil { - l = len(m.Value) - n += 1 + l + sovRpc(uint64(l)) - } - return n -} -func (m *Compare_Lease) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovRpc(uint64(m.Lease)) - return n -} -func (m *TxnRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Compare) > 0 { - for _, e := range m.Compare { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if len(m.Success) > 0 { - for _, e := range m.Success { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if len(m.Failure) > 0 { - for _, e := range m.Failure { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *TxnResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.Succeeded { - n += 2 - } - if len(m.Responses) > 0 { - for _, e := range m.Responses { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *CompactionRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Revision != 0 { - n += 1 + sovRpc(uint64(m.Revision)) - } - if m.Physical { - n += 2 - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *CompactionResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HashRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HashKVRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Revision != 0 { - n += 1 + sovRpc(uint64(m.Revision)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HashKVResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.Hash != 0 { - n += 1 + sovRpc(uint64(m.Hash)) - } - if m.CompactRevision != 0 { - n += 1 + sovRpc(uint64(m.CompactRevision)) - } - if m.HashRevision != 0 { - n += 1 + sovRpc(uint64(m.HashRevision)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HashResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.Hash != 0 { - n += 1 + sovRpc(uint64(m.Hash)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SnapshotRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SnapshotResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.RemainingBytes != 0 { - n += 1 + sovRpc(uint64(m.RemainingBytes)) - } - l = len(m.Blob) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.Version) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *WatchRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RequestUnion != nil { - n += m.RequestUnion.Size() - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *WatchRequest_CreateRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CreateRequest != nil { - l = m.CreateRequest.Size() - n += 1 + l + sovRpc(uint64(l)) - } - return n -} -func (m *WatchRequest_CancelRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CancelRequest != nil { - l = m.CancelRequest.Size() - n += 1 + l + sovRpc(uint64(l)) - } - return n -} -func (m *WatchRequest_ProgressRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProgressRequest != nil { - l = m.ProgressRequest.Size() - n += 1 + l + sovRpc(uint64(l)) - } - return n -} -func (m *WatchCreateRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.RangeEnd) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.StartRevision != 0 { - n += 1 + sovRpc(uint64(m.StartRevision)) - } - if m.ProgressNotify { - n += 2 - } - if len(m.Filters) > 0 { - l = 0 - for _, e := range m.Filters { - l += sovRpc(uint64(e)) - } - n += 1 + sovRpc(uint64(l)) + l - } - if m.PrevKv { - n += 2 - } - if m.WatchId != 0 { - n += 1 + sovRpc(uint64(m.WatchId)) - } - if m.Fragment { - n += 2 - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *WatchCancelRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.WatchId != 0 { - n += 1 + sovRpc(uint64(m.WatchId)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *WatchProgressRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *WatchResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.WatchId != 0 { - n += 1 + sovRpc(uint64(m.WatchId)) - } - if m.Created { - n += 2 - } - if m.Canceled { - n += 2 - } - if m.CompactRevision != 0 { - n += 1 + sovRpc(uint64(m.CompactRevision)) - } - l = len(m.CancelReason) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.Fragment { - n += 2 - } - if len(m.Events) > 0 { - for _, e := range m.Events { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LeaseGrantRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.TTL != 0 { - n += 1 + sovRpc(uint64(m.TTL)) - } - if m.ID != 0 { - n += 1 + sovRpc(uint64(m.ID)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LeaseGrantResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.ID != 0 { - n += 1 + sovRpc(uint64(m.ID)) - } - if m.TTL != 0 { - n += 1 + sovRpc(uint64(m.TTL)) - } - l = len(m.Error) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LeaseRevokeRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ID != 0 { - n += 1 + sovRpc(uint64(m.ID)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LeaseRevokeResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LeaseCheckpoint) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ID != 0 { - n += 1 + sovRpc(uint64(m.ID)) - } - if m.Remaining_TTL != 0 { - n += 1 + sovRpc(uint64(m.Remaining_TTL)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LeaseCheckpointRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Checkpoints) > 0 { - for _, e := range m.Checkpoints { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LeaseCheckpointResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LeaseKeepAliveRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ID != 0 { - n += 1 + sovRpc(uint64(m.ID)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LeaseKeepAliveResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.ID != 0 { - n += 1 + sovRpc(uint64(m.ID)) - } - if m.TTL != 0 { - n += 1 + sovRpc(uint64(m.TTL)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LeaseTimeToLiveRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ID != 0 { - n += 1 + sovRpc(uint64(m.ID)) - } - if m.Keys { - n += 2 - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LeaseTimeToLiveResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.ID != 0 { - n += 1 + sovRpc(uint64(m.ID)) - } - if m.TTL != 0 { - n += 1 + sovRpc(uint64(m.TTL)) - } - if m.GrantedTTL != 0 { - n += 1 + sovRpc(uint64(m.GrantedTTL)) - } - if len(m.Keys) > 0 { - for _, b := range m.Keys { - l = len(b) - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LeaseLeasesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LeaseStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ID != 0 { - n += 1 + sovRpc(uint64(m.ID)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LeaseLeasesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if len(m.Leases) > 0 { - for _, e := range m.Leases { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Member) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ID != 0 { - n += 1 + sovRpc(uint64(m.ID)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if len(m.PeerURLs) > 0 { - for _, s := range m.PeerURLs { - l = len(s) - n += 1 + l + sovRpc(uint64(l)) - } - } - if len(m.ClientURLs) > 0 { - for _, s := range m.ClientURLs { - l = len(s) - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.IsLearner { - n += 2 - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MemberAddRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.PeerURLs) > 0 { - for _, s := range m.PeerURLs { - l = len(s) - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.IsLearner { - n += 2 - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MemberAddResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.Member != nil { - l = m.Member.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if len(m.Members) > 0 { - for _, e := range m.Members { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MemberRemoveRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ID != 0 { - n += 1 + sovRpc(uint64(m.ID)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MemberRemoveResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if len(m.Members) > 0 { - for _, e := range m.Members { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MemberUpdateRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ID != 0 { - n += 1 + sovRpc(uint64(m.ID)) - } - if len(m.PeerURLs) > 0 { - for _, s := range m.PeerURLs { - l = len(s) - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MemberUpdateResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if len(m.Members) > 0 { - for _, e := range m.Members { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MemberListRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Linearizable { - n += 2 - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MemberListResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if len(m.Members) > 0 { - for _, e := range m.Members { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MemberPromoteRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ID != 0 { - n += 1 + sovRpc(uint64(m.ID)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MemberPromoteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if len(m.Members) > 0 { - for _, e := range m.Members { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DefragmentRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DefragmentResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MoveLeaderRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.TargetID != 0 { - n += 1 + sovRpc(uint64(m.TargetID)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MoveLeaderResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AlarmRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Action != 0 { - n += 1 + sovRpc(uint64(m.Action)) - } - if m.MemberID != 0 { - n += 1 + sovRpc(uint64(m.MemberID)) - } - if m.Alarm != 0 { - n += 1 + sovRpc(uint64(m.Alarm)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AlarmMember) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MemberID != 0 { - n += 1 + sovRpc(uint64(m.MemberID)) - } - if m.Alarm != 0 { - n += 1 + sovRpc(uint64(m.Alarm)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AlarmResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if len(m.Alarms) > 0 { - for _, e := range m.Alarms { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DowngradeRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Action != 0 { - n += 1 + sovRpc(uint64(m.Action)) - } - l = len(m.Version) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DowngradeResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.Version) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DowngradeVersionTestRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Ver) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *StatusRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *StatusResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.Version) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.DbSize != 0 { - n += 1 + sovRpc(uint64(m.DbSize)) - } - if m.Leader != 0 { - n += 1 + sovRpc(uint64(m.Leader)) - } - if m.RaftIndex != 0 { - n += 1 + sovRpc(uint64(m.RaftIndex)) - } - if m.RaftTerm != 0 { - n += 1 + sovRpc(uint64(m.RaftTerm)) - } - if m.RaftAppliedIndex != 0 { - n += 1 + sovRpc(uint64(m.RaftAppliedIndex)) - } - if len(m.Errors) > 0 { - for _, s := range m.Errors { - l = len(s) - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.DbSizeInUse != 0 { - n += 1 + sovRpc(uint64(m.DbSizeInUse)) - } - if m.IsLearner { - n += 2 - } - l = len(m.StorageVersion) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.DbSizeQuota != 0 { - n += 1 + sovRpc(uint64(m.DbSizeQuota)) - } - if m.DowngradeInfo != nil { - l = m.DowngradeInfo.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DowngradeInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Enabled { - n += 2 - } - l = len(m.TargetVersion) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthEnableRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthDisableRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthStatusRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthenticateRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.Password) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthUserAddRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.Password) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.Options != nil { - l = m.Options.Size() - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.HashedPassword) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthUserGetRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthUserDeleteRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthUserChangePasswordRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.Password) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.HashedPassword) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthUserGrantRoleRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.User) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.Role) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthUserRevokeRoleRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.Role) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthRoleAddRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthRoleGetRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Role) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthUserListRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthRoleListRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthRoleDeleteRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Role) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthRoleGrantPermissionRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.Perm != nil { - l = m.Perm.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthRoleRevokePermissionRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Role) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.Key) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.RangeEnd) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthEnableResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthDisableResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthStatusResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.Enabled { - n += 2 - } - if m.AuthRevision != 0 { - n += 1 + sovRpc(uint64(m.AuthRevision)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthenticateResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.Token) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthUserAddResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthUserGetResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if len(m.Roles) > 0 { - for _, s := range m.Roles { - l = len(s) - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthUserDeleteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthUserChangePasswordResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthUserGrantRoleResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthUserRevokeRoleResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthRoleAddResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthRoleGetResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if len(m.Perm) > 0 { - for _, e := range m.Perm { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthRoleListResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if len(m.Roles) > 0 { - for _, s := range m.Roles { - l = len(s) - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthUserListResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if len(m.Users) > 0 { - for _, s := range m.Users { - l = len(s) - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthRoleDeleteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthRoleGrantPermissionResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AuthRoleRevokePermissionResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovRpc(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozRpc(x uint64) (n int) { - return sovRpc(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ResponseHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ResponseHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ResponseHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ClusterId", wireType) - } - m.ClusterId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ClusterId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MemberId", wireType) - } - m.MemberId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MemberId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Revision", wireType) - } - m.Revision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Revision |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RaftTerm", wireType) - } - m.RaftTerm = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RaftTerm |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RangeRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RangeRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RangeRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RangeEnd", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RangeEnd = append(m.RangeEnd[:0], dAtA[iNdEx:postIndex]...) - if m.RangeEnd == nil { - m.RangeEnd = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) - } - m.Limit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Limit |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Revision", wireType) - } - m.Revision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Revision |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SortOrder", wireType) - } - m.SortOrder = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SortOrder |= RangeRequest_SortOrder(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SortTarget", wireType) - } - m.SortTarget = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SortTarget |= RangeRequest_SortTarget(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Serializable", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Serializable = bool(v != 0) - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field KeysOnly", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.KeysOnly = bool(v != 0) - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CountOnly", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.CountOnly = bool(v != 0) - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinModRevision", wireType) - } - m.MinModRevision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinModRevision |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxModRevision", wireType) - } - m.MaxModRevision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxModRevision |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinCreateRevision", wireType) - } - m.MinCreateRevision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinCreateRevision |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxCreateRevision", wireType) - } - m.MaxCreateRevision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxCreateRevision |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RangeResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RangeResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RangeResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Kvs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Kvs = append(m.Kvs, &mvccpb.KeyValue{}) - if err := m.Kvs[len(m.Kvs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field More", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.More = bool(v != 0) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) - } - m.Count = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Count |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PutRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PutRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Lease", wireType) - } - m.Lease = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Lease |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevKv", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.PrevKv = bool(v != 0) - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IgnoreValue", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IgnoreValue = bool(v != 0) - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IgnoreLease", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IgnoreLease = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PutResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PutResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevKv", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PrevKv == nil { - m.PrevKv = &mvccpb.KeyValue{} - } - if err := m.PrevKv.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteRangeRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteRangeRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteRangeRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RangeEnd", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RangeEnd = append(m.RangeEnd[:0], dAtA[iNdEx:postIndex]...) - if m.RangeEnd == nil { - m.RangeEnd = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevKv", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.PrevKv = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteRangeResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteRangeResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteRangeResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Deleted", wireType) - } - m.Deleted = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Deleted |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevKvs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PrevKvs = append(m.PrevKvs, &mvccpb.KeyValue{}) - if err := m.PrevKvs[len(m.PrevKvs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RequestOp) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RequestOp: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RequestOp: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestRange", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &RangeRequest{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Request = &RequestOp_RequestRange{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestPut", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &PutRequest{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Request = &RequestOp_RequestPut{v} - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestDeleteRange", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &DeleteRangeRequest{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Request = &RequestOp_RequestDeleteRange{v} - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestTxn", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &TxnRequest{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Request = &RequestOp_RequestTxn{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ResponseOp) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ResponseOp: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ResponseOp: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResponseRange", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &RangeResponse{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Response = &ResponseOp_ResponseRange{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResponsePut", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &PutResponse{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Response = &ResponseOp_ResponsePut{v} - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResponseDeleteRange", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &DeleteRangeResponse{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Response = &ResponseOp_ResponseDeleteRange{v} - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResponseTxn", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &TxnResponse{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Response = &ResponseOp_ResponseTxn{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Compare) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Compare: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Compare: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) - } - m.Result = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Result |= Compare_CompareResult(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) - } - m.Target = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Target |= Compare_CompareTarget(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.TargetUnion = &Compare_Version{v} - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CreateRevision", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.TargetUnion = &Compare_CreateRevision{v} - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ModRevision", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.TargetUnion = &Compare_ModRevision{v} - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := make([]byte, postIndex-iNdEx) - copy(v, dAtA[iNdEx:postIndex]) - m.TargetUnion = &Compare_Value{v} - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Lease", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.TargetUnion = &Compare_Lease{v} - case 64: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RangeEnd", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RangeEnd = append(m.RangeEnd[:0], dAtA[iNdEx:postIndex]...) - if m.RangeEnd == nil { - m.RangeEnd = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TxnRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TxnRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TxnRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Compare", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Compare = append(m.Compare, &Compare{}) - if err := m.Compare[len(m.Compare)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Success = append(m.Success, &RequestOp{}) - if err := m.Success[len(m.Success)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Failure", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Failure = append(m.Failure, &RequestOp{}) - if err := m.Failure[len(m.Failure)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TxnResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TxnResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TxnResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Succeeded", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Succeeded = bool(v != 0) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Responses", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Responses = append(m.Responses, &ResponseOp{}) - if err := m.Responses[len(m.Responses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompactionRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CompactionRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompactionRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Revision", wireType) - } - m.Revision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Revision |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Physical", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Physical = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompactionResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CompactionResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompactionResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HashRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HashRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HashRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HashKVRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HashKVRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HashKVRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Revision", wireType) - } - m.Revision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Revision |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HashKVResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HashKVResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HashKVResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - m.Hash = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Hash |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CompactRevision", wireType) - } - m.CompactRevision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CompactRevision |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HashRevision", wireType) - } - m.HashRevision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.HashRevision |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HashResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HashResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HashResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - m.Hash = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Hash |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SnapshotRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SnapshotRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SnapshotRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SnapshotResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SnapshotResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SnapshotResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RemainingBytes", wireType) - } - m.RemainingBytes = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RemainingBytes |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Blob", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Blob = append(m.Blob[:0], dAtA[iNdEx:postIndex]...) - if m.Blob == nil { - m.Blob = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Version = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WatchRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WatchRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WatchRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CreateRequest", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &WatchCreateRequest{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.RequestUnion = &WatchRequest_CreateRequest{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CancelRequest", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &WatchCancelRequest{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.RequestUnion = &WatchRequest_CancelRequest{v} - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProgressRequest", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &WatchProgressRequest{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.RequestUnion = &WatchRequest_ProgressRequest{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WatchCreateRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WatchCreateRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WatchCreateRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RangeEnd", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RangeEnd = append(m.RangeEnd[:0], dAtA[iNdEx:postIndex]...) - if m.RangeEnd == nil { - m.RangeEnd = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartRevision", wireType) - } - m.StartRevision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartRevision |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProgressNotify", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ProgressNotify = bool(v != 0) - case 5: - if wireType == 0 { - var v WatchCreateRequest_FilterType - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= WatchCreateRequest_FilterType(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Filters = append(m.Filters, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - if elementCount != 0 && len(m.Filters) == 0 { - m.Filters = make([]WatchCreateRequest_FilterType, 0, elementCount) - } - for iNdEx < postIndex { - var v WatchCreateRequest_FilterType - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= WatchCreateRequest_FilterType(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Filters = append(m.Filters, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevKv", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.PrevKv = bool(v != 0) - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field WatchId", wireType) - } - m.WatchId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.WatchId |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Fragment", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Fragment = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WatchCancelRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WatchCancelRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WatchCancelRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field WatchId", wireType) - } - m.WatchId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.WatchId |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WatchProgressRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WatchProgressRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WatchProgressRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WatchResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WatchResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WatchResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field WatchId", wireType) - } - m.WatchId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.WatchId |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Created", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Created = bool(v != 0) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Canceled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Canceled = bool(v != 0) - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CompactRevision", wireType) - } - m.CompactRevision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CompactRevision |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CancelReason", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CancelReason = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Fragment", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Fragment = bool(v != 0) - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Events", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Events = append(m.Events, &mvccpb.Event{}) - if err := m.Events[len(m.Events)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LeaseGrantRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LeaseGrantRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LeaseGrantRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) - } - m.TTL = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TTL |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LeaseGrantResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LeaseGrantResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LeaseGrantResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) - } - m.TTL = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TTL |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Error = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LeaseRevokeRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LeaseRevokeRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LeaseRevokeRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LeaseRevokeResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LeaseRevokeResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LeaseRevokeResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LeaseCheckpoint) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LeaseCheckpoint: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LeaseCheckpoint: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Remaining_TTL", wireType) - } - m.Remaining_TTL = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Remaining_TTL |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LeaseCheckpointRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LeaseCheckpointRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LeaseCheckpointRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Checkpoints", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Checkpoints = append(m.Checkpoints, &LeaseCheckpoint{}) - if err := m.Checkpoints[len(m.Checkpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LeaseCheckpointResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LeaseCheckpointResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LeaseCheckpointResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LeaseKeepAliveRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LeaseKeepAliveRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LeaseKeepAliveRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LeaseKeepAliveResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LeaseKeepAliveResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LeaseKeepAliveResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) - } - m.TTL = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TTL |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LeaseTimeToLiveRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LeaseTimeToLiveRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LeaseTimeToLiveRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Keys = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LeaseTimeToLiveResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LeaseTimeToLiveResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LeaseTimeToLiveResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) - } - m.TTL = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TTL |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GrantedTTL", wireType) - } - m.GrantedTTL = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GrantedTTL |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Keys = append(m.Keys, make([]byte, postIndex-iNdEx)) - copy(m.Keys[len(m.Keys)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LeaseLeasesRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LeaseLeasesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LeaseLeasesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LeaseStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LeaseStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LeaseStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LeaseLeasesResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LeaseLeasesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LeaseLeasesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Leases", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Leases = append(m.Leases, &LeaseStatus{}) - if err := m.Leases[len(m.Leases)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Member) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Member: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Member: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerURLs", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerURLs = append(m.PeerURLs, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientURLs", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClientURLs = append(m.ClientURLs, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsLearner", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IsLearner = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MemberAddRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MemberAddRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MemberAddRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerURLs", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerURLs = append(m.PeerURLs, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsLearner", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IsLearner = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MemberAddResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MemberAddResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MemberAddResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Member", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Member == nil { - m.Member = &Member{} - } - if err := m.Member.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Members", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Members = append(m.Members, &Member{}) - if err := m.Members[len(m.Members)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MemberRemoveRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MemberRemoveRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MemberRemoveRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MemberRemoveResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MemberRemoveResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MemberRemoveResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Members", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Members = append(m.Members, &Member{}) - if err := m.Members[len(m.Members)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MemberUpdateRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MemberUpdateRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MemberUpdateRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerURLs", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerURLs = append(m.PeerURLs, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MemberUpdateResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MemberUpdateResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MemberUpdateResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Members", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Members = append(m.Members, &Member{}) - if err := m.Members[len(m.Members)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MemberListRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MemberListRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MemberListRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Linearizable", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Linearizable = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MemberListResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MemberListResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MemberListResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Members", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Members = append(m.Members, &Member{}) - if err := m.Members[len(m.Members)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MemberPromoteRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MemberPromoteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MemberPromoteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MemberPromoteResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MemberPromoteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MemberPromoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Members", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Members = append(m.Members, &Member{}) - if err := m.Members[len(m.Members)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DefragmentRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DefragmentRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DefragmentRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DefragmentResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DefragmentResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DefragmentResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MoveLeaderRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MoveLeaderRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MoveLeaderRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TargetID", wireType) - } - m.TargetID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TargetID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MoveLeaderResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MoveLeaderResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MoveLeaderResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AlarmRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AlarmRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AlarmRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Action", wireType) - } - m.Action = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Action |= AlarmRequest_AlarmAction(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MemberID", wireType) - } - m.MemberID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MemberID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Alarm", wireType) - } - m.Alarm = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Alarm |= AlarmType(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AlarmMember) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AlarmMember: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AlarmMember: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MemberID", wireType) - } - m.MemberID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MemberID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Alarm", wireType) - } - m.Alarm = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Alarm |= AlarmType(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AlarmResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AlarmResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AlarmResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Alarms", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Alarms = append(m.Alarms, &AlarmMember{}) - if err := m.Alarms[len(m.Alarms)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DowngradeRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DowngradeRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DowngradeRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Action", wireType) - } - m.Action = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Action |= DowngradeRequest_DowngradeAction(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Version = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DowngradeResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DowngradeResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DowngradeResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Version = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DowngradeVersionTestRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DowngradeVersionTestRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DowngradeVersionTestRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ver", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ver = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StatusRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StatusRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StatusRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StatusResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StatusResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Version = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DbSize", wireType) - } - m.DbSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.DbSize |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Leader", wireType) - } - m.Leader = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Leader |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RaftIndex", wireType) - } - m.RaftIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RaftIndex |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RaftTerm", wireType) - } - m.RaftTerm = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RaftTerm |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RaftAppliedIndex", wireType) - } - m.RaftAppliedIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RaftAppliedIndex |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Errors", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Errors = append(m.Errors, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DbSizeInUse", wireType) - } - m.DbSizeInUse = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.DbSizeInUse |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsLearner", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IsLearner = bool(v != 0) - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StorageVersion", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StorageVersion = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DbSizeQuota", wireType) - } - m.DbSizeQuota = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.DbSizeQuota |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 13: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DowngradeInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DowngradeInfo == nil { - m.DowngradeInfo = &DowngradeInfo{} - } - if err := m.DowngradeInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DowngradeInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DowngradeInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DowngradeInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Enabled = bool(v != 0) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TargetVersion", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TargetVersion = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthEnableRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthEnableRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthEnableRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthDisableRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthDisableRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthDisableRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthStatusRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthStatusRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthStatusRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthenticateRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthenticateRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthenticateRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Password", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Password = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthUserAddRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthUserAddRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthUserAddRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Password", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Password = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Options == nil { - m.Options = &authpb.UserAddOptions{} - } - if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HashedPassword", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.HashedPassword = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthUserGetRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthUserGetRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthUserGetRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthUserDeleteRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthUserDeleteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthUserDeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthUserChangePasswordRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthUserChangePasswordRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthUserChangePasswordRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Password", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Password = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HashedPassword", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.HashedPassword = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthUserGrantRoleRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthUserGrantRoleRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthUserGrantRoleRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.User = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Role = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthUserRevokeRoleRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthUserRevokeRoleRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthUserRevokeRoleRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Role = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthRoleAddRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthRoleAddRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthRoleAddRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthRoleGetRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthRoleGetRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthRoleGetRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Role = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthUserListRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthUserListRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthUserListRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthRoleListRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthRoleListRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthRoleListRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthRoleDeleteRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthRoleDeleteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthRoleDeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Role = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthRoleGrantPermissionRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthRoleGrantPermissionRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthRoleGrantPermissionRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Perm", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Perm == nil { - m.Perm = &authpb.Permission{} - } - if err := m.Perm.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthRoleRevokePermissionRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthRoleRevokePermissionRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthRoleRevokePermissionRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Role = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RangeEnd", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RangeEnd = append(m.RangeEnd[:0], dAtA[iNdEx:postIndex]...) - if m.RangeEnd == nil { - m.RangeEnd = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthEnableResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthEnableResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthEnableResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthDisableResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthDisableResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthDisableResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthStatusResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthStatusResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Enabled = bool(v != 0) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthRevision", wireType) - } - m.AuthRevision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AuthRevision |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthenticateResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthenticateResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthenticateResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Token = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthUserAddResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthUserAddResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthUserAddResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthUserGetResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthUserGetResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthUserGetResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Roles", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Roles = append(m.Roles, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthUserDeleteResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthUserDeleteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthUserDeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthUserChangePasswordResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthUserChangePasswordResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthUserChangePasswordResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthUserGrantRoleResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthUserGrantRoleResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthUserGrantRoleResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthUserRevokeRoleResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthUserRevokeRoleResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthUserRevokeRoleResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthRoleAddResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthRoleAddResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthRoleAddResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthRoleGetResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthRoleGetResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthRoleGetResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Perm", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Perm = append(m.Perm, &authpb.Permission{}) - if err := m.Perm[len(m.Perm)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthRoleListResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthRoleListResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthRoleListResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Roles", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Roles = append(m.Roles, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthUserListResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthUserListResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthUserListResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Users", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Users = append(m.Users, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthRoleDeleteResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthRoleDeleteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthRoleDeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthRoleGrantPermissionResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthRoleGrantPermissionResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthRoleGrantPermissionResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuthRoleRevokePermissionResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthRoleRevokePermissionResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthRoleRevokePermissionResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &ResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipRpc(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRpc - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRpc - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRpc - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthRpc - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupRpc - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthRpc - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthRpc = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowRpc = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupRpc = fmt.Errorf("proto: unexpected end of group") -) diff --git a/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/rpc.proto b/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/rpc.proto index 983dc01725..31d5283473 100644 --- a/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/rpc.proto +++ b/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/rpc.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package etcdserverpb; -import "gogoproto/gogo.proto"; import "etcd/api/mvccpb/kv.proto"; import "etcd/api/authpb/auth.proto"; import "etcd/api/versionpb/version.proto"; @@ -12,9 +11,6 @@ import "protoc-gen-openapiv2/options/annotations.proto"; option go_package = "go.etcd.io/etcd/api/v3/etcdserverpb"; -option (gogoproto.marshaler_all) = true; -option (gogoproto.unmarshaler_all) = true; - option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { security_definitions: { security: { @@ -43,6 +39,14 @@ service KV { }; } + // RangeStream gets the keys in the range from the key-value store. + // + // This RPC is intentionally gRPC-only and does not provide a + // grpc-gateway REST mapping, because streaming chunked responses + // are not a good fit for standard JSON/REST semantics. + rpc RangeStream(RangeRequest) returns (stream RangeStreamResponse) { + } + // Put puts the given key into the key-value store. // A put request increments the revision of the key-value store // and generates one event in the event history. @@ -345,7 +349,7 @@ service Auth { }; } - // UserGrant grants a role to a specified user. + // UserGrantRole grants a role to a specified user. rpc UserGrantRole(AuthUserGrantRoleRequest) returns (AuthUserGrantRoleResponse) { option (google.api.http) = { post: "/v3/auth/user/grant" @@ -1434,3 +1438,20 @@ message AuthRoleRevokePermissionResponse { ResponseHeader header = 1; } + +// RangeStreamResponse is the response for the RangeStream RPC. +message RangeStreamResponse { + option (versionpb.etcd_version_msg) = "3.7"; + // range_response is a partial response for the KV.RangeStream RPC. + // The result of proto.Merge() applied on all responses should result in the + // same RangeResponse response as to the Range() method. + // + // Field population across chunks: + // - kvs: each chunk carries a disjoint slice of the result. Concatenating + // them in order yields the full key set. + // - header, more, count: set only on the final chunk. Non-merge clients + // can rely on io.EOF (end of stream) to detect completion. These + // fields are provided for clients that merge all responses into a + // single RangeResponse. + RangeResponse range_response = 1; +} diff --git a/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/rpc_grpc.pb.go b/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/rpc_grpc.pb.go new file mode 100644 index 0000000000..843632e191 --- /dev/null +++ b/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/rpc_grpc.pb.go @@ -0,0 +1,2137 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.2 +// - protoc v3.20.3 +// source: rpc.proto + +package etcdserverpb + +import ( + context "context" + + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// 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.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + KV_Range_FullMethodName = "/etcdserverpb.KV/Range" + KV_RangeStream_FullMethodName = "/etcdserverpb.KV/RangeStream" + KV_Put_FullMethodName = "/etcdserverpb.KV/Put" + KV_DeleteRange_FullMethodName = "/etcdserverpb.KV/DeleteRange" + KV_Txn_FullMethodName = "/etcdserverpb.KV/Txn" + KV_Compact_FullMethodName = "/etcdserverpb.KV/Compact" +) + +// KVClient is the client API for KV service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type KVClient interface { + // Range gets the keys in the range from the key-value store. + Range(ctx context.Context, in *RangeRequest, opts ...grpc.CallOption) (*RangeResponse, error) + // RangeStream gets the keys in the range from the key-value store. + // + // This RPC is intentionally gRPC-only and does not provide a + // grpc-gateway REST mapping, because streaming chunked responses + // are not a good fit for standard JSON/REST semantics. + RangeStream(ctx context.Context, in *RangeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[RangeStreamResponse], error) + // Put puts the given key into the key-value store. + // A put request increments the revision of the key-value store + // and generates one event in the event history. + Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) + // DeleteRange deletes the given range from the key-value store. + // A delete request increments the revision of the key-value store + // and generates a delete event in the event history for every deleted key. + DeleteRange(ctx context.Context, in *DeleteRangeRequest, opts ...grpc.CallOption) (*DeleteRangeResponse, error) + // Txn processes multiple requests in a single transaction. + // A txn request increments the revision of the key-value store + // and generates events with the same revision for every completed request. + // It is not allowed to modify the same key several times within one txn. + Txn(ctx context.Context, in *TxnRequest, opts ...grpc.CallOption) (*TxnResponse, error) + // Compact compacts the event history in the etcd key-value store. The key-value + // store should be periodically compacted or the event history will continue to grow + // indefinitely. + Compact(ctx context.Context, in *CompactionRequest, opts ...grpc.CallOption) (*CompactionResponse, error) +} + +type kVClient struct { + cc grpc.ClientConnInterface +} + +func NewKVClient(cc grpc.ClientConnInterface) KVClient { + return &kVClient{cc} +} + +func (c *kVClient) Range(ctx context.Context, in *RangeRequest, opts ...grpc.CallOption) (*RangeResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RangeResponse) + err := c.cc.Invoke(ctx, KV_Range_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *kVClient) RangeStream(ctx context.Context, in *RangeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[RangeStreamResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &KV_ServiceDesc.Streams[0], KV_RangeStream_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[RangeRequest, RangeStreamResponse]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type KV_RangeStreamClient = grpc.ServerStreamingClient[RangeStreamResponse] + +func (c *kVClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PutResponse) + err := c.cc.Invoke(ctx, KV_Put_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *kVClient) DeleteRange(ctx context.Context, in *DeleteRangeRequest, opts ...grpc.CallOption) (*DeleteRangeResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteRangeResponse) + err := c.cc.Invoke(ctx, KV_DeleteRange_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *kVClient) Txn(ctx context.Context, in *TxnRequest, opts ...grpc.CallOption) (*TxnResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(TxnResponse) + err := c.cc.Invoke(ctx, KV_Txn_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *kVClient) Compact(ctx context.Context, in *CompactionRequest, opts ...grpc.CallOption) (*CompactionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CompactionResponse) + err := c.cc.Invoke(ctx, KV_Compact_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// KVServer is the server API for KV service. +// All implementations must embed UnimplementedKVServer +// for forward compatibility. +type KVServer interface { + // Range gets the keys in the range from the key-value store. + Range(context.Context, *RangeRequest) (*RangeResponse, error) + // RangeStream gets the keys in the range from the key-value store. + // + // This RPC is intentionally gRPC-only and does not provide a + // grpc-gateway REST mapping, because streaming chunked responses + // are not a good fit for standard JSON/REST semantics. + RangeStream(*RangeRequest, grpc.ServerStreamingServer[RangeStreamResponse]) error + // Put puts the given key into the key-value store. + // A put request increments the revision of the key-value store + // and generates one event in the event history. + Put(context.Context, *PutRequest) (*PutResponse, error) + // DeleteRange deletes the given range from the key-value store. + // A delete request increments the revision of the key-value store + // and generates a delete event in the event history for every deleted key. + DeleteRange(context.Context, *DeleteRangeRequest) (*DeleteRangeResponse, error) + // Txn processes multiple requests in a single transaction. + // A txn request increments the revision of the key-value store + // and generates events with the same revision for every completed request. + // It is not allowed to modify the same key several times within one txn. + Txn(context.Context, *TxnRequest) (*TxnResponse, error) + // Compact compacts the event history in the etcd key-value store. The key-value + // store should be periodically compacted or the event history will continue to grow + // indefinitely. + Compact(context.Context, *CompactionRequest) (*CompactionResponse, error) + mustEmbedUnimplementedKVServer() +} + +// UnimplementedKVServer must 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 UnimplementedKVServer struct{} + +func (UnimplementedKVServer) Range(context.Context, *RangeRequest) (*RangeResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Range not implemented") +} +func (UnimplementedKVServer) RangeStream(*RangeRequest, grpc.ServerStreamingServer[RangeStreamResponse]) error { + return status.Error(codes.Unimplemented, "method RangeStream not implemented") +} +func (UnimplementedKVServer) Put(context.Context, *PutRequest) (*PutResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Put not implemented") +} +func (UnimplementedKVServer) DeleteRange(context.Context, *DeleteRangeRequest) (*DeleteRangeResponse, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteRange not implemented") +} +func (UnimplementedKVServer) Txn(context.Context, *TxnRequest) (*TxnResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Txn not implemented") +} +func (UnimplementedKVServer) Compact(context.Context, *CompactionRequest) (*CompactionResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Compact not implemented") +} +func (UnimplementedKVServer) mustEmbedUnimplementedKVServer() {} +func (UnimplementedKVServer) testEmbeddedByValue() {} + +// UnsafeKVServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to KVServer will +// result in compilation errors. +type UnsafeKVServer interface { + mustEmbedUnimplementedKVServer() +} + +func RegisterKVServer(s grpc.ServiceRegistrar, srv KVServer) { + // If the following call panics, it indicates UnimplementedKVServer 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(&KV_ServiceDesc, srv) +} + +func _KV_Range_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RangeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KVServer).Range(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: KV_Range_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KVServer).Range(ctx, req.(*RangeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _KV_RangeStream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(RangeRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(KVServer).RangeStream(m, &grpc.GenericServerStream[RangeRequest, RangeStreamResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type KV_RangeStreamServer = grpc.ServerStreamingServer[RangeStreamResponse] + +func _KV_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PutRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KVServer).Put(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: KV_Put_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KVServer).Put(ctx, req.(*PutRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _KV_DeleteRange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRangeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KVServer).DeleteRange(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: KV_DeleteRange_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KVServer).DeleteRange(ctx, req.(*DeleteRangeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _KV_Txn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TxnRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KVServer).Txn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: KV_Txn_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KVServer).Txn(ctx, req.(*TxnRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _KV_Compact_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CompactionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KVServer).Compact(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: KV_Compact_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KVServer).Compact(ctx, req.(*CompactionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// KV_ServiceDesc is the grpc.ServiceDesc for KV service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var KV_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "etcdserverpb.KV", + HandlerType: (*KVServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Range", + Handler: _KV_Range_Handler, + }, + { + MethodName: "Put", + Handler: _KV_Put_Handler, + }, + { + MethodName: "DeleteRange", + Handler: _KV_DeleteRange_Handler, + }, + { + MethodName: "Txn", + Handler: _KV_Txn_Handler, + }, + { + MethodName: "Compact", + Handler: _KV_Compact_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "RangeStream", + Handler: _KV_RangeStream_Handler, + ServerStreams: true, + }, + }, + Metadata: "rpc.proto", +} + +const ( + Watch_Watch_FullMethodName = "/etcdserverpb.Watch/Watch" +) + +// WatchClient is the client API for Watch service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type WatchClient interface { + // Watch watches for events happening or that have happened. Both input and output + // are streams; the input stream is for creating and canceling watchers and the output + // stream sends events. One watch RPC can watch on multiple key ranges, streaming events + // for several watches at once. The entire event history can be watched starting from the + // last compaction revision. + Watch(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[WatchRequest, WatchResponse], error) +} + +type watchClient struct { + cc grpc.ClientConnInterface +} + +func NewWatchClient(cc grpc.ClientConnInterface) WatchClient { + return &watchClient{cc} +} + +func (c *watchClient) Watch(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[WatchRequest, WatchResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &Watch_ServiceDesc.Streams[0], Watch_Watch_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[WatchRequest, WatchResponse]{ClientStream: stream} + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Watch_WatchClient = grpc.BidiStreamingClient[WatchRequest, WatchResponse] + +// WatchServer is the server API for Watch service. +// All implementations must embed UnimplementedWatchServer +// for forward compatibility. +type WatchServer interface { + // Watch watches for events happening or that have happened. Both input and output + // are streams; the input stream is for creating and canceling watchers and the output + // stream sends events. One watch RPC can watch on multiple key ranges, streaming events + // for several watches at once. The entire event history can be watched starting from the + // last compaction revision. + Watch(grpc.BidiStreamingServer[WatchRequest, WatchResponse]) error + mustEmbedUnimplementedWatchServer() +} + +// UnimplementedWatchServer must 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 UnimplementedWatchServer struct{} + +func (UnimplementedWatchServer) Watch(grpc.BidiStreamingServer[WatchRequest, WatchResponse]) error { + return status.Error(codes.Unimplemented, "method Watch not implemented") +} +func (UnimplementedWatchServer) mustEmbedUnimplementedWatchServer() {} +func (UnimplementedWatchServer) testEmbeddedByValue() {} + +// UnsafeWatchServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to WatchServer will +// result in compilation errors. +type UnsafeWatchServer interface { + mustEmbedUnimplementedWatchServer() +} + +func RegisterWatchServer(s grpc.ServiceRegistrar, srv WatchServer) { + // If the following call panics, it indicates UnimplementedWatchServer 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(&Watch_ServiceDesc, srv) +} + +func _Watch_Watch_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(WatchServer).Watch(&grpc.GenericServerStream[WatchRequest, WatchResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Watch_WatchServer = grpc.BidiStreamingServer[WatchRequest, WatchResponse] + +// Watch_ServiceDesc is the grpc.ServiceDesc for Watch service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Watch_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "etcdserverpb.Watch", + HandlerType: (*WatchServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Watch", + Handler: _Watch_Watch_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "rpc.proto", +} + +const ( + Lease_LeaseGrant_FullMethodName = "/etcdserverpb.Lease/LeaseGrant" + Lease_LeaseRevoke_FullMethodName = "/etcdserverpb.Lease/LeaseRevoke" + Lease_LeaseKeepAlive_FullMethodName = "/etcdserverpb.Lease/LeaseKeepAlive" + Lease_LeaseTimeToLive_FullMethodName = "/etcdserverpb.Lease/LeaseTimeToLive" + Lease_LeaseLeases_FullMethodName = "/etcdserverpb.Lease/LeaseLeases" +) + +// LeaseClient is the client API for Lease service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type LeaseClient interface { + // LeaseGrant creates a lease which expires if the server does not receive a keepAlive + // within a given time to live period. All keys attached to the lease will be expired and + // deleted if the lease expires. Each expired key generates a delete event in the event history. + LeaseGrant(ctx context.Context, in *LeaseGrantRequest, opts ...grpc.CallOption) (*LeaseGrantResponse, error) + // LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted. + LeaseRevoke(ctx context.Context, in *LeaseRevokeRequest, opts ...grpc.CallOption) (*LeaseRevokeResponse, error) + // LeaseKeepAlive keeps the lease alive by streaming keep alive requests from the client + // to the server and streaming keep alive responses from the server to the client. + LeaseKeepAlive(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[LeaseKeepAliveRequest, LeaseKeepAliveResponse], error) + // LeaseTimeToLive retrieves lease information. + LeaseTimeToLive(ctx context.Context, in *LeaseTimeToLiveRequest, opts ...grpc.CallOption) (*LeaseTimeToLiveResponse, error) + // LeaseLeases lists all existing leases. + LeaseLeases(ctx context.Context, in *LeaseLeasesRequest, opts ...grpc.CallOption) (*LeaseLeasesResponse, error) +} + +type leaseClient struct { + cc grpc.ClientConnInterface +} + +func NewLeaseClient(cc grpc.ClientConnInterface) LeaseClient { + return &leaseClient{cc} +} + +func (c *leaseClient) LeaseGrant(ctx context.Context, in *LeaseGrantRequest, opts ...grpc.CallOption) (*LeaseGrantResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LeaseGrantResponse) + err := c.cc.Invoke(ctx, Lease_LeaseGrant_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *leaseClient) LeaseRevoke(ctx context.Context, in *LeaseRevokeRequest, opts ...grpc.CallOption) (*LeaseRevokeResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LeaseRevokeResponse) + err := c.cc.Invoke(ctx, Lease_LeaseRevoke_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *leaseClient) LeaseKeepAlive(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[LeaseKeepAliveRequest, LeaseKeepAliveResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &Lease_ServiceDesc.Streams[0], Lease_LeaseKeepAlive_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[LeaseKeepAliveRequest, LeaseKeepAliveResponse]{ClientStream: stream} + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Lease_LeaseKeepAliveClient = grpc.BidiStreamingClient[LeaseKeepAliveRequest, LeaseKeepAliveResponse] + +func (c *leaseClient) LeaseTimeToLive(ctx context.Context, in *LeaseTimeToLiveRequest, opts ...grpc.CallOption) (*LeaseTimeToLiveResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LeaseTimeToLiveResponse) + err := c.cc.Invoke(ctx, Lease_LeaseTimeToLive_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *leaseClient) LeaseLeases(ctx context.Context, in *LeaseLeasesRequest, opts ...grpc.CallOption) (*LeaseLeasesResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LeaseLeasesResponse) + err := c.cc.Invoke(ctx, Lease_LeaseLeases_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// LeaseServer is the server API for Lease service. +// All implementations must embed UnimplementedLeaseServer +// for forward compatibility. +type LeaseServer interface { + // LeaseGrant creates a lease which expires if the server does not receive a keepAlive + // within a given time to live period. All keys attached to the lease will be expired and + // deleted if the lease expires. Each expired key generates a delete event in the event history. + LeaseGrant(context.Context, *LeaseGrantRequest) (*LeaseGrantResponse, error) + // LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted. + LeaseRevoke(context.Context, *LeaseRevokeRequest) (*LeaseRevokeResponse, error) + // LeaseKeepAlive keeps the lease alive by streaming keep alive requests from the client + // to the server and streaming keep alive responses from the server to the client. + LeaseKeepAlive(grpc.BidiStreamingServer[LeaseKeepAliveRequest, LeaseKeepAliveResponse]) error + // LeaseTimeToLive retrieves lease information. + LeaseTimeToLive(context.Context, *LeaseTimeToLiveRequest) (*LeaseTimeToLiveResponse, error) + // LeaseLeases lists all existing leases. + LeaseLeases(context.Context, *LeaseLeasesRequest) (*LeaseLeasesResponse, error) + mustEmbedUnimplementedLeaseServer() +} + +// UnimplementedLeaseServer must 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 UnimplementedLeaseServer struct{} + +func (UnimplementedLeaseServer) LeaseGrant(context.Context, *LeaseGrantRequest) (*LeaseGrantResponse, error) { + return nil, status.Error(codes.Unimplemented, "method LeaseGrant not implemented") +} +func (UnimplementedLeaseServer) LeaseRevoke(context.Context, *LeaseRevokeRequest) (*LeaseRevokeResponse, error) { + return nil, status.Error(codes.Unimplemented, "method LeaseRevoke not implemented") +} +func (UnimplementedLeaseServer) LeaseKeepAlive(grpc.BidiStreamingServer[LeaseKeepAliveRequest, LeaseKeepAliveResponse]) error { + return status.Error(codes.Unimplemented, "method LeaseKeepAlive not implemented") +} +func (UnimplementedLeaseServer) LeaseTimeToLive(context.Context, *LeaseTimeToLiveRequest) (*LeaseTimeToLiveResponse, error) { + return nil, status.Error(codes.Unimplemented, "method LeaseTimeToLive not implemented") +} +func (UnimplementedLeaseServer) LeaseLeases(context.Context, *LeaseLeasesRequest) (*LeaseLeasesResponse, error) { + return nil, status.Error(codes.Unimplemented, "method LeaseLeases not implemented") +} +func (UnimplementedLeaseServer) mustEmbedUnimplementedLeaseServer() {} +func (UnimplementedLeaseServer) testEmbeddedByValue() {} + +// UnsafeLeaseServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to LeaseServer will +// result in compilation errors. +type UnsafeLeaseServer interface { + mustEmbedUnimplementedLeaseServer() +} + +func RegisterLeaseServer(s grpc.ServiceRegistrar, srv LeaseServer) { + // If the following call panics, it indicates UnimplementedLeaseServer 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(&Lease_ServiceDesc, srv) +} + +func _Lease_LeaseGrant_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LeaseGrantRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LeaseServer).LeaseGrant(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Lease_LeaseGrant_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LeaseServer).LeaseGrant(ctx, req.(*LeaseGrantRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Lease_LeaseRevoke_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LeaseRevokeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LeaseServer).LeaseRevoke(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Lease_LeaseRevoke_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LeaseServer).LeaseRevoke(ctx, req.(*LeaseRevokeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Lease_LeaseKeepAlive_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(LeaseServer).LeaseKeepAlive(&grpc.GenericServerStream[LeaseKeepAliveRequest, LeaseKeepAliveResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Lease_LeaseKeepAliveServer = grpc.BidiStreamingServer[LeaseKeepAliveRequest, LeaseKeepAliveResponse] + +func _Lease_LeaseTimeToLive_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LeaseTimeToLiveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LeaseServer).LeaseTimeToLive(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Lease_LeaseTimeToLive_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LeaseServer).LeaseTimeToLive(ctx, req.(*LeaseTimeToLiveRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Lease_LeaseLeases_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LeaseLeasesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LeaseServer).LeaseLeases(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Lease_LeaseLeases_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LeaseServer).LeaseLeases(ctx, req.(*LeaseLeasesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Lease_ServiceDesc is the grpc.ServiceDesc for Lease service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Lease_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "etcdserverpb.Lease", + HandlerType: (*LeaseServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "LeaseGrant", + Handler: _Lease_LeaseGrant_Handler, + }, + { + MethodName: "LeaseRevoke", + Handler: _Lease_LeaseRevoke_Handler, + }, + { + MethodName: "LeaseTimeToLive", + Handler: _Lease_LeaseTimeToLive_Handler, + }, + { + MethodName: "LeaseLeases", + Handler: _Lease_LeaseLeases_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "LeaseKeepAlive", + Handler: _Lease_LeaseKeepAlive_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "rpc.proto", +} + +const ( + Cluster_MemberAdd_FullMethodName = "/etcdserverpb.Cluster/MemberAdd" + Cluster_MemberRemove_FullMethodName = "/etcdserverpb.Cluster/MemberRemove" + Cluster_MemberUpdate_FullMethodName = "/etcdserverpb.Cluster/MemberUpdate" + Cluster_MemberList_FullMethodName = "/etcdserverpb.Cluster/MemberList" + Cluster_MemberPromote_FullMethodName = "/etcdserverpb.Cluster/MemberPromote" +) + +// ClusterClient is the client API for Cluster service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ClusterClient interface { + // MemberAdd adds a member into the cluster. + MemberAdd(ctx context.Context, in *MemberAddRequest, opts ...grpc.CallOption) (*MemberAddResponse, error) + // MemberRemove removes an existing member from the cluster. + MemberRemove(ctx context.Context, in *MemberRemoveRequest, opts ...grpc.CallOption) (*MemberRemoveResponse, error) + // MemberUpdate updates the member configuration. + MemberUpdate(ctx context.Context, in *MemberUpdateRequest, opts ...grpc.CallOption) (*MemberUpdateResponse, error) + // MemberList lists all the members in the cluster. + MemberList(ctx context.Context, in *MemberListRequest, opts ...grpc.CallOption) (*MemberListResponse, error) + // MemberPromote promotes a member from raft learner (non-voting) to raft voting member. + MemberPromote(ctx context.Context, in *MemberPromoteRequest, opts ...grpc.CallOption) (*MemberPromoteResponse, error) +} + +type clusterClient struct { + cc grpc.ClientConnInterface +} + +func NewClusterClient(cc grpc.ClientConnInterface) ClusterClient { + return &clusterClient{cc} +} + +func (c *clusterClient) MemberAdd(ctx context.Context, in *MemberAddRequest, opts ...grpc.CallOption) (*MemberAddResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MemberAddResponse) + err := c.cc.Invoke(ctx, Cluster_MemberAdd_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *clusterClient) MemberRemove(ctx context.Context, in *MemberRemoveRequest, opts ...grpc.CallOption) (*MemberRemoveResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MemberRemoveResponse) + err := c.cc.Invoke(ctx, Cluster_MemberRemove_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *clusterClient) MemberUpdate(ctx context.Context, in *MemberUpdateRequest, opts ...grpc.CallOption) (*MemberUpdateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MemberUpdateResponse) + err := c.cc.Invoke(ctx, Cluster_MemberUpdate_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *clusterClient) MemberList(ctx context.Context, in *MemberListRequest, opts ...grpc.CallOption) (*MemberListResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MemberListResponse) + err := c.cc.Invoke(ctx, Cluster_MemberList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *clusterClient) MemberPromote(ctx context.Context, in *MemberPromoteRequest, opts ...grpc.CallOption) (*MemberPromoteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MemberPromoteResponse) + err := c.cc.Invoke(ctx, Cluster_MemberPromote_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ClusterServer is the server API for Cluster service. +// All implementations must embed UnimplementedClusterServer +// for forward compatibility. +type ClusterServer interface { + // MemberAdd adds a member into the cluster. + MemberAdd(context.Context, *MemberAddRequest) (*MemberAddResponse, error) + // MemberRemove removes an existing member from the cluster. + MemberRemove(context.Context, *MemberRemoveRequest) (*MemberRemoveResponse, error) + // MemberUpdate updates the member configuration. + MemberUpdate(context.Context, *MemberUpdateRequest) (*MemberUpdateResponse, error) + // MemberList lists all the members in the cluster. + MemberList(context.Context, *MemberListRequest) (*MemberListResponse, error) + // MemberPromote promotes a member from raft learner (non-voting) to raft voting member. + MemberPromote(context.Context, *MemberPromoteRequest) (*MemberPromoteResponse, error) + mustEmbedUnimplementedClusterServer() +} + +// UnimplementedClusterServer must 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 UnimplementedClusterServer struct{} + +func (UnimplementedClusterServer) MemberAdd(context.Context, *MemberAddRequest) (*MemberAddResponse, error) { + return nil, status.Error(codes.Unimplemented, "method MemberAdd not implemented") +} +func (UnimplementedClusterServer) MemberRemove(context.Context, *MemberRemoveRequest) (*MemberRemoveResponse, error) { + return nil, status.Error(codes.Unimplemented, "method MemberRemove not implemented") +} +func (UnimplementedClusterServer) MemberUpdate(context.Context, *MemberUpdateRequest) (*MemberUpdateResponse, error) { + return nil, status.Error(codes.Unimplemented, "method MemberUpdate not implemented") +} +func (UnimplementedClusterServer) MemberList(context.Context, *MemberListRequest) (*MemberListResponse, error) { + return nil, status.Error(codes.Unimplemented, "method MemberList not implemented") +} +func (UnimplementedClusterServer) MemberPromote(context.Context, *MemberPromoteRequest) (*MemberPromoteResponse, error) { + return nil, status.Error(codes.Unimplemented, "method MemberPromote not implemented") +} +func (UnimplementedClusterServer) mustEmbedUnimplementedClusterServer() {} +func (UnimplementedClusterServer) testEmbeddedByValue() {} + +// UnsafeClusterServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ClusterServer will +// result in compilation errors. +type UnsafeClusterServer interface { + mustEmbedUnimplementedClusterServer() +} + +func RegisterClusterServer(s grpc.ServiceRegistrar, srv ClusterServer) { + // If the following call panics, it indicates UnimplementedClusterServer 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(&Cluster_ServiceDesc, srv) +} + +func _Cluster_MemberAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MemberAddRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ClusterServer).MemberAdd(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Cluster_MemberAdd_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ClusterServer).MemberAdd(ctx, req.(*MemberAddRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Cluster_MemberRemove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MemberRemoveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ClusterServer).MemberRemove(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Cluster_MemberRemove_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ClusterServer).MemberRemove(ctx, req.(*MemberRemoveRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Cluster_MemberUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MemberUpdateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ClusterServer).MemberUpdate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Cluster_MemberUpdate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ClusterServer).MemberUpdate(ctx, req.(*MemberUpdateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Cluster_MemberList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MemberListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ClusterServer).MemberList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Cluster_MemberList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ClusterServer).MemberList(ctx, req.(*MemberListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Cluster_MemberPromote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MemberPromoteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ClusterServer).MemberPromote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Cluster_MemberPromote_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ClusterServer).MemberPromote(ctx, req.(*MemberPromoteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Cluster_ServiceDesc is the grpc.ServiceDesc for Cluster service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Cluster_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "etcdserverpb.Cluster", + HandlerType: (*ClusterServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "MemberAdd", + Handler: _Cluster_MemberAdd_Handler, + }, + { + MethodName: "MemberRemove", + Handler: _Cluster_MemberRemove_Handler, + }, + { + MethodName: "MemberUpdate", + Handler: _Cluster_MemberUpdate_Handler, + }, + { + MethodName: "MemberList", + Handler: _Cluster_MemberList_Handler, + }, + { + MethodName: "MemberPromote", + Handler: _Cluster_MemberPromote_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "rpc.proto", +} + +const ( + Maintenance_Alarm_FullMethodName = "/etcdserverpb.Maintenance/Alarm" + Maintenance_Status_FullMethodName = "/etcdserverpb.Maintenance/Status" + Maintenance_Defragment_FullMethodName = "/etcdserverpb.Maintenance/Defragment" + Maintenance_Hash_FullMethodName = "/etcdserverpb.Maintenance/Hash" + Maintenance_HashKV_FullMethodName = "/etcdserverpb.Maintenance/HashKV" + Maintenance_Snapshot_FullMethodName = "/etcdserverpb.Maintenance/Snapshot" + Maintenance_MoveLeader_FullMethodName = "/etcdserverpb.Maintenance/MoveLeader" + Maintenance_Downgrade_FullMethodName = "/etcdserverpb.Maintenance/Downgrade" +) + +// MaintenanceClient is the client API for Maintenance service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type MaintenanceClient interface { + // Alarm activates, deactivates, and queries alarms regarding cluster health. + Alarm(ctx context.Context, in *AlarmRequest, opts ...grpc.CallOption) (*AlarmResponse, error) + // Status gets the status of the member. + Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) + // Defragment defragments a member's backend database to recover storage space. + Defragment(ctx context.Context, in *DefragmentRequest, opts ...grpc.CallOption) (*DefragmentResponse, error) + // Hash computes the hash of whole backend keyspace, + // including key, lease, and other buckets in storage. + // This is designed for testing ONLY! + // Do not rely on this in production with ongoing transactions, + // since Hash operation does not hold MVCC locks. + // Use "HashKV" API instead for "key" bucket consistency checks. + Hash(ctx context.Context, in *HashRequest, opts ...grpc.CallOption) (*HashResponse, error) + // HashKV computes the hash of all MVCC keys up to a given revision. + // It only iterates "key" bucket in backend storage. + HashKV(ctx context.Context, in *HashKVRequest, opts ...grpc.CallOption) (*HashKVResponse, error) + // Snapshot sends a snapshot of the entire backend from a member over a stream to a client. + Snapshot(ctx context.Context, in *SnapshotRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SnapshotResponse], error) + // MoveLeader requests current leader node to transfer its leadership to transferee. + MoveLeader(ctx context.Context, in *MoveLeaderRequest, opts ...grpc.CallOption) (*MoveLeaderResponse, error) + // Downgrade requests downgrades, verifies feasibility or cancels downgrade + // on the cluster version. + // Supported since etcd 3.5. + Downgrade(ctx context.Context, in *DowngradeRequest, opts ...grpc.CallOption) (*DowngradeResponse, error) +} + +type maintenanceClient struct { + cc grpc.ClientConnInterface +} + +func NewMaintenanceClient(cc grpc.ClientConnInterface) MaintenanceClient { + return &maintenanceClient{cc} +} + +func (c *maintenanceClient) Alarm(ctx context.Context, in *AlarmRequest, opts ...grpc.CallOption) (*AlarmResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AlarmResponse) + err := c.cc.Invoke(ctx, Maintenance_Alarm_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *maintenanceClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(StatusResponse) + err := c.cc.Invoke(ctx, Maintenance_Status_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *maintenanceClient) Defragment(ctx context.Context, in *DefragmentRequest, opts ...grpc.CallOption) (*DefragmentResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DefragmentResponse) + err := c.cc.Invoke(ctx, Maintenance_Defragment_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *maintenanceClient) Hash(ctx context.Context, in *HashRequest, opts ...grpc.CallOption) (*HashResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(HashResponse) + err := c.cc.Invoke(ctx, Maintenance_Hash_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *maintenanceClient) HashKV(ctx context.Context, in *HashKVRequest, opts ...grpc.CallOption) (*HashKVResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(HashKVResponse) + err := c.cc.Invoke(ctx, Maintenance_HashKV_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *maintenanceClient) Snapshot(ctx context.Context, in *SnapshotRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SnapshotResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &Maintenance_ServiceDesc.Streams[0], Maintenance_Snapshot_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[SnapshotRequest, SnapshotResponse]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Maintenance_SnapshotClient = grpc.ServerStreamingClient[SnapshotResponse] + +func (c *maintenanceClient) MoveLeader(ctx context.Context, in *MoveLeaderRequest, opts ...grpc.CallOption) (*MoveLeaderResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MoveLeaderResponse) + err := c.cc.Invoke(ctx, Maintenance_MoveLeader_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *maintenanceClient) Downgrade(ctx context.Context, in *DowngradeRequest, opts ...grpc.CallOption) (*DowngradeResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DowngradeResponse) + err := c.cc.Invoke(ctx, Maintenance_Downgrade_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MaintenanceServer is the server API for Maintenance service. +// All implementations must embed UnimplementedMaintenanceServer +// for forward compatibility. +type MaintenanceServer interface { + // Alarm activates, deactivates, and queries alarms regarding cluster health. + Alarm(context.Context, *AlarmRequest) (*AlarmResponse, error) + // Status gets the status of the member. + Status(context.Context, *StatusRequest) (*StatusResponse, error) + // Defragment defragments a member's backend database to recover storage space. + Defragment(context.Context, *DefragmentRequest) (*DefragmentResponse, error) + // Hash computes the hash of whole backend keyspace, + // including key, lease, and other buckets in storage. + // This is designed for testing ONLY! + // Do not rely on this in production with ongoing transactions, + // since Hash operation does not hold MVCC locks. + // Use "HashKV" API instead for "key" bucket consistency checks. + Hash(context.Context, *HashRequest) (*HashResponse, error) + // HashKV computes the hash of all MVCC keys up to a given revision. + // It only iterates "key" bucket in backend storage. + HashKV(context.Context, *HashKVRequest) (*HashKVResponse, error) + // Snapshot sends a snapshot of the entire backend from a member over a stream to a client. + Snapshot(*SnapshotRequest, grpc.ServerStreamingServer[SnapshotResponse]) error + // MoveLeader requests current leader node to transfer its leadership to transferee. + MoveLeader(context.Context, *MoveLeaderRequest) (*MoveLeaderResponse, error) + // Downgrade requests downgrades, verifies feasibility or cancels downgrade + // on the cluster version. + // Supported since etcd 3.5. + Downgrade(context.Context, *DowngradeRequest) (*DowngradeResponse, error) + mustEmbedUnimplementedMaintenanceServer() +} + +// UnimplementedMaintenanceServer must 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 UnimplementedMaintenanceServer struct{} + +func (UnimplementedMaintenanceServer) Alarm(context.Context, *AlarmRequest) (*AlarmResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Alarm not implemented") +} +func (UnimplementedMaintenanceServer) Status(context.Context, *StatusRequest) (*StatusResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Status not implemented") +} +func (UnimplementedMaintenanceServer) Defragment(context.Context, *DefragmentRequest) (*DefragmentResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Defragment not implemented") +} +func (UnimplementedMaintenanceServer) Hash(context.Context, *HashRequest) (*HashResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Hash not implemented") +} +func (UnimplementedMaintenanceServer) HashKV(context.Context, *HashKVRequest) (*HashKVResponse, error) { + return nil, status.Error(codes.Unimplemented, "method HashKV not implemented") +} +func (UnimplementedMaintenanceServer) Snapshot(*SnapshotRequest, grpc.ServerStreamingServer[SnapshotResponse]) error { + return status.Error(codes.Unimplemented, "method Snapshot not implemented") +} +func (UnimplementedMaintenanceServer) MoveLeader(context.Context, *MoveLeaderRequest) (*MoveLeaderResponse, error) { + return nil, status.Error(codes.Unimplemented, "method MoveLeader not implemented") +} +func (UnimplementedMaintenanceServer) Downgrade(context.Context, *DowngradeRequest) (*DowngradeResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Downgrade not implemented") +} +func (UnimplementedMaintenanceServer) mustEmbedUnimplementedMaintenanceServer() {} +func (UnimplementedMaintenanceServer) testEmbeddedByValue() {} + +// UnsafeMaintenanceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to MaintenanceServer will +// result in compilation errors. +type UnsafeMaintenanceServer interface { + mustEmbedUnimplementedMaintenanceServer() +} + +func RegisterMaintenanceServer(s grpc.ServiceRegistrar, srv MaintenanceServer) { + // If the following call panics, it indicates UnimplementedMaintenanceServer 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(&Maintenance_ServiceDesc, srv) +} + +func _Maintenance_Alarm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AlarmRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MaintenanceServer).Alarm(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Maintenance_Alarm_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MaintenanceServer).Alarm(ctx, req.(*AlarmRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Maintenance_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MaintenanceServer).Status(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Maintenance_Status_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MaintenanceServer).Status(ctx, req.(*StatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Maintenance_Defragment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DefragmentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MaintenanceServer).Defragment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Maintenance_Defragment_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MaintenanceServer).Defragment(ctx, req.(*DefragmentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Maintenance_Hash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HashRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MaintenanceServer).Hash(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Maintenance_Hash_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MaintenanceServer).Hash(ctx, req.(*HashRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Maintenance_HashKV_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HashKVRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MaintenanceServer).HashKV(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Maintenance_HashKV_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MaintenanceServer).HashKV(ctx, req.(*HashKVRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Maintenance_Snapshot_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(SnapshotRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(MaintenanceServer).Snapshot(m, &grpc.GenericServerStream[SnapshotRequest, SnapshotResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Maintenance_SnapshotServer = grpc.ServerStreamingServer[SnapshotResponse] + +func _Maintenance_MoveLeader_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MoveLeaderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MaintenanceServer).MoveLeader(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Maintenance_MoveLeader_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MaintenanceServer).MoveLeader(ctx, req.(*MoveLeaderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Maintenance_Downgrade_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DowngradeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MaintenanceServer).Downgrade(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Maintenance_Downgrade_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MaintenanceServer).Downgrade(ctx, req.(*DowngradeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Maintenance_ServiceDesc is the grpc.ServiceDesc for Maintenance service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Maintenance_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "etcdserverpb.Maintenance", + HandlerType: (*MaintenanceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Alarm", + Handler: _Maintenance_Alarm_Handler, + }, + { + MethodName: "Status", + Handler: _Maintenance_Status_Handler, + }, + { + MethodName: "Defragment", + Handler: _Maintenance_Defragment_Handler, + }, + { + MethodName: "Hash", + Handler: _Maintenance_Hash_Handler, + }, + { + MethodName: "HashKV", + Handler: _Maintenance_HashKV_Handler, + }, + { + MethodName: "MoveLeader", + Handler: _Maintenance_MoveLeader_Handler, + }, + { + MethodName: "Downgrade", + Handler: _Maintenance_Downgrade_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Snapshot", + Handler: _Maintenance_Snapshot_Handler, + ServerStreams: true, + }, + }, + Metadata: "rpc.proto", +} + +const ( + Auth_AuthEnable_FullMethodName = "/etcdserverpb.Auth/AuthEnable" + Auth_AuthDisable_FullMethodName = "/etcdserverpb.Auth/AuthDisable" + Auth_AuthStatus_FullMethodName = "/etcdserverpb.Auth/AuthStatus" + Auth_Authenticate_FullMethodName = "/etcdserverpb.Auth/Authenticate" + Auth_UserAdd_FullMethodName = "/etcdserverpb.Auth/UserAdd" + Auth_UserGet_FullMethodName = "/etcdserverpb.Auth/UserGet" + Auth_UserList_FullMethodName = "/etcdserverpb.Auth/UserList" + Auth_UserDelete_FullMethodName = "/etcdserverpb.Auth/UserDelete" + Auth_UserChangePassword_FullMethodName = "/etcdserverpb.Auth/UserChangePassword" + Auth_UserGrantRole_FullMethodName = "/etcdserverpb.Auth/UserGrantRole" + Auth_UserRevokeRole_FullMethodName = "/etcdserverpb.Auth/UserRevokeRole" + Auth_RoleAdd_FullMethodName = "/etcdserverpb.Auth/RoleAdd" + Auth_RoleGet_FullMethodName = "/etcdserverpb.Auth/RoleGet" + Auth_RoleList_FullMethodName = "/etcdserverpb.Auth/RoleList" + Auth_RoleDelete_FullMethodName = "/etcdserverpb.Auth/RoleDelete" + Auth_RoleGrantPermission_FullMethodName = "/etcdserverpb.Auth/RoleGrantPermission" + Auth_RoleRevokePermission_FullMethodName = "/etcdserverpb.Auth/RoleRevokePermission" +) + +// AuthClient is the client API for Auth service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type AuthClient interface { + // AuthEnable enables authentication. + AuthEnable(ctx context.Context, in *AuthEnableRequest, opts ...grpc.CallOption) (*AuthEnableResponse, error) + // AuthDisable disables authentication. + AuthDisable(ctx context.Context, in *AuthDisableRequest, opts ...grpc.CallOption) (*AuthDisableResponse, error) + // AuthStatus displays authentication status. + AuthStatus(ctx context.Context, in *AuthStatusRequest, opts ...grpc.CallOption) (*AuthStatusResponse, error) + // Authenticate processes an authenticate request. + Authenticate(ctx context.Context, in *AuthenticateRequest, opts ...grpc.CallOption) (*AuthenticateResponse, error) + // UserAdd adds a new user. User name cannot be empty. + UserAdd(ctx context.Context, in *AuthUserAddRequest, opts ...grpc.CallOption) (*AuthUserAddResponse, error) + // UserGet gets detailed user information. + UserGet(ctx context.Context, in *AuthUserGetRequest, opts ...grpc.CallOption) (*AuthUserGetResponse, error) + // UserList gets a list of all users. + UserList(ctx context.Context, in *AuthUserListRequest, opts ...grpc.CallOption) (*AuthUserListResponse, error) + // UserDelete deletes a specified user. + UserDelete(ctx context.Context, in *AuthUserDeleteRequest, opts ...grpc.CallOption) (*AuthUserDeleteResponse, error) + // UserChangePassword changes the password of a specified user. + UserChangePassword(ctx context.Context, in *AuthUserChangePasswordRequest, opts ...grpc.CallOption) (*AuthUserChangePasswordResponse, error) + // UserGrantRole grants a role to a specified user. + UserGrantRole(ctx context.Context, in *AuthUserGrantRoleRequest, opts ...grpc.CallOption) (*AuthUserGrantRoleResponse, error) + // UserRevokeRole revokes a role of specified user. + UserRevokeRole(ctx context.Context, in *AuthUserRevokeRoleRequest, opts ...grpc.CallOption) (*AuthUserRevokeRoleResponse, error) + // RoleAdd adds a new role. Role name cannot be empty. + RoleAdd(ctx context.Context, in *AuthRoleAddRequest, opts ...grpc.CallOption) (*AuthRoleAddResponse, error) + // RoleGet gets detailed role information. + RoleGet(ctx context.Context, in *AuthRoleGetRequest, opts ...grpc.CallOption) (*AuthRoleGetResponse, error) + // RoleList gets lists of all roles. + RoleList(ctx context.Context, in *AuthRoleListRequest, opts ...grpc.CallOption) (*AuthRoleListResponse, error) + // RoleDelete deletes a specified role. + RoleDelete(ctx context.Context, in *AuthRoleDeleteRequest, opts ...grpc.CallOption) (*AuthRoleDeleteResponse, error) + // RoleGrantPermission grants a permission of a specified key or range to a specified role. + RoleGrantPermission(ctx context.Context, in *AuthRoleGrantPermissionRequest, opts ...grpc.CallOption) (*AuthRoleGrantPermissionResponse, error) + // RoleRevokePermission revokes a key or range permission of a specified role. + RoleRevokePermission(ctx context.Context, in *AuthRoleRevokePermissionRequest, opts ...grpc.CallOption) (*AuthRoleRevokePermissionResponse, error) +} + +type authClient struct { + cc grpc.ClientConnInterface +} + +func NewAuthClient(cc grpc.ClientConnInterface) AuthClient { + return &authClient{cc} +} + +func (c *authClient) AuthEnable(ctx context.Context, in *AuthEnableRequest, opts ...grpc.CallOption) (*AuthEnableResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthEnableResponse) + err := c.cc.Invoke(ctx, Auth_AuthEnable_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authClient) AuthDisable(ctx context.Context, in *AuthDisableRequest, opts ...grpc.CallOption) (*AuthDisableResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthDisableResponse) + err := c.cc.Invoke(ctx, Auth_AuthDisable_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authClient) AuthStatus(ctx context.Context, in *AuthStatusRequest, opts ...grpc.CallOption) (*AuthStatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthStatusResponse) + err := c.cc.Invoke(ctx, Auth_AuthStatus_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authClient) Authenticate(ctx context.Context, in *AuthenticateRequest, opts ...grpc.CallOption) (*AuthenticateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthenticateResponse) + err := c.cc.Invoke(ctx, Auth_Authenticate_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authClient) UserAdd(ctx context.Context, in *AuthUserAddRequest, opts ...grpc.CallOption) (*AuthUserAddResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthUserAddResponse) + err := c.cc.Invoke(ctx, Auth_UserAdd_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authClient) UserGet(ctx context.Context, in *AuthUserGetRequest, opts ...grpc.CallOption) (*AuthUserGetResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthUserGetResponse) + err := c.cc.Invoke(ctx, Auth_UserGet_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authClient) UserList(ctx context.Context, in *AuthUserListRequest, opts ...grpc.CallOption) (*AuthUserListResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthUserListResponse) + err := c.cc.Invoke(ctx, Auth_UserList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authClient) UserDelete(ctx context.Context, in *AuthUserDeleteRequest, opts ...grpc.CallOption) (*AuthUserDeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthUserDeleteResponse) + err := c.cc.Invoke(ctx, Auth_UserDelete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authClient) UserChangePassword(ctx context.Context, in *AuthUserChangePasswordRequest, opts ...grpc.CallOption) (*AuthUserChangePasswordResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthUserChangePasswordResponse) + err := c.cc.Invoke(ctx, Auth_UserChangePassword_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authClient) UserGrantRole(ctx context.Context, in *AuthUserGrantRoleRequest, opts ...grpc.CallOption) (*AuthUserGrantRoleResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthUserGrantRoleResponse) + err := c.cc.Invoke(ctx, Auth_UserGrantRole_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authClient) UserRevokeRole(ctx context.Context, in *AuthUserRevokeRoleRequest, opts ...grpc.CallOption) (*AuthUserRevokeRoleResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthUserRevokeRoleResponse) + err := c.cc.Invoke(ctx, Auth_UserRevokeRole_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authClient) RoleAdd(ctx context.Context, in *AuthRoleAddRequest, opts ...grpc.CallOption) (*AuthRoleAddResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthRoleAddResponse) + err := c.cc.Invoke(ctx, Auth_RoleAdd_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authClient) RoleGet(ctx context.Context, in *AuthRoleGetRequest, opts ...grpc.CallOption) (*AuthRoleGetResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthRoleGetResponse) + err := c.cc.Invoke(ctx, Auth_RoleGet_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authClient) RoleList(ctx context.Context, in *AuthRoleListRequest, opts ...grpc.CallOption) (*AuthRoleListResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthRoleListResponse) + err := c.cc.Invoke(ctx, Auth_RoleList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authClient) RoleDelete(ctx context.Context, in *AuthRoleDeleteRequest, opts ...grpc.CallOption) (*AuthRoleDeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthRoleDeleteResponse) + err := c.cc.Invoke(ctx, Auth_RoleDelete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authClient) RoleGrantPermission(ctx context.Context, in *AuthRoleGrantPermissionRequest, opts ...grpc.CallOption) (*AuthRoleGrantPermissionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthRoleGrantPermissionResponse) + err := c.cc.Invoke(ctx, Auth_RoleGrantPermission_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authClient) RoleRevokePermission(ctx context.Context, in *AuthRoleRevokePermissionRequest, opts ...grpc.CallOption) (*AuthRoleRevokePermissionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthRoleRevokePermissionResponse) + err := c.cc.Invoke(ctx, Auth_RoleRevokePermission_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AuthServer is the server API for Auth service. +// All implementations must embed UnimplementedAuthServer +// for forward compatibility. +type AuthServer interface { + // AuthEnable enables authentication. + AuthEnable(context.Context, *AuthEnableRequest) (*AuthEnableResponse, error) + // AuthDisable disables authentication. + AuthDisable(context.Context, *AuthDisableRequest) (*AuthDisableResponse, error) + // AuthStatus displays authentication status. + AuthStatus(context.Context, *AuthStatusRequest) (*AuthStatusResponse, error) + // Authenticate processes an authenticate request. + Authenticate(context.Context, *AuthenticateRequest) (*AuthenticateResponse, error) + // UserAdd adds a new user. User name cannot be empty. + UserAdd(context.Context, *AuthUserAddRequest) (*AuthUserAddResponse, error) + // UserGet gets detailed user information. + UserGet(context.Context, *AuthUserGetRequest) (*AuthUserGetResponse, error) + // UserList gets a list of all users. + UserList(context.Context, *AuthUserListRequest) (*AuthUserListResponse, error) + // UserDelete deletes a specified user. + UserDelete(context.Context, *AuthUserDeleteRequest) (*AuthUserDeleteResponse, error) + // UserChangePassword changes the password of a specified user. + UserChangePassword(context.Context, *AuthUserChangePasswordRequest) (*AuthUserChangePasswordResponse, error) + // UserGrantRole grants a role to a specified user. + UserGrantRole(context.Context, *AuthUserGrantRoleRequest) (*AuthUserGrantRoleResponse, error) + // UserRevokeRole revokes a role of specified user. + UserRevokeRole(context.Context, *AuthUserRevokeRoleRequest) (*AuthUserRevokeRoleResponse, error) + // RoleAdd adds a new role. Role name cannot be empty. + RoleAdd(context.Context, *AuthRoleAddRequest) (*AuthRoleAddResponse, error) + // RoleGet gets detailed role information. + RoleGet(context.Context, *AuthRoleGetRequest) (*AuthRoleGetResponse, error) + // RoleList gets lists of all roles. + RoleList(context.Context, *AuthRoleListRequest) (*AuthRoleListResponse, error) + // RoleDelete deletes a specified role. + RoleDelete(context.Context, *AuthRoleDeleteRequest) (*AuthRoleDeleteResponse, error) + // RoleGrantPermission grants a permission of a specified key or range to a specified role. + RoleGrantPermission(context.Context, *AuthRoleGrantPermissionRequest) (*AuthRoleGrantPermissionResponse, error) + // RoleRevokePermission revokes a key or range permission of a specified role. + RoleRevokePermission(context.Context, *AuthRoleRevokePermissionRequest) (*AuthRoleRevokePermissionResponse, error) + mustEmbedUnimplementedAuthServer() +} + +// UnimplementedAuthServer must 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 UnimplementedAuthServer struct{} + +func (UnimplementedAuthServer) AuthEnable(context.Context, *AuthEnableRequest) (*AuthEnableResponse, error) { + return nil, status.Error(codes.Unimplemented, "method AuthEnable not implemented") +} +func (UnimplementedAuthServer) AuthDisable(context.Context, *AuthDisableRequest) (*AuthDisableResponse, error) { + return nil, status.Error(codes.Unimplemented, "method AuthDisable not implemented") +} +func (UnimplementedAuthServer) AuthStatus(context.Context, *AuthStatusRequest) (*AuthStatusResponse, error) { + return nil, status.Error(codes.Unimplemented, "method AuthStatus not implemented") +} +func (UnimplementedAuthServer) Authenticate(context.Context, *AuthenticateRequest) (*AuthenticateResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Authenticate not implemented") +} +func (UnimplementedAuthServer) UserAdd(context.Context, *AuthUserAddRequest) (*AuthUserAddResponse, error) { + return nil, status.Error(codes.Unimplemented, "method UserAdd not implemented") +} +func (UnimplementedAuthServer) UserGet(context.Context, *AuthUserGetRequest) (*AuthUserGetResponse, error) { + return nil, status.Error(codes.Unimplemented, "method UserGet not implemented") +} +func (UnimplementedAuthServer) UserList(context.Context, *AuthUserListRequest) (*AuthUserListResponse, error) { + return nil, status.Error(codes.Unimplemented, "method UserList not implemented") +} +func (UnimplementedAuthServer) UserDelete(context.Context, *AuthUserDeleteRequest) (*AuthUserDeleteResponse, error) { + return nil, status.Error(codes.Unimplemented, "method UserDelete not implemented") +} +func (UnimplementedAuthServer) UserChangePassword(context.Context, *AuthUserChangePasswordRequest) (*AuthUserChangePasswordResponse, error) { + return nil, status.Error(codes.Unimplemented, "method UserChangePassword not implemented") +} +func (UnimplementedAuthServer) UserGrantRole(context.Context, *AuthUserGrantRoleRequest) (*AuthUserGrantRoleResponse, error) { + return nil, status.Error(codes.Unimplemented, "method UserGrantRole not implemented") +} +func (UnimplementedAuthServer) UserRevokeRole(context.Context, *AuthUserRevokeRoleRequest) (*AuthUserRevokeRoleResponse, error) { + return nil, status.Error(codes.Unimplemented, "method UserRevokeRole not implemented") +} +func (UnimplementedAuthServer) RoleAdd(context.Context, *AuthRoleAddRequest) (*AuthRoleAddResponse, error) { + return nil, status.Error(codes.Unimplemented, "method RoleAdd not implemented") +} +func (UnimplementedAuthServer) RoleGet(context.Context, *AuthRoleGetRequest) (*AuthRoleGetResponse, error) { + return nil, status.Error(codes.Unimplemented, "method RoleGet not implemented") +} +func (UnimplementedAuthServer) RoleList(context.Context, *AuthRoleListRequest) (*AuthRoleListResponse, error) { + return nil, status.Error(codes.Unimplemented, "method RoleList not implemented") +} +func (UnimplementedAuthServer) RoleDelete(context.Context, *AuthRoleDeleteRequest) (*AuthRoleDeleteResponse, error) { + return nil, status.Error(codes.Unimplemented, "method RoleDelete not implemented") +} +func (UnimplementedAuthServer) RoleGrantPermission(context.Context, *AuthRoleGrantPermissionRequest) (*AuthRoleGrantPermissionResponse, error) { + return nil, status.Error(codes.Unimplemented, "method RoleGrantPermission not implemented") +} +func (UnimplementedAuthServer) RoleRevokePermission(context.Context, *AuthRoleRevokePermissionRequest) (*AuthRoleRevokePermissionResponse, error) { + return nil, status.Error(codes.Unimplemented, "method RoleRevokePermission not implemented") +} +func (UnimplementedAuthServer) mustEmbedUnimplementedAuthServer() {} +func (UnimplementedAuthServer) testEmbeddedByValue() {} + +// UnsafeAuthServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AuthServer will +// result in compilation errors. +type UnsafeAuthServer interface { + mustEmbedUnimplementedAuthServer() +} + +func RegisterAuthServer(s grpc.ServiceRegistrar, srv AuthServer) { + // If the following call panics, it indicates UnimplementedAuthServer 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(&Auth_ServiceDesc, srv) +} + +func _Auth_AuthEnable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthEnableRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServer).AuthEnable(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Auth_AuthEnable_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServer).AuthEnable(ctx, req.(*AuthEnableRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Auth_AuthDisable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthDisableRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServer).AuthDisable(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Auth_AuthDisable_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServer).AuthDisable(ctx, req.(*AuthDisableRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Auth_AuthStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServer).AuthStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Auth_AuthStatus_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServer).AuthStatus(ctx, req.(*AuthStatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Auth_Authenticate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthenticateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServer).Authenticate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Auth_Authenticate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServer).Authenticate(ctx, req.(*AuthenticateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Auth_UserAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthUserAddRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServer).UserAdd(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Auth_UserAdd_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServer).UserAdd(ctx, req.(*AuthUserAddRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Auth_UserGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthUserGetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServer).UserGet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Auth_UserGet_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServer).UserGet(ctx, req.(*AuthUserGetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Auth_UserList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthUserListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServer).UserList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Auth_UserList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServer).UserList(ctx, req.(*AuthUserListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Auth_UserDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthUserDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServer).UserDelete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Auth_UserDelete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServer).UserDelete(ctx, req.(*AuthUserDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Auth_UserChangePassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthUserChangePasswordRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServer).UserChangePassword(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Auth_UserChangePassword_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServer).UserChangePassword(ctx, req.(*AuthUserChangePasswordRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Auth_UserGrantRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthUserGrantRoleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServer).UserGrantRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Auth_UserGrantRole_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServer).UserGrantRole(ctx, req.(*AuthUserGrantRoleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Auth_UserRevokeRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthUserRevokeRoleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServer).UserRevokeRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Auth_UserRevokeRole_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServer).UserRevokeRole(ctx, req.(*AuthUserRevokeRoleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Auth_RoleAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthRoleAddRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServer).RoleAdd(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Auth_RoleAdd_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServer).RoleAdd(ctx, req.(*AuthRoleAddRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Auth_RoleGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthRoleGetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServer).RoleGet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Auth_RoleGet_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServer).RoleGet(ctx, req.(*AuthRoleGetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Auth_RoleList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthRoleListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServer).RoleList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Auth_RoleList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServer).RoleList(ctx, req.(*AuthRoleListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Auth_RoleDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthRoleDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServer).RoleDelete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Auth_RoleDelete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServer).RoleDelete(ctx, req.(*AuthRoleDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Auth_RoleGrantPermission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthRoleGrantPermissionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServer).RoleGrantPermission(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Auth_RoleGrantPermission_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServer).RoleGrantPermission(ctx, req.(*AuthRoleGrantPermissionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Auth_RoleRevokePermission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthRoleRevokePermissionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServer).RoleRevokePermission(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Auth_RoleRevokePermission_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServer).RoleRevokePermission(ctx, req.(*AuthRoleRevokePermissionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Auth_ServiceDesc is the grpc.ServiceDesc for Auth service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Auth_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "etcdserverpb.Auth", + HandlerType: (*AuthServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AuthEnable", + Handler: _Auth_AuthEnable_Handler, + }, + { + MethodName: "AuthDisable", + Handler: _Auth_AuthDisable_Handler, + }, + { + MethodName: "AuthStatus", + Handler: _Auth_AuthStatus_Handler, + }, + { + MethodName: "Authenticate", + Handler: _Auth_Authenticate_Handler, + }, + { + MethodName: "UserAdd", + Handler: _Auth_UserAdd_Handler, + }, + { + MethodName: "UserGet", + Handler: _Auth_UserGet_Handler, + }, + { + MethodName: "UserList", + Handler: _Auth_UserList_Handler, + }, + { + MethodName: "UserDelete", + Handler: _Auth_UserDelete_Handler, + }, + { + MethodName: "UserChangePassword", + Handler: _Auth_UserChangePassword_Handler, + }, + { + MethodName: "UserGrantRole", + Handler: _Auth_UserGrantRole_Handler, + }, + { + MethodName: "UserRevokeRole", + Handler: _Auth_UserRevokeRole_Handler, + }, + { + MethodName: "RoleAdd", + Handler: _Auth_RoleAdd_Handler, + }, + { + MethodName: "RoleGet", + Handler: _Auth_RoleGet_Handler, + }, + { + MethodName: "RoleList", + Handler: _Auth_RoleList_Handler, + }, + { + MethodName: "RoleDelete", + Handler: _Auth_RoleDelete_Handler, + }, + { + MethodName: "RoleGrantPermission", + Handler: _Auth_RoleGrantPermission_Handler, + }, + { + MethodName: "RoleRevokePermission", + Handler: _Auth_RoleRevokePermission_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "rpc.proto", +} diff --git a/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/util.go b/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/util.go new file mode 100644 index 0000000000..413f0826b3 --- /dev/null +++ b/vendor/go.etcd.io/etcd/api/v3/etcdserverpb/util.go @@ -0,0 +1,25 @@ +// Copyright 2026 The etcd 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 etcdserverpb + +import "google.golang.org/protobuf/proto" + +// Clone returns a deep copy of h, or an empty ResponseHeader if h is nil. +func (h *ResponseHeader) Clone() *ResponseHeader { + if h == nil { + return &ResponseHeader{} + } + return proto.Clone(h).(*ResponseHeader) +} diff --git a/vendor/go.etcd.io/etcd/api/v3/membershippb/membership.pb.go b/vendor/go.etcd.io/etcd/api/v3/membershippb/membership.pb.go index 85a2a741f3..1882611f02 100644 --- a/vendor/go.etcd.io/etcd/api/v3/membershippb/membership.pb.go +++ b/vendor/go.etcd.io/etcd/api/v3/membershippb/membership.pb.go @@ -1,1459 +1,423 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v3.20.3 // source: membership.proto package membershippb import ( - fmt "fmt" - io "io" - math "math" - math_bits "math/bits" + reflect "reflect" + sync "sync" + unsafe "unsafe" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" _ "go.etcd.io/etcd/api/v3/versionpb" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) // RaftAttributes represents the raft related attributes of an etcd member. type RaftAttributes struct { + state protoimpl.MessageState `protogen:"open.v1"` // peerURLs is the list of peers in the raft cluster. PeerUrls []string `protobuf:"bytes,1,rep,name=peer_urls,json=peerUrls,proto3" json:"peer_urls,omitempty"` // isLearner indicates if the member is raft learner. - IsLearner bool `protobuf:"varint,2,opt,name=is_learner,json=isLearner,proto3" json:"is_learner,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + IsLearner bool `protobuf:"varint,2,opt,name=is_learner,json=isLearner,proto3" json:"is_learner,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *RaftAttributes) Reset() { *m = RaftAttributes{} } -func (m *RaftAttributes) String() string { return proto.CompactTextString(m) } -func (*RaftAttributes) ProtoMessage() {} -func (*RaftAttributes) Descriptor() ([]byte, []int) { - return fileDescriptor_949fe0d019050ef5, []int{0} -} -func (m *RaftAttributes) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RaftAttributes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RaftAttributes.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *RaftAttributes) XXX_Merge(src proto.Message) { - xxx_messageInfo_RaftAttributes.Merge(m, src) -} -func (m *RaftAttributes) XXX_Size() int { - return m.Size() +func (x *RaftAttributes) Reset() { + *x = RaftAttributes{} + mi := &file_membership_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *RaftAttributes) XXX_DiscardUnknown() { - xxx_messageInfo_RaftAttributes.DiscardUnknown(m) -} - -var xxx_messageInfo_RaftAttributes proto.InternalMessageInfo -// Attributes represents all the non-raft related attributes of an etcd member. -type Attributes struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - ClientUrls []string `protobuf:"bytes,2,rep,name=client_urls,json=clientUrls,proto3" json:"client_urls,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Attributes) Reset() { *m = Attributes{} } -func (m *Attributes) String() string { return proto.CompactTextString(m) } -func (*Attributes) ProtoMessage() {} -func (*Attributes) Descriptor() ([]byte, []int) { - return fileDescriptor_949fe0d019050ef5, []int{1} -} -func (m *Attributes) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Attributes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Attributes.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Attributes) XXX_Merge(src proto.Message) { - xxx_messageInfo_Attributes.Merge(m, src) -} -func (m *Attributes) XXX_Size() int { - return m.Size() -} -func (m *Attributes) XXX_DiscardUnknown() { - xxx_messageInfo_Attributes.DiscardUnknown(m) +func (x *RaftAttributes) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_Attributes proto.InternalMessageInfo +func (*RaftAttributes) ProtoMessage() {} -type Member struct { - ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - RaftAttributes *RaftAttributes `protobuf:"bytes,2,opt,name=raft_attributes,json=raftAttributes,proto3" json:"raft_attributes,omitempty"` - MemberAttributes *Attributes `protobuf:"bytes,3,opt,name=member_attributes,json=memberAttributes,proto3" json:"member_attributes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Member) Reset() { *m = Member{} } -func (m *Member) String() string { return proto.CompactTextString(m) } -func (*Member) ProtoMessage() {} -func (*Member) Descriptor() ([]byte, []int) { - return fileDescriptor_949fe0d019050ef5, []int{2} -} -func (m *Member) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Member) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Member.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (x *RaftAttributes) ProtoReflect() protoreflect.Message { + mi := &file_membership_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *Member) XXX_Merge(src proto.Message) { - xxx_messageInfo_Member.Merge(m, src) -} -func (m *Member) XXX_Size() int { - return m.Size() -} -func (m *Member) XXX_DiscardUnknown() { - xxx_messageInfo_Member.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_Member proto.InternalMessageInfo - -type ClusterVersionSetRequest struct { - Ver string `protobuf:"bytes,1,opt,name=ver,proto3" json:"ver,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Deprecated: Use RaftAttributes.ProtoReflect.Descriptor instead. +func (*RaftAttributes) Descriptor() ([]byte, []int) { + return file_membership_proto_rawDescGZIP(), []int{0} } -func (m *ClusterVersionSetRequest) Reset() { *m = ClusterVersionSetRequest{} } -func (m *ClusterVersionSetRequest) String() string { return proto.CompactTextString(m) } -func (*ClusterVersionSetRequest) ProtoMessage() {} -func (*ClusterVersionSetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_949fe0d019050ef5, []int{3} -} -func (m *ClusterVersionSetRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ClusterVersionSetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ClusterVersionSetRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *RaftAttributes) GetPeerUrls() []string { + if x != nil { + return x.PeerUrls } -} -func (m *ClusterVersionSetRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClusterVersionSetRequest.Merge(m, src) -} -func (m *ClusterVersionSetRequest) XXX_Size() int { - return m.Size() -} -func (m *ClusterVersionSetRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ClusterVersionSetRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ClusterVersionSetRequest proto.InternalMessageInfo - -type ClusterMemberAttrSetRequest struct { - Member_ID uint64 `protobuf:"varint,1,opt,name=member_ID,json=memberID,proto3" json:"member_ID,omitempty"` - MemberAttributes *Attributes `protobuf:"bytes,2,opt,name=member_attributes,json=memberAttributes,proto3" json:"member_attributes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + return nil } -func (m *ClusterMemberAttrSetRequest) Reset() { *m = ClusterMemberAttrSetRequest{} } -func (m *ClusterMemberAttrSetRequest) String() string { return proto.CompactTextString(m) } -func (*ClusterMemberAttrSetRequest) ProtoMessage() {} -func (*ClusterMemberAttrSetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_949fe0d019050ef5, []int{4} -} -func (m *ClusterMemberAttrSetRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ClusterMemberAttrSetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ClusterMemberAttrSetRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *RaftAttributes) GetIsLearner() bool { + if x != nil { + return x.IsLearner } + return false } -func (m *ClusterMemberAttrSetRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClusterMemberAttrSetRequest.Merge(m, src) -} -func (m *ClusterMemberAttrSetRequest) XXX_Size() int { - return m.Size() -} -func (m *ClusterMemberAttrSetRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ClusterMemberAttrSetRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ClusterMemberAttrSetRequest proto.InternalMessageInfo -type DowngradeInfoSetRequest struct { - Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` - Ver string `protobuf:"bytes,2,opt,name=ver,proto3" json:"ver,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Attributes represents all the non-raft related attributes of an etcd member. +type Attributes struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + ClientUrls []string `protobuf:"bytes,2,rep,name=client_urls,json=clientUrls,proto3" json:"client_urls,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *DowngradeInfoSetRequest) Reset() { *m = DowngradeInfoSetRequest{} } -func (m *DowngradeInfoSetRequest) String() string { return proto.CompactTextString(m) } -func (*DowngradeInfoSetRequest) ProtoMessage() {} -func (*DowngradeInfoSetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_949fe0d019050ef5, []int{5} -} -func (m *DowngradeInfoSetRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DowngradeInfoSetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DowngradeInfoSetRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DowngradeInfoSetRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DowngradeInfoSetRequest.Merge(m, src) +func (x *Attributes) Reset() { + *x = Attributes{} + mi := &file_membership_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *DowngradeInfoSetRequest) XXX_Size() int { - return m.Size() -} -func (m *DowngradeInfoSetRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DowngradeInfoSetRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DowngradeInfoSetRequest proto.InternalMessageInfo -func init() { - proto.RegisterType((*RaftAttributes)(nil), "membershippb.RaftAttributes") - proto.RegisterType((*Attributes)(nil), "membershippb.Attributes") - proto.RegisterType((*Member)(nil), "membershippb.Member") - proto.RegisterType((*ClusterVersionSetRequest)(nil), "membershippb.ClusterVersionSetRequest") - proto.RegisterType((*ClusterMemberAttrSetRequest)(nil), "membershippb.ClusterMemberAttrSetRequest") - proto.RegisterType((*DowngradeInfoSetRequest)(nil), "membershippb.DowngradeInfoSetRequest") +func (x *Attributes) String() string { + return protoimpl.X.MessageStringOf(x) } -func init() { proto.RegisterFile("membership.proto", fileDescriptor_949fe0d019050ef5) } - -var fileDescriptor_949fe0d019050ef5 = []byte{ - // 422 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0xed, 0x3a, 0x55, 0x6b, 0x4f, 0x51, 0x28, 0x2b, 0x24, 0xac, 0x06, 0x8c, 0x55, 0x2e, 0x39, - 0xd9, 0x12, 0x51, 0x0f, 0x70, 0x03, 0xd2, 0x43, 0x10, 0xe5, 0xb0, 0xa8, 0x1c, 0xb8, 0x44, 0xeb, - 0x66, 0x62, 0x56, 0x72, 0xbc, 0x66, 0x77, 0x5d, 0xee, 0x1c, 0xf9, 0x02, 0xfe, 0x82, 0x13, 0xff, - 0xd0, 0x23, 0x9f, 0x00, 0xe1, 0x47, 0x90, 0x77, 0x9d, 0xd8, 0x11, 0x9c, 0x7a, 0x1b, 0x3f, 0xcf, - 0xbc, 0x79, 0xef, 0xed, 0xc0, 0xf1, 0x0a, 0x57, 0x19, 0x2a, 0xfd, 0x51, 0x54, 0x49, 0xa5, 0xa4, - 0x91, 0xf4, 0x4e, 0x87, 0x54, 0xd9, 0xc9, 0xfd, 0x5c, 0xe6, 0xd2, 0xfe, 0x48, 0x9b, 0xca, 0xf5, - 0x9c, 0xc4, 0x68, 0xae, 0x16, 0x29, 0xaf, 0x44, 0x7a, 0x8d, 0x4a, 0x0b, 0x59, 0x56, 0xd9, 0xa6, - 0x72, 0x1d, 0xa7, 0x97, 0x30, 0x64, 0x7c, 0x69, 0x5e, 0x18, 0xa3, 0x44, 0x56, 0x1b, 0xd4, 0x74, - 0x04, 0x41, 0x85, 0xa8, 0xe6, 0xb5, 0x2a, 0x74, 0x48, 0xe2, 0xc1, 0x38, 0x60, 0x7e, 0x03, 0x5c, - 0xaa, 0x42, 0xd3, 0x47, 0x00, 0x42, 0xcf, 0x0b, 0xe4, 0xaa, 0x44, 0x15, 0x7a, 0x31, 0x19, 0xfb, - 0x2c, 0x10, 0xfa, 0x8d, 0x03, 0x9e, 0x1f, 0x7e, 0xf9, 0x11, 0x0e, 0x26, 0xc9, 0xd9, 0xe9, 0x6b, - 0x80, 0x1e, 0x25, 0x85, 0xfd, 0x92, 0xaf, 0x30, 0x24, 0x31, 0x19, 0x07, 0xcc, 0xd6, 0xf4, 0x31, - 0x1c, 0x5d, 0x15, 0x02, 0x4b, 0xe3, 0x16, 0x79, 0x76, 0x11, 0x38, 0xa8, 0x59, 0xd5, 0x71, 0x7d, - 0x27, 0x70, 0x70, 0x61, 0xbd, 0xd2, 0x21, 0x78, 0xb3, 0xa9, 0xa5, 0xd9, 0x67, 0xde, 0x6c, 0x4a, - 0xcf, 0xe1, 0xae, 0xe2, 0x4b, 0x33, 0xe7, 0xdb, 0x5d, 0x56, 0xd3, 0xd1, 0xd3, 0x87, 0x49, 0x3f, - 0x9d, 0x64, 0xd7, 0x22, 0x1b, 0xaa, 0x5d, 0xcb, 0xe7, 0x70, 0xcf, 0xb5, 0xf7, 0x89, 0x06, 0x96, - 0x28, 0xdc, 0x25, 0xea, 0x91, 0xb4, 0x2f, 0xd2, 0x21, 0x9d, 0xe2, 0x33, 0x08, 0x5f, 0x15, 0xb5, - 0x36, 0xa8, 0xde, 0xbb, 0xb0, 0xdf, 0xa1, 0x61, 0xf8, 0xa9, 0x46, 0x6d, 0xe8, 0x31, 0x0c, 0xae, - 0x51, 0xb5, 0x51, 0x34, 0x65, 0x37, 0xf6, 0x95, 0xc0, 0xa8, 0x9d, 0xbb, 0xd8, 0x72, 0xf7, 0x46, - 0x47, 0x10, 0xb4, 0x32, 0xb7, 0x21, 0xf8, 0x0e, 0xb0, 0x51, 0xfc, 0xc7, 0x83, 0x77, 0x7b, 0x0f, - 0x6f, 0xe1, 0xc1, 0x54, 0x7e, 0x2e, 0x73, 0xc5, 0x17, 0x38, 0x2b, 0x97, 0xb2, 0xa7, 0x23, 0x84, - 0x43, 0x2c, 0x79, 0x56, 0xe0, 0xc2, 0xaa, 0xf0, 0xd9, 0xe6, 0x73, 0x63, 0xce, 0xfb, 0xd7, 0xdc, - 0xcb, 0x67, 0x37, 0xbf, 0xa3, 0xbd, 0x9b, 0x75, 0x44, 0x7e, 0xae, 0x23, 0xf2, 0x6b, 0x1d, 0x91, - 0x6f, 0x7f, 0xa2, 0xbd, 0x0f, 0x4f, 0x72, 0x99, 0x34, 0x37, 0x9a, 0x08, 0x99, 0x76, 0xb7, 0x3a, - 0x49, 0xfb, 0x82, 0xb3, 0x03, 0x7b, 0xaa, 0x93, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xcf, 0x56, - 0x21, 0x97, 0x04, 0x03, 0x00, 0x00, -} +func (*Attributes) ProtoMessage() {} -func (m *RaftAttributes) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *Attributes) ProtoReflect() protoreflect.Message { + mi := &file_membership_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return dAtA[:n], nil + return mi.MessageOf(x) } -func (m *RaftAttributes) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +// Deprecated: Use Attributes.ProtoReflect.Descriptor instead. +func (*Attributes) Descriptor() ([]byte, []int) { + return file_membership_proto_rawDescGZIP(), []int{1} } -func (m *RaftAttributes) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.IsLearner { - i-- - if m.IsLearner { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if len(m.PeerUrls) > 0 { - for iNdEx := len(m.PeerUrls) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.PeerUrls[iNdEx]) - copy(dAtA[i:], m.PeerUrls[iNdEx]) - i = encodeVarintMembership(dAtA, i, uint64(len(m.PeerUrls[iNdEx]))) - i-- - dAtA[i] = 0xa - } +func (x *Attributes) GetName() string { + if x != nil { + return x.Name } - return len(dAtA) - i, nil + return "" } -func (m *Attributes) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *Attributes) GetClientUrls() []string { + if x != nil { + return x.ClientUrls } - return dAtA[:n], nil + return nil } -func (m *Attributes) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +type Member struct { + state protoimpl.MessageState `protogen:"open.v1"` + ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + RaftAttributes *RaftAttributes `protobuf:"bytes,2,opt,name=raft_attributes,json=raftAttributes,proto3" json:"raft_attributes,omitempty"` + MemberAttributes *Attributes `protobuf:"bytes,3,opt,name=member_attributes,json=memberAttributes,proto3" json:"member_attributes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *Attributes) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.ClientUrls) > 0 { - for iNdEx := len(m.ClientUrls) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ClientUrls[iNdEx]) - copy(dAtA[i:], m.ClientUrls[iNdEx]) - i = encodeVarintMembership(dAtA, i, uint64(len(m.ClientUrls[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintMembership(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil +func (x *Member) Reset() { + *x = Member{} + mi := &file_membership_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *Member) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (x *Member) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Member) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} +func (*Member) ProtoMessage() {} -func (m *Member) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.MemberAttributes != nil { - { - size, err := m.MemberAttributes.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMembership(dAtA, i, uint64(size)) +func (x *Member) ProtoReflect() protoreflect.Message { + mi := &file_membership_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - i-- - dAtA[i] = 0x1a - } - if m.RaftAttributes != nil { - { - size, err := m.RaftAttributes.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMembership(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.ID != 0 { - i = encodeVarintMembership(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x8 + return ms } - return len(dAtA) - i, nil + return mi.MessageOf(x) } -func (m *ClusterVersionSetRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +// Deprecated: Use Member.ProtoReflect.Descriptor instead. +func (*Member) Descriptor() ([]byte, []int) { + return file_membership_proto_rawDescGZIP(), []int{2} } -func (m *ClusterVersionSetRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (x *Member) GetID() uint64 { + if x != nil { + return x.ID + } + return 0 } -func (m *ClusterVersionSetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) +func (x *Member) GetRaftAttributes() *RaftAttributes { + if x != nil { + return x.RaftAttributes } - if len(m.Ver) > 0 { - i -= len(m.Ver) - copy(dAtA[i:], m.Ver) - i = encodeVarintMembership(dAtA, i, uint64(len(m.Ver))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil + return nil } -func (m *ClusterMemberAttrSetRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *Member) GetMemberAttributes() *Attributes { + if x != nil { + return x.MemberAttributes } - return dAtA[:n], nil + return nil } -func (m *ClusterMemberAttrSetRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +type ClusterVersionSetRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ver string `protobuf:"bytes,1,opt,name=ver,proto3" json:"ver,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *ClusterMemberAttrSetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.MemberAttributes != nil { - { - size, err := m.MemberAttributes.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMembership(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Member_ID != 0 { - i = encodeVarintMembership(dAtA, i, uint64(m.Member_ID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil +func (x *ClusterVersionSetRequest) Reset() { + *x = ClusterVersionSetRequest{} + mi := &file_membership_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *DowngradeInfoSetRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (x *ClusterVersionSetRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DowngradeInfoSetRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} +func (*ClusterVersionSetRequest) ProtoMessage() {} -func (m *DowngradeInfoSetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Ver) > 0 { - i -= len(m.Ver) - copy(dAtA[i:], m.Ver) - i = encodeVarintMembership(dAtA, i, uint64(len(m.Ver))) - i-- - dAtA[i] = 0x12 - } - if m.Enabled { - i-- - if m.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 +func (x *ClusterVersionSetRequest) ProtoReflect() protoreflect.Message { + mi := &file_membership_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - i-- - dAtA[i] = 0x8 + return ms } - return len(dAtA) - i, nil + return mi.MessageOf(x) } -func encodeVarintMembership(dAtA []byte, offset int, v uint64) int { - offset -= sovMembership(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *RaftAttributes) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.PeerUrls) > 0 { - for _, s := range m.PeerUrls { - l = len(s) - n += 1 + l + sovMembership(uint64(l)) - } - } - if m.IsLearner { - n += 2 - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n +// Deprecated: Use ClusterVersionSetRequest.ProtoReflect.Descriptor instead. +func (*ClusterVersionSetRequest) Descriptor() ([]byte, []int) { + return file_membership_proto_rawDescGZIP(), []int{3} } -func (m *Attributes) Size() (n int) { - if m == nil { - return 0 +func (x *ClusterVersionSetRequest) GetVer() string { + if x != nil { + return x.Ver } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovMembership(uint64(l)) - } - if len(m.ClientUrls) > 0 { - for _, s := range m.ClientUrls { - l = len(s) - n += 1 + l + sovMembership(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n + return "" } -func (m *Member) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ID != 0 { - n += 1 + sovMembership(uint64(m.ID)) - } - if m.RaftAttributes != nil { - l = m.RaftAttributes.Size() - n += 1 + l + sovMembership(uint64(l)) - } - if m.MemberAttributes != nil { - l = m.MemberAttributes.Size() - n += 1 + l + sovMembership(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n +type ClusterMemberAttrSetRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Member_ID uint64 `protobuf:"varint,1,opt,name=member_ID,json=memberID,proto3" json:"member_ID,omitempty"` + MemberAttributes *Attributes `protobuf:"bytes,2,opt,name=member_attributes,json=memberAttributes,proto3" json:"member_attributes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *ClusterVersionSetRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Ver) - if l > 0 { - n += 1 + l + sovMembership(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n +func (x *ClusterMemberAttrSetRequest) Reset() { + *x = ClusterMemberAttrSetRequest{} + mi := &file_membership_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *ClusterMemberAttrSetRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Member_ID != 0 { - n += 1 + sovMembership(uint64(m.Member_ID)) - } - if m.MemberAttributes != nil { - l = m.MemberAttributes.Size() - n += 1 + l + sovMembership(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n +func (x *ClusterMemberAttrSetRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DowngradeInfoSetRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Enabled { - n += 2 - } - l = len(m.Ver) - if l > 0 { - n += 1 + l + sovMembership(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} +func (*ClusterMemberAttrSetRequest) ProtoMessage() {} -func sovMembership(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozMembership(x uint64) (n int) { - return sovMembership(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *RaftAttributes) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMembership - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RaftAttributes: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RaftAttributes: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerUrls", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMembership - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMembership - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMembership - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerUrls = append(m.PeerUrls, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsLearner", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMembership - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IsLearner = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipMembership(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMembership - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy +func (x *ClusterMemberAttrSetRequest) ProtoReflect() protoreflect.Message { + mi := &file_membership_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } + return ms } + return mi.MessageOf(x) +} - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +// Deprecated: Use ClusterMemberAttrSetRequest.ProtoReflect.Descriptor instead. +func (*ClusterMemberAttrSetRequest) Descriptor() ([]byte, []int) { + return file_membership_proto_rawDescGZIP(), []int{4} } -func (m *Attributes) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMembership - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Attributes: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Attributes: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMembership - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMembership - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMembership - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientUrls", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMembership - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMembership - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMembership - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClientUrls = append(m.ClientUrls, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMembership(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMembership - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *ClusterMemberAttrSetRequest) GetMember_ID() uint64 { + if x != nil { + return x.Member_ID } - return nil + return 0 } -func (m *Member) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMembership - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Member: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Member: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMembership - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RaftAttributes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMembership - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMembership - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMembership - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RaftAttributes == nil { - m.RaftAttributes = &RaftAttributes{} - } - if err := m.RaftAttributes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MemberAttributes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMembership - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMembership - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMembership - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MemberAttributes == nil { - m.MemberAttributes = &Attributes{} - } - if err := m.MemberAttributes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMembership(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMembership - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *ClusterMemberAttrSetRequest) GetMemberAttributes() *Attributes { + if x != nil { + return x.MemberAttributes } return nil } -func (m *ClusterVersionSetRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMembership - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ClusterVersionSetRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ClusterVersionSetRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ver", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMembership - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMembership - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMembership - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ver = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMembership(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMembership - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +type DowngradeInfoSetRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` + Ver string `protobuf:"bytes,2,opt,name=ver,proto3" json:"ver,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *ClusterMemberAttrSetRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMembership - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ClusterMemberAttrSetRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ClusterMemberAttrSetRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Member_ID", wireType) - } - m.Member_ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMembership - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Member_ID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MemberAttributes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMembership - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMembership - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMembership - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MemberAttributes == nil { - m.MemberAttributes = &Attributes{} - } - if err := m.MemberAttributes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMembership(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMembership - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +func (x *DowngradeInfoSetRequest) Reset() { + *x = DowngradeInfoSetRequest{} + mi := &file_membership_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *DowngradeInfoSetRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMembership - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DowngradeInfoSetRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DowngradeInfoSetRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMembership - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Enabled = bool(v != 0) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ver", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMembership - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMembership - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMembership - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ver = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMembership(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMembership - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +func (x *DowngradeInfoSetRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func skipMembership(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMembership - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMembership - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMembership - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthMembership - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupMembership - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthMembership - } - if depth == 0 { - return iNdEx, nil + +func (*DowngradeInfoSetRequest) ProtoMessage() {} + +func (x *DowngradeInfoSetRequest) ProtoReflect() protoreflect.Message { + mi := &file_membership_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } + return ms } - return 0, io.ErrUnexpectedEOF + return mi.MessageOf(x) } +// Deprecated: Use DowngradeInfoSetRequest.ProtoReflect.Descriptor instead. +func (*DowngradeInfoSetRequest) Descriptor() ([]byte, []int) { + return file_membership_proto_rawDescGZIP(), []int{5} +} + +func (x *DowngradeInfoSetRequest) GetEnabled() bool { + if x != nil { + return x.Enabled + } + return false +} + +func (x *DowngradeInfoSetRequest) GetVer() string { + if x != nil { + return x.Ver + } + return "" +} + +var File_membership_proto protoreflect.FileDescriptor + +const file_membership_proto_rawDesc = "" + + "\n" + + "\x10membership.proto\x12\fmembershippb\x1a etcd/api/versionpb/version.proto\"U\n" + + "\x0eRaftAttributes\x12\x1b\n" + + "\tpeer_urls\x18\x01 \x03(\tR\bpeerUrls\x12\x1d\n" + + "\n" + + "is_learner\x18\x02 \x01(\bR\tisLearner:\a\x82\xb5\x18\x033.5\"J\n" + + "\n" + + "Attributes\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1f\n" + + "\vclient_urls\x18\x02 \x03(\tR\n" + + "clientUrls:\a\x82\xb5\x18\x033.5\"\xaf\x01\n" + + "\x06Member\x12\x0e\n" + + "\x02ID\x18\x01 \x01(\x04R\x02ID\x12E\n" + + "\x0fraft_attributes\x18\x02 \x01(\v2\x1c.membershippb.RaftAttributesR\x0eraftAttributes\x12E\n" + + "\x11member_attributes\x18\x03 \x01(\v2\x18.membershippb.AttributesR\x10memberAttributes:\a\x82\xb5\x18\x033.5\"5\n" + + "\x18ClusterVersionSetRequest\x12\x10\n" + + "\x03ver\x18\x01 \x01(\tR\x03ver:\a\x82\xb5\x18\x033.5\"\x8a\x01\n" + + "\x1bClusterMemberAttrSetRequest\x12\x1b\n" + + "\tmember_ID\x18\x01 \x01(\x04R\bmemberID\x12E\n" + + "\x11member_attributes\x18\x02 \x01(\v2\x18.membershippb.AttributesR\x10memberAttributes:\a\x82\xb5\x18\x033.5\"N\n" + + "\x17DowngradeInfoSetRequest\x12\x18\n" + + "\aenabled\x18\x01 \x01(\bR\aenabled\x12\x10\n" + + "\x03ver\x18\x02 \x01(\tR\x03ver:\a\x82\xb5\x18\x033.5B%Z#go.etcd.io/etcd/api/v3/membershippbb\x06proto3" + var ( - ErrInvalidLengthMembership = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowMembership = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupMembership = fmt.Errorf("proto: unexpected end of group") + file_membership_proto_rawDescOnce sync.Once + file_membership_proto_rawDescData []byte ) + +func file_membership_proto_rawDescGZIP() []byte { + file_membership_proto_rawDescOnce.Do(func() { + file_membership_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_membership_proto_rawDesc), len(file_membership_proto_rawDesc))) + }) + return file_membership_proto_rawDescData +} + +var file_membership_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_membership_proto_goTypes = []any{ + (*RaftAttributes)(nil), // 0: membershippb.RaftAttributes + (*Attributes)(nil), // 1: membershippb.Attributes + (*Member)(nil), // 2: membershippb.Member + (*ClusterVersionSetRequest)(nil), // 3: membershippb.ClusterVersionSetRequest + (*ClusterMemberAttrSetRequest)(nil), // 4: membershippb.ClusterMemberAttrSetRequest + (*DowngradeInfoSetRequest)(nil), // 5: membershippb.DowngradeInfoSetRequest +} +var file_membership_proto_depIdxs = []int32{ + 0, // 0: membershippb.Member.raft_attributes:type_name -> membershippb.RaftAttributes + 1, // 1: membershippb.Member.member_attributes:type_name -> membershippb.Attributes + 1, // 2: membershippb.ClusterMemberAttrSetRequest.member_attributes:type_name -> membershippb.Attributes + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_membership_proto_init() } +func file_membership_proto_init() { + if File_membership_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_membership_proto_rawDesc), len(file_membership_proto_rawDesc)), + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_membership_proto_goTypes, + DependencyIndexes: file_membership_proto_depIdxs, + MessageInfos: file_membership_proto_msgTypes, + }.Build() + File_membership_proto = out.File + file_membership_proto_goTypes = nil + file_membership_proto_depIdxs = nil +} diff --git a/vendor/go.etcd.io/etcd/api/v3/membershippb/membership.proto b/vendor/go.etcd.io/etcd/api/v3/membershippb/membership.proto index cbccfefccf..93a632f01b 100644 --- a/vendor/go.etcd.io/etcd/api/v3/membershippb/membership.proto +++ b/vendor/go.etcd.io/etcd/api/v3/membershippb/membership.proto @@ -1,16 +1,10 @@ syntax = "proto3"; package membershippb; -import "gogoproto/gogo.proto"; import "etcd/api/versionpb/version.proto"; option go_package = "go.etcd.io/etcd/api/v3/membershippb"; -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; -option (gogoproto.goproto_getters_all) = false; - // RaftAttributes represents the raft related attributes of an etcd member. message RaftAttributes { option (versionpb.etcd_version_msg) = "3.5"; diff --git a/vendor/go.etcd.io/etcd/api/v3/mvccpb/deprecated.go b/vendor/go.etcd.io/etcd/api/v3/mvccpb/deprecated.go new file mode 100644 index 0000000000..cc810ab45d --- /dev/null +++ b/vendor/go.etcd.io/etcd/api/v3/mvccpb/deprecated.go @@ -0,0 +1,24 @@ +// Copyright 2026 The etcd 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 mvccpb + +const ( + // PUT is an alias of Event_PUT + // Deprecated: use Event_PUT instead. Will be removed in v3.8. + PUT = Event_PUT + // DELETE is an alias of Permission_WRITE + // Deprecated: use Event_DELETE instead. Will be removed in v3.8. + DELETE = Event_DELETE +) diff --git a/vendor/go.etcd.io/etcd/api/v3/mvccpb/extension.go b/vendor/go.etcd.io/etcd/api/v3/mvccpb/extension.go new file mode 100644 index 0000000000..616e1c69fe --- /dev/null +++ b/vendor/go.etcd.io/etcd/api/v3/mvccpb/extension.go @@ -0,0 +1,25 @@ +// Copyright 2026 The etcd 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 mvccpb + +// IsCreate returns true if the event tells that the key is newly created. +func (e *Event) IsCreate() bool { + return e.GetType() == PUT && e.GetKv().GetCreateRevision() == e.GetKv().GetModRevision() +} + +// IsModify returns true if the event tells that a new value is put on existing key. +func (e *Event) IsModify() bool { + return e.GetType() == PUT && e.GetKv().GetCreateRevision() != e.GetKv().GetModRevision() +} diff --git a/vendor/go.etcd.io/etcd/api/v3/mvccpb/kv.pb.go b/vendor/go.etcd.io/etcd/api/v3/mvccpb/kv.pb.go index 2fed4242cc..73e72f9663 100644 --- a/vendor/go.etcd.io/etcd/api/v3/mvccpb/kv.pb.go +++ b/vendor/go.etcd.io/etcd/api/v3/mvccpb/kv.pb.go @@ -1,55 +1,75 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v3.20.3 // source: kv.proto package mvccpb import ( - fmt "fmt" - io "io" - math "math" - math_bits "math/bits" + reflect "reflect" + sync "sync" + unsafe "unsafe" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Event_EventType int32 const ( - PUT Event_EventType = 0 - DELETE Event_EventType = 1 + Event_PUT Event_EventType = 0 + Event_DELETE Event_EventType = 1 ) -var Event_EventType_name = map[int32]string{ - 0: "PUT", - 1: "DELETE", -} +// Enum value maps for Event_EventType. +var ( + Event_EventType_name = map[int32]string{ + 0: "PUT", + 1: "DELETE", + } + Event_EventType_value = map[string]int32{ + "PUT": 0, + "DELETE": 1, + } +) -var Event_EventType_value = map[string]int32{ - "PUT": 0, - "DELETE": 1, +func (x Event_EventType) Enum() *Event_EventType { + p := new(Event_EventType) + *p = x + return p } func (x Event_EventType) String() string { - return proto.EnumName(Event_EventType_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Event_EventType) Descriptor() protoreflect.EnumDescriptor { + return file_kv_proto_enumTypes[0].Descriptor() +} + +func (Event_EventType) Type() protoreflect.EnumType { + return &file_kv_proto_enumTypes[0] +} + +func (x Event_EventType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } +// Deprecated: Use Event_EventType.Descriptor instead. func (Event_EventType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_2216fe83c9c12408, []int{1, 0} + return file_kv_proto_rawDescGZIP(), []int{1, 0} } type KeyValue struct { + state protoimpl.MessageState `protogen:"open.v1"` // key is the key in bytes. An empty key is not allowed. Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // create_revision is the revision of last creation on this key. @@ -65,46 +85,85 @@ type KeyValue struct { // lease is the ID of the lease that attached to key. // When the attached lease expires, the key will be deleted. // If lease is 0, then no lease is attached to the key. - Lease int64 `protobuf:"varint,6,opt,name=lease,proto3" json:"lease,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Lease int64 `protobuf:"varint,6,opt,name=lease,proto3" json:"lease,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *KeyValue) Reset() { *m = KeyValue{} } -func (m *KeyValue) String() string { return proto.CompactTextString(m) } -func (*KeyValue) ProtoMessage() {} -func (*KeyValue) Descriptor() ([]byte, []int) { - return fileDescriptor_2216fe83c9c12408, []int{0} +func (x *KeyValue) Reset() { + *x = KeyValue{} + mi := &file_kv_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *KeyValue) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *KeyValue) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *KeyValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_KeyValue.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*KeyValue) ProtoMessage() {} + +func (x *KeyValue) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyValue.ProtoReflect.Descriptor instead. +func (*KeyValue) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{0} +} + +func (x *KeyValue) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *KeyValue) GetCreateRevision() int64 { + if x != nil { + return x.CreateRevision } + return 0 } -func (m *KeyValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_KeyValue.Merge(m, src) + +func (x *KeyValue) GetModRevision() int64 { + if x != nil { + return x.ModRevision + } + return 0 } -func (m *KeyValue) XXX_Size() int { - return m.Size() + +func (x *KeyValue) GetVersion() int64 { + if x != nil { + return x.Version + } + return 0 } -func (m *KeyValue) XXX_DiscardUnknown() { - xxx_messageInfo_KeyValue.DiscardUnknown(m) + +func (x *KeyValue) GetValue() []byte { + if x != nil { + return x.Value + } + return nil } -var xxx_messageInfo_KeyValue proto.InternalMessageInfo +func (x *KeyValue) GetLease() int64 { + if x != nil { + return x.Lease + } + return 0 +} type Event struct { + state protoimpl.MessageState `protogen:"open.v1"` // type is the kind of event. If type is a PUT, it indicates // new data has been stored to the key. If type is a DELETE, // it indicates the key was deleted. @@ -116,685 +175,134 @@ type Event struct { // its modification revision set to the revision of deletion. Kv *KeyValue `protobuf:"bytes,2,opt,name=kv,proto3" json:"kv,omitempty"` // prev_kv holds the key-value pair before the event happens. - PrevKv *KeyValue `protobuf:"bytes,3,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + PrevKv *KeyValue `protobuf:"bytes,3,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *Event) Reset() { *m = Event{} } -func (m *Event) String() string { return proto.CompactTextString(m) } -func (*Event) ProtoMessage() {} -func (*Event) Descriptor() ([]byte, []int) { - return fileDescriptor_2216fe83c9c12408, []int{1} -} -func (m *Event) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Event.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Event) XXX_Merge(src proto.Message) { - xxx_messageInfo_Event.Merge(m, src) -} -func (m *Event) XXX_Size() int { - return m.Size() -} -func (m *Event) XXX_DiscardUnknown() { - xxx_messageInfo_Event.DiscardUnknown(m) +func (x *Event) Reset() { + *x = Event{} + mi := &file_kv_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -var xxx_messageInfo_Event proto.InternalMessageInfo - -func init() { - proto.RegisterEnum("mvccpb.Event_EventType", Event_EventType_name, Event_EventType_value) - proto.RegisterType((*KeyValue)(nil), "mvccpb.KeyValue") - proto.RegisterType((*Event)(nil), "mvccpb.Event") +func (x *Event) String() string { + return protoimpl.X.MessageStringOf(x) } -func init() { proto.RegisterFile("kv.proto", fileDescriptor_2216fe83c9c12408) } - -var fileDescriptor_2216fe83c9c12408 = []byte{ - // 327 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xc1, 0x6a, 0xfa, 0x40, - 0x10, 0xc6, 0xb3, 0x46, 0xa3, 0xff, 0x51, 0xfc, 0x87, 0x45, 0x68, 0x28, 0x34, 0xa4, 0x5e, 0x6a, - 0x29, 0x24, 0xa0, 0x87, 0xde, 0x4b, 0x73, 0xb2, 0x87, 0x12, 0x6c, 0x0f, 0xbd, 0x48, 0x8c, 0x83, - 0x84, 0xa8, 0x1b, 0x62, 0xba, 0x90, 0x37, 0xe9, 0xbd, 0xf7, 0x3e, 0x87, 0x47, 0x1f, 0xa1, 0xda, - 0x17, 0x29, 0x3b, 0x5b, 0xed, 0xa5, 0x97, 0xdd, 0x99, 0xef, 0xfb, 0xb1, 0xf3, 0x0d, 0x0b, 0xad, - 0x4c, 0xfa, 0x79, 0x21, 0x4a, 0xc1, 0xad, 0x95, 0x4c, 0x92, 0x7c, 0x76, 0xde, 0x5b, 0x88, 0x85, - 0x20, 0x29, 0x50, 0x95, 0x76, 0xfb, 0x1f, 0x0c, 0x5a, 0x63, 0xac, 0x9e, 0xe3, 0xe5, 0x2b, 0x72, - 0x1b, 0xcc, 0x0c, 0x2b, 0x87, 0x79, 0x6c, 0xd0, 0x89, 0x54, 0xc9, 0xaf, 0xe0, 0x7f, 0x52, 0x60, - 0x5c, 0xe2, 0xb4, 0x40, 0x99, 0x6e, 0x52, 0xb1, 0x76, 0x6a, 0x1e, 0x1b, 0x98, 0x51, 0x57, 0xcb, - 0xd1, 0x8f, 0xca, 0x2f, 0xa1, 0xb3, 0x12, 0xf3, 0x5f, 0xca, 0x24, 0xaa, 0xbd, 0x12, 0xf3, 0x13, - 0xe2, 0x40, 0x53, 0x62, 0x41, 0x6e, 0x9d, 0xdc, 0x63, 0xcb, 0x7b, 0xd0, 0x90, 0x2a, 0x80, 0xd3, - 0xa0, 0xc9, 0xba, 0x51, 0xea, 0x12, 0xe3, 0x0d, 0x3a, 0x16, 0xd1, 0xba, 0xe9, 0xbf, 0x33, 0x68, - 0x84, 0x12, 0xd7, 0x25, 0xbf, 0x81, 0x7a, 0x59, 0xe5, 0x48, 0x71, 0xbb, 0xc3, 0x33, 0x5f, 0xef, - 0xe9, 0x93, 0xa9, 0xcf, 0x49, 0x95, 0x63, 0x44, 0x10, 0xf7, 0xa0, 0x96, 0x49, 0xca, 0xde, 0x1e, - 0xda, 0x47, 0xf4, 0xb8, 0x78, 0x54, 0xcb, 0x24, 0xbf, 0x86, 0x66, 0x5e, 0xa0, 0x9c, 0x66, 0x92, - 0xc2, 0xff, 0x85, 0x59, 0x0a, 0x18, 0xcb, 0xbe, 0x07, 0xff, 0x4e, 0xef, 0xf3, 0x26, 0x98, 0x8f, - 0x4f, 0x13, 0xdb, 0xe0, 0x00, 0xd6, 0x7d, 0xf8, 0x10, 0x4e, 0x42, 0x9b, 0xdd, 0xdd, 0x6e, 0xf7, - 0xae, 0xb1, 0xdb, 0xbb, 0xc6, 0xf6, 0xe0, 0xb2, 0xdd, 0xc1, 0x65, 0x9f, 0x07, 0x97, 0xbd, 0x7d, - 0xb9, 0xc6, 0xcb, 0xc5, 0x42, 0xf8, 0x58, 0x26, 0x73, 0x3f, 0x15, 0x81, 0xba, 0x83, 0x38, 0x4f, - 0x03, 0x39, 0x0a, 0xf4, 0xac, 0x99, 0x45, 0xdf, 0x32, 0xfa, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x78, - 0x06, 0x46, 0xf5, 0xc0, 0x01, 0x00, 0x00, -} +func (*Event) ProtoMessage() {} -func (m *KeyValue) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *KeyValue) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *KeyValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Lease != 0 { - i = encodeVarintKv(dAtA, i, uint64(m.Lease)) - i-- - dAtA[i] = 0x30 - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintKv(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x2a - } - if m.Version != 0 { - i = encodeVarintKv(dAtA, i, uint64(m.Version)) - i-- - dAtA[i] = 0x20 - } - if m.ModRevision != 0 { - i = encodeVarintKv(dAtA, i, uint64(m.ModRevision)) - i-- - dAtA[i] = 0x18 - } - if m.CreateRevision != 0 { - i = encodeVarintKv(dAtA, i, uint64(m.CreateRevision)) - i-- - dAtA[i] = 0x10 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintKv(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Event) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Event) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Event) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.PrevKv != nil { - { - size, err := m.PrevKv.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintKv(dAtA, i, uint64(size)) +func (x *Event) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - i-- - dAtA[i] = 0x1a + return ms } - if m.Kv != nil { - { - size, err := m.Kv.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintKv(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Type != 0 { - i = encodeVarintKv(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil + return mi.MessageOf(x) } -func encodeVarintKv(dAtA []byte, offset int, v uint64) int { - offset -= sovKv(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *KeyValue) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKv(uint64(l)) - } - if m.CreateRevision != 0 { - n += 1 + sovKv(uint64(m.CreateRevision)) - } - if m.ModRevision != 0 { - n += 1 + sovKv(uint64(m.ModRevision)) - } - if m.Version != 0 { - n += 1 + sovKv(uint64(m.Version)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovKv(uint64(l)) - } - if m.Lease != 0 { - n += 1 + sovKv(uint64(m.Lease)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n +// Deprecated: Use Event.ProtoReflect.Descriptor instead. +func (*Event) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{1} } -func (m *Event) Size() (n int) { - if m == nil { - return 0 +func (x *Event) GetType() Event_EventType { + if x != nil { + return x.Type } - var l int - _ = l - if m.Type != 0 { - n += 1 + sovKv(uint64(m.Type)) - } - if m.Kv != nil { - l = m.Kv.Size() - n += 1 + l + sovKv(uint64(l)) - } - if m.PrevKv != nil { - l = m.PrevKv.Size() - n += 1 + l + sovKv(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n + return Event_PUT } -func sovKv(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozKv(x uint64) (n int) { - return sovKv(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *KeyValue) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKv - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: KeyValue: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: KeyValue: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKv - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKv - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthKv - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CreateRevision", wireType) - } - m.CreateRevision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKv - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CreateRevision |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ModRevision", wireType) - } - m.ModRevision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKv - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ModRevision |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - m.Version = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKv - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Version |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKv - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKv - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthKv - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Lease", wireType) - } - m.Lease = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKv - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Lease |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipKv(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthKv - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *Event) GetKv() *KeyValue { + if x != nil { + return x.Kv } return nil } -func (m *Event) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKv - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Event: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Event: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKv - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= Event_EventType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Kv", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKv - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKv - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthKv - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Kv == nil { - m.Kv = &KeyValue{} - } - if err := m.Kv.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevKv", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKv - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKv - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthKv - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PrevKv == nil { - m.PrevKv = &KeyValue{} - } - if err := m.PrevKv.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKv(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthKv - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (x *Event) GetPrevKv() *KeyValue { + if x != nil { + return x.PrevKv } return nil } -func skipKv(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowKv - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowKv - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowKv - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthKv - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupKv - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthKv - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} + +var File_kv_proto protoreflect.FileDescriptor + +const file_kv_proto_rawDesc = "" + + "\n" + + "\bkv.proto\x12\x06mvccpb\"\xae\x01\n" + + "\bKeyValue\x12\x10\n" + + "\x03key\x18\x01 \x01(\fR\x03key\x12'\n" + + "\x0fcreate_revision\x18\x02 \x01(\x03R\x0ecreateRevision\x12!\n" + + "\fmod_revision\x18\x03 \x01(\x03R\vmodRevision\x12\x18\n" + + "\aversion\x18\x04 \x01(\x03R\aversion\x12\x14\n" + + "\x05value\x18\x05 \x01(\fR\x05value\x12\x14\n" + + "\x05lease\x18\x06 \x01(\x03R\x05lease\"\xa3\x01\n" + + "\x05Event\x12+\n" + + "\x04type\x18\x01 \x01(\x0e2\x17.mvccpb.Event.EventTypeR\x04type\x12 \n" + + "\x02kv\x18\x02 \x01(\v2\x10.mvccpb.KeyValueR\x02kv\x12)\n" + + "\aprev_kv\x18\x03 \x01(\v2\x10.mvccpb.KeyValueR\x06prevKv\" \n" + + "\tEventType\x12\a\n" + + "\x03PUT\x10\x00\x12\n" + + "\n" + + "\x06DELETE\x10\x01B\x1fZ\x1dgo.etcd.io/etcd/api/v3/mvccpbb\x06proto3" var ( - ErrInvalidLengthKv = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowKv = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupKv = fmt.Errorf("proto: unexpected end of group") + file_kv_proto_rawDescOnce sync.Once + file_kv_proto_rawDescData []byte ) + +func file_kv_proto_rawDescGZIP() []byte { + file_kv_proto_rawDescOnce.Do(func() { + file_kv_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_kv_proto_rawDesc), len(file_kv_proto_rawDesc))) + }) + return file_kv_proto_rawDescData +} + +var file_kv_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_kv_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_kv_proto_goTypes = []any{ + (Event_EventType)(0), // 0: mvccpb.Event.EventType + (*KeyValue)(nil), // 1: mvccpb.KeyValue + (*Event)(nil), // 2: mvccpb.Event +} +var file_kv_proto_depIdxs = []int32{ + 0, // 0: mvccpb.Event.type:type_name -> mvccpb.Event.EventType + 1, // 1: mvccpb.Event.kv:type_name -> mvccpb.KeyValue + 1, // 2: mvccpb.Event.prev_kv:type_name -> mvccpb.KeyValue + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_kv_proto_init() } +func file_kv_proto_init() { + if File_kv_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_kv_proto_rawDesc), len(file_kv_proto_rawDesc)), + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_kv_proto_goTypes, + DependencyIndexes: file_kv_proto_depIdxs, + EnumInfos: file_kv_proto_enumTypes, + MessageInfos: file_kv_proto_msgTypes, + }.Build() + File_kv_proto = out.File + file_kv_proto_goTypes = nil + file_kv_proto_depIdxs = nil +} diff --git a/vendor/go.etcd.io/etcd/api/v3/mvccpb/kv.proto b/vendor/go.etcd.io/etcd/api/v3/mvccpb/kv.proto index a93479c69f..6e035362f6 100644 --- a/vendor/go.etcd.io/etcd/api/v3/mvccpb/kv.proto +++ b/vendor/go.etcd.io/etcd/api/v3/mvccpb/kv.proto @@ -1,16 +1,8 @@ syntax = "proto3"; package mvccpb; -import "gogoproto/gogo.proto"; - option go_package = "go.etcd.io/etcd/api/v3/mvccpb"; -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; -option (gogoproto.goproto_getters_all) = false; -option (gogoproto.goproto_enum_prefix_all) = false; - message KeyValue { // key is the key in bytes. An empty key is not allowed. bytes key = 1; diff --git a/vendor/go.etcd.io/etcd/api/v3/version/version.go b/vendor/go.etcd.io/etcd/api/v3/version/version.go index cd0b63ea67..ad23060722 100644 --- a/vendor/go.etcd.io/etcd/api/v3/version/version.go +++ b/vendor/go.etcd.io/etcd/api/v3/version/version.go @@ -26,7 +26,7 @@ import ( var ( // MinClusterVersion is the min cluster version this etcd binary is compatible with. MinClusterVersion = "3.0.0" - Version = "3.6.8" + Version = "3.7.0" APIVersion = "unknown" // Git SHA Value will be set during build @@ -43,6 +43,7 @@ var ( V3_5 = semver.Version{Major: 3, Minor: 5} V3_6 = semver.Version{Major: 3, Minor: 6} V3_7 = semver.Version{Major: 3, Minor: 7} + V3_8 = semver.Version{Major: 3, Minor: 8} V4_0 = semver.Version{Major: 4, Minor: 0} // AllVersions keeps all the versions in ascending order. diff --git a/vendor/go.etcd.io/etcd/api/v3/versionpb/version.pb.go b/vendor/go.etcd.io/etcd/api/v3/versionpb/version.pb.go index 71c74eb719..8653baa7fb 100644 --- a/vendor/go.etcd.io/etcd/api/v3/versionpb/version.pb.go +++ b/vendor/go.etcd.io/etcd/api/v3/versionpb/version.pb.go @@ -1,91 +1,134 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v3.20.3 // source: version.proto package versionpb import ( - fmt "fmt" - math "math" + reflect "reflect" + unsafe "unsafe" - _ "github.com/gogo/protobuf/gogoproto" - descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -var E_EtcdVersionMsg = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*string)(nil), - Field: 50000, - Name: "versionpb.etcd_version_msg", - Tag: "bytes,50000,opt,name=etcd_version_msg", - Filename: "version.proto", +var file_version_proto_extTypes = []protoimpl.ExtensionInfo{ + { + ExtendedType: (*descriptorpb.MessageOptions)(nil), + ExtensionType: (*string)(nil), + Field: 50000, + Name: "versionpb.etcd_version_msg", + Tag: "bytes,50000,opt,name=etcd_version_msg", + Filename: "version.proto", + }, + { + ExtendedType: (*descriptorpb.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 50001, + Name: "versionpb.etcd_version_field", + Tag: "bytes,50001,opt,name=etcd_version_field", + Filename: "version.proto", + }, + { + ExtendedType: (*descriptorpb.EnumOptions)(nil), + ExtensionType: (*string)(nil), + Field: 50002, + Name: "versionpb.etcd_version_enum", + Tag: "bytes,50002,opt,name=etcd_version_enum", + Filename: "version.proto", + }, + { + ExtendedType: (*descriptorpb.EnumValueOptions)(nil), + ExtensionType: (*string)(nil), + Field: 50003, + Name: "versionpb.etcd_version_enum_value", + Tag: "bytes,50003,opt,name=etcd_version_enum_value", + Filename: "version.proto", + }, } -var E_EtcdVersionField = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 50001, - Name: "versionpb.etcd_version_field", - Tag: "bytes,50001,opt,name=etcd_version_field", - Filename: "version.proto", -} +// Extension fields to descriptorpb.MessageOptions. +var ( + // optional string etcd_version_msg = 50000; + E_EtcdVersionMsg = &file_version_proto_extTypes[0] +) -var E_EtcdVersionEnum = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*string)(nil), - Field: 50002, - Name: "versionpb.etcd_version_enum", - Tag: "bytes,50002,opt,name=etcd_version_enum", - Filename: "version.proto", -} +// Extension fields to descriptorpb.FieldOptions. +var ( + // optional string etcd_version_field = 50001; + E_EtcdVersionField = &file_version_proto_extTypes[1] +) -var E_EtcdVersionEnumValue = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumValueOptions)(nil), - ExtensionType: (*string)(nil), - Field: 50003, - Name: "versionpb.etcd_version_enum_value", - Tag: "bytes,50003,opt,name=etcd_version_enum_value", - Filename: "version.proto", -} +// Extension fields to descriptorpb.EnumOptions. +var ( + // optional string etcd_version_enum = 50002; + E_EtcdVersionEnum = &file_version_proto_extTypes[2] +) -func init() { - proto.RegisterExtension(E_EtcdVersionMsg) - proto.RegisterExtension(E_EtcdVersionField) - proto.RegisterExtension(E_EtcdVersionEnum) - proto.RegisterExtension(E_EtcdVersionEnumValue) -} +// Extension fields to descriptorpb.EnumValueOptions. +var ( + // optional string etcd_version_enum_value = 50003; + E_EtcdVersionEnumValue = &file_version_proto_extTypes[3] +) + +var File_version_proto protoreflect.FileDescriptor -func init() { proto.RegisterFile("version.proto", fileDescriptor_7d2c07d79758f814) } +const file_version_proto_rawDesc = "" + + "\n" + + "\rversion.proto\x12\tversionpb\x1a google/protobuf/descriptor.proto:N\n" + + "\x10etcd_version_msg\x12\x1f.google.protobuf.MessageOptions\x18І\x03 \x01(\tR\x0eetcdVersionMsg\x88\x01\x01:P\n" + + "\x12etcd_version_field\x12\x1d.google.protobuf.FieldOptions\x18ц\x03 \x01(\tR\x10etcdVersionField\x88\x01\x01:M\n" + + "\x11etcd_version_enum\x12\x1c.google.protobuf.EnumOptions\x18҆\x03 \x01(\tR\x0fetcdVersionEnum\x88\x01\x01:]\n" + + "\x17etcd_version_enum_value\x12!.google.protobuf.EnumValueOptions\x18ӆ\x03 \x01(\tR\x14etcdVersionEnumValue\x88\x01\x01B\"Z go.etcd.io/etcd/api/v3/versionpbb\x06proto3" + +var file_version_proto_goTypes = []any{ + (*descriptorpb.MessageOptions)(nil), // 0: google.protobuf.MessageOptions + (*descriptorpb.FieldOptions)(nil), // 1: google.protobuf.FieldOptions + (*descriptorpb.EnumOptions)(nil), // 2: google.protobuf.EnumOptions + (*descriptorpb.EnumValueOptions)(nil), // 3: google.protobuf.EnumValueOptions +} +var file_version_proto_depIdxs = []int32{ + 0, // 0: versionpb.etcd_version_msg:extendee -> google.protobuf.MessageOptions + 1, // 1: versionpb.etcd_version_field:extendee -> google.protobuf.FieldOptions + 2, // 2: versionpb.etcd_version_enum:extendee -> google.protobuf.EnumOptions + 3, // 3: versionpb.etcd_version_enum_value:extendee -> google.protobuf.EnumValueOptions + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 0, // [0:4] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} -var fileDescriptor_7d2c07d79758f814 = []byte{ - // 284 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0xd1, 0xc1, 0x4a, 0xc3, 0x30, - 0x18, 0x07, 0x70, 0x83, 0x20, 0x2c, 0xa0, 0xce, 0x30, 0x50, 0x86, 0xd6, 0x7a, 0xf3, 0x94, 0x80, - 0xbb, 0xed, 0x28, 0xe8, 0xad, 0x2a, 0x1e, 0x76, 0x10, 0xa4, 0xb4, 0x6b, 0x16, 0x02, 0x6d, 0xbf, - 0xd0, 0xb4, 0x7d, 0x04, 0xd9, 0x23, 0xf8, 0x48, 0x1e, 0xa7, 0xbe, 0x80, 0xd4, 0x17, 0x91, 0xa4, - 0xa9, 0xac, 0xd6, 0x53, 0xfb, 0x7d, 0xdf, 0xff, 0xff, 0xeb, 0xa1, 0x78, 0xbf, 0xe6, 0x85, 0x96, - 0x90, 0x53, 0x55, 0x40, 0x09, 0x64, 0xe4, 0x46, 0x15, 0x4f, 0x27, 0x02, 0x04, 0xd8, 0x2d, 0x33, - 0x6f, 0x6d, 0x60, 0xea, 0x0b, 0x00, 0x91, 0x72, 0x66, 0xa7, 0xb8, 0x5a, 0xb1, 0x84, 0xeb, 0x65, - 0x21, 0x55, 0x09, 0x45, 0x9b, 0x98, 0xdf, 0xe1, 0x31, 0x2f, 0x97, 0x49, 0xe8, 0xa4, 0x30, 0xd3, - 0x82, 0x9c, 0xd3, 0xb6, 0x46, 0xbb, 0x1a, 0x0d, 0xb8, 0xd6, 0x91, 0xe0, 0xf7, 0xaa, 0x94, 0x90, - 0xeb, 0x93, 0xcd, 0xcb, 0xae, 0x8f, 0x2e, 0x47, 0x8f, 0x07, 0xa6, 0xba, 0x68, 0x9b, 0x81, 0x16, - 0x6b, 0x84, 0xe6, 0x0f, 0x98, 0xf4, 0xbc, 0x95, 0xe4, 0x69, 0x42, 0xce, 0x06, 0xe2, 0xad, 0xd9, - 0x77, 0xde, 0xbb, 0xf3, 0xc6, 0x5b, 0x9e, 0x0d, 0x18, 0x31, 0xc0, 0x47, 0x3d, 0x91, 0xe7, 0x55, - 0x46, 0x4e, 0x07, 0xe0, 0x4d, 0x5e, 0x65, 0x9d, 0xf7, 0xe1, 0xbc, 0xc3, 0x2d, 0xcf, 0xdc, 0x0d, - 0xf7, 0x8c, 0x8f, 0x07, 0x5c, 0x58, 0x47, 0x69, 0xc5, 0xc9, 0xc5, 0xbf, 0xe8, 0xc2, 0xdc, 0x3a, - 0xf9, 0xd3, 0xc9, 0x93, 0x3f, 0xb2, 0x0d, 0xad, 0x11, 0xba, 0xbe, 0x7a, 0x6b, 0x3c, 0xb4, 0x69, - 0x3c, 0xf4, 0xd5, 0x78, 0xe8, 0xf5, 0xdb, 0xdb, 0x79, 0xf2, 0x05, 0x50, 0x93, 0xa6, 0x12, 0x98, - 0x79, 0xb2, 0x48, 0x49, 0x56, 0xcf, 0xd8, 0xef, 0xbf, 0x8b, 0xf7, 0xec, 0xf7, 0x66, 0x3f, 0x01, - 0x00, 0x00, 0xff, 0xff, 0xe8, 0x02, 0x15, 0xc0, 0xde, 0x01, 0x00, 0x00, +func init() { file_version_proto_init() } +func file_version_proto_init() { + if File_version_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_version_proto_rawDesc), len(file_version_proto_rawDesc)), + NumEnums: 0, + NumMessages: 0, + NumExtensions: 4, + NumServices: 0, + }, + GoTypes: file_version_proto_goTypes, + DependencyIndexes: file_version_proto_depIdxs, + ExtensionInfos: file_version_proto_extTypes, + }.Build() + File_version_proto = out.File + file_version_proto_goTypes = nil + file_version_proto_depIdxs = nil } diff --git a/vendor/go.etcd.io/etcd/api/v3/versionpb/version.proto b/vendor/go.etcd.io/etcd/api/v3/versionpb/version.proto index c81b2f58a4..1ee99fadb1 100644 --- a/vendor/go.etcd.io/etcd/api/v3/versionpb/version.proto +++ b/vendor/go.etcd.io/etcd/api/v3/versionpb/version.proto @@ -1,14 +1,10 @@ syntax = "proto3"; package versionpb; -import "gogoproto/gogo.proto"; import "google/protobuf/descriptor.proto"; option go_package = "go.etcd.io/etcd/api/v3/versionpb"; -option (gogoproto.marshaler_all) = true; -option (gogoproto.unmarshaler_all) = true; - // Indicates etcd version that introduced the message, used to determine minimal etcd version required to interpret wal that includes this message. extend google.protobuf.MessageOptions { optional string etcd_version_msg = 50000; diff --git a/vendor/go.etcd.io/etcd/client/pkg/v3/LICENSE b/vendor/go.etcd.io/etcd/client/pkg/v3/LICENSE index d645695673..52fb9c29f2 100644 --- a/vendor/go.etcd.io/etcd/client/pkg/v3/LICENSE +++ b/vendor/go.etcd.io/etcd/client/pkg/v3/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2020 The etcd Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/go.etcd.io/etcd/client/pkg/v3/transport/listener.go b/vendor/go.etcd.io/etcd/client/pkg/v3/transport/listener.go index 9c2d29ba99..659bb7adb1 100644 --- a/vendor/go.etcd.io/etcd/client/pkg/v3/transport/listener.go +++ b/vendor/go.etcd.io/etcd/client/pkg/v3/transport/listener.go @@ -39,7 +39,7 @@ import ( "go.etcd.io/etcd/client/pkg/v3/verify" ) -// NewListener creates a new listner. +// NewListener creates a new listener. func NewListener(addr, scheme string, tlsinfo *TLSInfo) (l net.Listener, err error) { return newListener(addr, scheme, WithTLSInfo(tlsinfo)) } diff --git a/vendor/go.etcd.io/etcd/client/pkg/v3/transport/listener_opts.go b/vendor/go.etcd.io/etcd/client/pkg/v3/transport/listener_opts.go index 7536f6aff4..cec7484e72 100644 --- a/vendor/go.etcd.io/etcd/client/pkg/v3/transport/listener_opts.go +++ b/vendor/go.etcd.io/etcd/client/pkg/v3/transport/listener_opts.go @@ -53,7 +53,7 @@ func (lo *ListenerOptions) IsSocketOpts() bool { return lo.socketOpts.ReusePort || lo.socketOpts.ReuseAddress } -// IsTLS returns true if listner options includes TLSInfo. +// IsTLS returns true if listener options includes TLSInfo. func (lo *ListenerOptions) IsTLS() bool { if lo.tlsInfo == nil { return false diff --git a/vendor/go.etcd.io/etcd/client/pkg/v3/transport/listener_tls.go b/vendor/go.etcd.io/etcd/client/pkg/v3/transport/listener_tls.go index 2c94841625..63566e1f64 100644 --- a/vendor/go.etcd.io/etcd/client/pkg/v3/transport/listener_tls.go +++ b/vendor/go.etcd.io/etcd/client/pkg/v3/transport/listener_tls.go @@ -166,6 +166,29 @@ func (l *tlsListener) acceptLoop() { } } +// ConfigureCRLVerification appends a VerifyConnection hook to cfg that +// rejects any peer certificate whose serial number appears in the CRL file +// configured on info. It is a no-op when CRLFile is empty. Any existing +// VerifyConnection hook is called first and its error short-circuits. +func (info TLSInfo) ConfigureCRLVerification(cfg *tls.Config) { + if len(info.CRLFile) == 0 { + return + } + crlFile := info.CRLFile + prev := cfg.VerifyConnection + cfg.VerifyConnection = func(cs tls.ConnectionState) error { + if prev != nil { + if err := prev(cs); err != nil { + return err + } + } + if len(cs.PeerCertificates) == 0 { + return nil + } + return checkCRL(crlFile, cs.PeerCertificates) + } +} + func checkCRL(crlPath string, cert []*x509.Certificate) error { // TODO: cache crlBytes, err := os.ReadFile(crlPath) diff --git a/vendor/go.etcd.io/etcd/client/pkg/v3/transport/timeout_transport.go b/vendor/go.etcd.io/etcd/client/pkg/v3/transport/timeout_transport.go index ea16b4c0f8..6b6bc67156 100644 --- a/vendor/go.etcd.io/etcd/client/pkg/v3/transport/timeout_transport.go +++ b/vendor/go.etcd.io/etcd/client/pkg/v3/transport/timeout_transport.go @@ -39,7 +39,7 @@ func NewTimeoutTransport(info TLSInfo, dialtimeoutd, rdtimeoutd, wtimeoutd time. tr.MaxIdleConnsPerHost = 1024 } - tr.Dial = (&rwTimeoutDialer{ + tr.Dial = (&rwTimeoutDialer{ //nolint:staticcheck // TODO: remove for a supported version Dialer: net.Dialer{ Timeout: dialtimeoutd, KeepAlive: 30 * time.Second, diff --git a/vendor/go.etcd.io/etcd/client/pkg/v3/types/set.go b/vendor/go.etcd.io/etcd/client/pkg/v3/types/set.go index 3e69c8d8b9..8c9d8773ef 100644 --- a/vendor/go.etcd.io/etcd/client/pkg/v3/types/set.go +++ b/vendor/go.etcd.io/etcd/client/pkg/v3/types/set.go @@ -23,15 +23,23 @@ import ( type Set interface { Add(string) Remove(string) - Contains(string) bool + Contains(val ...string) bool Equals(Set) bool Length() int Values() []string Copy() Set Sub(Set) Set + + // ContainsAll returns whether the set contains all given values + // Deprecated: Use Contains instead. + ContainsAll(values []string) bool +} + +type ThreadsafeSet interface { + Set } -func NewUnsafeSet(values ...string) *unsafeSet { +func NewUnsafeSet(values ...string) Set { set := &unsafeSet{make(map[string]struct{})} for _, v := range values { set.Add(v) @@ -39,11 +47,13 @@ func NewUnsafeSet(values ...string) *unsafeSet { return set } -func NewThreadsafeSet(values ...string) *tsafeSet { +func NewThreadsafeSet(values ...string) ThreadsafeSet { us := NewUnsafeSet(values...) return &tsafeSet{us, sync.RWMutex{}} } +var _ Set = (*unsafeSet)(nil) + type unsafeSet struct { d map[string]struct{} } @@ -59,12 +69,17 @@ func (us *unsafeSet) Remove(value string) { } // Contains returns whether the set contains the given value -func (us *unsafeSet) Contains(value string) (exists bool) { - _, exists = us.d[value] - return exists +func (us *unsafeSet) Contains(values ...string) (exists bool) { + for _, value := range values { + if _, exists := us.d[value]; !exists { + return false + } + } + return true } // ContainsAll returns whether the set contains all given values +// Deprecated: Use Contains instead. func (us *unsafeSet) ContainsAll(values []string) bool { for _, s := range values { if !us.Contains(s) { @@ -122,8 +137,10 @@ func (us *unsafeSet) Sub(other Set) Set { return result } +var _ ThreadsafeSet = (*tsafeSet)(nil) + type tsafeSet struct { - us *unsafeSet + us Set m sync.RWMutex } @@ -139,10 +156,18 @@ func (ts *tsafeSet) Remove(value string) { ts.us.Remove(value) } -func (ts *tsafeSet) Contains(value string) (exists bool) { +func (ts *tsafeSet) Contains(values ...string) (exists bool) { + ts.m.RLock() + defer ts.m.RUnlock() + return ts.us.Contains(values...) +} + +// ContainsAll returns whether the set contains all given values +// Deprecated: Use Contains instead. +func (ts *tsafeSet) ContainsAll(values []string) bool { ts.m.RLock() defer ts.m.RUnlock() - return ts.us.Contains(value) + return ts.us.ContainsAll(values) } func (ts *tsafeSet) Equals(other Set) bool { diff --git a/vendor/go.etcd.io/etcd/client/pkg/v3/types/urls.go b/vendor/go.etcd.io/etcd/client/pkg/v3/types/urls.go index 49a38967e6..7dca16c048 100644 --- a/vendor/go.etcd.io/etcd/client/pkg/v3/types/urls.go +++ b/vendor/go.etcd.io/etcd/client/pkg/v3/types/urls.go @@ -47,7 +47,6 @@ func NewURLs(strs []string) (URLs, error) { return nil, fmt.Errorf("URL must not contain a path: %s", in) } case "unix", "unixs": - break default: return nil, fmt.Errorf("URL scheme must be http, https, unix, or unixs: %s", in) } diff --git a/vendor/go.etcd.io/etcd/client/pkg/v3/verify/verify.go b/vendor/go.etcd.io/etcd/client/pkg/v3/verify/verify.go index a7b2097bed..cb48d8ff02 100644 --- a/vendor/go.etcd.io/etcd/client/pkg/v3/verify/verify.go +++ b/vendor/go.etcd.io/etcd/client/pkg/v3/verify/verify.go @@ -66,9 +66,18 @@ func DisableVerifications() func() { // Verify performs verification if the assertions are enabled. // In the default setup running in tests and skipped in the production code. -func Verify(f func()) { +func Verify(msg string, f VerifyFunc) { if IsVerificationEnabled(envVerifyValueAssert) { - f() + ok, details := f() + verifier(ok, msg, details) + } +} + +type VerifyFunc func() (condition bool, details map[string]any) + +func verifier(condition bool, msg string, details map[string]any) { + if !condition { + panic(fmt.Sprintf("%s. details: %v.", msg, details)) } } diff --git a/vendor/go.etcd.io/etcd/client/v3/.gomodguard.yaml b/vendor/go.etcd.io/etcd/client/v3/.gomodguard.yaml new file mode 100644 index 0000000000..138dedc4f7 --- /dev/null +++ b/vendor/go.etcd.io/etcd/client/v3/.gomodguard.yaml @@ -0,0 +1,13 @@ +--- +blocked: + modules: + - go.etcd.io/etcd: + reason: "Forbidden dependency" + - go.etcd.io/etcd/pkg/v3: + reason: "Forbidden dependency" + - go.etcd.io/etcd/server/v3: + reason: "Forbidden dependency" + - go.etcd.io/etcd/tests/v3: + reason: "Forbidden dependency" + - go.etcd.io/etcd/v3: + reason: "Forbidden dependency" diff --git a/vendor/go.etcd.io/etcd/client/v3/LICENSE b/vendor/go.etcd.io/etcd/client/v3/LICENSE index d645695673..52fb9c29f2 100644 --- a/vendor/go.etcd.io/etcd/client/v3/LICENSE +++ b/vendor/go.etcd.io/etcd/client/v3/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2020 The etcd Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/go.etcd.io/etcd/client/v3/auth.go b/vendor/go.etcd.io/etcd/client/v3/auth.go index 382172b21b..7d9a55f1d4 100644 --- a/vendor/go.etcd.io/etcd/client/v3/auth.go +++ b/vendor/go.etcd.io/etcd/client/v3/auth.go @@ -49,9 +49,9 @@ type ( ) const ( - PermRead = authpb.READ - PermWrite = authpb.WRITE - PermReadWrite = authpb.READWRITE + PermRead = authpb.Permission_READ + PermWrite = authpb.Permission_WRITE + PermReadWrite = authpb.Permission_READWRITE ) type UserAddOptions authpb.UserAddOptions diff --git a/vendor/go.etcd.io/etcd/client/v3/block_logger.go b/vendor/go.etcd.io/etcd/client/v3/block_logger.go new file mode 100644 index 0000000000..a581292843 --- /dev/null +++ b/vendor/go.etcd.io/etcd/client/v3/block_logger.go @@ -0,0 +1,67 @@ +// Copyright 2026 The etcd 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 clientv3 + +import ( + "sync" + "time" +) + +type blockLogger struct { + interval time.Duration + threshold time.Duration + now func() time.Time + logFunc func(eventCount int, timeWaiting time.Duration, window time.Duration) + + mu sync.Mutex + lastLogTime time.Time + eventCount int + timeWaiting time.Duration +} + +func newBlockLogger(interval time.Duration, threshold time.Duration, now func() time.Time, logFunc func(eventCount int, timeWaiting time.Duration, window time.Duration)) *blockLogger { + if now == nil { + now = time.Now + } + l := &blockLogger{ + interval: interval, + threshold: threshold, + now: now, + logFunc: logFunc, + } + l.lastLogTime = l.now() + return l +} + +func (l *blockLogger) recordWait(waitTime time.Duration) { + l.mu.Lock() + defer l.mu.Unlock() + + l.eventCount++ + l.timeWaiting += waitTime + + now := l.now() + window := now.Sub(l.lastLogTime) + if window < l.interval { + return + } + + if l.timeWaiting > l.threshold && l.logFunc != nil { + l.logFunc(l.eventCount, l.timeWaiting, window) + } + l.eventCount = 0 + l.timeWaiting = 0 + l.lastLogTime = now +} diff --git a/vendor/go.etcd.io/etcd/client/v3/client.go b/vendor/go.etcd.io/etcd/client/v3/client.go index 24f5988986..43d47077fe 100644 --- a/vendor/go.etcd.io/etcd/client/v3/client.go +++ b/vendor/go.etcd.io/etcd/client/v3/client.go @@ -20,6 +20,7 @@ import ( "fmt" "strings" "sync" + "sync/atomic" "time" "github.com/coreos/go-semver/semver" @@ -43,6 +44,7 @@ import ( var ( ErrNoAvailableEndpoints = errors.New("etcdclient: no available endpoints") ErrOldCluster = errors.New("etcdclient: old cluster version") + ErrMutuallyExclusiveCfg = errors.New("Username/Password and Token configurations are mutually exclusive") ) // Client provides and manages an etcd v3 client session. @@ -69,13 +71,15 @@ type Client struct { // Username is a user name for authentication. Username string // Password is a password for authentication. - Password string + Password string + // Token is a JWT used for authentication instead of a password. + Token string + authTokenBundle credentials.PerRPCCredentialsBundle callOpts []grpc.CallOption - lgMu *sync.RWMutex - lg *zap.Logger + lg atomic.Pointer[zap.Logger] } // New creates a new etcdv3 client from a given configuration. @@ -92,12 +96,12 @@ func New(cfg Config) (*Client, error) { // service interface implementations and do not need connection management. func NewCtxClient(ctx context.Context, opts ...Option) *Client { cctx, cancel := context.WithCancel(ctx) - c := &Client{ctx: cctx, cancel: cancel, lgMu: new(sync.RWMutex), epMu: new(sync.RWMutex)} + c := &Client{ctx: cctx, cancel: cancel, epMu: new(sync.RWMutex)} for _, opt := range opts { opt(c) } - if c.lg == nil { - c.lg = zap.NewNop() + if c.lg.Load() == nil { + c.lg.Store(zap.NewNop()) } return c } @@ -118,7 +122,7 @@ func NewFromURLs(urls []string) (*Client, error) { // WithZapLogger is a NewCtxClient option that overrides the logger func WithZapLogger(lg *zap.Logger) Option { return func(c *Client) { - c.lg = lg + c.lg.Store(lg) } } @@ -129,19 +133,14 @@ func WithZapLogger(lg *zap.Logger) Option { // Does not changes grpcLogger, that can be explicitly configured // using grpc_zap.ReplaceGrpcLoggerV2(..) method. func (c *Client) WithLogger(lg *zap.Logger) *Client { - c.lgMu.Lock() - c.lg = lg - c.lgMu.Unlock() + c.lg.Store(lg) return c } // GetLogger gets the logger. // NOTE: This method is for internal use of etcd-client library and should not be used as general-purpose logger. func (c *Client) GetLogger() *zap.Logger { - c.lgMu.RLock() - l := c.lg - c.lgMu.RUnlock() - return l + return c.lg.Load() } // Close shuts down the client's etcd connections. @@ -197,13 +196,11 @@ func (c *Client) Sync(ctx context.Context) error { } // The linearizable `MemberList` returned successfully, so the // endpoints shouldn't be empty. - verify.Verify(func() { - if len(eps) == 0 { - panic("empty endpoints returned from etcd cluster") - } + verify.Verify("empty endpoints returned from etcd cluster", func() (bool, map[string]any) { + return len(eps) > 0, nil }) c.SetEndpoints(eps...) - c.lg.Debug("set etcd endpoints by autoSync", zap.Strings("endpoints", eps)) + c.GetLogger().Debug("set etcd endpoints by autoSync", zap.Strings("endpoints", eps)) return nil } @@ -221,7 +218,7 @@ func (c *Client) autoSync() { err := c.Sync(ctx) cancel() if err != nil && !errors.Is(err, c.ctx.Err()) { - c.lg.Info("Auto sync endpoints failed.", zap.Error(err)) + c.GetLogger().Info("Auto sync endpoints failed.", zap.Error(err)) } } } @@ -288,6 +285,11 @@ func (c *Client) Dial(ep string) (*grpc.ClientConn, error) { func (c *Client) getToken(ctx context.Context) error { var err error // return last error in a case of fail + if c.Token != "" { + c.authTokenBundle.UpdateAuthToken(c.Token) + return nil + } + if c.Username == "" || c.Password == "" { return nil } @@ -322,18 +324,8 @@ func (c *Client) dial(creds grpccredentials.TransportCredentials, dopts ...grpc. opts = append(opts, c.cfg.DialOptions...) - dctx := c.ctx - if c.cfg.DialTimeout > 0 { - var cancel context.CancelFunc - dctx, cancel = context.WithTimeout(c.ctx, c.cfg.DialTimeout) - defer cancel() // TODO: Is this right for cases where grpc.WithBlock() is not set on the dial options? - } target := fmt.Sprintf("%s://%p/%s", resolver.Schema, c, authority(c.endpoints[0])) - conn, err := grpc.DialContext(dctx, target, opts...) - if err != nil { - return nil, err - } - return conn, nil + return grpc.NewClient(target, opts...) } func authority(endpoint string) string { @@ -376,6 +368,10 @@ func newClient(cfg *Config) (*Client, error) { creds = credentials.NewTransportCredential(cfg.TLS) } + if cfg.Token != "" && (cfg.Username != "" || cfg.Password != "") { + return nil, ErrMutuallyExclusiveCfg + } + // use a temporary skeleton client to bootstrap first connection baseCtx := context.TODO() if cfg.Context != nil { @@ -391,29 +387,36 @@ func newClient(cfg *Config) (*Client, error) { cancel: cancel, epMu: new(sync.RWMutex), callOpts: defaultCallOpts, - lgMu: new(sync.RWMutex), } var err error + var lg *zap.Logger if cfg.Logger != nil { - client.lg = cfg.Logger + lg = cfg.Logger } else if cfg.LogConfig != nil { - client.lg, err = cfg.LogConfig.Build() + lg, err = cfg.LogConfig.Build() } else { - client.lg, err = logutil.CreateDefaultZapLogger(etcdClientDebugLevel()) - if client.lg != nil { - client.lg = client.lg.Named("etcd-client") + lg, err = logutil.CreateDefaultZapLogger(ClientLogLevel()) + if lg != nil { + lg = lg.Named("etcd-client") } } if err != nil { return nil, err } + client.lg.Store(lg) if cfg.Username != "" && cfg.Password != "" { client.Username = cfg.Username client.Password = cfg.Password client.authTokenBundle = credentials.NewPerRPCCredentialBundle() } + + if cfg.Token != "" { + client.Token = cfg.Token + client.authTokenBundle = credentials.NewPerRPCCredentialBundle() + } + if cfg.MaxCallSendMsgSize > 0 || cfg.MaxCallRecvMsgSize > 0 { if cfg.MaxCallRecvMsgSize > 0 && cfg.MaxCallSendMsgSize > cfg.MaxCallRecvMsgSize { return nil, fmt.Errorf("gRPC message recv limit (%d bytes) must be greater than send limit (%d bytes)", cfg.MaxCallRecvMsgSize, cfg.MaxCallSendMsgSize) @@ -491,10 +494,10 @@ func (c *Client) roundRobinQuorumBackoff(waitBetween time.Duration, jitterFracti n := uint(len(c.Endpoints())) quorum := (n/2 + 1) if attempt%quorum == 0 { - c.lg.Debug("backoff", zap.Uint("attempt", attempt), zap.Uint("quorum", quorum), zap.Duration("waitBetween", waitBetween), zap.Float64("jitterFraction", jitterFraction)) + c.GetLogger().Debug("backoff", zap.Uint("attempt", attempt), zap.Uint("quorum", quorum), zap.Duration("waitBetween", waitBetween), zap.Float64("jitterFraction", jitterFraction)) return jitterUp(waitBetween, jitterFraction) } - c.lg.Debug("backoff skipped", zap.Uint("attempt", attempt), zap.Uint("quorum", quorum)) + c.GetLogger().Debug("backoff skipped", zap.Uint("attempt", attempt), zap.Uint("quorum", quorum)) return 0 } } diff --git a/vendor/go.etcd.io/etcd/client/v3/compare.go b/vendor/go.etcd.io/etcd/client/v3/compare.go index 663fdb4d20..25a6e65576 100644 --- a/vendor/go.etcd.io/etcd/client/v3/compare.go +++ b/vendor/go.etcd.io/etcd/client/v3/compare.go @@ -15,6 +15,8 @@ package clientv3 import ( + "google.golang.org/protobuf/proto" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" ) @@ -30,7 +32,25 @@ const ( CompareValue ) -type Cmp pb.Compare +type Cmp struct { + c *pb.Compare +} + +func FromCompare(c *pb.Compare) Cmp { + return Cmp{c: cloneCompare(c)} +} + +func (cmp *Cmp) GetCompare() *pb.Compare { + cmp.ensureCompare() + return cmp.c +} + +func (cmp *Cmp) Clone() Cmp { + if cmp.c == nil { + return Cmp{} + } + return Cmp{c: cloneCompare(cmp.c)} +} func Compare(cmp Cmp, result string, v any) Cmp { var r pb.Compare_CompareResult @@ -48,22 +68,24 @@ func Compare(cmp Cmp, result string, v any) Cmp { panic("Unknown result op") } - cmp.Result = r - switch cmp.Target { + cmp = cmp.Clone() + cmp.ensureCompare() + cmp.c.Result = r + switch cmp.c.Target { case pb.Compare_VALUE: val, ok := v.(string) if !ok { panic("bad compare value") } - cmp.TargetUnion = &pb.Compare_Value{Value: []byte(val)} + cmp.c.TargetUnion = &pb.Compare_Value{Value: []byte(val)} case pb.Compare_VERSION: - cmp.TargetUnion = &pb.Compare_Version{Version: mustInt64(v)} + cmp.c.TargetUnion = &pb.Compare_Version{Version: mustInt64(v)} case pb.Compare_CREATE: - cmp.TargetUnion = &pb.Compare_CreateRevision{CreateRevision: mustInt64(v)} + cmp.c.TargetUnion = &pb.Compare_CreateRevision{CreateRevision: mustInt64(v)} case pb.Compare_MOD: - cmp.TargetUnion = &pb.Compare_ModRevision{ModRevision: mustInt64(v)} + cmp.c.TargetUnion = &pb.Compare_ModRevision{ModRevision: mustInt64(v)} case pb.Compare_LEASE: - cmp.TargetUnion = &pb.Compare_Lease{Lease: mustInt64orLeaseID(v)} + cmp.c.TargetUnion = &pb.Compare_Lease{Lease: mustInt64orLeaseID(v)} default: panic("Unknown compare type") } @@ -71,53 +93,74 @@ func Compare(cmp Cmp, result string, v any) Cmp { } func Value(key string) Cmp { - return Cmp{Key: []byte(key), Target: pb.Compare_VALUE} + return Cmp{c: &pb.Compare{Key: []byte(key), Target: pb.Compare_VALUE}} } func Version(key string) Cmp { - return Cmp{Key: []byte(key), Target: pb.Compare_VERSION} + return Cmp{c: &pb.Compare{Key: []byte(key), Target: pb.Compare_VERSION}} } func CreateRevision(key string) Cmp { - return Cmp{Key: []byte(key), Target: pb.Compare_CREATE} + return Cmp{c: &pb.Compare{Key: []byte(key), Target: pb.Compare_CREATE}} } func ModRevision(key string) Cmp { - return Cmp{Key: []byte(key), Target: pb.Compare_MOD} + return Cmp{c: &pb.Compare{Key: []byte(key), Target: pb.Compare_MOD}} } // LeaseValue compares a key's LeaseID to a value of your choosing. The empty // LeaseID is 0, otherwise known as `NoLease`. func LeaseValue(key string) Cmp { - return Cmp{Key: []byte(key), Target: pb.Compare_LEASE} + return Cmp{c: &pb.Compare{Key: []byte(key), Target: pb.Compare_LEASE}} +} + +func (cmp *Cmp) ensureCompare() { + if cmp.c == nil { + cmp.c = &pb.Compare{} + } } // KeyBytes returns the byte slice holding with the comparison key. -func (cmp *Cmp) KeyBytes() []byte { return cmp.Key } +func (cmp *Cmp) KeyBytes() []byte { + if cmp == nil { + return nil + } + return cmp.c.GetKey() +} // WithKeyBytes sets the byte slice for the comparison key. -func (cmp *Cmp) WithKeyBytes(key []byte) { cmp.Key = key } +func (cmp *Cmp) WithKeyBytes(key []byte) { + cmp.ensureCompare() + cmp.c.Key = key +} // ValueBytes returns the byte slice holding the comparison value, if any. func (cmp *Cmp) ValueBytes() []byte { - if tu, ok := cmp.TargetUnion.(*pb.Compare_Value); ok { + if tu, ok := cmp.GetCompare().GetTargetUnion().(*pb.Compare_Value); ok { return tu.Value } return nil } // WithValueBytes sets the byte slice for the comparison's value. -func (cmp *Cmp) WithValueBytes(v []byte) { cmp.TargetUnion.(*pb.Compare_Value).Value = v } +func (cmp *Cmp) WithValueBytes(v []byte) { + cmp.ensureCompare() + cmp.c.TargetUnion.(*pb.Compare_Value).Value = v +} // WithRange sets the comparison to scan the range [key, end). func (cmp Cmp) WithRange(end string) Cmp { - cmp.RangeEnd = []byte(end) + cmp = cmp.Clone() + cmp.ensureCompare() + cmp.c.RangeEnd = []byte(end) return cmp } // WithPrefix sets the comparison to scan all keys prefixed by the key. func (cmp Cmp) WithPrefix() Cmp { - cmp.RangeEnd = getPrefix(cmp.Key) + cmp = cmp.Clone() + cmp.ensureCompare() + cmp.c.RangeEnd = getPrefix(cmp.c.GetKey()) return cmp } @@ -140,3 +183,10 @@ func mustInt64orLeaseID(val any) int64 { } return mustInt64(val) } + +func cloneCompare(c *pb.Compare) *pb.Compare { + if c == nil { + return nil + } + return proto.Clone(c).(*pb.Compare) +} diff --git a/vendor/go.etcd.io/etcd/client/v3/config.go b/vendor/go.etcd.io/etcd/client/v3/config.go index 8351828d2f..153bb97bbc 100644 --- a/vendor/go.etcd.io/etcd/client/v3/config.go +++ b/vendor/go.etcd.io/etcd/client/v3/config.go @@ -33,7 +33,14 @@ type Config struct { // 0 disables auto-sync. By default auto-sync is disabled. AutoSyncInterval time.Duration `json:"auto-sync-interval"` - // DialTimeout is the timeout for failing to establish a connection. + // DialTimeout is the timeout used for certain operations, such as fetching + // an authentication token and checking the cluster version (when + // RejectOldCluster is true). It is also used to derive the initial + // keep-alive timeout for lease keep-alives (DialTimeout + 1s). + // It is NOT used to bound the gRPC connection establishment itself, + // because client creation is non-blocking since + // https://github.com/etcd-io/etcd/pull/21832. + // A value of 0 means no timeout is applied to those operations. DialTimeout time.Duration `json:"dial-timeout"` // DialKeepAliveTime is the time after which client pings the server to see if @@ -66,12 +73,15 @@ type Config struct { // Password is a password for authentication. Password string `json:"password"` + // Token is a JWT used for authentication instead of a password. + Token string `json:"token"` + // RejectOldCluster when set will refuse to create a client against an outdated cluster. RejectOldCluster bool `json:"reject-old-cluster"` // DialOptions is a list of dial options for the grpc client (e.g., for interceptors). - // For example, pass "grpc.WithBlock()" to block until the underlying connection is up. - // Without this, Dial returns immediately and connecting the server happens in background. + // Note that grpc.NewClient ignores options that are specific to grpc.Dial such as + // "grpc.WithBlock()". DialOptions []grpc.DialOption // Context is the default client context; it can be used to cancel grpc dial out and @@ -130,6 +140,7 @@ type SecureConfig struct { type AuthConfig struct { Username string `json:"username"` Password string `json:"password"` + Token string `json:"token"` } func (cs *ConfigSpec) Clone() *ConfigSpec { @@ -157,7 +168,7 @@ func (cs *ConfigSpec) Clone() *ConfigSpec { } func (cfg AuthConfig) Empty() bool { - return cfg.Username == "" && cfg.Password == "" + return cfg.Username == "" && cfg.Password == "" && cfg.Token == "" } // NewClientConfig creates a Config based on the provided ConfigSpec. @@ -180,6 +191,7 @@ func NewClientConfig(confSpec *ConfigSpec, lg *zap.Logger) (*Config, error) { if confSpec.Auth != nil { cfg.Username = confSpec.Auth.Username cfg.Password = confSpec.Auth.Password + cfg.Token = confSpec.Auth.Token } return cfg, nil diff --git a/vendor/go.etcd.io/etcd/client/v3/internal/resolver/resolver.go b/vendor/go.etcd.io/etcd/client/v3/internal/resolver/resolver.go index 403b745cb7..c7f9fb1aee 100644 --- a/vendor/go.etcd.io/etcd/client/v3/internal/resolver/resolver.go +++ b/vendor/go.etcd.io/etcd/client/v3/internal/resolver/resolver.go @@ -60,7 +60,7 @@ func (r *EtcdManualResolver) SetEndpoints(endpoints []string) { } func (r EtcdManualResolver) updateState() { - if r.CC != nil { + if getCC(r) != nil { eps := make([]resolver.Endpoint, len(r.endpoints)) for i, ep := range r.endpoints { addr, serverName := endpoint.Interpret(ep) @@ -75,3 +75,13 @@ func (r EtcdManualResolver) updateState() { r.UpdateState(state) } } + +func getCC(r EtcdManualResolver) (cc resolver.ClientConn) { + defer func() { + if rec := recover(); rec != nil { + cc = nil + } + }() + + return r.CC() +} diff --git a/vendor/go.etcd.io/etcd/client/v3/kv.go b/vendor/go.etcd.io/etcd/client/v3/kv.go index 8d0c595d1e..c0d3ace313 100644 --- a/vendor/go.etcd.io/etcd/client/v3/kv.go +++ b/vendor/go.etcd.io/etcd/client/v3/kv.go @@ -16,7 +16,10 @@ package clientv3 import ( "context" + "errors" + "io" + "github.com/golang/protobuf/proto" //nolint:staticcheck // TODO: remove for a supported version "google.golang.org/grpc" pb "go.etcd.io/etcd/api/v3/etcdserverpb" @@ -27,6 +30,7 @@ type ( CompactResponse pb.CompactionResponse PutResponse pb.PutResponse GetResponse pb.RangeResponse + GetStreamChan <-chan RangeStreamResponse DeleteResponse pb.DeleteRangeResponse TxnResponse pb.TxnResponse ) @@ -48,6 +52,15 @@ type KV interface { // When passed WithSort(), the keys will be sorted. Get(ctx context.Context, key string, opts ...OpOption) (*GetResponse, error) + // RangeStream retrieves keys. + // By default, will return the value for "key", if any. + // When passed WithRange(end), will return the keys in the range [key, end). + // When passed WithFromKey(), returns keys greater than or equal to key. + // When passed WithRev(rev) with rev > 0, retrieves keys at the given revision; + // if the required revision is compacted, the request will fail with ErrCompacted . + // When passed WithLimit(limit), the number of returned keys is bounded by limit. + GetStream(ctx context.Context, key string, opts ...OpOption) (GetStreamChan, error) + // Delete deletes a key, or optionally using WithRange(end), [key, end). Delete(ctx context.Context, key string, opts ...OpOption) (*DeleteResponse, error) @@ -65,6 +78,35 @@ type KV interface { Txn(ctx context.Context) Txn } +// RangeStreamResponse holds a single chunk from a RangeStream RPC. Kvs is +// disjoint per chunk; Header, More, and Count are populated only on the +// final chunk. +// +// On a non-EOF stream error, the final value sent on the channel is a +// terminal RangeStreamResponse with RangeResponse == nil and a non-nil +// Err(). +type RangeStreamResponse struct { + *pb.RangeResponse + closeErr error +} + +// Err returns the error value if this RangeStreamResponse is the terminal +// error response for a stream that failed mid-flight. +func (r *RangeStreamResponse) Err() error { + return r.closeErr +} + +func GetStreamToGetResponse(stream GetStreamChan) (*GetResponse, error) { + resp := &pb.RangeResponse{} + for r := range stream { + if err := r.Err(); err != nil { + return nil, err + } + proto.Merge(resp, r.RangeResponse) + } + return (*GetResponse)(resp), nil +} + type OpResponse struct { put *PutResponse get *GetResponse @@ -124,6 +166,29 @@ func (kv *kv) Get(ctx context.Context, key string, opts ...OpOption) (*GetRespon return r.get, ContextError(ctx, err) } +func (kv *kv) GetStream(ctx context.Context, key string, opts ...OpOption) (GetStreamChan, error) { + op := OpGet(key, opts...) + c, err := kv.remote.RangeStream(ctx, op.toRangeRequest(), kv.callOpts...) + if err != nil { + return nil, ContextError(ctx, err) + } + respCh := make(chan RangeStreamResponse, 1) + go func() { + defer close(respCh) + for { + resp, err := c.Recv() + if err != nil { + if !errors.Is(err, io.EOF) { + respCh <- RangeStreamResponse{closeErr: ContextError(ctx, err)} + } + return + } + respCh <- RangeStreamResponse{RangeResponse: resp.RangeResponse} + } + }() + return respCh, nil +} + func (kv *kv) Delete(ctx context.Context, key string, opts ...OpOption) (*DeleteResponse, error) { r, err := kv.Do(ctx, OpDelete(key, opts...)) return r.del, ContextError(ctx, err) @@ -134,7 +199,7 @@ func (kv *kv) Compact(ctx context.Context, rev int64, opts ...CompactOption) (*C if err != nil { return nil, ContextError(ctx, err) } - return (*CompactResponse)(resp), err + return (*CompactResponse)(resp), nil } func (kv *kv) Txn(ctx context.Context) Txn { diff --git a/vendor/go.etcd.io/etcd/client/v3/lease.go b/vendor/go.etcd.io/etcd/client/v3/lease.go index 11b5834828..ab5c559a54 100644 --- a/vendor/go.etcd.io/etcd/client/v3/lease.go +++ b/vendor/go.etcd.io/etcd/client/v3/lease.go @@ -204,7 +204,7 @@ func NewLeaseFromLeaseClient(remote pb.LeaseClient, c *Client, keepAliveTimeout l.firstKeepAliveTimeout = defaultTTL } if c != nil { - l.lg = c.lg + l.lg = c.GetLogger() l.callOpts = c.callOpts } reqLeaderCtx := WithRequireLeader(context.Background()) diff --git a/vendor/go.etcd.io/etcd/client/v3/logger.go b/vendor/go.etcd.io/etcd/client/v3/logger.go index 300363cd25..530f5264c2 100644 --- a/vendor/go.etcd.io/etcd/client/v3/logger.go +++ b/vendor/go.etcd.io/etcd/client/v3/logger.go @@ -29,7 +29,7 @@ func init() { // We override grpc logger only when the environment variable is set // in order to not interfere by default with user's code or other libraries. if os.Getenv("ETCD_CLIENT_DEBUG") != "" { - lg, err := logutil.CreateDefaultZapLogger(etcdClientDebugLevel()) + lg, err := logutil.CreateDefaultZapLogger(ClientLogLevel()) if err != nil { panic(err) } @@ -45,8 +45,8 @@ func SetLogger(l grpclog.LoggerV2) { grpclog.SetLoggerV2(l) } -// etcdClientDebugLevel translates ETCD_CLIENT_DEBUG into zap log level. -func etcdClientDebugLevel() zapcore.Level { +// ClientLogLevel translates ETCD_CLIENT_DEBUG into zap log level. +func ClientLogLevel() zapcore.Level { envLevel := os.Getenv("ETCD_CLIENT_DEBUG") if envLevel == "" || envLevel == "true" { return zapcore.InfoLevel diff --git a/vendor/go.etcd.io/etcd/client/v3/maintenance.go b/vendor/go.etcd.io/etcd/client/v3/maintenance.go index 00aaacd15f..d76ae231fe 100644 --- a/vendor/go.etcd.io/etcd/client/v3/maintenance.go +++ b/vendor/go.etcd.io/etcd/client/v3/maintenance.go @@ -113,7 +113,7 @@ type maintenance struct { func NewMaintenance(c *Client) Maintenance { api := &maintenance{ - lg: c.lg, + lg: c.GetLogger(), dial: func(endpoint string) (pb.MaintenanceClient, func(), error) { conn, err := c.Dial(endpoint) if err != nil { @@ -140,7 +140,7 @@ func NewMaintenanceFromMaintenanceClient(remote pb.MaintenanceClient, c *Client) } if c != nil { api.callOpts = c.callOpts - api.lg = c.lg + api.lg = c.GetLogger() } return api } diff --git a/vendor/go.etcd.io/etcd/client/v3/op.go b/vendor/go.etcd.io/etcd/client/v3/op.go index 20cb34f5c3..9542f0ccf7 100644 --- a/vendor/go.etcd.io/etcd/client/v3/op.go +++ b/vendor/go.etcd.io/etcd/client/v3/op.go @@ -55,7 +55,8 @@ type Op struct { // fragmentation should be disabled by default // if true, split watch events when total exceeds // "--max-request-bytes" flag value + 512-byte - fragment bool + fragment bool + watchBufLogEnabled bool // for put ignoreValue bool @@ -127,10 +128,31 @@ func (op Op) IsKeysOnly() bool { return op.keysOnly } // IsCountOnly returns whether countOnly is set. func (op Op) IsCountOnly() bool { return op.countOnly } +// IsSortSet returns true if WithSort is set. +func (op Op) IsSortSet() bool { return op.sort != nil } + func (op Op) IsOptsWithFromKey() bool { return op.isOptsWithFromKey } func (op Op) IsOptsWithPrefix() bool { return op.isOptsWithPrefix } +// IsPrevKV returns whether WithPrevKV() is set. +func (op Op) IsPrevKV() bool { return op.prevKV } + +// IsFragment returns whether WithFragment() is set. +func (op Op) IsFragment() bool { return op.fragment } + +// IsProgressNotify returns whether WithProgressNotify() is set. +func (op Op) IsProgressNotify() bool { return op.progressNotify } + +// IsCreatedNotify returns whether WithCreatedNotify() is set. +func (op Op) IsCreatedNotify() bool { return op.createdNotify } + +// IsFilterPut returns whether WithFilterPut() is set. +func (op Op) IsFilterPut() bool { return op.filterPut } + +// IsFilterDelete returns whether WithFilterDelete() is set. +func (op Op) IsFilterDelete() bool { return op.filterDelete } + // MinModRev returns the operation's minimum modify revision. func (op Op) MinModRev() int64 { return op.minModRev } @@ -187,7 +209,8 @@ func (op Op) toTxnRequest() *pb.TxnRequest { } cmps := make([]*pb.Compare, len(op.cmps)) for i := range op.cmps { - cmps[i] = (*pb.Compare)(&op.cmps[i]) + cmp := op.cmps[i].Clone() + cmps[i] = cmp.GetCompare() } return &pb.TxnRequest{Compare: cmps, Success: thenOps, Failure: elseOps} } @@ -305,10 +328,14 @@ func OpPut(key, val string, opts ...OpOption) Op { // OpTxn returns "txn" operation based on given transaction conditions. func OpTxn(cmps []Cmp, thenOps []Op, elseOps []Op) Op { - return Op{t: tTxn, cmps: cmps, thenOps: thenOps, elseOps: elseOps} + clonedCmps := make([]Cmp, len(cmps)) + for i := range cmps { + clonedCmps[i] = cmps[i].Clone() + } + return Op{t: tTxn, cmps: clonedCmps, thenOps: thenOps, elseOps: elseOps} } -func opWatch(key string, opts ...OpOption) Op { +func OpWatch(key string, opts ...OpOption) Op { ret := Op{t: tRange, key: []byte(key)} ret.applyOpts(opts) switch { @@ -529,6 +556,11 @@ func WithFragment() OpOption { return func(op *Op) { op.fragment = true } } +// WithWatchBufLog enables watch response buffer logging. +func WithWatchBufLog() OpOption { + return func(op *Op) { op.watchBufLogEnabled = true } +} + // WithIgnoreValue updates the key using its current value. // This option can not be combined with non-empty values. // Returns an error if the key does not exist. diff --git a/vendor/go.etcd.io/etcd/client/v3/retry.go b/vendor/go.etcd.io/etcd/client/v3/retry.go index 9152c53a7d..d4263c4b28 100644 --- a/vendor/go.etcd.io/etcd/client/v3/retry.go +++ b/vendor/go.etcd.io/etcd/client/v3/retry.go @@ -108,6 +108,10 @@ func (rkv *retryKVClient) Range(ctx context.Context, in *pb.RangeRequest, opts . return rkv.kc.Range(ctx, in, append(opts, withRepeatablePolicy())...) } +func (rkv *retryKVClient) RangeStream(ctx context.Context, in *pb.RangeRequest, opts ...grpc.CallOption) (pb.KV_RangeStreamClient, error) { + return rkv.kc.RangeStream(ctx, in, opts...) +} + func (rkv *retryKVClient) Put(ctx context.Context, in *pb.PutRequest, opts ...grpc.CallOption) (resp *pb.PutResponse, err error) { return rkv.kc.Put(ctx, in, opts...) } diff --git a/vendor/go.etcd.io/etcd/client/v3/retry_interceptor.go b/vendor/go.etcd.io/etcd/client/v3/retry_interceptor.go index 7703e673b0..18aa3ae80a 100644 --- a/vendor/go.etcd.io/etcd/client/v3/retry_interceptor.go +++ b/vendor/go.etcd.io/etcd/client/v3/retry_interceptor.go @@ -28,6 +28,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" + "google.golang.org/grpc/peer" "google.golang.org/grpc/status" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" @@ -42,6 +43,8 @@ func (c *Client) unaryClientInterceptor(optFuncs ...retryOption) grpc.UnaryClien return func(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { ctx = withVersion(ctx) grpcOpts, retryOpts := filterCallOptions(opts) + var p peer.Peer + grpcOpts = append(grpcOpts, grpc.Peer(&p)) callOpts := reuseOrNewWithCallOptions(intOpts, retryOpts) // short circuit for simplicity, and avoiding allocations. if callOpts.max == 0 { @@ -65,6 +68,7 @@ func (c *Client) unaryClientInterceptor(optFuncs ...retryOption) grpc.UnaryClien c.GetLogger().Warn( "retrying of unary invoker failed", zap.String("target", cc.Target()), + zap.String("peer", p.String()), zap.String("method", method), zap.Uint("attempt", attempt), zap.Error(lastErr), @@ -146,6 +150,11 @@ func (c *Client) streamClientInterceptor(optFuncs ...retryOption) grpc.StreamCli // shouldRefreshToken checks whether there's a need to refresh the token based on the error and callOptions, // and returns a boolean value. func (c *Client) shouldRefreshToken(err error, callOpts *options) bool { + if c.Token != "" { + // do not try to refresh the token as it is set by user + return false + } + if errors.Is(rpctypes.Error(err), rpctypes.ErrUserEmpty) { // refresh the token when username, password is present but the server returns ErrUserEmpty // which is possible when the client token is cleared somehow @@ -235,12 +244,12 @@ func (s *serverStreamingRetryingStream) RecvMsg(m any) error { } newStream, err := s.reestablishStreamAndResendBuffer(s.ctx) if err != nil { - s.client.lg.Error("failed reestablishStreamAndResendBuffer", zap.Error(err)) + s.client.GetLogger().Error("failed reestablishStreamAndResendBuffer", zap.Error(err)) return err // TODO(mwitkow): Maybe dial and transport errors should be retriable? } s.setStream(newStream) - s.client.lg.Warn("retrying RecvMsg", zap.Error(lastErr)) + s.client.GetLogger().Warn("retrying RecvMsg", zap.Error(lastErr)) attemptRetry, lastErr = s.receiveMsgAndIndicateRetry(m) if !attemptRetry { return lastErr @@ -273,7 +282,7 @@ func (s *serverStreamingRetryingStream) receiveMsgAndIndicateRetry(m any) (bool, if s.client.shouldRefreshToken(err, s.callOpts) { gtErr := s.client.refreshToken(s.ctx) if gtErr != nil { - s.client.lg.Warn("retry failed to fetch new auth token", zap.Error(gtErr)) + s.client.GetLogger().Warn("retry failed to fetch new auth token", zap.Error(gtErr)) return false, err // return the original error for simplicity } return true, err @@ -339,7 +348,7 @@ func isSafeRetry(c *Client, err error, callOpts *options) bool { case nonRepeatable: return isSafeRetryMutableRPC(err) default: - c.lg.Warn("unrecognized retry policy", zap.String("retryPolicy", callOpts.retryPolicy.String())) + c.GetLogger().Warn("unrecognized retry policy", zap.String("retryPolicy", callOpts.retryPolicy.String())) return false } } diff --git a/vendor/go.etcd.io/etcd/client/v3/txn.go b/vendor/go.etcd.io/etcd/client/v3/txn.go index 0a57332ac7..152016b34a 100644 --- a/vendor/go.etcd.io/etcd/client/v3/txn.go +++ b/vendor/go.etcd.io/etcd/client/v3/txn.go @@ -89,7 +89,8 @@ func (txn *txn) If(cs ...Cmp) Txn { txn.cif = true for i := range cs { - txn.cmps = append(txn.cmps, (*pb.Compare)(&cs[i])) + cmp := cs[i].Clone() + txn.cmps = append(txn.cmps, cmp.GetCompare()) } return txn diff --git a/vendor/go.etcd.io/etcd/client/v3/watch.go b/vendor/go.etcd.io/etcd/client/v3/watch.go index a46f98b8e2..46adce7ba8 100644 --- a/vendor/go.etcd.io/etcd/client/v3/watch.go +++ b/vendor/go.etcd.io/etcd/client/v3/watch.go @@ -33,8 +33,8 @@ import ( ) const ( - EventTypeDelete = mvccpb.DELETE - EventTypePut = mvccpb.PUT + EventTypeDelete = mvccpb.Event_DELETE + EventTypePut = mvccpb.Event_PUT closeSendErrTimeout = 250 * time.Millisecond @@ -44,12 +44,22 @@ const ( // InvalidWatchID represents an invalid watch ID and prevents duplication with an existing watch. InvalidWatchID = -1 + + watcherStreamBufWarningInterval = 5 * time.Second + watcherStreamBufWarningThreshold = 100 * time.Millisecond ) -type Event mvccpb.Event +type Event = mvccpb.Event type WatchChan <-chan WatchResponse +func ensureWatchHeader(hdr *pb.ResponseHeader) *pb.ResponseHeader { + if hdr != nil { + return hdr + } + return &pb.ResponseHeader{} +} + type Watcher interface { // Watch watches on a key or prefix. The watched events will be returned // through the returned channel. If revisions waiting to be sent over the @@ -89,7 +99,7 @@ type Watcher interface { } type WatchResponse struct { - Header pb.ResponseHeader + Header *pb.ResponseHeader Events []*Event // CompactRevision is the minimum revision the watcher may receive. @@ -105,18 +115,8 @@ type WatchResponse struct { closeErr error - // cancelReason is a reason of canceling watch - cancelReason string -} - -// IsCreate returns true if the event tells that the key is newly created. -func (e *Event) IsCreate() bool { - return e.Type == EventTypePut && e.Kv.CreateRevision == e.Kv.ModRevision -} - -// IsModify returns true if the event tells that a new value is put on existing key. -func (e *Event) IsModify() bool { - return e.Type == EventTypePut && e.Kv.CreateRevision != e.Kv.ModRevision + // CancelReason is a reason of canceling watch + CancelReason string } // Err is the error value if this WatchResponse holds an error. @@ -127,8 +127,8 @@ func (wr *WatchResponse) Err() error { case wr.CompactRevision != 0: return v3rpc.ErrCompacted case wr.Canceled: - if len(wr.cancelReason) != 0 { - return v3rpc.Error(status.Error(codes.FailedPrecondition, wr.cancelReason)) + if len(wr.CancelReason) != 0 { + return v3rpc.Error(status.Error(codes.FailedPrecondition, wr.CancelReason)) } return v3rpc.ErrFutureRev } @@ -137,7 +137,7 @@ func (wr *WatchResponse) Err() error { // IsProgressNotify returns true if the WatchResponse is progress notification. func (wr *WatchResponse) IsProgressNotify() bool { - return len(wr.Events) == 0 && !wr.Canceled && !wr.Created && wr.CompactRevision == 0 && wr.Header.Revision != 0 + return len(wr.Events) == 0 && !wr.Canceled && !wr.Created && wr.CompactRevision == 0 && wr.Header.GetRevision() != 0 } // watcher implements the Watcher interface @@ -211,6 +211,8 @@ type watchRequest struct { // if true, split watch events when total exceeds // "--max-request-bytes" flag value + 512-byte fragment bool + // watchBufLogEnabled enables watch response buffer logging. + watchBufLogEnabled bool // filters is the list of events to filter out filters []pb.WatchCreateRequest_FilterType @@ -241,6 +243,10 @@ type watcherStream struct { // buf holds all events received from etcd but not yet consumed by the client buf []*WatchResponse + // bufLogger tracks buffer backlog and rate-limits warning logs. + bufLogger *blockLogger + // bufWaitStartTime is set while the first response in buf is waiting for outc. + bufWaitStartTime time.Time } func NewWatcher(c *Client) Watcher { @@ -254,7 +260,7 @@ func NewWatchFromWatchClient(wc pb.WatchClient, c *Client) Watcher { } if c != nil { w.callOpts = c.callOpts - w.lg = c.lg + w.lg = c.GetLogger() } return w } @@ -296,7 +302,7 @@ func (w *watcher) newWatcherGRPCStream(inctx context.Context) *watchGRPCStream { // Watch posts a watch request to run() and waits for a new watcher channel func (w *watcher) Watch(ctx context.Context, key string, opts ...OpOption) WatchChan { - ow := opWatch(key, opts...) + ow := OpWatch(key, opts...) var filters []pb.WatchCreateRequest_FilterType if ow.filterPut { @@ -307,16 +313,17 @@ func (w *watcher) Watch(ctx context.Context, key string, opts ...OpOption) Watch } wr := &watchRequest{ - ctx: ctx, - createdNotify: ow.createdNotify, - key: string(ow.key), - end: string(ow.end), - rev: ow.rev, - progressNotify: ow.progressNotify, - fragment: ow.fragment, - filters: filters, - prevKV: ow.prevKV, - retc: make(chan chan WatchResponse, 1), + ctx: ctx, + createdNotify: ow.createdNotify, + key: string(ow.key), + end: string(ow.end), + rev: ow.rev, + progressNotify: ow.progressNotify, + fragment: ow.fragment, + watchBufLogEnabled: ow.watchBufLogEnabled, + filters: filters, + prevKV: ow.prevKV, + retc: make(chan chan WatchResponse, 1), } ok := false @@ -356,7 +363,7 @@ func (w *watcher) Watch(ctx context.Context, key string, opts ...OpOption) Watch case <-donec: ok = false if wgs.closeErr != nil { - closeCh <- WatchResponse{Canceled: true, closeErr: wgs.closeErr} + closeCh <- WatchResponse{Header: &pb.ResponseHeader{}, Canceled: true, closeErr: wgs.closeErr} break } // retry; may have dropped stream from no ctxs @@ -371,7 +378,7 @@ func (w *watcher) Watch(ctx context.Context, key string, opts ...OpOption) Watch case <-ctx.Done(): case <-donec: if wgs.closeErr != nil { - closeCh <- WatchResponse{Canceled: true, closeErr: wgs.closeErr} + closeCh <- WatchResponse{Header: &pb.ResponseHeader{}, Canceled: true, closeErr: wgs.closeErr} break } // retry; may have dropped stream from no ctxs @@ -485,7 +492,7 @@ func (w *watchGRPCStream) closeSubstream(ws *watcherStream) { } // close subscriber's channel if closeErr := w.closeErr; closeErr != nil && ws.initReq.ctx.Err() == nil { - go w.sendCloseSubstream(ws, &WatchResponse{Canceled: true, closeErr: w.closeErr}) + go w.sendCloseSubstream(ws, &WatchResponse{Header: &pb.ResponseHeader{}, Canceled: true, closeErr: w.closeErr}) } else if ws.outc != nil { close(ws.outc) } @@ -557,6 +564,9 @@ func (w *watchGRPCStream) run() { // unbuffered so resumes won't cause repeat events recvc: make(chan *WatchResponse), } + if ws.initReq.watchBufLogEnabled { + ws.bufLogger = w.newWatcherStreamBufLogger(ws, time.Now) + } ws.donec = make(chan struct{}) w.wg.Add(1) @@ -580,7 +590,7 @@ func (w *watchGRPCStream) run() { case pbresp := <-w.respc: if cur == nil || pbresp.Created || pbresp.Canceled { cur = pbresp - } else if cur != nil && cur.WatchId == pbresp.WatchId { + } else if cur.WatchId == pbresp.WatchId { // merge new events cur.Events = append(cur.Events, pbresp.Events...) // update "Fragment" field; last response with "Fragment" == false @@ -712,18 +722,14 @@ func (w *watchGRPCStream) nextResume() *watcherStream { // dispatchEvent sends a WatchResponse to the appropriate watcher stream func (w *watchGRPCStream) dispatchEvent(pbresp *pb.WatchResponse) bool { - events := make([]*Event, len(pbresp.Events)) - for i, ev := range pbresp.Events { - events[i] = (*Event)(ev) - } // TODO: return watch ID? wr := &WatchResponse{ - Header: *pbresp.Header, - Events: events, + Header: ensureWatchHeader(pbresp.Header), + Events: pbresp.Events, CompactRevision: pbresp.CompactRevision, Created: pbresp.Created, Canceled: pbresp.Canceled, - cancelReason: pbresp.CancelReason, + CancelReason: pbresp.CancelReason, } // watch IDs are zero indexed, so request notify watch responses are assigned a watch ID of InvalidWatchID to @@ -798,19 +804,26 @@ func (w *watchGRPCStream) serveSubstream(ws *watcherStream, resumec chan struct{ } w.wg.Done() }() + defer func() { + if !resuming { + w.recordBufWait(ws) + } + }() - emptyWr := &WatchResponse{} + emptyWr := &WatchResponse{Header: &pb.ResponseHeader{}} for { curWr := emptyWr outc := ws.outc if len(ws.buf) > 0 { curWr = ws.buf[0] + w.startBufWait(ws) } else { outc = nil } select { case outc <- *curWr: + w.recordBufWait(ws) if ws.buf[0].Err() != nil { return } @@ -870,6 +883,7 @@ func (w *watchGRPCStream) serveSubstream(ws *watcherStream, resumec chan struct{ case <-ws.initReq.ctx.Done(): return case <-resumec: + ws.resetBufWait() resuming = true return } @@ -877,6 +891,40 @@ func (w *watchGRPCStream) serveSubstream(ws *watcherStream, resumec chan struct{ // lazily send cancel message if events on missing id } +func (w *watchGRPCStream) startBufWait(ws *watcherStream) { + if w.lg == nil || ws.bufLogger == nil || !ws.bufWaitStartTime.IsZero() { + return + } + ws.bufWaitStartTime = ws.bufLogger.now() +} + +func (w *watchGRPCStream) recordBufWait(ws *watcherStream) { + if w.lg == nil || ws.bufLogger == nil || ws.bufWaitStartTime.IsZero() { + return + } + ws.bufLogger.recordWait(ws.bufLogger.now().Sub(ws.bufWaitStartTime)) + ws.resetBufWait() +} + +func (ws *watcherStream) resetBufWait() { + ws.bufWaitStartTime = time.Time{} +} + +func (w *watchGRPCStream) newWatcherStreamBufLogger(ws *watcherStream, now func() time.Time) *blockLogger { + return newBlockLogger(watcherStreamBufWarningInterval, watcherStreamBufWarningThreshold, now, func(responseCount int, timeWaiting time.Duration, window time.Duration) { + w.lg.Info( + "watcher substream buffer is backlogged; subscriber may be too slow to consume events", + zap.String("range-start", ws.initReq.key), + zap.String("range-end", ws.initReq.end), + zap.Int64("watch-revision", ws.initReq.rev), + zap.Int("buffer-size", len(ws.buf)), + zap.Int("response-count", responseCount), + zap.Duration("time-blocked", timeWaiting), + zap.Duration("log-interval", window), + ) + }) +} + func (w *watchGRPCStream) newWatchClient() (pb.Watch_WatchClient, error) { // mark all substreams as resuming close(w.resumec) @@ -896,7 +944,7 @@ func (w *watchGRPCStream) newWatchClient() (pb.Watch_WatchClient, error) { w.resuming = resuming w.substreams = make(map[int64]*watcherStream) - // connect to grpc stream while accepting watcher cancelation + // connect to grpc stream while accepting watcher cancellation stopc := make(chan struct{}) donec := w.waitCancelSubstreams(stopc) wc, err := w.openWatchClient() diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/config.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/config.go index 0018e2d45f..7f3a935220 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/config.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/config.go @@ -5,6 +5,8 @@ package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.g import ( "context" + "os" + "strings" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" @@ -29,6 +31,14 @@ type InterceptorFilter func(*InterceptorInfo) bool // A Filter must return true if the request should be instrumented. type Filter func(*stats.RPCTagInfo) bool +type semconvMode int + +const ( + semconvModeNew semconvMode = iota // Default + semconvModeOld + semconvModeDup +) + // config is a group of options for this instrumentation. type config struct { Filter Filter @@ -36,6 +46,7 @@ type config struct { Propagators propagation.TextMapPropagator TracerProvider trace.TracerProvider MeterProvider metric.MeterProvider + SpanKind trace.SpanKind SpanStartOptions []trace.SpanStartOption SpanAttributes []attribute.KeyValue MetricAttributes []attribute.KeyValue @@ -46,6 +57,8 @@ type config struct { ReceivedEvent bool SentEvent bool + + semconvMode semconvMode } // Option applies an option value for a config. @@ -65,13 +78,33 @@ func newConfig(opts []Option) *config { Propagators: otel.GetTextMapPropagator(), TracerProvider: otel.GetTracerProvider(), MeterProvider: otel.GetMeterProvider(), + semconvMode: parseSemconvMode(), } for _, o := range opts { o.apply(c) } + return c } +func parseSemconvMode() semconvMode { + val := os.Getenv("OTEL_SEMCONV_STABILITY_OPT_IN") + if val == "" { + return semconvModeNew + } + parts := strings.SplitSeq(val, ",") + for p := range parts { + p = strings.TrimSpace(p) + if p == "rpc/dup" { + return semconvModeDup + } + if p == "rpc/old" { + return semconvModeOld + } + } + return semconvModeNew +} + // WithPublicEndpoint configures the Handler to link the span with an incoming // span context. If this option is not provided, then the association is a child // association instead of a link. @@ -181,6 +214,18 @@ func WithSpanOptions(opts ...trace.SpanStartOption) Option { }) } +// WithSpanKind returns an Option to set the span kind for spans created by +// the handler. +// +// By default, [NewServerHandler] creates spans with +// [trace.SpanKindServer] and [NewClientHandler] creates spans with +// [trace.SpanKindClient]. +func WithSpanKind(sk trace.SpanKind) Option { + return optionFunc(func(c *config) { + c.SpanKind = sk + }) +} + // WithSpanAttributes returns an Option to add custom attributes to the spans. func WithSpanAttributes(a ...attribute.KeyValue) Option { return optionFunc(func(c *config) { diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go index 24053927ca..69e8506ffd 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go @@ -11,7 +11,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - semconv "go.opentelemetry.io/otel/semconv/v1.39.0" + semconv "go.opentelemetry.io/otel/semconv/v1.40.0" grpc_codes "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal/parse.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal/parse.go index 2ab085031a..5174f4dd19 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal/parse.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal/parse.go @@ -8,7 +8,8 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.39.0" + oldsemconv "go.opentelemetry.io/otel/semconv/v1.37.0" //nolint:depguard // Use of v1.37.0 is required for backward compatibility stability opt-in. + semconv "go.opentelemetry.io/otel/semconv/v1.40.0" ) // ParseFullMethod returns a span name following the OpenTelemetry semantic @@ -25,3 +26,28 @@ func ParseFullMethod(fullMethod string) (string, []attribute.KeyValue) { name := fullMethod[1:] return name, []attribute.KeyValue{semconv.RPCMethod(name)} } + +// ParseFullMethodOld returns a span name following the old OpenTelemetry semantic +// conventions as well as all applicable span attribute.KeyValue attributes based +// on a gRPC's FullMethod. +// Based on the implementation in: +// https://github.com/open-telemetry/opentelemetry-go-contrib/blob/072dcf8ad7e5e48b506e05720b29d8b078759606/instrumentation/google.golang.org/grpc/otelgrpc/internal/parse.go#L20 +func ParseFullMethodOld(fullMethod string) (string, []attribute.KeyValue) { + if !strings.HasPrefix(fullMethod, "/") { + return fullMethod, nil + } + name := fullMethod[1:] + parts := strings.Split(name, "/") + if len(parts) < 2 { + return name, []attribute.KeyValue{ + attribute.String("rpc.system", "grpc"), + } + } + service := parts[0] + method := parts[1] + return name, []attribute.KeyValue{ + oldsemconv.RPCSystemKey.String("grpc"), + oldsemconv.RPCServiceKey.String(service), + oldsemconv.RPCMethodKey.String(method), + } +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/stats_handler.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/stats_handler.go index 0340ca7766..c9c44c1592 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/stats_handler.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/stats_handler.go @@ -5,18 +5,19 @@ package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.g import ( "context" - "sync/atomic" + "strconv" "time" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/metric" - semconv "go.opentelemetry.io/otel/semconv/v1.39.0" - "go.opentelemetry.io/otel/semconv/v1.39.0/rpcconv" + oldrpcconv "go.opentelemetry.io/otel/semconv/v1.37.0/rpcconv" //nolint:depguard // Use of v1.37.0 is required for backward compatibility stability opt-in. + semconv "go.opentelemetry.io/otel/semconv/v1.40.0" + "go.opentelemetry.io/otel/semconv/v1.40.0/rpcconv" "go.opentelemetry.io/otel/trace" + grpc_codes "google.golang.org/grpc/codes" - "google.golang.org/grpc/peer" "google.golang.org/grpc/stats" "google.golang.org/grpc/status" @@ -26,11 +27,8 @@ import ( type gRPCContextKey struct{} type gRPCContext struct { - inMessages int64 - outMessages int64 - metricAttrs []attribute.KeyValue - metricAttrSet attribute.Set - record bool + metricAttrs []attribute.KeyValue + record bool } type serverHandler struct { @@ -38,14 +36,17 @@ type serverHandler struct { tracer trace.Tracer - duration rpcconv.ServerCallDuration - inSize int64Hist - outSize int64Hist + duration rpcconv.ServerCallDuration + oldDuration oldrpcconv.ServerDuration } // NewServerHandler creates a stats.Handler for a gRPC server. func NewServerHandler(opts ...Option) stats.Handler { c := newConfig(opts) + if c.SpanKind == trace.SpanKindUnspecified { + c.SpanKind = trace.SpanKindServer + } + h := &serverHandler{config: c} h.tracer = c.TracerProvider.Tracer( @@ -60,19 +61,26 @@ func NewServerHandler(opts ...Option) stats.Handler { ) var err error - h.duration, err = rpcconv.NewServerCallDuration(meter) - if err != nil { - otel.Handle(err) - } - - h.inSize, err = rpcconv.NewServerRequestSize(meter) - if err != nil { - otel.Handle(err) + if c.semconvMode == semconvModeOld || c.semconvMode == semconvModeDup { + oldDur, err := oldrpcconv.NewServerDuration(meter) + if err != nil { + otel.Handle(err) + } else { + h.oldDuration = oldDur + } } - h.outSize, err = rpcconv.NewServerResponseSize(meter) - if err != nil { - otel.Handle(err) + if c.semconvMode == semconvModeNew || c.semconvMode == semconvModeDup { + h.duration, err = rpcconv.NewServerCallDuration( + meter, + metric.WithExplicitBucketBoundaries( + 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, + 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10, + ), + ) + if err != nil { + otel.Handle(err) + } } return h @@ -91,8 +99,23 @@ func (*serverHandler) HandleConn(context.Context, stats.ConnStats) { func (h *serverHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context { ctx = extract(ctx, h.Propagators) - name, attrs := internal.ParseFullMethod(info.FullMethodName) - attrs = append(attrs, semconv.RPCSystemNameGRPC) + var name string + var attrs []attribute.KeyValue + + switch h.semconvMode { + case semconvModeOld: + name, attrs = internal.ParseFullMethodOld(info.FullMethodName) + case semconvModeDup: + var attrsNew, attrsOld []attribute.KeyValue + name, attrsNew = internal.ParseFullMethod(info.FullMethodName) + _, attrsOld = internal.ParseFullMethodOld(info.FullMethodName) + // Combine both. We append New last so its rpc.method (fully qualified) wins when deduplicated. + attrs = append(append([]attribute.KeyValue{}, attrsOld...), attrsNew...) + attrs = append(attrs, semconv.RPCSystemNameGRPC) // New convention + default: // semconvModeNew + name, attrs = internal.ParseFullMethod(info.FullMethodName) + attrs = append(attrs, semconv.RPCSystemNameGRPC) + } record := true if h.Filter != nil { @@ -104,7 +127,7 @@ func (h *serverHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) cont spanAttributes := make([]attribute.KeyValue, 0, len(attrs)+len(h.SpanAttributes)) spanAttributes = append(append(spanAttributes, attrs...), h.SpanAttributes...) opts := []trace.SpanStartOption{ - trace.WithSpanKind(trace.SpanKindServer), + trace.WithSpanKind(h.SpanKind), trace.WithAttributes(spanAttributes...), } if h.PublicEndpoint || (h.PublicEndpointFn != nil && h.PublicEndpointFn(ctx, info)) { @@ -131,19 +154,24 @@ func (h *serverHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) cont gctx.metricAttrs = append(gctx.metricAttrs, extraAttrs...) } - gctx.metricAttrSet = attribute.NewSet(gctx.metricAttrs...) - return context.WithValue(ctx, gRPCContextKey{}, &gctx) } // HandleRPC processes the RPC stats. func (h *serverHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) { + var dur metric.Float64Histogram + if h.semconvMode == semconvModeNew || h.semconvMode == semconvModeDup { + dur = h.duration.Inst() + } + var oldDur metric.Float64Histogram + if h.semconvMode == semconvModeOld || h.semconvMode == semconvModeDup { + oldDur = h.oldDuration.Inst() + } h.handleRPC( ctx, rs, - h.duration.Inst(), - h.inSize, - h.outSize, + dur, + oldDur, serverStatus, ) } @@ -153,14 +181,17 @@ type clientHandler struct { tracer trace.Tracer - duration rpcconv.ClientCallDuration - inSize int64Hist - outSize int64Hist + duration rpcconv.ClientCallDuration + oldDuration oldrpcconv.ClientDuration } // NewClientHandler creates a stats.Handler for a gRPC client. func NewClientHandler(opts ...Option) stats.Handler { c := newConfig(opts) + if c.SpanKind == trace.SpanKindUnspecified { + c.SpanKind = trace.SpanKindClient + } + h := &clientHandler{config: c} h.tracer = c.TracerProvider.Tracer( @@ -175,19 +206,26 @@ func NewClientHandler(opts ...Option) stats.Handler { ) var err error - h.duration, err = rpcconv.NewClientCallDuration(meter) - if err != nil { - otel.Handle(err) - } - - h.inSize, err = rpcconv.NewClientResponseSize(meter) - if err != nil { - otel.Handle(err) + if c.semconvMode == semconvModeOld || c.semconvMode == semconvModeDup { + oldDur, err := oldrpcconv.NewClientDuration(meter) + if err != nil { + otel.Handle(err) + } else { + h.oldDuration = oldDur + } } - h.outSize, err = rpcconv.NewClientRequestSize(meter) - if err != nil { - otel.Handle(err) + if c.semconvMode == semconvModeNew || c.semconvMode == semconvModeDup { + h.duration, err = rpcconv.NewClientCallDuration( + meter, + metric.WithExplicitBucketBoundaries( + 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, + 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10, + ), + ) + if err != nil { + otel.Handle(err) + } } return h @@ -195,8 +233,23 @@ func NewClientHandler(opts ...Option) stats.Handler { // TagRPC can attach some information to the given context. func (h *clientHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context { - name, attrs := internal.ParseFullMethod(info.FullMethodName) - attrs = append(attrs, semconv.RPCSystemNameGRPC) + var name string + var attrs []attribute.KeyValue + + switch h.semconvMode { + case semconvModeOld: + name, attrs = internal.ParseFullMethodOld(info.FullMethodName) + case semconvModeDup: + var attrsNew, attrsOld []attribute.KeyValue + name, attrsNew = internal.ParseFullMethod(info.FullMethodName) + _, attrsOld = internal.ParseFullMethodOld(info.FullMethodName) + // Combine both. We append New last so its rpc.method (fully qualified) wins when deduplicated. + attrs = append(append([]attribute.KeyValue{}, attrsOld...), attrsNew...) + attrs = append(attrs, semconv.RPCSystemNameGRPC) // New convention + default: // semconvModeNew + name, attrs = internal.ParseFullMethod(info.FullMethodName) + attrs = append(attrs, semconv.RPCSystemNameGRPC) + } record := true if h.Filter != nil { @@ -210,7 +263,7 @@ func (h *clientHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) cont ctx, _ = h.tracer.Start( ctx, name, - trace.WithSpanKind(trace.SpanKindClient), + trace.WithSpanKind(h.SpanKind), trace.WithAttributes(spanAttributes...), ) } @@ -225,19 +278,24 @@ func (h *clientHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) cont gctx.metricAttrs = append(gctx.metricAttrs, extraAttrs...) } - gctx.metricAttrSet = attribute.NewSet(gctx.metricAttrs...) - return inject(context.WithValue(ctx, gRPCContextKey{}, &gctx), h.Propagators) } // HandleRPC processes the RPC stats. func (h *clientHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) { + var dur metric.Float64Histogram + if h.semconvMode == semconvModeNew || h.semconvMode == semconvModeDup { + dur = h.duration.Inst() + } + var oldDur metric.Float64Histogram + if h.semconvMode == semconvModeOld || h.semconvMode == semconvModeDup { + oldDur = h.oldDuration.Inst() + } h.handleRPC( ctx, rs, - h.duration.Inst(), - h.inSize, - h.outSize, + dur, + oldDur, func(s *status.Status) (codes.Code, string) { return codes.Error, s.Message() }, @@ -254,15 +312,11 @@ func (*clientHandler) HandleConn(context.Context, stats.ConnStats) { // no-op } -type int64Hist interface { - RecordSet(context.Context, int64, attribute.Set) -} - -func (c *config) handleRPC( +func (*config) handleRPC( ctx context.Context, rs stats.RPCStats, duration metric.Float64Histogram, - inSize, outSize int64Hist, + oldDuration metric.Float64Histogram, recordStatus func(*status.Status) (codes.Code, string), ) { gctx, _ := ctx.Value(gRPCContextKey{}).(*gRPCContext) @@ -271,47 +325,27 @@ func (c *config) handleRPC( } span := trace.SpanFromContext(ctx) - var messageId int64 switch rs := rs.(type) { case *stats.Begin: case *stats.InPayload: - if gctx != nil { - messageId = atomic.AddInt64(&gctx.inMessages, 1) - inSize.RecordSet(ctx, int64(rs.Length), gctx.metricAttrSet) - } - - if c.ReceivedEvent && span.IsRecording() { - span.AddEvent("message", - trace.WithAttributes( - semconv.RPCMessageTypeReceived, - semconv.RPCMessageIDKey.Int64(messageId), - semconv.RPCMessageCompressedSizeKey.Int(rs.CompressedLength), - semconv.RPCMessageUncompressedSizeKey.Int(rs.Length), - ), - ) + case *stats.InHeader: + if !rs.Client && rs.LocalAddr != nil { + if span.IsRecording() { + span.SetAttributes(serverAddrAttrs(rs.LocalAddr.String())...) + } + // TODO: add server.address and server.port to metrics once the API supports opt-in attributes. } case *stats.OutPayload: - if gctx != nil { - messageId = atomic.AddInt64(&gctx.outMessages, 1) - outSize.RecordSet(ctx, int64(rs.Length), gctx.metricAttrSet) - } - - if c.SentEvent && span.IsRecording() { - span.AddEvent("message", - trace.WithAttributes( - semconv.RPCMessageTypeSent, - semconv.RPCMessageIDKey.Int64(messageId), - semconv.RPCMessageCompressedSizeKey.Int(rs.CompressedLength), - semconv.RPCMessageUncompressedSizeKey.Int(rs.Length), - ), - ) - } case *stats.OutTrailer: case *stats.OutHeader: - if span.IsRecording() { - if p, ok := peer.FromContext(ctx); ok { - span.SetAttributes(serverAddrAttrs(p.Addr.String())...) + if rs.Client && rs.RemoteAddr != nil && (span.IsRecording() || gctx != nil) { + attrs := serverAddrAttrs(rs.RemoteAddr.String()) + if span.IsRecording() { + span.SetAttributes(attrs...) + } + if gctx != nil { + gctx.metricAttrs = append(gctx.metricAttrs, attrs...) } } case *stats.End: @@ -320,9 +354,9 @@ func (c *config) handleRPC( var s *status.Status if rs.Error != nil { s, _ = status.FromError(rs.Error) - rpcStatusAttr = semconv.RPCResponseStatusCode(s.Code().String()) + rpcStatusAttr = semconv.RPCResponseStatusCode(canonicalString(s.Code())) } else { - rpcStatusAttr = semconv.RPCResponseStatusCode(grpc_codes.OK.String()) + rpcStatusAttr = semconv.RPCResponseStatusCode(canonicalString(grpc_codes.OK)) } if span.IsRecording() { if s != nil { @@ -347,10 +381,57 @@ func (c *config) handleRPC( // Use floating point division here for higher precision (instead of Millisecond method). // Measure right before calling Record() to capture as much elapsed time as possible. - elapsedTime := float64(rs.EndTime.Sub(rs.BeginTime)) / float64(time.Millisecond) + elapsedTime := float64(rs.EndTime.Sub(rs.BeginTime)) / float64(time.Second) + + if duration != nil { + duration.Record(ctx, elapsedTime, recordOpts...) + } + if oldDuration != nil { + oldDuration.Record(ctx, elapsedTime*1000.0, recordOpts...) + } - duration.Record(ctx, elapsedTime, recordOpts...) default: return } } + +func canonicalString(code grpc_codes.Code) string { + switch code { + case grpc_codes.OK: + return "OK" + case grpc_codes.Canceled: + return "CANCELLED" + case grpc_codes.Unknown: + return "UNKNOWN" + case grpc_codes.InvalidArgument: + return "INVALID_ARGUMENT" + case grpc_codes.DeadlineExceeded: + return "DEADLINE_EXCEEDED" + case grpc_codes.NotFound: + return "NOT_FOUND" + case grpc_codes.AlreadyExists: + return "ALREADY_EXISTS" + case grpc_codes.PermissionDenied: + return "PERMISSION_DENIED" + case grpc_codes.ResourceExhausted: + return "RESOURCE_EXHAUSTED" + case grpc_codes.FailedPrecondition: + return "FAILED_PRECONDITION" + case grpc_codes.Aborted: + return "ABORTED" + case grpc_codes.OutOfRange: + return "OUT_OF_RANGE" + case grpc_codes.Unimplemented: + return "UNIMPLEMENTED" + case grpc_codes.Internal: + return "INTERNAL" + case grpc_codes.Unavailable: + return "UNAVAILABLE" + case grpc_codes.DataLoss: + return "DATA_LOSS" + case grpc_codes.Unauthenticated: + return "UNAUTHENTICATED" + default: + return "CODE(" + strconv.FormatInt(int64(code), 10) + ")" + } +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/version.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/version.go index f9f963fdd9..1e81d31fec 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/version.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/version.go @@ -4,4 +4,4 @@ package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" // Version is the current release version of the gRPC instrumentation. -const Version = "0.65.0" +const Version = "0.68.0" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go index 12e243e042..0d43a5dc5b 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go @@ -87,6 +87,16 @@ func Value(v attribute.Value) *commonpb.AnyValue { av.Value = &commonpb.AnyValue_StringValue{ StringValue: v.AsString(), } + case attribute.BYTESLICE: + av.Value = &commonpb.AnyValue_BytesValue{ + BytesValue: v.AsByteSlice(), + } + case attribute.SLICE: + av.Value = &commonpb.AnyValue_ArrayValue{ + ArrayValue: &commonpb.ArrayValue{ + Values: values(v.AsSlice()), + }, + } case attribute.STRINGSLICE: av.Value = &commonpb.AnyValue_ArrayValue{ ArrayValue: &commonpb.ArrayValue{ @@ -149,3 +159,11 @@ func stringSliceValues(vals []string) []*commonpb.AnyValue { } return converted } + +func values(vals []attribute.Value) []*commonpb.AnyValue { + converted := make([]*commonpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = Value(v) + } + return converted +} diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go index 258d0ca6a5..e8b33d3fa5 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go @@ -6,6 +6,7 @@ package otlptracegrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlptra import ( "context" "errors" + "fmt" "sync" "time" @@ -16,6 +17,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal" @@ -26,11 +28,12 @@ import ( ) type client struct { - endpoint string - dialOpts []grpc.DialOption - metadata metadata.MD - exportTimeout time.Duration - requestFunc retry.RequestFunc + endpoint string + dialOpts []grpc.DialOption + metadata metadata.MD + exportTimeout time.Duration + maxRequestSize int + requestFunc retry.RequestFunc // stopCtx is used as a parent context for all exports. Therefore, when it // is canceled with the stopFunc all exports are canceled. @@ -65,14 +68,15 @@ func newClient(opts ...Option) *client { ctx, cancel := context.WithCancel(context.Background()) //nolint:gosec // cancel called in client shutdown. c := &client{ - endpoint: cfg.Traces.Endpoint, - exportTimeout: cfg.Traces.Timeout, - requestFunc: cfg.RetryConfig.RequestFunc(retryable), - dialOpts: cfg.DialOptions, - stopCtx: ctx, - stopFunc: cancel, - conn: cfg.GRPCConn, - instID: counter.NextExporterID(), + endpoint: cfg.Traces.Endpoint, + exportTimeout: cfg.Traces.Timeout, + maxRequestSize: cfg.Traces.MaxRequestSize, + requestFunc: cfg.RetryConfig.RequestFunc(retryable), + dialOpts: cfg.DialOptions, + stopCtx: ctx, + stopFunc: cancel, + conn: cfg.GRPCConn, + instID: counter.NextExporterID(), } if len(cfg.Traces.Headers) > 0 { @@ -205,16 +209,28 @@ func (c *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc ctx, cancel := c.exportContext(ctx) defer cancel() - var code codes.Code + pbRequest := &coltracepb.ExportTraceServiceRequest{ + ResourceSpans: protoSpans, + } + + code := codes.Unknown if c.inst != nil { - op := c.inst.ExportSpans(ctx, len(protoSpans)) + var spanCount int + for _, rs := range protoSpans { + for _, ss := range rs.ScopeSpans { + spanCount += len(ss.Spans) + } + } + op := c.inst.ExportSpans(ctx, spanCount) defer func() { op.End(uploadErr, code) }() } + if maxSize := c.maxRequestSize; maxSize > 0 && proto.Size(pbRequest) > maxSize { + return fmt.Errorf("request message too large: exceeded %d bytes", maxSize) + } + return c.requestFunc(ctx, func(iCtx context.Context) error { - resp, err := c.tsc.Export(iCtx, &coltracepb.ExportTraceServiceRequest{ - ResourceSpans: protoSpans, - }) + resp, err := c.tsc.Export(iCtx, pbRequest) if resp != nil && resp.PartialSuccess != nil { msg := resp.PartialSuccess.GetErrorMessage() n := resp.PartialSuccess.GetRejectedSpans() diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/instrumentation.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/instrumentation.go index a84733174e..676a93514b 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/instrumentation.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/instrumentation.go @@ -18,8 +18,8 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" - semconv "go.opentelemetry.io/otel/semconv/v1.40.0" - "go.opentelemetry.io/otel/semconv/v1.40.0/otelconv" + semconv "go.opentelemetry.io/otel/semconv/v1.41.0" + "go.opentelemetry.io/otel/semconv/v1.41.0/otelconv" ) const ( @@ -72,6 +72,7 @@ var ( func get[T any](p *sync.Pool) *[]T { return p.Get().(*[]T) } func put[T any](p *sync.Pool, s *[]T) { + clear(*s) // erase elements to allow GC to collect what they refer to. *s = (*s)[:0] // Reset. p.Put(s) } @@ -339,7 +340,10 @@ var errPartialPool = &sync.Pool{ // the provided non-nil err. func rejected(n int64, err error) int64 { ps := errPartialPool.Get().(*internal.PartialSuccess) - defer errPartialPool.Put(ps) + defer func() { + *ps = internal.PartialSuccess{} // erase fields to allow GC to collect them. + errPartialPool.Put(ps) + }() // Check for partial success. if errors.As(err, ps) { // Bound RejectedItems to [0, n]. This should not be needed, diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go index 4f47117a58..d940b67625 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go @@ -31,6 +31,9 @@ const ( // DefaultTracesPath is a default URL path for endpoint that // receives spans. DefaultTracesPath string = "/v1/traces" + // DefaultMaxRequestSize is the default maximum size of a serialized export + // request, before compression. + DefaultMaxRequestSize int = 64 * 1024 * 1024 // DefaultTimeout is a default max waiting time for the backend to process // each span batch. DefaultTimeout time.Duration = 10 * time.Second @@ -42,13 +45,14 @@ type ( HTTPTransportProxyFunc func(*http.Request) (*url.URL, error) SignalConfig struct { - Endpoint string - Insecure bool - TLSCfg *tls.Config - Headers map[string]string - Compression Compression - Timeout time.Duration - URLPath string + Endpoint string + Insecure bool + TLSCfg *tls.Config + Headers map[string]string + Compression Compression + MaxRequestSize int + Timeout time.Duration + URLPath string // gRPC configurations GRPCCredentials credentials.TransportCredentials @@ -77,10 +81,11 @@ type ( func NewHTTPConfig(opts ...HTTPOption) Config { cfg := Config{ Traces: SignalConfig{ - Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorHTTPPort), - URLPath: DefaultTracesPath, - Compression: NoCompression, - Timeout: DefaultTimeout, + Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorHTTPPort), + URLPath: DefaultTracesPath, + Compression: NoCompression, + MaxRequestSize: DefaultMaxRequestSize, + Timeout: DefaultTimeout, }, RetryConfig: retry.DefaultConfig, } @@ -111,10 +116,11 @@ func NewGRPCConfig(opts ...GRPCOption) Config { userAgent := "OTel OTLP Exporter Go/" + otlptrace.Version() cfg := Config{ Traces: SignalConfig{ - Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorGRPCPort), - URLPath: DefaultTracesPath, - Compression: NoCompression, - Timeout: DefaultTimeout, + Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorGRPCPort), + URLPath: DefaultTracesPath, + Compression: NoCompression, + MaxRequestSize: DefaultMaxRequestSize, + Timeout: DefaultTimeout, }, RetryConfig: retry.DefaultConfig, DialOptions: []grpc.DialOption{grpc.WithUserAgent(userAgent)}, @@ -345,6 +351,13 @@ func WithTimeout(duration time.Duration) GenericOption { }) } +func WithMaxRequestSize(size int) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.MaxRequestSize = size + return cfg + }) +} + func WithProxy(pf HTTPTransportProxyFunc) GenericOption { return newGenericOption(func(cfg Config) Config { cfg.Traces.Proxy = pf diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/version.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/version.go index 9d4b311920..28e51e443f 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/version.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/version.go @@ -5,4 +5,4 @@ package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/ot // Version is the current release version of the OpenTelemetry OTLP gRPC trace // exporter in use. -const Version = "1.42.0" +const Version = "1.44.0" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go index 2da2298701..b320060525 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go @@ -192,6 +192,16 @@ func WithTimeout(duration time.Duration) Option { return wrappedOption{otlpconfig.WithTimeout(duration)} } +// WithMaxRequestSize sets the maximum size, in bytes, of a serialized export +// request, before compression, that the exporter will send. +// +// If size is less than or equal to zero, no request-size limit is applied. +// Disabling the limit is not recommended because it can lead to excessive +// resource consumption or abuse. +func WithMaxRequestSize(size int) Option { + return wrappedOption{otlpconfig.WithMaxRequestSize(size)} +} + // WithRetry sets the retry policy for transient retryable errors that may be // returned by the target endpoint when exporting a batch of spans. // diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go index 087e95f7b8..d847210dba 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go @@ -5,5 +5,5 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.43.0" + return "1.44.0" } diff --git a/vendor/go.opentelemetry.io/otel/semconv/internal/http.go b/vendor/go.opentelemetry.io/otel/semconv/internal/http.go deleted file mode 100644 index f18d6e3f22..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/internal/http.go +++ /dev/null @@ -1,338 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Package internal provides common semconv functionality. -package internal // import "go.opentelemetry.io/otel/semconv/internal" - -import ( - "fmt" - "net" - "net/http" - "strconv" - "strings" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/trace" -) - -// SemanticConventions are the semantic convention values defined for a -// version of the OpenTelemetry specification. -type SemanticConventions struct { - EnduserIDKey attribute.Key - HTTPClientIPKey attribute.Key - HTTPFlavorKey attribute.Key - HTTPHostKey attribute.Key - HTTPMethodKey attribute.Key - HTTPRequestContentLengthKey attribute.Key - HTTPRouteKey attribute.Key - HTTPSchemeHTTP attribute.KeyValue - HTTPSchemeHTTPS attribute.KeyValue - HTTPServerNameKey attribute.Key - HTTPStatusCodeKey attribute.Key - HTTPTargetKey attribute.Key - HTTPURLKey attribute.Key - HTTPUserAgentKey attribute.Key - NetHostIPKey attribute.Key - NetHostNameKey attribute.Key - NetHostPortKey attribute.Key - NetPeerIPKey attribute.Key - NetPeerNameKey attribute.Key - NetPeerPortKey attribute.Key - NetTransportIP attribute.KeyValue - NetTransportOther attribute.KeyValue - NetTransportTCP attribute.KeyValue - NetTransportUDP attribute.KeyValue - NetTransportUnix attribute.KeyValue -} - -// NetAttributesFromHTTPRequest generates attributes of the net -// namespace as specified by the OpenTelemetry specification for a -// span. The network parameter is a string that net.Dial function -// from standard library can understand. -func (sc *SemanticConventions) NetAttributesFromHTTPRequest( - network string, - request *http.Request, -) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - - switch network { - case "tcp", "tcp4", "tcp6": - attrs = append(attrs, sc.NetTransportTCP) - case "udp", "udp4", "udp6": - attrs = append(attrs, sc.NetTransportUDP) - case "ip", "ip4", "ip6": - attrs = append(attrs, sc.NetTransportIP) - case "unix", "unixgram", "unixpacket": - attrs = append(attrs, sc.NetTransportUnix) - default: - attrs = append(attrs, sc.NetTransportOther) - } - - peerIP, peerName, peerPort := hostIPNamePort(request.RemoteAddr) - if peerIP != "" { - attrs = append(attrs, sc.NetPeerIPKey.String(peerIP)) - } - if peerName != "" { - attrs = append(attrs, sc.NetPeerNameKey.String(peerName)) - } - if peerPort != 0 { - attrs = append(attrs, sc.NetPeerPortKey.Int(peerPort)) - } - - hostIP, hostName, hostPort := "", "", 0 - for _, someHost := range []string{request.Host, request.Header.Get("Host"), request.URL.Host} { - hostIP, hostName, hostPort = hostIPNamePort(someHost) - if hostIP != "" || hostName != "" || hostPort != 0 { - break - } - } - if hostIP != "" { - attrs = append(attrs, sc.NetHostIPKey.String(hostIP)) - } - if hostName != "" { - attrs = append(attrs, sc.NetHostNameKey.String(hostName)) - } - if hostPort != 0 { - attrs = append(attrs, sc.NetHostPortKey.Int(hostPort)) - } - - return attrs -} - -// hostIPNamePort extracts the IP address, name and (optional) port from hostWithPort. -// It handles both IPv4 and IPv6 addresses. If the host portion is not recognized -// as a valid IPv4 or IPv6 address, the `ip` result will be empty and the -// host portion will instead be returned in `name`. -func hostIPNamePort(hostWithPort string) (ip, name string, port int) { - var ( - hostPart, portPart string - parsedPort uint64 - err error - ) - if hostPart, portPart, err = net.SplitHostPort(hostWithPort); err != nil { - hostPart, portPart = hostWithPort, "" - } - if parsedIP := net.ParseIP(hostPart); parsedIP != nil { - ip = parsedIP.String() - } else { - name = hostPart - } - if parsedPort, err = strconv.ParseUint(portPart, 10, 16); err == nil { - port = int(parsedPort) // nolint: gosec // Bit size of 16 checked above. - } - return ip, name, port -} - -// EndUserAttributesFromHTTPRequest generates attributes of the -// enduser namespace as specified by the OpenTelemetry specification -// for a span. -func (sc *SemanticConventions) EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - if username, _, ok := request.BasicAuth(); ok { - return []attribute.KeyValue{sc.EnduserIDKey.String(username)} - } - return nil -} - -// HTTPClientAttributesFromHTTPRequest generates attributes of the -// http namespace as specified by the OpenTelemetry specification for -// a span on the client side. -func (sc *SemanticConventions) HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - - // remove any username/password info that may be in the URL - // before adding it to the attributes - userinfo := request.URL.User - request.URL.User = nil - - attrs = append(attrs, sc.HTTPURLKey.String(request.URL.String())) - - // restore any username/password info that was removed - request.URL.User = userinfo - - return append(attrs, sc.httpCommonAttributesFromHTTPRequest(request)...) -} - -func (sc *SemanticConventions) httpCommonAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - if ua := request.UserAgent(); ua != "" { - attrs = append(attrs, sc.HTTPUserAgentKey.String(ua)) - } - if request.ContentLength > 0 { - attrs = append(attrs, sc.HTTPRequestContentLengthKey.Int64(request.ContentLength)) - } - - return append(attrs, sc.httpBasicAttributesFromHTTPRequest(request)...) -} - -func (sc *SemanticConventions) httpBasicAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - // as these attributes are used by HTTPServerMetricAttributesFromHTTPRequest, they should be low-cardinality - attrs := []attribute.KeyValue{} - - if request.TLS != nil { - attrs = append(attrs, sc.HTTPSchemeHTTPS) - } else { - attrs = append(attrs, sc.HTTPSchemeHTTP) - } - - if request.Host != "" { - attrs = append(attrs, sc.HTTPHostKey.String(request.Host)) - } else if request.URL != nil && request.URL.Host != "" { - attrs = append(attrs, sc.HTTPHostKey.String(request.URL.Host)) - } - - flavor := "" - switch request.ProtoMajor { - case 1: - flavor = fmt.Sprintf("1.%d", request.ProtoMinor) - case 2: - flavor = "2" - } - if flavor != "" { - attrs = append(attrs, sc.HTTPFlavorKey.String(flavor)) - } - - if request.Method != "" { - attrs = append(attrs, sc.HTTPMethodKey.String(request.Method)) - } else { - attrs = append(attrs, sc.HTTPMethodKey.String(http.MethodGet)) - } - - return attrs -} - -// HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes -// to be used with server-side HTTP metrics. -func (sc *SemanticConventions) HTTPServerMetricAttributesFromHTTPRequest( - serverName string, - request *http.Request, -) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - if serverName != "" { - attrs = append(attrs, sc.HTTPServerNameKey.String(serverName)) - } - return append(attrs, sc.httpBasicAttributesFromHTTPRequest(request)...) -} - -// HTTPServerAttributesFromHTTPRequest generates attributes of the -// http namespace as specified by the OpenTelemetry specification for -// a span on the server side. Currently, only basic authentication is -// supported. -func (sc *SemanticConventions) HTTPServerAttributesFromHTTPRequest( - serverName, route string, - request *http.Request, -) []attribute.KeyValue { - attrs := []attribute.KeyValue{ - sc.HTTPTargetKey.String(request.RequestURI), - } - - if serverName != "" { - attrs = append(attrs, sc.HTTPServerNameKey.String(serverName)) - } - if route != "" { - attrs = append(attrs, sc.HTTPRouteKey.String(route)) - } - if values := request.Header["X-Forwarded-For"]; len(values) > 0 { - addr := values[0] - if i := strings.Index(addr, ","); i > 0 { - addr = addr[:i] - } - attrs = append(attrs, sc.HTTPClientIPKey.String(addr)) - } - - return append(attrs, sc.httpCommonAttributesFromHTTPRequest(request)...) -} - -// HTTPAttributesFromHTTPStatusCode generates attributes of the http -// namespace as specified by the OpenTelemetry specification for a -// span. -func (sc *SemanticConventions) HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue { - attrs := []attribute.KeyValue{ - sc.HTTPStatusCodeKey.Int(code), - } - return attrs -} - -type codeRange struct { - fromInclusive int - toInclusive int -} - -func (r codeRange) contains(code int) bool { - return r.fromInclusive <= code && code <= r.toInclusive -} - -var validRangesPerCategory = map[int][]codeRange{ - 1: { - {http.StatusContinue, http.StatusEarlyHints}, - }, - 2: { - {http.StatusOK, http.StatusAlreadyReported}, - {http.StatusIMUsed, http.StatusIMUsed}, - }, - 3: { - {http.StatusMultipleChoices, http.StatusUseProxy}, - {http.StatusTemporaryRedirect, http.StatusPermanentRedirect}, - }, - 4: { - {http.StatusBadRequest, http.StatusTeapot}, // yes, teapot is so useful… - {http.StatusMisdirectedRequest, http.StatusUpgradeRequired}, - {http.StatusPreconditionRequired, http.StatusTooManyRequests}, - {http.StatusRequestHeaderFieldsTooLarge, http.StatusRequestHeaderFieldsTooLarge}, - {http.StatusUnavailableForLegalReasons, http.StatusUnavailableForLegalReasons}, - }, - 5: { - {http.StatusInternalServerError, http.StatusLoopDetected}, - {http.StatusNotExtended, http.StatusNetworkAuthenticationRequired}, - }, -} - -// SpanStatusFromHTTPStatusCode generates a status code and a message -// as specified by the OpenTelemetry specification for a span. -func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) { - spanCode, valid := validateHTTPStatusCode(code) - if !valid { - return spanCode, fmt.Sprintf("Invalid HTTP status code %d", code) - } - return spanCode, "" -} - -// SpanStatusFromHTTPStatusCodeAndSpanKind generates a status code and a message -// as specified by the OpenTelemetry specification for a span. -// Exclude 4xx for SERVER to set the appropriate status. -func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string) { - spanCode, valid := validateHTTPStatusCode(code) - if !valid { - return spanCode, fmt.Sprintf("Invalid HTTP status code %d", code) - } - category := code / 100 - if spanKind == trace.SpanKindServer && category == 4 { - return codes.Unset, "" - } - return spanCode, "" -} - -// validateHTTPStatusCode validates the HTTP status code and returns -// corresponding span status code. If the `code` is not a valid HTTP status -// code, returns span status Error and false. -func validateHTTPStatusCode(code int) (codes.Code, bool) { - category := code / 100 - ranges, ok := validRangesPerCategory[category] - if !ok { - return codes.Error, false - } - ok = false - for _, crange := range ranges { - ok = crange.contains(code) - if ok { - break - } - } - if !ok { - return codes.Error, false - } - if category > 0 && category < 4 { - return codes.Unset, true - } - return codes.Error, true -} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/README.md b/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/README.md deleted file mode 100644 index 6a273180fe..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Semconv v1.12.0 - -[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/semconv/v1.12.0)](https://pkg.go.dev/go.opentelemetry.io/otel/semconv/v1.12.0) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/doc.go deleted file mode 100644 index fc255ef05d..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Package semconv implements OpenTelemetry semantic conventions. -// -// OpenTelemetry semantic conventions are agreed standardized naming -// patterns for OpenTelemetry things. This package represents the conventions -// as of the v1.12.0 version of the OpenTelemetry specification. -package semconv // import "go.opentelemetry.io/otel/semconv/v1.12.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/exception.go deleted file mode 100644 index f0e12957e3..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/exception.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.12.0" - -const ( - // ExceptionEventName is the name of the Span event representing an exception. - ExceptionEventName = "exception" -) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/http.go b/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/http.go deleted file mode 100644 index 4e19ca342c..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/http.go +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.12.0" - -import ( - "net/http" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/semconv/internal" - "go.opentelemetry.io/otel/trace" -) - -// HTTP scheme attributes. -var ( - HTTPSchemeHTTP = HTTPSchemeKey.String("http") - HTTPSchemeHTTPS = HTTPSchemeKey.String("https") -) - -var sc = &internal.SemanticConventions{ - EnduserIDKey: EnduserIDKey, - HTTPClientIPKey: HTTPClientIPKey, - HTTPFlavorKey: HTTPFlavorKey, - HTTPHostKey: HTTPHostKey, - HTTPMethodKey: HTTPMethodKey, - HTTPRequestContentLengthKey: HTTPRequestContentLengthKey, - HTTPRouteKey: HTTPRouteKey, - HTTPSchemeHTTP: HTTPSchemeHTTP, - HTTPSchemeHTTPS: HTTPSchemeHTTPS, - HTTPServerNameKey: HTTPServerNameKey, - HTTPStatusCodeKey: HTTPStatusCodeKey, - HTTPTargetKey: HTTPTargetKey, - HTTPURLKey: HTTPURLKey, - HTTPUserAgentKey: HTTPUserAgentKey, - NetHostIPKey: NetHostIPKey, - NetHostNameKey: NetHostNameKey, - NetHostPortKey: NetHostPortKey, - NetPeerIPKey: NetPeerIPKey, - NetPeerNameKey: NetPeerNameKey, - NetPeerPortKey: NetPeerPortKey, - NetTransportIP: NetTransportIP, - NetTransportOther: NetTransportOther, - NetTransportTCP: NetTransportTCP, - NetTransportUDP: NetTransportUDP, - NetTransportUnix: NetTransportUnix, -} - -// NetAttributesFromHTTPRequest generates attributes of the net -// namespace as specified by the OpenTelemetry specification for a -// span. The network parameter is a string that net.Dial function -// from standard library can understand. -func NetAttributesFromHTTPRequest(network string, request *http.Request) []attribute.KeyValue { - return sc.NetAttributesFromHTTPRequest(network, request) -} - -// EndUserAttributesFromHTTPRequest generates attributes of the -// enduser namespace as specified by the OpenTelemetry specification -// for a span. -func EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - return sc.EndUserAttributesFromHTTPRequest(request) -} - -// HTTPClientAttributesFromHTTPRequest generates attributes of the -// http namespace as specified by the OpenTelemetry specification for -// a span on the client side. -func HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - return sc.HTTPClientAttributesFromHTTPRequest(request) -} - -// HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes -// to be used with server-side HTTP metrics. -func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue { - return sc.HTTPServerMetricAttributesFromHTTPRequest(serverName, request) -} - -// HTTPServerAttributesFromHTTPRequest generates attributes of the -// http namespace as specified by the OpenTelemetry specification for -// a span on the server side. Currently, only basic authentication is -// supported. -func HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue { - return sc.HTTPServerAttributesFromHTTPRequest(serverName, route, request) -} - -// HTTPAttributesFromHTTPStatusCode generates attributes of the http -// namespace as specified by the OpenTelemetry specification for a -// span. -func HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue { - return sc.HTTPAttributesFromHTTPStatusCode(code) -} - -// SpanStatusFromHTTPStatusCode generates a status code and a message -// as specified by the OpenTelemetry specification for a span. -func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) { - return internal.SpanStatusFromHTTPStatusCode(code) -} - -// SpanStatusFromHTTPStatusCodeAndSpanKind generates a status code and a message -// as specified by the OpenTelemetry specification for a span. -// Exclude 4xx for SERVER to set the appropriate status. -func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string) { - return internal.SpanStatusFromHTTPStatusCodeAndSpanKind(code, spanKind) -} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/resource.go b/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/resource.go deleted file mode 100644 index 45951685a7..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/resource.go +++ /dev/null @@ -1,1031 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Code generated from semantic convention specification. DO NOT EDIT. - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.12.0" - -import "go.opentelemetry.io/otel/attribute" - -// The web browser in which the application represented by the resource is running. The `browser.*` attributes MUST be used only for resources that represent applications running in a web browser (regardless of whether running on a mobile or desktop device). -const ( - // Array of brand name and version separated by a space - // - // Type: string[] - // Required: No - // Stability: stable - // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' - // Note: This value is intended to be taken from the [UA client hints - // API](https://wicg.github.io/ua-client-hints/#interface) - // (navigator.userAgentData.brands). - BrowserBrandsKey = attribute.Key("browser.brands") - // The platform on which the browser is running - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'Windows', 'macOS', 'Android' - // Note: This value is intended to be taken from the [UA client hints - // API](https://wicg.github.io/ua-client-hints/#interface) - // (navigator.userAgentData.platform). If unavailable, the legacy - // `navigator.platform` API SHOULD NOT be used instead and this attribute SHOULD - // be left unset in order for the values to be consistent. - // The list of possible values is defined in the [W3C User-Agent Client Hints - // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). - // Note that some (but not all) of these values can overlap with values in the - // [os.type and os.name attributes](./os.md). However, for consistency, the values - // in the `browser.platform` attribute should capture the exact value that the - // user agent provides. - BrowserPlatformKey = attribute.Key("browser.platform") - // Full user-agent string provided by the browser - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 - // (KHTML, ' - // 'like Gecko) Chrome/95.0.4638.54 Safari/537.36' - // Note: The user-agent value SHOULD be provided only from browsers that do not - // have a mechanism to retrieve brands and platform individually from the User- - // Agent Client Hints API. To retrieve the value, the legacy `navigator.userAgent` - // API can be used. - BrowserUserAgentKey = attribute.Key("browser.user_agent") -) - -// A cloud environment (e.g. GCP, Azure, AWS) -const ( - // Name of the cloud provider. - // - // Type: Enum - // Required: No - // Stability: stable - CloudProviderKey = attribute.Key("cloud.provider") - // The cloud account ID the resource is assigned to. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '111111111111', 'opentelemetry' - CloudAccountIDKey = attribute.Key("cloud.account.id") - // The geographical region the resource is running. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'us-central1', 'us-east-1' - // Note: Refer to your provider's docs to see the available regions, for example - // [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc- - // detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global- - // infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en- - // us/global-infrastructure/geographies/), [Google Cloud - // regions](https://cloud.google.com/about/locations), or [Tencent Cloud - // regions](https://intl.cloud.tencent.com/document/product/213/6091). - CloudRegionKey = attribute.Key("cloud.region") - // Cloud regions often have multiple, isolated locations known as zones to - // increase availability. Availability zone represents the zone where the resource - // is running. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'us-east-1c' - // Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud. - CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") - // The cloud platform in use. - // - // Type: Enum - // Required: No - // Stability: stable - // Note: The prefix of the service SHOULD match the one specified in - // `cloud.provider`. - CloudPlatformKey = attribute.Key("cloud.platform") -) - -var ( - // Alibaba Cloud - CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") - // Amazon Web Services - CloudProviderAWS = CloudProviderKey.String("aws") - // Microsoft Azure - CloudProviderAzure = CloudProviderKey.String("azure") - // Google Cloud Platform - CloudProviderGCP = CloudProviderKey.String("gcp") - // Tencent Cloud - CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") -) - -var ( - // Alibaba Cloud Elastic Compute Service - CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") - // Alibaba Cloud Function Compute - CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") - // AWS Elastic Compute Cloud - CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") - // AWS Elastic Container Service - CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") - // AWS Elastic Kubernetes Service - CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") - // AWS Lambda - CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") - // AWS Elastic Beanstalk - CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") - // AWS App Runner - CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") - // Azure Virtual Machines - CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") - // Azure Container Instances - CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") - // Azure Kubernetes Service - CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") - // Azure Functions - CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") - // Azure App Service - CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") - // Google Cloud Compute Engine (GCE) - CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") - // Google Cloud Run - CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") - // Google Cloud Kubernetes Engine (GKE) - CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") - // Google Cloud Functions (GCF) - CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") - // Google Cloud App Engine (GAE) - CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") - // Tencent Cloud Cloud Virtual Machine (CVM) - CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") - // Tencent Cloud Elastic Kubernetes Service (EKS) - CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") - // Tencent Cloud Serverless Cloud Function (SCF) - CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") -) - -// Resources used by AWS Elastic Container Service (ECS). -const ( - // The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws. - // amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'arn:aws:ecs:us- - // west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' - AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") - // The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/develo - // perguide/clusters.html). - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' - AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") - // The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/l - // aunch_types.html) for an ECS task. - // - // Type: Enum - // Required: No - // Stability: stable - AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") - // The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/lates - // t/developerguide/task_definitions.html). - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'arn:aws:ecs:us- - // west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' - AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") - // The task definition family this task definition is a member of. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'opentelemetry-family' - AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") - // The revision for this task definition. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '8', '26' - AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") -) - -var ( - // ec2 - AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") - // fargate - AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") -) - -// Resources used by AWS Elastic Kubernetes Service (EKS). -const ( - // The ARN of an EKS cluster. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' - AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") -) - -// Resources specific to Amazon Web Services. -const ( - // The name(s) of the AWS log group(s) an application is writing to. - // - // Type: string[] - // Required: No - // Stability: stable - // Examples: '/aws/lambda/my-function', 'opentelemetry-service' - // Note: Multiple log groups must be supported for cases like multi-container - // applications, where a single application has sidecar containers, and each write - // to their own log group. - AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") - // The Amazon Resource Name(s) (ARN) of the AWS log group(s). - // - // Type: string[] - // Required: No - // Stability: stable - // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' - // Note: See the [log group ARN format - // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- - // access-control-overview-cwl.html#CWL_ARN_Format). - AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") - // The name(s) of the AWS log stream(s) an application is writing to. - // - // Type: string[] - // Required: No - // Stability: stable - // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' - AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") - // The ARN(s) of the AWS log stream(s). - // - // Type: string[] - // Required: No - // Stability: stable - // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log- - // stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' - // Note: See the [log stream ARN format - // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- - // access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain - // several log streams, so these ARNs necessarily identify both a log group and a - // log stream. - AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") -) - -// A container instance. -const ( - // Container name used by container runtime. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'opentelemetry-autoconf' - ContainerNameKey = attribute.Key("container.name") - // Container ID. Usually a UUID, as for example used to [identify Docker - // containers](https://docs.docker.com/engine/reference/run/#container- - // identification). The UUID might be abbreviated. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'a3bf90e006b2' - ContainerIDKey = attribute.Key("container.id") - // The container runtime managing this container. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'docker', 'containerd', 'rkt' - ContainerRuntimeKey = attribute.Key("container.runtime") - // Name of the image the container was built on. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'gcr.io/opentelemetry/operator' - ContainerImageNameKey = attribute.Key("container.image.name") - // Container image tag. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '0.1' - ContainerImageTagKey = attribute.Key("container.image.tag") -) - -// The software deployment. -const ( - // Name of the [deployment - // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka - // deployment tier). - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'staging', 'production' - DeploymentEnvironmentKey = attribute.Key("deployment.environment") -) - -// The device on which the process represented by this resource is running. -const ( - // A unique identifier representing the device - // - // Type: string - // Required: No - // Stability: stable - // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' - // Note: The device identifier MUST only be defined using the values outlined - // below. This value is not an advertising identifier and MUST NOT be used as - // such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor id - // entifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-iden - // tifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the - // Firebase Installation ID or a globally unique UUID which is persisted across - // sessions in your application. More information can be found - // [here](https://developer.android.com/training/articles/user-data-ids) on best - // practices and exact implementation details. Caution should be taken when - // storing personal data or anything which can identify a user. GDPR and data - // protection laws may apply, ensure you do your own due diligence. - DeviceIDKey = attribute.Key("device.id") - // The model identifier for the device - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'iPhone3,4', 'SM-G920F' - // Note: It's recommended this value represents a machine readable version of the - // model identifier rather than the market or consumer-friendly name of the - // device. - DeviceModelIdentifierKey = attribute.Key("device.model.identifier") - // The marketing name for the device model - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' - // Note: It's recommended this value represents a human readable version of the - // device model rather than a machine readable alternative. - DeviceModelNameKey = attribute.Key("device.model.name") - // The name of the device manufacturer - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'Apple', 'Samsung' - // Note: The Android OS provides this field via - // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). - // iOS apps SHOULD hardcode the value `Apple`. - DeviceManufacturerKey = attribute.Key("device.manufacturer") -) - -// A serverless instance. -const ( - // The name of the single function that this runtime instance executes. - // - // Type: string - // Required: Always - // Stability: stable - // Examples: 'my-function', 'myazurefunctionapp/some-function-name' - // Note: This is the name of the function as configured/deployed on the FaaS - // platform and is usually different from the name of the callback - // function (which may be stored in the - // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span- - // general.md#source-code-attributes) - // span attributes). - - // For some cloud providers, the above definition is ambiguous. The following - // definition of function name MUST be used for this attribute - // (and consequently the span name) for the listed cloud providers/products: - - // * **Azure:** The full name `/`, i.e., function app name - // followed by a forward slash followed by the function name (this form - // can also be seen in the resource JSON for the function). - // This means that a span attribute MUST be used, as an Azure function - // app can host multiple functions that would usually share - // a TracerProvider (see also the `faas.id` attribute). - FaaSNameKey = attribute.Key("faas.name") - // The unique ID of the single function that this runtime instance executes. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'arn:aws:lambda:us-west-2:123456789012:function:my-function' - // Note: On some cloud providers, it may not be possible to determine the full ID - // at startup, - // so consider setting `faas.id` as a span attribute instead. - - // The exact value to use for `faas.id` depends on the cloud provider: - - // * **AWS Lambda:** The function - // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and- - // namespaces.html). - // Take care not to use the "invoked ARN" directly but replace any - // [alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration- - // aliases.html) - // with the resolved function version, as the same runtime instance may be - // invokable with - // multiple different aliases. - // * **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full- - // resource-names) - // * **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en- - // us/rest/api/resources/resources/get-by-id) of the invoked function, - // *not* the function app, having the form - // `/subscriptions//resourceGroups//providers/Microsoft.We - // b/sites//functions/`. - // This means that a span attribute MUST be used, as an Azure function app can - // host multiple functions that would usually share - // a TracerProvider. - FaaSIDKey = attribute.Key("faas.id") - // The immutable version of the function being executed. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '26', 'pinkfroid-00002' - // Note: Depending on the cloud provider and platform, use: - - // * **AWS Lambda:** The [function - // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration- - // versions.html) - // (an integer represented as a decimal string). - // * **Google Cloud Run:** The - // [revision](https://cloud.google.com/run/docs/managing/revisions) - // (i.e., the function name plus the revision suffix). - // * **Google Cloud Functions:** The value of the - // [`K_REVISION` environment - // variable](https://cloud.google.com/functions/docs/env- - // var#runtime_environment_variables_set_automatically). - // * **Azure Functions:** Not applicable. Do not set this attribute. - FaaSVersionKey = attribute.Key("faas.version") - // The execution environment ID as a string, that will be potentially reused for - // other invocations to the same function/function version. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' - // Note: * **AWS Lambda:** Use the (full) log stream name. - FaaSInstanceKey = attribute.Key("faas.instance") - // The amount of memory available to the serverless function in MiB. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 128 - // Note: It's recommended to set this attribute since e.g. too little memory can - // easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, - // the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this - // information. - FaaSMaxMemoryKey = attribute.Key("faas.max_memory") -) - -// A host is defined as a general computing instance. -const ( - // Unique host ID. For Cloud, this must be the instance_id assigned by the cloud - // provider. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'opentelemetry-test' - HostIDKey = attribute.Key("host.id") - // Name of the host. On Unix systems, it may contain what the hostname command - // returns, or the fully qualified hostname, or another name specified by the - // user. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'opentelemetry-test' - HostNameKey = attribute.Key("host.name") - // Type of host. For Cloud, this must be the machine type. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'n1-standard-1' - HostTypeKey = attribute.Key("host.type") - // The CPU architecture the host system is running on. - // - // Type: Enum - // Required: No - // Stability: stable - HostArchKey = attribute.Key("host.arch") - // Name of the VM image or OS install the host was instantiated from. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' - HostImageNameKey = attribute.Key("host.image.name") - // VM image ID. For Cloud, this value is from the provider. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'ami-07b06b442921831e5' - HostImageIDKey = attribute.Key("host.image.id") - // The version string of the VM image as defined in [Version - // Attributes](README.md#version-attributes). - // - // Type: string - // Required: No - // Stability: stable - // Examples: '0.1' - HostImageVersionKey = attribute.Key("host.image.version") -) - -var ( - // AMD64 - HostArchAMD64 = HostArchKey.String("amd64") - // ARM32 - HostArchARM32 = HostArchKey.String("arm32") - // ARM64 - HostArchARM64 = HostArchKey.String("arm64") - // Itanium - HostArchIA64 = HostArchKey.String("ia64") - // 32-bit PowerPC - HostArchPPC32 = HostArchKey.String("ppc32") - // 64-bit PowerPC - HostArchPPC64 = HostArchKey.String("ppc64") - // IBM z/Architecture - HostArchS390x = HostArchKey.String("s390x") - // 32-bit x86 - HostArchX86 = HostArchKey.String("x86") -) - -// A Kubernetes Cluster. -const ( - // The name of the cluster. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'opentelemetry-cluster' - K8SClusterNameKey = attribute.Key("k8s.cluster.name") -) - -// A Kubernetes Node object. -const ( - // The name of the Node. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'node-1' - K8SNodeNameKey = attribute.Key("k8s.node.name") - // The UID of the Node. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' - K8SNodeUIDKey = attribute.Key("k8s.node.uid") -) - -// A Kubernetes Namespace. -const ( - // The name of the namespace that the pod is running in. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'default' - K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") -) - -// A Kubernetes Pod object. -const ( - // The UID of the Pod. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SPodUIDKey = attribute.Key("k8s.pod.uid") - // The name of the Pod. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'opentelemetry-pod-autoconf' - K8SPodNameKey = attribute.Key("k8s.pod.name") -) - -// A container in a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). -const ( - // The name of the Container from Pod specification, must be unique within a Pod. - // Container runtime usually uses different globally unique name - // (`container.name`). - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'redis' - K8SContainerNameKey = attribute.Key("k8s.container.name") - // Number of times the container was restarted. This attribute can be used to - // identify a particular container (running or stopped) within a container spec. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 0, 2 - K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") -) - -// A Kubernetes ReplicaSet object. -const ( - // The UID of the ReplicaSet. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") - // The name of the ReplicaSet. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'opentelemetry' - K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") -) - -// A Kubernetes Deployment object. -const ( - // The UID of the Deployment. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") - // The name of the Deployment. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'opentelemetry' - K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") -) - -// A Kubernetes StatefulSet object. -const ( - // The UID of the StatefulSet. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") - // The name of the StatefulSet. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'opentelemetry' - K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") -) - -// A Kubernetes DaemonSet object. -const ( - // The UID of the DaemonSet. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") - // The name of the DaemonSet. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'opentelemetry' - K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") -) - -// A Kubernetes Job object. -const ( - // The UID of the Job. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SJobUIDKey = attribute.Key("k8s.job.uid") - // The name of the Job. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'opentelemetry' - K8SJobNameKey = attribute.Key("k8s.job.name") -) - -// A Kubernetes CronJob object. -const ( - // The UID of the CronJob. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") - // The name of the CronJob. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'opentelemetry' - K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") -) - -// The operating system (OS) on which the process represented by this resource is running. -const ( - // The operating system type. - // - // Type: Enum - // Required: Always - // Stability: stable - OSTypeKey = attribute.Key("os.type") - // Human readable (not intended to be parsed) OS version information, like e.g. - // reported by `ver` or `lsb_release -a` commands. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 LTS' - OSDescriptionKey = attribute.Key("os.description") - // Human readable operating system name. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'iOS', 'Android', 'Ubuntu' - OSNameKey = attribute.Key("os.name") - // The version string of the operating system as defined in [Version - // Attributes](../../resource/semantic_conventions/README.md#version-attributes). - // - // Type: string - // Required: No - // Stability: stable - // Examples: '14.2.1', '18.04.1' - OSVersionKey = attribute.Key("os.version") -) - -var ( - // Microsoft Windows - OSTypeWindows = OSTypeKey.String("windows") - // Linux - OSTypeLinux = OSTypeKey.String("linux") - // Apple Darwin - OSTypeDarwin = OSTypeKey.String("darwin") - // FreeBSD - OSTypeFreeBSD = OSTypeKey.String("freebsd") - // NetBSD - OSTypeNetBSD = OSTypeKey.String("netbsd") - // OpenBSD - OSTypeOpenBSD = OSTypeKey.String("openbsd") - // DragonFly BSD - OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") - // HP-UX (Hewlett Packard Unix) - OSTypeHPUX = OSTypeKey.String("hpux") - // AIX (Advanced Interactive eXecutive) - OSTypeAIX = OSTypeKey.String("aix") - // SunOS, Oracle Solaris - OSTypeSolaris = OSTypeKey.String("solaris") - // IBM z/OS - OSTypeZOS = OSTypeKey.String("z_os") -) - -// An operating system process. -const ( - // Process identifier (PID). - // - // Type: int - // Required: No - // Stability: stable - // Examples: 1234 - ProcessPIDKey = attribute.Key("process.pid") - // The name of the process executable. On Linux based systems, can be set to the - // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of - // `GetProcessImageFileNameW`. - // - // Type: string - // Required: See below - // Stability: stable - // Examples: 'otelcol' - ProcessExecutableNameKey = attribute.Key("process.executable.name") - // The full path to the process executable. On Linux based systems, can be set to - // the target of `proc/[pid]/exe`. On Windows, can be set to the result of - // `GetProcessImageFileNameW`. - // - // Type: string - // Required: See below - // Stability: stable - // Examples: '/usr/bin/cmd/otelcol' - ProcessExecutablePathKey = attribute.Key("process.executable.path") - // The command used to launch the process (i.e. the command name). On Linux based - // systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, - // can be set to the first parameter extracted from `GetCommandLineW`. - // - // Type: string - // Required: See below - // Stability: stable - // Examples: 'cmd/otelcol' - ProcessCommandKey = attribute.Key("process.command") - // The full command used to launch the process as a single string representing the - // full command. On Windows, can be set to the result of `GetCommandLineW`. Do not - // set this if you have to assemble it just for monitoring; use - // `process.command_args` instead. - // - // Type: string - // Required: See below - // Stability: stable - // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' - ProcessCommandLineKey = attribute.Key("process.command_line") - // All the command arguments (including the command/executable itself) as received - // by the process. On Linux-based systems (and some other Unixoid systems - // supporting procfs), can be set according to the list of null-delimited strings - // extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be - // the full argv vector passed to `main`. - // - // Type: string[] - // Required: See below - // Stability: stable - // Examples: 'cmd/otecol', '--config=config.yaml' - ProcessCommandArgsKey = attribute.Key("process.command_args") - // The username of the user that owns the process. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'root' - ProcessOwnerKey = attribute.Key("process.owner") -) - -// The single (language) runtime instance which is monitored. -const ( - // The name of the runtime of this process. For compiled native binaries, this - // SHOULD be the name of the compiler. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'OpenJDK Runtime Environment' - ProcessRuntimeNameKey = attribute.Key("process.runtime.name") - // The version of the runtime of this process, as returned by the runtime without - // modification. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '14.0.2' - ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") - // An additional description about the runtime of the process, for example a - // specific vendor customization of the runtime environment. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' - ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") -) - -// A service instance. -const ( - // Logical name of the service. - // - // Type: string - // Required: Always - // Stability: stable - // Examples: 'shoppingcart' - // Note: MUST be the same for all instances of horizontally scaled services. If - // the value was not specified, SDKs MUST fallback to `unknown_service:` - // concatenated with [`process.executable.name`](process.md#process), e.g. - // `unknown_service:bash`. If `process.executable.name` is not available, the - // value MUST be set to `unknown_service`. - ServiceNameKey = attribute.Key("service.name") - // A namespace for `service.name`. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'Shop' - // Note: A string value having a meaning that helps to distinguish a group of - // services, for example the team name that owns a group of services. - // `service.name` is expected to be unique within the same namespace. If - // `service.namespace` is not specified in the Resource then `service.name` is - // expected to be unique for all services that have no explicit namespace defined - // (so the empty/unspecified namespace is simply one more valid namespace). Zero- - // length namespace string is assumed equal to unspecified namespace. - ServiceNamespaceKey = attribute.Key("service.namespace") - // The string ID of the service instance. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '627cc493-f310-47de-96bd-71410b7dec09' - // Note: MUST be unique for each instance of the same - // `service.namespace,service.name` pair (in other words - // `service.namespace,service.name,service.instance.id` triplet MUST be globally - // unique). The ID helps to distinguish instances of the same service that exist - // at the same time (e.g. instances of a horizontally scaled service). It is - // preferable for the ID to be persistent and stay the same for the lifetime of - // the service instance, however it is acceptable that the ID is ephemeral and - // changes during important lifetime events for the service (e.g. service - // restarts). If the service has no inherent unique ID that can be used as the - // value of this attribute it is recommended to generate a random Version 1 or - // Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use - // Version 5, see RFC 4122 for more recommendations). - ServiceInstanceIDKey = attribute.Key("service.instance.id") - // The version string of the service API or implementation. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '2.0.0' - ServiceVersionKey = attribute.Key("service.version") -) - -// The telemetry SDK used to capture data recorded by the instrumentation libraries. -const ( - // The name of the telemetry SDK as defined above. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'opentelemetry' - TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") - // The language of the telemetry SDK. - // - // Type: Enum - // Required: No - // Stability: stable - TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") - // The version string of the telemetry SDK. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '1.2.3' - TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") - // The version string of the auto instrumentation agent, if used. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '1.2.3' - TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") -) - -var ( - // cpp - TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") - // dotnet - TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") - // erlang - TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") - // go - TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") - // java - TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") - // nodejs - TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") - // php - TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") - // python - TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") - // ruby - TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") - // webjs - TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") - // swift - TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") -) - -// Resource describing the packaged software running the application code. Web engines are typically executed using process.runtime. -const ( - // The name of the web engine. - // - // Type: string - // Required: Always - // Stability: stable - // Examples: 'WildFly' - WebEngineNameKey = attribute.Key("webengine.name") - // The version of the web engine. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '21.0.0' - WebEngineVersionKey = attribute.Key("webengine.version") - // Additional description of the web engine (e.g. detailed version and edition - // information). - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - 2.2.2.Final' - WebEngineDescriptionKey = attribute.Key("webengine.description") -) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/schema.go deleted file mode 100644 index f01d515bc2..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/schema.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.12.0" - -// SchemaURL is the schema URL that matches the version of the semantic conventions -// that this package defines. Semconv packages starting from v1.4.0 must declare -// non-empty schema URL in the form https://opentelemetry.io/schemas/ -const SchemaURL = "https://opentelemetry.io/schemas/1.12.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/trace.go b/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/trace.go deleted file mode 100644 index 70c25dc210..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.12.0/trace.go +++ /dev/null @@ -1,1693 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Code generated from semantic convention specification. DO NOT EDIT. - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.12.0" - -import "go.opentelemetry.io/otel/attribute" - -// Span attributes used by AWS Lambda (in addition to general `faas` attributes). -const ( - // The full invoked ARN as provided on the `Context` passed to the function - // (`Lambda-Runtime-Invoked-Function-ARN` header on the `/runtime/invocation/next` - // applicable). - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' - // Note: This may be different from `faas.id` if an alias is involved. - AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") -) - -// This document defines attributes for CloudEvents. CloudEvents is a specification on how to define event data in a standard way. These attributes can be attached to spans when performing operations with CloudEvents, regardless of the protocol being used. -const ( - // The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec - // .md#id) uniquely identifies the event. - // - // Type: string - // Required: Always - // Stability: stable - // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' - CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") - // The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.m - // d#source-1) identifies the context in which an event happened. - // - // Type: string - // Required: Always - // Stability: stable - // Examples: 'https://github.com/cloudevents', '/cloudevents/spec/pull/123', 'my- - // service' - CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") - // The [version of the CloudEvents specification](https://github.com/cloudevents/s - // pec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses. - // - // Type: string - // Required: Always - // Stability: stable - // Examples: '1.0' - CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") - // The [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/sp - // ec.md#type) contains a value describing the type of event related to the - // originating occurrence. - // - // Type: string - // Required: Always - // Stability: stable - // Examples: 'com.github.pull_request.opened', 'com.example.object.deleted.v2' - CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") - // The [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec. - // md#subject) of the event in the context of the event producer (identified by - // source). - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'mynewfile.jpg' - CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") -) - -// This document defines semantic conventions for the OpenTracing Shim -const ( - // Parent-child Reference type - // - // Type: Enum - // Required: No - // Stability: stable - // Note: The causal relationship between a child Span and a parent Span. - OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") -) - -var ( - // The parent Span depends on the child Span in some capacity - OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") - // The parent Span does not depend in any way on the result of the child Span - OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") -) - -// This document defines the attributes used to perform database client calls. -const ( - // An identifier for the database management system (DBMS) product being used. See - // below for a list of well-known identifiers. - // - // Type: Enum - // Required: Always - // Stability: stable - DBSystemKey = attribute.Key("db.system") - // The connection string used to connect to the database. It is recommended to - // remove embedded credentials. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' - DBConnectionStringKey = attribute.Key("db.connection_string") - // Username for accessing the database. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'readonly_user', 'reporting_user' - DBUserKey = attribute.Key("db.user") - // The fully-qualified class name of the [Java Database Connectivity - // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver - // used to connect. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'org.postgresql.Driver', - // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' - DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") - // This attribute is used to report the name of the database being accessed. For - // commands that switch the database, this should be set to the target database - // (even if the command fails). - // - // Type: string - // Required: Required, if applicable. - // Stability: stable - // Examples: 'customers', 'main' - // Note: In some SQL databases, the database name to be used is called "schema - // name". In case there are multiple layers that could be considered for database - // name (e.g. Oracle instance name and schema name), the database name to be used - // is the more specific layer (e.g. Oracle schema name). - DBNameKey = attribute.Key("db.name") - // The database statement being executed. - // - // Type: string - // Required: Required if applicable and not explicitly disabled via - // instrumentation configuration. - // Stability: stable - // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' - // Note: The value may be sanitized to exclude sensitive information. - DBStatementKey = attribute.Key("db.statement") - // The name of the operation being executed, e.g. the [MongoDB command - // name](https://docs.mongodb.com/manual/reference/command/#database-operations) - // such as `findAndModify`, or the SQL keyword. - // - // Type: string - // Required: Required, if `db.statement` is not applicable. - // Stability: stable - // Examples: 'findAndModify', 'HMSET', 'SELECT' - // Note: When setting this to an SQL keyword, it is not recommended to attempt any - // client-side parsing of `db.statement` just to get this property, but it should - // be set if the operation name is provided by the library being instrumented. If - // the SQL statement has an ambiguous operation, or performs more than one - // operation, this value may be omitted. - DBOperationKey = attribute.Key("db.operation") -) - -var ( - // Some other SQL database. Fallback only. See notes - DBSystemOtherSQL = DBSystemKey.String("other_sql") - // Microsoft SQL Server - DBSystemMSSQL = DBSystemKey.String("mssql") - // MySQL - DBSystemMySQL = DBSystemKey.String("mysql") - // Oracle Database - DBSystemOracle = DBSystemKey.String("oracle") - // IBM DB2 - DBSystemDB2 = DBSystemKey.String("db2") - // PostgreSQL - DBSystemPostgreSQL = DBSystemKey.String("postgresql") - // Amazon Redshift - DBSystemRedshift = DBSystemKey.String("redshift") - // Apache Hive - DBSystemHive = DBSystemKey.String("hive") - // Cloudscape - DBSystemCloudscape = DBSystemKey.String("cloudscape") - // HyperSQL DataBase - DBSystemHSQLDB = DBSystemKey.String("hsqldb") - // Progress Database - DBSystemProgress = DBSystemKey.String("progress") - // SAP MaxDB - DBSystemMaxDB = DBSystemKey.String("maxdb") - // SAP HANA - DBSystemHanaDB = DBSystemKey.String("hanadb") - // Ingres - DBSystemIngres = DBSystemKey.String("ingres") - // FirstSQL - DBSystemFirstSQL = DBSystemKey.String("firstsql") - // EnterpriseDB - DBSystemEDB = DBSystemKey.String("edb") - // InterSystems Caché - DBSystemCache = DBSystemKey.String("cache") - // Adabas (Adaptable Database System) - DBSystemAdabas = DBSystemKey.String("adabas") - // Firebird - DBSystemFirebird = DBSystemKey.String("firebird") - // Apache Derby - DBSystemDerby = DBSystemKey.String("derby") - // FileMaker - DBSystemFilemaker = DBSystemKey.String("filemaker") - // Informix - DBSystemInformix = DBSystemKey.String("informix") - // InstantDB - DBSystemInstantDB = DBSystemKey.String("instantdb") - // InterBase - DBSystemInterbase = DBSystemKey.String("interbase") - // MariaDB - DBSystemMariaDB = DBSystemKey.String("mariadb") - // Netezza - DBSystemNetezza = DBSystemKey.String("netezza") - // Pervasive PSQL - DBSystemPervasive = DBSystemKey.String("pervasive") - // PointBase - DBSystemPointbase = DBSystemKey.String("pointbase") - // SQLite - DBSystemSqlite = DBSystemKey.String("sqlite") - // Sybase - DBSystemSybase = DBSystemKey.String("sybase") - // Teradata - DBSystemTeradata = DBSystemKey.String("teradata") - // Vertica - DBSystemVertica = DBSystemKey.String("vertica") - // H2 - DBSystemH2 = DBSystemKey.String("h2") - // ColdFusion IMQ - DBSystemColdfusion = DBSystemKey.String("coldfusion") - // Apache Cassandra - DBSystemCassandra = DBSystemKey.String("cassandra") - // Apache HBase - DBSystemHBase = DBSystemKey.String("hbase") - // MongoDB - DBSystemMongoDB = DBSystemKey.String("mongodb") - // Redis - DBSystemRedis = DBSystemKey.String("redis") - // Couchbase - DBSystemCouchbase = DBSystemKey.String("couchbase") - // CouchDB - DBSystemCouchDB = DBSystemKey.String("couchdb") - // Microsoft Azure Cosmos DB - DBSystemCosmosDB = DBSystemKey.String("cosmosdb") - // Amazon DynamoDB - DBSystemDynamoDB = DBSystemKey.String("dynamodb") - // Neo4j - DBSystemNeo4j = DBSystemKey.String("neo4j") - // Apache Geode - DBSystemGeode = DBSystemKey.String("geode") - // Elasticsearch - DBSystemElasticsearch = DBSystemKey.String("elasticsearch") - // Memcached - DBSystemMemcached = DBSystemKey.String("memcached") - // CockroachDB - DBSystemCockroachdb = DBSystemKey.String("cockroachdb") -) - -// Connection-level attributes for Microsoft SQL Server -const ( - // The Microsoft SQL Server [instance name](https://docs.microsoft.com/en- - // us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) - // connecting to. This name is used to determine the port of a named instance. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'MSSQLSERVER' - // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer - // required (but still recommended if non-standard). - DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") -) - -// Call-level attributes for Cassandra -const ( - // The fetch size used for paging, i.e. how many rows will be returned at once. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 5000 - DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") - // The consistency level of the query. Based on consistency values from - // [CQL](https://docs.datastax.com/en/cassandra- - // oss/3.0/cassandra/dml/dmlConfigConsistency.html). - // - // Type: Enum - // Required: No - // Stability: stable - DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") - // The name of the primary table that the operation is acting upon, including the - // keyspace name (if applicable). - // - // Type: string - // Required: Recommended if available. - // Stability: stable - // Examples: 'mytable' - // Note: This mirrors the db.sql.table attribute but references cassandra rather - // than sql. It is not recommended to attempt any client-side parsing of - // `db.statement` just to get this property, but it should be set if it is - // provided by the library being instrumented. If the operation is acting upon an - // anonymous table, or more than one table, this value MUST NOT be set. - DBCassandraTableKey = attribute.Key("db.cassandra.table") - // Whether or not the query is idempotent. - // - // Type: boolean - // Required: No - // Stability: stable - DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") - // The number of times a query was speculatively executed. Not set or `0` if the - // query was not executed speculatively. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 0, 2 - DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") - // The ID of the coordinating node for a query. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' - DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") - // The data center of the coordinating node for a query. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'us-west-2' - DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") -) - -var ( - // all - DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") - // each_quorum - DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") - // quorum - DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") - // local_quorum - DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") - // one - DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") - // two - DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") - // three - DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") - // local_one - DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") - // any - DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") - // serial - DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") - // local_serial - DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") -) - -// Call-level attributes for Redis -const ( - // The index of the database being accessed as used in the [`SELECT` - // command](https://redis.io/commands/select), provided as an integer. To be used - // instead of the generic `db.name` attribute. - // - // Type: int - // Required: Required, if other than the default database (`0`). - // Stability: stable - // Examples: 0, 1, 15 - DBRedisDBIndexKey = attribute.Key("db.redis.database_index") -) - -// Call-level attributes for MongoDB -const ( - // The collection being accessed within the database stated in `db.name`. - // - // Type: string - // Required: Always - // Stability: stable - // Examples: 'customers', 'products' - DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") -) - -// Call-level attributes for SQL databases -const ( - // The name of the primary table that the operation is acting upon, including the - // database name (if applicable). - // - // Type: string - // Required: Recommended if available. - // Stability: stable - // Examples: 'public.users', 'customers' - // Note: It is not recommended to attempt any client-side parsing of - // `db.statement` just to get this property, but it should be set if it is - // provided by the library being instrumented. If the operation is acting upon an - // anonymous table, or more than one table, this value MUST NOT be set. - DBSQLTableKey = attribute.Key("db.sql.table") -) - -// This document defines the attributes used to report a single exception associated with a span. -const ( - // The type of the exception (its fully-qualified class name, if applicable). The - // dynamic type of the exception should be preferred over the static type in - // languages that support it. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'java.net.ConnectException', 'OSError' - ExceptionTypeKey = attribute.Key("exception.type") - // The exception message. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'Division by zero', "Can't convert 'int' object to str implicitly" - ExceptionMessageKey = attribute.Key("exception.message") - // A stacktrace as a string in the natural representation for the language - // runtime. The representation is to be determined and documented by each language - // SIG. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test - // exception\\n at ' - // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' - // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' - // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' - ExceptionStacktraceKey = attribute.Key("exception.stacktrace") - // SHOULD be set to true if the exception event is recorded at a point where it is - // known that the exception is escaping the scope of the span. - // - // Type: boolean - // Required: No - // Stability: stable - // Note: An exception is considered to have escaped (or left) the scope of a span, - // if that span is ended while the exception is still logically "in flight". - // This may be actually "in flight" in some languages (e.g. if the exception - // is passed to a Context manager's `__exit__` method in Python) but will - // usually be caught at the point of recording the exception in most languages. - - // It is usually not possible to determine at the point where an exception is - // thrown - // whether it will escape the scope of a span. - // However, it is trivial to know that an exception - // will escape, if one checks for an active exception just before ending the span, - // as done in the [example above](#recording-an-exception). - - // It follows that an exception may still escape the scope of the span - // even if the `exception.escaped` attribute was not set or set to false, - // since the event might have been recorded at a time where it was not - // clear whether the exception will escape. - ExceptionEscapedKey = attribute.Key("exception.escaped") -) - -// This semantic convention describes an instance of a function that runs without provisioning or managing of servers (also known as serverless functions or Function as a Service (FaaS)) with spans. -const ( - // Type of the trigger which caused this function execution. - // - // Type: Enum - // Required: No - // Stability: stable - // Note: For the server/consumer span on the incoming side, - // `faas.trigger` MUST be set. - - // Clients invoking FaaS instances usually cannot set `faas.trigger`, - // since they would typically need to look in the payload to determine - // the event type. If clients set it, it should be the same as the - // trigger that corresponding incoming would have (i.e., this has - // nothing to do with the underlying transport used to make the API - // call to invoke the lambda, which is often HTTP). - FaaSTriggerKey = attribute.Key("faas.trigger") - // The execution ID of the current function execution. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' - FaaSExecutionKey = attribute.Key("faas.execution") -) - -var ( - // A response to some data source operation such as a database or filesystem read/write - FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") - // To provide an answer to an inbound HTTP request - FaaSTriggerHTTP = FaaSTriggerKey.String("http") - // A function is set to be executed when messages are sent to a messaging system - FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") - // A function is scheduled to be executed regularly - FaaSTriggerTimer = FaaSTriggerKey.String("timer") - // If none of the others apply - FaaSTriggerOther = FaaSTriggerKey.String("other") -) - -// Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. -const ( - // The name of the source on which the triggering operation was performed. For - // example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos - // DB to the database name. - // - // Type: string - // Required: Always - // Stability: stable - // Examples: 'myBucketName', 'myDBName' - FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") - // Describes the type of the operation that was performed on the data. - // - // Type: Enum - // Required: Always - // Stability: stable - FaaSDocumentOperationKey = attribute.Key("faas.document.operation") - // A string containing the time when the data was accessed in the [ISO - // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed - // in [UTC](https://www.w3.org/TR/NOTE-datetime). - // - // Type: string - // Required: Always - // Stability: stable - // Examples: '2020-01-23T13:47:06Z' - FaaSDocumentTimeKey = attribute.Key("faas.document.time") - // The document name/table subjected to the operation. For example, in Cloud - // Storage or S3 is the name of the file, and in Cosmos DB the table name. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'myFile.txt', 'myTableName' - FaaSDocumentNameKey = attribute.Key("faas.document.name") -) - -var ( - // When a new object is created - FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") - // When an object is modified - FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") - // When an object is deleted - FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") -) - -// Semantic Convention for FaaS scheduled to be executed regularly. -const ( - // A string containing the function invocation time in the [ISO - // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed - // in [UTC](https://www.w3.org/TR/NOTE-datetime). - // - // Type: string - // Required: Always - // Stability: stable - // Examples: '2020-01-23T13:47:06Z' - FaaSTimeKey = attribute.Key("faas.time") - // A string containing the schedule period as [Cron Expression](https://docs.oracl - // e.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). - // - // Type: string - // Required: No - // Stability: stable - // Examples: '0/5 * * * ? *' - FaaSCronKey = attribute.Key("faas.cron") -) - -// Contains additional attributes for incoming FaaS spans. -const ( - // A boolean that is true if the serverless function is executed for the first - // time (aka cold-start). - // - // Type: boolean - // Required: No - // Stability: stable - FaaSColdstartKey = attribute.Key("faas.coldstart") -) - -// Contains additional attributes for outgoing FaaS spans. -const ( - // The name of the invoked function. - // - // Type: string - // Required: Always - // Stability: stable - // Examples: 'my-function' - // Note: SHOULD be equal to the `faas.name` resource attribute of the invoked - // function. - FaaSInvokedNameKey = attribute.Key("faas.invoked_name") - // The cloud provider of the invoked function. - // - // Type: Enum - // Required: Always - // Stability: stable - // Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked - // function. - FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") - // The cloud region of the invoked function. - // - // Type: string - // Required: For some cloud providers, like AWS or GCP, the region in which a - // function is hosted is essential to uniquely identify the function and also part - // of its endpoint. Since it's part of the endpoint being called, the region is - // always known to clients. In these cases, `faas.invoked_region` MUST be set - // accordingly. If the region is unknown to the client or not required for - // identifying the invoked function, setting `faas.invoked_region` is optional. - // Stability: stable - // Examples: 'eu-central-1' - // Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked - // function. - FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") -) - -var ( - // Alibaba Cloud - FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") - // Amazon Web Services - FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") - // Microsoft Azure - FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") - // Google Cloud Platform - FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") - // Tencent Cloud - FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") -) - -// These attributes may be used for any network related operation. -const ( - // Transport protocol used. See note below. - // - // Type: Enum - // Required: No - // Stability: stable - NetTransportKey = attribute.Key("net.transport") - // Remote address of the peer (dotted decimal for IPv4 or - // [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6) - // - // Type: string - // Required: No - // Stability: stable - // Examples: '127.0.0.1' - NetPeerIPKey = attribute.Key("net.peer.ip") - // Remote port number. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 80, 8080, 443 - NetPeerPortKey = attribute.Key("net.peer.port") - // Remote hostname or similar, see note below. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'example.com' - // Note: `net.peer.name` SHOULD NOT be set if capturing it would require an extra - // DNS lookup. - NetPeerNameKey = attribute.Key("net.peer.name") - // Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '192.168.0.1' - NetHostIPKey = attribute.Key("net.host.ip") - // Like `net.peer.port` but for the host port. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 35555 - NetHostPortKey = attribute.Key("net.host.port") - // Local hostname or similar, see note below. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'localhost' - NetHostNameKey = attribute.Key("net.host.name") - // The internet connection type currently being used by the host. - // - // Type: Enum - // Required: No - // Stability: stable - // Examples: 'wifi' - NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") - // This describes more details regarding the connection.type. It may be the type - // of cell technology connection, but it could be used for describing details - // about a wifi connection. - // - // Type: Enum - // Required: No - // Stability: stable - // Examples: 'LTE' - NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") - // The name of the mobile carrier. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'sprint' - NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") - // The mobile carrier country code. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '310' - NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") - // The mobile carrier network code. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '001' - NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") - // The ISO 3166-1 alpha-2 2-character country code associated with the mobile - // carrier network. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'DE' - NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") -) - -var ( - // ip_tcp - NetTransportTCP = NetTransportKey.String("ip_tcp") - // ip_udp - NetTransportUDP = NetTransportKey.String("ip_udp") - // Another IP-based protocol - NetTransportIP = NetTransportKey.String("ip") - // Unix Domain socket. See below - NetTransportUnix = NetTransportKey.String("unix") - // Named or anonymous pipe. See note below - NetTransportPipe = NetTransportKey.String("pipe") - // In-process communication - NetTransportInProc = NetTransportKey.String("inproc") - // Something else (non IP-based) - NetTransportOther = NetTransportKey.String("other") -) - -var ( - // wifi - NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") - // wired - NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") - // cell - NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") - // unavailable - NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") - // unknown - NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") -) - -var ( - // GPRS - NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") - // EDGE - NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") - // UMTS - NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") - // CDMA - NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") - // EVDO Rel. 0 - NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") - // EVDO Rev. A - NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") - // CDMA2000 1XRTT - NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") - // HSDPA - NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") - // HSUPA - NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") - // HSPA - NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") - // IDEN - NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") - // EVDO Rev. B - NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") - // LTE - NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") - // EHRPD - NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") - // HSPAP - NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") - // GSM - NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") - // TD-SCDMA - NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") - // IWLAN - NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") - // 5G NR (New Radio) - NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") - // 5G NRNSA (New Radio Non-Standalone) - NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") - // LTE CA - NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") -) - -// Operations that access some remote service. -const ( - // The [`service.name`](../../resource/semantic_conventions/README.md#service) of - // the remote service. SHOULD be equal to the actual `service.name` resource - // attribute of the remote service if any. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'AuthTokenCache' - PeerServiceKey = attribute.Key("peer.service") -) - -// These attributes may be used for any operation with an authenticated and/or authorized enduser. -const ( - // Username or client_id extracted from the access token or - // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the - // inbound request from outside the system. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'username' - EnduserIDKey = attribute.Key("enduser.id") - // Actual/assumed role the client is making the request under extracted from token - // or application security context. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'admin' - EnduserRoleKey = attribute.Key("enduser.role") - // Scopes or granted authorities the client currently possesses extracted from - // token or application security context. The value would come from the scope - // associated with an [OAuth 2.0 Access - // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value - // in a [SAML 2.0 Assertion](http://docs.oasis- - // open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'read:message, write:files' - EnduserScopeKey = attribute.Key("enduser.scope") -) - -// These attributes may be used for any operation to store information about a thread that started a span. -const ( - // Current "managed" thread ID (as opposed to OS thread ID). - // - // Type: int - // Required: No - // Stability: stable - // Examples: 42 - ThreadIDKey = attribute.Key("thread.id") - // Current thread name. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'main' - ThreadNameKey = attribute.Key("thread.name") -) - -// These attributes allow to report this unit of code and therefore to provide more context about the span. -const ( - // The method or function name, or equivalent (usually rightmost part of the code - // unit's name). - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'serveRequest' - CodeFunctionKey = attribute.Key("code.function") - // The "namespace" within which `code.function` is defined. Usually the qualified - // class or module name, such that `code.namespace` + some separator + - // `code.function` form a unique identifier for the code unit. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'com.example.MyHTTPService' - CodeNamespaceKey = attribute.Key("code.namespace") - // The source code file name that identifies the code unit as uniquely as possible - // (preferably an absolute file path). - // - // Type: string - // Required: No - // Stability: stable - // Examples: '/usr/local/MyApplication/content_root/app/index.php' - CodeFilepathKey = attribute.Key("code.filepath") - // The line number in `code.filepath` best representing the operation. It SHOULD - // point within the code unit named in `code.function`. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 42 - CodeLineNumberKey = attribute.Key("code.lineno") -) - -// This document defines semantic conventions for HTTP client and server Spans. -const ( - // HTTP request method. - // - // Type: string - // Required: Always - // Stability: stable - // Examples: 'GET', 'POST', 'HEAD' - HTTPMethodKey = attribute.Key("http.method") - // Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. - // Usually the fragment is not transmitted over HTTP, but if it is known, it - // should be included nevertheless. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' - // Note: `http.url` MUST NOT contain credentials passed via URL in form of - // `https://username:password@www.example.com/`. In such case the attribute's - // value should be `https://www.example.com/`. - HTTPURLKey = attribute.Key("http.url") - // The full request target as passed in a HTTP request line or equivalent. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '/path/12314/?q=ddds#123' - HTTPTargetKey = attribute.Key("http.target") - // The value of the [HTTP host - // header](https://tools.ietf.org/html/rfc7230#section-5.4). An empty Host header - // should also be reported, see note. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'www.example.org' - // Note: When the header is present but empty the attribute SHOULD be set to the - // empty string. Note that this is a valid situation that is expected in certain - // cases, according the aforementioned [section of RFC - // 7230](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is not - // set the attribute MUST NOT be set. - HTTPHostKey = attribute.Key("http.host") - // The URI scheme identifying the used protocol. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'http', 'https' - HTTPSchemeKey = attribute.Key("http.scheme") - // [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). - // - // Type: int - // Required: If and only if one was received/sent. - // Stability: stable - // Examples: 200 - HTTPStatusCodeKey = attribute.Key("http.status_code") - // Kind of HTTP protocol used. - // - // Type: Enum - // Required: No - // Stability: stable - // Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` - // except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. - HTTPFlavorKey = attribute.Key("http.flavor") - // Value of the [HTTP User- - // Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the - // client. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' - HTTPUserAgentKey = attribute.Key("http.user_agent") - // The size of the request payload body in bytes. This is the number of bytes - // transferred excluding headers and is often, but not always, present as the - // [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For - // requests using transport encoding, this should be the compressed size. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 3495 - HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") - // The size of the uncompressed request payload body after transport decoding. Not - // set if transport encoding not used. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 5493 - HTTPRequestContentLengthUncompressedKey = attribute.Key("http.request_content_length_uncompressed") - // The size of the response payload body in bytes. This is the number of bytes - // transferred excluding headers and is often, but not always, present as the - // [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For - // requests using transport encoding, this should be the compressed size. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 3495 - HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") - // The size of the uncompressed response payload body after transport decoding. - // Not set if transport encoding not used. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 5493 - HTTPResponseContentLengthUncompressedKey = attribute.Key("http.response_content_length_uncompressed") - // The ordinal number of request re-sending attempt. - // - // Type: int - // Required: If and only if a request was retried. - // Stability: stable - // Examples: 3 - HTTPRetryCountKey = attribute.Key("http.retry_count") -) - -var ( - // HTTP/1.0 - HTTPFlavorHTTP10 = HTTPFlavorKey.String("1.0") - // HTTP/1.1 - HTTPFlavorHTTP11 = HTTPFlavorKey.String("1.1") - // HTTP/2 - HTTPFlavorHTTP20 = HTTPFlavorKey.String("2.0") - // HTTP/3 - HTTPFlavorHTTP30 = HTTPFlavorKey.String("3.0") - // SPDY protocol - HTTPFlavorSPDY = HTTPFlavorKey.String("SPDY") - // QUIC protocol - HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC") -) - -// Semantic Convention for HTTP Server -const ( - // The primary server name of the matched virtual host. This should be obtained - // via configuration. If no such configuration can be obtained, this attribute - // MUST NOT be set ( `net.host.name` should be used instead). - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'example.com' - // Note: `http.url` is usually not readily available on the server side but would - // have to be assembled in a cumbersome and sometimes lossy process from other - // information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus - // preferred to supply the raw data that is available. - HTTPServerNameKey = attribute.Key("http.server_name") - // The matched route (path template). - // - // Type: string - // Required: No - // Stability: stable - // Examples: '/users/:userID?' - HTTPRouteKey = attribute.Key("http.route") - // The IP address of the original client behind all proxies, if known (e.g. from - // [X-Forwarded-For](https://developer.mozilla.org/en- - // US/docs/Web/HTTP/Headers/X-Forwarded-For)). - // - // Type: string - // Required: No - // Stability: stable - // Examples: '83.164.160.102' - // Note: This is not necessarily the same as `net.peer.ip`, which would - // identify the network-level peer, which may be a proxy. - - // This attribute should be set when a source of information different - // from the one used for `net.peer.ip`, is available even if that other - // source just confirms the same value as `net.peer.ip`. - // Rationale: For `net.peer.ip`, one typically does not know if it - // comes from a proxy, reverse proxy, or the actual client. Setting - // `http.client_ip` when it's the same as `net.peer.ip` means that - // one is at least somewhat confident that the address is not that of - // the closest proxy. - HTTPClientIPKey = attribute.Key("http.client_ip") -) - -// Attributes that exist for multiple DynamoDB request types. -const ( - // The keys in the `RequestItems` object field. - // - // Type: string[] - // Required: No - // Stability: stable - // Examples: 'Users', 'Cats' - AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") - // The JSON-serialized value of each item in the `ConsumedCapacity` response - // field. - // - // Type: string[] - // Required: No - // Stability: stable - // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { "string" : { - // "CapacityUnits": number, "ReadCapacityUnits": number, "WriteCapacityUnits": - // number } }, "LocalSecondaryIndexes": { "string" : { "CapacityUnits": number, - // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }, - // "ReadCapacityUnits": number, "Table": { "CapacityUnits": number, - // "ReadCapacityUnits": number, "WriteCapacityUnits": number }, "TableName": - // "string", "WriteCapacityUnits": number }' - AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") - // The JSON-serialized value of the `ItemCollectionMetrics` response field. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": blob, - // "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { "string" : - // "AttributeValue" }, "N": "string", "NS": [ "string" ], "NULL": boolean, "S": - // "string", "SS": [ "string" ] } }, "SizeEstimateRangeGB": [ number ] } ] }' - AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") - // The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. - // - // Type: double - // Required: No - // Stability: stable - // Examples: 1.0, 2.0 - AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") - // The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. - // - // Type: double - // Required: No - // Stability: stable - // Examples: 1.0, 2.0 - AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") - // The value of the `ConsistentRead` request parameter. - // - // Type: boolean - // Required: No - // Stability: stable - AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") - // The value of the `ProjectionExpression` request parameter. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'Title', 'Title, Price, Color', 'Title, Description, RelatedItems, - // ProductReviews' - AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") - // The value of the `Limit` request parameter. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 10 - AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") - // The value of the `AttributesToGet` request parameter. - // - // Type: string[] - // Required: No - // Stability: stable - // Examples: 'lives', 'id' - AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") - // The value of the `IndexName` request parameter. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'name_to_group' - AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") - // The value of the `Select` request parameter. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'ALL_ATTRIBUTES', 'COUNT' - AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") -) - -// DynamoDB.CreateTable -const ( - // The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request - // field - // - // Type: string[] - // Required: No - // Stability: stable - // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": "string", - // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], - // "ProjectionType": "string" }, "ProvisionedThroughput": { "ReadCapacityUnits": - // number, "WriteCapacityUnits": number } }' - AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") - // The JSON-serialized value of each item of the `LocalSecondaryIndexes` request - // field. - // - // Type: string[] - // Required: No - // Stability: stable - // Examples: '{ "IndexARN": "string", "IndexName": "string", "IndexSizeBytes": - // number, "ItemCount": number, "KeySchema": [ { "AttributeName": "string", - // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], - // "ProjectionType": "string" } }' - AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") -) - -// DynamoDB.ListTables -const ( - // The value of the `ExclusiveStartTableName` request parameter. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'Users', 'CatsTable' - AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - // The number of items in the `TableNames` response parameter. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 20 - AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") -) - -// DynamoDB.Query -const ( - // The value of the `ScanIndexForward` request parameter. - // - // Type: boolean - // Required: No - // Stability: stable - AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") -) - -// DynamoDB.Scan -const ( - // The value of the `Segment` request parameter. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 10 - AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") - // The value of the `TotalSegments` request parameter. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 100 - AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") - // The value of the `Count` response parameter. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 10 - AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") - // The value of the `ScannedCount` response parameter. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 50 - AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") -) - -// DynamoDB.UpdateTable -const ( - // The JSON-serialized value of each item in the `AttributeDefinitions` request - // field. - // - // Type: string[] - // Required: No - // Stability: stable - // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' - AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - // The JSON-serialized value of each item in the `GlobalSecondaryIndexUpdates` - // request field. - // - // Type: string[] - // Required: No - // Stability: stable - // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { - // "AttributeName": "string", "KeyType": "string" } ], "Projection": { - // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, - // "ProvisionedThroughput": { "ReadCapacityUnits": number, "WriteCapacityUnits": - // number } }' - AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") -) - -// This document defines the attributes used in messaging systems. -const ( - // A string identifying the messaging system. - // - // Type: string - // Required: Always - // Stability: stable - // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' - MessagingSystemKey = attribute.Key("messaging.system") - // The message destination name. This might be equal to the span name but is - // required nevertheless. - // - // Type: string - // Required: Always - // Stability: stable - // Examples: 'MyQueue', 'MyTopic' - MessagingDestinationKey = attribute.Key("messaging.destination") - // The kind of message destination - // - // Type: Enum - // Required: Required only if the message destination is either a `queue` or - // `topic`. - // Stability: stable - MessagingDestinationKindKey = attribute.Key("messaging.destination_kind") - // A boolean that is true if the message destination is temporary. - // - // Type: boolean - // Required: If missing, it is assumed to be false. - // Stability: stable - MessagingTempDestinationKey = attribute.Key("messaging.temp_destination") - // The name of the transport protocol. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'AMQP', 'MQTT' - MessagingProtocolKey = attribute.Key("messaging.protocol") - // The version of the transport protocol. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '0.9.1' - MessagingProtocolVersionKey = attribute.Key("messaging.protocol_version") - // Connection string. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'tibjmsnaming://localhost:7222', - // 'https://queue.amazonaws.com/80398EXAMPLE/MyQueue' - MessagingURLKey = attribute.Key("messaging.url") - // A value used by the messaging system as an identifier for the message, - // represented as a string. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '452a7c7c7c7048c2f887f61572b18fc2' - MessagingMessageIDKey = attribute.Key("messaging.message_id") - // The [conversation ID](#conversations) identifying the conversation to which the - // message belongs, represented as a string. Sometimes called "Correlation ID". - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'MyConversationID' - MessagingConversationIDKey = attribute.Key("messaging.conversation_id") - // The (uncompressed) size of the message payload in bytes. Also use this - // attribute if it is unknown whether the compressed or uncompressed payload size - // is reported. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 2738 - MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message_payload_size_bytes") - // The compressed size of the message payload in bytes. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 2048 - MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message_payload_compressed_size_bytes") -) - -var ( - // A message sent to a queue - MessagingDestinationKindQueue = MessagingDestinationKindKey.String("queue") - // A message sent to a topic - MessagingDestinationKindTopic = MessagingDestinationKindKey.String("topic") -) - -// Semantic convention for a consumer of messages received from a messaging system -const ( - // A string identifying the kind of message consumption as defined in the - // [Operation names](#operation-names) section above. If the operation is "send", - // this attribute MUST NOT be set, since the operation can be inferred from the - // span kind in that case. - // - // Type: Enum - // Required: No - // Stability: stable - MessagingOperationKey = attribute.Key("messaging.operation") - // The identifier for the consumer receiving a message. For Kafka, set it to - // `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are - // present, or only `messaging.kafka.consumer_group`. For brokers, such as - // RabbitMQ and Artemis, set it to the `client_id` of the client consuming the - // message. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'mygroup - client-6' - MessagingConsumerIDKey = attribute.Key("messaging.consumer_id") -) - -var ( - // receive - MessagingOperationReceive = MessagingOperationKey.String("receive") - // process - MessagingOperationProcess = MessagingOperationKey.String("process") -) - -// Attributes for RabbitMQ -const ( - // RabbitMQ message routing key. - // - // Type: string - // Required: Unless it is empty. - // Stability: stable - // Examples: 'myKey' - MessagingRabbitmqRoutingKeyKey = attribute.Key("messaging.rabbitmq.routing_key") -) - -// Attributes for Apache Kafka -const ( - // Message keys in Kafka are used for grouping alike messages to ensure they're - // processed on the same partition. They differ from `messaging.message_id` in - // that they're not unique. If the key is `null`, the attribute MUST NOT be set. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'myKey' - // Note: If the key type is not string, it's string representation has to be - // supplied for the attribute. If the key has no unambiguous, canonical string - // form, don't include its value. - MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message_key") - // Name of the Kafka Consumer Group that is handling the message. Only applies to - // consumers, not producers. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'my-group' - MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer_group") - // Client ID for the Consumer or Producer that is handling the message. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'client-5' - MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") - // Partition the message is sent to. - // - // Type: int - // Required: No - // Stability: stable - // Examples: 2 - MessagingKafkaPartitionKey = attribute.Key("messaging.kafka.partition") - // A boolean that is true if the message is a tombstone. - // - // Type: boolean - // Required: If missing, it is assumed to be false. - // Stability: stable - MessagingKafkaTombstoneKey = attribute.Key("messaging.kafka.tombstone") -) - -// Attributes for Apache RocketMQ -const ( - // Namespace of RocketMQ resources, resources in different namespaces are - // individual. - // - // Type: string - // Required: Always - // Stability: stable - // Examples: 'myNamespace' - MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") - // Name of the RocketMQ producer/consumer group that is handling the message. The - // client type is identified by the SpanKind. - // - // Type: string - // Required: Always - // Stability: stable - // Examples: 'myConsumerGroup' - MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") - // The unique identifier for each client. - // - // Type: string - // Required: Always - // Stability: stable - // Examples: 'myhost@8742@s8083jm' - MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") - // Type of message. - // - // Type: Enum - // Required: No - // Stability: stable - MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message_type") - // The secondary classifier of message besides topic. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'tagA' - MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message_tag") - // Key(s) of message, another way to mark message besides message id. - // - // Type: string[] - // Required: No - // Stability: stable - // Examples: 'keyA', 'keyB' - MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message_keys") - // Model of message consumption. This only applies to consumer spans. - // - // Type: Enum - // Required: No - // Stability: stable - MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") -) - -var ( - // Normal message - MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") - // FIFO message - MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") - // Delay message - MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") - // Transaction message - MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") -) - -var ( - // Clustering consumption model - MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") - // Broadcasting consumption model - MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") -) - -// This document defines semantic conventions for remote procedure calls. -const ( - // A string identifying the remoting system. See below for a list of well-known - // identifiers. - // - // Type: Enum - // Required: Always - // Stability: stable - RPCSystemKey = attribute.Key("rpc.system") - // The full (logical) name of the service being called, including its package - // name, if applicable. - // - // Type: string - // Required: No, but recommended - // Stability: stable - // Examples: 'myservice.EchoService' - // Note: This is the logical name of the service from the RPC interface - // perspective, which can be different from the name of any implementing class. - // The `code.namespace` attribute may be used to store the latter (despite the - // attribute name, it may include a class name; e.g., class with method actually - // executing the call on the server side, RPC client stub class on the client - // side). - RPCServiceKey = attribute.Key("rpc.service") - // The name of the (logical) method being called, must be equal to the $method - // part in the span name. - // - // Type: string - // Required: No, but recommended - // Stability: stable - // Examples: 'exampleMethod' - // Note: This is the logical name of the method from the RPC interface - // perspective, which can be different from the name of any implementing - // method/function. The `code.function` attribute may be used to store the latter - // (e.g., method actually executing the call on the server side, RPC client stub - // method on the client side). - RPCMethodKey = attribute.Key("rpc.method") -) - -var ( - // gRPC - RPCSystemGRPC = RPCSystemKey.String("grpc") - // Java RMI - RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") - // .NET WCF - RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") - // Apache Dubbo - RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") -) - -// Tech-specific attributes for gRPC. -const ( - // The [numeric status - // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC - // request. - // - // Type: Enum - // Required: Always - // Stability: stable - RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") -) - -var ( - // OK - RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) - // CANCELLED - RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) - // UNKNOWN - RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) - // INVALID_ARGUMENT - RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) - // DEADLINE_EXCEEDED - RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) - // NOT_FOUND - RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) - // ALREADY_EXISTS - RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) - // PERMISSION_DENIED - RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) - // RESOURCE_EXHAUSTED - RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) - // FAILED_PRECONDITION - RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) - // ABORTED - RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) - // OUT_OF_RANGE - RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) - // UNIMPLEMENTED - RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) - // INTERNAL - RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) - // UNAVAILABLE - RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) - // DATA_LOSS - RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) - // UNAUTHENTICATED - RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) -) - -// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). -const ( - // Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC - // 1.0 does not specify this, the value can be omitted. - // - // Type: string - // Required: If missing, it is assumed to be "1.0". - // Stability: stable - // Examples: '2.0', '1.0' - RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") - // `id` property of request or response. Since protocol allows id to be int, - // string, `null` or missing (for notifications), value is expected to be cast to - // string for simplicity. Use empty string in case of `null` value. Omit entirely - // if this is a notification. - // - // Type: string - // Required: No - // Stability: stable - // Examples: '10', 'request-7', '' - RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") - // `error.code` property of response if it is an error response. - // - // Type: int - // Required: If missing, response is assumed to be successful. - // Stability: stable - // Examples: -32700, 100 - RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") - // `error.message` property of response if it is an error response. - // - // Type: string - // Required: No - // Stability: stable - // Examples: 'Parse error', 'User already exists' - RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") -) - -// RPC received/sent message. -const ( - // Whether this is a received or sent message. - // - // Type: Enum - // Required: No - // Stability: stable - MessageTypeKey = attribute.Key("message.type") - // MUST be calculated as two different counters starting from `1` one for sent - // messages and one for received message. - // - // Type: int - // Required: No - // Stability: stable - // Note: This way we guarantee that the values will be consistent between - // different implementations. - MessageIDKey = attribute.Key("message.id") - // Compressed size of the message in bytes. - // - // Type: int - // Required: No - // Stability: stable - MessageCompressedSizeKey = attribute.Key("message.compressed_size") - // Uncompressed size of the message in bytes. - // - // Type: int - // Required: No - // Stability: stable - MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") -) - -var ( - // sent - MessageTypeSent = MessageTypeKey.String("SENT") - // received - MessageTypeReceived = MessageTypeKey.String("RECEIVED") -) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/README.md b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/README.md deleted file mode 100644 index 87b842c5d1..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Semconv v1.17.0 - -[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/semconv/v1.17.0)](https://pkg.go.dev/go.opentelemetry.io/otel/semconv/v1.17.0) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/doc.go deleted file mode 100644 index e087c9c04d..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Package semconv implements OpenTelemetry semantic conventions. -// -// OpenTelemetry semantic conventions are agreed standardized naming -// patterns for OpenTelemetry things. This package represents the conventions -// as of the v1.17.0 version of the OpenTelemetry specification. -package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/event.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/event.go deleted file mode 100644 index c7b804bbe2..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/event.go +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Code generated from semantic convention specification. DO NOT EDIT. - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" - -import "go.opentelemetry.io/otel/attribute" - -// This semantic convention defines the attributes used to represent a feature -// flag evaluation as an event. -const ( - // FeatureFlagKeyKey is the attribute Key conforming to the - // "feature_flag.key" semantic conventions. It represents the unique - // identifier of the feature flag. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'logo-color' - FeatureFlagKeyKey = attribute.Key("feature_flag.key") - - // FeatureFlagProviderNameKey is the attribute Key conforming to the - // "feature_flag.provider_name" semantic conventions. It represents the - // name of the service provider that performs the flag evaluation. - // - // Type: string - // RequirementLevel: Recommended - // Stability: stable - // Examples: 'Flag Manager' - FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider_name") - - // FeatureFlagVariantKey is the attribute Key conforming to the - // "feature_flag.variant" semantic conventions. It represents the sHOULD be - // a semantic identifier for a value. If one is unavailable, a stringified - // version of the value can be used. - // - // Type: string - // RequirementLevel: Recommended - // Stability: stable - // Examples: 'red', 'true', 'on' - // Note: A semantic identifier, commonly referred to as a variant, provides - // a means - // for referring to a value without including the value itself. This can - // provide additional context for understanding the meaning behind a value. - // For example, the variant `red` maybe be used for the value `#c05543`. - // - // A stringified version of the value can be used in situations where a - // semantic identifier is unavailable. String representation of the value - // should be determined by the implementer. - FeatureFlagVariantKey = attribute.Key("feature_flag.variant") -) - -// FeatureFlagKey returns an attribute KeyValue conforming to the -// "feature_flag.key" semantic conventions. It represents the unique identifier -// of the feature flag. -func FeatureFlagKey(val string) attribute.KeyValue { - return FeatureFlagKeyKey.String(val) -} - -// FeatureFlagProviderName returns an attribute KeyValue conforming to the -// "feature_flag.provider_name" semantic conventions. It represents the name of -// the service provider that performs the flag evaluation. -func FeatureFlagProviderName(val string) attribute.KeyValue { - return FeatureFlagProviderNameKey.String(val) -} - -// FeatureFlagVariant returns an attribute KeyValue conforming to the -// "feature_flag.variant" semantic conventions. It represents the sHOULD be a -// semantic identifier for a value. If one is unavailable, a stringified -// version of the value can be used. -func FeatureFlagVariant(val string) attribute.KeyValue { - return FeatureFlagVariantKey.String(val) -} - -// RPC received/sent message. -const ( - // MessageTypeKey is the attribute Key conforming to the "message.type" - // semantic conventions. It represents the whether this is a received or - // sent message. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - MessageTypeKey = attribute.Key("message.type") - - // MessageIDKey is the attribute Key conforming to the "message.id" - // semantic conventions. It represents the mUST be calculated as two - // different counters starting from `1` one for sent messages and one for - // received message. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Note: This way we guarantee that the values will be consistent between - // different implementations. - MessageIDKey = attribute.Key("message.id") - - // MessageCompressedSizeKey is the attribute Key conforming to the - // "message.compressed_size" semantic conventions. It represents the - // compressed size of the message in bytes. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - MessageCompressedSizeKey = attribute.Key("message.compressed_size") - - // MessageUncompressedSizeKey is the attribute Key conforming to the - // "message.uncompressed_size" semantic conventions. It represents the - // uncompressed size of the message in bytes. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") -) - -var ( - // sent - MessageTypeSent = MessageTypeKey.String("SENT") - // received - MessageTypeReceived = MessageTypeKey.String("RECEIVED") -) - -// MessageID returns an attribute KeyValue conforming to the "message.id" -// semantic conventions. It represents the mUST be calculated as two different -// counters starting from `1` one for sent messages and one for received -// message. -func MessageID(val int) attribute.KeyValue { - return MessageIDKey.Int(val) -} - -// MessageCompressedSize returns an attribute KeyValue conforming to the -// "message.compressed_size" semantic conventions. It represents the compressed -// size of the message in bytes. -func MessageCompressedSize(val int) attribute.KeyValue { - return MessageCompressedSizeKey.Int(val) -} - -// MessageUncompressedSize returns an attribute KeyValue conforming to the -// "message.uncompressed_size" semantic conventions. It represents the -// uncompressed size of the message in bytes. -func MessageUncompressedSize(val int) attribute.KeyValue { - return MessageUncompressedSizeKey.Int(val) -} - -// The attributes used to report a single exception associated with a span. -const ( - // ExceptionEscapedKey is the attribute Key conforming to the - // "exception.escaped" semantic conventions. It represents the sHOULD be - // set to true if the exception event is recorded at a point where it is - // known that the exception is escaping the scope of the span. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - // Note: An exception is considered to have escaped (or left) the scope of - // a span, - // if that span is ended while the exception is still logically "in - // flight". - // This may be actually "in flight" in some languages (e.g. if the - // exception - // is passed to a Context manager's `__exit__` method in Python) but will - // usually be caught at the point of recording the exception in most - // languages. - // - // It is usually not possible to determine at the point where an exception - // is thrown - // whether it will escape the scope of a span. - // However, it is trivial to know that an exception - // will escape, if one checks for an active exception just before ending - // the span, - // as done in the [example above](#recording-an-exception). - // - // It follows that an exception may still escape the scope of the span - // even if the `exception.escaped` attribute was not set or set to false, - // since the event might have been recorded at a time where it was not - // clear whether the exception will escape. - ExceptionEscapedKey = attribute.Key("exception.escaped") -) - -// ExceptionEscaped returns an attribute KeyValue conforming to the -// "exception.escaped" semantic conventions. It represents the sHOULD be set to -// true if the exception event is recorded at a point where it is known that -// the exception is escaping the scope of the span. -func ExceptionEscaped(val bool) attribute.KeyValue { - return ExceptionEscapedKey.Bool(val) -} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/exception.go deleted file mode 100644 index 137acc67de..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/exception.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" - -const ( - // ExceptionEventName is the name of the Span event representing an exception. - ExceptionEventName = "exception" -) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/http.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/http.go deleted file mode 100644 index d318221e59..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/http.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" - -// HTTP scheme attributes. -var ( - HTTPSchemeHTTP = HTTPSchemeKey.String("http") - HTTPSchemeHTTPS = HTTPSchemeKey.String("https") -) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/resource.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/resource.go deleted file mode 100644 index 7e365e82ce..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/resource.go +++ /dev/null @@ -1,1999 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Code generated from semantic convention specification. DO NOT EDIT. - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" - -import "go.opentelemetry.io/otel/attribute" - -// The web browser in which the application represented by the resource is -// running. The `browser.*` attributes MUST be used only for resources that -// represent applications running in a web browser (regardless of whether -// running on a mobile or desktop device). -const ( - // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" - // semantic conventions. It represents the array of brand name and version - // separated by a space - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' - // Note: This value is intended to be taken from the [UA client hints - // API](https://wicg.github.io/ua-client-hints/#interface) - // (`navigator.userAgentData.brands`). - BrowserBrandsKey = attribute.Key("browser.brands") - - // BrowserPlatformKey is the attribute Key conforming to the - // "browser.platform" semantic conventions. It represents the platform on - // which the browser is running - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Windows', 'macOS', 'Android' - // Note: This value is intended to be taken from the [UA client hints - // API](https://wicg.github.io/ua-client-hints/#interface) - // (`navigator.userAgentData.platform`). If unavailable, the legacy - // `navigator.platform` API SHOULD NOT be used instead and this attribute - // SHOULD be left unset in order for the values to be consistent. - // The list of possible values is defined in the [W3C User-Agent Client - // Hints - // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). - // Note that some (but not all) of these values can overlap with values in - // the [`os.type` and `os.name` attributes](./os.md). However, for - // consistency, the values in the `browser.platform` attribute should - // capture the exact value that the user agent provides. - BrowserPlatformKey = attribute.Key("browser.platform") - - // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" - // semantic conventions. It represents a boolean that is true if the - // browser is running on a mobile device - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - // Note: This value is intended to be taken from the [UA client hints - // API](https://wicg.github.io/ua-client-hints/#interface) - // (`navigator.userAgentData.mobile`). If unavailable, this attribute - // SHOULD be left unset. - BrowserMobileKey = attribute.Key("browser.mobile") - - // BrowserUserAgentKey is the attribute Key conforming to the - // "browser.user_agent" semantic conventions. It represents the full - // user-agent string provided by the browser - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) - // AppleWebKit/537.36 (KHTML, ' - // 'like Gecko) Chrome/95.0.4638.54 Safari/537.36' - // Note: The user-agent value SHOULD be provided only from browsers that do - // not have a mechanism to retrieve brands and platform individually from - // the User-Agent Client Hints API. To retrieve the value, the legacy - // `navigator.userAgent` API can be used. - BrowserUserAgentKey = attribute.Key("browser.user_agent") - - // BrowserLanguageKey is the attribute Key conforming to the - // "browser.language" semantic conventions. It represents the preferred - // language of the user using the browser - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'en', 'en-US', 'fr', 'fr-FR' - // Note: This value is intended to be taken from the Navigator API - // `navigator.language`. - BrowserLanguageKey = attribute.Key("browser.language") -) - -// BrowserBrands returns an attribute KeyValue conforming to the -// "browser.brands" semantic conventions. It represents the array of brand name -// and version separated by a space -func BrowserBrands(val ...string) attribute.KeyValue { - return BrowserBrandsKey.StringSlice(val) -} - -// BrowserPlatform returns an attribute KeyValue conforming to the -// "browser.platform" semantic conventions. It represents the platform on which -// the browser is running -func BrowserPlatform(val string) attribute.KeyValue { - return BrowserPlatformKey.String(val) -} - -// BrowserMobile returns an attribute KeyValue conforming to the -// "browser.mobile" semantic conventions. It represents a boolean that is true -// if the browser is running on a mobile device -func BrowserMobile(val bool) attribute.KeyValue { - return BrowserMobileKey.Bool(val) -} - -// BrowserUserAgent returns an attribute KeyValue conforming to the -// "browser.user_agent" semantic conventions. It represents the full user-agent -// string provided by the browser -func BrowserUserAgent(val string) attribute.KeyValue { - return BrowserUserAgentKey.String(val) -} - -// BrowserLanguage returns an attribute KeyValue conforming to the -// "browser.language" semantic conventions. It represents the preferred -// language of the user using the browser -func BrowserLanguage(val string) attribute.KeyValue { - return BrowserLanguageKey.String(val) -} - -// A cloud environment (e.g. GCP, Azure, AWS) -const ( - // CloudProviderKey is the attribute Key conforming to the "cloud.provider" - // semantic conventions. It represents the name of the cloud provider. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - CloudProviderKey = attribute.Key("cloud.provider") - - // CloudAccountIDKey is the attribute Key conforming to the - // "cloud.account.id" semantic conventions. It represents the cloud account - // ID the resource is assigned to. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '111111111111', 'opentelemetry' - CloudAccountIDKey = attribute.Key("cloud.account.id") - - // CloudRegionKey is the attribute Key conforming to the "cloud.region" - // semantic conventions. It represents the geographical region the resource - // is running. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'us-central1', 'us-east-1' - // Note: Refer to your provider's docs to see the available regions, for - // example [Alibaba Cloud - // regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS - // regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), - // [Azure - // regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), - // [Google Cloud regions](https://cloud.google.com/about/locations), or - // [Tencent Cloud - // regions](https://intl.cloud.tencent.com/document/product/213/6091). - CloudRegionKey = attribute.Key("cloud.region") - - // CloudAvailabilityZoneKey is the attribute Key conforming to the - // "cloud.availability_zone" semantic conventions. It represents the cloud - // regions often have multiple, isolated locations known as zones to - // increase availability. Availability zone represents the zone where the - // resource is running. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'us-east-1c' - // Note: Availability zones are called "zones" on Alibaba Cloud and Google - // Cloud. - CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") - - // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" - // semantic conventions. It represents the cloud platform in use. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Note: The prefix of the service SHOULD match the one specified in - // `cloud.provider`. - CloudPlatformKey = attribute.Key("cloud.platform") -) - -var ( - // Alibaba Cloud - CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") - // Amazon Web Services - CloudProviderAWS = CloudProviderKey.String("aws") - // Microsoft Azure - CloudProviderAzure = CloudProviderKey.String("azure") - // Google Cloud Platform - CloudProviderGCP = CloudProviderKey.String("gcp") - // IBM Cloud - CloudProviderIbmCloud = CloudProviderKey.String("ibm_cloud") - // Tencent Cloud - CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") -) - -var ( - // Alibaba Cloud Elastic Compute Service - CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") - // Alibaba Cloud Function Compute - CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") - // Red Hat OpenShift on Alibaba Cloud - CloudPlatformAlibabaCloudOpenshift = CloudPlatformKey.String("alibaba_cloud_openshift") - // AWS Elastic Compute Cloud - CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") - // AWS Elastic Container Service - CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") - // AWS Elastic Kubernetes Service - CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") - // AWS Lambda - CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") - // AWS Elastic Beanstalk - CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") - // AWS App Runner - CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") - // Red Hat OpenShift on AWS (ROSA) - CloudPlatformAWSOpenshift = CloudPlatformKey.String("aws_openshift") - // Azure Virtual Machines - CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") - // Azure Container Instances - CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") - // Azure Kubernetes Service - CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") - // Azure Functions - CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") - // Azure App Service - CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") - // Azure Red Hat OpenShift - CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") - // Google Cloud Compute Engine (GCE) - CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") - // Google Cloud Run - CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") - // Google Cloud Kubernetes Engine (GKE) - CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") - // Google Cloud Functions (GCF) - CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") - // Google Cloud App Engine (GAE) - CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") - // Red Hat OpenShift on Google Cloud - CloudPlatformGoogleCloudOpenshift = CloudPlatformKey.String("google_cloud_openshift") - // Red Hat OpenShift on IBM Cloud - CloudPlatformIbmCloudOpenshift = CloudPlatformKey.String("ibm_cloud_openshift") - // Tencent Cloud Cloud Virtual Machine (CVM) - CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") - // Tencent Cloud Elastic Kubernetes Service (EKS) - CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") - // Tencent Cloud Serverless Cloud Function (SCF) - CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") -) - -// CloudAccountID returns an attribute KeyValue conforming to the -// "cloud.account.id" semantic conventions. It represents the cloud account ID -// the resource is assigned to. -func CloudAccountID(val string) attribute.KeyValue { - return CloudAccountIDKey.String(val) -} - -// CloudRegion returns an attribute KeyValue conforming to the -// "cloud.region" semantic conventions. It represents the geographical region -// the resource is running. -func CloudRegion(val string) attribute.KeyValue { - return CloudRegionKey.String(val) -} - -// CloudAvailabilityZone returns an attribute KeyValue conforming to the -// "cloud.availability_zone" semantic conventions. It represents the cloud -// regions often have multiple, isolated locations known as zones to increase -// availability. Availability zone represents the zone where the resource is -// running. -func CloudAvailabilityZone(val string) attribute.KeyValue { - return CloudAvailabilityZoneKey.String(val) -} - -// Resources used by AWS Elastic Container Service (ECS). -const ( - // AWSECSContainerARNKey is the attribute Key conforming to the - // "aws.ecs.container.arn" semantic conventions. It represents the Amazon - // Resource Name (ARN) of an [ECS container - // instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: - // 'arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' - AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") - - // AWSECSClusterARNKey is the attribute Key conforming to the - // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an - // [ECS - // cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' - AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") - - // AWSECSLaunchtypeKey is the attribute Key conforming to the - // "aws.ecs.launchtype" semantic conventions. It represents the [launch - // type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) - // for an ECS task. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") - - // AWSECSTaskARNKey is the attribute Key conforming to the - // "aws.ecs.task.arn" semantic conventions. It represents the ARN of an - // [ECS task - // definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: - // 'arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' - AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") - - // AWSECSTaskFamilyKey is the attribute Key conforming to the - // "aws.ecs.task.family" semantic conventions. It represents the task - // definition family this task definition is a member of. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry-family' - AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") - - // AWSECSTaskRevisionKey is the attribute Key conforming to the - // "aws.ecs.task.revision" semantic conventions. It represents the revision - // for this task definition. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '8', '26' - AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") -) - -var ( - // ec2 - AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") - // fargate - AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") -) - -// AWSECSContainerARN returns an attribute KeyValue conforming to the -// "aws.ecs.container.arn" semantic conventions. It represents the Amazon -// Resource Name (ARN) of an [ECS container -// instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). -func AWSECSContainerARN(val string) attribute.KeyValue { - return AWSECSContainerARNKey.String(val) -} - -// AWSECSClusterARN returns an attribute KeyValue conforming to the -// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an [ECS -// cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). -func AWSECSClusterARN(val string) attribute.KeyValue { - return AWSECSClusterARNKey.String(val) -} - -// AWSECSTaskARN returns an attribute KeyValue conforming to the -// "aws.ecs.task.arn" semantic conventions. It represents the ARN of an [ECS -// task -// definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). -func AWSECSTaskARN(val string) attribute.KeyValue { - return AWSECSTaskARNKey.String(val) -} - -// AWSECSTaskFamily returns an attribute KeyValue conforming to the -// "aws.ecs.task.family" semantic conventions. It represents the task -// definition family this task definition is a member of. -func AWSECSTaskFamily(val string) attribute.KeyValue { - return AWSECSTaskFamilyKey.String(val) -} - -// AWSECSTaskRevision returns an attribute KeyValue conforming to the -// "aws.ecs.task.revision" semantic conventions. It represents the revision for -// this task definition. -func AWSECSTaskRevision(val string) attribute.KeyValue { - return AWSECSTaskRevisionKey.String(val) -} - -// Resources used by AWS Elastic Kubernetes Service (EKS). -const ( - // AWSEKSClusterARNKey is the attribute Key conforming to the - // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an - // EKS cluster. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' - AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") -) - -// AWSEKSClusterARN returns an attribute KeyValue conforming to the -// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS -// cluster. -func AWSEKSClusterARN(val string) attribute.KeyValue { - return AWSEKSClusterARNKey.String(val) -} - -// Resources specific to Amazon Web Services. -const ( - // AWSLogGroupNamesKey is the attribute Key conforming to the - // "aws.log.group.names" semantic conventions. It represents the name(s) of - // the AWS log group(s) an application is writing to. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: '/aws/lambda/my-function', 'opentelemetry-service' - // Note: Multiple log groups must be supported for cases like - // multi-container applications, where a single application has sidecar - // containers, and each write to their own log group. - AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") - - // AWSLogGroupARNsKey is the attribute Key conforming to the - // "aws.log.group.arns" semantic conventions. It represents the Amazon - // Resource Name(s) (ARN) of the AWS log group(s). - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: - // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' - // Note: See the [log group ARN format - // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). - AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") - - // AWSLogStreamNamesKey is the attribute Key conforming to the - // "aws.log.stream.names" semantic conventions. It represents the name(s) - // of the AWS log stream(s) an application is writing to. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' - AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") - - // AWSLogStreamARNsKey is the attribute Key conforming to the - // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of - // the AWS log stream(s). - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: - // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' - // Note: See the [log stream ARN format - // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). - // One log group can contain several log streams, so these ARNs necessarily - // identify both a log group and a log stream. - AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") -) - -// AWSLogGroupNames returns an attribute KeyValue conforming to the -// "aws.log.group.names" semantic conventions. It represents the name(s) of the -// AWS log group(s) an application is writing to. -func AWSLogGroupNames(val ...string) attribute.KeyValue { - return AWSLogGroupNamesKey.StringSlice(val) -} - -// AWSLogGroupARNs returns an attribute KeyValue conforming to the -// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource -// Name(s) (ARN) of the AWS log group(s). -func AWSLogGroupARNs(val ...string) attribute.KeyValue { - return AWSLogGroupARNsKey.StringSlice(val) -} - -// AWSLogStreamNames returns an attribute KeyValue conforming to the -// "aws.log.stream.names" semantic conventions. It represents the name(s) of -// the AWS log stream(s) an application is writing to. -func AWSLogStreamNames(val ...string) attribute.KeyValue { - return AWSLogStreamNamesKey.StringSlice(val) -} - -// AWSLogStreamARNs returns an attribute KeyValue conforming to the -// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the -// AWS log stream(s). -func AWSLogStreamARNs(val ...string) attribute.KeyValue { - return AWSLogStreamARNsKey.StringSlice(val) -} - -// A container instance. -const ( - // ContainerNameKey is the attribute Key conforming to the "container.name" - // semantic conventions. It represents the container name used by container - // runtime. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry-autoconf' - ContainerNameKey = attribute.Key("container.name") - - // ContainerIDKey is the attribute Key conforming to the "container.id" - // semantic conventions. It represents the container ID. Usually a UUID, as - // for example used to [identify Docker - // containers](https://docs.docker.com/engine/reference/run/#container-identification). - // The UUID might be abbreviated. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'a3bf90e006b2' - ContainerIDKey = attribute.Key("container.id") - - // ContainerRuntimeKey is the attribute Key conforming to the - // "container.runtime" semantic conventions. It represents the container - // runtime managing this container. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'docker', 'containerd', 'rkt' - ContainerRuntimeKey = attribute.Key("container.runtime") - - // ContainerImageNameKey is the attribute Key conforming to the - // "container.image.name" semantic conventions. It represents the name of - // the image the container was built on. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'gcr.io/opentelemetry/operator' - ContainerImageNameKey = attribute.Key("container.image.name") - - // ContainerImageTagKey is the attribute Key conforming to the - // "container.image.tag" semantic conventions. It represents the container - // image tag. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '0.1' - ContainerImageTagKey = attribute.Key("container.image.tag") -) - -// ContainerName returns an attribute KeyValue conforming to the -// "container.name" semantic conventions. It represents the container name used -// by container runtime. -func ContainerName(val string) attribute.KeyValue { - return ContainerNameKey.String(val) -} - -// ContainerID returns an attribute KeyValue conforming to the -// "container.id" semantic conventions. It represents the container ID. Usually -// a UUID, as for example used to [identify Docker -// containers](https://docs.docker.com/engine/reference/run/#container-identification). -// The UUID might be abbreviated. -func ContainerID(val string) attribute.KeyValue { - return ContainerIDKey.String(val) -} - -// ContainerRuntime returns an attribute KeyValue conforming to the -// "container.runtime" semantic conventions. It represents the container -// runtime managing this container. -func ContainerRuntime(val string) attribute.KeyValue { - return ContainerRuntimeKey.String(val) -} - -// ContainerImageName returns an attribute KeyValue conforming to the -// "container.image.name" semantic conventions. It represents the name of the -// image the container was built on. -func ContainerImageName(val string) attribute.KeyValue { - return ContainerImageNameKey.String(val) -} - -// ContainerImageTag returns an attribute KeyValue conforming to the -// "container.image.tag" semantic conventions. It represents the container -// image tag. -func ContainerImageTag(val string) attribute.KeyValue { - return ContainerImageTagKey.String(val) -} - -// The software deployment. -const ( - // DeploymentEnvironmentKey is the attribute Key conforming to the - // "deployment.environment" semantic conventions. It represents the name of - // the [deployment - // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka - // deployment tier). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'staging', 'production' - DeploymentEnvironmentKey = attribute.Key("deployment.environment") -) - -// DeploymentEnvironment returns an attribute KeyValue conforming to the -// "deployment.environment" semantic conventions. It represents the name of the -// [deployment -// environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka -// deployment tier). -func DeploymentEnvironment(val string) attribute.KeyValue { - return DeploymentEnvironmentKey.String(val) -} - -// The device on which the process represented by this resource is running. -const ( - // DeviceIDKey is the attribute Key conforming to the "device.id" semantic - // conventions. It represents a unique identifier representing the device - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' - // Note: The device identifier MUST only be defined using the values - // outlined below. This value is not an advertising identifier and MUST NOT - // be used as such. On iOS (Swift or Objective-C), this value MUST be equal - // to the [vendor - // identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). - // On Android (Java or Kotlin), this value MUST be equal to the Firebase - // Installation ID or a globally unique UUID which is persisted across - // sessions in your application. More information can be found - // [here](https://developer.android.com/training/articles/user-data-ids) on - // best practices and exact implementation details. Caution should be taken - // when storing personal data or anything which can identify a user. GDPR - // and data protection laws may apply, ensure you do your own due - // diligence. - DeviceIDKey = attribute.Key("device.id") - - // DeviceModelIdentifierKey is the attribute Key conforming to the - // "device.model.identifier" semantic conventions. It represents the model - // identifier for the device - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'iPhone3,4', 'SM-G920F' - // Note: It's recommended this value represents a machine readable version - // of the model identifier rather than the market or consumer-friendly name - // of the device. - DeviceModelIdentifierKey = attribute.Key("device.model.identifier") - - // DeviceModelNameKey is the attribute Key conforming to the - // "device.model.name" semantic conventions. It represents the marketing - // name for the device model - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' - // Note: It's recommended this value represents a human readable version of - // the device model rather than a machine readable alternative. - DeviceModelNameKey = attribute.Key("device.model.name") - - // DeviceManufacturerKey is the attribute Key conforming to the - // "device.manufacturer" semantic conventions. It represents the name of - // the device manufacturer - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Apple', 'Samsung' - // Note: The Android OS provides this field via - // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). - // iOS apps SHOULD hardcode the value `Apple`. - DeviceManufacturerKey = attribute.Key("device.manufacturer") -) - -// DeviceID returns an attribute KeyValue conforming to the "device.id" -// semantic conventions. It represents a unique identifier representing the -// device -func DeviceID(val string) attribute.KeyValue { - return DeviceIDKey.String(val) -} - -// DeviceModelIdentifier returns an attribute KeyValue conforming to the -// "device.model.identifier" semantic conventions. It represents the model -// identifier for the device -func DeviceModelIdentifier(val string) attribute.KeyValue { - return DeviceModelIdentifierKey.String(val) -} - -// DeviceModelName returns an attribute KeyValue conforming to the -// "device.model.name" semantic conventions. It represents the marketing name -// for the device model -func DeviceModelName(val string) attribute.KeyValue { - return DeviceModelNameKey.String(val) -} - -// DeviceManufacturer returns an attribute KeyValue conforming to the -// "device.manufacturer" semantic conventions. It represents the name of the -// device manufacturer -func DeviceManufacturer(val string) attribute.KeyValue { - return DeviceManufacturerKey.String(val) -} - -// A serverless instance. -const ( - // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic - // conventions. It represents the name of the single function that this - // runtime instance executes. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'my-function', 'myazurefunctionapp/some-function-name' - // Note: This is the name of the function as configured/deployed on the - // FaaS - // platform and is usually different from the name of the callback - // function (which may be stored in the - // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span-general.md#source-code-attributes) - // span attributes). - // - // For some cloud providers, the above definition is ambiguous. The - // following - // definition of function name MUST be used for this attribute - // (and consequently the span name) for the listed cloud - // providers/products: - // - // * **Azure:** The full name `/`, i.e., function app name - // followed by a forward slash followed by the function name (this form - // can also be seen in the resource JSON for the function). - // This means that a span attribute MUST be used, as an Azure function - // app can host multiple functions that would usually share - // a TracerProvider (see also the `faas.id` attribute). - FaaSNameKey = attribute.Key("faas.name") - - // FaaSIDKey is the attribute Key conforming to the "faas.id" semantic - // conventions. It represents the unique ID of the single function that - // this runtime instance executes. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'arn:aws:lambda:us-west-2:123456789012:function:my-function' - // Note: On some cloud providers, it may not be possible to determine the - // full ID at startup, - // so consider setting `faas.id` as a span attribute instead. - // - // The exact value to use for `faas.id` depends on the cloud provider: - // - // * **AWS Lambda:** The function - // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). - // Take care not to use the "invoked ARN" directly but replace any - // [alias - // suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) - // with the resolved function version, as the same runtime instance may - // be invokable with - // multiple different aliases. - // * **GCP:** The [URI of the - // resource](https://cloud.google.com/iam/docs/full-resource-names) - // * **Azure:** The [Fully Qualified Resource - // ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) - // of the invoked function, - // *not* the function app, having the form - // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. - // This means that a span attribute MUST be used, as an Azure function - // app can host multiple functions that would usually share - // a TracerProvider. - FaaSIDKey = attribute.Key("faas.id") - - // FaaSVersionKey is the attribute Key conforming to the "faas.version" - // semantic conventions. It represents the immutable version of the - // function being executed. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '26', 'pinkfroid-00002' - // Note: Depending on the cloud provider and platform, use: - // - // * **AWS Lambda:** The [function - // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) - // (an integer represented as a decimal string). - // * **Google Cloud Run:** The - // [revision](https://cloud.google.com/run/docs/managing/revisions) - // (i.e., the function name plus the revision suffix). - // * **Google Cloud Functions:** The value of the - // [`K_REVISION` environment - // variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). - // * **Azure Functions:** Not applicable. Do not set this attribute. - FaaSVersionKey = attribute.Key("faas.version") - - // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" - // semantic conventions. It represents the execution environment ID as a - // string, that will be potentially reused for other invocations to the - // same function/function version. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' - // Note: * **AWS Lambda:** Use the (full) log stream name. - FaaSInstanceKey = attribute.Key("faas.instance") - - // FaaSMaxMemoryKey is the attribute Key conforming to the - // "faas.max_memory" semantic conventions. It represents the amount of - // memory available to the serverless function in MiB. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 128 - // Note: It's recommended to set this attribute since e.g. too little - // memory can easily stop a Java AWS Lambda function from working - // correctly. On AWS Lambda, the environment variable - // `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information. - FaaSMaxMemoryKey = attribute.Key("faas.max_memory") -) - -// FaaSName returns an attribute KeyValue conforming to the "faas.name" -// semantic conventions. It represents the name of the single function that -// this runtime instance executes. -func FaaSName(val string) attribute.KeyValue { - return FaaSNameKey.String(val) -} - -// FaaSID returns an attribute KeyValue conforming to the "faas.id" semantic -// conventions. It represents the unique ID of the single function that this -// runtime instance executes. -func FaaSID(val string) attribute.KeyValue { - return FaaSIDKey.String(val) -} - -// FaaSVersion returns an attribute KeyValue conforming to the -// "faas.version" semantic conventions. It represents the immutable version of -// the function being executed. -func FaaSVersion(val string) attribute.KeyValue { - return FaaSVersionKey.String(val) -} - -// FaaSInstance returns an attribute KeyValue conforming to the -// "faas.instance" semantic conventions. It represents the execution -// environment ID as a string, that will be potentially reused for other -// invocations to the same function/function version. -func FaaSInstance(val string) attribute.KeyValue { - return FaaSInstanceKey.String(val) -} - -// FaaSMaxMemory returns an attribute KeyValue conforming to the -// "faas.max_memory" semantic conventions. It represents the amount of memory -// available to the serverless function in MiB. -func FaaSMaxMemory(val int) attribute.KeyValue { - return FaaSMaxMemoryKey.Int(val) -} - -// A host is defined as a general computing instance. -const ( - // HostIDKey is the attribute Key conforming to the "host.id" semantic - // conventions. It represents the unique host ID. For Cloud, this must be - // the instance_id assigned by the cloud provider. For non-containerized - // Linux systems, the `machine-id` located in `/etc/machine-id` or - // `/var/lib/dbus/machine-id` may be used. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'fdbf79e8af94cb7f9e8df36789187052' - HostIDKey = attribute.Key("host.id") - - // HostNameKey is the attribute Key conforming to the "host.name" semantic - // conventions. It represents the name of the host. On Unix systems, it may - // contain what the hostname command returns, or the fully qualified - // hostname, or another name specified by the user. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry-test' - HostNameKey = attribute.Key("host.name") - - // HostTypeKey is the attribute Key conforming to the "host.type" semantic - // conventions. It represents the type of host. For Cloud, this must be the - // machine type. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'n1-standard-1' - HostTypeKey = attribute.Key("host.type") - - // HostArchKey is the attribute Key conforming to the "host.arch" semantic - // conventions. It represents the CPU architecture the host system is - // running on. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - HostArchKey = attribute.Key("host.arch") - - // HostImageNameKey is the attribute Key conforming to the - // "host.image.name" semantic conventions. It represents the name of the VM - // image or OS install the host was instantiated from. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' - HostImageNameKey = attribute.Key("host.image.name") - - // HostImageIDKey is the attribute Key conforming to the "host.image.id" - // semantic conventions. It represents the vM image ID. For Cloud, this - // value is from the provider. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'ami-07b06b442921831e5' - HostImageIDKey = attribute.Key("host.image.id") - - // HostImageVersionKey is the attribute Key conforming to the - // "host.image.version" semantic conventions. It represents the version - // string of the VM image as defined in [Version - // Attributes](README.md#version-attributes). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '0.1' - HostImageVersionKey = attribute.Key("host.image.version") -) - -var ( - // AMD64 - HostArchAMD64 = HostArchKey.String("amd64") - // ARM32 - HostArchARM32 = HostArchKey.String("arm32") - // ARM64 - HostArchARM64 = HostArchKey.String("arm64") - // Itanium - HostArchIA64 = HostArchKey.String("ia64") - // 32-bit PowerPC - HostArchPPC32 = HostArchKey.String("ppc32") - // 64-bit PowerPC - HostArchPPC64 = HostArchKey.String("ppc64") - // IBM z/Architecture - HostArchS390x = HostArchKey.String("s390x") - // 32-bit x86 - HostArchX86 = HostArchKey.String("x86") -) - -// HostID returns an attribute KeyValue conforming to the "host.id" semantic -// conventions. It represents the unique host ID. For Cloud, this must be the -// instance_id assigned by the cloud provider. For non-containerized Linux -// systems, the `machine-id` located in `/etc/machine-id` or -// `/var/lib/dbus/machine-id` may be used. -func HostID(val string) attribute.KeyValue { - return HostIDKey.String(val) -} - -// HostName returns an attribute KeyValue conforming to the "host.name" -// semantic conventions. It represents the name of the host. On Unix systems, -// it may contain what the hostname command returns, or the fully qualified -// hostname, or another name specified by the user. -func HostName(val string) attribute.KeyValue { - return HostNameKey.String(val) -} - -// HostType returns an attribute KeyValue conforming to the "host.type" -// semantic conventions. It represents the type of host. For Cloud, this must -// be the machine type. -func HostType(val string) attribute.KeyValue { - return HostTypeKey.String(val) -} - -// HostImageName returns an attribute KeyValue conforming to the -// "host.image.name" semantic conventions. It represents the name of the VM -// image or OS install the host was instantiated from. -func HostImageName(val string) attribute.KeyValue { - return HostImageNameKey.String(val) -} - -// HostImageID returns an attribute KeyValue conforming to the -// "host.image.id" semantic conventions. It represents the vM image ID. For -// Cloud, this value is from the provider. -func HostImageID(val string) attribute.KeyValue { - return HostImageIDKey.String(val) -} - -// HostImageVersion returns an attribute KeyValue conforming to the -// "host.image.version" semantic conventions. It represents the version string -// of the VM image as defined in [Version -// Attributes](README.md#version-attributes). -func HostImageVersion(val string) attribute.KeyValue { - return HostImageVersionKey.String(val) -} - -// A Kubernetes Cluster. -const ( - // K8SClusterNameKey is the attribute Key conforming to the - // "k8s.cluster.name" semantic conventions. It represents the name of the - // cluster. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry-cluster' - K8SClusterNameKey = attribute.Key("k8s.cluster.name") -) - -// K8SClusterName returns an attribute KeyValue conforming to the -// "k8s.cluster.name" semantic conventions. It represents the name of the -// cluster. -func K8SClusterName(val string) attribute.KeyValue { - return K8SClusterNameKey.String(val) -} - -// A Kubernetes Node object. -const ( - // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" - // semantic conventions. It represents the name of the Node. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'node-1' - K8SNodeNameKey = attribute.Key("k8s.node.name") - - // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" - // semantic conventions. It represents the UID of the Node. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' - K8SNodeUIDKey = attribute.Key("k8s.node.uid") -) - -// K8SNodeName returns an attribute KeyValue conforming to the -// "k8s.node.name" semantic conventions. It represents the name of the Node. -func K8SNodeName(val string) attribute.KeyValue { - return K8SNodeNameKey.String(val) -} - -// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" -// semantic conventions. It represents the UID of the Node. -func K8SNodeUID(val string) attribute.KeyValue { - return K8SNodeUIDKey.String(val) -} - -// A Kubernetes Namespace. -const ( - // K8SNamespaceNameKey is the attribute Key conforming to the - // "k8s.namespace.name" semantic conventions. It represents the name of the - // namespace that the pod is running in. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'default' - K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") -) - -// K8SNamespaceName returns an attribute KeyValue conforming to the -// "k8s.namespace.name" semantic conventions. It represents the name of the -// namespace that the pod is running in. -func K8SNamespaceName(val string) attribute.KeyValue { - return K8SNamespaceNameKey.String(val) -} - -// A Kubernetes Pod object. -const ( - // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" - // semantic conventions. It represents the UID of the Pod. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SPodUIDKey = attribute.Key("k8s.pod.uid") - - // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" - // semantic conventions. It represents the name of the Pod. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry-pod-autoconf' - K8SPodNameKey = attribute.Key("k8s.pod.name") -) - -// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" -// semantic conventions. It represents the UID of the Pod. -func K8SPodUID(val string) attribute.KeyValue { - return K8SPodUIDKey.String(val) -} - -// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" -// semantic conventions. It represents the name of the Pod. -func K8SPodName(val string) attribute.KeyValue { - return K8SPodNameKey.String(val) -} - -// A container in a -// [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). -const ( - // K8SContainerNameKey is the attribute Key conforming to the - // "k8s.container.name" semantic conventions. It represents the name of the - // Container from Pod specification, must be unique within a Pod. Container - // runtime usually uses different globally unique name (`container.name`). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'redis' - K8SContainerNameKey = attribute.Key("k8s.container.name") - - // K8SContainerRestartCountKey is the attribute Key conforming to the - // "k8s.container.restart_count" semantic conventions. It represents the - // number of times the container was restarted. This attribute can be used - // to identify a particular container (running or stopped) within a - // container spec. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 0, 2 - K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") -) - -// K8SContainerName returns an attribute KeyValue conforming to the -// "k8s.container.name" semantic conventions. It represents the name of the -// Container from Pod specification, must be unique within a Pod. Container -// runtime usually uses different globally unique name (`container.name`). -func K8SContainerName(val string) attribute.KeyValue { - return K8SContainerNameKey.String(val) -} - -// K8SContainerRestartCount returns an attribute KeyValue conforming to the -// "k8s.container.restart_count" semantic conventions. It represents the number -// of times the container was restarted. This attribute can be used to identify -// a particular container (running or stopped) within a container spec. -func K8SContainerRestartCount(val int) attribute.KeyValue { - return K8SContainerRestartCountKey.Int(val) -} - -// A Kubernetes ReplicaSet object. -const ( - // K8SReplicaSetUIDKey is the attribute Key conforming to the - // "k8s.replicaset.uid" semantic conventions. It represents the UID of the - // ReplicaSet. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") - - // K8SReplicaSetNameKey is the attribute Key conforming to the - // "k8s.replicaset.name" semantic conventions. It represents the name of - // the ReplicaSet. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry' - K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") -) - -// K8SReplicaSetUID returns an attribute KeyValue conforming to the -// "k8s.replicaset.uid" semantic conventions. It represents the UID of the -// ReplicaSet. -func K8SReplicaSetUID(val string) attribute.KeyValue { - return K8SReplicaSetUIDKey.String(val) -} - -// K8SReplicaSetName returns an attribute KeyValue conforming to the -// "k8s.replicaset.name" semantic conventions. It represents the name of the -// ReplicaSet. -func K8SReplicaSetName(val string) attribute.KeyValue { - return K8SReplicaSetNameKey.String(val) -} - -// A Kubernetes Deployment object. -const ( - // K8SDeploymentUIDKey is the attribute Key conforming to the - // "k8s.deployment.uid" semantic conventions. It represents the UID of the - // Deployment. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") - - // K8SDeploymentNameKey is the attribute Key conforming to the - // "k8s.deployment.name" semantic conventions. It represents the name of - // the Deployment. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry' - K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") -) - -// K8SDeploymentUID returns an attribute KeyValue conforming to the -// "k8s.deployment.uid" semantic conventions. It represents the UID of the -// Deployment. -func K8SDeploymentUID(val string) attribute.KeyValue { - return K8SDeploymentUIDKey.String(val) -} - -// K8SDeploymentName returns an attribute KeyValue conforming to the -// "k8s.deployment.name" semantic conventions. It represents the name of the -// Deployment. -func K8SDeploymentName(val string) attribute.KeyValue { - return K8SDeploymentNameKey.String(val) -} - -// A Kubernetes StatefulSet object. -const ( - // K8SStatefulSetUIDKey is the attribute Key conforming to the - // "k8s.statefulset.uid" semantic conventions. It represents the UID of the - // StatefulSet. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") - - // K8SStatefulSetNameKey is the attribute Key conforming to the - // "k8s.statefulset.name" semantic conventions. It represents the name of - // the StatefulSet. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry' - K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") -) - -// K8SStatefulSetUID returns an attribute KeyValue conforming to the -// "k8s.statefulset.uid" semantic conventions. It represents the UID of the -// StatefulSet. -func K8SStatefulSetUID(val string) attribute.KeyValue { - return K8SStatefulSetUIDKey.String(val) -} - -// K8SStatefulSetName returns an attribute KeyValue conforming to the -// "k8s.statefulset.name" semantic conventions. It represents the name of the -// StatefulSet. -func K8SStatefulSetName(val string) attribute.KeyValue { - return K8SStatefulSetNameKey.String(val) -} - -// A Kubernetes DaemonSet object. -const ( - // K8SDaemonSetUIDKey is the attribute Key conforming to the - // "k8s.daemonset.uid" semantic conventions. It represents the UID of the - // DaemonSet. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") - - // K8SDaemonSetNameKey is the attribute Key conforming to the - // "k8s.daemonset.name" semantic conventions. It represents the name of the - // DaemonSet. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry' - K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") -) - -// K8SDaemonSetUID returns an attribute KeyValue conforming to the -// "k8s.daemonset.uid" semantic conventions. It represents the UID of the -// DaemonSet. -func K8SDaemonSetUID(val string) attribute.KeyValue { - return K8SDaemonSetUIDKey.String(val) -} - -// K8SDaemonSetName returns an attribute KeyValue conforming to the -// "k8s.daemonset.name" semantic conventions. It represents the name of the -// DaemonSet. -func K8SDaemonSetName(val string) attribute.KeyValue { - return K8SDaemonSetNameKey.String(val) -} - -// A Kubernetes Job object. -const ( - // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" - // semantic conventions. It represents the UID of the Job. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SJobUIDKey = attribute.Key("k8s.job.uid") - - // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" - // semantic conventions. It represents the name of the Job. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry' - K8SJobNameKey = attribute.Key("k8s.job.name") -) - -// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" -// semantic conventions. It represents the UID of the Job. -func K8SJobUID(val string) attribute.KeyValue { - return K8SJobUIDKey.String(val) -} - -// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" -// semantic conventions. It represents the name of the Job. -func K8SJobName(val string) attribute.KeyValue { - return K8SJobNameKey.String(val) -} - -// A Kubernetes CronJob object. -const ( - // K8SCronJobUIDKey is the attribute Key conforming to the - // "k8s.cronjob.uid" semantic conventions. It represents the UID of the - // CronJob. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") - - // K8SCronJobNameKey is the attribute Key conforming to the - // "k8s.cronjob.name" semantic conventions. It represents the name of the - // CronJob. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry' - K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") -) - -// K8SCronJobUID returns an attribute KeyValue conforming to the -// "k8s.cronjob.uid" semantic conventions. It represents the UID of the -// CronJob. -func K8SCronJobUID(val string) attribute.KeyValue { - return K8SCronJobUIDKey.String(val) -} - -// K8SCronJobName returns an attribute KeyValue conforming to the -// "k8s.cronjob.name" semantic conventions. It represents the name of the -// CronJob. -func K8SCronJobName(val string) attribute.KeyValue { - return K8SCronJobNameKey.String(val) -} - -// The operating system (OS) on which the process represented by this resource -// is running. -const ( - // OSTypeKey is the attribute Key conforming to the "os.type" semantic - // conventions. It represents the operating system type. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - OSTypeKey = attribute.Key("os.type") - - // OSDescriptionKey is the attribute Key conforming to the "os.description" - // semantic conventions. It represents the human readable (not intended to - // be parsed) OS version information, like e.g. reported by `ver` or - // `lsb_release -a` commands. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 - // LTS' - OSDescriptionKey = attribute.Key("os.description") - - // OSNameKey is the attribute Key conforming to the "os.name" semantic - // conventions. It represents the human readable operating system name. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'iOS', 'Android', 'Ubuntu' - OSNameKey = attribute.Key("os.name") - - // OSVersionKey is the attribute Key conforming to the "os.version" - // semantic conventions. It represents the version string of the operating - // system as defined in [Version - // Attributes](../../resource/semantic_conventions/README.md#version-attributes). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '14.2.1', '18.04.1' - OSVersionKey = attribute.Key("os.version") -) - -var ( - // Microsoft Windows - OSTypeWindows = OSTypeKey.String("windows") - // Linux - OSTypeLinux = OSTypeKey.String("linux") - // Apple Darwin - OSTypeDarwin = OSTypeKey.String("darwin") - // FreeBSD - OSTypeFreeBSD = OSTypeKey.String("freebsd") - // NetBSD - OSTypeNetBSD = OSTypeKey.String("netbsd") - // OpenBSD - OSTypeOpenBSD = OSTypeKey.String("openbsd") - // DragonFly BSD - OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") - // HP-UX (Hewlett Packard Unix) - OSTypeHPUX = OSTypeKey.String("hpux") - // AIX (Advanced Interactive eXecutive) - OSTypeAIX = OSTypeKey.String("aix") - // SunOS, Oracle Solaris - OSTypeSolaris = OSTypeKey.String("solaris") - // IBM z/OS - OSTypeZOS = OSTypeKey.String("z_os") -) - -// OSDescription returns an attribute KeyValue conforming to the -// "os.description" semantic conventions. It represents the human readable (not -// intended to be parsed) OS version information, like e.g. reported by `ver` -// or `lsb_release -a` commands. -func OSDescription(val string) attribute.KeyValue { - return OSDescriptionKey.String(val) -} - -// OSName returns an attribute KeyValue conforming to the "os.name" semantic -// conventions. It represents the human readable operating system name. -func OSName(val string) attribute.KeyValue { - return OSNameKey.String(val) -} - -// OSVersion returns an attribute KeyValue conforming to the "os.version" -// semantic conventions. It represents the version string of the operating -// system as defined in [Version -// Attributes](../../resource/semantic_conventions/README.md#version-attributes). -func OSVersion(val string) attribute.KeyValue { - return OSVersionKey.String(val) -} - -// An operating system process. -const ( - // ProcessPIDKey is the attribute Key conforming to the "process.pid" - // semantic conventions. It represents the process identifier (PID). - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 1234 - ProcessPIDKey = attribute.Key("process.pid") - - // ProcessParentPIDKey is the attribute Key conforming to the - // "process.parent_pid" semantic conventions. It represents the parent - // Process identifier (PID). - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 111 - ProcessParentPIDKey = attribute.Key("process.parent_pid") - - // ProcessExecutableNameKey is the attribute Key conforming to the - // "process.executable.name" semantic conventions. It represents the name - // of the process executable. On Linux based systems, can be set to the - // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name - // of `GetProcessImageFileNameW`. - // - // Type: string - // RequirementLevel: ConditionallyRequired (See alternative attributes - // below.) - // Stability: stable - // Examples: 'otelcol' - ProcessExecutableNameKey = attribute.Key("process.executable.name") - - // ProcessExecutablePathKey is the attribute Key conforming to the - // "process.executable.path" semantic conventions. It represents the full - // path to the process executable. On Linux based systems, can be set to - // the target of `proc/[pid]/exe`. On Windows, can be set to the result of - // `GetProcessImageFileNameW`. - // - // Type: string - // RequirementLevel: ConditionallyRequired (See alternative attributes - // below.) - // Stability: stable - // Examples: '/usr/bin/cmd/otelcol' - ProcessExecutablePathKey = attribute.Key("process.executable.path") - - // ProcessCommandKey is the attribute Key conforming to the - // "process.command" semantic conventions. It represents the command used - // to launch the process (i.e. the command name). On Linux based systems, - // can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can - // be set to the first parameter extracted from `GetCommandLineW`. - // - // Type: string - // RequirementLevel: ConditionallyRequired (See alternative attributes - // below.) - // Stability: stable - // Examples: 'cmd/otelcol' - ProcessCommandKey = attribute.Key("process.command") - - // ProcessCommandLineKey is the attribute Key conforming to the - // "process.command_line" semantic conventions. It represents the full - // command used to launch the process as a single string representing the - // full command. On Windows, can be set to the result of `GetCommandLineW`. - // Do not set this if you have to assemble it just for monitoring; use - // `process.command_args` instead. - // - // Type: string - // RequirementLevel: ConditionallyRequired (See alternative attributes - // below.) - // Stability: stable - // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' - ProcessCommandLineKey = attribute.Key("process.command_line") - - // ProcessCommandArgsKey is the attribute Key conforming to the - // "process.command_args" semantic conventions. It represents the all the - // command arguments (including the command/executable itself) as received - // by the process. On Linux-based systems (and some other Unixoid systems - // supporting procfs), can be set according to the list of null-delimited - // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, - // this would be the full argv vector passed to `main`. - // - // Type: string[] - // RequirementLevel: ConditionallyRequired (See alternative attributes - // below.) - // Stability: stable - // Examples: 'cmd/otecol', '--config=config.yaml' - ProcessCommandArgsKey = attribute.Key("process.command_args") - - // ProcessOwnerKey is the attribute Key conforming to the "process.owner" - // semantic conventions. It represents the username of the user that owns - // the process. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'root' - ProcessOwnerKey = attribute.Key("process.owner") -) - -// ProcessPID returns an attribute KeyValue conforming to the "process.pid" -// semantic conventions. It represents the process identifier (PID). -func ProcessPID(val int) attribute.KeyValue { - return ProcessPIDKey.Int(val) -} - -// ProcessParentPID returns an attribute KeyValue conforming to the -// "process.parent_pid" semantic conventions. It represents the parent Process -// identifier (PID). -func ProcessParentPID(val int) attribute.KeyValue { - return ProcessParentPIDKey.Int(val) -} - -// ProcessExecutableName returns an attribute KeyValue conforming to the -// "process.executable.name" semantic conventions. It represents the name of -// the process executable. On Linux based systems, can be set to the `Name` in -// `proc/[pid]/status`. On Windows, can be set to the base name of -// `GetProcessImageFileNameW`. -func ProcessExecutableName(val string) attribute.KeyValue { - return ProcessExecutableNameKey.String(val) -} - -// ProcessExecutablePath returns an attribute KeyValue conforming to the -// "process.executable.path" semantic conventions. It represents the full path -// to the process executable. On Linux based systems, can be set to the target -// of `proc/[pid]/exe`. On Windows, can be set to the result of -// `GetProcessImageFileNameW`. -func ProcessExecutablePath(val string) attribute.KeyValue { - return ProcessExecutablePathKey.String(val) -} - -// ProcessCommand returns an attribute KeyValue conforming to the -// "process.command" semantic conventions. It represents the command used to -// launch the process (i.e. the command name). On Linux based systems, can be -// set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to -// the first parameter extracted from `GetCommandLineW`. -func ProcessCommand(val string) attribute.KeyValue { - return ProcessCommandKey.String(val) -} - -// ProcessCommandLine returns an attribute KeyValue conforming to the -// "process.command_line" semantic conventions. It represents the full command -// used to launch the process as a single string representing the full command. -// On Windows, can be set to the result of `GetCommandLineW`. Do not set this -// if you have to assemble it just for monitoring; use `process.command_args` -// instead. -func ProcessCommandLine(val string) attribute.KeyValue { - return ProcessCommandLineKey.String(val) -} - -// ProcessCommandArgs returns an attribute KeyValue conforming to the -// "process.command_args" semantic conventions. It represents the all the -// command arguments (including the command/executable itself) as received by -// the process. On Linux-based systems (and some other Unixoid systems -// supporting procfs), can be set according to the list of null-delimited -// strings extracted from `proc/[pid]/cmdline`. For libc-based executables, -// this would be the full argv vector passed to `main`. -func ProcessCommandArgs(val ...string) attribute.KeyValue { - return ProcessCommandArgsKey.StringSlice(val) -} - -// ProcessOwner returns an attribute KeyValue conforming to the -// "process.owner" semantic conventions. It represents the username of the user -// that owns the process. -func ProcessOwner(val string) attribute.KeyValue { - return ProcessOwnerKey.String(val) -} - -// The single (language) runtime instance which is monitored. -const ( - // ProcessRuntimeNameKey is the attribute Key conforming to the - // "process.runtime.name" semantic conventions. It represents the name of - // the runtime of this process. For compiled native binaries, this SHOULD - // be the name of the compiler. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'OpenJDK Runtime Environment' - ProcessRuntimeNameKey = attribute.Key("process.runtime.name") - - // ProcessRuntimeVersionKey is the attribute Key conforming to the - // "process.runtime.version" semantic conventions. It represents the - // version of the runtime of this process, as returned by the runtime - // without modification. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '14.0.2' - ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") - - // ProcessRuntimeDescriptionKey is the attribute Key conforming to the - // "process.runtime.description" semantic conventions. It represents an - // additional description about the runtime of the process, for example a - // specific vendor customization of the runtime environment. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' - ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") -) - -// ProcessRuntimeName returns an attribute KeyValue conforming to the -// "process.runtime.name" semantic conventions. It represents the name of the -// runtime of this process. For compiled native binaries, this SHOULD be the -// name of the compiler. -func ProcessRuntimeName(val string) attribute.KeyValue { - return ProcessRuntimeNameKey.String(val) -} - -// ProcessRuntimeVersion returns an attribute KeyValue conforming to the -// "process.runtime.version" semantic conventions. It represents the version of -// the runtime of this process, as returned by the runtime without -// modification. -func ProcessRuntimeVersion(val string) attribute.KeyValue { - return ProcessRuntimeVersionKey.String(val) -} - -// ProcessRuntimeDescription returns an attribute KeyValue conforming to the -// "process.runtime.description" semantic conventions. It represents an -// additional description about the runtime of the process, for example a -// specific vendor customization of the runtime environment. -func ProcessRuntimeDescription(val string) attribute.KeyValue { - return ProcessRuntimeDescriptionKey.String(val) -} - -// A service instance. -const ( - // ServiceNameKey is the attribute Key conforming to the "service.name" - // semantic conventions. It represents the logical name of the service. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'shoppingcart' - // Note: MUST be the same for all instances of horizontally scaled - // services. If the value was not specified, SDKs MUST fallback to - // `unknown_service:` concatenated with - // [`process.executable.name`](process.md#process), e.g. - // `unknown_service:bash`. If `process.executable.name` is not available, - // the value MUST be set to `unknown_service`. - ServiceNameKey = attribute.Key("service.name") - - // ServiceNamespaceKey is the attribute Key conforming to the - // "service.namespace" semantic conventions. It represents a namespace for - // `service.name`. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Shop' - // Note: A string value having a meaning that helps to distinguish a group - // of services, for example the team name that owns a group of services. - // `service.name` is expected to be unique within the same namespace. If - // `service.namespace` is not specified in the Resource then `service.name` - // is expected to be unique for all services that have no explicit - // namespace defined (so the empty/unspecified namespace is simply one more - // valid namespace). Zero-length namespace string is assumed equal to - // unspecified namespace. - ServiceNamespaceKey = attribute.Key("service.namespace") - - // ServiceInstanceIDKey is the attribute Key conforming to the - // "service.instance.id" semantic conventions. It represents the string ID - // of the service instance. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '627cc493-f310-47de-96bd-71410b7dec09' - // Note: MUST be unique for each instance of the same - // `service.namespace,service.name` pair (in other words - // `service.namespace,service.name,service.instance.id` triplet MUST be - // globally unique). The ID helps to distinguish instances of the same - // service that exist at the same time (e.g. instances of a horizontally - // scaled service). It is preferable for the ID to be persistent and stay - // the same for the lifetime of the service instance, however it is - // acceptable that the ID is ephemeral and changes during important - // lifetime events for the service (e.g. service restarts). If the service - // has no inherent unique ID that can be used as the value of this - // attribute it is recommended to generate a random Version 1 or Version 4 - // RFC 4122 UUID (services aiming for reproducible UUIDs may also use - // Version 5, see RFC 4122 for more recommendations). - ServiceInstanceIDKey = attribute.Key("service.instance.id") - - // ServiceVersionKey is the attribute Key conforming to the - // "service.version" semantic conventions. It represents the version string - // of the service API or implementation. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '2.0.0' - ServiceVersionKey = attribute.Key("service.version") -) - -// ServiceName returns an attribute KeyValue conforming to the -// "service.name" semantic conventions. It represents the logical name of the -// service. -func ServiceName(val string) attribute.KeyValue { - return ServiceNameKey.String(val) -} - -// ServiceNamespace returns an attribute KeyValue conforming to the -// "service.namespace" semantic conventions. It represents a namespace for -// `service.name`. -func ServiceNamespace(val string) attribute.KeyValue { - return ServiceNamespaceKey.String(val) -} - -// ServiceInstanceID returns an attribute KeyValue conforming to the -// "service.instance.id" semantic conventions. It represents the string ID of -// the service instance. -func ServiceInstanceID(val string) attribute.KeyValue { - return ServiceInstanceIDKey.String(val) -} - -// ServiceVersion returns an attribute KeyValue conforming to the -// "service.version" semantic conventions. It represents the version string of -// the service API or implementation. -func ServiceVersion(val string) attribute.KeyValue { - return ServiceVersionKey.String(val) -} - -// The telemetry SDK used to capture data recorded by the instrumentation -// libraries. -const ( - // TelemetrySDKNameKey is the attribute Key conforming to the - // "telemetry.sdk.name" semantic conventions. It represents the name of the - // telemetry SDK as defined above. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry' - TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") - - // TelemetrySDKLanguageKey is the attribute Key conforming to the - // "telemetry.sdk.language" semantic conventions. It represents the - // language of the telemetry SDK. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") - - // TelemetrySDKVersionKey is the attribute Key conforming to the - // "telemetry.sdk.version" semantic conventions. It represents the version - // string of the telemetry SDK. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '1.2.3' - TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") - - // TelemetryAutoVersionKey is the attribute Key conforming to the - // "telemetry.auto.version" semantic conventions. It represents the version - // string of the auto instrumentation agent, if used. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '1.2.3' - TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") -) - -var ( - // cpp - TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") - // dotnet - TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") - // erlang - TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") - // go - TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") - // java - TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") - // nodejs - TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") - // php - TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") - // python - TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") - // ruby - TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") - // webjs - TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") - // swift - TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") -) - -// TelemetrySDKName returns an attribute KeyValue conforming to the -// "telemetry.sdk.name" semantic conventions. It represents the name of the -// telemetry SDK as defined above. -func TelemetrySDKName(val string) attribute.KeyValue { - return TelemetrySDKNameKey.String(val) -} - -// TelemetrySDKVersion returns an attribute KeyValue conforming to the -// "telemetry.sdk.version" semantic conventions. It represents the version -// string of the telemetry SDK. -func TelemetrySDKVersion(val string) attribute.KeyValue { - return TelemetrySDKVersionKey.String(val) -} - -// TelemetryAutoVersion returns an attribute KeyValue conforming to the -// "telemetry.auto.version" semantic conventions. It represents the version -// string of the auto instrumentation agent, if used. -func TelemetryAutoVersion(val string) attribute.KeyValue { - return TelemetryAutoVersionKey.String(val) -} - -// Resource describing the packaged software running the application code. Web -// engines are typically executed using process.runtime. -const ( - // WebEngineNameKey is the attribute Key conforming to the "webengine.name" - // semantic conventions. It represents the name of the web engine. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'WildFly' - WebEngineNameKey = attribute.Key("webengine.name") - - // WebEngineVersionKey is the attribute Key conforming to the - // "webengine.version" semantic conventions. It represents the version of - // the web engine. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '21.0.0' - WebEngineVersionKey = attribute.Key("webengine.version") - - // WebEngineDescriptionKey is the attribute Key conforming to the - // "webengine.description" semantic conventions. It represents the - // additional description of the web engine (e.g. detailed version and - // edition information). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - - // 2.2.2.Final' - WebEngineDescriptionKey = attribute.Key("webengine.description") -) - -// WebEngineName returns an attribute KeyValue conforming to the -// "webengine.name" semantic conventions. It represents the name of the web -// engine. -func WebEngineName(val string) attribute.KeyValue { - return WebEngineNameKey.String(val) -} - -// WebEngineVersion returns an attribute KeyValue conforming to the -// "webengine.version" semantic conventions. It represents the version of the -// web engine. -func WebEngineVersion(val string) attribute.KeyValue { - return WebEngineVersionKey.String(val) -} - -// WebEngineDescription returns an attribute KeyValue conforming to the -// "webengine.description" semantic conventions. It represents the additional -// description of the web engine (e.g. detailed version and edition -// information). -func WebEngineDescription(val string) attribute.KeyValue { - return WebEngineDescriptionKey.String(val) -} - -// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's -// concepts. -const ( - // OtelScopeNameKey is the attribute Key conforming to the - // "otel.scope.name" semantic conventions. It represents the name of the - // instrumentation scope - (`InstrumentationScope.Name` in OTLP). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'io.opentelemetry.contrib.mongodb' - OtelScopeNameKey = attribute.Key("otel.scope.name") - - // OtelScopeVersionKey is the attribute Key conforming to the - // "otel.scope.version" semantic conventions. It represents the version of - // the instrumentation scope - (`InstrumentationScope.Version` in OTLP). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '1.0.0' - OtelScopeVersionKey = attribute.Key("otel.scope.version") -) - -// OtelScopeName returns an attribute KeyValue conforming to the -// "otel.scope.name" semantic conventions. It represents the name of the -// instrumentation scope - (`InstrumentationScope.Name` in OTLP). -func OtelScopeName(val string) attribute.KeyValue { - return OtelScopeNameKey.String(val) -} - -// OtelScopeVersion returns an attribute KeyValue conforming to the -// "otel.scope.version" semantic conventions. It represents the version of the -// instrumentation scope - (`InstrumentationScope.Version` in OTLP). -func OtelScopeVersion(val string) attribute.KeyValue { - return OtelScopeVersionKey.String(val) -} - -// Span attributes used by non-OTLP exporters to represent OpenTelemetry -// Scope's concepts. -const ( - // OtelLibraryNameKey is the attribute Key conforming to the - // "otel.library.name" semantic conventions. It represents the deprecated, - // use the `otel.scope.name` attribute. - // - // Type: string - // RequirementLevel: Optional - // Stability: deprecated - // Examples: 'io.opentelemetry.contrib.mongodb' - OtelLibraryNameKey = attribute.Key("otel.library.name") - - // OtelLibraryVersionKey is the attribute Key conforming to the - // "otel.library.version" semantic conventions. It represents the - // deprecated, use the `otel.scope.version` attribute. - // - // Type: string - // RequirementLevel: Optional - // Stability: deprecated - // Examples: '1.0.0' - OtelLibraryVersionKey = attribute.Key("otel.library.version") -) - -// OtelLibraryName returns an attribute KeyValue conforming to the -// "otel.library.name" semantic conventions. It represents the deprecated, use -// the `otel.scope.name` attribute. -func OtelLibraryName(val string) attribute.KeyValue { - return OtelLibraryNameKey.String(val) -} - -// OtelLibraryVersion returns an attribute KeyValue conforming to the -// "otel.library.version" semantic conventions. It represents the deprecated, -// use the `otel.scope.version` attribute. -func OtelLibraryVersion(val string) attribute.KeyValue { - return OtelLibraryVersionKey.String(val) -} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/schema.go deleted file mode 100644 index 634a1dce07..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/schema.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" - -// SchemaURL is the schema URL that matches the version of the semantic conventions -// that this package defines. Semconv packages starting from v1.4.0 must declare -// non-empty schema URL in the form https://opentelemetry.io/schemas/ -const SchemaURL = "https://opentelemetry.io/schemas/1.17.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/trace.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/trace.go deleted file mode 100644 index 21497bb6bc..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/trace.go +++ /dev/null @@ -1,3364 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Code generated from semantic convention specification. DO NOT EDIT. - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" - -import "go.opentelemetry.io/otel/attribute" - -// The shared attributes used to report a single exception associated with a -// span or log. -const ( - // ExceptionTypeKey is the attribute Key conforming to the "exception.type" - // semantic conventions. It represents the type of the exception (its - // fully-qualified class name, if applicable). The dynamic type of the - // exception should be preferred over the static type in languages that - // support it. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'java.net.ConnectException', 'OSError' - ExceptionTypeKey = attribute.Key("exception.type") - - // ExceptionMessageKey is the attribute Key conforming to the - // "exception.message" semantic conventions. It represents the exception - // message. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Division by zero', "Can't convert 'int' object to str - // implicitly" - ExceptionMessageKey = attribute.Key("exception.message") - - // ExceptionStacktraceKey is the attribute Key conforming to the - // "exception.stacktrace" semantic conventions. It represents a stacktrace - // as a string in the natural representation for the language runtime. The - // representation is to be determined and documented by each language SIG. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test - // exception\\n at ' - // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' - // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' - // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' - ExceptionStacktraceKey = attribute.Key("exception.stacktrace") -) - -// ExceptionType returns an attribute KeyValue conforming to the -// "exception.type" semantic conventions. It represents the type of the -// exception (its fully-qualified class name, if applicable). The dynamic type -// of the exception should be preferred over the static type in languages that -// support it. -func ExceptionType(val string) attribute.KeyValue { - return ExceptionTypeKey.String(val) -} - -// ExceptionMessage returns an attribute KeyValue conforming to the -// "exception.message" semantic conventions. It represents the exception -// message. -func ExceptionMessage(val string) attribute.KeyValue { - return ExceptionMessageKey.String(val) -} - -// ExceptionStacktrace returns an attribute KeyValue conforming to the -// "exception.stacktrace" semantic conventions. It represents a stacktrace as a -// string in the natural representation for the language runtime. The -// representation is to be determined and documented by each language SIG. -func ExceptionStacktrace(val string) attribute.KeyValue { - return ExceptionStacktraceKey.String(val) -} - -// Attributes for Events represented using Log Records. -const ( - // EventNameKey is the attribute Key conforming to the "event.name" - // semantic conventions. It represents the name identifies the event. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'click', 'exception' - EventNameKey = attribute.Key("event.name") - - // EventDomainKey is the attribute Key conforming to the "event.domain" - // semantic conventions. It represents the domain identifies the business - // context for the events. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - // Note: Events across different domains may have same `event.name`, yet be - // unrelated events. - EventDomainKey = attribute.Key("event.domain") -) - -var ( - // Events from browser apps - EventDomainBrowser = EventDomainKey.String("browser") - // Events from mobile apps - EventDomainDevice = EventDomainKey.String("device") - // Events from Kubernetes - EventDomainK8S = EventDomainKey.String("k8s") -) - -// EventName returns an attribute KeyValue conforming to the "event.name" -// semantic conventions. It represents the name identifies the event. -func EventName(val string) attribute.KeyValue { - return EventNameKey.String(val) -} - -// Span attributes used by AWS Lambda (in addition to general `faas` -// attributes). -const ( - // AWSLambdaInvokedARNKey is the attribute Key conforming to the - // "aws.lambda.invoked_arn" semantic conventions. It represents the full - // invoked ARN as provided on the `Context` passed to the function - // (`Lambda-Runtime-Invoked-Function-ARN` header on the - // `/runtime/invocation/next` applicable). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' - // Note: This may be different from `faas.id` if an alias is involved. - AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") -) - -// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the -// "aws.lambda.invoked_arn" semantic conventions. It represents the full -// invoked ARN as provided on the `Context` passed to the function -// (`Lambda-Runtime-Invoked-Function-ARN` header on the -// `/runtime/invocation/next` applicable). -func AWSLambdaInvokedARN(val string) attribute.KeyValue { - return AWSLambdaInvokedARNKey.String(val) -} - -// Attributes for CloudEvents. CloudEvents is a specification on how to define -// event data in a standard way. These attributes can be attached to spans when -// performing operations with CloudEvents, regardless of the protocol being -// used. -const ( - // CloudeventsEventIDKey is the attribute Key conforming to the - // "cloudevents.event_id" semantic conventions. It represents the - // [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) - // uniquely identifies the event. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' - CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") - - // CloudeventsEventSourceKey is the attribute Key conforming to the - // "cloudevents.event_source" semantic conventions. It represents the - // [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) - // identifies the context in which an event happened. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'https://github.com/cloudevents', - // '/cloudevents/spec/pull/123', 'my-service' - CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") - - // CloudeventsEventSpecVersionKey is the attribute Key conforming to the - // "cloudevents.event_spec_version" semantic conventions. It represents the - // [version of the CloudEvents - // specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) - // which the event uses. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '1.0' - CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") - - // CloudeventsEventTypeKey is the attribute Key conforming to the - // "cloudevents.event_type" semantic conventions. It represents the - // [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) - // contains a value describing the type of event related to the originating - // occurrence. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'com.github.pull_request.opened', - // 'com.example.object.deleted.v2' - CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") - - // CloudeventsEventSubjectKey is the attribute Key conforming to the - // "cloudevents.event_subject" semantic conventions. It represents the - // [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) - // of the event in the context of the event producer (identified by - // source). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'mynewfile.jpg' - CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") -) - -// CloudeventsEventID returns an attribute KeyValue conforming to the -// "cloudevents.event_id" semantic conventions. It represents the -// [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) -// uniquely identifies the event. -func CloudeventsEventID(val string) attribute.KeyValue { - return CloudeventsEventIDKey.String(val) -} - -// CloudeventsEventSource returns an attribute KeyValue conforming to the -// "cloudevents.event_source" semantic conventions. It represents the -// [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) -// identifies the context in which an event happened. -func CloudeventsEventSource(val string) attribute.KeyValue { - return CloudeventsEventSourceKey.String(val) -} - -// CloudeventsEventSpecVersion returns an attribute KeyValue conforming to -// the "cloudevents.event_spec_version" semantic conventions. It represents the -// [version of the CloudEvents -// specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) -// which the event uses. -func CloudeventsEventSpecVersion(val string) attribute.KeyValue { - return CloudeventsEventSpecVersionKey.String(val) -} - -// CloudeventsEventType returns an attribute KeyValue conforming to the -// "cloudevents.event_type" semantic conventions. It represents the -// [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) -// contains a value describing the type of event related to the originating -// occurrence. -func CloudeventsEventType(val string) attribute.KeyValue { - return CloudeventsEventTypeKey.String(val) -} - -// CloudeventsEventSubject returns an attribute KeyValue conforming to the -// "cloudevents.event_subject" semantic conventions. It represents the -// [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) -// of the event in the context of the event producer (identified by source). -func CloudeventsEventSubject(val string) attribute.KeyValue { - return CloudeventsEventSubjectKey.String(val) -} - -// Semantic conventions for the OpenTracing Shim -const ( - // OpentracingRefTypeKey is the attribute Key conforming to the - // "opentracing.ref_type" semantic conventions. It represents the - // parent-child Reference type - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Note: The causal relationship between a child Span and a parent Span. - OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") -) - -var ( - // The parent Span depends on the child Span in some capacity - OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") - // The parent Span does not depend in any way on the result of the child Span - OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") -) - -// The attributes used to perform database client calls. -const ( - // DBSystemKey is the attribute Key conforming to the "db.system" semantic - // conventions. It represents an identifier for the database management - // system (DBMS) product being used. See below for a list of well-known - // identifiers. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - DBSystemKey = attribute.Key("db.system") - - // DBConnectionStringKey is the attribute Key conforming to the - // "db.connection_string" semantic conventions. It represents the - // connection string used to connect to the database. It is recommended to - // remove embedded credentials. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' - DBConnectionStringKey = attribute.Key("db.connection_string") - - // DBUserKey is the attribute Key conforming to the "db.user" semantic - // conventions. It represents the username for accessing the database. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'readonly_user', 'reporting_user' - DBUserKey = attribute.Key("db.user") - - // DBJDBCDriverClassnameKey is the attribute Key conforming to the - // "db.jdbc.driver_classname" semantic conventions. It represents the - // fully-qualified class name of the [Java Database Connectivity - // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) - // driver used to connect. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'org.postgresql.Driver', - // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' - DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") - - // DBNameKey is the attribute Key conforming to the "db.name" semantic - // conventions. It represents the this attribute is used to report the name - // of the database being accessed. For commands that switch the database, - // this should be set to the target database (even if the command fails). - // - // Type: string - // RequirementLevel: ConditionallyRequired (If applicable.) - // Stability: stable - // Examples: 'customers', 'main' - // Note: In some SQL databases, the database name to be used is called - // "schema name". In case there are multiple layers that could be - // considered for database name (e.g. Oracle instance name and schema - // name), the database name to be used is the more specific layer (e.g. - // Oracle schema name). - DBNameKey = attribute.Key("db.name") - - // DBStatementKey is the attribute Key conforming to the "db.statement" - // semantic conventions. It represents the database statement being - // executed. - // - // Type: string - // RequirementLevel: ConditionallyRequired (If applicable and not - // explicitly disabled via instrumentation configuration.) - // Stability: stable - // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' - // Note: The value may be sanitized to exclude sensitive information. - DBStatementKey = attribute.Key("db.statement") - - // DBOperationKey is the attribute Key conforming to the "db.operation" - // semantic conventions. It represents the name of the operation being - // executed, e.g. the [MongoDB command - // name](https://docs.mongodb.com/manual/reference/command/#database-operations) - // such as `findAndModify`, or the SQL keyword. - // - // Type: string - // RequirementLevel: ConditionallyRequired (If `db.statement` is not - // applicable.) - // Stability: stable - // Examples: 'findAndModify', 'HMSET', 'SELECT' - // Note: When setting this to an SQL keyword, it is not recommended to - // attempt any client-side parsing of `db.statement` just to get this - // property, but it should be set if the operation name is provided by the - // library being instrumented. If the SQL statement has an ambiguous - // operation, or performs more than one operation, this value may be - // omitted. - DBOperationKey = attribute.Key("db.operation") -) - -var ( - // Some other SQL database. Fallback only. See notes - DBSystemOtherSQL = DBSystemKey.String("other_sql") - // Microsoft SQL Server - DBSystemMSSQL = DBSystemKey.String("mssql") - // MySQL - DBSystemMySQL = DBSystemKey.String("mysql") - // Oracle Database - DBSystemOracle = DBSystemKey.String("oracle") - // IBM DB2 - DBSystemDB2 = DBSystemKey.String("db2") - // PostgreSQL - DBSystemPostgreSQL = DBSystemKey.String("postgresql") - // Amazon Redshift - DBSystemRedshift = DBSystemKey.String("redshift") - // Apache Hive - DBSystemHive = DBSystemKey.String("hive") - // Cloudscape - DBSystemCloudscape = DBSystemKey.String("cloudscape") - // HyperSQL DataBase - DBSystemHSQLDB = DBSystemKey.String("hsqldb") - // Progress Database - DBSystemProgress = DBSystemKey.String("progress") - // SAP MaxDB - DBSystemMaxDB = DBSystemKey.String("maxdb") - // SAP HANA - DBSystemHanaDB = DBSystemKey.String("hanadb") - // Ingres - DBSystemIngres = DBSystemKey.String("ingres") - // FirstSQL - DBSystemFirstSQL = DBSystemKey.String("firstsql") - // EnterpriseDB - DBSystemEDB = DBSystemKey.String("edb") - // InterSystems Caché - DBSystemCache = DBSystemKey.String("cache") - // Adabas (Adaptable Database System) - DBSystemAdabas = DBSystemKey.String("adabas") - // Firebird - DBSystemFirebird = DBSystemKey.String("firebird") - // Apache Derby - DBSystemDerby = DBSystemKey.String("derby") - // FileMaker - DBSystemFilemaker = DBSystemKey.String("filemaker") - // Informix - DBSystemInformix = DBSystemKey.String("informix") - // InstantDB - DBSystemInstantDB = DBSystemKey.String("instantdb") - // InterBase - DBSystemInterbase = DBSystemKey.String("interbase") - // MariaDB - DBSystemMariaDB = DBSystemKey.String("mariadb") - // Netezza - DBSystemNetezza = DBSystemKey.String("netezza") - // Pervasive PSQL - DBSystemPervasive = DBSystemKey.String("pervasive") - // PointBase - DBSystemPointbase = DBSystemKey.String("pointbase") - // SQLite - DBSystemSqlite = DBSystemKey.String("sqlite") - // Sybase - DBSystemSybase = DBSystemKey.String("sybase") - // Teradata - DBSystemTeradata = DBSystemKey.String("teradata") - // Vertica - DBSystemVertica = DBSystemKey.String("vertica") - // H2 - DBSystemH2 = DBSystemKey.String("h2") - // ColdFusion IMQ - DBSystemColdfusion = DBSystemKey.String("coldfusion") - // Apache Cassandra - DBSystemCassandra = DBSystemKey.String("cassandra") - // Apache HBase - DBSystemHBase = DBSystemKey.String("hbase") - // MongoDB - DBSystemMongoDB = DBSystemKey.String("mongodb") - // Redis - DBSystemRedis = DBSystemKey.String("redis") - // Couchbase - DBSystemCouchbase = DBSystemKey.String("couchbase") - // CouchDB - DBSystemCouchDB = DBSystemKey.String("couchdb") - // Microsoft Azure Cosmos DB - DBSystemCosmosDB = DBSystemKey.String("cosmosdb") - // Amazon DynamoDB - DBSystemDynamoDB = DBSystemKey.String("dynamodb") - // Neo4j - DBSystemNeo4j = DBSystemKey.String("neo4j") - // Apache Geode - DBSystemGeode = DBSystemKey.String("geode") - // Elasticsearch - DBSystemElasticsearch = DBSystemKey.String("elasticsearch") - // Memcached - DBSystemMemcached = DBSystemKey.String("memcached") - // CockroachDB - DBSystemCockroachdb = DBSystemKey.String("cockroachdb") - // OpenSearch - DBSystemOpensearch = DBSystemKey.String("opensearch") - // ClickHouse - DBSystemClickhouse = DBSystemKey.String("clickhouse") -) - -// DBConnectionString returns an attribute KeyValue conforming to the -// "db.connection_string" semantic conventions. It represents the connection -// string used to connect to the database. It is recommended to remove embedded -// credentials. -func DBConnectionString(val string) attribute.KeyValue { - return DBConnectionStringKey.String(val) -} - -// DBUser returns an attribute KeyValue conforming to the "db.user" semantic -// conventions. It represents the username for accessing the database. -func DBUser(val string) attribute.KeyValue { - return DBUserKey.String(val) -} - -// DBJDBCDriverClassname returns an attribute KeyValue conforming to the -// "db.jdbc.driver_classname" semantic conventions. It represents the -// fully-qualified class name of the [Java Database Connectivity -// (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver -// used to connect. -func DBJDBCDriverClassname(val string) attribute.KeyValue { - return DBJDBCDriverClassnameKey.String(val) -} - -// DBName returns an attribute KeyValue conforming to the "db.name" semantic -// conventions. It represents the this attribute is used to report the name of -// the database being accessed. For commands that switch the database, this -// should be set to the target database (even if the command fails). -func DBName(val string) attribute.KeyValue { - return DBNameKey.String(val) -} - -// DBStatement returns an attribute KeyValue conforming to the -// "db.statement" semantic conventions. It represents the database statement -// being executed. -func DBStatement(val string) attribute.KeyValue { - return DBStatementKey.String(val) -} - -// DBOperation returns an attribute KeyValue conforming to the -// "db.operation" semantic conventions. It represents the name of the operation -// being executed, e.g. the [MongoDB command -// name](https://docs.mongodb.com/manual/reference/command/#database-operations) -// such as `findAndModify`, or the SQL keyword. -func DBOperation(val string) attribute.KeyValue { - return DBOperationKey.String(val) -} - -// Connection-level attributes for Microsoft SQL Server -const ( - // DBMSSQLInstanceNameKey is the attribute Key conforming to the - // "db.mssql.instance_name" semantic conventions. It represents the - // Microsoft SQL Server [instance - // name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) - // connecting to. This name is used to determine the port of a named - // instance. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'MSSQLSERVER' - // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no - // longer required (but still recommended if non-standard). - DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") -) - -// DBMSSQLInstanceName returns an attribute KeyValue conforming to the -// "db.mssql.instance_name" semantic conventions. It represents the Microsoft -// SQL Server [instance -// name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) -// connecting to. This name is used to determine the port of a named instance. -func DBMSSQLInstanceName(val string) attribute.KeyValue { - return DBMSSQLInstanceNameKey.String(val) -} - -// Call-level attributes for Cassandra -const ( - // DBCassandraPageSizeKey is the attribute Key conforming to the - // "db.cassandra.page_size" semantic conventions. It represents the fetch - // size used for paging, i.e. how many rows will be returned at once. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 5000 - DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") - - // DBCassandraConsistencyLevelKey is the attribute Key conforming to the - // "db.cassandra.consistency_level" semantic conventions. It represents the - // consistency level of the query. Based on consistency values from - // [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") - - // DBCassandraTableKey is the attribute Key conforming to the - // "db.cassandra.table" semantic conventions. It represents the name of the - // primary table that the operation is acting upon, including the keyspace - // name (if applicable). - // - // Type: string - // RequirementLevel: Recommended - // Stability: stable - // Examples: 'mytable' - // Note: This mirrors the db.sql.table attribute but references cassandra - // rather than sql. It is not recommended to attempt any client-side - // parsing of `db.statement` just to get this property, but it should be - // set if it is provided by the library being instrumented. If the - // operation is acting upon an anonymous table, or more than one table, - // this value MUST NOT be set. - DBCassandraTableKey = attribute.Key("db.cassandra.table") - - // DBCassandraIdempotenceKey is the attribute Key conforming to the - // "db.cassandra.idempotence" semantic conventions. It represents the - // whether or not the query is idempotent. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") - - // DBCassandraSpeculativeExecutionCountKey is the attribute Key conforming - // to the "db.cassandra.speculative_execution_count" semantic conventions. - // It represents the number of times a query was speculatively executed. - // Not set or `0` if the query was not executed speculatively. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 0, 2 - DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") - - // DBCassandraCoordinatorIDKey is the attribute Key conforming to the - // "db.cassandra.coordinator.id" semantic conventions. It represents the ID - // of the coordinating node for a query. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' - DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") - - // DBCassandraCoordinatorDCKey is the attribute Key conforming to the - // "db.cassandra.coordinator.dc" semantic conventions. It represents the - // data center of the coordinating node for a query. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'us-west-2' - DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") -) - -var ( - // all - DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") - // each_quorum - DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") - // quorum - DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") - // local_quorum - DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") - // one - DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") - // two - DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") - // three - DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") - // local_one - DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") - // any - DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") - // serial - DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") - // local_serial - DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") -) - -// DBCassandraPageSize returns an attribute KeyValue conforming to the -// "db.cassandra.page_size" semantic conventions. It represents the fetch size -// used for paging, i.e. how many rows will be returned at once. -func DBCassandraPageSize(val int) attribute.KeyValue { - return DBCassandraPageSizeKey.Int(val) -} - -// DBCassandraTable returns an attribute KeyValue conforming to the -// "db.cassandra.table" semantic conventions. It represents the name of the -// primary table that the operation is acting upon, including the keyspace name -// (if applicable). -func DBCassandraTable(val string) attribute.KeyValue { - return DBCassandraTableKey.String(val) -} - -// DBCassandraIdempotence returns an attribute KeyValue conforming to the -// "db.cassandra.idempotence" semantic conventions. It represents the whether -// or not the query is idempotent. -func DBCassandraIdempotence(val bool) attribute.KeyValue { - return DBCassandraIdempotenceKey.Bool(val) -} - -// DBCassandraSpeculativeExecutionCount returns an attribute KeyValue -// conforming to the "db.cassandra.speculative_execution_count" semantic -// conventions. It represents the number of times a query was speculatively -// executed. Not set or `0` if the query was not executed speculatively. -func DBCassandraSpeculativeExecutionCount(val int) attribute.KeyValue { - return DBCassandraSpeculativeExecutionCountKey.Int(val) -} - -// DBCassandraCoordinatorID returns an attribute KeyValue conforming to the -// "db.cassandra.coordinator.id" semantic conventions. It represents the ID of -// the coordinating node for a query. -func DBCassandraCoordinatorID(val string) attribute.KeyValue { - return DBCassandraCoordinatorIDKey.String(val) -} - -// DBCassandraCoordinatorDC returns an attribute KeyValue conforming to the -// "db.cassandra.coordinator.dc" semantic conventions. It represents the data -// center of the coordinating node for a query. -func DBCassandraCoordinatorDC(val string) attribute.KeyValue { - return DBCassandraCoordinatorDCKey.String(val) -} - -// Call-level attributes for Redis -const ( - // DBRedisDBIndexKey is the attribute Key conforming to the - // "db.redis.database_index" semantic conventions. It represents the index - // of the database being accessed as used in the [`SELECT` - // command](https://redis.io/commands/select), provided as an integer. To - // be used instead of the generic `db.name` attribute. - // - // Type: int - // RequirementLevel: ConditionallyRequired (If other than the default - // database (`0`).) - // Stability: stable - // Examples: 0, 1, 15 - DBRedisDBIndexKey = attribute.Key("db.redis.database_index") -) - -// DBRedisDBIndex returns an attribute KeyValue conforming to the -// "db.redis.database_index" semantic conventions. It represents the index of -// the database being accessed as used in the [`SELECT` -// command](https://redis.io/commands/select), provided as an integer. To be -// used instead of the generic `db.name` attribute. -func DBRedisDBIndex(val int) attribute.KeyValue { - return DBRedisDBIndexKey.Int(val) -} - -// Call-level attributes for MongoDB -const ( - // DBMongoDBCollectionKey is the attribute Key conforming to the - // "db.mongodb.collection" semantic conventions. It represents the - // collection being accessed within the database stated in `db.name`. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'customers', 'products' - DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") -) - -// DBMongoDBCollection returns an attribute KeyValue conforming to the -// "db.mongodb.collection" semantic conventions. It represents the collection -// being accessed within the database stated in `db.name`. -func DBMongoDBCollection(val string) attribute.KeyValue { - return DBMongoDBCollectionKey.String(val) -} - -// Call-level attributes for SQL databases -const ( - // DBSQLTableKey is the attribute Key conforming to the "db.sql.table" - // semantic conventions. It represents the name of the primary table that - // the operation is acting upon, including the database name (if - // applicable). - // - // Type: string - // RequirementLevel: Recommended - // Stability: stable - // Examples: 'public.users', 'customers' - // Note: It is not recommended to attempt any client-side parsing of - // `db.statement` just to get this property, but it should be set if it is - // provided by the library being instrumented. If the operation is acting - // upon an anonymous table, or more than one table, this value MUST NOT be - // set. - DBSQLTableKey = attribute.Key("db.sql.table") -) - -// DBSQLTable returns an attribute KeyValue conforming to the "db.sql.table" -// semantic conventions. It represents the name of the primary table that the -// operation is acting upon, including the database name (if applicable). -func DBSQLTable(val string) attribute.KeyValue { - return DBSQLTableKey.String(val) -} - -// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's -// concepts. -const ( - // OtelStatusCodeKey is the attribute Key conforming to the - // "otel.status_code" semantic conventions. It represents the name of the - // code, either "OK" or "ERROR". MUST NOT be set if the status code is - // UNSET. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - OtelStatusCodeKey = attribute.Key("otel.status_code") - - // OtelStatusDescriptionKey is the attribute Key conforming to the - // "otel.status_description" semantic conventions. It represents the - // description of the Status if it has a value, otherwise not set. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'resource not found' - OtelStatusDescriptionKey = attribute.Key("otel.status_description") -) - -var ( - // The operation has been validated by an Application developer or Operator to have completed successfully - OtelStatusCodeOk = OtelStatusCodeKey.String("OK") - // The operation contains an error - OtelStatusCodeError = OtelStatusCodeKey.String("ERROR") -) - -// OtelStatusDescription returns an attribute KeyValue conforming to the -// "otel.status_description" semantic conventions. It represents the -// description of the Status if it has a value, otherwise not set. -func OtelStatusDescription(val string) attribute.KeyValue { - return OtelStatusDescriptionKey.String(val) -} - -// This semantic convention describes an instance of a function that runs -// without provisioning or managing of servers (also known as serverless -// functions or Function as a Service (FaaS)) with spans. -const ( - // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" - // semantic conventions. It represents the type of the trigger which caused - // this function execution. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Note: For the server/consumer span on the incoming side, - // `faas.trigger` MUST be set. - // - // Clients invoking FaaS instances usually cannot set `faas.trigger`, - // since they would typically need to look in the payload to determine - // the event type. If clients set it, it should be the same as the - // trigger that corresponding incoming would have (i.e., this has - // nothing to do with the underlying transport used to make the API - // call to invoke the lambda, which is often HTTP). - FaaSTriggerKey = attribute.Key("faas.trigger") - - // FaaSExecutionKey is the attribute Key conforming to the "faas.execution" - // semantic conventions. It represents the execution ID of the current - // function execution. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' - FaaSExecutionKey = attribute.Key("faas.execution") -) - -var ( - // A response to some data source operation such as a database or filesystem read/write - FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") - // To provide an answer to an inbound HTTP request - FaaSTriggerHTTP = FaaSTriggerKey.String("http") - // A function is set to be executed when messages are sent to a messaging system - FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") - // A function is scheduled to be executed regularly - FaaSTriggerTimer = FaaSTriggerKey.String("timer") - // If none of the others apply - FaaSTriggerOther = FaaSTriggerKey.String("other") -) - -// FaaSExecution returns an attribute KeyValue conforming to the -// "faas.execution" semantic conventions. It represents the execution ID of the -// current function execution. -func FaaSExecution(val string) attribute.KeyValue { - return FaaSExecutionKey.String(val) -} - -// Semantic Convention for FaaS triggered as a response to some data source -// operation such as a database or filesystem read/write. -const ( - // FaaSDocumentCollectionKey is the attribute Key conforming to the - // "faas.document.collection" semantic conventions. It represents the name - // of the source on which the triggering operation was performed. For - // example, in Cloud Storage or S3 corresponds to the bucket name, and in - // Cosmos DB to the database name. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'myBucketName', 'myDBName' - FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") - - // FaaSDocumentOperationKey is the attribute Key conforming to the - // "faas.document.operation" semantic conventions. It represents the - // describes the type of the operation that was performed on the data. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - FaaSDocumentOperationKey = attribute.Key("faas.document.operation") - - // FaaSDocumentTimeKey is the attribute Key conforming to the - // "faas.document.time" semantic conventions. It represents a string - // containing the time when the data was accessed in the [ISO - // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format - // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '2020-01-23T13:47:06Z' - FaaSDocumentTimeKey = attribute.Key("faas.document.time") - - // FaaSDocumentNameKey is the attribute Key conforming to the - // "faas.document.name" semantic conventions. It represents the document - // name/table subjected to the operation. For example, in Cloud Storage or - // S3 is the name of the file, and in Cosmos DB the table name. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'myFile.txt', 'myTableName' - FaaSDocumentNameKey = attribute.Key("faas.document.name") -) - -var ( - // When a new object is created - FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") - // When an object is modified - FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") - // When an object is deleted - FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") -) - -// FaaSDocumentCollection returns an attribute KeyValue conforming to the -// "faas.document.collection" semantic conventions. It represents the name of -// the source on which the triggering operation was performed. For example, in -// Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the -// database name. -func FaaSDocumentCollection(val string) attribute.KeyValue { - return FaaSDocumentCollectionKey.String(val) -} - -// FaaSDocumentTime returns an attribute KeyValue conforming to the -// "faas.document.time" semantic conventions. It represents a string containing -// the time when the data was accessed in the [ISO -// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format -// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). -func FaaSDocumentTime(val string) attribute.KeyValue { - return FaaSDocumentTimeKey.String(val) -} - -// FaaSDocumentName returns an attribute KeyValue conforming to the -// "faas.document.name" semantic conventions. It represents the document -// name/table subjected to the operation. For example, in Cloud Storage or S3 -// is the name of the file, and in Cosmos DB the table name. -func FaaSDocumentName(val string) attribute.KeyValue { - return FaaSDocumentNameKey.String(val) -} - -// Semantic Convention for FaaS scheduled to be executed regularly. -const ( - // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic - // conventions. It represents a string containing the function invocation - // time in the [ISO - // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format - // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '2020-01-23T13:47:06Z' - FaaSTimeKey = attribute.Key("faas.time") - - // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic - // conventions. It represents a string containing the schedule period as - // [Cron - // Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '0/5 * * * ? *' - FaaSCronKey = attribute.Key("faas.cron") -) - -// FaaSTime returns an attribute KeyValue conforming to the "faas.time" -// semantic conventions. It represents a string containing the function -// invocation time in the [ISO -// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format -// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). -func FaaSTime(val string) attribute.KeyValue { - return FaaSTimeKey.String(val) -} - -// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" -// semantic conventions. It represents a string containing the schedule period -// as [Cron -// Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). -func FaaSCron(val string) attribute.KeyValue { - return FaaSCronKey.String(val) -} - -// Contains additional attributes for incoming FaaS spans. -const ( - // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" - // semantic conventions. It represents a boolean that is true if the - // serverless function is executed for the first time (aka cold-start). - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - FaaSColdstartKey = attribute.Key("faas.coldstart") -) - -// FaaSColdstart returns an attribute KeyValue conforming to the -// "faas.coldstart" semantic conventions. It represents a boolean that is true -// if the serverless function is executed for the first time (aka cold-start). -func FaaSColdstart(val bool) attribute.KeyValue { - return FaaSColdstartKey.Bool(val) -} - -// Contains additional attributes for outgoing FaaS spans. -const ( - // FaaSInvokedNameKey is the attribute Key conforming to the - // "faas.invoked_name" semantic conventions. It represents the name of the - // invoked function. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'my-function' - // Note: SHOULD be equal to the `faas.name` resource attribute of the - // invoked function. - FaaSInvokedNameKey = attribute.Key("faas.invoked_name") - - // FaaSInvokedProviderKey is the attribute Key conforming to the - // "faas.invoked_provider" semantic conventions. It represents the cloud - // provider of the invoked function. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - // Note: SHOULD be equal to the `cloud.provider` resource attribute of the - // invoked function. - FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") - - // FaaSInvokedRegionKey is the attribute Key conforming to the - // "faas.invoked_region" semantic conventions. It represents the cloud - // region of the invoked function. - // - // Type: string - // RequirementLevel: ConditionallyRequired (For some cloud providers, like - // AWS or GCP, the region in which a function is hosted is essential to - // uniquely identify the function and also part of its endpoint. Since it's - // part of the endpoint being called, the region is always known to - // clients. In these cases, `faas.invoked_region` MUST be set accordingly. - // If the region is unknown to the client or not required for identifying - // the invoked function, setting `faas.invoked_region` is optional.) - // Stability: stable - // Examples: 'eu-central-1' - // Note: SHOULD be equal to the `cloud.region` resource attribute of the - // invoked function. - FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") -) - -var ( - // Alibaba Cloud - FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") - // Amazon Web Services - FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") - // Microsoft Azure - FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") - // Google Cloud Platform - FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") - // Tencent Cloud - FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") -) - -// FaaSInvokedName returns an attribute KeyValue conforming to the -// "faas.invoked_name" semantic conventions. It represents the name of the -// invoked function. -func FaaSInvokedName(val string) attribute.KeyValue { - return FaaSInvokedNameKey.String(val) -} - -// FaaSInvokedRegion returns an attribute KeyValue conforming to the -// "faas.invoked_region" semantic conventions. It represents the cloud region -// of the invoked function. -func FaaSInvokedRegion(val string) attribute.KeyValue { - return FaaSInvokedRegionKey.String(val) -} - -// These attributes may be used for any network related operation. -const ( - // NetTransportKey is the attribute Key conforming to the "net.transport" - // semantic conventions. It represents the transport protocol used. See - // note below. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - NetTransportKey = attribute.Key("net.transport") - - // NetAppProtocolNameKey is the attribute Key conforming to the - // "net.app.protocol.name" semantic conventions. It represents the - // application layer protocol used. The value SHOULD be normalized to - // lowercase. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'amqp', 'http', 'mqtt' - NetAppProtocolNameKey = attribute.Key("net.app.protocol.name") - - // NetAppProtocolVersionKey is the attribute Key conforming to the - // "net.app.protocol.version" semantic conventions. It represents the - // version of the application layer protocol used. See note below. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '3.1.1' - // Note: `net.app.protocol.version` refers to the version of the protocol - // used and might be different from the protocol client's version. If the - // HTTP client used has a version of `0.27.2`, but sends HTTP version - // `1.1`, this attribute should be set to `1.1`. - NetAppProtocolVersionKey = attribute.Key("net.app.protocol.version") - - // NetSockPeerNameKey is the attribute Key conforming to the - // "net.sock.peer.name" semantic conventions. It represents the remote - // socket peer name. - // - // Type: string - // RequirementLevel: Recommended (If available and different from - // `net.peer.name` and if `net.sock.peer.addr` is set.) - // Stability: stable - // Examples: 'proxy.example.com' - NetSockPeerNameKey = attribute.Key("net.sock.peer.name") - - // NetSockPeerAddrKey is the attribute Key conforming to the - // "net.sock.peer.addr" semantic conventions. It represents the remote - // socket peer address: IPv4 or IPv6 for internet protocols, path for local - // communication, - // [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '127.0.0.1', '/tmp/mysql.sock' - NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") - - // NetSockPeerPortKey is the attribute Key conforming to the - // "net.sock.peer.port" semantic conventions. It represents the remote - // socket peer port. - // - // Type: int - // RequirementLevel: Recommended (If defined for the address family and if - // different than `net.peer.port` and if `net.sock.peer.addr` is set.) - // Stability: stable - // Examples: 16456 - NetSockPeerPortKey = attribute.Key("net.sock.peer.port") - - // NetSockFamilyKey is the attribute Key conforming to the - // "net.sock.family" semantic conventions. It represents the protocol - // [address - // family](https://man7.org/linux/man-pages/man7/address_families.7.html) - // which is used for communication. - // - // Type: Enum - // RequirementLevel: ConditionallyRequired (If different than `inet` and if - // any of `net.sock.peer.addr` or `net.sock.host.addr` are set. Consumers - // of telemetry SHOULD accept both IPv4 and IPv6 formats for the address in - // `net.sock.peer.addr` if `net.sock.family` is not set. This is to support - // instrumentations that follow previous versions of this document.) - // Stability: stable - // Examples: 'inet6', 'bluetooth' - NetSockFamilyKey = attribute.Key("net.sock.family") - - // NetPeerNameKey is the attribute Key conforming to the "net.peer.name" - // semantic conventions. It represents the logical remote hostname, see - // note below. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'example.com' - // Note: `net.peer.name` SHOULD NOT be set if capturing it would require an - // extra DNS lookup. - NetPeerNameKey = attribute.Key("net.peer.name") - - // NetPeerPortKey is the attribute Key conforming to the "net.peer.port" - // semantic conventions. It represents the logical remote port number - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 80, 8080, 443 - NetPeerPortKey = attribute.Key("net.peer.port") - - // NetHostNameKey is the attribute Key conforming to the "net.host.name" - // semantic conventions. It represents the logical local hostname or - // similar, see note below. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'localhost' - NetHostNameKey = attribute.Key("net.host.name") - - // NetHostPortKey is the attribute Key conforming to the "net.host.port" - // semantic conventions. It represents the logical local port number, - // preferably the one that the peer used to connect - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 8080 - NetHostPortKey = attribute.Key("net.host.port") - - // NetSockHostAddrKey is the attribute Key conforming to the - // "net.sock.host.addr" semantic conventions. It represents the local - // socket address. Useful in case of a multi-IP host. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '192.168.0.1' - NetSockHostAddrKey = attribute.Key("net.sock.host.addr") - - // NetSockHostPortKey is the attribute Key conforming to the - // "net.sock.host.port" semantic conventions. It represents the local - // socket port number. - // - // Type: int - // RequirementLevel: Recommended (If defined for the address family and if - // different than `net.host.port` and if `net.sock.host.addr` is set.) - // Stability: stable - // Examples: 35555 - NetSockHostPortKey = attribute.Key("net.sock.host.port") - - // NetHostConnectionTypeKey is the attribute Key conforming to the - // "net.host.connection.type" semantic conventions. It represents the - // internet connection type currently being used by the host. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'wifi' - NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") - - // NetHostConnectionSubtypeKey is the attribute Key conforming to the - // "net.host.connection.subtype" semantic conventions. It represents the - // this describes more details regarding the connection.type. It may be the - // type of cell technology connection, but it could be used for describing - // details about a wifi connection. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'LTE' - NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") - - // NetHostCarrierNameKey is the attribute Key conforming to the - // "net.host.carrier.name" semantic conventions. It represents the name of - // the mobile carrier. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'sprint' - NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") - - // NetHostCarrierMccKey is the attribute Key conforming to the - // "net.host.carrier.mcc" semantic conventions. It represents the mobile - // carrier country code. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '310' - NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") - - // NetHostCarrierMncKey is the attribute Key conforming to the - // "net.host.carrier.mnc" semantic conventions. It represents the mobile - // carrier network code. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '001' - NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") - - // NetHostCarrierIccKey is the attribute Key conforming to the - // "net.host.carrier.icc" semantic conventions. It represents the ISO - // 3166-1 alpha-2 2-character country code associated with the mobile - // carrier network. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'DE' - NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") -) - -var ( - // ip_tcp - NetTransportTCP = NetTransportKey.String("ip_tcp") - // ip_udp - NetTransportUDP = NetTransportKey.String("ip_udp") - // Named or anonymous pipe. See note below - NetTransportPipe = NetTransportKey.String("pipe") - // In-process communication - NetTransportInProc = NetTransportKey.String("inproc") - // Something else (non IP-based) - NetTransportOther = NetTransportKey.String("other") -) - -var ( - // IPv4 address - NetSockFamilyInet = NetSockFamilyKey.String("inet") - // IPv6 address - NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") - // Unix domain socket path - NetSockFamilyUnix = NetSockFamilyKey.String("unix") -) - -var ( - // wifi - NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") - // wired - NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") - // cell - NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") - // unavailable - NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") - // unknown - NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") -) - -var ( - // GPRS - NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") - // EDGE - NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") - // UMTS - NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") - // CDMA - NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") - // EVDO Rel. 0 - NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") - // EVDO Rev. A - NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") - // CDMA2000 1XRTT - NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") - // HSDPA - NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") - // HSUPA - NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") - // HSPA - NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") - // IDEN - NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") - // EVDO Rev. B - NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") - // LTE - NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") - // EHRPD - NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") - // HSPAP - NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") - // GSM - NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") - // TD-SCDMA - NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") - // IWLAN - NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") - // 5G NR (New Radio) - NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") - // 5G NRNSA (New Radio Non-Standalone) - NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") - // LTE CA - NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") -) - -// NetAppProtocolName returns an attribute KeyValue conforming to the -// "net.app.protocol.name" semantic conventions. It represents the application -// layer protocol used. The value SHOULD be normalized to lowercase. -func NetAppProtocolName(val string) attribute.KeyValue { - return NetAppProtocolNameKey.String(val) -} - -// NetAppProtocolVersion returns an attribute KeyValue conforming to the -// "net.app.protocol.version" semantic conventions. It represents the version -// of the application layer protocol used. See note below. -func NetAppProtocolVersion(val string) attribute.KeyValue { - return NetAppProtocolVersionKey.String(val) -} - -// NetSockPeerName returns an attribute KeyValue conforming to the -// "net.sock.peer.name" semantic conventions. It represents the remote socket -// peer name. -func NetSockPeerName(val string) attribute.KeyValue { - return NetSockPeerNameKey.String(val) -} - -// NetSockPeerAddr returns an attribute KeyValue conforming to the -// "net.sock.peer.addr" semantic conventions. It represents the remote socket -// peer address: IPv4 or IPv6 for internet protocols, path for local -// communication, -// [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). -func NetSockPeerAddr(val string) attribute.KeyValue { - return NetSockPeerAddrKey.String(val) -} - -// NetSockPeerPort returns an attribute KeyValue conforming to the -// "net.sock.peer.port" semantic conventions. It represents the remote socket -// peer port. -func NetSockPeerPort(val int) attribute.KeyValue { - return NetSockPeerPortKey.Int(val) -} - -// NetPeerName returns an attribute KeyValue conforming to the -// "net.peer.name" semantic conventions. It represents the logical remote -// hostname, see note below. -func NetPeerName(val string) attribute.KeyValue { - return NetPeerNameKey.String(val) -} - -// NetPeerPort returns an attribute KeyValue conforming to the -// "net.peer.port" semantic conventions. It represents the logical remote port -// number -func NetPeerPort(val int) attribute.KeyValue { - return NetPeerPortKey.Int(val) -} - -// NetHostName returns an attribute KeyValue conforming to the -// "net.host.name" semantic conventions. It represents the logical local -// hostname or similar, see note below. -func NetHostName(val string) attribute.KeyValue { - return NetHostNameKey.String(val) -} - -// NetHostPort returns an attribute KeyValue conforming to the -// "net.host.port" semantic conventions. It represents the logical local port -// number, preferably the one that the peer used to connect -func NetHostPort(val int) attribute.KeyValue { - return NetHostPortKey.Int(val) -} - -// NetSockHostAddr returns an attribute KeyValue conforming to the -// "net.sock.host.addr" semantic conventions. It represents the local socket -// address. Useful in case of a multi-IP host. -func NetSockHostAddr(val string) attribute.KeyValue { - return NetSockHostAddrKey.String(val) -} - -// NetSockHostPort returns an attribute KeyValue conforming to the -// "net.sock.host.port" semantic conventions. It represents the local socket -// port number. -func NetSockHostPort(val int) attribute.KeyValue { - return NetSockHostPortKey.Int(val) -} - -// NetHostCarrierName returns an attribute KeyValue conforming to the -// "net.host.carrier.name" semantic conventions. It represents the name of the -// mobile carrier. -func NetHostCarrierName(val string) attribute.KeyValue { - return NetHostCarrierNameKey.String(val) -} - -// NetHostCarrierMcc returns an attribute KeyValue conforming to the -// "net.host.carrier.mcc" semantic conventions. It represents the mobile -// carrier country code. -func NetHostCarrierMcc(val string) attribute.KeyValue { - return NetHostCarrierMccKey.String(val) -} - -// NetHostCarrierMnc returns an attribute KeyValue conforming to the -// "net.host.carrier.mnc" semantic conventions. It represents the mobile -// carrier network code. -func NetHostCarrierMnc(val string) attribute.KeyValue { - return NetHostCarrierMncKey.String(val) -} - -// NetHostCarrierIcc returns an attribute KeyValue conforming to the -// "net.host.carrier.icc" semantic conventions. It represents the ISO 3166-1 -// alpha-2 2-character country code associated with the mobile carrier network. -func NetHostCarrierIcc(val string) attribute.KeyValue { - return NetHostCarrierIccKey.String(val) -} - -// Operations that access some remote service. -const ( - // PeerServiceKey is the attribute Key conforming to the "peer.service" - // semantic conventions. It represents the - // [`service.name`](../../resource/semantic_conventions/README.md#service) - // of the remote service. SHOULD be equal to the actual `service.name` - // resource attribute of the remote service if any. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'AuthTokenCache' - PeerServiceKey = attribute.Key("peer.service") -) - -// PeerService returns an attribute KeyValue conforming to the -// "peer.service" semantic conventions. It represents the -// [`service.name`](../../resource/semantic_conventions/README.md#service) of -// the remote service. SHOULD be equal to the actual `service.name` resource -// attribute of the remote service if any. -func PeerService(val string) attribute.KeyValue { - return PeerServiceKey.String(val) -} - -// These attributes may be used for any operation with an authenticated and/or -// authorized enduser. -const ( - // EnduserIDKey is the attribute Key conforming to the "enduser.id" - // semantic conventions. It represents the username or client_id extracted - // from the access token or - // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header - // in the inbound request from outside the system. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'username' - EnduserIDKey = attribute.Key("enduser.id") - - // EnduserRoleKey is the attribute Key conforming to the "enduser.role" - // semantic conventions. It represents the actual/assumed role the client - // is making the request under extracted from token or application security - // context. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'admin' - EnduserRoleKey = attribute.Key("enduser.role") - - // EnduserScopeKey is the attribute Key conforming to the "enduser.scope" - // semantic conventions. It represents the scopes or granted authorities - // the client currently possesses extracted from token or application - // security context. The value would come from the scope associated with an - // [OAuth 2.0 Access - // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute - // value in a [SAML 2.0 - // Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'read:message, write:files' - EnduserScopeKey = attribute.Key("enduser.scope") -) - -// EnduserID returns an attribute KeyValue conforming to the "enduser.id" -// semantic conventions. It represents the username or client_id extracted from -// the access token or -// [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in -// the inbound request from outside the system. -func EnduserID(val string) attribute.KeyValue { - return EnduserIDKey.String(val) -} - -// EnduserRole returns an attribute KeyValue conforming to the -// "enduser.role" semantic conventions. It represents the actual/assumed role -// the client is making the request under extracted from token or application -// security context. -func EnduserRole(val string) attribute.KeyValue { - return EnduserRoleKey.String(val) -} - -// EnduserScope returns an attribute KeyValue conforming to the -// "enduser.scope" semantic conventions. It represents the scopes or granted -// authorities the client currently possesses extracted from token or -// application security context. The value would come from the scope associated -// with an [OAuth 2.0 Access -// Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute -// value in a [SAML 2.0 -// Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). -func EnduserScope(val string) attribute.KeyValue { - return EnduserScopeKey.String(val) -} - -// These attributes may be used for any operation to store information about a -// thread that started a span. -const ( - // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic - // conventions. It represents the current "managed" thread ID (as opposed - // to OS thread ID). - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 42 - ThreadIDKey = attribute.Key("thread.id") - - // ThreadNameKey is the attribute Key conforming to the "thread.name" - // semantic conventions. It represents the current thread name. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'main' - ThreadNameKey = attribute.Key("thread.name") -) - -// ThreadID returns an attribute KeyValue conforming to the "thread.id" -// semantic conventions. It represents the current "managed" thread ID (as -// opposed to OS thread ID). -func ThreadID(val int) attribute.KeyValue { - return ThreadIDKey.Int(val) -} - -// ThreadName returns an attribute KeyValue conforming to the "thread.name" -// semantic conventions. It represents the current thread name. -func ThreadName(val string) attribute.KeyValue { - return ThreadNameKey.String(val) -} - -// These attributes allow to report this unit of code and therefore to provide -// more context about the span. -const ( - // CodeFunctionKey is the attribute Key conforming to the "code.function" - // semantic conventions. It represents the method or function name, or - // equivalent (usually rightmost part of the code unit's name). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'serveRequest' - CodeFunctionKey = attribute.Key("code.function") - - // CodeNamespaceKey is the attribute Key conforming to the "code.namespace" - // semantic conventions. It represents the "namespace" within which - // `code.function` is defined. Usually the qualified class or module name, - // such that `code.namespace` + some separator + `code.function` form a - // unique identifier for the code unit. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'com.example.MyHTTPService' - CodeNamespaceKey = attribute.Key("code.namespace") - - // CodeFilepathKey is the attribute Key conforming to the "code.filepath" - // semantic conventions. It represents the source code file name that - // identifies the code unit as uniquely as possible (preferably an absolute - // file path). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '/usr/local/MyApplication/content_root/app/index.php' - CodeFilepathKey = attribute.Key("code.filepath") - - // CodeLineNumberKey is the attribute Key conforming to the "code.lineno" - // semantic conventions. It represents the line number in `code.filepath` - // best representing the operation. It SHOULD point within the code unit - // named in `code.function`. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 42 - CodeLineNumberKey = attribute.Key("code.lineno") - - // CodeColumnKey is the attribute Key conforming to the "code.column" - // semantic conventions. It represents the column number in `code.filepath` - // best representing the operation. It SHOULD point within the code unit - // named in `code.function`. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 16 - CodeColumnKey = attribute.Key("code.column") -) - -// CodeFunction returns an attribute KeyValue conforming to the -// "code.function" semantic conventions. It represents the method or function -// name, or equivalent (usually rightmost part of the code unit's name). -func CodeFunction(val string) attribute.KeyValue { - return CodeFunctionKey.String(val) -} - -// CodeNamespace returns an attribute KeyValue conforming to the -// "code.namespace" semantic conventions. It represents the "namespace" within -// which `code.function` is defined. Usually the qualified class or module -// name, such that `code.namespace` + some separator + `code.function` form a -// unique identifier for the code unit. -func CodeNamespace(val string) attribute.KeyValue { - return CodeNamespaceKey.String(val) -} - -// CodeFilepath returns an attribute KeyValue conforming to the -// "code.filepath" semantic conventions. It represents the source code file -// name that identifies the code unit as uniquely as possible (preferably an -// absolute file path). -func CodeFilepath(val string) attribute.KeyValue { - return CodeFilepathKey.String(val) -} - -// CodeLineNumber returns an attribute KeyValue conforming to the "code.lineno" -// semantic conventions. It represents the line number in `code.filepath` best -// representing the operation. It SHOULD point within the code unit named in -// `code.function`. -func CodeLineNumber(val int) attribute.KeyValue { - return CodeLineNumberKey.Int(val) -} - -// CodeColumn returns an attribute KeyValue conforming to the "code.column" -// semantic conventions. It represents the column number in `code.filepath` -// best representing the operation. It SHOULD point within the code unit named -// in `code.function`. -func CodeColumn(val int) attribute.KeyValue { - return CodeColumnKey.Int(val) -} - -// Semantic conventions for HTTP client and server Spans. -const ( - // HTTPMethodKey is the attribute Key conforming to the "http.method" - // semantic conventions. It represents the hTTP request method. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'GET', 'POST', 'HEAD' - HTTPMethodKey = attribute.Key("http.method") - - // HTTPStatusCodeKey is the attribute Key conforming to the - // "http.status_code" semantic conventions. It represents the [HTTP - // response status code](https://tools.ietf.org/html/rfc7231#section-6). - // - // Type: int - // RequirementLevel: ConditionallyRequired (If and only if one was - // received/sent.) - // Stability: stable - // Examples: 200 - HTTPStatusCodeKey = attribute.Key("http.status_code") - - // HTTPFlavorKey is the attribute Key conforming to the "http.flavor" - // semantic conventions. It represents the kind of HTTP protocol used. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Note: If `net.transport` is not specified, it can be assumed to be - // `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is - // assumed. - HTTPFlavorKey = attribute.Key("http.flavor") - - // HTTPUserAgentKey is the attribute Key conforming to the - // "http.user_agent" semantic conventions. It represents the value of the - // [HTTP - // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) - // header sent by the client. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' - HTTPUserAgentKey = attribute.Key("http.user_agent") - - // HTTPRequestContentLengthKey is the attribute Key conforming to the - // "http.request_content_length" semantic conventions. It represents the - // size of the request payload body in bytes. This is the number of bytes - // transferred excluding headers and is often, but not always, present as - // the - // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) - // header. For requests using transport encoding, this should be the - // compressed size. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 3495 - HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") - - // HTTPResponseContentLengthKey is the attribute Key conforming to the - // "http.response_content_length" semantic conventions. It represents the - // size of the response payload body in bytes. This is the number of bytes - // transferred excluding headers and is often, but not always, present as - // the - // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) - // header. For requests using transport encoding, this should be the - // compressed size. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 3495 - HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") -) - -var ( - // HTTP/1.0 - HTTPFlavorHTTP10 = HTTPFlavorKey.String("1.0") - // HTTP/1.1 - HTTPFlavorHTTP11 = HTTPFlavorKey.String("1.1") - // HTTP/2 - HTTPFlavorHTTP20 = HTTPFlavorKey.String("2.0") - // HTTP/3 - HTTPFlavorHTTP30 = HTTPFlavorKey.String("3.0") - // SPDY protocol - HTTPFlavorSPDY = HTTPFlavorKey.String("SPDY") - // QUIC protocol - HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC") -) - -// HTTPMethod returns an attribute KeyValue conforming to the "http.method" -// semantic conventions. It represents the hTTP request method. -func HTTPMethod(val string) attribute.KeyValue { - return HTTPMethodKey.String(val) -} - -// HTTPStatusCode returns an attribute KeyValue conforming to the -// "http.status_code" semantic conventions. It represents the [HTTP response -// status code](https://tools.ietf.org/html/rfc7231#section-6). -func HTTPStatusCode(val int) attribute.KeyValue { - return HTTPStatusCodeKey.Int(val) -} - -// HTTPUserAgent returns an attribute KeyValue conforming to the -// "http.user_agent" semantic conventions. It represents the value of the [HTTP -// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) -// header sent by the client. -func HTTPUserAgent(val string) attribute.KeyValue { - return HTTPUserAgentKey.String(val) -} - -// HTTPRequestContentLength returns an attribute KeyValue conforming to the -// "http.request_content_length" semantic conventions. It represents the size -// of the request payload body in bytes. This is the number of bytes -// transferred excluding headers and is often, but not always, present as the -// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) -// header. For requests using transport encoding, this should be the compressed -// size. -func HTTPRequestContentLength(val int) attribute.KeyValue { - return HTTPRequestContentLengthKey.Int(val) -} - -// HTTPResponseContentLength returns an attribute KeyValue conforming to the -// "http.response_content_length" semantic conventions. It represents the size -// of the response payload body in bytes. This is the number of bytes -// transferred excluding headers and is often, but not always, present as the -// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) -// header. For requests using transport encoding, this should be the compressed -// size. -func HTTPResponseContentLength(val int) attribute.KeyValue { - return HTTPResponseContentLengthKey.Int(val) -} - -// Semantic Convention for HTTP Client -const ( - // HTTPURLKey is the attribute Key conforming to the "http.url" semantic - // conventions. It represents the full HTTP request URL in the form - // `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is - // not transmitted over HTTP, but if it is known, it should be included - // nevertheless. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' - // Note: `http.url` MUST NOT contain credentials passed via URL in form of - // `https://username:password@www.example.com/`. In such case the - // attribute's value should be `https://www.example.com/`. - HTTPURLKey = attribute.Key("http.url") - - // HTTPResendCountKey is the attribute Key conforming to the - // "http.resend_count" semantic conventions. It represents the ordinal - // number of request resending attempt (for any reason, including - // redirects). - // - // Type: int - // RequirementLevel: Recommended (if and only if request was retried.) - // Stability: stable - // Examples: 3 - // Note: The resend count SHOULD be updated each time an HTTP request gets - // resent by the client, regardless of what was the cause of the resending - // (e.g. redirection, authorization failure, 503 Server Unavailable, - // network issues, or any other). - HTTPResendCountKey = attribute.Key("http.resend_count") -) - -// HTTPURL returns an attribute KeyValue conforming to the "http.url" -// semantic conventions. It represents the full HTTP request URL in the form -// `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not -// transmitted over HTTP, but if it is known, it should be included -// nevertheless. -func HTTPURL(val string) attribute.KeyValue { - return HTTPURLKey.String(val) -} - -// HTTPResendCount returns an attribute KeyValue conforming to the -// "http.resend_count" semantic conventions. It represents the ordinal number -// of request resending attempt (for any reason, including redirects). -func HTTPResendCount(val int) attribute.KeyValue { - return HTTPResendCountKey.Int(val) -} - -// Semantic Convention for HTTP Server -const ( - // HTTPSchemeKey is the attribute Key conforming to the "http.scheme" - // semantic conventions. It represents the URI scheme identifying the used - // protocol. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'http', 'https' - HTTPSchemeKey = attribute.Key("http.scheme") - - // HTTPTargetKey is the attribute Key conforming to the "http.target" - // semantic conventions. It represents the full request target as passed in - // a HTTP request line or equivalent. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: '/path/12314/?q=ddds' - HTTPTargetKey = attribute.Key("http.target") - - // HTTPRouteKey is the attribute Key conforming to the "http.route" - // semantic conventions. It represents the matched route (path template in - // the format used by the respective server framework). See note below - // - // Type: string - // RequirementLevel: ConditionallyRequired (If and only if it's available) - // Stability: stable - // Examples: '/users/:userID?', '{controller}/{action}/{id?}' - // Note: 'http.route' MUST NOT be populated when this is not supported by - // the HTTP server framework as the route attribute should have - // low-cardinality and the URI path can NOT substitute it. - HTTPRouteKey = attribute.Key("http.route") - - // HTTPClientIPKey is the attribute Key conforming to the "http.client_ip" - // semantic conventions. It represents the IP address of the original - // client behind all proxies, if known (e.g. from - // [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '83.164.160.102' - // Note: This is not necessarily the same as `net.sock.peer.addr`, which - // would - // identify the network-level peer, which may be a proxy. - // - // This attribute should be set when a source of information different - // from the one used for `net.sock.peer.addr`, is available even if that - // other - // source just confirms the same value as `net.sock.peer.addr`. - // Rationale: For `net.sock.peer.addr`, one typically does not know if it - // comes from a proxy, reverse proxy, or the actual client. Setting - // `http.client_ip` when it's the same as `net.sock.peer.addr` means that - // one is at least somewhat confident that the address is not that of - // the closest proxy. - HTTPClientIPKey = attribute.Key("http.client_ip") -) - -// HTTPScheme returns an attribute KeyValue conforming to the "http.scheme" -// semantic conventions. It represents the URI scheme identifying the used -// protocol. -func HTTPScheme(val string) attribute.KeyValue { - return HTTPSchemeKey.String(val) -} - -// HTTPTarget returns an attribute KeyValue conforming to the "http.target" -// semantic conventions. It represents the full request target as passed in a -// HTTP request line or equivalent. -func HTTPTarget(val string) attribute.KeyValue { - return HTTPTargetKey.String(val) -} - -// HTTPRoute returns an attribute KeyValue conforming to the "http.route" -// semantic conventions. It represents the matched route (path template in the -// format used by the respective server framework). See note below -func HTTPRoute(val string) attribute.KeyValue { - return HTTPRouteKey.String(val) -} - -// HTTPClientIP returns an attribute KeyValue conforming to the -// "http.client_ip" semantic conventions. It represents the IP address of the -// original client behind all proxies, if known (e.g. from -// [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). -func HTTPClientIP(val string) attribute.KeyValue { - return HTTPClientIPKey.String(val) -} - -// Attributes that exist for multiple DynamoDB request types. -const ( - // AWSDynamoDBTableNamesKey is the attribute Key conforming to the - // "aws.dynamodb.table_names" semantic conventions. It represents the keys - // in the `RequestItems` object field. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Users', 'Cats' - AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") - - // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the - // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the - // JSON-serialized value of each item in the `ConsumedCapacity` response - // field. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { - // "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, - // "WriteCapacityUnits": number } }, "LocalSecondaryIndexes": { "string" : - // { "CapacityUnits": number, "ReadCapacityUnits": number, - // "WriteCapacityUnits": number } }, "ReadCapacityUnits": number, "Table": - // { "CapacityUnits": number, "ReadCapacityUnits": number, - // "WriteCapacityUnits": number }, "TableName": "string", - // "WriteCapacityUnits": number }' - AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") - - // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to - // the "aws.dynamodb.item_collection_metrics" semantic conventions. It - // represents the JSON-serialized value of the `ItemCollectionMetrics` - // response field. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": - // blob, "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { - // "string" : "AttributeValue" }, "N": "string", "NS": [ "string" ], - // "NULL": boolean, "S": "string", "SS": [ "string" ] } }, - // "SizeEstimateRangeGB": [ number ] } ] }' - AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") - - // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to - // the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It - // represents the value of the `ProvisionedThroughput.ReadCapacityUnits` - // request parameter. - // - // Type: double - // RequirementLevel: Optional - // Stability: stable - // Examples: 1.0, 2.0 - AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") - - // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming - // to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. - // It represents the value of the - // `ProvisionedThroughput.WriteCapacityUnits` request parameter. - // - // Type: double - // RequirementLevel: Optional - // Stability: stable - // Examples: 1.0, 2.0 - AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") - - // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the - // "aws.dynamodb.consistent_read" semantic conventions. It represents the - // value of the `ConsistentRead` request parameter. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") - - // AWSDynamoDBProjectionKey is the attribute Key conforming to the - // "aws.dynamodb.projection" semantic conventions. It represents the value - // of the `ProjectionExpression` request parameter. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Title', 'Title, Price, Color', 'Title, Description, - // RelatedItems, ProductReviews' - AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") - - // AWSDynamoDBLimitKey is the attribute Key conforming to the - // "aws.dynamodb.limit" semantic conventions. It represents the value of - // the `Limit` request parameter. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 10 - AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") - - // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the - // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the - // value of the `AttributesToGet` request parameter. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: 'lives', 'id' - AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") - - // AWSDynamoDBIndexNameKey is the attribute Key conforming to the - // "aws.dynamodb.index_name" semantic conventions. It represents the value - // of the `IndexName` request parameter. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'name_to_group' - AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") - - // AWSDynamoDBSelectKey is the attribute Key conforming to the - // "aws.dynamodb.select" semantic conventions. It represents the value of - // the `Select` request parameter. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'ALL_ATTRIBUTES', 'COUNT' - AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") -) - -// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the -// "aws.dynamodb.table_names" semantic conventions. It represents the keys in -// the `RequestItems` object field. -func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { - return AWSDynamoDBTableNamesKey.StringSlice(val) -} - -// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to -// the "aws.dynamodb.consumed_capacity" semantic conventions. It represents the -// JSON-serialized value of each item in the `ConsumedCapacity` response field. -func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { - return AWSDynamoDBConsumedCapacityKey.StringSlice(val) -} - -// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming -// to the "aws.dynamodb.item_collection_metrics" semantic conventions. It -// represents the JSON-serialized value of the `ItemCollectionMetrics` response -// field. -func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { - return AWSDynamoDBItemCollectionMetricsKey.String(val) -} - -// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue -// conforming to the "aws.dynamodb.provisioned_read_capacity" semantic -// conventions. It represents the value of the -// `ProvisionedThroughput.ReadCapacityUnits` request parameter. -func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { - return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) -} - -// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue -// conforming to the "aws.dynamodb.provisioned_write_capacity" semantic -// conventions. It represents the value of the -// `ProvisionedThroughput.WriteCapacityUnits` request parameter. -func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { - return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) -} - -// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the -// "aws.dynamodb.consistent_read" semantic conventions. It represents the value -// of the `ConsistentRead` request parameter. -func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { - return AWSDynamoDBConsistentReadKey.Bool(val) -} - -// AWSDynamoDBProjection returns an attribute KeyValue conforming to the -// "aws.dynamodb.projection" semantic conventions. It represents the value of -// the `ProjectionExpression` request parameter. -func AWSDynamoDBProjection(val string) attribute.KeyValue { - return AWSDynamoDBProjectionKey.String(val) -} - -// AWSDynamoDBLimit returns an attribute KeyValue conforming to the -// "aws.dynamodb.limit" semantic conventions. It represents the value of the -// `Limit` request parameter. -func AWSDynamoDBLimit(val int) attribute.KeyValue { - return AWSDynamoDBLimitKey.Int(val) -} - -// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to -// the "aws.dynamodb.attributes_to_get" semantic conventions. It represents the -// value of the `AttributesToGet` request parameter. -func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { - return AWSDynamoDBAttributesToGetKey.StringSlice(val) -} - -// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the -// "aws.dynamodb.index_name" semantic conventions. It represents the value of -// the `IndexName` request parameter. -func AWSDynamoDBIndexName(val string) attribute.KeyValue { - return AWSDynamoDBIndexNameKey.String(val) -} - -// AWSDynamoDBSelect returns an attribute KeyValue conforming to the -// "aws.dynamodb.select" semantic conventions. It represents the value of the -// `Select` request parameter. -func AWSDynamoDBSelect(val string) attribute.KeyValue { - return AWSDynamoDBSelectKey.String(val) -} - -// DynamoDB.CreateTable -const ( - // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to - // the "aws.dynamodb.global_secondary_indexes" semantic conventions. It - // represents the JSON-serialized value of each item of the - // `GlobalSecondaryIndexes` request field - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": - // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ - // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { - // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }' - AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") - - // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to - // the "aws.dynamodb.local_secondary_indexes" semantic conventions. It - // represents the JSON-serialized value of each item of the - // `LocalSecondaryIndexes` request field. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: '{ "IndexARN": "string", "IndexName": "string", - // "IndexSizeBytes": number, "ItemCount": number, "KeySchema": [ { - // "AttributeName": "string", "KeyType": "string" } ], "Projection": { - // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" } }' - AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") -) - -// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue -// conforming to the "aws.dynamodb.global_secondary_indexes" semantic -// conventions. It represents the JSON-serialized value of each item of the -// `GlobalSecondaryIndexes` request field -func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { - return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) -} - -// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming -// to the "aws.dynamodb.local_secondary_indexes" semantic conventions. It -// represents the JSON-serialized value of each item of the -// `LocalSecondaryIndexes` request field. -func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { - return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) -} - -// DynamoDB.ListTables -const ( - // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the - // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents - // the value of the `ExclusiveStartTableName` request parameter. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Users', 'CatsTable' - AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - - // AWSDynamoDBTableCountKey is the attribute Key conforming to the - // "aws.dynamodb.table_count" semantic conventions. It represents the the - // number of items in the `TableNames` response parameter. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 20 - AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") -) - -// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming -// to the "aws.dynamodb.exclusive_start_table" semantic conventions. It -// represents the value of the `ExclusiveStartTableName` request parameter. -func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { - return AWSDynamoDBExclusiveStartTableKey.String(val) -} - -// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the -// "aws.dynamodb.table_count" semantic conventions. It represents the the -// number of items in the `TableNames` response parameter. -func AWSDynamoDBTableCount(val int) attribute.KeyValue { - return AWSDynamoDBTableCountKey.Int(val) -} - -// DynamoDB.Query -const ( - // AWSDynamoDBScanForwardKey is the attribute Key conforming to the - // "aws.dynamodb.scan_forward" semantic conventions. It represents the - // value of the `ScanIndexForward` request parameter. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") -) - -// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the -// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of -// the `ScanIndexForward` request parameter. -func AWSDynamoDBScanForward(val bool) attribute.KeyValue { - return AWSDynamoDBScanForwardKey.Bool(val) -} - -// DynamoDB.Scan -const ( - // AWSDynamoDBSegmentKey is the attribute Key conforming to the - // "aws.dynamodb.segment" semantic conventions. It represents the value of - // the `Segment` request parameter. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 10 - AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") - - // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the - // "aws.dynamodb.total_segments" semantic conventions. It represents the - // value of the `TotalSegments` request parameter. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 100 - AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") - - // AWSDynamoDBCountKey is the attribute Key conforming to the - // "aws.dynamodb.count" semantic conventions. It represents the value of - // the `Count` response parameter. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 10 - AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") - - // AWSDynamoDBScannedCountKey is the attribute Key conforming to the - // "aws.dynamodb.scanned_count" semantic conventions. It represents the - // value of the `ScannedCount` response parameter. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 50 - AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") -) - -// AWSDynamoDBSegment returns an attribute KeyValue conforming to the -// "aws.dynamodb.segment" semantic conventions. It represents the value of the -// `Segment` request parameter. -func AWSDynamoDBSegment(val int) attribute.KeyValue { - return AWSDynamoDBSegmentKey.Int(val) -} - -// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the -// "aws.dynamodb.total_segments" semantic conventions. It represents the value -// of the `TotalSegments` request parameter. -func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { - return AWSDynamoDBTotalSegmentsKey.Int(val) -} - -// AWSDynamoDBCount returns an attribute KeyValue conforming to the -// "aws.dynamodb.count" semantic conventions. It represents the value of the -// `Count` response parameter. -func AWSDynamoDBCount(val int) attribute.KeyValue { - return AWSDynamoDBCountKey.Int(val) -} - -// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the -// "aws.dynamodb.scanned_count" semantic conventions. It represents the value -// of the `ScannedCount` response parameter. -func AWSDynamoDBScannedCount(val int) attribute.KeyValue { - return AWSDynamoDBScannedCountKey.Int(val) -} - -// DynamoDB.UpdateTable -const ( - // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to - // the "aws.dynamodb.attribute_definitions" semantic conventions. It - // represents the JSON-serialized value of each item in the - // `AttributeDefinitions` request field. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' - AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - - // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key - // conforming to the "aws.dynamodb.global_secondary_index_updates" semantic - // conventions. It represents the JSON-serialized value of each item in the - // the `GlobalSecondaryIndexUpdates` request field. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { - // "AttributeName": "string", "KeyType": "string" } ], "Projection": { - // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, - // "ProvisionedThroughput": { "ReadCapacityUnits": number, - // "WriteCapacityUnits": number } }' - AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") -) - -// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming -// to the "aws.dynamodb.attribute_definitions" semantic conventions. It -// represents the JSON-serialized value of each item in the -// `AttributeDefinitions` request field. -func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { - return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) -} - -// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue -// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic -// conventions. It represents the JSON-serialized value of each item in the the -// `GlobalSecondaryIndexUpdates` request field. -func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { - return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) -} - -// Semantic conventions to apply when instrumenting the GraphQL implementation. -// They map GraphQL operations to attributes on a Span. -const ( - // GraphqlOperationNameKey is the attribute Key conforming to the - // "graphql.operation.name" semantic conventions. It represents the name of - // the operation being executed. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'findBookByID' - GraphqlOperationNameKey = attribute.Key("graphql.operation.name") - - // GraphqlOperationTypeKey is the attribute Key conforming to the - // "graphql.operation.type" semantic conventions. It represents the type of - // the operation being executed. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'query', 'mutation', 'subscription' - GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") - - // GraphqlDocumentKey is the attribute Key conforming to the - // "graphql.document" semantic conventions. It represents the GraphQL - // document being executed. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'query findBookByID { bookByID(id: ?) { name } }' - // Note: The value may be sanitized to exclude sensitive information. - GraphqlDocumentKey = attribute.Key("graphql.document") -) - -var ( - // GraphQL query - GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") - // GraphQL mutation - GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") - // GraphQL subscription - GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") -) - -// GraphqlOperationName returns an attribute KeyValue conforming to the -// "graphql.operation.name" semantic conventions. It represents the name of the -// operation being executed. -func GraphqlOperationName(val string) attribute.KeyValue { - return GraphqlOperationNameKey.String(val) -} - -// GraphqlDocument returns an attribute KeyValue conforming to the -// "graphql.document" semantic conventions. It represents the GraphQL document -// being executed. -func GraphqlDocument(val string) attribute.KeyValue { - return GraphqlDocumentKey.String(val) -} - -// Semantic convention describing per-message attributes populated on messaging -// spans or links. -const ( - // MessagingMessageIDKey is the attribute Key conforming to the - // "messaging.message.id" semantic conventions. It represents a value used - // by the messaging system as an identifier for the message, represented as - // a string. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '452a7c7c7c7048c2f887f61572b18fc2' - MessagingMessageIDKey = attribute.Key("messaging.message.id") - - // MessagingMessageConversationIDKey is the attribute Key conforming to the - // "messaging.message.conversation_id" semantic conventions. It represents - // the [conversation ID](#conversations) identifying the conversation to - // which the message belongs, represented as a string. Sometimes called - // "Correlation ID". - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'MyConversationID' - MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") - - // MessagingMessagePayloadSizeBytesKey is the attribute Key conforming to - // the "messaging.message.payload_size_bytes" semantic conventions. It - // represents the (uncompressed) size of the message payload in bytes. Also - // use this attribute if it is unknown whether the compressed or - // uncompressed payload size is reported. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 2738 - MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message.payload_size_bytes") - - // MessagingMessagePayloadCompressedSizeBytesKey is the attribute Key - // conforming to the "messaging.message.payload_compressed_size_bytes" - // semantic conventions. It represents the compressed size of the message - // payload in bytes. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 2048 - MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message.payload_compressed_size_bytes") -) - -// MessagingMessageID returns an attribute KeyValue conforming to the -// "messaging.message.id" semantic conventions. It represents a value used by -// the messaging system as an identifier for the message, represented as a -// string. -func MessagingMessageID(val string) attribute.KeyValue { - return MessagingMessageIDKey.String(val) -} - -// MessagingMessageConversationID returns an attribute KeyValue conforming -// to the "messaging.message.conversation_id" semantic conventions. It -// represents the [conversation ID](#conversations) identifying the -// conversation to which the message belongs, represented as a string. -// Sometimes called "Correlation ID". -func MessagingMessageConversationID(val string) attribute.KeyValue { - return MessagingMessageConversationIDKey.String(val) -} - -// MessagingMessagePayloadSizeBytes returns an attribute KeyValue conforming -// to the "messaging.message.payload_size_bytes" semantic conventions. It -// represents the (uncompressed) size of the message payload in bytes. Also use -// this attribute if it is unknown whether the compressed or uncompressed -// payload size is reported. -func MessagingMessagePayloadSizeBytes(val int) attribute.KeyValue { - return MessagingMessagePayloadSizeBytesKey.Int(val) -} - -// MessagingMessagePayloadCompressedSizeBytes returns an attribute KeyValue -// conforming to the "messaging.message.payload_compressed_size_bytes" semantic -// conventions. It represents the compressed size of the message payload in -// bytes. -func MessagingMessagePayloadCompressedSizeBytes(val int) attribute.KeyValue { - return MessagingMessagePayloadCompressedSizeBytesKey.Int(val) -} - -// Semantic convention for attributes that describe messaging destination on -// broker -const ( - // MessagingDestinationNameKey is the attribute Key conforming to the - // "messaging.destination.name" semantic conventions. It represents the - // message destination name - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'MyQueue', 'MyTopic' - // Note: Destination name SHOULD uniquely identify a specific queue, topic - // or other entity within the broker. If - // the broker does not have such notion, the destination name SHOULD - // uniquely identify the broker. - MessagingDestinationNameKey = attribute.Key("messaging.destination.name") - - // MessagingDestinationKindKey is the attribute Key conforming to the - // "messaging.destination.kind" semantic conventions. It represents the - // kind of message destination - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - MessagingDestinationKindKey = attribute.Key("messaging.destination.kind") - - // MessagingDestinationTemplateKey is the attribute Key conforming to the - // "messaging.destination.template" semantic conventions. It represents the - // low cardinality representation of the messaging destination name - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '/customers/{customerID}' - // Note: Destination names could be constructed from templates. An example - // would be a destination name involving a user name or product id. - // Although the destination name in this case is of high cardinality, the - // underlying template is of low cardinality and can be effectively used - // for grouping and aggregation. - MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") - - // MessagingDestinationTemporaryKey is the attribute Key conforming to the - // "messaging.destination.temporary" semantic conventions. It represents a - // boolean that is true if the message destination is temporary and might - // not exist anymore after messages are processed. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") - - // MessagingDestinationAnonymousKey is the attribute Key conforming to the - // "messaging.destination.anonymous" semantic conventions. It represents a - // boolean that is true if the message destination is anonymous (could be - // unnamed or have auto-generated name). - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") -) - -var ( - // A message sent to a queue - MessagingDestinationKindQueue = MessagingDestinationKindKey.String("queue") - // A message sent to a topic - MessagingDestinationKindTopic = MessagingDestinationKindKey.String("topic") -) - -// MessagingDestinationName returns an attribute KeyValue conforming to the -// "messaging.destination.name" semantic conventions. It represents the message -// destination name -func MessagingDestinationName(val string) attribute.KeyValue { - return MessagingDestinationNameKey.String(val) -} - -// MessagingDestinationTemplate returns an attribute KeyValue conforming to -// the "messaging.destination.template" semantic conventions. It represents the -// low cardinality representation of the messaging destination name -func MessagingDestinationTemplate(val string) attribute.KeyValue { - return MessagingDestinationTemplateKey.String(val) -} - -// MessagingDestinationTemporary returns an attribute KeyValue conforming to -// the "messaging.destination.temporary" semantic conventions. It represents a -// boolean that is true if the message destination is temporary and might not -// exist anymore after messages are processed. -func MessagingDestinationTemporary(val bool) attribute.KeyValue { - return MessagingDestinationTemporaryKey.Bool(val) -} - -// MessagingDestinationAnonymous returns an attribute KeyValue conforming to -// the "messaging.destination.anonymous" semantic conventions. It represents a -// boolean that is true if the message destination is anonymous (could be -// unnamed or have auto-generated name). -func MessagingDestinationAnonymous(val bool) attribute.KeyValue { - return MessagingDestinationAnonymousKey.Bool(val) -} - -// Semantic convention for attributes that describe messaging source on broker -const ( - // MessagingSourceNameKey is the attribute Key conforming to the - // "messaging.source.name" semantic conventions. It represents the message - // source name - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'MyQueue', 'MyTopic' - // Note: Source name SHOULD uniquely identify a specific queue, topic, or - // other entity within the broker. If - // the broker does not have such notion, the source name SHOULD uniquely - // identify the broker. - MessagingSourceNameKey = attribute.Key("messaging.source.name") - - // MessagingSourceKindKey is the attribute Key conforming to the - // "messaging.source.kind" semantic conventions. It represents the kind of - // message source - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - MessagingSourceKindKey = attribute.Key("messaging.source.kind") - - // MessagingSourceTemplateKey is the attribute Key conforming to the - // "messaging.source.template" semantic conventions. It represents the low - // cardinality representation of the messaging source name - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '/customers/{customerID}' - // Note: Source names could be constructed from templates. An example would - // be a source name involving a user name or product id. Although the - // source name in this case is of high cardinality, the underlying template - // is of low cardinality and can be effectively used for grouping and - // aggregation. - MessagingSourceTemplateKey = attribute.Key("messaging.source.template") - - // MessagingSourceTemporaryKey is the attribute Key conforming to the - // "messaging.source.temporary" semantic conventions. It represents a - // boolean that is true if the message source is temporary and might not - // exist anymore after messages are processed. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - MessagingSourceTemporaryKey = attribute.Key("messaging.source.temporary") - - // MessagingSourceAnonymousKey is the attribute Key conforming to the - // "messaging.source.anonymous" semantic conventions. It represents a - // boolean that is true if the message source is anonymous (could be - // unnamed or have auto-generated name). - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - MessagingSourceAnonymousKey = attribute.Key("messaging.source.anonymous") -) - -var ( - // A message received from a queue - MessagingSourceKindQueue = MessagingSourceKindKey.String("queue") - // A message received from a topic - MessagingSourceKindTopic = MessagingSourceKindKey.String("topic") -) - -// MessagingSourceName returns an attribute KeyValue conforming to the -// "messaging.source.name" semantic conventions. It represents the message -// source name -func MessagingSourceName(val string) attribute.KeyValue { - return MessagingSourceNameKey.String(val) -} - -// MessagingSourceTemplate returns an attribute KeyValue conforming to the -// "messaging.source.template" semantic conventions. It represents the low -// cardinality representation of the messaging source name -func MessagingSourceTemplate(val string) attribute.KeyValue { - return MessagingSourceTemplateKey.String(val) -} - -// MessagingSourceTemporary returns an attribute KeyValue conforming to the -// "messaging.source.temporary" semantic conventions. It represents a boolean -// that is true if the message source is temporary and might not exist anymore -// after messages are processed. -func MessagingSourceTemporary(val bool) attribute.KeyValue { - return MessagingSourceTemporaryKey.Bool(val) -} - -// MessagingSourceAnonymous returns an attribute KeyValue conforming to the -// "messaging.source.anonymous" semantic conventions. It represents a boolean -// that is true if the message source is anonymous (could be unnamed or have -// auto-generated name). -func MessagingSourceAnonymous(val bool) attribute.KeyValue { - return MessagingSourceAnonymousKey.Bool(val) -} - -// General attributes used in messaging systems. -const ( - // MessagingSystemKey is the attribute Key conforming to the - // "messaging.system" semantic conventions. It represents a string - // identifying the messaging system. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' - MessagingSystemKey = attribute.Key("messaging.system") - - // MessagingOperationKey is the attribute Key conforming to the - // "messaging.operation" semantic conventions. It represents a string - // identifying the kind of messaging operation as defined in the [Operation - // names](#operation-names) section above. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - // Note: If a custom value is used, it MUST be of low cardinality. - MessagingOperationKey = attribute.Key("messaging.operation") - - // MessagingBatchMessageCountKey is the attribute Key conforming to the - // "messaging.batch.message_count" semantic conventions. It represents the - // number of messages sent, received, or processed in the scope of the - // batching operation. - // - // Type: int - // RequirementLevel: ConditionallyRequired (If the span describes an - // operation on a batch of messages.) - // Stability: stable - // Examples: 0, 1, 2 - // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on - // spans that operate with a single message. When a messaging client - // library supports both batch and single-message API for the same - // operation, instrumentations SHOULD use `messaging.batch.message_count` - // for batching APIs and SHOULD NOT use it for single-message APIs. - MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") -) - -var ( - // publish - MessagingOperationPublish = MessagingOperationKey.String("publish") - // receive - MessagingOperationReceive = MessagingOperationKey.String("receive") - // process - MessagingOperationProcess = MessagingOperationKey.String("process") -) - -// MessagingSystem returns an attribute KeyValue conforming to the -// "messaging.system" semantic conventions. It represents a string identifying -// the messaging system. -func MessagingSystem(val string) attribute.KeyValue { - return MessagingSystemKey.String(val) -} - -// MessagingBatchMessageCount returns an attribute KeyValue conforming to -// the "messaging.batch.message_count" semantic conventions. It represents the -// number of messages sent, received, or processed in the scope of the batching -// operation. -func MessagingBatchMessageCount(val int) attribute.KeyValue { - return MessagingBatchMessageCountKey.Int(val) -} - -// Semantic convention for a consumer of messages received from a messaging -// system -const ( - // MessagingConsumerIDKey is the attribute Key conforming to the - // "messaging.consumer.id" semantic conventions. It represents the - // identifier for the consumer receiving a message. For Kafka, set it to - // `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if - // both are present, or only `messaging.kafka.consumer.group`. For brokers, - // such as RabbitMQ and Artemis, set it to the `client_id` of the client - // consuming the message. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'mygroup - client-6' - MessagingConsumerIDKey = attribute.Key("messaging.consumer.id") -) - -// MessagingConsumerID returns an attribute KeyValue conforming to the -// "messaging.consumer.id" semantic conventions. It represents the identifier -// for the consumer receiving a message. For Kafka, set it to -// `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both -// are present, or only `messaging.kafka.consumer.group`. For brokers, such as -// RabbitMQ and Artemis, set it to the `client_id` of the client consuming the -// message. -func MessagingConsumerID(val string) attribute.KeyValue { - return MessagingConsumerIDKey.String(val) -} - -// Attributes for RabbitMQ -const ( - // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key - // conforming to the "messaging.rabbitmq.destination.routing_key" semantic - // conventions. It represents the rabbitMQ message routing key. - // - // Type: string - // RequirementLevel: ConditionallyRequired (If not empty.) - // Stability: stable - // Examples: 'myKey' - MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") -) - -// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue -// conforming to the "messaging.rabbitmq.destination.routing_key" semantic -// conventions. It represents the rabbitMQ message routing key. -func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { - return MessagingRabbitmqDestinationRoutingKeyKey.String(val) -} - -// Attributes for Apache Kafka -const ( - // MessagingKafkaMessageKeyKey is the attribute Key conforming to the - // "messaging.kafka.message.key" semantic conventions. It represents the - // message keys in Kafka are used for grouping alike messages to ensure - // they're processed on the same partition. They differ from - // `messaging.message.id` in that they're not unique. If the key is `null`, - // the attribute MUST NOT be set. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'myKey' - // Note: If the key type is not string, it's string representation has to - // be supplied for the attribute. If the key has no unambiguous, canonical - // string form, don't include its value. - MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") - - // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the - // "messaging.kafka.consumer.group" semantic conventions. It represents the - // name of the Kafka Consumer Group that is handling the message. Only - // applies to consumers, not producers. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'my-group' - MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") - - // MessagingKafkaClientIDKey is the attribute Key conforming to the - // "messaging.kafka.client_id" semantic conventions. It represents the - // client ID for the Consumer or Producer that is handling the message. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'client-5' - MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") - - // MessagingKafkaDestinationPartitionKey is the attribute Key conforming to - // the "messaging.kafka.destination.partition" semantic conventions. It - // represents the partition the message is sent to. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 2 - MessagingKafkaDestinationPartitionKey = attribute.Key("messaging.kafka.destination.partition") - - // MessagingKafkaSourcePartitionKey is the attribute Key conforming to the - // "messaging.kafka.source.partition" semantic conventions. It represents - // the partition the message is received from. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 2 - MessagingKafkaSourcePartitionKey = attribute.Key("messaging.kafka.source.partition") - - // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the - // "messaging.kafka.message.offset" semantic conventions. It represents the - // offset of a record in the corresponding Kafka partition. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 42 - MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") - - // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the - // "messaging.kafka.message.tombstone" semantic conventions. It represents - // a boolean that is true if the message is a tombstone. - // - // Type: boolean - // RequirementLevel: ConditionallyRequired (If value is `true`. When - // missing, the value is assumed to be `false`.) - // Stability: stable - MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") -) - -// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the -// "messaging.kafka.message.key" semantic conventions. It represents the -// message keys in Kafka are used for grouping alike messages to ensure they're -// processed on the same partition. They differ from `messaging.message.id` in -// that they're not unique. If the key is `null`, the attribute MUST NOT be -// set. -func MessagingKafkaMessageKey(val string) attribute.KeyValue { - return MessagingKafkaMessageKeyKey.String(val) -} - -// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to -// the "messaging.kafka.consumer.group" semantic conventions. It represents the -// name of the Kafka Consumer Group that is handling the message. Only applies -// to consumers, not producers. -func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { - return MessagingKafkaConsumerGroupKey.String(val) -} - -// MessagingKafkaClientID returns an attribute KeyValue conforming to the -// "messaging.kafka.client_id" semantic conventions. It represents the client -// ID for the Consumer or Producer that is handling the message. -func MessagingKafkaClientID(val string) attribute.KeyValue { - return MessagingKafkaClientIDKey.String(val) -} - -// MessagingKafkaDestinationPartition returns an attribute KeyValue -// conforming to the "messaging.kafka.destination.partition" semantic -// conventions. It represents the partition the message is sent to. -func MessagingKafkaDestinationPartition(val int) attribute.KeyValue { - return MessagingKafkaDestinationPartitionKey.Int(val) -} - -// MessagingKafkaSourcePartition returns an attribute KeyValue conforming to -// the "messaging.kafka.source.partition" semantic conventions. It represents -// the partition the message is received from. -func MessagingKafkaSourcePartition(val int) attribute.KeyValue { - return MessagingKafkaSourcePartitionKey.Int(val) -} - -// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to -// the "messaging.kafka.message.offset" semantic conventions. It represents the -// offset of a record in the corresponding Kafka partition. -func MessagingKafkaMessageOffset(val int) attribute.KeyValue { - return MessagingKafkaMessageOffsetKey.Int(val) -} - -// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming -// to the "messaging.kafka.message.tombstone" semantic conventions. It -// represents a boolean that is true if the message is a tombstone. -func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { - return MessagingKafkaMessageTombstoneKey.Bool(val) -} - -// Attributes for Apache RocketMQ -const ( - // MessagingRocketmqNamespaceKey is the attribute Key conforming to the - // "messaging.rocketmq.namespace" semantic conventions. It represents the - // namespace of RocketMQ resources, resources in different namespaces are - // individual. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'myNamespace' - MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") - - // MessagingRocketmqClientGroupKey is the attribute Key conforming to the - // "messaging.rocketmq.client_group" semantic conventions. It represents - // the name of the RocketMQ producer/consumer group that is handling the - // message. The client type is identified by the SpanKind. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'myConsumerGroup' - MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") - - // MessagingRocketmqClientIDKey is the attribute Key conforming to the - // "messaging.rocketmq.client_id" semantic conventions. It represents the - // unique identifier for each client. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'myhost@8742@s8083jm' - MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") - - // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key - // conforming to the "messaging.rocketmq.message.delivery_timestamp" - // semantic conventions. It represents the timestamp in milliseconds that - // the delay message is expected to be delivered to consumer. - // - // Type: int - // RequirementLevel: ConditionallyRequired (If the message type is delay - // and delay time level is not specified.) - // Stability: stable - // Examples: 1665987217045 - MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") - - // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key - // conforming to the "messaging.rocketmq.message.delay_time_level" semantic - // conventions. It represents the delay time level for delay message, which - // determines the message delay time. - // - // Type: int - // RequirementLevel: ConditionallyRequired (If the message type is delay - // and delivery timestamp is not specified.) - // Stability: stable - // Examples: 3 - MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") - - // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the - // "messaging.rocketmq.message.group" semantic conventions. It represents - // the it is essential for FIFO message. Messages that belong to the same - // message group are always processed one by one within the same consumer - // group. - // - // Type: string - // RequirementLevel: ConditionallyRequired (If the message type is FIFO.) - // Stability: stable - // Examples: 'myMessageGroup' - MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") - - // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the - // "messaging.rocketmq.message.type" semantic conventions. It represents - // the type of message. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") - - // MessagingRocketmqMessageTagKey is the attribute Key conforming to the - // "messaging.rocketmq.message.tag" semantic conventions. It represents the - // secondary classifier of message besides topic. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'tagA' - MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") - - // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the - // "messaging.rocketmq.message.keys" semantic conventions. It represents - // the key(s) of message, another way to mark message besides message id. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: 'keyA', 'keyB' - MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") - - // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to - // the "messaging.rocketmq.consumption_model" semantic conventions. It - // represents the model of message consumption. This only applies to - // consumer spans. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") -) - -var ( - // Normal message - MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") - // FIFO message - MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") - // Delay message - MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") - // Transaction message - MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") -) - -var ( - // Clustering consumption model - MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") - // Broadcasting consumption model - MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") -) - -// MessagingRocketmqNamespace returns an attribute KeyValue conforming to -// the "messaging.rocketmq.namespace" semantic conventions. It represents the -// namespace of RocketMQ resources, resources in different namespaces are -// individual. -func MessagingRocketmqNamespace(val string) attribute.KeyValue { - return MessagingRocketmqNamespaceKey.String(val) -} - -// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to -// the "messaging.rocketmq.client_group" semantic conventions. It represents -// the name of the RocketMQ producer/consumer group that is handling the -// message. The client type is identified by the SpanKind. -func MessagingRocketmqClientGroup(val string) attribute.KeyValue { - return MessagingRocketmqClientGroupKey.String(val) -} - -// MessagingRocketmqClientID returns an attribute KeyValue conforming to the -// "messaging.rocketmq.client_id" semantic conventions. It represents the -// unique identifier for each client. -func MessagingRocketmqClientID(val string) attribute.KeyValue { - return MessagingRocketmqClientIDKey.String(val) -} - -// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue -// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic -// conventions. It represents the timestamp in milliseconds that the delay -// message is expected to be delivered to consumer. -func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { - return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) -} - -// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue -// conforming to the "messaging.rocketmq.message.delay_time_level" semantic -// conventions. It represents the delay time level for delay message, which -// determines the message delay time. -func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { - return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) -} - -// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to -// the "messaging.rocketmq.message.group" semantic conventions. It represents -// the it is essential for FIFO message. Messages that belong to the same -// message group are always processed one by one within the same consumer -// group. -func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { - return MessagingRocketmqMessageGroupKey.String(val) -} - -// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to -// the "messaging.rocketmq.message.tag" semantic conventions. It represents the -// secondary classifier of message besides topic. -func MessagingRocketmqMessageTag(val string) attribute.KeyValue { - return MessagingRocketmqMessageTagKey.String(val) -} - -// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to -// the "messaging.rocketmq.message.keys" semantic conventions. It represents -// the key(s) of message, another way to mark message besides message id. -func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { - return MessagingRocketmqMessageKeysKey.StringSlice(val) -} - -// Semantic conventions for remote procedure calls. -const ( - // RPCSystemKey is the attribute Key conforming to the "rpc.system" - // semantic conventions. It represents a string identifying the remoting - // system. See below for a list of well-known identifiers. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - RPCSystemKey = attribute.Key("rpc.system") - - // RPCServiceKey is the attribute Key conforming to the "rpc.service" - // semantic conventions. It represents the full (logical) name of the - // service being called, including its package name, if applicable. - // - // Type: string - // RequirementLevel: Recommended - // Stability: stable - // Examples: 'myservice.EchoService' - // Note: This is the logical name of the service from the RPC interface - // perspective, which can be different from the name of any implementing - // class. The `code.namespace` attribute may be used to store the latter - // (despite the attribute name, it may include a class name; e.g., class - // with method actually executing the call on the server side, RPC client - // stub class on the client side). - RPCServiceKey = attribute.Key("rpc.service") - - // RPCMethodKey is the attribute Key conforming to the "rpc.method" - // semantic conventions. It represents the name of the (logical) method - // being called, must be equal to the $method part in the span name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: stable - // Examples: 'exampleMethod' - // Note: This is the logical name of the method from the RPC interface - // perspective, which can be different from the name of any implementing - // method/function. The `code.function` attribute may be used to store the - // latter (e.g., method actually executing the call on the server side, RPC - // client stub method on the client side). - RPCMethodKey = attribute.Key("rpc.method") -) - -var ( - // gRPC - RPCSystemGRPC = RPCSystemKey.String("grpc") - // Java RMI - RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") - // .NET WCF - RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") - // Apache Dubbo - RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") -) - -// RPCService returns an attribute KeyValue conforming to the "rpc.service" -// semantic conventions. It represents the full (logical) name of the service -// being called, including its package name, if applicable. -func RPCService(val string) attribute.KeyValue { - return RPCServiceKey.String(val) -} - -// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" -// semantic conventions. It represents the name of the (logical) method being -// called, must be equal to the $method part in the span name. -func RPCMethod(val string) attribute.KeyValue { - return RPCMethodKey.String(val) -} - -// Tech-specific attributes for gRPC. -const ( - // RPCGRPCStatusCodeKey is the attribute Key conforming to the - // "rpc.grpc.status_code" semantic conventions. It represents the [numeric - // status - // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of - // the gRPC request. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") -) - -var ( - // OK - RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) - // CANCELLED - RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) - // UNKNOWN - RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) - // INVALID_ARGUMENT - RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) - // DEADLINE_EXCEEDED - RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) - // NOT_FOUND - RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) - // ALREADY_EXISTS - RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) - // PERMISSION_DENIED - RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) - // RESOURCE_EXHAUSTED - RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) - // FAILED_PRECONDITION - RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) - // ABORTED - RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) - // OUT_OF_RANGE - RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) - // UNIMPLEMENTED - RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) - // INTERNAL - RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) - // UNAVAILABLE - RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) - // DATA_LOSS - RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) - // UNAUTHENTICATED - RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) -) - -// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). -const ( - // RPCJsonrpcVersionKey is the attribute Key conforming to the - // "rpc.jsonrpc.version" semantic conventions. It represents the protocol - // version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 - // does not specify this, the value can be omitted. - // - // Type: string - // RequirementLevel: ConditionallyRequired (If other than the default - // version (`1.0`)) - // Stability: stable - // Examples: '2.0', '1.0' - RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") - - // RPCJsonrpcRequestIDKey is the attribute Key conforming to the - // "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` - // property of request or response. Since protocol allows id to be int, - // string, `null` or missing (for notifications), value is expected to be - // cast to string for simplicity. Use empty string in case of `null` value. - // Omit entirely if this is a notification. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '10', 'request-7', '' - RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") - - // RPCJsonrpcErrorCodeKey is the attribute Key conforming to the - // "rpc.jsonrpc.error_code" semantic conventions. It represents the - // `error.code` property of response if it is an error response. - // - // Type: int - // RequirementLevel: ConditionallyRequired (If response is not successful.) - // Stability: stable - // Examples: -32700, 100 - RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") - - // RPCJsonrpcErrorMessageKey is the attribute Key conforming to the - // "rpc.jsonrpc.error_message" semantic conventions. It represents the - // `error.message` property of response if it is an error response. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Parse error', 'User already exists' - RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") -) - -// RPCJsonrpcVersion returns an attribute KeyValue conforming to the -// "rpc.jsonrpc.version" semantic conventions. It represents the protocol -// version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 -// does not specify this, the value can be omitted. -func RPCJsonrpcVersion(val string) attribute.KeyValue { - return RPCJsonrpcVersionKey.String(val) -} - -// RPCJsonrpcRequestID returns an attribute KeyValue conforming to the -// "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` -// property of request or response. Since protocol allows id to be int, string, -// `null` or missing (for notifications), value is expected to be cast to -// string for simplicity. Use empty string in case of `null` value. Omit -// entirely if this is a notification. -func RPCJsonrpcRequestID(val string) attribute.KeyValue { - return RPCJsonrpcRequestIDKey.String(val) -} - -// RPCJsonrpcErrorCode returns an attribute KeyValue conforming to the -// "rpc.jsonrpc.error_code" semantic conventions. It represents the -// `error.code` property of response if it is an error response. -func RPCJsonrpcErrorCode(val int) attribute.KeyValue { - return RPCJsonrpcErrorCodeKey.Int(val) -} - -// RPCJsonrpcErrorMessage returns an attribute KeyValue conforming to the -// "rpc.jsonrpc.error_message" semantic conventions. It represents the -// `error.message` property of response if it is an error response. -func RPCJsonrpcErrorMessage(val string) attribute.KeyValue { - return RPCJsonrpcErrorMessageKey.String(val) -} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/rpcconv/metric.go b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/rpcconv/metric.go new file mode 100644 index 0000000000..089b0c457f --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/rpcconv/metric.go @@ -0,0 +1,1010 @@ +// Code generated from semantic convention specification. DO NOT EDIT. + +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package rpcconv provides types and functionality for OpenTelemetry semantic +// conventions in the "rpc" namespace. +package rpcconv + +import ( + "context" + "sync" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/noop" +) + +var ( + addOptPool = &sync.Pool{New: func() any { return &[]metric.AddOption{} }} + recOptPool = &sync.Pool{New: func() any { return &[]metric.RecordOption{} }} +) + +// ClientDuration is an instrument used to record metric values conforming to the +// "rpc.client.duration" semantic conventions. It represents the measures the +// duration of outbound RPC. +type ClientDuration struct { + metric.Float64Histogram +} + +var newClientDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Measures the duration of outbound RPC."), + metric.WithUnit("ms"), +} + +// NewClientDuration returns a new ClientDuration instrument. +func NewClientDuration( + m metric.Meter, + opt ...metric.Float64HistogramOption, +) (ClientDuration, error) { + // Check if the meter is nil. + if m == nil { + return ClientDuration{noop.Float64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientDurationOpts + } else { + opt = append(opt, newClientDurationOpts...) + } + + i, err := m.Float64Histogram( + "rpc.client.duration", + opt..., + ) + if err != nil { + return ClientDuration{noop.Float64Histogram{}}, err + } + return ClientDuration{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientDuration) Inst() metric.Float64Histogram { + return m.Float64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientDuration) Name() string { + return "rpc.client.duration" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientDuration) Unit() string { + return "ms" +} + +// Description returns the semantic convention description of the instrument +func (ClientDuration) Description() string { + return "Measures the duration of outbound RPC." +} + +// Record records val to the current distribution for attrs. +// +// While streaming RPCs may record this metric as start-of-batch +// to end-of-batch, it's hard to interpret in practice. +// +// **Streaming**: N/A. +func (m ClientDuration) Record(ctx context.Context, val float64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Float64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// While streaming RPCs may record this metric as start-of-batch +// to end-of-batch, it's hard to interpret in practice. +// +// **Streaming**: N/A. +func (m ClientDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { + if set.Len() == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Float64Histogram.Record(ctx, val, *o...) +} + +// ClientRequestSize is an instrument used to record metric values conforming to +// the "rpc.client.request.size" semantic conventions. It represents the measures +// the size of RPC request messages (uncompressed). +type ClientRequestSize struct { + metric.Int64Histogram +} + +var newClientRequestSizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the size of RPC request messages (uncompressed)."), + metric.WithUnit("By"), +} + +// NewClientRequestSize returns a new ClientRequestSize instrument. +func NewClientRequestSize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ClientRequestSize, error) { + // Check if the meter is nil. + if m == nil { + return ClientRequestSize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientRequestSizeOpts + } else { + opt = append(opt, newClientRequestSizeOpts...) + } + + i, err := m.Int64Histogram( + "rpc.client.request.size", + opt..., + ) + if err != nil { + return ClientRequestSize{noop.Int64Histogram{}}, err + } + return ClientRequestSize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientRequestSize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientRequestSize) Name() string { + return "rpc.client.request.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientRequestSize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ClientRequestSize) Description() string { + return "Measures the size of RPC request messages (uncompressed)." +} + +// Record records val to the current distribution for attrs. +// +// **Streaming**: Recorded per message in a streaming batch +func (m ClientRequestSize) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// **Streaming**: Recorded per message in a streaming batch +func (m ClientRequestSize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// ClientRequestsPerRPC is an instrument used to record metric values conforming +// to the "rpc.client.requests_per_rpc" semantic conventions. It represents the +// measures the number of messages received per RPC. +type ClientRequestsPerRPC struct { + metric.Int64Histogram +} + +var newClientRequestsPerRPCOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the number of messages received per RPC."), + metric.WithUnit("{count}"), +} + +// NewClientRequestsPerRPC returns a new ClientRequestsPerRPC instrument. +func NewClientRequestsPerRPC( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ClientRequestsPerRPC, error) { + // Check if the meter is nil. + if m == nil { + return ClientRequestsPerRPC{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientRequestsPerRPCOpts + } else { + opt = append(opt, newClientRequestsPerRPCOpts...) + } + + i, err := m.Int64Histogram( + "rpc.client.requests_per_rpc", + opt..., + ) + if err != nil { + return ClientRequestsPerRPC{noop.Int64Histogram{}}, err + } + return ClientRequestsPerRPC{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientRequestsPerRPC) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientRequestsPerRPC) Name() string { + return "rpc.client.requests_per_rpc" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientRequestsPerRPC) Unit() string { + return "{count}" +} + +// Description returns the semantic convention description of the instrument +func (ClientRequestsPerRPC) Description() string { + return "Measures the number of messages received per RPC." +} + +// Record records val to the current distribution for attrs. +// +// Should be 1 for all non-streaming RPCs. +// +// **Streaming**: This metric is required for server and client streaming RPCs +func (m ClientRequestsPerRPC) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// Should be 1 for all non-streaming RPCs. +// +// **Streaming**: This metric is required for server and client streaming RPCs +func (m ClientRequestsPerRPC) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// ClientResponseSize is an instrument used to record metric values conforming to +// the "rpc.client.response.size" semantic conventions. It represents the +// measures the size of RPC response messages (uncompressed). +type ClientResponseSize struct { + metric.Int64Histogram +} + +var newClientResponseSizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the size of RPC response messages (uncompressed)."), + metric.WithUnit("By"), +} + +// NewClientResponseSize returns a new ClientResponseSize instrument. +func NewClientResponseSize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ClientResponseSize, error) { + // Check if the meter is nil. + if m == nil { + return ClientResponseSize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientResponseSizeOpts + } else { + opt = append(opt, newClientResponseSizeOpts...) + } + + i, err := m.Int64Histogram( + "rpc.client.response.size", + opt..., + ) + if err != nil { + return ClientResponseSize{noop.Int64Histogram{}}, err + } + return ClientResponseSize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientResponseSize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientResponseSize) Name() string { + return "rpc.client.response.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientResponseSize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ClientResponseSize) Description() string { + return "Measures the size of RPC response messages (uncompressed)." +} + +// Record records val to the current distribution for attrs. +// +// **Streaming**: Recorded per response in a streaming batch +func (m ClientResponseSize) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// **Streaming**: Recorded per response in a streaming batch +func (m ClientResponseSize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// ClientResponsesPerRPC is an instrument used to record metric values conforming +// to the "rpc.client.responses_per_rpc" semantic conventions. It represents the +// measures the number of messages sent per RPC. +type ClientResponsesPerRPC struct { + metric.Int64Histogram +} + +var newClientResponsesPerRPCOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the number of messages sent per RPC."), + metric.WithUnit("{count}"), +} + +// NewClientResponsesPerRPC returns a new ClientResponsesPerRPC instrument. +func NewClientResponsesPerRPC( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ClientResponsesPerRPC, error) { + // Check if the meter is nil. + if m == nil { + return ClientResponsesPerRPC{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientResponsesPerRPCOpts + } else { + opt = append(opt, newClientResponsesPerRPCOpts...) + } + + i, err := m.Int64Histogram( + "rpc.client.responses_per_rpc", + opt..., + ) + if err != nil { + return ClientResponsesPerRPC{noop.Int64Histogram{}}, err + } + return ClientResponsesPerRPC{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientResponsesPerRPC) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientResponsesPerRPC) Name() string { + return "rpc.client.responses_per_rpc" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientResponsesPerRPC) Unit() string { + return "{count}" +} + +// Description returns the semantic convention description of the instrument +func (ClientResponsesPerRPC) Description() string { + return "Measures the number of messages sent per RPC." +} + +// Record records val to the current distribution for attrs. +// +// Should be 1 for all non-streaming RPCs. +// +// **Streaming**: This metric is required for server and client streaming RPCs +func (m ClientResponsesPerRPC) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// Should be 1 for all non-streaming RPCs. +// +// **Streaming**: This metric is required for server and client streaming RPCs +func (m ClientResponsesPerRPC) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// ServerDuration is an instrument used to record metric values conforming to the +// "rpc.server.duration" semantic conventions. It represents the measures the +// duration of inbound RPC. +type ServerDuration struct { + metric.Float64Histogram +} + +var newServerDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Measures the duration of inbound RPC."), + metric.WithUnit("ms"), +} + +// NewServerDuration returns a new ServerDuration instrument. +func NewServerDuration( + m metric.Meter, + opt ...metric.Float64HistogramOption, +) (ServerDuration, error) { + // Check if the meter is nil. + if m == nil { + return ServerDuration{noop.Float64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerDurationOpts + } else { + opt = append(opt, newServerDurationOpts...) + } + + i, err := m.Float64Histogram( + "rpc.server.duration", + opt..., + ) + if err != nil { + return ServerDuration{noop.Float64Histogram{}}, err + } + return ServerDuration{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerDuration) Inst() metric.Float64Histogram { + return m.Float64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerDuration) Name() string { + return "rpc.server.duration" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerDuration) Unit() string { + return "ms" +} + +// Description returns the semantic convention description of the instrument +func (ServerDuration) Description() string { + return "Measures the duration of inbound RPC." +} + +// Record records val to the current distribution for attrs. +// +// While streaming RPCs may record this metric as start-of-batch +// to end-of-batch, it's hard to interpret in practice. +// +// **Streaming**: N/A. +func (m ServerDuration) Record(ctx context.Context, val float64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Float64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// While streaming RPCs may record this metric as start-of-batch +// to end-of-batch, it's hard to interpret in practice. +// +// **Streaming**: N/A. +func (m ServerDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { + if set.Len() == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Float64Histogram.Record(ctx, val, *o...) +} + +// ServerRequestSize is an instrument used to record metric values conforming to +// the "rpc.server.request.size" semantic conventions. It represents the measures +// the size of RPC request messages (uncompressed). +type ServerRequestSize struct { + metric.Int64Histogram +} + +var newServerRequestSizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the size of RPC request messages (uncompressed)."), + metric.WithUnit("By"), +} + +// NewServerRequestSize returns a new ServerRequestSize instrument. +func NewServerRequestSize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ServerRequestSize, error) { + // Check if the meter is nil. + if m == nil { + return ServerRequestSize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerRequestSizeOpts + } else { + opt = append(opt, newServerRequestSizeOpts...) + } + + i, err := m.Int64Histogram( + "rpc.server.request.size", + opt..., + ) + if err != nil { + return ServerRequestSize{noop.Int64Histogram{}}, err + } + return ServerRequestSize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerRequestSize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerRequestSize) Name() string { + return "rpc.server.request.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerRequestSize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ServerRequestSize) Description() string { + return "Measures the size of RPC request messages (uncompressed)." +} + +// Record records val to the current distribution for attrs. +// +// **Streaming**: Recorded per message in a streaming batch +func (m ServerRequestSize) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// **Streaming**: Recorded per message in a streaming batch +func (m ServerRequestSize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// ServerRequestsPerRPC is an instrument used to record metric values conforming +// to the "rpc.server.requests_per_rpc" semantic conventions. It represents the +// measures the number of messages received per RPC. +type ServerRequestsPerRPC struct { + metric.Int64Histogram +} + +var newServerRequestsPerRPCOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the number of messages received per RPC."), + metric.WithUnit("{count}"), +} + +// NewServerRequestsPerRPC returns a new ServerRequestsPerRPC instrument. +func NewServerRequestsPerRPC( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ServerRequestsPerRPC, error) { + // Check if the meter is nil. + if m == nil { + return ServerRequestsPerRPC{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerRequestsPerRPCOpts + } else { + opt = append(opt, newServerRequestsPerRPCOpts...) + } + + i, err := m.Int64Histogram( + "rpc.server.requests_per_rpc", + opt..., + ) + if err != nil { + return ServerRequestsPerRPC{noop.Int64Histogram{}}, err + } + return ServerRequestsPerRPC{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerRequestsPerRPC) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerRequestsPerRPC) Name() string { + return "rpc.server.requests_per_rpc" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerRequestsPerRPC) Unit() string { + return "{count}" +} + +// Description returns the semantic convention description of the instrument +func (ServerRequestsPerRPC) Description() string { + return "Measures the number of messages received per RPC." +} + +// Record records val to the current distribution for attrs. +// +// Should be 1 for all non-streaming RPCs. +// +// **Streaming** : This metric is required for server and client streaming RPCs +func (m ServerRequestsPerRPC) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// Should be 1 for all non-streaming RPCs. +// +// **Streaming** : This metric is required for server and client streaming RPCs +func (m ServerRequestsPerRPC) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// ServerResponseSize is an instrument used to record metric values conforming to +// the "rpc.server.response.size" semantic conventions. It represents the +// measures the size of RPC response messages (uncompressed). +type ServerResponseSize struct { + metric.Int64Histogram +} + +var newServerResponseSizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the size of RPC response messages (uncompressed)."), + metric.WithUnit("By"), +} + +// NewServerResponseSize returns a new ServerResponseSize instrument. +func NewServerResponseSize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ServerResponseSize, error) { + // Check if the meter is nil. + if m == nil { + return ServerResponseSize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerResponseSizeOpts + } else { + opt = append(opt, newServerResponseSizeOpts...) + } + + i, err := m.Int64Histogram( + "rpc.server.response.size", + opt..., + ) + if err != nil { + return ServerResponseSize{noop.Int64Histogram{}}, err + } + return ServerResponseSize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerResponseSize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerResponseSize) Name() string { + return "rpc.server.response.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerResponseSize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ServerResponseSize) Description() string { + return "Measures the size of RPC response messages (uncompressed)." +} + +// Record records val to the current distribution for attrs. +// +// **Streaming**: Recorded per response in a streaming batch +func (m ServerResponseSize) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// **Streaming**: Recorded per response in a streaming batch +func (m ServerResponseSize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// ServerResponsesPerRPC is an instrument used to record metric values conforming +// to the "rpc.server.responses_per_rpc" semantic conventions. It represents the +// measures the number of messages sent per RPC. +type ServerResponsesPerRPC struct { + metric.Int64Histogram +} + +var newServerResponsesPerRPCOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the number of messages sent per RPC."), + metric.WithUnit("{count}"), +} + +// NewServerResponsesPerRPC returns a new ServerResponsesPerRPC instrument. +func NewServerResponsesPerRPC( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ServerResponsesPerRPC, error) { + // Check if the meter is nil. + if m == nil { + return ServerResponsesPerRPC{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerResponsesPerRPCOpts + } else { + opt = append(opt, newServerResponsesPerRPCOpts...) + } + + i, err := m.Int64Histogram( + "rpc.server.responses_per_rpc", + opt..., + ) + if err != nil { + return ServerResponsesPerRPC{noop.Int64Histogram{}}, err + } + return ServerResponsesPerRPC{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerResponsesPerRPC) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerResponsesPerRPC) Name() string { + return "rpc.server.responses_per_rpc" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerResponsesPerRPC) Unit() string { + return "{count}" +} + +// Description returns the semantic convention description of the instrument +func (ServerResponsesPerRPC) Description() string { + return "Measures the number of messages sent per RPC." +} + +// Record records val to the current distribution for attrs. +// +// Should be 1 for all non-streaming RPCs. +// +// **Streaming**: This metric is required for server and client streaming RPCs +func (m ServerResponsesPerRPC) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// Should be 1 for all non-streaming RPCs. +// +// **Streaming**: This metric is required for server and client streaming RPCs +func (m ServerResponsesPerRPC) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/MIGRATION.md b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/MIGRATION.md deleted file mode 100644 index fed7013e6f..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/MIGRATION.md +++ /dev/null @@ -1,78 +0,0 @@ - -# Migration from v1.38.0 to v1.39.0 - -The `go.opentelemetry.io/otel/semconv/v1.39.0` package should be a drop-in replacement for `go.opentelemetry.io/otel/semconv/v1.38.0` with the following exceptions. - -## Removed - -The following declarations have been removed. -Refer to the [OpenTelemetry Semantic Conventions documentation] for deprecation instructions. - -If the type is not listed in the documentation as deprecated, it has been removed in this version due to lack of applicability or use. -If you use any of these non-deprecated declarations in your Go application, please [open an issue] describing your use-case. - -- `LinuxMemorySlabStateKey` -- `LinuxMemorySlabStateReclaimable` -- `LinuxMemorySlabStateUnreclaimable` -- `PeerService` -- `PeerServiceKey` -- `RPCConnectRPCErrorCodeAborted` -- `RPCConnectRPCErrorCodeAlreadyExists` -- `RPCConnectRPCErrorCodeCancelled` -- `RPCConnectRPCErrorCodeDataLoss` -- `RPCConnectRPCErrorCodeDeadlineExceeded` -- `RPCConnectRPCErrorCodeFailedPrecondition` -- `RPCConnectRPCErrorCodeInternal` -- `RPCConnectRPCErrorCodeInvalidArgument` -- `RPCConnectRPCErrorCodeKey` -- `RPCConnectRPCErrorCodeNotFound` -- `RPCConnectRPCErrorCodeOutOfRange` -- `RPCConnectRPCErrorCodePermissionDenied` -- `RPCConnectRPCErrorCodeResourceExhausted` -- `RPCConnectRPCErrorCodeUnauthenticated` -- `RPCConnectRPCErrorCodeUnavailable` -- `RPCConnectRPCErrorCodeUnimplemented` -- `RPCConnectRPCErrorCodeUnknown` -- `RPCConnectRPCRequestMetadata` -- `RPCConnectRPCResponseMetadata` -- `RPCGRPCRequestMetadata` -- `RPCGRPCResponseMetadata` -- `RPCGRPCStatusCodeAborted` -- `RPCGRPCStatusCodeAlreadyExists` -- `RPCGRPCStatusCodeCancelled` -- `RPCGRPCStatusCodeDataLoss` -- `RPCGRPCStatusCodeDeadlineExceeded` -- `RPCGRPCStatusCodeFailedPrecondition` -- `RPCGRPCStatusCodeInternal` -- `RPCGRPCStatusCodeInvalidArgument` -- `RPCGRPCStatusCodeKey` -- `RPCGRPCStatusCodeNotFound` -- `RPCGRPCStatusCodeOk` -- `RPCGRPCStatusCodeOutOfRange` -- `RPCGRPCStatusCodePermissionDenied` -- `RPCGRPCStatusCodeResourceExhausted` -- `RPCGRPCStatusCodeUnauthenticated` -- `RPCGRPCStatusCodeUnavailable` -- `RPCGRPCStatusCodeUnimplemented` -- `RPCGRPCStatusCodeUnknown` -- `RPCJSONRPCErrorCode` -- `RPCJSONRPCErrorCodeKey` -- `RPCJSONRPCErrorMessage` -- `RPCJSONRPCErrorMessageKey` -- `RPCJSONRPCRequestID` -- `RPCJSONRPCRequestIDKey` -- `RPCJSONRPCVersion` -- `RPCJSONRPCVersionKey` -- `RPCService` -- `RPCServiceKey` -- `RPCSystemApacheDubbo` -- `RPCSystemConnectRPC` -- `RPCSystemDotnetWcf` -- `RPCSystemGRPC` -- `RPCSystemJSONRPC` -- `RPCSystemJavaRmi` -- `RPCSystemKey` -- `RPCSystemOncRPC` - -[OpenTelemetry Semantic Conventions documentation]: https://github.com/open-telemetry/semantic-conventions -[open an issue]: https://github.com/open-telemetry/opentelemetry-go/issues/new?template=Blank+issue diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/README.md b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/README.md deleted file mode 100644 index 4b0e6f7f3e..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Semconv v1.39.0 - -[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/semconv/v1.39.0)](https://pkg.go.dev/go.opentelemetry.io/otel/semconv/v1.39.0) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/attribute_group.go b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/attribute_group.go deleted file mode 100644 index dfcee964a6..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/attribute_group.go +++ /dev/null @@ -1,16243 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Code generated from semantic convention specification. DO NOT EDIT. - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.39.0" - -import "go.opentelemetry.io/otel/attribute" - -// Namespace: android -const ( - // AndroidAppStateKey is the attribute Key conforming to the "android.app.state" - // semantic conventions. It represents the this attribute represents the state - // of the application. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "created" - // Note: The Android lifecycle states are defined in - // [Activity lifecycle callbacks], and from which the `OS identifiers` are - // derived. - // - // [Activity lifecycle callbacks]: https://developer.android.com/guide/components/activities/activity-lifecycle#lc - AndroidAppStateKey = attribute.Key("android.app.state") - - // AndroidOSAPILevelKey is the attribute Key conforming to the - // "android.os.api_level" semantic conventions. It represents the uniquely - // identifies the framework API revision offered by a version (`os.version`) of - // the android operating system. More information can be found in the - // [Android API levels documentation]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "33", "32" - // - // [Android API levels documentation]: https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels - AndroidOSAPILevelKey = attribute.Key("android.os.api_level") -) - -// AndroidOSAPILevel returns an attribute KeyValue conforming to the -// "android.os.api_level" semantic conventions. It represents the uniquely -// identifies the framework API revision offered by a version (`os.version`) of -// the android operating system. More information can be found in the -// [Android API levels documentation]. -// -// [Android API levels documentation]: https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels -func AndroidOSAPILevel(val string) attribute.KeyValue { - return AndroidOSAPILevelKey.String(val) -} - -// Enum values for android.app.state -var ( - // Any time before Activity.onResume() or, if the app has no Activity, - // Context.startService() has been called in the app for the first time. - // - // Stability: development - AndroidAppStateCreated = AndroidAppStateKey.String("created") - // Any time after Activity.onPause() or, if the app has no Activity, - // Context.stopService() has been called when the app was in the foreground - // state. - // - // Stability: development - AndroidAppStateBackground = AndroidAppStateKey.String("background") - // Any time after Activity.onResume() or, if the app has no Activity, - // Context.startService() has been called when the app was in either the created - // or background states. - // - // Stability: development - AndroidAppStateForeground = AndroidAppStateKey.String("foreground") -) - -// Namespace: app -const ( - // AppBuildIDKey is the attribute Key conforming to the "app.build_id" semantic - // conventions. It represents the unique identifier for a particular build or - // compilation of the application. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "6cff0a7e-cefc-4668-96f5-1273d8b334d0", - // "9f2b833506aa6973a92fde9733e6271f", "my-app-1.0.0-code-123" - AppBuildIDKey = attribute.Key("app.build_id") - - // AppInstallationIDKey is the attribute Key conforming to the - // "app.installation.id" semantic conventions. It represents a unique identifier - // representing the installation of an application on a specific device. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "2ab2916d-a51f-4ac8-80ee-45ac31a28092" - // Note: Its value SHOULD persist across launches of the same application - // installation, including through application upgrades. - // It SHOULD change if the application is uninstalled or if all applications of - // the vendor are uninstalled. - // Additionally, users might be able to reset this value (e.g. by clearing - // application data). - // If an app is installed multiple times on the same device (e.g. in different - // accounts on Android), each `app.installation.id` SHOULD have a different - // value. - // If multiple OpenTelemetry SDKs are used within the same application, they - // SHOULD use the same value for `app.installation.id`. - // Hardware IDs (e.g. serial number, IMEI, MAC address) MUST NOT be used as the - // `app.installation.id`. - // - // For iOS, this value SHOULD be equal to the [vendor identifier]. - // - // For Android, examples of `app.installation.id` implementations include: - // - // - [Firebase Installation ID]. - // - A globally unique UUID which is persisted across sessions in your - // application. - // - [App set ID]. - // - [`Settings.getString(Settings.Secure.ANDROID_ID)`]. - // - // More information about Android identifier best practices can be found in the - // [Android user data IDs guide]. - // - // [vendor identifier]: https://developer.apple.com/documentation/uikit/uidevice/identifierforvendor - // [Firebase Installation ID]: https://firebase.google.com/docs/projects/manage-installations - // [App set ID]: https://developer.android.com/identity/app-set-id - // [`Settings.getString(Settings.Secure.ANDROID_ID)`]: https://developer.android.com/reference/android/provider/Settings.Secure#ANDROID_ID - // [Android user data IDs guide]: https://developer.android.com/training/articles/user-data-ids - AppInstallationIDKey = attribute.Key("app.installation.id") - - // AppJankFrameCountKey is the attribute Key conforming to the - // "app.jank.frame_count" semantic conventions. It represents a number of frame - // renders that experienced jank. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 9, 42 - // Note: Depending on platform limitations, the value provided MAY be - // approximation. - AppJankFrameCountKey = attribute.Key("app.jank.frame_count") - - // AppJankPeriodKey is the attribute Key conforming to the "app.jank.period" - // semantic conventions. It represents the time period, in seconds, for which - // this jank is being reported. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 1.0, 5.0, 10.24 - AppJankPeriodKey = attribute.Key("app.jank.period") - - // AppJankThresholdKey is the attribute Key conforming to the - // "app.jank.threshold" semantic conventions. It represents the minimum - // rendering threshold for this jank, in seconds. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 0.016, 0.7, 1.024 - AppJankThresholdKey = attribute.Key("app.jank.threshold") - - // AppScreenCoordinateXKey is the attribute Key conforming to the - // "app.screen.coordinate.x" semantic conventions. It represents the x - // (horizontal) coordinate of a screen coordinate, in screen pixels. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 0, 131 - AppScreenCoordinateXKey = attribute.Key("app.screen.coordinate.x") - - // AppScreenCoordinateYKey is the attribute Key conforming to the - // "app.screen.coordinate.y" semantic conventions. It represents the y - // (vertical) component of a screen coordinate, in screen pixels. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 12, 99 - AppScreenCoordinateYKey = attribute.Key("app.screen.coordinate.y") - - // AppScreenIDKey is the attribute Key conforming to the "app.screen.id" - // semantic conventions. It represents an identifier that uniquely - // differentiates this screen from other screens in the same application. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "f9bc787d-ff05-48ad-90e1-fca1d46130b3", - // "com.example.app.MainActivity", "com.example.shop.ProductDetailFragment", - // "MyApp.ProfileView", "MyApp.ProfileViewController" - // Note: A screen represents only the part of the device display drawn by the - // app. It typically contains multiple widgets or UI components and is larger in - // scope than individual widgets. Multiple screens can coexist on the same - // display simultaneously (e.g., split view on tablets). - AppScreenIDKey = attribute.Key("app.screen.id") - - // AppScreenNameKey is the attribute Key conforming to the "app.screen.name" - // semantic conventions. It represents the name of an application screen. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "MainActivity", "ProductDetailFragment", "ProfileView", - // "ProfileViewController" - // Note: A screen represents only the part of the device display drawn by the - // app. It typically contains multiple widgets or UI components and is larger in - // scope than individual widgets. Multiple screens can coexist on the same - // display simultaneously (e.g., split view on tablets). - AppScreenNameKey = attribute.Key("app.screen.name") - - // AppWidgetIDKey is the attribute Key conforming to the "app.widget.id" - // semantic conventions. It represents an identifier that uniquely - // differentiates this widget from other widgets in the same application. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "f9bc787d-ff05-48ad-90e1-fca1d46130b3", "submit_order_1829" - // Note: A widget is an application component, typically an on-screen visual GUI - // element. - AppWidgetIDKey = attribute.Key("app.widget.id") - - // AppWidgetNameKey is the attribute Key conforming to the "app.widget.name" - // semantic conventions. It represents the name of an application widget. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "submit", "attack", "Clear Cart" - // Note: A widget is an application component, typically an on-screen visual GUI - // element. - AppWidgetNameKey = attribute.Key("app.widget.name") -) - -// AppBuildID returns an attribute KeyValue conforming to the "app.build_id" -// semantic conventions. It represents the unique identifier for a particular -// build or compilation of the application. -func AppBuildID(val string) attribute.KeyValue { - return AppBuildIDKey.String(val) -} - -// AppInstallationID returns an attribute KeyValue conforming to the -// "app.installation.id" semantic conventions. It represents a unique identifier -// representing the installation of an application on a specific device. -func AppInstallationID(val string) attribute.KeyValue { - return AppInstallationIDKey.String(val) -} - -// AppJankFrameCount returns an attribute KeyValue conforming to the -// "app.jank.frame_count" semantic conventions. It represents a number of frame -// renders that experienced jank. -func AppJankFrameCount(val int) attribute.KeyValue { - return AppJankFrameCountKey.Int(val) -} - -// AppJankPeriod returns an attribute KeyValue conforming to the -// "app.jank.period" semantic conventions. It represents the time period, in -// seconds, for which this jank is being reported. -func AppJankPeriod(val float64) attribute.KeyValue { - return AppJankPeriodKey.Float64(val) -} - -// AppJankThreshold returns an attribute KeyValue conforming to the -// "app.jank.threshold" semantic conventions. It represents the minimum rendering -// threshold for this jank, in seconds. -func AppJankThreshold(val float64) attribute.KeyValue { - return AppJankThresholdKey.Float64(val) -} - -// AppScreenCoordinateX returns an attribute KeyValue conforming to the -// "app.screen.coordinate.x" semantic conventions. It represents the x -// (horizontal) coordinate of a screen coordinate, in screen pixels. -func AppScreenCoordinateX(val int) attribute.KeyValue { - return AppScreenCoordinateXKey.Int(val) -} - -// AppScreenCoordinateY returns an attribute KeyValue conforming to the -// "app.screen.coordinate.y" semantic conventions. It represents the y (vertical) -// component of a screen coordinate, in screen pixels. -func AppScreenCoordinateY(val int) attribute.KeyValue { - return AppScreenCoordinateYKey.Int(val) -} - -// AppScreenID returns an attribute KeyValue conforming to the "app.screen.id" -// semantic conventions. It represents an identifier that uniquely differentiates -// this screen from other screens in the same application. -func AppScreenID(val string) attribute.KeyValue { - return AppScreenIDKey.String(val) -} - -// AppScreenName returns an attribute KeyValue conforming to the -// "app.screen.name" semantic conventions. It represents the name of an -// application screen. -func AppScreenName(val string) attribute.KeyValue { - return AppScreenNameKey.String(val) -} - -// AppWidgetID returns an attribute KeyValue conforming to the "app.widget.id" -// semantic conventions. It represents an identifier that uniquely differentiates -// this widget from other widgets in the same application. -func AppWidgetID(val string) attribute.KeyValue { - return AppWidgetIDKey.String(val) -} - -// AppWidgetName returns an attribute KeyValue conforming to the -// "app.widget.name" semantic conventions. It represents the name of an -// application widget. -func AppWidgetName(val string) attribute.KeyValue { - return AppWidgetNameKey.String(val) -} - -// Namespace: artifact -const ( - // ArtifactAttestationFilenameKey is the attribute Key conforming to the - // "artifact.attestation.filename" semantic conventions. It represents the - // provenance filename of the built attestation which directly relates to the - // build artifact filename. This filename SHOULD accompany the artifact at - // publish time. See the [SLSA Relationship] specification for more information. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "golang-binary-amd64-v0.1.0.attestation", - // "docker-image-amd64-v0.1.0.intoto.json1", "release-1.tar.gz.attestation", - // "file-name-package.tar.gz.intoto.json1" - // - // [SLSA Relationship]: https://slsa.dev/spec/v1.0/distributing-provenance#relationship-between-artifacts-and-attestations - ArtifactAttestationFilenameKey = attribute.Key("artifact.attestation.filename") - - // ArtifactAttestationHashKey is the attribute Key conforming to the - // "artifact.attestation.hash" semantic conventions. It represents the full - // [hash value (see glossary)], of the built attestation. Some envelopes in the - // [software attestation space] also refer to this as the **digest**. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "1b31dfcd5b7f9267bf2ff47651df1cfb9147b9e4df1f335accf65b4cda498408" - // - // [hash value (see glossary)]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf - // [software attestation space]: https://github.com/in-toto/attestation/tree/main/spec - ArtifactAttestationHashKey = attribute.Key("artifact.attestation.hash") - - // ArtifactAttestationIDKey is the attribute Key conforming to the - // "artifact.attestation.id" semantic conventions. It represents the id of the - // build [software attestation]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "123" - // - // [software attestation]: https://slsa.dev/attestation-model - ArtifactAttestationIDKey = attribute.Key("artifact.attestation.id") - - // ArtifactFilenameKey is the attribute Key conforming to the - // "artifact.filename" semantic conventions. It represents the human readable - // file name of the artifact, typically generated during build and release - // processes. Often includes the package name and version in the file name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "golang-binary-amd64-v0.1.0", "docker-image-amd64-v0.1.0", - // "release-1.tar.gz", "file-name-package.tar.gz" - // Note: This file name can also act as the [Package Name] - // in cases where the package ecosystem maps accordingly. - // Additionally, the artifact [can be published] - // for others, but that is not a guarantee. - // - // [Package Name]: https://slsa.dev/spec/v1.0/terminology#package-model - // [can be published]: https://slsa.dev/spec/v1.0/terminology#software-supply-chain - ArtifactFilenameKey = attribute.Key("artifact.filename") - - // ArtifactHashKey is the attribute Key conforming to the "artifact.hash" - // semantic conventions. It represents the full [hash value (see glossary)], - // often found in checksum.txt on a release of the artifact and used to verify - // package integrity. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "9ff4c52759e2c4ac70b7d517bc7fcdc1cda631ca0045271ddd1b192544f8a3e9" - // Note: The specific algorithm used to create the cryptographic hash value is - // not defined. In situations where an artifact has multiple - // cryptographic hashes, it is up to the implementer to choose which - // hash value to set here; this should be the most secure hash algorithm - // that is suitable for the situation and consistent with the - // corresponding attestation. The implementer can then provide the other - // hash values through an additional set of attribute extensions as they - // deem necessary. - // - // [hash value (see glossary)]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf - ArtifactHashKey = attribute.Key("artifact.hash") - - // ArtifactPurlKey is the attribute Key conforming to the "artifact.purl" - // semantic conventions. It represents the [Package URL] of the - // [package artifact] provides a standard way to identify and locate the - // packaged artifact. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "pkg:github/package-url/purl-spec@1209109710924", - // "pkg:npm/foo@12.12.3" - // - // [Package URL]: https://github.com/package-url/purl-spec - // [package artifact]: https://slsa.dev/spec/v1.0/terminology#package-model - ArtifactPurlKey = attribute.Key("artifact.purl") - - // ArtifactVersionKey is the attribute Key conforming to the "artifact.version" - // semantic conventions. It represents the version of the artifact. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "v0.1.0", "1.2.1", "122691-build" - ArtifactVersionKey = attribute.Key("artifact.version") -) - -// ArtifactAttestationFilename returns an attribute KeyValue conforming to the -// "artifact.attestation.filename" semantic conventions. It represents the -// provenance filename of the built attestation which directly relates to the -// build artifact filename. This filename SHOULD accompany the artifact at -// publish time. See the [SLSA Relationship] specification for more information. -// -// [SLSA Relationship]: https://slsa.dev/spec/v1.0/distributing-provenance#relationship-between-artifacts-and-attestations -func ArtifactAttestationFilename(val string) attribute.KeyValue { - return ArtifactAttestationFilenameKey.String(val) -} - -// ArtifactAttestationHash returns an attribute KeyValue conforming to the -// "artifact.attestation.hash" semantic conventions. It represents the full -// [hash value (see glossary)], of the built attestation. Some envelopes in the -// [software attestation space] also refer to this as the **digest**. -// -// [hash value (see glossary)]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf -// [software attestation space]: https://github.com/in-toto/attestation/tree/main/spec -func ArtifactAttestationHash(val string) attribute.KeyValue { - return ArtifactAttestationHashKey.String(val) -} - -// ArtifactAttestationID returns an attribute KeyValue conforming to the -// "artifact.attestation.id" semantic conventions. It represents the id of the -// build [software attestation]. -// -// [software attestation]: https://slsa.dev/attestation-model -func ArtifactAttestationID(val string) attribute.KeyValue { - return ArtifactAttestationIDKey.String(val) -} - -// ArtifactFilename returns an attribute KeyValue conforming to the -// "artifact.filename" semantic conventions. It represents the human readable -// file name of the artifact, typically generated during build and release -// processes. Often includes the package name and version in the file name. -func ArtifactFilename(val string) attribute.KeyValue { - return ArtifactFilenameKey.String(val) -} - -// ArtifactHash returns an attribute KeyValue conforming to the "artifact.hash" -// semantic conventions. It represents the full [hash value (see glossary)], -// often found in checksum.txt on a release of the artifact and used to verify -// package integrity. -// -// [hash value (see glossary)]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf -func ArtifactHash(val string) attribute.KeyValue { - return ArtifactHashKey.String(val) -} - -// ArtifactPurl returns an attribute KeyValue conforming to the "artifact.purl" -// semantic conventions. It represents the [Package URL] of the -// [package artifact] provides a standard way to identify and locate the packaged -// artifact. -// -// [Package URL]: https://github.com/package-url/purl-spec -// [package artifact]: https://slsa.dev/spec/v1.0/terminology#package-model -func ArtifactPurl(val string) attribute.KeyValue { - return ArtifactPurlKey.String(val) -} - -// ArtifactVersion returns an attribute KeyValue conforming to the -// "artifact.version" semantic conventions. It represents the version of the -// artifact. -func ArtifactVersion(val string) attribute.KeyValue { - return ArtifactVersionKey.String(val) -} - -// Namespace: aws -const ( - // AWSBedrockGuardrailIDKey is the attribute Key conforming to the - // "aws.bedrock.guardrail.id" semantic conventions. It represents the unique - // identifier of the AWS Bedrock Guardrail. A [guardrail] helps safeguard and - // prevent unwanted behavior from model responses or user messages. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "sgi5gkybzqak" - // - // [guardrail]: https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html - AWSBedrockGuardrailIDKey = attribute.Key("aws.bedrock.guardrail.id") - - // AWSBedrockKnowledgeBaseIDKey is the attribute Key conforming to the - // "aws.bedrock.knowledge_base.id" semantic conventions. It represents the - // unique identifier of the AWS Bedrock Knowledge base. A [knowledge base] is a - // bank of information that can be queried by models to generate more relevant - // responses and augment prompts. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "XFWUPB9PAW" - // - // [knowledge base]: https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base.html - AWSBedrockKnowledgeBaseIDKey = attribute.Key("aws.bedrock.knowledge_base.id") - - // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to the - // "aws.dynamodb.attribute_definitions" semantic conventions. It represents the - // JSON-serialized value of each item in the `AttributeDefinitions` request - // field. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "{ "AttributeName": "string", "AttributeType": "string" }" - AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - - // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the - // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the - // value of the `AttributesToGet` request parameter. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "lives", "id" - AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") - - // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the - // "aws.dynamodb.consistent_read" semantic conventions. It represents the value - // of the `ConsistentRead` request parameter. - // - // Type: boolean - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") - - // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the - // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the - // JSON-serialized value of each item in the `ConsumedCapacity` response field. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "{ "CapacityUnits": number, "GlobalSecondaryIndexes": { "string" : - // { "CapacityUnits": number, "ReadCapacityUnits": number, "WriteCapacityUnits": - // number } }, "LocalSecondaryIndexes": { "string" : { "CapacityUnits": number, - // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }, - // "ReadCapacityUnits": number, "Table": { "CapacityUnits": number, - // "ReadCapacityUnits": number, "WriteCapacityUnits": number }, "TableName": - // "string", "WriteCapacityUnits": number }" - AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") - - // AWSDynamoDBCountKey is the attribute Key conforming to the - // "aws.dynamodb.count" semantic conventions. It represents the value of the - // `Count` response parameter. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 10 - AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") - - // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the - // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents the - // value of the `ExclusiveStartTableName` request parameter. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Users", "CatsTable" - AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - - // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key conforming to - // the "aws.dynamodb.global_secondary_index_updates" semantic conventions. It - // represents the JSON-serialized value of each item in the - // `GlobalSecondaryIndexUpdates` request field. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "{ "Create": { "IndexName": "string", "KeySchema": [ { - // "AttributeName": "string", "KeyType": "string" } ], "Projection": { - // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, - // "ProvisionedThroughput": { "ReadCapacityUnits": number, "WriteCapacityUnits": - // number } }" - AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") - - // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to the - // "aws.dynamodb.global_secondary_indexes" semantic conventions. It represents - // the JSON-serialized value of each item of the `GlobalSecondaryIndexes` - // request field. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "{ "IndexName": "string", "KeySchema": [ { "AttributeName": - // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ - // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { - // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }" - AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") - - // AWSDynamoDBIndexNameKey is the attribute Key conforming to the - // "aws.dynamodb.index_name" semantic conventions. It represents the value of - // the `IndexName` request parameter. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "name_to_group" - AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") - - // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to the - // "aws.dynamodb.item_collection_metrics" semantic conventions. It represents - // the JSON-serialized value of the `ItemCollectionMetrics` response field. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "{ "string" : [ { "ItemCollectionKey": { "string" : { "B": blob, - // "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { "string" : - // "AttributeValue" }, "N": "string", "NS": [ "string" ], "NULL": boolean, "S": - // "string", "SS": [ "string" ] } }, "SizeEstimateRangeGB": [ number ] } ] }" - AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") - - // AWSDynamoDBLimitKey is the attribute Key conforming to the - // "aws.dynamodb.limit" semantic conventions. It represents the value of the - // `Limit` request parameter. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 10 - AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") - - // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to the - // "aws.dynamodb.local_secondary_indexes" semantic conventions. It represents - // the JSON-serialized value of each item of the `LocalSecondaryIndexes` request - // field. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "{ "IndexArn": "string", "IndexName": "string", "IndexSizeBytes": - // number, "ItemCount": number, "KeySchema": [ { "AttributeName": "string", - // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], - // "ProjectionType": "string" } }" - AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") - - // AWSDynamoDBProjectionKey is the attribute Key conforming to the - // "aws.dynamodb.projection" semantic conventions. It represents the value of - // the `ProjectionExpression` request parameter. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Title", "Title, Price, Color", "Title, Description, RelatedItems, - // ProductReviews" - AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") - - // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to the - // "aws.dynamodb.provisioned_read_capacity" semantic conventions. It represents - // the value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 1.0, 2.0 - AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") - - // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming to the - // "aws.dynamodb.provisioned_write_capacity" semantic conventions. It represents - // the value of the `ProvisionedThroughput.WriteCapacityUnits` request - // parameter. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 1.0, 2.0 - AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") - - // AWSDynamoDBScanForwardKey is the attribute Key conforming to the - // "aws.dynamodb.scan_forward" semantic conventions. It represents the value of - // the `ScanIndexForward` request parameter. - // - // Type: boolean - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") - - // AWSDynamoDBScannedCountKey is the attribute Key conforming to the - // "aws.dynamodb.scanned_count" semantic conventions. It represents the value of - // the `ScannedCount` response parameter. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 50 - AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") - - // AWSDynamoDBSegmentKey is the attribute Key conforming to the - // "aws.dynamodb.segment" semantic conventions. It represents the value of the - // `Segment` request parameter. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 10 - AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") - - // AWSDynamoDBSelectKey is the attribute Key conforming to the - // "aws.dynamodb.select" semantic conventions. It represents the value of the - // `Select` request parameter. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "ALL_ATTRIBUTES", "COUNT" - AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") - - // AWSDynamoDBTableCountKey is the attribute Key conforming to the - // "aws.dynamodb.table_count" semantic conventions. It represents the number of - // items in the `TableNames` response parameter. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 20 - AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") - - // AWSDynamoDBTableNamesKey is the attribute Key conforming to the - // "aws.dynamodb.table_names" semantic conventions. It represents the keys in - // the `RequestItems` object field. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Users", "Cats" - AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") - - // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the - // "aws.dynamodb.total_segments" semantic conventions. It represents the value - // of the `TotalSegments` request parameter. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 100 - AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") - - // AWSECSClusterARNKey is the attribute Key conforming to the - // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an - // [ECS cluster]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster" - // - // [ECS cluster]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html - AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") - - // AWSECSContainerARNKey is the attribute Key conforming to the - // "aws.ecs.container.arn" semantic conventions. It represents the Amazon - // Resource Name (ARN) of an [ECS container instance]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // "arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9" - // - // [ECS container instance]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html - AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") - - // AWSECSLaunchtypeKey is the attribute Key conforming to the - // "aws.ecs.launchtype" semantic conventions. It represents the [launch type] - // for an ECS task. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // - // [launch type]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html - AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") - - // AWSECSTaskARNKey is the attribute Key conforming to the "aws.ecs.task.arn" - // semantic conventions. It represents the ARN of a running [ECS task]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // "arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b", - // "arn:aws:ecs:us-west-1:123456789123:task/my-cluster/task-id/23ebb8ac-c18f-46c6-8bbe-d55d0e37cfbd" - // - // [ECS task]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids - AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") - - // AWSECSTaskFamilyKey is the attribute Key conforming to the - // "aws.ecs.task.family" semantic conventions. It represents the family name of - // the [ECS task definition] used to create the ECS task. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "opentelemetry-family" - // - // [ECS task definition]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html - AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") - - // AWSECSTaskIDKey is the attribute Key conforming to the "aws.ecs.task.id" - // semantic conventions. It represents the ID of a running ECS task. The ID MUST - // be extracted from `task.arn`. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "10838bed-421f-43ef-870a-f43feacbbb5b", - // "23ebb8ac-c18f-46c6-8bbe-d55d0e37cfbd" - AWSECSTaskIDKey = attribute.Key("aws.ecs.task.id") - - // AWSECSTaskRevisionKey is the attribute Key conforming to the - // "aws.ecs.task.revision" semantic conventions. It represents the revision for - // the task definition used to create the ECS task. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "8", "26" - AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") - - // AWSEKSClusterARNKey is the attribute Key conforming to the - // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS - // cluster. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster" - AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") - - // AWSExtendedRequestIDKey is the attribute Key conforming to the - // "aws.extended_request_id" semantic conventions. It represents the AWS - // extended request ID as returned in the response header `x-amz-id-2`. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // "wzHcyEWfmOGDIE5QOhTAqFDoDWP3y8IUvpNINCwL9N4TEHbUw0/gZJ+VZTmCNCWR7fezEN3eCiQ=" - AWSExtendedRequestIDKey = attribute.Key("aws.extended_request_id") - - // AWSKinesisStreamNameKey is the attribute Key conforming to the - // "aws.kinesis.stream_name" semantic conventions. It represents the name of the - // AWS Kinesis [stream] the request refers to. Corresponds to the - // `--stream-name` parameter of the Kinesis [describe-stream] operation. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "some-stream-name" - // - // [stream]: https://docs.aws.amazon.com/streams/latest/dev/introduction.html - // [describe-stream]: https://docs.aws.amazon.com/cli/latest/reference/kinesis/describe-stream.html - AWSKinesisStreamNameKey = attribute.Key("aws.kinesis.stream_name") - - // AWSLambdaInvokedARNKey is the attribute Key conforming to the - // "aws.lambda.invoked_arn" semantic conventions. It represents the full invoked - // ARN as provided on the `Context` passed to the function ( - // `Lambda-Runtime-Invoked-Function-Arn` header on the - // `/runtime/invocation/next` applicable). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "arn:aws:lambda:us-east-1:123456:function:myfunction:myalias" - // Note: This may be different from `cloud.resource_id` if an alias is involved. - AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") - - // AWSLambdaResourceMappingIDKey is the attribute Key conforming to the - // "aws.lambda.resource_mapping.id" semantic conventions. It represents the UUID - // of the [AWS Lambda EvenSource Mapping]. An event source is mapped to a lambda - // function. It's contents are read by Lambda and used to trigger a function. - // This isn't available in the lambda execution context or the lambda runtime - // environtment. This is going to be populated by the AWS SDK for each language - // when that UUID is present. Some of these operations are - // Create/Delete/Get/List/Update EventSourceMapping. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "587ad24b-03b9-4413-8202-bbd56b36e5b7" - // - // [AWS Lambda EvenSource Mapping]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html - AWSLambdaResourceMappingIDKey = attribute.Key("aws.lambda.resource_mapping.id") - - // AWSLogGroupARNsKey is the attribute Key conforming to the - // "aws.log.group.arns" semantic conventions. It represents the Amazon Resource - // Name(s) (ARN) of the AWS log group(s). - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*" - // Note: See the [log group ARN format documentation]. - // - // [log group ARN format documentation]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format - AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") - - // AWSLogGroupNamesKey is the attribute Key conforming to the - // "aws.log.group.names" semantic conventions. It represents the name(s) of the - // AWS log group(s) an application is writing to. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "/aws/lambda/my-function", "opentelemetry-service" - // Note: Multiple log groups must be supported for cases like multi-container - // applications, where a single application has sidecar containers, and each - // write to their own log group. - AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") - - // AWSLogStreamARNsKey is the attribute Key conforming to the - // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the - // AWS log stream(s). - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // "arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b" - // Note: See the [log stream ARN format documentation]. One log group can - // contain several log streams, so these ARNs necessarily identify both a log - // group and a log stream. - // - // [log stream ARN format documentation]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format - AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") - - // AWSLogStreamNamesKey is the attribute Key conforming to the - // "aws.log.stream.names" semantic conventions. It represents the name(s) of the - // AWS log stream(s) an application is writing to. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "logs/main/10838bed-421f-43ef-870a-f43feacbbb5b" - AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") - - // AWSRequestIDKey is the attribute Key conforming to the "aws.request_id" - // semantic conventions. It represents the AWS request ID as returned in the - // response headers `x-amzn-requestid`, `x-amzn-request-id` or - // `x-amz-request-id`. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "79b9da39-b7ae-508a-a6bc-864b2829c622", "C9ER4AJX75574TDJ" - AWSRequestIDKey = attribute.Key("aws.request_id") - - // AWSS3BucketKey is the attribute Key conforming to the "aws.s3.bucket" - // semantic conventions. It represents the S3 bucket name the request refers to. - // Corresponds to the `--bucket` parameter of the [S3 API] operations. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "some-bucket-name" - // Note: The `bucket` attribute is applicable to all S3 operations that - // reference a bucket, i.e. that require the bucket name as a mandatory - // parameter. - // This applies to almost all S3 operations except `list-buckets`. - // - // [S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html - AWSS3BucketKey = attribute.Key("aws.s3.bucket") - - // AWSS3CopySourceKey is the attribute Key conforming to the - // "aws.s3.copy_source" semantic conventions. It represents the source object - // (in the form `bucket`/`key`) for the copy operation. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "someFile.yml" - // Note: The `copy_source` attribute applies to S3 copy operations and - // corresponds to the `--copy-source` parameter - // of the [copy-object operation within the S3 API]. - // This applies in particular to the following operations: - // - // - [copy-object] - // - [upload-part-copy] - // - // - // [copy-object operation within the S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html - // [copy-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html - // [upload-part-copy]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html - AWSS3CopySourceKey = attribute.Key("aws.s3.copy_source") - - // AWSS3DeleteKey is the attribute Key conforming to the "aws.s3.delete" - // semantic conventions. It represents the delete request container that - // specifies the objects to be deleted. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // "Objects=[{Key=string,VersionId=string},{Key=string,VersionId=string}],Quiet=boolean" - // Note: The `delete` attribute is only applicable to the [delete-object] - // operation. - // The `delete` attribute corresponds to the `--delete` parameter of the - // [delete-objects operation within the S3 API]. - // - // [delete-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html - // [delete-objects operation within the S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html - AWSS3DeleteKey = attribute.Key("aws.s3.delete") - - // AWSS3KeyKey is the attribute Key conforming to the "aws.s3.key" semantic - // conventions. It represents the S3 object key the request refers to. - // Corresponds to the `--key` parameter of the [S3 API] operations. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "someFile.yml" - // Note: The `key` attribute is applicable to all object-related S3 operations, - // i.e. that require the object key as a mandatory parameter. - // This applies in particular to the following operations: - // - // - [copy-object] - // - [delete-object] - // - [get-object] - // - [head-object] - // - [put-object] - // - [restore-object] - // - [select-object-content] - // - [abort-multipart-upload] - // - [complete-multipart-upload] - // - [create-multipart-upload] - // - [list-parts] - // - [upload-part] - // - [upload-part-copy] - // - // - // [S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html - // [copy-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html - // [delete-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html - // [get-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html - // [head-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/head-object.html - // [put-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html - // [restore-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/restore-object.html - // [select-object-content]: https://docs.aws.amazon.com/cli/latest/reference/s3api/select-object-content.html - // [abort-multipart-upload]: https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html - // [complete-multipart-upload]: https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html - // [create-multipart-upload]: https://docs.aws.amazon.com/cli/latest/reference/s3api/create-multipart-upload.html - // [list-parts]: https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html - // [upload-part]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html - // [upload-part-copy]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html - AWSS3KeyKey = attribute.Key("aws.s3.key") - - // AWSS3PartNumberKey is the attribute Key conforming to the - // "aws.s3.part_number" semantic conventions. It represents the part number of - // the part being uploaded in a multipart-upload operation. This is a positive - // integer between 1 and 10,000. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 3456 - // Note: The `part_number` attribute is only applicable to the [upload-part] - // and [upload-part-copy] operations. - // The `part_number` attribute corresponds to the `--part-number` parameter of - // the - // [upload-part operation within the S3 API]. - // - // [upload-part]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html - // [upload-part-copy]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html - // [upload-part operation within the S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html - AWSS3PartNumberKey = attribute.Key("aws.s3.part_number") - - // AWSS3UploadIDKey is the attribute Key conforming to the "aws.s3.upload_id" - // semantic conventions. It represents the upload ID that identifies the - // multipart upload. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "dfRtDYWFbkRONycy.Yxwh66Yjlx.cph0gtNBtJ" - // Note: The `upload_id` attribute applies to S3 multipart-upload operations and - // corresponds to the `--upload-id` parameter - // of the [S3 API] multipart operations. - // This applies in particular to the following operations: - // - // - [abort-multipart-upload] - // - [complete-multipart-upload] - // - [list-parts] - // - [upload-part] - // - [upload-part-copy] - // - // - // [S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html - // [abort-multipart-upload]: https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html - // [complete-multipart-upload]: https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html - // [list-parts]: https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html - // [upload-part]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html - // [upload-part-copy]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html - AWSS3UploadIDKey = attribute.Key("aws.s3.upload_id") - - // AWSSecretsmanagerSecretARNKey is the attribute Key conforming to the - // "aws.secretsmanager.secret.arn" semantic conventions. It represents the ARN - // of the Secret stored in the Secrets Mangger. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // "arn:aws:secretsmanager:us-east-1:123456789012:secret:SecretName-6RandomCharacters" - AWSSecretsmanagerSecretARNKey = attribute.Key("aws.secretsmanager.secret.arn") - - // AWSSNSTopicARNKey is the attribute Key conforming to the "aws.sns.topic.arn" - // semantic conventions. It represents the ARN of the AWS SNS Topic. An Amazon - // SNS [topic] is a logical access point that acts as a communication channel. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "arn:aws:sns:us-east-1:123456789012:mystack-mytopic-NZJ5JSMVGFIE" - // - // [topic]: https://docs.aws.amazon.com/sns/latest/dg/sns-create-topic.html - AWSSNSTopicARNKey = attribute.Key("aws.sns.topic.arn") - - // AWSSQSQueueURLKey is the attribute Key conforming to the "aws.sqs.queue.url" - // semantic conventions. It represents the URL of the AWS SQS Queue. It's a - // unique identifier for a queue in Amazon Simple Queue Service (SQS) and is - // used to access the queue and perform actions on it. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue" - AWSSQSQueueURLKey = attribute.Key("aws.sqs.queue.url") - - // AWSStepFunctionsActivityARNKey is the attribute Key conforming to the - // "aws.step_functions.activity.arn" semantic conventions. It represents the ARN - // of the AWS Step Functions Activity. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "arn:aws:states:us-east-1:123456789012:activity:get-greeting" - AWSStepFunctionsActivityARNKey = attribute.Key("aws.step_functions.activity.arn") - - // AWSStepFunctionsStateMachineARNKey is the attribute Key conforming to the - // "aws.step_functions.state_machine.arn" semantic conventions. It represents - // the ARN of the AWS Step Functions State Machine. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // "arn:aws:states:us-east-1:123456789012:stateMachine:myStateMachine:1" - AWSStepFunctionsStateMachineARNKey = attribute.Key("aws.step_functions.state_machine.arn") -) - -// AWSBedrockGuardrailID returns an attribute KeyValue conforming to the -// "aws.bedrock.guardrail.id" semantic conventions. It represents the unique -// identifier of the AWS Bedrock Guardrail. A [guardrail] helps safeguard and -// prevent unwanted behavior from model responses or user messages. -// -// [guardrail]: https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html -func AWSBedrockGuardrailID(val string) attribute.KeyValue { - return AWSBedrockGuardrailIDKey.String(val) -} - -// AWSBedrockKnowledgeBaseID returns an attribute KeyValue conforming to the -// "aws.bedrock.knowledge_base.id" semantic conventions. It represents the unique -// identifier of the AWS Bedrock Knowledge base. A [knowledge base] is a bank of -// information that can be queried by models to generate more relevant responses -// and augment prompts. -// -// [knowledge base]: https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base.html -func AWSBedrockKnowledgeBaseID(val string) attribute.KeyValue { - return AWSBedrockKnowledgeBaseIDKey.String(val) -} - -// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming to -// the "aws.dynamodb.attribute_definitions" semantic conventions. It represents -// the JSON-serialized value of each item in the `AttributeDefinitions` request -// field. -func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { - return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) -} - -// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to the -// "aws.dynamodb.attributes_to_get" semantic conventions. It represents the value -// of the `AttributesToGet` request parameter. -func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { - return AWSDynamoDBAttributesToGetKey.StringSlice(val) -} - -// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the -// "aws.dynamodb.consistent_read" semantic conventions. It represents the value -// of the `ConsistentRead` request parameter. -func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { - return AWSDynamoDBConsistentReadKey.Bool(val) -} - -// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to the -// "aws.dynamodb.consumed_capacity" semantic conventions. It represents the -// JSON-serialized value of each item in the `ConsumedCapacity` response field. -func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { - return AWSDynamoDBConsumedCapacityKey.StringSlice(val) -} - -// AWSDynamoDBCount returns an attribute KeyValue conforming to the -// "aws.dynamodb.count" semantic conventions. It represents the value of the -// `Count` response parameter. -func AWSDynamoDBCount(val int) attribute.KeyValue { - return AWSDynamoDBCountKey.Int(val) -} - -// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming to the -// "aws.dynamodb.exclusive_start_table" semantic conventions. It represents the -// value of the `ExclusiveStartTableName` request parameter. -func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { - return AWSDynamoDBExclusiveStartTableKey.String(val) -} - -// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue -// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic -// conventions. It represents the JSON-serialized value of each item in the -// `GlobalSecondaryIndexUpdates` request field. -func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { - return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) -} - -// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue conforming to -// the "aws.dynamodb.global_secondary_indexes" semantic conventions. It -// represents the JSON-serialized value of each item of the -// `GlobalSecondaryIndexes` request field. -func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { - return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) -} - -// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the -// "aws.dynamodb.index_name" semantic conventions. It represents the value of the -// `IndexName` request parameter. -func AWSDynamoDBIndexName(val string) attribute.KeyValue { - return AWSDynamoDBIndexNameKey.String(val) -} - -// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming to -// the "aws.dynamodb.item_collection_metrics" semantic conventions. It represents -// the JSON-serialized value of the `ItemCollectionMetrics` response field. -func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { - return AWSDynamoDBItemCollectionMetricsKey.String(val) -} - -// AWSDynamoDBLimit returns an attribute KeyValue conforming to the -// "aws.dynamodb.limit" semantic conventions. It represents the value of the -// `Limit` request parameter. -func AWSDynamoDBLimit(val int) attribute.KeyValue { - return AWSDynamoDBLimitKey.Int(val) -} - -// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming to -// the "aws.dynamodb.local_secondary_indexes" semantic conventions. It represents -// the JSON-serialized value of each item of the `LocalSecondaryIndexes` request -// field. -func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { - return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) -} - -// AWSDynamoDBProjection returns an attribute KeyValue conforming to the -// "aws.dynamodb.projection" semantic conventions. It represents the value of the -// `ProjectionExpression` request parameter. -func AWSDynamoDBProjection(val string) attribute.KeyValue { - return AWSDynamoDBProjectionKey.String(val) -} - -// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue conforming to -// the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It -// represents the value of the `ProvisionedThroughput.ReadCapacityUnits` request -// parameter. -func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { - return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) -} - -// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue conforming -// to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. It -// represents the value of the `ProvisionedThroughput.WriteCapacityUnits` request -// parameter. -func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { - return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) -} - -// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the -// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of -// the `ScanIndexForward` request parameter. -func AWSDynamoDBScanForward(val bool) attribute.KeyValue { - return AWSDynamoDBScanForwardKey.Bool(val) -} - -// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the -// "aws.dynamodb.scanned_count" semantic conventions. It represents the value of -// the `ScannedCount` response parameter. -func AWSDynamoDBScannedCount(val int) attribute.KeyValue { - return AWSDynamoDBScannedCountKey.Int(val) -} - -// AWSDynamoDBSegment returns an attribute KeyValue conforming to the -// "aws.dynamodb.segment" semantic conventions. It represents the value of the -// `Segment` request parameter. -func AWSDynamoDBSegment(val int) attribute.KeyValue { - return AWSDynamoDBSegmentKey.Int(val) -} - -// AWSDynamoDBSelect returns an attribute KeyValue conforming to the -// "aws.dynamodb.select" semantic conventions. It represents the value of the -// `Select` request parameter. -func AWSDynamoDBSelect(val string) attribute.KeyValue { - return AWSDynamoDBSelectKey.String(val) -} - -// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the -// "aws.dynamodb.table_count" semantic conventions. It represents the number of -// items in the `TableNames` response parameter. -func AWSDynamoDBTableCount(val int) attribute.KeyValue { - return AWSDynamoDBTableCountKey.Int(val) -} - -// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the -// "aws.dynamodb.table_names" semantic conventions. It represents the keys in the -// `RequestItems` object field. -func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { - return AWSDynamoDBTableNamesKey.StringSlice(val) -} - -// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the -// "aws.dynamodb.total_segments" semantic conventions. It represents the value of -// the `TotalSegments` request parameter. -func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { - return AWSDynamoDBTotalSegmentsKey.Int(val) -} - -// AWSECSClusterARN returns an attribute KeyValue conforming to the -// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an -// [ECS cluster]. -// -// [ECS cluster]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html -func AWSECSClusterARN(val string) attribute.KeyValue { - return AWSECSClusterARNKey.String(val) -} - -// AWSECSContainerARN returns an attribute KeyValue conforming to the -// "aws.ecs.container.arn" semantic conventions. It represents the Amazon -// Resource Name (ARN) of an [ECS container instance]. -// -// [ECS container instance]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html -func AWSECSContainerARN(val string) attribute.KeyValue { - return AWSECSContainerARNKey.String(val) -} - -// AWSECSTaskARN returns an attribute KeyValue conforming to the -// "aws.ecs.task.arn" semantic conventions. It represents the ARN of a running -// [ECS task]. -// -// [ECS task]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids -func AWSECSTaskARN(val string) attribute.KeyValue { - return AWSECSTaskARNKey.String(val) -} - -// AWSECSTaskFamily returns an attribute KeyValue conforming to the -// "aws.ecs.task.family" semantic conventions. It represents the family name of -// the [ECS task definition] used to create the ECS task. -// -// [ECS task definition]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html -func AWSECSTaskFamily(val string) attribute.KeyValue { - return AWSECSTaskFamilyKey.String(val) -} - -// AWSECSTaskID returns an attribute KeyValue conforming to the "aws.ecs.task.id" -// semantic conventions. It represents the ID of a running ECS task. The ID MUST -// be extracted from `task.arn`. -func AWSECSTaskID(val string) attribute.KeyValue { - return AWSECSTaskIDKey.String(val) -} - -// AWSECSTaskRevision returns an attribute KeyValue conforming to the -// "aws.ecs.task.revision" semantic conventions. It represents the revision for -// the task definition used to create the ECS task. -func AWSECSTaskRevision(val string) attribute.KeyValue { - return AWSECSTaskRevisionKey.String(val) -} - -// AWSEKSClusterARN returns an attribute KeyValue conforming to the -// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS -// cluster. -func AWSEKSClusterARN(val string) attribute.KeyValue { - return AWSEKSClusterARNKey.String(val) -} - -// AWSExtendedRequestID returns an attribute KeyValue conforming to the -// "aws.extended_request_id" semantic conventions. It represents the AWS extended -// request ID as returned in the response header `x-amz-id-2`. -func AWSExtendedRequestID(val string) attribute.KeyValue { - return AWSExtendedRequestIDKey.String(val) -} - -// AWSKinesisStreamName returns an attribute KeyValue conforming to the -// "aws.kinesis.stream_name" semantic conventions. It represents the name of the -// AWS Kinesis [stream] the request refers to. Corresponds to the `--stream-name` -// -// parameter of the Kinesis [describe-stream] operation. -// -// [stream]: https://docs.aws.amazon.com/streams/latest/dev/introduction.html -// -// [describe-stream]: https://docs.aws.amazon.com/cli/latest/reference/kinesis/describe-stream.html -func AWSKinesisStreamName(val string) attribute.KeyValue { - return AWSKinesisStreamNameKey.String(val) -} - -// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the -// "aws.lambda.invoked_arn" semantic conventions. It represents the full invoked -// ARN as provided on the `Context` passed to the function ( -// `Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` -// -// applicable). -func AWSLambdaInvokedARN(val string) attribute.KeyValue { - return AWSLambdaInvokedARNKey.String(val) -} - -// AWSLambdaResourceMappingID returns an attribute KeyValue conforming to the -// "aws.lambda.resource_mapping.id" semantic conventions. It represents the UUID -// of the [AWS Lambda EvenSource Mapping]. An event source is mapped to a lambda -// function. It's contents are read by Lambda and used to trigger a function. -// This isn't available in the lambda execution context or the lambda runtime -// environtment. This is going to be populated by the AWS SDK for each language -// when that UUID is present. Some of these operations are -// Create/Delete/Get/List/Update EventSourceMapping. -// -// [AWS Lambda EvenSource Mapping]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html -func AWSLambdaResourceMappingID(val string) attribute.KeyValue { - return AWSLambdaResourceMappingIDKey.String(val) -} - -// AWSLogGroupARNs returns an attribute KeyValue conforming to the -// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource -// Name(s) (ARN) of the AWS log group(s). -func AWSLogGroupARNs(val ...string) attribute.KeyValue { - return AWSLogGroupARNsKey.StringSlice(val) -} - -// AWSLogGroupNames returns an attribute KeyValue conforming to the -// "aws.log.group.names" semantic conventions. It represents the name(s) of the -// AWS log group(s) an application is writing to. -func AWSLogGroupNames(val ...string) attribute.KeyValue { - return AWSLogGroupNamesKey.StringSlice(val) -} - -// AWSLogStreamARNs returns an attribute KeyValue conforming to the -// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the -// AWS log stream(s). -func AWSLogStreamARNs(val ...string) attribute.KeyValue { - return AWSLogStreamARNsKey.StringSlice(val) -} - -// AWSLogStreamNames returns an attribute KeyValue conforming to the -// "aws.log.stream.names" semantic conventions. It represents the name(s) of the -// AWS log stream(s) an application is writing to. -func AWSLogStreamNames(val ...string) attribute.KeyValue { - return AWSLogStreamNamesKey.StringSlice(val) -} - -// AWSRequestID returns an attribute KeyValue conforming to the "aws.request_id" -// semantic conventions. It represents the AWS request ID as returned in the -// response headers `x-amzn-requestid`, `x-amzn-request-id` or `x-amz-request-id` -// . -func AWSRequestID(val string) attribute.KeyValue { - return AWSRequestIDKey.String(val) -} - -// AWSS3Bucket returns an attribute KeyValue conforming to the "aws.s3.bucket" -// semantic conventions. It represents the S3 bucket name the request refers to. -// Corresponds to the `--bucket` parameter of the [S3 API] operations. -// -// [S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html -func AWSS3Bucket(val string) attribute.KeyValue { - return AWSS3BucketKey.String(val) -} - -// AWSS3CopySource returns an attribute KeyValue conforming to the -// "aws.s3.copy_source" semantic conventions. It represents the source object (in -// the form `bucket`/`key`) for the copy operation. -func AWSS3CopySource(val string) attribute.KeyValue { - return AWSS3CopySourceKey.String(val) -} - -// AWSS3Delete returns an attribute KeyValue conforming to the "aws.s3.delete" -// semantic conventions. It represents the delete request container that -// specifies the objects to be deleted. -func AWSS3Delete(val string) attribute.KeyValue { - return AWSS3DeleteKey.String(val) -} - -// AWSS3Key returns an attribute KeyValue conforming to the "aws.s3.key" semantic -// conventions. It represents the S3 object key the request refers to. -// Corresponds to the `--key` parameter of the [S3 API] operations. -// -// [S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html -func AWSS3Key(val string) attribute.KeyValue { - return AWSS3KeyKey.String(val) -} - -// AWSS3PartNumber returns an attribute KeyValue conforming to the -// "aws.s3.part_number" semantic conventions. It represents the part number of -// the part being uploaded in a multipart-upload operation. This is a positive -// integer between 1 and 10,000. -func AWSS3PartNumber(val int) attribute.KeyValue { - return AWSS3PartNumberKey.Int(val) -} - -// AWSS3UploadID returns an attribute KeyValue conforming to the -// "aws.s3.upload_id" semantic conventions. It represents the upload ID that -// identifies the multipart upload. -func AWSS3UploadID(val string) attribute.KeyValue { - return AWSS3UploadIDKey.String(val) -} - -// AWSSecretsmanagerSecretARN returns an attribute KeyValue conforming to the -// "aws.secretsmanager.secret.arn" semantic conventions. It represents the ARN of -// the Secret stored in the Secrets Mangger. -func AWSSecretsmanagerSecretARN(val string) attribute.KeyValue { - return AWSSecretsmanagerSecretARNKey.String(val) -} - -// AWSSNSTopicARN returns an attribute KeyValue conforming to the -// "aws.sns.topic.arn" semantic conventions. It represents the ARN of the AWS SNS -// Topic. An Amazon SNS [topic] is a logical access point that acts as a -// communication channel. -// -// [topic]: https://docs.aws.amazon.com/sns/latest/dg/sns-create-topic.html -func AWSSNSTopicARN(val string) attribute.KeyValue { - return AWSSNSTopicARNKey.String(val) -} - -// AWSSQSQueueURL returns an attribute KeyValue conforming to the -// "aws.sqs.queue.url" semantic conventions. It represents the URL of the AWS SQS -// Queue. It's a unique identifier for a queue in Amazon Simple Queue Service -// (SQS) and is used to access the queue and perform actions on it. -func AWSSQSQueueURL(val string) attribute.KeyValue { - return AWSSQSQueueURLKey.String(val) -} - -// AWSStepFunctionsActivityARN returns an attribute KeyValue conforming to the -// "aws.step_functions.activity.arn" semantic conventions. It represents the ARN -// of the AWS Step Functions Activity. -func AWSStepFunctionsActivityARN(val string) attribute.KeyValue { - return AWSStepFunctionsActivityARNKey.String(val) -} - -// AWSStepFunctionsStateMachineARN returns an attribute KeyValue conforming to -// the "aws.step_functions.state_machine.arn" semantic conventions. It represents -// the ARN of the AWS Step Functions State Machine. -func AWSStepFunctionsStateMachineARN(val string) attribute.KeyValue { - return AWSStepFunctionsStateMachineARNKey.String(val) -} - -// Enum values for aws.ecs.launchtype -var ( - // Amazon EC2 - // Stability: development - AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") - // Amazon Fargate - // Stability: development - AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") -) - -// Namespace: azure -const ( - // AzureClientIDKey is the attribute Key conforming to the "azure.client.id" - // semantic conventions. It represents the unique identifier of the client - // instance. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "3ba4827d-4422-483f-b59f-85b74211c11d", "storage-client-1" - AzureClientIDKey = attribute.Key("azure.client.id") - - // AzureCosmosDBConnectionModeKey is the attribute Key conforming to the - // "azure.cosmosdb.connection.mode" semantic conventions. It represents the - // cosmos client connection mode. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - AzureCosmosDBConnectionModeKey = attribute.Key("azure.cosmosdb.connection.mode") - - // AzureCosmosDBConsistencyLevelKey is the attribute Key conforming to the - // "azure.cosmosdb.consistency.level" semantic conventions. It represents the - // account or request [consistency level]. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Eventual", "ConsistentPrefix", "BoundedStaleness", "Strong", - // "Session" - // - // [consistency level]: https://learn.microsoft.com/azure/cosmos-db/consistency-levels - AzureCosmosDBConsistencyLevelKey = attribute.Key("azure.cosmosdb.consistency.level") - - // AzureCosmosDBOperationContactedRegionsKey is the attribute Key conforming to - // the "azure.cosmosdb.operation.contacted_regions" semantic conventions. It - // represents the list of regions contacted during operation in the order that - // they were contacted. If there is more than one region listed, it indicates - // that the operation was performed on multiple regions i.e. cross-regional - // call. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "North Central US", "Australia East", "Australia Southeast" - // Note: Region name matches the format of `displayName` in [Azure Location API] - // - // [Azure Location API]: https://learn.microsoft.com/rest/api/resources/subscriptions/list-locations - AzureCosmosDBOperationContactedRegionsKey = attribute.Key("azure.cosmosdb.operation.contacted_regions") - - // AzureCosmosDBOperationRequestChargeKey is the attribute Key conforming to the - // "azure.cosmosdb.operation.request_charge" semantic conventions. It represents - // the number of request units consumed by the operation. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 46.18, 1.0 - AzureCosmosDBOperationRequestChargeKey = attribute.Key("azure.cosmosdb.operation.request_charge") - - // AzureCosmosDBRequestBodySizeKey is the attribute Key conforming to the - // "azure.cosmosdb.request.body.size" semantic conventions. It represents the - // request payload size in bytes. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - AzureCosmosDBRequestBodySizeKey = attribute.Key("azure.cosmosdb.request.body.size") - - // AzureCosmosDBResponseSubStatusCodeKey is the attribute Key conforming to the - // "azure.cosmosdb.response.sub_status_code" semantic conventions. It represents - // the cosmos DB sub status code. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 1000, 1002 - AzureCosmosDBResponseSubStatusCodeKey = attribute.Key("azure.cosmosdb.response.sub_status_code") - - // AzureResourceProviderNamespaceKey is the attribute Key conforming to the - // "azure.resource_provider.namespace" semantic conventions. It represents the - // [Azure Resource Provider Namespace] as recognized by the client. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Microsoft.Storage", "Microsoft.KeyVault", "Microsoft.ServiceBus" - // - // [Azure Resource Provider Namespace]: https://learn.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers - AzureResourceProviderNamespaceKey = attribute.Key("azure.resource_provider.namespace") - - // AzureServiceRequestIDKey is the attribute Key conforming to the - // "azure.service.request.id" semantic conventions. It represents the unique - // identifier of the service request. It's generated by the Azure service and - // returned with the response. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "00000000-0000-0000-0000-000000000000" - AzureServiceRequestIDKey = attribute.Key("azure.service.request.id") -) - -// AzureClientID returns an attribute KeyValue conforming to the -// "azure.client.id" semantic conventions. It represents the unique identifier of -// the client instance. -func AzureClientID(val string) attribute.KeyValue { - return AzureClientIDKey.String(val) -} - -// AzureCosmosDBOperationContactedRegions returns an attribute KeyValue -// conforming to the "azure.cosmosdb.operation.contacted_regions" semantic -// conventions. It represents the list of regions contacted during operation in -// the order that they were contacted. If there is more than one region listed, -// it indicates that the operation was performed on multiple regions i.e. -// cross-regional call. -func AzureCosmosDBOperationContactedRegions(val ...string) attribute.KeyValue { - return AzureCosmosDBOperationContactedRegionsKey.StringSlice(val) -} - -// AzureCosmosDBOperationRequestCharge returns an attribute KeyValue conforming -// to the "azure.cosmosdb.operation.request_charge" semantic conventions. It -// represents the number of request units consumed by the operation. -func AzureCosmosDBOperationRequestCharge(val float64) attribute.KeyValue { - return AzureCosmosDBOperationRequestChargeKey.Float64(val) -} - -// AzureCosmosDBRequestBodySize returns an attribute KeyValue conforming to the -// "azure.cosmosdb.request.body.size" semantic conventions. It represents the -// request payload size in bytes. -func AzureCosmosDBRequestBodySize(val int) attribute.KeyValue { - return AzureCosmosDBRequestBodySizeKey.Int(val) -} - -// AzureCosmosDBResponseSubStatusCode returns an attribute KeyValue conforming to -// the "azure.cosmosdb.response.sub_status_code" semantic conventions. It -// represents the cosmos DB sub status code. -func AzureCosmosDBResponseSubStatusCode(val int) attribute.KeyValue { - return AzureCosmosDBResponseSubStatusCodeKey.Int(val) -} - -// AzureResourceProviderNamespace returns an attribute KeyValue conforming to the -// "azure.resource_provider.namespace" semantic conventions. It represents the -// [Azure Resource Provider Namespace] as recognized by the client. -// -// [Azure Resource Provider Namespace]: https://learn.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers -func AzureResourceProviderNamespace(val string) attribute.KeyValue { - return AzureResourceProviderNamespaceKey.String(val) -} - -// AzureServiceRequestID returns an attribute KeyValue conforming to the -// "azure.service.request.id" semantic conventions. It represents the unique -// identifier of the service request. It's generated by the Azure service and -// returned with the response. -func AzureServiceRequestID(val string) attribute.KeyValue { - return AzureServiceRequestIDKey.String(val) -} - -// Enum values for azure.cosmosdb.connection.mode -var ( - // Gateway (HTTP) connection. - // Stability: development - AzureCosmosDBConnectionModeGateway = AzureCosmosDBConnectionModeKey.String("gateway") - // Direct connection. - // Stability: development - AzureCosmosDBConnectionModeDirect = AzureCosmosDBConnectionModeKey.String("direct") -) - -// Enum values for azure.cosmosdb.consistency.level -var ( - // Strong - // Stability: development - AzureCosmosDBConsistencyLevelStrong = AzureCosmosDBConsistencyLevelKey.String("Strong") - // Bounded Staleness - // Stability: development - AzureCosmosDBConsistencyLevelBoundedStaleness = AzureCosmosDBConsistencyLevelKey.String("BoundedStaleness") - // Session - // Stability: development - AzureCosmosDBConsistencyLevelSession = AzureCosmosDBConsistencyLevelKey.String("Session") - // Eventual - // Stability: development - AzureCosmosDBConsistencyLevelEventual = AzureCosmosDBConsistencyLevelKey.String("Eventual") - // Consistent Prefix - // Stability: development - AzureCosmosDBConsistencyLevelConsistentPrefix = AzureCosmosDBConsistencyLevelKey.String("ConsistentPrefix") -) - -// Namespace: browser -const ( - // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" - // semantic conventions. It represents the array of brand name and version - // separated by a space. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: " Not A;Brand 99", "Chromium 99", "Chrome 99" - // Note: This value is intended to be taken from the [UA client hints API] ( - // `navigator.userAgentData.brands`). - // - // [UA client hints API]: https://wicg.github.io/ua-client-hints/#interface - BrowserBrandsKey = attribute.Key("browser.brands") - - // BrowserLanguageKey is the attribute Key conforming to the "browser.language" - // semantic conventions. It represents the preferred language of the user using - // the browser. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "en", "en-US", "fr", "fr-FR" - // Note: This value is intended to be taken from the Navigator API - // `navigator.language`. - BrowserLanguageKey = attribute.Key("browser.language") - - // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" - // semantic conventions. It represents a boolean that is true if the browser is - // running on a mobile device. - // - // Type: boolean - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: This value is intended to be taken from the [UA client hints API] ( - // `navigator.userAgentData.mobile`). If unavailable, this attribute SHOULD be - // left unset. - // - // [UA client hints API]: https://wicg.github.io/ua-client-hints/#interface - BrowserMobileKey = attribute.Key("browser.mobile") - - // BrowserPlatformKey is the attribute Key conforming to the "browser.platform" - // semantic conventions. It represents the platform on which the browser is - // running. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Windows", "macOS", "Android" - // Note: This value is intended to be taken from the [UA client hints API] ( - // `navigator.userAgentData.platform`). If unavailable, the legacy - // `navigator.platform` API SHOULD NOT be used instead and this attribute SHOULD - // be left unset in order for the values to be consistent. - // The list of possible values is defined in the - // [W3C User-Agent Client Hints specification]. Note that some (but not all) of - // these values can overlap with values in the - // [`os.type` and `os.name` attributes]. However, for consistency, the values in - // the `browser.platform` attribute should capture the exact value that the user - // agent provides. - // - // [UA client hints API]: https://wicg.github.io/ua-client-hints/#interface - // [W3C User-Agent Client Hints specification]: https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform - // [`os.type` and `os.name` attributes]: ./os.md - BrowserPlatformKey = attribute.Key("browser.platform") -) - -// BrowserBrands returns an attribute KeyValue conforming to the "browser.brands" -// semantic conventions. It represents the array of brand name and version -// separated by a space. -func BrowserBrands(val ...string) attribute.KeyValue { - return BrowserBrandsKey.StringSlice(val) -} - -// BrowserLanguage returns an attribute KeyValue conforming to the -// "browser.language" semantic conventions. It represents the preferred language -// of the user using the browser. -func BrowserLanguage(val string) attribute.KeyValue { - return BrowserLanguageKey.String(val) -} - -// BrowserMobile returns an attribute KeyValue conforming to the "browser.mobile" -// semantic conventions. It represents a boolean that is true if the browser is -// running on a mobile device. -func BrowserMobile(val bool) attribute.KeyValue { - return BrowserMobileKey.Bool(val) -} - -// BrowserPlatform returns an attribute KeyValue conforming to the -// "browser.platform" semantic conventions. It represents the platform on which -// the browser is running. -func BrowserPlatform(val string) attribute.KeyValue { - return BrowserPlatformKey.String(val) -} - -// Namespace: cassandra -const ( - // CassandraConsistencyLevelKey is the attribute Key conforming to the - // "cassandra.consistency.level" semantic conventions. It represents the - // consistency level of the query. Based on consistency values from [CQL]. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // - // [CQL]: https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html - CassandraConsistencyLevelKey = attribute.Key("cassandra.consistency.level") - - // CassandraCoordinatorDCKey is the attribute Key conforming to the - // "cassandra.coordinator.dc" semantic conventions. It represents the data - // center of the coordinating node for a query. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: us-west-2 - CassandraCoordinatorDCKey = attribute.Key("cassandra.coordinator.dc") - - // CassandraCoordinatorIDKey is the attribute Key conforming to the - // "cassandra.coordinator.id" semantic conventions. It represents the ID of the - // coordinating node for a query. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: be13faa2-8574-4d71-926d-27f16cf8a7af - CassandraCoordinatorIDKey = attribute.Key("cassandra.coordinator.id") - - // CassandraPageSizeKey is the attribute Key conforming to the - // "cassandra.page.size" semantic conventions. It represents the fetch size used - // for paging, i.e. how many rows will be returned at once. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 5000 - CassandraPageSizeKey = attribute.Key("cassandra.page.size") - - // CassandraQueryIdempotentKey is the attribute Key conforming to the - // "cassandra.query.idempotent" semantic conventions. It represents the whether - // or not the query is idempotent. - // - // Type: boolean - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - CassandraQueryIdempotentKey = attribute.Key("cassandra.query.idempotent") - - // CassandraSpeculativeExecutionCountKey is the attribute Key conforming to the - // "cassandra.speculative_execution.count" semantic conventions. It represents - // the number of times a query was speculatively executed. Not set or `0` if the - // query was not executed speculatively. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 0, 2 - CassandraSpeculativeExecutionCountKey = attribute.Key("cassandra.speculative_execution.count") -) - -// CassandraCoordinatorDC returns an attribute KeyValue conforming to the -// "cassandra.coordinator.dc" semantic conventions. It represents the data center -// of the coordinating node for a query. -func CassandraCoordinatorDC(val string) attribute.KeyValue { - return CassandraCoordinatorDCKey.String(val) -} - -// CassandraCoordinatorID returns an attribute KeyValue conforming to the -// "cassandra.coordinator.id" semantic conventions. It represents the ID of the -// coordinating node for a query. -func CassandraCoordinatorID(val string) attribute.KeyValue { - return CassandraCoordinatorIDKey.String(val) -} - -// CassandraPageSize returns an attribute KeyValue conforming to the -// "cassandra.page.size" semantic conventions. It represents the fetch size used -// for paging, i.e. how many rows will be returned at once. -func CassandraPageSize(val int) attribute.KeyValue { - return CassandraPageSizeKey.Int(val) -} - -// CassandraQueryIdempotent returns an attribute KeyValue conforming to the -// "cassandra.query.idempotent" semantic conventions. It represents the whether -// or not the query is idempotent. -func CassandraQueryIdempotent(val bool) attribute.KeyValue { - return CassandraQueryIdempotentKey.Bool(val) -} - -// CassandraSpeculativeExecutionCount returns an attribute KeyValue conforming to -// the "cassandra.speculative_execution.count" semantic conventions. It -// represents the number of times a query was speculatively executed. Not set or -// `0` if the query was not executed speculatively. -func CassandraSpeculativeExecutionCount(val int) attribute.KeyValue { - return CassandraSpeculativeExecutionCountKey.Int(val) -} - -// Enum values for cassandra.consistency.level -var ( - // All - // Stability: development - CassandraConsistencyLevelAll = CassandraConsistencyLevelKey.String("all") - // Each Quorum - // Stability: development - CassandraConsistencyLevelEachQuorum = CassandraConsistencyLevelKey.String("each_quorum") - // Quorum - // Stability: development - CassandraConsistencyLevelQuorum = CassandraConsistencyLevelKey.String("quorum") - // Local Quorum - // Stability: development - CassandraConsistencyLevelLocalQuorum = CassandraConsistencyLevelKey.String("local_quorum") - // One - // Stability: development - CassandraConsistencyLevelOne = CassandraConsistencyLevelKey.String("one") - // Two - // Stability: development - CassandraConsistencyLevelTwo = CassandraConsistencyLevelKey.String("two") - // Three - // Stability: development - CassandraConsistencyLevelThree = CassandraConsistencyLevelKey.String("three") - // Local One - // Stability: development - CassandraConsistencyLevelLocalOne = CassandraConsistencyLevelKey.String("local_one") - // Any - // Stability: development - CassandraConsistencyLevelAny = CassandraConsistencyLevelKey.String("any") - // Serial - // Stability: development - CassandraConsistencyLevelSerial = CassandraConsistencyLevelKey.String("serial") - // Local Serial - // Stability: development - CassandraConsistencyLevelLocalSerial = CassandraConsistencyLevelKey.String("local_serial") -) - -// Namespace: cicd -const ( - // CICDPipelineActionNameKey is the attribute Key conforming to the - // "cicd.pipeline.action.name" semantic conventions. It represents the kind of - // action a pipeline run is performing. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "BUILD", "RUN", "SYNC" - CICDPipelineActionNameKey = attribute.Key("cicd.pipeline.action.name") - - // CICDPipelineNameKey is the attribute Key conforming to the - // "cicd.pipeline.name" semantic conventions. It represents the human readable - // name of the pipeline within a CI/CD system. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Build and Test", "Lint", "Deploy Go Project", - // "deploy_to_environment" - CICDPipelineNameKey = attribute.Key("cicd.pipeline.name") - - // CICDPipelineResultKey is the attribute Key conforming to the - // "cicd.pipeline.result" semantic conventions. It represents the result of a - // pipeline run. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "success", "failure", "timeout", "skipped" - CICDPipelineResultKey = attribute.Key("cicd.pipeline.result") - - // CICDPipelineRunIDKey is the attribute Key conforming to the - // "cicd.pipeline.run.id" semantic conventions. It represents the unique - // identifier of a pipeline run within a CI/CD system. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "120912" - CICDPipelineRunIDKey = attribute.Key("cicd.pipeline.run.id") - - // CICDPipelineRunStateKey is the attribute Key conforming to the - // "cicd.pipeline.run.state" semantic conventions. It represents the pipeline - // run goes through these states during its lifecycle. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "pending", "executing", "finalizing" - CICDPipelineRunStateKey = attribute.Key("cicd.pipeline.run.state") - - // CICDPipelineRunURLFullKey is the attribute Key conforming to the - // "cicd.pipeline.run.url.full" semantic conventions. It represents the [URL] of - // the pipeline run, providing the complete address in order to locate and - // identify the pipeline run. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // "https://github.com/open-telemetry/semantic-conventions/actions/runs/9753949763?pr=1075" - // - // [URL]: https://wikipedia.org/wiki/URL - CICDPipelineRunURLFullKey = attribute.Key("cicd.pipeline.run.url.full") - - // CICDPipelineTaskNameKey is the attribute Key conforming to the - // "cicd.pipeline.task.name" semantic conventions. It represents the human - // readable name of a task within a pipeline. Task here most closely aligns with - // a [computing process] in a pipeline. Other terms for tasks include commands, - // steps, and procedures. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Run GoLang Linter", "Go Build", "go-test", "deploy_binary" - // - // [computing process]: https://wikipedia.org/wiki/Pipeline_(computing) - CICDPipelineTaskNameKey = attribute.Key("cicd.pipeline.task.name") - - // CICDPipelineTaskRunIDKey is the attribute Key conforming to the - // "cicd.pipeline.task.run.id" semantic conventions. It represents the unique - // identifier of a task run within a pipeline. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "12097" - CICDPipelineTaskRunIDKey = attribute.Key("cicd.pipeline.task.run.id") - - // CICDPipelineTaskRunResultKey is the attribute Key conforming to the - // "cicd.pipeline.task.run.result" semantic conventions. It represents the - // result of a task run. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "success", "failure", "timeout", "skipped" - CICDPipelineTaskRunResultKey = attribute.Key("cicd.pipeline.task.run.result") - - // CICDPipelineTaskRunURLFullKey is the attribute Key conforming to the - // "cicd.pipeline.task.run.url.full" semantic conventions. It represents the - // [URL] of the pipeline task run, providing the complete address in order to - // locate and identify the pipeline task run. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // "https://github.com/open-telemetry/semantic-conventions/actions/runs/9753949763/job/26920038674?pr=1075" - // - // [URL]: https://wikipedia.org/wiki/URL - CICDPipelineTaskRunURLFullKey = attribute.Key("cicd.pipeline.task.run.url.full") - - // CICDPipelineTaskTypeKey is the attribute Key conforming to the - // "cicd.pipeline.task.type" semantic conventions. It represents the type of the - // task within a pipeline. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "build", "test", "deploy" - CICDPipelineTaskTypeKey = attribute.Key("cicd.pipeline.task.type") - - // CICDSystemComponentKey is the attribute Key conforming to the - // "cicd.system.component" semantic conventions. It represents the name of a - // component of the CICD system. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "controller", "scheduler", "agent" - CICDSystemComponentKey = attribute.Key("cicd.system.component") - - // CICDWorkerIDKey is the attribute Key conforming to the "cicd.worker.id" - // semantic conventions. It represents the unique identifier of a worker within - // a CICD system. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "abc123", "10.0.1.2", "controller" - CICDWorkerIDKey = attribute.Key("cicd.worker.id") - - // CICDWorkerNameKey is the attribute Key conforming to the "cicd.worker.name" - // semantic conventions. It represents the name of a worker within a CICD - // system. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "agent-abc", "controller", "Ubuntu LTS" - CICDWorkerNameKey = attribute.Key("cicd.worker.name") - - // CICDWorkerStateKey is the attribute Key conforming to the "cicd.worker.state" - // semantic conventions. It represents the state of a CICD worker / agent. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "idle", "busy", "down" - CICDWorkerStateKey = attribute.Key("cicd.worker.state") - - // CICDWorkerURLFullKey is the attribute Key conforming to the - // "cicd.worker.url.full" semantic conventions. It represents the [URL] of the - // worker, providing the complete address in order to locate and identify the - // worker. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "https://cicd.example.org/worker/abc123" - // - // [URL]: https://wikipedia.org/wiki/URL - CICDWorkerURLFullKey = attribute.Key("cicd.worker.url.full") -) - -// CICDPipelineName returns an attribute KeyValue conforming to the -// "cicd.pipeline.name" semantic conventions. It represents the human readable -// name of the pipeline within a CI/CD system. -func CICDPipelineName(val string) attribute.KeyValue { - return CICDPipelineNameKey.String(val) -} - -// CICDPipelineRunID returns an attribute KeyValue conforming to the -// "cicd.pipeline.run.id" semantic conventions. It represents the unique -// identifier of a pipeline run within a CI/CD system. -func CICDPipelineRunID(val string) attribute.KeyValue { - return CICDPipelineRunIDKey.String(val) -} - -// CICDPipelineRunURLFull returns an attribute KeyValue conforming to the -// "cicd.pipeline.run.url.full" semantic conventions. It represents the [URL] of -// the pipeline run, providing the complete address in order to locate and -// identify the pipeline run. -// -// [URL]: https://wikipedia.org/wiki/URL -func CICDPipelineRunURLFull(val string) attribute.KeyValue { - return CICDPipelineRunURLFullKey.String(val) -} - -// CICDPipelineTaskName returns an attribute KeyValue conforming to the -// "cicd.pipeline.task.name" semantic conventions. It represents the human -// readable name of a task within a pipeline. Task here most closely aligns with -// a [computing process] in a pipeline. Other terms for tasks include commands, -// steps, and procedures. -// -// [computing process]: https://wikipedia.org/wiki/Pipeline_(computing) -func CICDPipelineTaskName(val string) attribute.KeyValue { - return CICDPipelineTaskNameKey.String(val) -} - -// CICDPipelineTaskRunID returns an attribute KeyValue conforming to the -// "cicd.pipeline.task.run.id" semantic conventions. It represents the unique -// identifier of a task run within a pipeline. -func CICDPipelineTaskRunID(val string) attribute.KeyValue { - return CICDPipelineTaskRunIDKey.String(val) -} - -// CICDPipelineTaskRunURLFull returns an attribute KeyValue conforming to the -// "cicd.pipeline.task.run.url.full" semantic conventions. It represents the -// [URL] of the pipeline task run, providing the complete address in order to -// locate and identify the pipeline task run. -// -// [URL]: https://wikipedia.org/wiki/URL -func CICDPipelineTaskRunURLFull(val string) attribute.KeyValue { - return CICDPipelineTaskRunURLFullKey.String(val) -} - -// CICDSystemComponent returns an attribute KeyValue conforming to the -// "cicd.system.component" semantic conventions. It represents the name of a -// component of the CICD system. -func CICDSystemComponent(val string) attribute.KeyValue { - return CICDSystemComponentKey.String(val) -} - -// CICDWorkerID returns an attribute KeyValue conforming to the "cicd.worker.id" -// semantic conventions. It represents the unique identifier of a worker within a -// CICD system. -func CICDWorkerID(val string) attribute.KeyValue { - return CICDWorkerIDKey.String(val) -} - -// CICDWorkerName returns an attribute KeyValue conforming to the -// "cicd.worker.name" semantic conventions. It represents the name of a worker -// within a CICD system. -func CICDWorkerName(val string) attribute.KeyValue { - return CICDWorkerNameKey.String(val) -} - -// CICDWorkerURLFull returns an attribute KeyValue conforming to the -// "cicd.worker.url.full" semantic conventions. It represents the [URL] of the -// worker, providing the complete address in order to locate and identify the -// worker. -// -// [URL]: https://wikipedia.org/wiki/URL -func CICDWorkerURLFull(val string) attribute.KeyValue { - return CICDWorkerURLFullKey.String(val) -} - -// Enum values for cicd.pipeline.action.name -var ( - // The pipeline run is executing a build. - // Stability: development - CICDPipelineActionNameBuild = CICDPipelineActionNameKey.String("BUILD") - // The pipeline run is executing. - // Stability: development - CICDPipelineActionNameRun = CICDPipelineActionNameKey.String("RUN") - // The pipeline run is executing a sync. - // Stability: development - CICDPipelineActionNameSync = CICDPipelineActionNameKey.String("SYNC") -) - -// Enum values for cicd.pipeline.result -var ( - // The pipeline run finished successfully. - // Stability: development - CICDPipelineResultSuccess = CICDPipelineResultKey.String("success") - // The pipeline run did not finish successfully, eg. due to a compile error or a - // failing test. Such failures are usually detected by non-zero exit codes of - // the tools executed in the pipeline run. - // Stability: development - CICDPipelineResultFailure = CICDPipelineResultKey.String("failure") - // The pipeline run failed due to an error in the CICD system, eg. due to the - // worker being killed. - // Stability: development - CICDPipelineResultError = CICDPipelineResultKey.String("error") - // A timeout caused the pipeline run to be interrupted. - // Stability: development - CICDPipelineResultTimeout = CICDPipelineResultKey.String("timeout") - // The pipeline run was cancelled, eg. by a user manually cancelling the - // pipeline run. - // Stability: development - CICDPipelineResultCancellation = CICDPipelineResultKey.String("cancellation") - // The pipeline run was skipped, eg. due to a precondition not being met. - // Stability: development - CICDPipelineResultSkip = CICDPipelineResultKey.String("skip") -) - -// Enum values for cicd.pipeline.run.state -var ( - // The run pending state spans from the event triggering the pipeline run until - // the execution of the run starts (eg. time spent in a queue, provisioning - // agents, creating run resources). - // - // Stability: development - CICDPipelineRunStatePending = CICDPipelineRunStateKey.String("pending") - // The executing state spans the execution of any run tasks (eg. build, test). - // Stability: development - CICDPipelineRunStateExecuting = CICDPipelineRunStateKey.String("executing") - // The finalizing state spans from when the run has finished executing (eg. - // cleanup of run resources). - // Stability: development - CICDPipelineRunStateFinalizing = CICDPipelineRunStateKey.String("finalizing") -) - -// Enum values for cicd.pipeline.task.run.result -var ( - // The task run finished successfully. - // Stability: development - CICDPipelineTaskRunResultSuccess = CICDPipelineTaskRunResultKey.String("success") - // The task run did not finish successfully, eg. due to a compile error or a - // failing test. Such failures are usually detected by non-zero exit codes of - // the tools executed in the task run. - // Stability: development - CICDPipelineTaskRunResultFailure = CICDPipelineTaskRunResultKey.String("failure") - // The task run failed due to an error in the CICD system, eg. due to the worker - // being killed. - // Stability: development - CICDPipelineTaskRunResultError = CICDPipelineTaskRunResultKey.String("error") - // A timeout caused the task run to be interrupted. - // Stability: development - CICDPipelineTaskRunResultTimeout = CICDPipelineTaskRunResultKey.String("timeout") - // The task run was cancelled, eg. by a user manually cancelling the task run. - // Stability: development - CICDPipelineTaskRunResultCancellation = CICDPipelineTaskRunResultKey.String("cancellation") - // The task run was skipped, eg. due to a precondition not being met. - // Stability: development - CICDPipelineTaskRunResultSkip = CICDPipelineTaskRunResultKey.String("skip") -) - -// Enum values for cicd.pipeline.task.type -var ( - // build - // Stability: development - CICDPipelineTaskTypeBuild = CICDPipelineTaskTypeKey.String("build") - // test - // Stability: development - CICDPipelineTaskTypeTest = CICDPipelineTaskTypeKey.String("test") - // deploy - // Stability: development - CICDPipelineTaskTypeDeploy = CICDPipelineTaskTypeKey.String("deploy") -) - -// Enum values for cicd.worker.state -var ( - // The worker is not performing work for the CICD system. It is available to the - // CICD system to perform work on (online / idle). - // Stability: development - CICDWorkerStateAvailable = CICDWorkerStateKey.String("available") - // The worker is performing work for the CICD system. - // Stability: development - CICDWorkerStateBusy = CICDWorkerStateKey.String("busy") - // The worker is not available to the CICD system (disconnected / down). - // Stability: development - CICDWorkerStateOffline = CICDWorkerStateKey.String("offline") -) - -// Namespace: client -const ( - // ClientAddressKey is the attribute Key conforming to the "client.address" - // semantic conventions. It represents the client address - domain name if - // available without reverse DNS lookup; otherwise, IP address or Unix domain - // socket name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "client.example.com", "10.1.2.80", "/tmp/my.sock" - // Note: When observed from the server side, and when communicating through an - // intermediary, `client.address` SHOULD represent the client address behind any - // intermediaries, for example proxies, if it's available. - ClientAddressKey = attribute.Key("client.address") - - // ClientPortKey is the attribute Key conforming to the "client.port" semantic - // conventions. It represents the client port number. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: 65123 - // Note: When observed from the server side, and when communicating through an - // intermediary, `client.port` SHOULD represent the client port behind any - // intermediaries, for example proxies, if it's available. - ClientPortKey = attribute.Key("client.port") -) - -// ClientAddress returns an attribute KeyValue conforming to the "client.address" -// semantic conventions. It represents the client address - domain name if -// available without reverse DNS lookup; otherwise, IP address or Unix domain -// socket name. -func ClientAddress(val string) attribute.KeyValue { - return ClientAddressKey.String(val) -} - -// ClientPort returns an attribute KeyValue conforming to the "client.port" -// semantic conventions. It represents the client port number. -func ClientPort(val int) attribute.KeyValue { - return ClientPortKey.Int(val) -} - -// Namespace: cloud -const ( - // CloudAccountIDKey is the attribute Key conforming to the "cloud.account.id" - // semantic conventions. It represents the cloud account ID the resource is - // assigned to. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "111111111111", "opentelemetry" - CloudAccountIDKey = attribute.Key("cloud.account.id") - - // CloudAvailabilityZoneKey is the attribute Key conforming to the - // "cloud.availability_zone" semantic conventions. It represents the cloud - // regions often have multiple, isolated locations known as zones to increase - // availability. Availability zone represents the zone where the resource is - // running. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "us-east-1c" - // Note: Availability zones are called "zones" on Alibaba Cloud and Google - // Cloud. - CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") - - // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" - // semantic conventions. It represents the cloud platform in use. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: The prefix of the service SHOULD match the one specified in - // `cloud.provider`. - CloudPlatformKey = attribute.Key("cloud.platform") - - // CloudProviderKey is the attribute Key conforming to the "cloud.provider" - // semantic conventions. It represents the name of the cloud provider. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - CloudProviderKey = attribute.Key("cloud.provider") - - // CloudRegionKey is the attribute Key conforming to the "cloud.region" semantic - // conventions. It represents the geographical region within a cloud provider. - // When associated with a resource, this attribute specifies the region where - // the resource operates. When calling services or APIs deployed on a cloud, - // this attribute identifies the region where the called destination is - // deployed. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "us-central1", "us-east-1" - // Note: Refer to your provider's docs to see the available regions, for example - // [Alibaba Cloud regions], [AWS regions], [Azure regions], - // [Google Cloud regions], or [Tencent Cloud regions]. - // - // [Alibaba Cloud regions]: https://www.alibabacloud.com/help/doc-detail/40654.htm - // [AWS regions]: https://aws.amazon.com/about-aws/global-infrastructure/regions_az/ - // [Azure regions]: https://azure.microsoft.com/global-infrastructure/geographies/ - // [Google Cloud regions]: https://cloud.google.com/about/locations - // [Tencent Cloud regions]: https://www.tencentcloud.com/document/product/213/6091 - CloudRegionKey = attribute.Key("cloud.region") - - // CloudResourceIDKey is the attribute Key conforming to the "cloud.resource_id" - // semantic conventions. It represents the cloud provider-specific native - // identifier of the monitored cloud resource (e.g. an [ARN] on AWS, a - // [fully qualified resource ID] on Azure, a [full resource name] on GCP). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function", - // "//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID", - // "/subscriptions//resourceGroups/ - // /providers/Microsoft.Web/sites//functions/" - // Note: On some cloud providers, it may not be possible to determine the full - // ID at startup, - // so it may be necessary to set `cloud.resource_id` as a span attribute - // instead. - // - // The exact value to use for `cloud.resource_id` depends on the cloud provider. - // The following well-known definitions MUST be used if you set this attribute - // and they apply: - // - // - **AWS Lambda:** The function [ARN]. - // Take care not to use the "invoked ARN" directly but replace any - // [alias suffix] - // with the resolved function version, as the same runtime instance may be - // invocable with - // multiple different aliases. - // - **GCP:** The [URI of the resource] - // - **Azure:** The [Fully Qualified Resource ID] of the invoked function, - // *not* the function app, having the form - // - // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/` - // . - // This means that a span attribute MUST be used, as an Azure function app - // can host multiple functions that would usually share - // a TracerProvider. - // - // - // [ARN]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html - // [fully qualified resource ID]: https://learn.microsoft.com/rest/api/resources/resources/get-by-id - // [full resource name]: https://google.aip.dev/122#full-resource-names - // [ARN]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html - // [alias suffix]: https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html - // [URI of the resource]: https://cloud.google.com/iam/docs/full-resource-names - // [Fully Qualified Resource ID]: https://learn.microsoft.com/rest/api/resources/resources/get-by-id - CloudResourceIDKey = attribute.Key("cloud.resource_id") -) - -// CloudAccountID returns an attribute KeyValue conforming to the -// "cloud.account.id" semantic conventions. It represents the cloud account ID -// the resource is assigned to. -func CloudAccountID(val string) attribute.KeyValue { - return CloudAccountIDKey.String(val) -} - -// CloudAvailabilityZone returns an attribute KeyValue conforming to the -// "cloud.availability_zone" semantic conventions. It represents the cloud -// regions often have multiple, isolated locations known as zones to increase -// availability. Availability zone represents the zone where the resource is -// running. -func CloudAvailabilityZone(val string) attribute.KeyValue { - return CloudAvailabilityZoneKey.String(val) -} - -// CloudRegion returns an attribute KeyValue conforming to the "cloud.region" -// semantic conventions. It represents the geographical region within a cloud -// provider. When associated with a resource, this attribute specifies the region -// where the resource operates. When calling services or APIs deployed on a -// cloud, this attribute identifies the region where the called destination is -// deployed. -func CloudRegion(val string) attribute.KeyValue { - return CloudRegionKey.String(val) -} - -// CloudResourceID returns an attribute KeyValue conforming to the -// "cloud.resource_id" semantic conventions. It represents the cloud -// provider-specific native identifier of the monitored cloud resource (e.g. an -// [ARN] on AWS, a [fully qualified resource ID] on Azure, a [full resource name] -// -// on GCP). -// -// [ARN]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html -// [fully qualified resource ID]: https://learn.microsoft.com/rest/api/resources/resources/get-by-id -// [full resource name]: https://google.aip.dev/122#full-resource-names -func CloudResourceID(val string) attribute.KeyValue { - return CloudResourceIDKey.String(val) -} - -// Enum values for cloud.platform -var ( - // Akamai Cloud Compute - // Stability: development - CloudPlatformAkamaiCloudCompute = CloudPlatformKey.String("akamai_cloud.compute") - // Alibaba Cloud Elastic Compute Service - // Stability: development - CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") - // Alibaba Cloud Function Compute - // Stability: development - CloudPlatformAlibabaCloudFC = CloudPlatformKey.String("alibaba_cloud_fc") - // Red Hat OpenShift on Alibaba Cloud - // Stability: development - CloudPlatformAlibabaCloudOpenShift = CloudPlatformKey.String("alibaba_cloud_openshift") - // AWS Elastic Compute Cloud - // Stability: development - CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") - // AWS Elastic Container Service - // Stability: development - CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") - // AWS Elastic Kubernetes Service - // Stability: development - CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") - // AWS Lambda - // Stability: development - CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") - // AWS Elastic Beanstalk - // Stability: development - CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") - // AWS App Runner - // Stability: development - CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") - // Red Hat OpenShift on AWS (ROSA) - // Stability: development - CloudPlatformAWSOpenShift = CloudPlatformKey.String("aws_openshift") - // Azure Virtual Machines - // Stability: development - CloudPlatformAzureVM = CloudPlatformKey.String("azure.vm") - // Azure Container Apps - // Stability: development - CloudPlatformAzureContainerApps = CloudPlatformKey.String("azure.container_apps") - // Azure Container Instances - // Stability: development - CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure.container_instances") - // Azure Kubernetes Service - // Stability: development - CloudPlatformAzureAKS = CloudPlatformKey.String("azure.aks") - // Azure Functions - // Stability: development - CloudPlatformAzureFunctions = CloudPlatformKey.String("azure.functions") - // Azure App Service - // Stability: development - CloudPlatformAzureAppService = CloudPlatformKey.String("azure.app_service") - // Azure Red Hat OpenShift - // Stability: development - CloudPlatformAzureOpenShift = CloudPlatformKey.String("azure.openshift") - // Google Vertex AI Agent Engine - // Stability: development - CloudPlatformGCPAgentEngine = CloudPlatformKey.String("gcp.agent_engine") - // Google Bare Metal Solution (BMS) - // Stability: development - CloudPlatformGCPBareMetalSolution = CloudPlatformKey.String("gcp_bare_metal_solution") - // Google Cloud Compute Engine (GCE) - // Stability: development - CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") - // Google Cloud Run - // Stability: development - CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") - // Google Cloud Kubernetes Engine (GKE) - // Stability: development - CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") - // Google Cloud Functions (GCF) - // Stability: development - CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") - // Google Cloud App Engine (GAE) - // Stability: development - CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") - // Red Hat OpenShift on Google Cloud - // Stability: development - CloudPlatformGCPOpenShift = CloudPlatformKey.String("gcp_openshift") - // Server on Hetzner Cloud - // Stability: development - CloudPlatformHetznerCloudServer = CloudPlatformKey.String("hetzner.cloud_server") - // Red Hat OpenShift on IBM Cloud - // Stability: development - CloudPlatformIBMCloudOpenShift = CloudPlatformKey.String("ibm_cloud_openshift") - // Compute on Oracle Cloud Infrastructure (OCI) - // Stability: development - CloudPlatformOracleCloudCompute = CloudPlatformKey.String("oracle_cloud_compute") - // Kubernetes Engine (OKE) on Oracle Cloud Infrastructure (OCI) - // Stability: development - CloudPlatformOracleCloudOKE = CloudPlatformKey.String("oracle_cloud_oke") - // Tencent Cloud Cloud Virtual Machine (CVM) - // Stability: development - CloudPlatformTencentCloudCVM = CloudPlatformKey.String("tencent_cloud_cvm") - // Tencent Cloud Elastic Kubernetes Service (EKS) - // Stability: development - CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") - // Tencent Cloud Serverless Cloud Function (SCF) - // Stability: development - CloudPlatformTencentCloudSCF = CloudPlatformKey.String("tencent_cloud_scf") - // Vultr Cloud Compute - // Stability: development - CloudPlatformVultrCloudCompute = CloudPlatformKey.String("vultr.cloud_compute") -) - -// Enum values for cloud.provider -var ( - // Akamai Cloud - // Stability: development - CloudProviderAkamaiCloud = CloudProviderKey.String("akamai_cloud") - // Alibaba Cloud - // Stability: development - CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") - // Amazon Web Services - // Stability: development - CloudProviderAWS = CloudProviderKey.String("aws") - // Microsoft Azure - // Stability: development - CloudProviderAzure = CloudProviderKey.String("azure") - // Google Cloud Platform - // Stability: development - CloudProviderGCP = CloudProviderKey.String("gcp") - // Heroku Platform as a Service - // Stability: development - CloudProviderHeroku = CloudProviderKey.String("heroku") - // Hetzner - // Stability: development - CloudProviderHetzner = CloudProviderKey.String("hetzner") - // IBM Cloud - // Stability: development - CloudProviderIBMCloud = CloudProviderKey.String("ibm_cloud") - // Oracle Cloud Infrastructure (OCI) - // Stability: development - CloudProviderOracleCloud = CloudProviderKey.String("oracle_cloud") - // Tencent Cloud - // Stability: development - CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") - // Vultr - // Stability: development - CloudProviderVultr = CloudProviderKey.String("vultr") -) - -// Namespace: cloudevents -const ( - // CloudEventsEventIDKey is the attribute Key conforming to the - // "cloudevents.event_id" semantic conventions. It represents the [event_id] - // uniquely identifies the event. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "123e4567-e89b-12d3-a456-426614174000", "0001" - // - // [event_id]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id - CloudEventsEventIDKey = attribute.Key("cloudevents.event_id") - - // CloudEventsEventSourceKey is the attribute Key conforming to the - // "cloudevents.event_source" semantic conventions. It represents the [source] - // identifies the context in which an event happened. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "https://github.com/cloudevents", "/cloudevents/spec/pull/123", - // "my-service" - // - // [source]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1 - CloudEventsEventSourceKey = attribute.Key("cloudevents.event_source") - - // CloudEventsEventSpecVersionKey is the attribute Key conforming to the - // "cloudevents.event_spec_version" semantic conventions. It represents the - // [version of the CloudEvents specification] which the event uses. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 1.0 - // - // [version of the CloudEvents specification]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion - CloudEventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") - - // CloudEventsEventSubjectKey is the attribute Key conforming to the - // "cloudevents.event_subject" semantic conventions. It represents the [subject] - // of the event in the context of the event producer (identified by source). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: mynewfile.jpg - // - // [subject]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject - CloudEventsEventSubjectKey = attribute.Key("cloudevents.event_subject") - - // CloudEventsEventTypeKey is the attribute Key conforming to the - // "cloudevents.event_type" semantic conventions. It represents the [event_type] - // contains a value describing the type of event related to the originating - // occurrence. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "com.github.pull_request.opened", "com.example.object.deleted.v2" - // - // [event_type]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type - CloudEventsEventTypeKey = attribute.Key("cloudevents.event_type") -) - -// CloudEventsEventID returns an attribute KeyValue conforming to the -// "cloudevents.event_id" semantic conventions. It represents the [event_id] -// uniquely identifies the event. -// -// [event_id]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id -func CloudEventsEventID(val string) attribute.KeyValue { - return CloudEventsEventIDKey.String(val) -} - -// CloudEventsEventSource returns an attribute KeyValue conforming to the -// "cloudevents.event_source" semantic conventions. It represents the [source] -// identifies the context in which an event happened. -// -// [source]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1 -func CloudEventsEventSource(val string) attribute.KeyValue { - return CloudEventsEventSourceKey.String(val) -} - -// CloudEventsEventSpecVersion returns an attribute KeyValue conforming to the -// "cloudevents.event_spec_version" semantic conventions. It represents the -// [version of the CloudEvents specification] which the event uses. -// -// [version of the CloudEvents specification]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion -func CloudEventsEventSpecVersion(val string) attribute.KeyValue { - return CloudEventsEventSpecVersionKey.String(val) -} - -// CloudEventsEventSubject returns an attribute KeyValue conforming to the -// "cloudevents.event_subject" semantic conventions. It represents the [subject] -// of the event in the context of the event producer (identified by source). -// -// [subject]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject -func CloudEventsEventSubject(val string) attribute.KeyValue { - return CloudEventsEventSubjectKey.String(val) -} - -// CloudEventsEventType returns an attribute KeyValue conforming to the -// "cloudevents.event_type" semantic conventions. It represents the [event_type] -// contains a value describing the type of event related to the originating -// occurrence. -// -// [event_type]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type -func CloudEventsEventType(val string) attribute.KeyValue { - return CloudEventsEventTypeKey.String(val) -} - -// Namespace: cloudfoundry -const ( - // CloudFoundryAppIDKey is the attribute Key conforming to the - // "cloudfoundry.app.id" semantic conventions. It represents the guid of the - // application. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" - // Note: Application instrumentation should use the value from environment - // variable `VCAP_APPLICATION.application_id`. This is the same value as - // reported by `cf app --guid`. - CloudFoundryAppIDKey = attribute.Key("cloudfoundry.app.id") - - // CloudFoundryAppInstanceIDKey is the attribute Key conforming to the - // "cloudfoundry.app.instance.id" semantic conventions. It represents the index - // of the application instance. 0 when just one instance is active. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "0", "1" - // Note: CloudFoundry defines the `instance_id` in the [Loggregator v2 envelope] - // . - // It is used for logs and metrics emitted by CloudFoundry. It is - // supposed to contain the application instance index for applications - // deployed on the runtime. - // - // Application instrumentation should use the value from environment - // variable `CF_INSTANCE_INDEX`. - // - // [Loggregator v2 envelope]: https://github.com/cloudfoundry/loggregator-api#v2-envelope - CloudFoundryAppInstanceIDKey = attribute.Key("cloudfoundry.app.instance.id") - - // CloudFoundryAppNameKey is the attribute Key conforming to the - // "cloudfoundry.app.name" semantic conventions. It represents the name of the - // application. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "my-app-name" - // Note: Application instrumentation should use the value from environment - // variable `VCAP_APPLICATION.application_name`. This is the same value - // as reported by `cf apps`. - CloudFoundryAppNameKey = attribute.Key("cloudfoundry.app.name") - - // CloudFoundryOrgIDKey is the attribute Key conforming to the - // "cloudfoundry.org.id" semantic conventions. It represents the guid of the - // CloudFoundry org the application is running in. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" - // Note: Application instrumentation should use the value from environment - // variable `VCAP_APPLICATION.org_id`. This is the same value as - // reported by `cf org --guid`. - CloudFoundryOrgIDKey = attribute.Key("cloudfoundry.org.id") - - // CloudFoundryOrgNameKey is the attribute Key conforming to the - // "cloudfoundry.org.name" semantic conventions. It represents the name of the - // CloudFoundry organization the app is running in. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "my-org-name" - // Note: Application instrumentation should use the value from environment - // variable `VCAP_APPLICATION.org_name`. This is the same value as - // reported by `cf orgs`. - CloudFoundryOrgNameKey = attribute.Key("cloudfoundry.org.name") - - // CloudFoundryProcessIDKey is the attribute Key conforming to the - // "cloudfoundry.process.id" semantic conventions. It represents the UID - // identifying the process. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" - // Note: Application instrumentation should use the value from environment - // variable `VCAP_APPLICATION.process_id`. It is supposed to be equal to - // `VCAP_APPLICATION.app_id` for applications deployed to the runtime. - // For system components, this could be the actual PID. - CloudFoundryProcessIDKey = attribute.Key("cloudfoundry.process.id") - - // CloudFoundryProcessTypeKey is the attribute Key conforming to the - // "cloudfoundry.process.type" semantic conventions. It represents the type of - // process. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "web" - // Note: CloudFoundry applications can consist of multiple jobs. Usually the - // main process will be of type `web`. There can be additional background - // tasks or side-cars with different process types. - CloudFoundryProcessTypeKey = attribute.Key("cloudfoundry.process.type") - - // CloudFoundrySpaceIDKey is the attribute Key conforming to the - // "cloudfoundry.space.id" semantic conventions. It represents the guid of the - // CloudFoundry space the application is running in. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" - // Note: Application instrumentation should use the value from environment - // variable `VCAP_APPLICATION.space_id`. This is the same value as - // reported by `cf space --guid`. - CloudFoundrySpaceIDKey = attribute.Key("cloudfoundry.space.id") - - // CloudFoundrySpaceNameKey is the attribute Key conforming to the - // "cloudfoundry.space.name" semantic conventions. It represents the name of the - // CloudFoundry space the application is running in. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "my-space-name" - // Note: Application instrumentation should use the value from environment - // variable `VCAP_APPLICATION.space_name`. This is the same value as - // reported by `cf spaces`. - CloudFoundrySpaceNameKey = attribute.Key("cloudfoundry.space.name") - - // CloudFoundrySystemIDKey is the attribute Key conforming to the - // "cloudfoundry.system.id" semantic conventions. It represents a guid or - // another name describing the event source. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "cf/gorouter" - // Note: CloudFoundry defines the `source_id` in the [Loggregator v2 envelope]. - // It is used for logs and metrics emitted by CloudFoundry. It is - // supposed to contain the component name, e.g. "gorouter", for - // CloudFoundry components. - // - // When system components are instrumented, values from the - // [Bosh spec] - // should be used. The `system.id` should be set to - // `spec.deployment/spec.name`. - // - // [Loggregator v2 envelope]: https://github.com/cloudfoundry/loggregator-api#v2-envelope - // [Bosh spec]: https://bosh.io/docs/jobs/#properties-spec - CloudFoundrySystemIDKey = attribute.Key("cloudfoundry.system.id") - - // CloudFoundrySystemInstanceIDKey is the attribute Key conforming to the - // "cloudfoundry.system.instance.id" semantic conventions. It represents a guid - // describing the concrete instance of the event source. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" - // Note: CloudFoundry defines the `instance_id` in the [Loggregator v2 envelope] - // . - // It is used for logs and metrics emitted by CloudFoundry. It is - // supposed to contain the vm id for CloudFoundry components. - // - // When system components are instrumented, values from the - // [Bosh spec] - // should be used. The `system.instance.id` should be set to `spec.id`. - // - // [Loggregator v2 envelope]: https://github.com/cloudfoundry/loggregator-api#v2-envelope - // [Bosh spec]: https://bosh.io/docs/jobs/#properties-spec - CloudFoundrySystemInstanceIDKey = attribute.Key("cloudfoundry.system.instance.id") -) - -// CloudFoundryAppID returns an attribute KeyValue conforming to the -// "cloudfoundry.app.id" semantic conventions. It represents the guid of the -// application. -func CloudFoundryAppID(val string) attribute.KeyValue { - return CloudFoundryAppIDKey.String(val) -} - -// CloudFoundryAppInstanceID returns an attribute KeyValue conforming to the -// "cloudfoundry.app.instance.id" semantic conventions. It represents the index -// of the application instance. 0 when just one instance is active. -func CloudFoundryAppInstanceID(val string) attribute.KeyValue { - return CloudFoundryAppInstanceIDKey.String(val) -} - -// CloudFoundryAppName returns an attribute KeyValue conforming to the -// "cloudfoundry.app.name" semantic conventions. It represents the name of the -// application. -func CloudFoundryAppName(val string) attribute.KeyValue { - return CloudFoundryAppNameKey.String(val) -} - -// CloudFoundryOrgID returns an attribute KeyValue conforming to the -// "cloudfoundry.org.id" semantic conventions. It represents the guid of the -// CloudFoundry org the application is running in. -func CloudFoundryOrgID(val string) attribute.KeyValue { - return CloudFoundryOrgIDKey.String(val) -} - -// CloudFoundryOrgName returns an attribute KeyValue conforming to the -// "cloudfoundry.org.name" semantic conventions. It represents the name of the -// CloudFoundry organization the app is running in. -func CloudFoundryOrgName(val string) attribute.KeyValue { - return CloudFoundryOrgNameKey.String(val) -} - -// CloudFoundryProcessID returns an attribute KeyValue conforming to the -// "cloudfoundry.process.id" semantic conventions. It represents the UID -// identifying the process. -func CloudFoundryProcessID(val string) attribute.KeyValue { - return CloudFoundryProcessIDKey.String(val) -} - -// CloudFoundryProcessType returns an attribute KeyValue conforming to the -// "cloudfoundry.process.type" semantic conventions. It represents the type of -// process. -func CloudFoundryProcessType(val string) attribute.KeyValue { - return CloudFoundryProcessTypeKey.String(val) -} - -// CloudFoundrySpaceID returns an attribute KeyValue conforming to the -// "cloudfoundry.space.id" semantic conventions. It represents the guid of the -// CloudFoundry space the application is running in. -func CloudFoundrySpaceID(val string) attribute.KeyValue { - return CloudFoundrySpaceIDKey.String(val) -} - -// CloudFoundrySpaceName returns an attribute KeyValue conforming to the -// "cloudfoundry.space.name" semantic conventions. It represents the name of the -// CloudFoundry space the application is running in. -func CloudFoundrySpaceName(val string) attribute.KeyValue { - return CloudFoundrySpaceNameKey.String(val) -} - -// CloudFoundrySystemID returns an attribute KeyValue conforming to the -// "cloudfoundry.system.id" semantic conventions. It represents a guid or another -// name describing the event source. -func CloudFoundrySystemID(val string) attribute.KeyValue { - return CloudFoundrySystemIDKey.String(val) -} - -// CloudFoundrySystemInstanceID returns an attribute KeyValue conforming to the -// "cloudfoundry.system.instance.id" semantic conventions. It represents a guid -// describing the concrete instance of the event source. -func CloudFoundrySystemInstanceID(val string) attribute.KeyValue { - return CloudFoundrySystemInstanceIDKey.String(val) -} - -// Namespace: code -const ( - // CodeColumnNumberKey is the attribute Key conforming to the - // "code.column.number" semantic conventions. It represents the column number in - // `code.file.path` best representing the operation. It SHOULD point within the - // code unit named in `code.function.name`. This attribute MUST NOT be used on - // the Profile signal since the data is already captured in 'message Line'. This - // constraint is imposed to prevent redundancy and maintain data integrity. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Stable - CodeColumnNumberKey = attribute.Key("code.column.number") - - // CodeFilePathKey is the attribute Key conforming to the "code.file.path" - // semantic conventions. It represents the source code file name that identifies - // the code unit as uniquely as possible (preferably an absolute file path). - // This attribute MUST NOT be used on the Profile signal since the data is - // already captured in 'message Function'. This constraint is imposed to prevent - // redundancy and maintain data integrity. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: /usr/local/MyApplication/content_root/app/index.php - CodeFilePathKey = attribute.Key("code.file.path") - - // CodeFunctionNameKey is the attribute Key conforming to the - // "code.function.name" semantic conventions. It represents the method or - // function fully-qualified name without arguments. The value should fit the - // natural representation of the language runtime, which is also likely the same - // used within `code.stacktrace` attribute value. This attribute MUST NOT be - // used on the Profile signal since the data is already captured in 'message - // Function'. This constraint is imposed to prevent redundancy and maintain data - // integrity. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "com.example.MyHttpService.serveRequest", - // "GuzzleHttp\Client::transfer", "fopen" - // Note: Values and format depends on each language runtime, thus it is - // impossible to provide an exhaustive list of examples. - // The values are usually the same (or prefixes of) the ones found in native - // stack trace representation stored in - // `code.stacktrace` without information on arguments. - // - // Examples: - // - // - Java method: `com.example.MyHttpService.serveRequest` - // - Java anonymous class method: `com.mycompany.Main$1.myMethod` - // - Java lambda method: - // `com.mycompany.Main$$Lambda/0x0000748ae4149c00.myMethod` - // - PHP function: `GuzzleHttp\Client::transfer` - // - Go function: `github.com/my/repo/pkg.foo.func5` - // - Elixir: `OpenTelemetry.Ctx.new` - // - Erlang: `opentelemetry_ctx:new` - // - Rust: `playground::my_module::my_cool_func` - // - C function: `fopen` - CodeFunctionNameKey = attribute.Key("code.function.name") - - // CodeLineNumberKey is the attribute Key conforming to the "code.line.number" - // semantic conventions. It represents the line number in `code.file.path` best - // representing the operation. It SHOULD point within the code unit named in - // `code.function.name`. This attribute MUST NOT be used on the Profile signal - // since the data is already captured in 'message Line'. This constraint is - // imposed to prevent redundancy and maintain data integrity. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Stable - CodeLineNumberKey = attribute.Key("code.line.number") - - // CodeStacktraceKey is the attribute Key conforming to the "code.stacktrace" - // semantic conventions. It represents a stacktrace as a string in the natural - // representation for the language runtime. The representation is identical to - // [`exception.stacktrace`]. This attribute MUST NOT be used on the Profile - // signal since the data is already captured in 'message Location'. This - // constraint is imposed to prevent redundancy and maintain data integrity. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at - // com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at - // com.example.GenerateTrace.main(GenerateTrace.java:5) - // - // [`exception.stacktrace`]: /docs/exceptions/exceptions-spans.md#stacktrace-representation - CodeStacktraceKey = attribute.Key("code.stacktrace") -) - -// CodeColumnNumber returns an attribute KeyValue conforming to the -// "code.column.number" semantic conventions. It represents the column number in -// `code.file.path` best representing the operation. It SHOULD point within the -// code unit named in `code.function.name`. This attribute MUST NOT be used on -// the Profile signal since the data is already captured in 'message Line'. This -// constraint is imposed to prevent redundancy and maintain data integrity. -func CodeColumnNumber(val int) attribute.KeyValue { - return CodeColumnNumberKey.Int(val) -} - -// CodeFilePath returns an attribute KeyValue conforming to the "code.file.path" -// semantic conventions. It represents the source code file name that identifies -// the code unit as uniquely as possible (preferably an absolute file path). This -// attribute MUST NOT be used on the Profile signal since the data is already -// captured in 'message Function'. This constraint is imposed to prevent -// redundancy and maintain data integrity. -func CodeFilePath(val string) attribute.KeyValue { - return CodeFilePathKey.String(val) -} - -// CodeFunctionName returns an attribute KeyValue conforming to the -// "code.function.name" semantic conventions. It represents the method or -// function fully-qualified name without arguments. The value should fit the -// natural representation of the language runtime, which is also likely the same -// used within `code.stacktrace` attribute value. This attribute MUST NOT be used -// on the Profile signal since the data is already captured in 'message -// Function'. This constraint is imposed to prevent redundancy and maintain data -// integrity. -func CodeFunctionName(val string) attribute.KeyValue { - return CodeFunctionNameKey.String(val) -} - -// CodeLineNumber returns an attribute KeyValue conforming to the -// "code.line.number" semantic conventions. It represents the line number in -// `code.file.path` best representing the operation. It SHOULD point within the -// code unit named in `code.function.name`. This attribute MUST NOT be used on -// the Profile signal since the data is already captured in 'message Line'. This -// constraint is imposed to prevent redundancy and maintain data integrity. -func CodeLineNumber(val int) attribute.KeyValue { - return CodeLineNumberKey.Int(val) -} - -// CodeStacktrace returns an attribute KeyValue conforming to the -// "code.stacktrace" semantic conventions. It represents a stacktrace as a string -// in the natural representation for the language runtime. The representation is -// identical to [`exception.stacktrace`]. This attribute MUST NOT be used on the -// Profile signal since the data is already captured in 'message Location'. This -// constraint is imposed to prevent redundancy and maintain data integrity. -// -// [`exception.stacktrace`]: /docs/exceptions/exceptions-spans.md#stacktrace-representation -func CodeStacktrace(val string) attribute.KeyValue { - return CodeStacktraceKey.String(val) -} - -// Namespace: container -const ( - // ContainerCommandKey is the attribute Key conforming to the - // "container.command" semantic conventions. It represents the command used to - // run the container (i.e. the command name). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "otelcontribcol" - // Note: If using embedded credentials or sensitive data, it is recommended to - // remove them to prevent potential leakage. - ContainerCommandKey = attribute.Key("container.command") - - // ContainerCommandArgsKey is the attribute Key conforming to the - // "container.command_args" semantic conventions. It represents the all the - // command arguments (including the command/executable itself) run by the - // container. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "otelcontribcol", "--config", "config.yaml" - ContainerCommandArgsKey = attribute.Key("container.command_args") - - // ContainerCommandLineKey is the attribute Key conforming to the - // "container.command_line" semantic conventions. It represents the full command - // run by the container as a single string representing the full command. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "otelcontribcol --config config.yaml" - ContainerCommandLineKey = attribute.Key("container.command_line") - - // ContainerCSIPluginNameKey is the attribute Key conforming to the - // "container.csi.plugin.name" semantic conventions. It represents the name of - // the CSI ([Container Storage Interface]) plugin used by the volume. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "pd.csi.storage.gke.io" - // Note: This can sometimes be referred to as a "driver" in CSI implementations. - // This should represent the `name` field of the GetPluginInfo RPC. - // - // [Container Storage Interface]: https://github.com/container-storage-interface/spec - ContainerCSIPluginNameKey = attribute.Key("container.csi.plugin.name") - - // ContainerCSIVolumeIDKey is the attribute Key conforming to the - // "container.csi.volume.id" semantic conventions. It represents the unique - // volume ID returned by the CSI ([Container Storage Interface]) plugin. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "projects/my-gcp-project/zones/my-gcp-zone/disks/my-gcp-disk" - // Note: This can sometimes be referred to as a "volume handle" in CSI - // implementations. This should represent the `Volume.volume_id` field in CSI - // spec. - // - // [Container Storage Interface]: https://github.com/container-storage-interface/spec - ContainerCSIVolumeIDKey = attribute.Key("container.csi.volume.id") - - // ContainerIDKey is the attribute Key conforming to the "container.id" semantic - // conventions. It represents the container ID. Usually a UUID, as for example - // used to [identify Docker containers]. The UUID might be abbreviated. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "a3bf90e006b2" - // - // [identify Docker containers]: https://docs.docker.com/engine/containers/run/#container-identification - ContainerIDKey = attribute.Key("container.id") - - // ContainerImageIDKey is the attribute Key conforming to the - // "container.image.id" semantic conventions. It represents the runtime specific - // image identifier. Usually a hash algorithm followed by a UUID. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // "sha256:19c92d0a00d1b66d897bceaa7319bee0dd38a10a851c60bcec9474aa3f01e50f" - // Note: Docker defines a sha256 of the image id; `container.image.id` - // corresponds to the `Image` field from the Docker container inspect [API] - // endpoint. - // K8s defines a link to the container registry repository with digest - // `"imageID": "registry.azurecr.io /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"` - // . - // The ID is assigned by the container runtime and can vary in different - // environments. Consider using `oci.manifest.digest` if it is important to - // identify the same image in different environments/runtimes. - // - // [API]: https://docs.docker.com/reference/api/engine/version/v1.52/#tag/Container/operation/ContainerInspect - ContainerImageIDKey = attribute.Key("container.image.id") - - // ContainerImageNameKey is the attribute Key conforming to the - // "container.image.name" semantic conventions. It represents the name of the - // image the container was built on. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "gcr.io/opentelemetry/operator" - ContainerImageNameKey = attribute.Key("container.image.name") - - // ContainerImageRepoDigestsKey is the attribute Key conforming to the - // "container.image.repo_digests" semantic conventions. It represents the repo - // digests of the container image as provided by the container runtime. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: - // "example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb", - // "internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578" - // Note: [Docker] and [CRI] report those under the `RepoDigests` field. - // - // [Docker]: https://docs.docker.com/reference/api/engine/version/v1.52/#tag/Image/operation/ImageInspect - // [CRI]: https://github.com/kubernetes/cri-api/blob/c75ef5b473bbe2d0a4fc92f82235efd665ea8e9f/pkg/apis/runtime/v1/api.proto#L1237-L1238 - ContainerImageRepoDigestsKey = attribute.Key("container.image.repo_digests") - - // ContainerImageTagsKey is the attribute Key conforming to the - // "container.image.tags" semantic conventions. It represents the container - // image tags. An example can be found in [Docker Image Inspect]. Should be only - // the `` section of the full name for example from - // `registry.example.com/my-org/my-image:`. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "v1.27.1", "3.5.7-0" - // - // [Docker Image Inspect]: https://docs.docker.com/reference/api/engine/version/v1.52/#tag/Image/operation/ImageInspect - ContainerImageTagsKey = attribute.Key("container.image.tags") - - // ContainerNameKey is the attribute Key conforming to the "container.name" - // semantic conventions. It represents the container name used by container - // runtime. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "opentelemetry-autoconf" - ContainerNameKey = attribute.Key("container.name") - - // ContainerRuntimeDescriptionKey is the attribute Key conforming to the - // "container.runtime.description" semantic conventions. It represents a - // description about the runtime which could include, for example details about - // the CRI/API version being used or other customisations. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "docker://19.3.1 - CRI: 1.22.0" - ContainerRuntimeDescriptionKey = attribute.Key("container.runtime.description") - - // ContainerRuntimeNameKey is the attribute Key conforming to the - // "container.runtime.name" semantic conventions. It represents the container - // runtime managing this container. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "docker", "containerd", "rkt" - ContainerRuntimeNameKey = attribute.Key("container.runtime.name") - - // ContainerRuntimeVersionKey is the attribute Key conforming to the - // "container.runtime.version" semantic conventions. It represents the version - // of the runtime of this process, as returned by the runtime without - // modification. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 1.0.0 - ContainerRuntimeVersionKey = attribute.Key("container.runtime.version") -) - -// ContainerCommand returns an attribute KeyValue conforming to the -// "container.command" semantic conventions. It represents the command used to -// run the container (i.e. the command name). -func ContainerCommand(val string) attribute.KeyValue { - return ContainerCommandKey.String(val) -} - -// ContainerCommandArgs returns an attribute KeyValue conforming to the -// "container.command_args" semantic conventions. It represents the all the -// command arguments (including the command/executable itself) run by the -// container. -func ContainerCommandArgs(val ...string) attribute.KeyValue { - return ContainerCommandArgsKey.StringSlice(val) -} - -// ContainerCommandLine returns an attribute KeyValue conforming to the -// "container.command_line" semantic conventions. It represents the full command -// run by the container as a single string representing the full command. -func ContainerCommandLine(val string) attribute.KeyValue { - return ContainerCommandLineKey.String(val) -} - -// ContainerCSIPluginName returns an attribute KeyValue conforming to the -// "container.csi.plugin.name" semantic conventions. It represents the name of -// the CSI ([Container Storage Interface]) plugin used by the volume. -// -// [Container Storage Interface]: https://github.com/container-storage-interface/spec -func ContainerCSIPluginName(val string) attribute.KeyValue { - return ContainerCSIPluginNameKey.String(val) -} - -// ContainerCSIVolumeID returns an attribute KeyValue conforming to the -// "container.csi.volume.id" semantic conventions. It represents the unique -// volume ID returned by the CSI ([Container Storage Interface]) plugin. -// -// [Container Storage Interface]: https://github.com/container-storage-interface/spec -func ContainerCSIVolumeID(val string) attribute.KeyValue { - return ContainerCSIVolumeIDKey.String(val) -} - -// ContainerID returns an attribute KeyValue conforming to the "container.id" -// semantic conventions. It represents the container ID. Usually a UUID, as for -// example used to [identify Docker containers]. The UUID might be abbreviated. -// -// [identify Docker containers]: https://docs.docker.com/engine/containers/run/#container-identification -func ContainerID(val string) attribute.KeyValue { - return ContainerIDKey.String(val) -} - -// ContainerImageID returns an attribute KeyValue conforming to the -// "container.image.id" semantic conventions. It represents the runtime specific -// image identifier. Usually a hash algorithm followed by a UUID. -func ContainerImageID(val string) attribute.KeyValue { - return ContainerImageIDKey.String(val) -} - -// ContainerImageName returns an attribute KeyValue conforming to the -// "container.image.name" semantic conventions. It represents the name of the -// image the container was built on. -func ContainerImageName(val string) attribute.KeyValue { - return ContainerImageNameKey.String(val) -} - -// ContainerImageRepoDigests returns an attribute KeyValue conforming to the -// "container.image.repo_digests" semantic conventions. It represents the repo -// digests of the container image as provided by the container runtime. -func ContainerImageRepoDigests(val ...string) attribute.KeyValue { - return ContainerImageRepoDigestsKey.StringSlice(val) -} - -// ContainerImageTags returns an attribute KeyValue conforming to the -// "container.image.tags" semantic conventions. It represents the container image -// tags. An example can be found in [Docker Image Inspect]. Should be only the -// `` section of the full name for example from -// `registry.example.com/my-org/my-image:`. -// -// [Docker Image Inspect]: https://docs.docker.com/reference/api/engine/version/v1.52/#tag/Image/operation/ImageInspect -func ContainerImageTags(val ...string) attribute.KeyValue { - return ContainerImageTagsKey.StringSlice(val) -} - -// ContainerLabel returns an attribute KeyValue conforming to the -// "container.label" semantic conventions. It represents the container labels, -// `` being the label name, the value being the label value. -func ContainerLabel(key string, val string) attribute.KeyValue { - return attribute.String("container.label."+key, val) -} - -// ContainerName returns an attribute KeyValue conforming to the "container.name" -// semantic conventions. It represents the container name used by container -// runtime. -func ContainerName(val string) attribute.KeyValue { - return ContainerNameKey.String(val) -} - -// ContainerRuntimeDescription returns an attribute KeyValue conforming to the -// "container.runtime.description" semantic conventions. It represents a -// description about the runtime which could include, for example details about -// the CRI/API version being used or other customisations. -func ContainerRuntimeDescription(val string) attribute.KeyValue { - return ContainerRuntimeDescriptionKey.String(val) -} - -// ContainerRuntimeName returns an attribute KeyValue conforming to the -// "container.runtime.name" semantic conventions. It represents the container -// runtime managing this container. -func ContainerRuntimeName(val string) attribute.KeyValue { - return ContainerRuntimeNameKey.String(val) -} - -// ContainerRuntimeVersion returns an attribute KeyValue conforming to the -// "container.runtime.version" semantic conventions. It represents the version of -// the runtime of this process, as returned by the runtime without modification. -func ContainerRuntimeVersion(val string) attribute.KeyValue { - return ContainerRuntimeVersionKey.String(val) -} - -// Namespace: cpu -const ( - // CPULogicalNumberKey is the attribute Key conforming to the - // "cpu.logical_number" semantic conventions. It represents the logical CPU - // number [0..n-1]. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 1 - CPULogicalNumberKey = attribute.Key("cpu.logical_number") - - // CPUModeKey is the attribute Key conforming to the "cpu.mode" semantic - // conventions. It represents the mode of the CPU. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "user", "system" - CPUModeKey = attribute.Key("cpu.mode") -) - -// CPULogicalNumber returns an attribute KeyValue conforming to the -// "cpu.logical_number" semantic conventions. It represents the logical CPU -// number [0..n-1]. -func CPULogicalNumber(val int) attribute.KeyValue { - return CPULogicalNumberKey.Int(val) -} - -// Enum values for cpu.mode -var ( - // User - // Stability: development - CPUModeUser = CPUModeKey.String("user") - // System - // Stability: development - CPUModeSystem = CPUModeKey.String("system") - // Nice - // Stability: development - CPUModeNice = CPUModeKey.String("nice") - // Idle - // Stability: development - CPUModeIdle = CPUModeKey.String("idle") - // IO Wait - // Stability: development - CPUModeIOWait = CPUModeKey.String("iowait") - // Interrupt - // Stability: development - CPUModeInterrupt = CPUModeKey.String("interrupt") - // Steal - // Stability: development - CPUModeSteal = CPUModeKey.String("steal") - // Kernel - // Stability: development - CPUModeKernel = CPUModeKey.String("kernel") -) - -// Namespace: db -const ( - // DBClientConnectionPoolNameKey is the attribute Key conforming to the - // "db.client.connection.pool.name" semantic conventions. It represents the name - // of the connection pool; unique within the instrumented application. In case - // the connection pool implementation doesn't provide a name, instrumentation - // SHOULD use a combination of parameters that would make the name unique, for - // example, combining attributes `server.address`, `server.port`, and - // `db.namespace`, formatted as `server.address:server.port/db.namespace`. - // Instrumentations that generate connection pool name following different - // patterns SHOULD document it. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "myDataSource" - DBClientConnectionPoolNameKey = attribute.Key("db.client.connection.pool.name") - - // DBClientConnectionStateKey is the attribute Key conforming to the - // "db.client.connection.state" semantic conventions. It represents the state of - // a connection in the pool. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "idle" - DBClientConnectionStateKey = attribute.Key("db.client.connection.state") - - // DBCollectionNameKey is the attribute Key conforming to the - // "db.collection.name" semantic conventions. It represents the name of a - // collection (table, container) within the database. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "public.users", "customers" - // Note: It is RECOMMENDED to capture the value as provided by the application - // without attempting to do any case normalization. - // - // The collection name SHOULD NOT be extracted from `db.query.text`, - // when the database system supports query text with multiple collections - // in non-batch operations. - // - // For batch operations, if the individual operations are known to have the same - // collection name then that collection name SHOULD be used. - DBCollectionNameKey = attribute.Key("db.collection.name") - - // DBNamespaceKey is the attribute Key conforming to the "db.namespace" semantic - // conventions. It represents the name of the database, fully qualified within - // the server address and port. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "customers", "test.users" - // Note: If a database system has multiple namespace components, they SHOULD be - // concatenated from the most general to the most specific namespace component, - // using `|` as a separator between the components. Any missing components (and - // their associated separators) SHOULD be omitted. - // Semantic conventions for individual database systems SHOULD document what - // `db.namespace` means in the context of that system. - // It is RECOMMENDED to capture the value as provided by the application without - // attempting to do any case normalization. - DBNamespaceKey = attribute.Key("db.namespace") - - // DBOperationBatchSizeKey is the attribute Key conforming to the - // "db.operation.batch.size" semantic conventions. It represents the number of - // queries included in a batch operation. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: 2, 3, 4 - // Note: Operations are only considered batches when they contain two or more - // operations, and so `db.operation.batch.size` SHOULD never be `1`. - DBOperationBatchSizeKey = attribute.Key("db.operation.batch.size") - - // DBOperationNameKey is the attribute Key conforming to the "db.operation.name" - // semantic conventions. It represents the name of the operation or command - // being executed. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "findAndModify", "HMSET", "SELECT" - // Note: It is RECOMMENDED to capture the value as provided by the application - // without attempting to do any case normalization. - // - // The operation name SHOULD NOT be extracted from `db.query.text`, - // when the database system supports query text with multiple operations - // in non-batch operations. - // - // If spaces can occur in the operation name, multiple consecutive spaces - // SHOULD be normalized to a single space. - // - // For batch operations, if the individual operations are known to have the same - // operation name - // then that operation name SHOULD be used prepended by `BATCH `, - // otherwise `db.operation.name` SHOULD be `BATCH` or some other database - // system specific term if more applicable. - DBOperationNameKey = attribute.Key("db.operation.name") - - // DBQuerySummaryKey is the attribute Key conforming to the "db.query.summary" - // semantic conventions. It represents the low cardinality summary of a database - // query. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "SELECT wuser_table", "INSERT shipping_details SELECT orders", "get - // user by id" - // Note: The query summary describes a class of database queries and is useful - // as a grouping key, especially when analyzing telemetry for database - // calls involving complex queries. - // - // Summary may be available to the instrumentation through - // instrumentation hooks or other means. If it is not available, - // instrumentations - // that support query parsing SHOULD generate a summary following - // [Generating query summary] - // section. - // - // [Generating query summary]: /docs/db/database-spans.md#generating-a-summary-of-the-query - DBQuerySummaryKey = attribute.Key("db.query.summary") - - // DBQueryTextKey is the attribute Key conforming to the "db.query.text" - // semantic conventions. It represents the database query being executed. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "SELECT * FROM wuser_table where username = ?", "SET mykey ?" - // Note: For sanitization see [Sanitization of `db.query.text`]. - // For batch operations, if the individual operations are known to have the same - // query text then that query text SHOULD be used, otherwise all of the - // individual query texts SHOULD be concatenated with separator `; ` or some - // other database system specific separator if more applicable. - // Parameterized query text SHOULD NOT be sanitized. Even though parameterized - // query text can potentially have sensitive data, by using a parameterized - // query the user is giving a strong signal that any sensitive data will be - // passed as parameter values, and the benefit to observability of capturing the - // static part of the query text by default outweighs the risk. - // - // [Sanitization of `db.query.text`]: /docs/db/database-spans.md#sanitization-of-dbquerytext - DBQueryTextKey = attribute.Key("db.query.text") - - // DBResponseReturnedRowsKey is the attribute Key conforming to the - // "db.response.returned_rows" semantic conventions. It represents the number of - // rows returned by the operation. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 10, 30, 1000 - DBResponseReturnedRowsKey = attribute.Key("db.response.returned_rows") - - // DBResponseStatusCodeKey is the attribute Key conforming to the - // "db.response.status_code" semantic conventions. It represents the database - // response status code. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "102", "ORA-17002", "08P01", "404" - // Note: The status code returned by the database. Usually it represents an - // error code, but may also represent partial success, warning, or differentiate - // between various types of successful outcomes. - // Semantic conventions for individual database systems SHOULD document what - // `db.response.status_code` means in the context of that system. - DBResponseStatusCodeKey = attribute.Key("db.response.status_code") - - // DBStoredProcedureNameKey is the attribute Key conforming to the - // "db.stored_procedure.name" semantic conventions. It represents the name of a - // stored procedure within the database. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "GetCustomer" - // Note: It is RECOMMENDED to capture the value as provided by the application - // without attempting to do any case normalization. - // - // For batch operations, if the individual operations are known to have the same - // stored procedure name then that stored procedure name SHOULD be used. - DBStoredProcedureNameKey = attribute.Key("db.stored_procedure.name") - - // DBSystemNameKey is the attribute Key conforming to the "db.system.name" - // semantic conventions. It represents the database management system (DBMS) - // product as identified by the client instrumentation. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: - // Note: The actual DBMS may differ from the one identified by the client. For - // example, when using PostgreSQL client libraries to connect to a CockroachDB, - // the `db.system.name` is set to `postgresql` based on the instrumentation's - // best knowledge. - DBSystemNameKey = attribute.Key("db.system.name") -) - -// DBClientConnectionPoolName returns an attribute KeyValue conforming to the -// "db.client.connection.pool.name" semantic conventions. It represents the name -// of the connection pool; unique within the instrumented application. In case -// the connection pool implementation doesn't provide a name, instrumentation -// SHOULD use a combination of parameters that would make the name unique, for -// example, combining attributes `server.address`, `server.port`, and -// `db.namespace`, formatted as `server.address:server.port/db.namespace`. -// Instrumentations that generate connection pool name following different -// patterns SHOULD document it. -func DBClientConnectionPoolName(val string) attribute.KeyValue { - return DBClientConnectionPoolNameKey.String(val) -} - -// DBCollectionName returns an attribute KeyValue conforming to the -// "db.collection.name" semantic conventions. It represents the name of a -// collection (table, container) within the database. -func DBCollectionName(val string) attribute.KeyValue { - return DBCollectionNameKey.String(val) -} - -// DBNamespace returns an attribute KeyValue conforming to the "db.namespace" -// semantic conventions. It represents the name of the database, fully qualified -// within the server address and port. -func DBNamespace(val string) attribute.KeyValue { - return DBNamespaceKey.String(val) -} - -// DBOperationBatchSize returns an attribute KeyValue conforming to the -// "db.operation.batch.size" semantic conventions. It represents the number of -// queries included in a batch operation. -func DBOperationBatchSize(val int) attribute.KeyValue { - return DBOperationBatchSizeKey.Int(val) -} - -// DBOperationName returns an attribute KeyValue conforming to the -// "db.operation.name" semantic conventions. It represents the name of the -// operation or command being executed. -func DBOperationName(val string) attribute.KeyValue { - return DBOperationNameKey.String(val) -} - -// DBOperationParameter returns an attribute KeyValue conforming to the -// "db.operation.parameter" semantic conventions. It represents a database -// operation parameter, with `` being the parameter name, and the attribute -// value being a string representation of the parameter value. -func DBOperationParameter(key string, val string) attribute.KeyValue { - return attribute.String("db.operation.parameter."+key, val) -} - -// DBQueryParameter returns an attribute KeyValue conforming to the -// "db.query.parameter" semantic conventions. It represents a database query -// parameter, with `` being the parameter name, and the attribute value -// being a string representation of the parameter value. -func DBQueryParameter(key string, val string) attribute.KeyValue { - return attribute.String("db.query.parameter."+key, val) -} - -// DBQuerySummary returns an attribute KeyValue conforming to the -// "db.query.summary" semantic conventions. It represents the low cardinality -// summary of a database query. -func DBQuerySummary(val string) attribute.KeyValue { - return DBQuerySummaryKey.String(val) -} - -// DBQueryText returns an attribute KeyValue conforming to the "db.query.text" -// semantic conventions. It represents the database query being executed. -func DBQueryText(val string) attribute.KeyValue { - return DBQueryTextKey.String(val) -} - -// DBResponseReturnedRows returns an attribute KeyValue conforming to the -// "db.response.returned_rows" semantic conventions. It represents the number of -// rows returned by the operation. -func DBResponseReturnedRows(val int) attribute.KeyValue { - return DBResponseReturnedRowsKey.Int(val) -} - -// DBResponseStatusCode returns an attribute KeyValue conforming to the -// "db.response.status_code" semantic conventions. It represents the database -// response status code. -func DBResponseStatusCode(val string) attribute.KeyValue { - return DBResponseStatusCodeKey.String(val) -} - -// DBStoredProcedureName returns an attribute KeyValue conforming to the -// "db.stored_procedure.name" semantic conventions. It represents the name of a -// stored procedure within the database. -func DBStoredProcedureName(val string) attribute.KeyValue { - return DBStoredProcedureNameKey.String(val) -} - -// Enum values for db.client.connection.state -var ( - // idle - // Stability: development - DBClientConnectionStateIdle = DBClientConnectionStateKey.String("idle") - // used - // Stability: development - DBClientConnectionStateUsed = DBClientConnectionStateKey.String("used") -) - -// Enum values for db.system.name -var ( - // Some other SQL database. Fallback only. - // Stability: development - DBSystemNameOtherSQL = DBSystemNameKey.String("other_sql") - // [Adabas (Adaptable Database System)] - // Stability: development - // - // [Adabas (Adaptable Database System)]: https://documentation.softwareag.com/?pf=adabas - DBSystemNameSoftwareagAdabas = DBSystemNameKey.String("softwareag.adabas") - // [Actian Ingres] - // Stability: development - // - // [Actian Ingres]: https://www.actian.com/databases/ingres/ - DBSystemNameActianIngres = DBSystemNameKey.String("actian.ingres") - // [Amazon DynamoDB] - // Stability: development - // - // [Amazon DynamoDB]: https://aws.amazon.com/pm/dynamodb/ - DBSystemNameAWSDynamoDB = DBSystemNameKey.String("aws.dynamodb") - // [Amazon Redshift] - // Stability: development - // - // [Amazon Redshift]: https://aws.amazon.com/redshift/ - DBSystemNameAWSRedshift = DBSystemNameKey.String("aws.redshift") - // [Azure Cosmos DB] - // Stability: development - // - // [Azure Cosmos DB]: https://learn.microsoft.com/azure/cosmos-db - DBSystemNameAzureCosmosDB = DBSystemNameKey.String("azure.cosmosdb") - // [InterSystems Caché] - // Stability: development - // - // [InterSystems Caché]: https://www.intersystems.com/products/cache/ - DBSystemNameIntersystemsCache = DBSystemNameKey.String("intersystems.cache") - // [Apache Cassandra] - // Stability: development - // - // [Apache Cassandra]: https://cassandra.apache.org/ - DBSystemNameCassandra = DBSystemNameKey.String("cassandra") - // [ClickHouse] - // Stability: development - // - // [ClickHouse]: https://clickhouse.com/ - DBSystemNameClickHouse = DBSystemNameKey.String("clickhouse") - // [CockroachDB] - // Stability: development - // - // [CockroachDB]: https://www.cockroachlabs.com/ - DBSystemNameCockroachDB = DBSystemNameKey.String("cockroachdb") - // [Couchbase] - // Stability: development - // - // [Couchbase]: https://www.couchbase.com/ - DBSystemNameCouchbase = DBSystemNameKey.String("couchbase") - // [Apache CouchDB] - // Stability: development - // - // [Apache CouchDB]: https://couchdb.apache.org/ - DBSystemNameCouchDB = DBSystemNameKey.String("couchdb") - // [Apache Derby] - // Stability: development - // - // [Apache Derby]: https://db.apache.org/derby/ - DBSystemNameDerby = DBSystemNameKey.String("derby") - // [Elasticsearch] - // Stability: development - // - // [Elasticsearch]: https://www.elastic.co/elasticsearch - DBSystemNameElasticsearch = DBSystemNameKey.String("elasticsearch") - // [Firebird] - // Stability: development - // - // [Firebird]: https://www.firebirdsql.org/ - DBSystemNameFirebirdSQL = DBSystemNameKey.String("firebirdsql") - // [Google Cloud Spanner] - // Stability: development - // - // [Google Cloud Spanner]: https://cloud.google.com/spanner - DBSystemNameGCPSpanner = DBSystemNameKey.String("gcp.spanner") - // [Apache Geode] - // Stability: development - // - // [Apache Geode]: https://geode.apache.org/ - DBSystemNameGeode = DBSystemNameKey.String("geode") - // [H2 Database] - // Stability: development - // - // [H2 Database]: https://h2database.com/ - DBSystemNameH2database = DBSystemNameKey.String("h2database") - // [Apache HBase] - // Stability: development - // - // [Apache HBase]: https://hbase.apache.org/ - DBSystemNameHBase = DBSystemNameKey.String("hbase") - // [Apache Hive] - // Stability: development - // - // [Apache Hive]: https://hive.apache.org/ - DBSystemNameHive = DBSystemNameKey.String("hive") - // [HyperSQL Database] - // Stability: development - // - // [HyperSQL Database]: https://hsqldb.org/ - DBSystemNameHSQLDB = DBSystemNameKey.String("hsqldb") - // [IBM Db2] - // Stability: development - // - // [IBM Db2]: https://www.ibm.com/db2 - DBSystemNameIBMDB2 = DBSystemNameKey.String("ibm.db2") - // [IBM Informix] - // Stability: development - // - // [IBM Informix]: https://www.ibm.com/products/informix - DBSystemNameIBMInformix = DBSystemNameKey.String("ibm.informix") - // [IBM Netezza] - // Stability: development - // - // [IBM Netezza]: https://www.ibm.com/products/netezza - DBSystemNameIBMNetezza = DBSystemNameKey.String("ibm.netezza") - // [InfluxDB] - // Stability: development - // - // [InfluxDB]: https://www.influxdata.com/ - DBSystemNameInfluxDB = DBSystemNameKey.String("influxdb") - // [Instant] - // Stability: development - // - // [Instant]: https://www.instantdb.com/ - DBSystemNameInstantDB = DBSystemNameKey.String("instantdb") - // [MariaDB] - // Stability: stable - // - // [MariaDB]: https://mariadb.org/ - DBSystemNameMariaDB = DBSystemNameKey.String("mariadb") - // [Memcached] - // Stability: development - // - // [Memcached]: https://memcached.org/ - DBSystemNameMemcached = DBSystemNameKey.String("memcached") - // [MongoDB] - // Stability: development - // - // [MongoDB]: https://www.mongodb.com/ - DBSystemNameMongoDB = DBSystemNameKey.String("mongodb") - // [Microsoft SQL Server] - // Stability: stable - // - // [Microsoft SQL Server]: https://www.microsoft.com/sql-server - DBSystemNameMicrosoftSQLServer = DBSystemNameKey.String("microsoft.sql_server") - // [MySQL] - // Stability: stable - // - // [MySQL]: https://www.mysql.com/ - DBSystemNameMySQL = DBSystemNameKey.String("mysql") - // [Neo4j] - // Stability: development - // - // [Neo4j]: https://neo4j.com/ - DBSystemNameNeo4j = DBSystemNameKey.String("neo4j") - // [OpenSearch] - // Stability: development - // - // [OpenSearch]: https://opensearch.org/ - DBSystemNameOpenSearch = DBSystemNameKey.String("opensearch") - // [Oracle Database] - // Stability: development - // - // [Oracle Database]: https://www.oracle.com/database/ - DBSystemNameOracleDB = DBSystemNameKey.String("oracle.db") - // [PostgreSQL] - // Stability: stable - // - // [PostgreSQL]: https://www.postgresql.org/ - DBSystemNamePostgreSQL = DBSystemNameKey.String("postgresql") - // [Redis] - // Stability: development - // - // [Redis]: https://redis.io/ - DBSystemNameRedis = DBSystemNameKey.String("redis") - // [SAP HANA] - // Stability: development - // - // [SAP HANA]: https://www.sap.com/products/technology-platform/hana/what-is-sap-hana.html - DBSystemNameSAPHANA = DBSystemNameKey.String("sap.hana") - // [SAP MaxDB] - // Stability: development - // - // [SAP MaxDB]: https://maxdb.sap.com/ - DBSystemNameSAPMaxDB = DBSystemNameKey.String("sap.maxdb") - // [SQLite] - // Stability: development - // - // [SQLite]: https://www.sqlite.org/ - DBSystemNameSQLite = DBSystemNameKey.String("sqlite") - // [Teradata] - // Stability: development - // - // [Teradata]: https://www.teradata.com/ - DBSystemNameTeradata = DBSystemNameKey.String("teradata") - // [Trino] - // Stability: development - // - // [Trino]: https://trino.io/ - DBSystemNameTrino = DBSystemNameKey.String("trino") -) - -// Namespace: deployment -const ( - // DeploymentEnvironmentNameKey is the attribute Key conforming to the - // "deployment.environment.name" semantic conventions. It represents the name of - // the [deployment environment] (aka deployment tier). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "staging", "production" - // Note: `deployment.environment.name` does not affect the uniqueness - // constraints defined through - // the `service.namespace`, `service.name` and `service.instance.id` resource - // attributes. - // This implies that resources carrying the following attribute combinations - // MUST be - // considered to be identifying the same service: - // - // - `service.name=frontend`, `deployment.environment.name=production` - // - `service.name=frontend`, `deployment.environment.name=staging`. - // - // - // [deployment environment]: https://wikipedia.org/wiki/Deployment_environment - DeploymentEnvironmentNameKey = attribute.Key("deployment.environment.name") - - // DeploymentIDKey is the attribute Key conforming to the "deployment.id" - // semantic conventions. It represents the id of the deployment. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "1208" - DeploymentIDKey = attribute.Key("deployment.id") - - // DeploymentNameKey is the attribute Key conforming to the "deployment.name" - // semantic conventions. It represents the name of the deployment. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "deploy my app", "deploy-frontend" - DeploymentNameKey = attribute.Key("deployment.name") - - // DeploymentStatusKey is the attribute Key conforming to the - // "deployment.status" semantic conventions. It represents the status of the - // deployment. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - DeploymentStatusKey = attribute.Key("deployment.status") -) - -// DeploymentEnvironmentName returns an attribute KeyValue conforming to the -// "deployment.environment.name" semantic conventions. It represents the name of -// the [deployment environment] (aka deployment tier). -// -// [deployment environment]: https://wikipedia.org/wiki/Deployment_environment -func DeploymentEnvironmentName(val string) attribute.KeyValue { - return DeploymentEnvironmentNameKey.String(val) -} - -// DeploymentID returns an attribute KeyValue conforming to the "deployment.id" -// semantic conventions. It represents the id of the deployment. -func DeploymentID(val string) attribute.KeyValue { - return DeploymentIDKey.String(val) -} - -// DeploymentName returns an attribute KeyValue conforming to the -// "deployment.name" semantic conventions. It represents the name of the -// deployment. -func DeploymentName(val string) attribute.KeyValue { - return DeploymentNameKey.String(val) -} - -// Enum values for deployment.status -var ( - // failed - // Stability: development - DeploymentStatusFailed = DeploymentStatusKey.String("failed") - // succeeded - // Stability: development - DeploymentStatusSucceeded = DeploymentStatusKey.String("succeeded") -) - -// Namespace: destination -const ( - // DestinationAddressKey is the attribute Key conforming to the - // "destination.address" semantic conventions. It represents the destination - // address - domain name if available without reverse DNS lookup; otherwise, IP - // address or Unix domain socket name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "destination.example.com", "10.1.2.80", "/tmp/my.sock" - // Note: When observed from the source side, and when communicating through an - // intermediary, `destination.address` SHOULD represent the destination address - // behind any intermediaries, for example proxies, if it's available. - DestinationAddressKey = attribute.Key("destination.address") - - // DestinationPortKey is the attribute Key conforming to the "destination.port" - // semantic conventions. It represents the destination port number. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 3389, 2888 - DestinationPortKey = attribute.Key("destination.port") -) - -// DestinationAddress returns an attribute KeyValue conforming to the -// "destination.address" semantic conventions. It represents the destination -// address - domain name if available without reverse DNS lookup; otherwise, IP -// address or Unix domain socket name. -func DestinationAddress(val string) attribute.KeyValue { - return DestinationAddressKey.String(val) -} - -// DestinationPort returns an attribute KeyValue conforming to the -// "destination.port" semantic conventions. It represents the destination port -// number. -func DestinationPort(val int) attribute.KeyValue { - return DestinationPortKey.Int(val) -} - -// Namespace: device -const ( - // DeviceIDKey is the attribute Key conforming to the "device.id" semantic - // conventions. It represents a unique identifier representing the device. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "123456789012345", "01:23:45:67:89:AB" - // Note: Its value SHOULD be identical for all apps on a device and it SHOULD - // NOT change if an app is uninstalled and re-installed. - // However, it might be resettable by the user for all apps on a device. - // Hardware IDs (e.g. vendor-specific serial number, IMEI or MAC address) MAY be - // used as values. - // - // More information about Android identifier best practices can be found in the - // [Android user data IDs guide]. - // - // > [!WARNING]> This attribute may contain sensitive (PII) information. Caution - // > should be taken when storing personal data or anything which can identify a - // > user. GDPR and data protection laws may apply, - // > ensure you do your own due diligence.> Due to these reasons, this - // > identifier is not recommended for consumer applications and will likely - // > result in rejection from both Google Play and App Store. - // > However, it may be appropriate for specific enterprise scenarios, such as - // > kiosk devices or enterprise-managed devices, with appropriate compliance - // > clearance. - // > Any instrumentation providing this identifier MUST implement it as an - // > opt-in feature.> See [`app.installation.id`]> for a more - // > privacy-preserving alternative. - // - // [Android user data IDs guide]: https://developer.android.com/training/articles/user-data-ids - // [`app.installation.id`]: /docs/registry/attributes/app.md#app-installation-id - DeviceIDKey = attribute.Key("device.id") - - // DeviceManufacturerKey is the attribute Key conforming to the - // "device.manufacturer" semantic conventions. It represents the name of the - // device manufacturer. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Apple", "Samsung" - // Note: The Android OS provides this field via [Build]. iOS apps SHOULD - // hardcode the value `Apple`. - // - // [Build]: https://developer.android.com/reference/android/os/Build#MANUFACTURER - DeviceManufacturerKey = attribute.Key("device.manufacturer") - - // DeviceModelIdentifierKey is the attribute Key conforming to the - // "device.model.identifier" semantic conventions. It represents the model - // identifier for the device. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "iPhone3,4", "SM-G920F" - // Note: It's recommended this value represents a machine-readable version of - // the model identifier rather than the market or consumer-friendly name of the - // device. - DeviceModelIdentifierKey = attribute.Key("device.model.identifier") - - // DeviceModelNameKey is the attribute Key conforming to the "device.model.name" - // semantic conventions. It represents the marketing name for the device model. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "iPhone 6s Plus", "Samsung Galaxy S6" - // Note: It's recommended this value represents a human-readable version of the - // device model rather than a machine-readable alternative. - DeviceModelNameKey = attribute.Key("device.model.name") -) - -// DeviceID returns an attribute KeyValue conforming to the "device.id" semantic -// conventions. It represents a unique identifier representing the device. -func DeviceID(val string) attribute.KeyValue { - return DeviceIDKey.String(val) -} - -// DeviceManufacturer returns an attribute KeyValue conforming to the -// "device.manufacturer" semantic conventions. It represents the name of the -// device manufacturer. -func DeviceManufacturer(val string) attribute.KeyValue { - return DeviceManufacturerKey.String(val) -} - -// DeviceModelIdentifier returns an attribute KeyValue conforming to the -// "device.model.identifier" semantic conventions. It represents the model -// identifier for the device. -func DeviceModelIdentifier(val string) attribute.KeyValue { - return DeviceModelIdentifierKey.String(val) -} - -// DeviceModelName returns an attribute KeyValue conforming to the -// "device.model.name" semantic conventions. It represents the marketing name for -// the device model. -func DeviceModelName(val string) attribute.KeyValue { - return DeviceModelNameKey.String(val) -} - -// Namespace: disk -const ( - // DiskIODirectionKey is the attribute Key conforming to the "disk.io.direction" - // semantic conventions. It represents the disk IO operation direction. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "read" - DiskIODirectionKey = attribute.Key("disk.io.direction") -) - -// Enum values for disk.io.direction -var ( - // read - // Stability: development - DiskIODirectionRead = DiskIODirectionKey.String("read") - // write - // Stability: development - DiskIODirectionWrite = DiskIODirectionKey.String("write") -) - -// Namespace: dns -const ( - // DNSAnswersKey is the attribute Key conforming to the "dns.answers" semantic - // conventions. It represents the list of IPv4 or IPv6 addresses resolved during - // DNS lookup. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "10.0.0.1", "2001:0db8:85a3:0000:0000:8a2e:0370:7334" - DNSAnswersKey = attribute.Key("dns.answers") - - // DNSQuestionNameKey is the attribute Key conforming to the "dns.question.name" - // semantic conventions. It represents the name being queried. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "www.example.com", "opentelemetry.io" - // Note: The name represents the queried domain name as it appears in the DNS - // query without any additional normalization. - DNSQuestionNameKey = attribute.Key("dns.question.name") -) - -// DNSAnswers returns an attribute KeyValue conforming to the "dns.answers" -// semantic conventions. It represents the list of IPv4 or IPv6 addresses -// resolved during DNS lookup. -func DNSAnswers(val ...string) attribute.KeyValue { - return DNSAnswersKey.StringSlice(val) -} - -// DNSQuestionName returns an attribute KeyValue conforming to the -// "dns.question.name" semantic conventions. It represents the name being -// queried. -func DNSQuestionName(val string) attribute.KeyValue { - return DNSQuestionNameKey.String(val) -} - -// Namespace: elasticsearch -const ( - // ElasticsearchNodeNameKey is the attribute Key conforming to the - // "elasticsearch.node.name" semantic conventions. It represents the represents - // the human-readable identifier of the node/instance to which a request was - // routed. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "instance-0000000001" - ElasticsearchNodeNameKey = attribute.Key("elasticsearch.node.name") -) - -// ElasticsearchNodeName returns an attribute KeyValue conforming to the -// "elasticsearch.node.name" semantic conventions. It represents the represents -// the human-readable identifier of the node/instance to which a request was -// routed. -func ElasticsearchNodeName(val string) attribute.KeyValue { - return ElasticsearchNodeNameKey.String(val) -} - -// Namespace: enduser -const ( - // EnduserIDKey is the attribute Key conforming to the "enduser.id" semantic - // conventions. It represents the unique identifier of an end user in the - // system. It maybe a username, email address, or other identifier. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "username" - // Note: Unique identifier of an end user in the system. - // - // > [!Warning] - // > This field contains sensitive (PII) information. - EnduserIDKey = attribute.Key("enduser.id") - - // EnduserPseudoIDKey is the attribute Key conforming to the "enduser.pseudo.id" - // semantic conventions. It represents the pseudonymous identifier of an end - // user. This identifier should be a random value that is not directly linked or - // associated with the end user's actual identity. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "QdH5CAWJgqVT4rOr0qtumf" - // Note: Pseudonymous identifier of an end user. - // - // > [!Warning] - // > This field contains sensitive (linkable PII) information. - EnduserPseudoIDKey = attribute.Key("enduser.pseudo.id") -) - -// EnduserID returns an attribute KeyValue conforming to the "enduser.id" -// semantic conventions. It represents the unique identifier of an end user in -// the system. It maybe a username, email address, or other identifier. -func EnduserID(val string) attribute.KeyValue { - return EnduserIDKey.String(val) -} - -// EnduserPseudoID returns an attribute KeyValue conforming to the -// "enduser.pseudo.id" semantic conventions. It represents the pseudonymous -// identifier of an end user. This identifier should be a random value that is -// not directly linked or associated with the end user's actual identity. -func EnduserPseudoID(val string) attribute.KeyValue { - return EnduserPseudoIDKey.String(val) -} - -// Namespace: error -const ( - // ErrorMessageKey is the attribute Key conforming to the "error.message" - // semantic conventions. It represents a message providing more detail about an - // error in human-readable form. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Unexpected input type: string", "The user has exceeded their - // storage quota" - // Note: `error.message` should provide additional context and detail about an - // error. - // It is NOT RECOMMENDED to duplicate the value of `error.type` in - // `error.message`. - // It is also NOT RECOMMENDED to duplicate the value of `exception.message` in - // `error.message`. - // - // `error.message` is NOT RECOMMENDED for metrics or spans due to its unbounded - // cardinality and overlap with span status. - ErrorMessageKey = attribute.Key("error.message") - - // ErrorTypeKey is the attribute Key conforming to the "error.type" semantic - // conventions. It represents the describes a class of error the operation ended - // with. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "timeout", "java.net.UnknownHostException", - // "server_certificate_invalid", "500" - // Note: The `error.type` SHOULD be predictable, and SHOULD have low - // cardinality. - // - // When `error.type` is set to a type (e.g., an exception type), its - // canonical class name identifying the type within the artifact SHOULD be used. - // - // Instrumentations SHOULD document the list of errors they report. - // - // The cardinality of `error.type` within one instrumentation library SHOULD be - // low. - // Telemetry consumers that aggregate data from multiple instrumentation - // libraries and applications - // should be prepared for `error.type` to have high cardinality at query time - // when no - // additional filters are applied. - // - // If the operation has completed successfully, instrumentations SHOULD NOT set - // `error.type`. - // - // If a specific domain defines its own set of error identifiers (such as HTTP - // or RPC status codes), - // it's RECOMMENDED to: - // - // - Use a domain-specific attribute - // - Set `error.type` to capture all errors, regardless of whether they are - // defined within the domain-specific set or not. - ErrorTypeKey = attribute.Key("error.type") -) - -// ErrorMessage returns an attribute KeyValue conforming to the "error.message" -// semantic conventions. It represents a message providing more detail about an -// error in human-readable form. -func ErrorMessage(val string) attribute.KeyValue { - return ErrorMessageKey.String(val) -} - -// Enum values for error.type -var ( - // A fallback error value to be used when the instrumentation doesn't define a - // custom value. - // - // Stability: stable - ErrorTypeOther = ErrorTypeKey.String("_OTHER") -) - -// Namespace: exception -const ( - // ExceptionMessageKey is the attribute Key conforming to the - // "exception.message" semantic conventions. It represents the exception - // message. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "Division by zero", "Can't convert 'int' object to str implicitly" - ExceptionMessageKey = attribute.Key("exception.message") - - // ExceptionStacktraceKey is the attribute Key conforming to the - // "exception.stacktrace" semantic conventions. It represents a stacktrace as a - // string in the natural representation for the language runtime. The - // representation is to be determined and documented by each language SIG. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: Exception in thread "main" java.lang.RuntimeException: Test - // exception\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at - // com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at - // com.example.GenerateTrace.main(GenerateTrace.java:5) - ExceptionStacktraceKey = attribute.Key("exception.stacktrace") - - // ExceptionTypeKey is the attribute Key conforming to the "exception.type" - // semantic conventions. It represents the type of the exception (its - // fully-qualified class name, if applicable). The dynamic type of the exception - // should be preferred over the static type in languages that support it. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "java.net.ConnectException", "OSError" - ExceptionTypeKey = attribute.Key("exception.type") -) - -// ExceptionMessage returns an attribute KeyValue conforming to the -// "exception.message" semantic conventions. It represents the exception message. -func ExceptionMessage(val string) attribute.KeyValue { - return ExceptionMessageKey.String(val) -} - -// ExceptionStacktrace returns an attribute KeyValue conforming to the -// "exception.stacktrace" semantic conventions. It represents a stacktrace as a -// string in the natural representation for the language runtime. The -// representation is to be determined and documented by each language SIG. -func ExceptionStacktrace(val string) attribute.KeyValue { - return ExceptionStacktraceKey.String(val) -} - -// ExceptionType returns an attribute KeyValue conforming to the "exception.type" -// semantic conventions. It represents the type of the exception (its -// fully-qualified class name, if applicable). The dynamic type of the exception -// should be preferred over the static type in languages that support it. -func ExceptionType(val string) attribute.KeyValue { - return ExceptionTypeKey.String(val) -} - -// Namespace: faas -const ( - // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" - // semantic conventions. It represents a boolean that is true if the serverless - // function is executed for the first time (aka cold-start). - // - // Type: boolean - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - FaaSColdstartKey = attribute.Key("faas.coldstart") - - // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic - // conventions. It represents a string containing the schedule period as - // [Cron Expression]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 0/5 * * * ? * - // - // [Cron Expression]: https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm - FaaSCronKey = attribute.Key("faas.cron") - - // FaaSDocumentCollectionKey is the attribute Key conforming to the - // "faas.document.collection" semantic conventions. It represents the name of - // the source on which the triggering operation was performed. For example, in - // Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the - // database name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "myBucketName", "myDbName" - FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") - - // FaaSDocumentNameKey is the attribute Key conforming to the - // "faas.document.name" semantic conventions. It represents the document - // name/table subjected to the operation. For example, in Cloud Storage or S3 is - // the name of the file, and in Cosmos DB the table name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "myFile.txt", "myTableName" - FaaSDocumentNameKey = attribute.Key("faas.document.name") - - // FaaSDocumentOperationKey is the attribute Key conforming to the - // "faas.document.operation" semantic conventions. It represents the describes - // the type of the operation that was performed on the data. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - FaaSDocumentOperationKey = attribute.Key("faas.document.operation") - - // FaaSDocumentTimeKey is the attribute Key conforming to the - // "faas.document.time" semantic conventions. It represents a string containing - // the time when the data was accessed in the [ISO 8601] format expressed in - // [UTC]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 2020-01-23T13:47:06Z - // - // [ISO 8601]: https://www.iso.org/iso-8601-date-and-time-format.html - // [UTC]: https://www.w3.org/TR/NOTE-datetime - FaaSDocumentTimeKey = attribute.Key("faas.document.time") - - // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" - // semantic conventions. It represents the execution environment ID as a string, - // that will be potentially reused for other invocations to the same - // function/function version. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de" - // Note: - **AWS Lambda:** Use the (full) log stream name. - FaaSInstanceKey = attribute.Key("faas.instance") - - // FaaSInvocationIDKey is the attribute Key conforming to the - // "faas.invocation_id" semantic conventions. It represents the invocation ID of - // the current function invocation. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: af9d5aa4-a685-4c5f-a22b-444f80b3cc28 - FaaSInvocationIDKey = attribute.Key("faas.invocation_id") - - // FaaSInvokedNameKey is the attribute Key conforming to the "faas.invoked_name" - // semantic conventions. It represents the name of the invoked function. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: my-function - // Note: SHOULD be equal to the `faas.name` resource attribute of the invoked - // function. - FaaSInvokedNameKey = attribute.Key("faas.invoked_name") - - // FaaSInvokedProviderKey is the attribute Key conforming to the - // "faas.invoked_provider" semantic conventions. It represents the cloud - // provider of the invoked function. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: SHOULD be equal to the `cloud.provider` resource attribute of the - // invoked function. - FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") - - // FaaSInvokedRegionKey is the attribute Key conforming to the - // "faas.invoked_region" semantic conventions. It represents the cloud region of - // the invoked function. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: eu-central-1 - // Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked - // function. - FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") - - // FaaSMaxMemoryKey is the attribute Key conforming to the "faas.max_memory" - // semantic conventions. It represents the amount of memory available to the - // serverless function converted to Bytes. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Note: It's recommended to set this attribute since e.g. too little memory can - // easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, - // the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this - // information (which must be multiplied by 1,048,576). - FaaSMaxMemoryKey = attribute.Key("faas.max_memory") - - // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic - // conventions. It represents the name of the single function that this runtime - // instance executes. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "my-function", "myazurefunctionapp/some-function-name" - // Note: This is the name of the function as configured/deployed on the FaaS - // platform and is usually different from the name of the callback - // function (which may be stored in the - // [`code.namespace`/`code.function.name`] - // span attributes). - // - // For some cloud providers, the above definition is ambiguous. The following - // definition of function name MUST be used for this attribute - // (and consequently the span name) for the listed cloud providers/products: - // - // - **Azure:** The full name `/`, i.e., function app name - // followed by a forward slash followed by the function name (this form - // can also be seen in the resource JSON for the function). - // This means that a span attribute MUST be used, as an Azure function - // app can host multiple functions that would usually share - // a TracerProvider (see also the `cloud.resource_id` attribute). - // - // - // [`code.namespace`/`code.function.name`]: /docs/general/attributes.md#source-code-attributes - FaaSNameKey = attribute.Key("faas.name") - - // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic - // conventions. It represents a string containing the function invocation time - // in the [ISO 8601] format expressed in [UTC]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 2020-01-23T13:47:06Z - // - // [ISO 8601]: https://www.iso.org/iso-8601-date-and-time-format.html - // [UTC]: https://www.w3.org/TR/NOTE-datetime - FaaSTimeKey = attribute.Key("faas.time") - - // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" semantic - // conventions. It represents the type of the trigger which caused this function - // invocation. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - FaaSTriggerKey = attribute.Key("faas.trigger") - - // FaaSVersionKey is the attribute Key conforming to the "faas.version" semantic - // conventions. It represents the immutable version of the function being - // executed. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "26", "pinkfroid-00002" - // Note: Depending on the cloud provider and platform, use: - // - // - **AWS Lambda:** The [function version] - // (an integer represented as a decimal string). - // - **Google Cloud Run (Services):** The [revision] - // (i.e., the function name plus the revision suffix). - // - **Google Cloud Functions:** The value of the - // [`K_REVISION` environment variable]. - // - **Azure Functions:** Not applicable. Do not set this attribute. - // - // - // [function version]: https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html - // [revision]: https://cloud.google.com/run/docs/managing/revisions - // [`K_REVISION` environment variable]: https://cloud.google.com/run/docs/container-contract#services-env-vars - FaaSVersionKey = attribute.Key("faas.version") -) - -// FaaSColdstart returns an attribute KeyValue conforming to the "faas.coldstart" -// semantic conventions. It represents a boolean that is true if the serverless -// function is executed for the first time (aka cold-start). -func FaaSColdstart(val bool) attribute.KeyValue { - return FaaSColdstartKey.Bool(val) -} - -// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" semantic -// conventions. It represents a string containing the schedule period as -// [Cron Expression]. -// -// [Cron Expression]: https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm -func FaaSCron(val string) attribute.KeyValue { - return FaaSCronKey.String(val) -} - -// FaaSDocumentCollection returns an attribute KeyValue conforming to the -// "faas.document.collection" semantic conventions. It represents the name of the -// source on which the triggering operation was performed. For example, in Cloud -// Storage or S3 corresponds to the bucket name, and in Cosmos DB to the database -// name. -func FaaSDocumentCollection(val string) attribute.KeyValue { - return FaaSDocumentCollectionKey.String(val) -} - -// FaaSDocumentName returns an attribute KeyValue conforming to the -// "faas.document.name" semantic conventions. It represents the document -// name/table subjected to the operation. For example, in Cloud Storage or S3 is -// the name of the file, and in Cosmos DB the table name. -func FaaSDocumentName(val string) attribute.KeyValue { - return FaaSDocumentNameKey.String(val) -} - -// FaaSDocumentTime returns an attribute KeyValue conforming to the -// "faas.document.time" semantic conventions. It represents a string containing -// the time when the data was accessed in the [ISO 8601] format expressed in -// [UTC]. -// -// [ISO 8601]: https://www.iso.org/iso-8601-date-and-time-format.html -// [UTC]: https://www.w3.org/TR/NOTE-datetime -func FaaSDocumentTime(val string) attribute.KeyValue { - return FaaSDocumentTimeKey.String(val) -} - -// FaaSInstance returns an attribute KeyValue conforming to the "faas.instance" -// semantic conventions. It represents the execution environment ID as a string, -// that will be potentially reused for other invocations to the same -// function/function version. -func FaaSInstance(val string) attribute.KeyValue { - return FaaSInstanceKey.String(val) -} - -// FaaSInvocationID returns an attribute KeyValue conforming to the -// "faas.invocation_id" semantic conventions. It represents the invocation ID of -// the current function invocation. -func FaaSInvocationID(val string) attribute.KeyValue { - return FaaSInvocationIDKey.String(val) -} - -// FaaSInvokedName returns an attribute KeyValue conforming to the -// "faas.invoked_name" semantic conventions. It represents the name of the -// invoked function. -func FaaSInvokedName(val string) attribute.KeyValue { - return FaaSInvokedNameKey.String(val) -} - -// FaaSInvokedRegion returns an attribute KeyValue conforming to the -// "faas.invoked_region" semantic conventions. It represents the cloud region of -// the invoked function. -func FaaSInvokedRegion(val string) attribute.KeyValue { - return FaaSInvokedRegionKey.String(val) -} - -// FaaSMaxMemory returns an attribute KeyValue conforming to the -// "faas.max_memory" semantic conventions. It represents the amount of memory -// available to the serverless function converted to Bytes. -func FaaSMaxMemory(val int) attribute.KeyValue { - return FaaSMaxMemoryKey.Int(val) -} - -// FaaSName returns an attribute KeyValue conforming to the "faas.name" semantic -// conventions. It represents the name of the single function that this runtime -// instance executes. -func FaaSName(val string) attribute.KeyValue { - return FaaSNameKey.String(val) -} - -// FaaSTime returns an attribute KeyValue conforming to the "faas.time" semantic -// conventions. It represents a string containing the function invocation time in -// the [ISO 8601] format expressed in [UTC]. -// -// [ISO 8601]: https://www.iso.org/iso-8601-date-and-time-format.html -// [UTC]: https://www.w3.org/TR/NOTE-datetime -func FaaSTime(val string) attribute.KeyValue { - return FaaSTimeKey.String(val) -} - -// FaaSVersion returns an attribute KeyValue conforming to the "faas.version" -// semantic conventions. It represents the immutable version of the function -// being executed. -func FaaSVersion(val string) attribute.KeyValue { - return FaaSVersionKey.String(val) -} - -// Enum values for faas.document.operation -var ( - // When a new object is created. - // Stability: development - FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") - // When an object is modified. - // Stability: development - FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") - // When an object is deleted. - // Stability: development - FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") -) - -// Enum values for faas.invoked_provider -var ( - // Alibaba Cloud - // Stability: development - FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") - // Amazon Web Services - // Stability: development - FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") - // Microsoft Azure - // Stability: development - FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") - // Google Cloud Platform - // Stability: development - FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") - // Tencent Cloud - // Stability: development - FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") -) - -// Enum values for faas.trigger -var ( - // A response to some data source operation such as a database or filesystem - // read/write - // Stability: development - FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") - // To provide an answer to an inbound HTTP request - // Stability: development - FaaSTriggerHTTP = FaaSTriggerKey.String("http") - // A function is set to be executed when messages are sent to a messaging system - // Stability: development - FaaSTriggerPubSub = FaaSTriggerKey.String("pubsub") - // A function is scheduled to be executed regularly - // Stability: development - FaaSTriggerTimer = FaaSTriggerKey.String("timer") - // If none of the others apply - // Stability: development - FaaSTriggerOther = FaaSTriggerKey.String("other") -) - -// Namespace: feature_flag -const ( - // FeatureFlagContextIDKey is the attribute Key conforming to the - // "feature_flag.context.id" semantic conventions. It represents the unique - // identifier for the flag evaluation context. For example, the targeting key. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Release_Candidate - // - // Examples: "5157782b-2203-4c80-a857-dbbd5e7761db" - FeatureFlagContextIDKey = attribute.Key("feature_flag.context.id") - - // FeatureFlagKeyKey is the attribute Key conforming to the "feature_flag.key" - // semantic conventions. It represents the lookup key of the feature flag. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Release_Candidate - // - // Examples: "logo-color" - FeatureFlagKeyKey = attribute.Key("feature_flag.key") - - // FeatureFlagProviderNameKey is the attribute Key conforming to the - // "feature_flag.provider.name" semantic conventions. It represents the - // identifies the feature flag provider. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Release_Candidate - // - // Examples: "Flag Manager" - FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider.name") - - // FeatureFlagResultReasonKey is the attribute Key conforming to the - // "feature_flag.result.reason" semantic conventions. It represents the reason - // code which shows how a feature flag value was determined. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Release_Candidate - // - // Examples: "static", "targeting_match", "error", "default" - FeatureFlagResultReasonKey = attribute.Key("feature_flag.result.reason") - - // FeatureFlagResultValueKey is the attribute Key conforming to the - // "feature_flag.result.value" semantic conventions. It represents the evaluated - // value of the feature flag. - // - // Type: any - // RequirementLevel: Recommended - // Stability: Release_Candidate - // - // Examples: "#ff0000", true, 3 - // Note: With some feature flag providers, feature flag results can be quite - // large or contain private or sensitive details. - // Because of this, `feature_flag.result.variant` is often the preferred - // attribute if it is available. - // - // It may be desirable to redact or otherwise limit the size and scope of - // `feature_flag.result.value` if possible. - // Because the evaluated flag value is unstructured and may be any type, it is - // left to the instrumentation author to determine how best to achieve this. - FeatureFlagResultValueKey = attribute.Key("feature_flag.result.value") - - // FeatureFlagResultVariantKey is the attribute Key conforming to the - // "feature_flag.result.variant" semantic conventions. It represents a semantic - // identifier for an evaluated flag value. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Release_Candidate - // - // Examples: "red", "true", "on" - // Note: A semantic identifier, commonly referred to as a variant, provides a - // means - // for referring to a value without including the value itself. This can - // provide additional context for understanding the meaning behind a value. - // For example, the variant `red` maybe be used for the value `#c05543`. - FeatureFlagResultVariantKey = attribute.Key("feature_flag.result.variant") - - // FeatureFlagSetIDKey is the attribute Key conforming to the - // "feature_flag.set.id" semantic conventions. It represents the identifier of - // the [flag set] to which the feature flag belongs. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Release_Candidate - // - // Examples: "proj-1", "ab98sgs", "service1/dev" - // - // [flag set]: https://openfeature.dev/specification/glossary/#flag-set - FeatureFlagSetIDKey = attribute.Key("feature_flag.set.id") - - // FeatureFlagVersionKey is the attribute Key conforming to the - // "feature_flag.version" semantic conventions. It represents the version of the - // ruleset used during the evaluation. This may be any stable value which - // uniquely identifies the ruleset. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Release_Candidate - // - // Examples: "1", "01ABCDEF" - FeatureFlagVersionKey = attribute.Key("feature_flag.version") -) - -// FeatureFlagContextID returns an attribute KeyValue conforming to the -// "feature_flag.context.id" semantic conventions. It represents the unique -// identifier for the flag evaluation context. For example, the targeting key. -func FeatureFlagContextID(val string) attribute.KeyValue { - return FeatureFlagContextIDKey.String(val) -} - -// FeatureFlagKey returns an attribute KeyValue conforming to the -// "feature_flag.key" semantic conventions. It represents the lookup key of the -// feature flag. -func FeatureFlagKey(val string) attribute.KeyValue { - return FeatureFlagKeyKey.String(val) -} - -// FeatureFlagProviderName returns an attribute KeyValue conforming to the -// "feature_flag.provider.name" semantic conventions. It represents the -// identifies the feature flag provider. -func FeatureFlagProviderName(val string) attribute.KeyValue { - return FeatureFlagProviderNameKey.String(val) -} - -// FeatureFlagResultVariant returns an attribute KeyValue conforming to the -// "feature_flag.result.variant" semantic conventions. It represents a semantic -// identifier for an evaluated flag value. -func FeatureFlagResultVariant(val string) attribute.KeyValue { - return FeatureFlagResultVariantKey.String(val) -} - -// FeatureFlagSetID returns an attribute KeyValue conforming to the -// "feature_flag.set.id" semantic conventions. It represents the identifier of -// the [flag set] to which the feature flag belongs. -// -// [flag set]: https://openfeature.dev/specification/glossary/#flag-set -func FeatureFlagSetID(val string) attribute.KeyValue { - return FeatureFlagSetIDKey.String(val) -} - -// FeatureFlagVersion returns an attribute KeyValue conforming to the -// "feature_flag.version" semantic conventions. It represents the version of the -// ruleset used during the evaluation. This may be any stable value which -// uniquely identifies the ruleset. -func FeatureFlagVersion(val string) attribute.KeyValue { - return FeatureFlagVersionKey.String(val) -} - -// Enum values for feature_flag.result.reason -var ( - // The resolved value is static (no dynamic evaluation). - // Stability: release_candidate - FeatureFlagResultReasonStatic = FeatureFlagResultReasonKey.String("static") - // The resolved value fell back to a pre-configured value (no dynamic evaluation - // occurred or dynamic evaluation yielded no result). - // Stability: release_candidate - FeatureFlagResultReasonDefault = FeatureFlagResultReasonKey.String("default") - // The resolved value was the result of a dynamic evaluation, such as a rule or - // specific user-targeting. - // Stability: release_candidate - FeatureFlagResultReasonTargetingMatch = FeatureFlagResultReasonKey.String("targeting_match") - // The resolved value was the result of pseudorandom assignment. - // Stability: release_candidate - FeatureFlagResultReasonSplit = FeatureFlagResultReasonKey.String("split") - // The resolved value was retrieved from cache. - // Stability: release_candidate - FeatureFlagResultReasonCached = FeatureFlagResultReasonKey.String("cached") - // The resolved value was the result of the flag being disabled in the - // management system. - // Stability: release_candidate - FeatureFlagResultReasonDisabled = FeatureFlagResultReasonKey.String("disabled") - // The reason for the resolved value could not be determined. - // Stability: release_candidate - FeatureFlagResultReasonUnknown = FeatureFlagResultReasonKey.String("unknown") - // The resolved value is non-authoritative or possibly out of date - // Stability: release_candidate - FeatureFlagResultReasonStale = FeatureFlagResultReasonKey.String("stale") - // The resolved value was the result of an error. - // Stability: release_candidate - FeatureFlagResultReasonError = FeatureFlagResultReasonKey.String("error") -) - -// Namespace: file -const ( - // FileAccessedKey is the attribute Key conforming to the "file.accessed" - // semantic conventions. It represents the time when the file was last accessed, - // in ISO 8601 format. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "2021-01-01T12:00:00Z" - // Note: This attribute might not be supported by some file systems — NFS, - // FAT32, in embedded OS, etc. - FileAccessedKey = attribute.Key("file.accessed") - - // FileAttributesKey is the attribute Key conforming to the "file.attributes" - // semantic conventions. It represents the array of file attributes. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "readonly", "hidden" - // Note: Attributes names depend on the OS or file system. Here’s a - // non-exhaustive list of values expected for this attribute: `archive`, - // `compressed`, `directory`, `encrypted`, `execute`, `hidden`, `immutable`, - // `journaled`, `read`, `readonly`, `symbolic link`, `system`, `temporary`, - // `write`. - FileAttributesKey = attribute.Key("file.attributes") - - // FileChangedKey is the attribute Key conforming to the "file.changed" semantic - // conventions. It represents the time when the file attributes or metadata was - // last changed, in ISO 8601 format. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "2021-01-01T12:00:00Z" - // Note: `file.changed` captures the time when any of the file's properties or - // attributes (including the content) are changed, while `file.modified` - // captures the timestamp when the file content is modified. - FileChangedKey = attribute.Key("file.changed") - - // FileCreatedKey is the attribute Key conforming to the "file.created" semantic - // conventions. It represents the time when the file was created, in ISO 8601 - // format. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "2021-01-01T12:00:00Z" - // Note: This attribute might not be supported by some file systems — NFS, - // FAT32, in embedded OS, etc. - FileCreatedKey = attribute.Key("file.created") - - // FileDirectoryKey is the attribute Key conforming to the "file.directory" - // semantic conventions. It represents the directory where the file is located. - // It should include the drive letter, when appropriate. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "/home/user", "C:\Program Files\MyApp" - FileDirectoryKey = attribute.Key("file.directory") - - // FileExtensionKey is the attribute Key conforming to the "file.extension" - // semantic conventions. It represents the file extension, excluding the leading - // dot. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "png", "gz" - // Note: When the file name has multiple extensions (example.tar.gz), only the - // last one should be captured ("gz", not "tar.gz"). - FileExtensionKey = attribute.Key("file.extension") - - // FileForkNameKey is the attribute Key conforming to the "file.fork_name" - // semantic conventions. It represents the name of the fork. A fork is - // additional data associated with a filesystem object. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Zone.Identifier" - // Note: On Linux, a resource fork is used to store additional data with a - // filesystem object. A file always has at least one fork for the data portion, - // and additional forks may exist. - // On NTFS, this is analogous to an Alternate Data Stream (ADS), and the default - // data stream for a file is just called $DATA. Zone.Identifier is commonly used - // by Windows to track contents downloaded from the Internet. An ADS is - // typically of the form: C:\path\to\filename.extension:some_fork_name, and - // some_fork_name is the value that should populate `fork_name`. - // `filename.extension` should populate `file.name`, and `extension` should - // populate `file.extension`. The full path, `file.path`, will include the fork - // name. - FileForkNameKey = attribute.Key("file.fork_name") - - // FileGroupIDKey is the attribute Key conforming to the "file.group.id" - // semantic conventions. It represents the primary Group ID (GID) of the file. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "1000" - FileGroupIDKey = attribute.Key("file.group.id") - - // FileGroupNameKey is the attribute Key conforming to the "file.group.name" - // semantic conventions. It represents the primary group name of the file. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "users" - FileGroupNameKey = attribute.Key("file.group.name") - - // FileInodeKey is the attribute Key conforming to the "file.inode" semantic - // conventions. It represents the inode representing the file in the filesystem. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "256383" - FileInodeKey = attribute.Key("file.inode") - - // FileModeKey is the attribute Key conforming to the "file.mode" semantic - // conventions. It represents the mode of the file in octal representation. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "0640" - FileModeKey = attribute.Key("file.mode") - - // FileModifiedKey is the attribute Key conforming to the "file.modified" - // semantic conventions. It represents the time when the file content was last - // modified, in ISO 8601 format. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "2021-01-01T12:00:00Z" - FileModifiedKey = attribute.Key("file.modified") - - // FileNameKey is the attribute Key conforming to the "file.name" semantic - // conventions. It represents the name of the file including the extension, - // without the directory. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "example.png" - FileNameKey = attribute.Key("file.name") - - // FileOwnerIDKey is the attribute Key conforming to the "file.owner.id" - // semantic conventions. It represents the user ID (UID) or security identifier - // (SID) of the file owner. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "1000" - FileOwnerIDKey = attribute.Key("file.owner.id") - - // FileOwnerNameKey is the attribute Key conforming to the "file.owner.name" - // semantic conventions. It represents the username of the file owner. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "root" - FileOwnerNameKey = attribute.Key("file.owner.name") - - // FilePathKey is the attribute Key conforming to the "file.path" semantic - // conventions. It represents the full path to the file, including the file - // name. It should include the drive letter, when appropriate. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "/home/alice/example.png", "C:\Program Files\MyApp\myapp.exe" - FilePathKey = attribute.Key("file.path") - - // FileSizeKey is the attribute Key conforming to the "file.size" semantic - // conventions. It represents the file size in bytes. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - FileSizeKey = attribute.Key("file.size") - - // FileSymbolicLinkTargetPathKey is the attribute Key conforming to the - // "file.symbolic_link.target_path" semantic conventions. It represents the path - // to the target of a symbolic link. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "/usr/bin/python3" - // Note: This attribute is only applicable to symbolic links. - FileSymbolicLinkTargetPathKey = attribute.Key("file.symbolic_link.target_path") -) - -// FileAccessed returns an attribute KeyValue conforming to the "file.accessed" -// semantic conventions. It represents the time when the file was last accessed, -// in ISO 8601 format. -func FileAccessed(val string) attribute.KeyValue { - return FileAccessedKey.String(val) -} - -// FileAttributes returns an attribute KeyValue conforming to the -// "file.attributes" semantic conventions. It represents the array of file -// attributes. -func FileAttributes(val ...string) attribute.KeyValue { - return FileAttributesKey.StringSlice(val) -} - -// FileChanged returns an attribute KeyValue conforming to the "file.changed" -// semantic conventions. It represents the time when the file attributes or -// metadata was last changed, in ISO 8601 format. -func FileChanged(val string) attribute.KeyValue { - return FileChangedKey.String(val) -} - -// FileCreated returns an attribute KeyValue conforming to the "file.created" -// semantic conventions. It represents the time when the file was created, in ISO -// 8601 format. -func FileCreated(val string) attribute.KeyValue { - return FileCreatedKey.String(val) -} - -// FileDirectory returns an attribute KeyValue conforming to the "file.directory" -// semantic conventions. It represents the directory where the file is located. -// It should include the drive letter, when appropriate. -func FileDirectory(val string) attribute.KeyValue { - return FileDirectoryKey.String(val) -} - -// FileExtension returns an attribute KeyValue conforming to the "file.extension" -// semantic conventions. It represents the file extension, excluding the leading -// dot. -func FileExtension(val string) attribute.KeyValue { - return FileExtensionKey.String(val) -} - -// FileForkName returns an attribute KeyValue conforming to the "file.fork_name" -// semantic conventions. It represents the name of the fork. A fork is additional -// data associated with a filesystem object. -func FileForkName(val string) attribute.KeyValue { - return FileForkNameKey.String(val) -} - -// FileGroupID returns an attribute KeyValue conforming to the "file.group.id" -// semantic conventions. It represents the primary Group ID (GID) of the file. -func FileGroupID(val string) attribute.KeyValue { - return FileGroupIDKey.String(val) -} - -// FileGroupName returns an attribute KeyValue conforming to the -// "file.group.name" semantic conventions. It represents the primary group name -// of the file. -func FileGroupName(val string) attribute.KeyValue { - return FileGroupNameKey.String(val) -} - -// FileInode returns an attribute KeyValue conforming to the "file.inode" -// semantic conventions. It represents the inode representing the file in the -// filesystem. -func FileInode(val string) attribute.KeyValue { - return FileInodeKey.String(val) -} - -// FileMode returns an attribute KeyValue conforming to the "file.mode" semantic -// conventions. It represents the mode of the file in octal representation. -func FileMode(val string) attribute.KeyValue { - return FileModeKey.String(val) -} - -// FileModified returns an attribute KeyValue conforming to the "file.modified" -// semantic conventions. It represents the time when the file content was last -// modified, in ISO 8601 format. -func FileModified(val string) attribute.KeyValue { - return FileModifiedKey.String(val) -} - -// FileName returns an attribute KeyValue conforming to the "file.name" semantic -// conventions. It represents the name of the file including the extension, -// without the directory. -func FileName(val string) attribute.KeyValue { - return FileNameKey.String(val) -} - -// FileOwnerID returns an attribute KeyValue conforming to the "file.owner.id" -// semantic conventions. It represents the user ID (UID) or security identifier -// (SID) of the file owner. -func FileOwnerID(val string) attribute.KeyValue { - return FileOwnerIDKey.String(val) -} - -// FileOwnerName returns an attribute KeyValue conforming to the -// "file.owner.name" semantic conventions. It represents the username of the file -// owner. -func FileOwnerName(val string) attribute.KeyValue { - return FileOwnerNameKey.String(val) -} - -// FilePath returns an attribute KeyValue conforming to the "file.path" semantic -// conventions. It represents the full path to the file, including the file name. -// It should include the drive letter, when appropriate. -func FilePath(val string) attribute.KeyValue { - return FilePathKey.String(val) -} - -// FileSize returns an attribute KeyValue conforming to the "file.size" semantic -// conventions. It represents the file size in bytes. -func FileSize(val int) attribute.KeyValue { - return FileSizeKey.Int(val) -} - -// FileSymbolicLinkTargetPath returns an attribute KeyValue conforming to the -// "file.symbolic_link.target_path" semantic conventions. It represents the path -// to the target of a symbolic link. -func FileSymbolicLinkTargetPath(val string) attribute.KeyValue { - return FileSymbolicLinkTargetPathKey.String(val) -} - -// Namespace: gcp -const ( - // GCPAppHubApplicationContainerKey is the attribute Key conforming to the - // "gcp.apphub.application.container" semantic conventions. It represents the - // container within GCP where the AppHub application is defined. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "projects/my-container-project" - GCPAppHubApplicationContainerKey = attribute.Key("gcp.apphub.application.container") - - // GCPAppHubApplicationIDKey is the attribute Key conforming to the - // "gcp.apphub.application.id" semantic conventions. It represents the name of - // the application as configured in AppHub. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "my-application" - GCPAppHubApplicationIDKey = attribute.Key("gcp.apphub.application.id") - - // GCPAppHubApplicationLocationKey is the attribute Key conforming to the - // "gcp.apphub.application.location" semantic conventions. It represents the GCP - // zone or region where the application is defined. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "us-central1" - GCPAppHubApplicationLocationKey = attribute.Key("gcp.apphub.application.location") - - // GCPAppHubServiceCriticalityTypeKey is the attribute Key conforming to the - // "gcp.apphub.service.criticality_type" semantic conventions. It represents the - // criticality of a service indicates its importance to the business. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: [See AppHub type enum] - // - // [See AppHub type enum]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type - GCPAppHubServiceCriticalityTypeKey = attribute.Key("gcp.apphub.service.criticality_type") - - // GCPAppHubServiceEnvironmentTypeKey is the attribute Key conforming to the - // "gcp.apphub.service.environment_type" semantic conventions. It represents the - // environment of a service is the stage of a software lifecycle. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: [See AppHub environment type] - // - // [See AppHub environment type]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type_1 - GCPAppHubServiceEnvironmentTypeKey = attribute.Key("gcp.apphub.service.environment_type") - - // GCPAppHubServiceIDKey is the attribute Key conforming to the - // "gcp.apphub.service.id" semantic conventions. It represents the name of the - // service as configured in AppHub. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "my-service" - GCPAppHubServiceIDKey = attribute.Key("gcp.apphub.service.id") - - // GCPAppHubWorkloadCriticalityTypeKey is the attribute Key conforming to the - // "gcp.apphub.workload.criticality_type" semantic conventions. It represents - // the criticality of a workload indicates its importance to the business. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: [See AppHub type enum] - // - // [See AppHub type enum]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type - GCPAppHubWorkloadCriticalityTypeKey = attribute.Key("gcp.apphub.workload.criticality_type") - - // GCPAppHubWorkloadEnvironmentTypeKey is the attribute Key conforming to the - // "gcp.apphub.workload.environment_type" semantic conventions. It represents - // the environment of a workload is the stage of a software lifecycle. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: [See AppHub environment type] - // - // [See AppHub environment type]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type_1 - GCPAppHubWorkloadEnvironmentTypeKey = attribute.Key("gcp.apphub.workload.environment_type") - - // GCPAppHubWorkloadIDKey is the attribute Key conforming to the - // "gcp.apphub.workload.id" semantic conventions. It represents the name of the - // workload as configured in AppHub. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "my-workload" - GCPAppHubWorkloadIDKey = attribute.Key("gcp.apphub.workload.id") - - // GCPAppHubDestinationApplicationContainerKey is the attribute Key conforming - // to the "gcp.apphub_destination.application.container" semantic conventions. - // It represents the container within GCP where the AppHub destination - // application is defined. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "projects/my-container-project" - GCPAppHubDestinationApplicationContainerKey = attribute.Key("gcp.apphub_destination.application.container") - - // GCPAppHubDestinationApplicationIDKey is the attribute Key conforming to the - // "gcp.apphub_destination.application.id" semantic conventions. It represents - // the name of the destination application as configured in AppHub. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "my-application" - GCPAppHubDestinationApplicationIDKey = attribute.Key("gcp.apphub_destination.application.id") - - // GCPAppHubDestinationApplicationLocationKey is the attribute Key conforming to - // the "gcp.apphub_destination.application.location" semantic conventions. It - // represents the GCP zone or region where the destination application is - // defined. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "us-central1" - GCPAppHubDestinationApplicationLocationKey = attribute.Key("gcp.apphub_destination.application.location") - - // GCPAppHubDestinationServiceCriticalityTypeKey is the attribute Key conforming - // to the "gcp.apphub_destination.service.criticality_type" semantic - // conventions. It represents the criticality of a destination workload - // indicates its importance to the business as specified in [AppHub type enum]. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // - // [AppHub type enum]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type - GCPAppHubDestinationServiceCriticalityTypeKey = attribute.Key("gcp.apphub_destination.service.criticality_type") - - // GCPAppHubDestinationServiceEnvironmentTypeKey is the attribute Key conforming - // to the "gcp.apphub_destination.service.environment_type" semantic - // conventions. It represents the software lifecycle stage of a destination - // service as defined [AppHub environment type]. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // - // [AppHub environment type]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type_1 - GCPAppHubDestinationServiceEnvironmentTypeKey = attribute.Key("gcp.apphub_destination.service.environment_type") - - // GCPAppHubDestinationServiceIDKey is the attribute Key conforming to the - // "gcp.apphub_destination.service.id" semantic conventions. It represents the - // name of the destination service as configured in AppHub. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "my-service" - GCPAppHubDestinationServiceIDKey = attribute.Key("gcp.apphub_destination.service.id") - - // GCPAppHubDestinationWorkloadCriticalityTypeKey is the attribute Key - // conforming to the "gcp.apphub_destination.workload.criticality_type" semantic - // conventions. It represents the criticality of a destination workload - // indicates its importance to the business as specified in [AppHub type enum]. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // - // [AppHub type enum]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type - GCPAppHubDestinationWorkloadCriticalityTypeKey = attribute.Key("gcp.apphub_destination.workload.criticality_type") - - // GCPAppHubDestinationWorkloadEnvironmentTypeKey is the attribute Key - // conforming to the "gcp.apphub_destination.workload.environment_type" semantic - // conventions. It represents the environment of a destination workload is the - // stage of a software lifecycle as provided in the [AppHub environment type]. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // - // [AppHub environment type]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type_1 - GCPAppHubDestinationWorkloadEnvironmentTypeKey = attribute.Key("gcp.apphub_destination.workload.environment_type") - - // GCPAppHubDestinationWorkloadIDKey is the attribute Key conforming to the - // "gcp.apphub_destination.workload.id" semantic conventions. It represents the - // name of the destination workload as configured in AppHub. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "my-workload" - GCPAppHubDestinationWorkloadIDKey = attribute.Key("gcp.apphub_destination.workload.id") - - // GCPClientServiceKey is the attribute Key conforming to the - // "gcp.client.service" semantic conventions. It represents the identifies the - // Google Cloud service for which the official client library is intended. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "appengine", "run", "firestore", "alloydb", "spanner" - // Note: Intended to be a stable identifier for Google Cloud client libraries - // that is uniform across implementation languages. The value should be derived - // from the canonical service domain for the service; for example, - // 'foo.googleapis.com' should result in a value of 'foo'. - GCPClientServiceKey = attribute.Key("gcp.client.service") - - // GCPCloudRunJobExecutionKey is the attribute Key conforming to the - // "gcp.cloud_run.job.execution" semantic conventions. It represents the name of - // the Cloud Run [execution] being run for the Job, as set by the - // [`CLOUD_RUN_EXECUTION`] environment variable. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "job-name-xxxx", "sample-job-mdw84" - // - // [execution]: https://cloud.google.com/run/docs/managing/job-executions - // [`CLOUD_RUN_EXECUTION`]: https://cloud.google.com/run/docs/container-contract#jobs-env-vars - GCPCloudRunJobExecutionKey = attribute.Key("gcp.cloud_run.job.execution") - - // GCPCloudRunJobTaskIndexKey is the attribute Key conforming to the - // "gcp.cloud_run.job.task_index" semantic conventions. It represents the index - // for a task within an execution as provided by the [`CLOUD_RUN_TASK_INDEX`] - // environment variable. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 0, 1 - // - // [`CLOUD_RUN_TASK_INDEX`]: https://cloud.google.com/run/docs/container-contract#jobs-env-vars - GCPCloudRunJobTaskIndexKey = attribute.Key("gcp.cloud_run.job.task_index") - - // GCPGCEInstanceHostnameKey is the attribute Key conforming to the - // "gcp.gce.instance.hostname" semantic conventions. It represents the hostname - // of a GCE instance. This is the full value of the default or [custom hostname] - // . - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "my-host1234.example.com", - // "sample-vm.us-west1-b.c.my-project.internal" - // - // [custom hostname]: https://cloud.google.com/compute/docs/instances/custom-hostname-vm - GCPGCEInstanceHostnameKey = attribute.Key("gcp.gce.instance.hostname") - - // GCPGCEInstanceNameKey is the attribute Key conforming to the - // "gcp.gce.instance.name" semantic conventions. It represents the instance name - // of a GCE instance. This is the value provided by `host.name`, the visible - // name of the instance in the Cloud Console UI, and the prefix for the default - // hostname of the instance as defined by the [default internal DNS name]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "instance-1", "my-vm-name" - // - // [default internal DNS name]: https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names - GCPGCEInstanceNameKey = attribute.Key("gcp.gce.instance.name") -) - -// GCPAppHubApplicationContainer returns an attribute KeyValue conforming to the -// "gcp.apphub.application.container" semantic conventions. It represents the -// container within GCP where the AppHub application is defined. -func GCPAppHubApplicationContainer(val string) attribute.KeyValue { - return GCPAppHubApplicationContainerKey.String(val) -} - -// GCPAppHubApplicationID returns an attribute KeyValue conforming to the -// "gcp.apphub.application.id" semantic conventions. It represents the name of -// the application as configured in AppHub. -func GCPAppHubApplicationID(val string) attribute.KeyValue { - return GCPAppHubApplicationIDKey.String(val) -} - -// GCPAppHubApplicationLocation returns an attribute KeyValue conforming to the -// "gcp.apphub.application.location" semantic conventions. It represents the GCP -// zone or region where the application is defined. -func GCPAppHubApplicationLocation(val string) attribute.KeyValue { - return GCPAppHubApplicationLocationKey.String(val) -} - -// GCPAppHubServiceID returns an attribute KeyValue conforming to the -// "gcp.apphub.service.id" semantic conventions. It represents the name of the -// service as configured in AppHub. -func GCPAppHubServiceID(val string) attribute.KeyValue { - return GCPAppHubServiceIDKey.String(val) -} - -// GCPAppHubWorkloadID returns an attribute KeyValue conforming to the -// "gcp.apphub.workload.id" semantic conventions. It represents the name of the -// workload as configured in AppHub. -func GCPAppHubWorkloadID(val string) attribute.KeyValue { - return GCPAppHubWorkloadIDKey.String(val) -} - -// GCPAppHubDestinationApplicationContainer returns an attribute KeyValue -// conforming to the "gcp.apphub_destination.application.container" semantic -// conventions. It represents the container within GCP where the AppHub -// destination application is defined. -func GCPAppHubDestinationApplicationContainer(val string) attribute.KeyValue { - return GCPAppHubDestinationApplicationContainerKey.String(val) -} - -// GCPAppHubDestinationApplicationID returns an attribute KeyValue conforming to -// the "gcp.apphub_destination.application.id" semantic conventions. It -// represents the name of the destination application as configured in AppHub. -func GCPAppHubDestinationApplicationID(val string) attribute.KeyValue { - return GCPAppHubDestinationApplicationIDKey.String(val) -} - -// GCPAppHubDestinationApplicationLocation returns an attribute KeyValue -// conforming to the "gcp.apphub_destination.application.location" semantic -// conventions. It represents the GCP zone or region where the destination -// application is defined. -func GCPAppHubDestinationApplicationLocation(val string) attribute.KeyValue { - return GCPAppHubDestinationApplicationLocationKey.String(val) -} - -// GCPAppHubDestinationServiceID returns an attribute KeyValue conforming to the -// "gcp.apphub_destination.service.id" semantic conventions. It represents the -// name of the destination service as configured in AppHub. -func GCPAppHubDestinationServiceID(val string) attribute.KeyValue { - return GCPAppHubDestinationServiceIDKey.String(val) -} - -// GCPAppHubDestinationWorkloadID returns an attribute KeyValue conforming to the -// "gcp.apphub_destination.workload.id" semantic conventions. It represents the -// name of the destination workload as configured in AppHub. -func GCPAppHubDestinationWorkloadID(val string) attribute.KeyValue { - return GCPAppHubDestinationWorkloadIDKey.String(val) -} - -// GCPClientService returns an attribute KeyValue conforming to the -// "gcp.client.service" semantic conventions. It represents the identifies the -// Google Cloud service for which the official client library is intended. -func GCPClientService(val string) attribute.KeyValue { - return GCPClientServiceKey.String(val) -} - -// GCPCloudRunJobExecution returns an attribute KeyValue conforming to the -// "gcp.cloud_run.job.execution" semantic conventions. It represents the name of -// the Cloud Run [execution] being run for the Job, as set by the -// [`CLOUD_RUN_EXECUTION`] environment variable. -// -// [execution]: https://cloud.google.com/run/docs/managing/job-executions -// [`CLOUD_RUN_EXECUTION`]: https://cloud.google.com/run/docs/container-contract#jobs-env-vars -func GCPCloudRunJobExecution(val string) attribute.KeyValue { - return GCPCloudRunJobExecutionKey.String(val) -} - -// GCPCloudRunJobTaskIndex returns an attribute KeyValue conforming to the -// "gcp.cloud_run.job.task_index" semantic conventions. It represents the index -// for a task within an execution as provided by the [`CLOUD_RUN_TASK_INDEX`] -// environment variable. -// -// [`CLOUD_RUN_TASK_INDEX`]: https://cloud.google.com/run/docs/container-contract#jobs-env-vars -func GCPCloudRunJobTaskIndex(val int) attribute.KeyValue { - return GCPCloudRunJobTaskIndexKey.Int(val) -} - -// GCPGCEInstanceHostname returns an attribute KeyValue conforming to the -// "gcp.gce.instance.hostname" semantic conventions. It represents the hostname -// of a GCE instance. This is the full value of the default or [custom hostname] -// . -// -// [custom hostname]: https://cloud.google.com/compute/docs/instances/custom-hostname-vm -func GCPGCEInstanceHostname(val string) attribute.KeyValue { - return GCPGCEInstanceHostnameKey.String(val) -} - -// GCPGCEInstanceName returns an attribute KeyValue conforming to the -// "gcp.gce.instance.name" semantic conventions. It represents the instance name -// of a GCE instance. This is the value provided by `host.name`, the visible name -// of the instance in the Cloud Console UI, and the prefix for the default -// hostname of the instance as defined by the [default internal DNS name]. -// -// [default internal DNS name]: https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names -func GCPGCEInstanceName(val string) attribute.KeyValue { - return GCPGCEInstanceNameKey.String(val) -} - -// Enum values for gcp.apphub.service.criticality_type -var ( - // Mission critical service. - // Stability: development - GCPAppHubServiceCriticalityTypeMissionCritical = GCPAppHubServiceCriticalityTypeKey.String("MISSION_CRITICAL") - // High impact. - // Stability: development - GCPAppHubServiceCriticalityTypeHigh = GCPAppHubServiceCriticalityTypeKey.String("HIGH") - // Medium impact. - // Stability: development - GCPAppHubServiceCriticalityTypeMedium = GCPAppHubServiceCriticalityTypeKey.String("MEDIUM") - // Low impact. - // Stability: development - GCPAppHubServiceCriticalityTypeLow = GCPAppHubServiceCriticalityTypeKey.String("LOW") -) - -// Enum values for gcp.apphub.service.environment_type -var ( - // Production environment. - // Stability: development - GCPAppHubServiceEnvironmentTypeProduction = GCPAppHubServiceEnvironmentTypeKey.String("PRODUCTION") - // Staging environment. - // Stability: development - GCPAppHubServiceEnvironmentTypeStaging = GCPAppHubServiceEnvironmentTypeKey.String("STAGING") - // Test environment. - // Stability: development - GCPAppHubServiceEnvironmentTypeTest = GCPAppHubServiceEnvironmentTypeKey.String("TEST") - // Development environment. - // Stability: development - GCPAppHubServiceEnvironmentTypeDevelopment = GCPAppHubServiceEnvironmentTypeKey.String("DEVELOPMENT") -) - -// Enum values for gcp.apphub.workload.criticality_type -var ( - // Mission critical service. - // Stability: development - GCPAppHubWorkloadCriticalityTypeMissionCritical = GCPAppHubWorkloadCriticalityTypeKey.String("MISSION_CRITICAL") - // High impact. - // Stability: development - GCPAppHubWorkloadCriticalityTypeHigh = GCPAppHubWorkloadCriticalityTypeKey.String("HIGH") - // Medium impact. - // Stability: development - GCPAppHubWorkloadCriticalityTypeMedium = GCPAppHubWorkloadCriticalityTypeKey.String("MEDIUM") - // Low impact. - // Stability: development - GCPAppHubWorkloadCriticalityTypeLow = GCPAppHubWorkloadCriticalityTypeKey.String("LOW") -) - -// Enum values for gcp.apphub.workload.environment_type -var ( - // Production environment. - // Stability: development - GCPAppHubWorkloadEnvironmentTypeProduction = GCPAppHubWorkloadEnvironmentTypeKey.String("PRODUCTION") - // Staging environment. - // Stability: development - GCPAppHubWorkloadEnvironmentTypeStaging = GCPAppHubWorkloadEnvironmentTypeKey.String("STAGING") - // Test environment. - // Stability: development - GCPAppHubWorkloadEnvironmentTypeTest = GCPAppHubWorkloadEnvironmentTypeKey.String("TEST") - // Development environment. - // Stability: development - GCPAppHubWorkloadEnvironmentTypeDevelopment = GCPAppHubWorkloadEnvironmentTypeKey.String("DEVELOPMENT") -) - -// Enum values for gcp.apphub_destination.service.criticality_type -var ( - // Mission critical service. - // Stability: development - GCPAppHubDestinationServiceCriticalityTypeMissionCritical = GCPAppHubDestinationServiceCriticalityTypeKey.String("MISSION_CRITICAL") - // High impact. - // Stability: development - GCPAppHubDestinationServiceCriticalityTypeHigh = GCPAppHubDestinationServiceCriticalityTypeKey.String("HIGH") - // Medium impact. - // Stability: development - GCPAppHubDestinationServiceCriticalityTypeMedium = GCPAppHubDestinationServiceCriticalityTypeKey.String("MEDIUM") - // Low impact. - // Stability: development - GCPAppHubDestinationServiceCriticalityTypeLow = GCPAppHubDestinationServiceCriticalityTypeKey.String("LOW") -) - -// Enum values for gcp.apphub_destination.service.environment_type -var ( - // Production environment. - // Stability: development - GCPAppHubDestinationServiceEnvironmentTypeProduction = GCPAppHubDestinationServiceEnvironmentTypeKey.String("PRODUCTION") - // Staging environment. - // Stability: development - GCPAppHubDestinationServiceEnvironmentTypeStaging = GCPAppHubDestinationServiceEnvironmentTypeKey.String("STAGING") - // Test environment. - // Stability: development - GCPAppHubDestinationServiceEnvironmentTypeTest = GCPAppHubDestinationServiceEnvironmentTypeKey.String("TEST") - // Development environment. - // Stability: development - GCPAppHubDestinationServiceEnvironmentTypeDevelopment = GCPAppHubDestinationServiceEnvironmentTypeKey.String("DEVELOPMENT") -) - -// Enum values for gcp.apphub_destination.workload.criticality_type -var ( - // Mission critical service. - // Stability: development - GCPAppHubDestinationWorkloadCriticalityTypeMissionCritical = GCPAppHubDestinationWorkloadCriticalityTypeKey.String("MISSION_CRITICAL") - // High impact. - // Stability: development - GCPAppHubDestinationWorkloadCriticalityTypeHigh = GCPAppHubDestinationWorkloadCriticalityTypeKey.String("HIGH") - // Medium impact. - // Stability: development - GCPAppHubDestinationWorkloadCriticalityTypeMedium = GCPAppHubDestinationWorkloadCriticalityTypeKey.String("MEDIUM") - // Low impact. - // Stability: development - GCPAppHubDestinationWorkloadCriticalityTypeLow = GCPAppHubDestinationWorkloadCriticalityTypeKey.String("LOW") -) - -// Enum values for gcp.apphub_destination.workload.environment_type -var ( - // Production environment. - // Stability: development - GCPAppHubDestinationWorkloadEnvironmentTypeProduction = GCPAppHubDestinationWorkloadEnvironmentTypeKey.String("PRODUCTION") - // Staging environment. - // Stability: development - GCPAppHubDestinationWorkloadEnvironmentTypeStaging = GCPAppHubDestinationWorkloadEnvironmentTypeKey.String("STAGING") - // Test environment. - // Stability: development - GCPAppHubDestinationWorkloadEnvironmentTypeTest = GCPAppHubDestinationWorkloadEnvironmentTypeKey.String("TEST") - // Development environment. - // Stability: development - GCPAppHubDestinationWorkloadEnvironmentTypeDevelopment = GCPAppHubDestinationWorkloadEnvironmentTypeKey.String("DEVELOPMENT") -) - -// Namespace: gen_ai -const ( - // GenAIAgentDescriptionKey is the attribute Key conforming to the - // "gen_ai.agent.description" semantic conventions. It represents the free-form - // description of the GenAI agent provided by the application. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Helps with math problems", "Generates fiction stories" - GenAIAgentDescriptionKey = attribute.Key("gen_ai.agent.description") - - // GenAIAgentIDKey is the attribute Key conforming to the "gen_ai.agent.id" - // semantic conventions. It represents the unique identifier of the GenAI agent. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "asst_5j66UpCpwteGg4YSxUnt7lPY" - GenAIAgentIDKey = attribute.Key("gen_ai.agent.id") - - // GenAIAgentNameKey is the attribute Key conforming to the "gen_ai.agent.name" - // semantic conventions. It represents the human-readable name of the GenAI - // agent provided by the application. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Math Tutor", "Fiction Writer" - GenAIAgentNameKey = attribute.Key("gen_ai.agent.name") - - // GenAIConversationIDKey is the attribute Key conforming to the - // "gen_ai.conversation.id" semantic conventions. It represents the unique - // identifier for a conversation (session, thread), used to store and correlate - // messages within this conversation. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "conv_5j66UpCpwteGg4YSxUnt7lPY" - GenAIConversationIDKey = attribute.Key("gen_ai.conversation.id") - - // GenAIDataSourceIDKey is the attribute Key conforming to the - // "gen_ai.data_source.id" semantic conventions. It represents the data source - // identifier. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "H7STPQYOND" - // Note: Data sources are used by AI agents and RAG applications to store - // grounding data. A data source may be an external database, object store, - // document collection, website, or any other storage system used by the GenAI - // agent or application. The `gen_ai.data_source.id` SHOULD match the identifier - // used by the GenAI system rather than a name specific to the external storage, - // such as a database or object store. Semantic conventions referencing - // `gen_ai.data_source.id` MAY also leverage additional attributes, such as - // `db.*`, to further identify and describe the data source. - GenAIDataSourceIDKey = attribute.Key("gen_ai.data_source.id") - - // GenAIEmbeddingsDimensionCountKey is the attribute Key conforming to the - // "gen_ai.embeddings.dimension.count" semantic conventions. It represents the - // number of dimensions the resulting output embeddings should have. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 512, 1024 - GenAIEmbeddingsDimensionCountKey = attribute.Key("gen_ai.embeddings.dimension.count") - - // GenAIEvaluationExplanationKey is the attribute Key conforming to the - // "gen_ai.evaluation.explanation" semantic conventions. It represents a - // free-form explanation for the assigned score provided by the evaluator. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "The response is factually accurate but lacks sufficient detail to - // fully address the question." - GenAIEvaluationExplanationKey = attribute.Key("gen_ai.evaluation.explanation") - - // GenAIEvaluationNameKey is the attribute Key conforming to the - // "gen_ai.evaluation.name" semantic conventions. It represents the name of the - // evaluation metric used for the GenAI response. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Relevance", "IntentResolution" - GenAIEvaluationNameKey = attribute.Key("gen_ai.evaluation.name") - - // GenAIEvaluationScoreLabelKey is the attribute Key conforming to the - // "gen_ai.evaluation.score.label" semantic conventions. It represents the human - // readable label for evaluation. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "relevant", "not_relevant", "correct", "incorrect", "pass", "fail" - // Note: This attribute provides a human-readable interpretation of the - // evaluation score produced by an evaluator. For example, a score value of 1 - // could mean "relevant" in one evaluation system and "not relevant" in another, - // depending on the scoring range and evaluator. The label SHOULD have low - // cardinality. Possible values depend on the evaluation metric and evaluator - // used; implementations SHOULD document the possible values. - GenAIEvaluationScoreLabelKey = attribute.Key("gen_ai.evaluation.score.label") - - // GenAIEvaluationScoreValueKey is the attribute Key conforming to the - // "gen_ai.evaluation.score.value" semantic conventions. It represents the - // evaluation score returned by the evaluator. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 4.0 - GenAIEvaluationScoreValueKey = attribute.Key("gen_ai.evaluation.score.value") - - // GenAIInputMessagesKey is the attribute Key conforming to the - // "gen_ai.input.messages" semantic conventions. It represents the chat history - // provided to the model as an input. - // - // Type: any - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "[\n {\n "role": "user",\n "parts": [\n {\n "type": "text",\n - // "content": "Weather in Paris?"\n }\n ]\n },\n {\n "role": "assistant",\n - // "parts": [\n {\n "type": "tool_call",\n "id": - // "call_VSPygqKTWdrhaFErNvMV18Yl",\n "name": "get_weather",\n "arguments": {\n - // "location": "Paris"\n }\n }\n ]\n },\n {\n "role": "tool",\n "parts": [\n {\n - // "type": "tool_call_response",\n "id": " call_VSPygqKTWdrhaFErNvMV18Yl",\n - // "result": "rainy, 57°F"\n }\n ]\n }\n]\n" - // Note: Instrumentations MUST follow [Input messages JSON schema]. - // When the attribute is recorded on events, it MUST be recorded in structured - // form. When recorded on spans, it MAY be recorded as a JSON string if - // structured - // format is not supported and SHOULD be recorded in structured form otherwise. - // - // Messages MUST be provided in the order they were sent to the model. - // Instrumentations MAY provide a way for users to filter or truncate - // input messages. - // - // > [!Warning] - // > This attribute is likely to contain sensitive information including - // > user/PII data. - // - // See [Recording content on attributes] - // section for more details. - // - // [Input messages JSON schema]: /docs/gen-ai/gen-ai-input-messages.json - // [Recording content on attributes]: /docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes - GenAIInputMessagesKey = attribute.Key("gen_ai.input.messages") - - // GenAIOperationNameKey is the attribute Key conforming to the - // "gen_ai.operation.name" semantic conventions. It represents the name of the - // operation being performed. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: If one of the predefined values applies, but specific system uses a - // different name it's RECOMMENDED to document it in the semantic conventions - // for specific GenAI system and use system-specific name in the - // instrumentation. If a different name is not documented, instrumentation - // libraries SHOULD use applicable predefined value. - GenAIOperationNameKey = attribute.Key("gen_ai.operation.name") - - // GenAIOutputMessagesKey is the attribute Key conforming to the - // "gen_ai.output.messages" semantic conventions. It represents the messages - // returned by the model where each message represents a specific model response - // (choice, candidate). - // - // Type: any - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "[\n {\n "role": "assistant",\n "parts": [\n {\n "type": "text",\n - // "content": "The weather in Paris is currently rainy with a temperature of - // 57°F."\n }\n ],\n "finish_reason": "stop"\n }\n]\n" - // Note: Instrumentations MUST follow [Output messages JSON schema] - // - // Each message represents a single output choice/candidate generated by - // the model. Each message corresponds to exactly one generation - // (choice/candidate) and vice versa - one choice cannot be split across - // multiple messages or one message cannot contain parts from multiple choices. - // - // When the attribute is recorded on events, it MUST be recorded in structured - // form. When recorded on spans, it MAY be recorded as a JSON string if - // structured - // format is not supported and SHOULD be recorded in structured form otherwise. - // - // Instrumentations MAY provide a way for users to filter or truncate - // output messages. - // - // > [!Warning] - // > This attribute is likely to contain sensitive information including - // > user/PII data. - // - // See [Recording content on attributes] - // section for more details. - // - // [Output messages JSON schema]: /docs/gen-ai/gen-ai-output-messages.json - // [Recording content on attributes]: /docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes - GenAIOutputMessagesKey = attribute.Key("gen_ai.output.messages") - - // GenAIOutputTypeKey is the attribute Key conforming to the - // "gen_ai.output.type" semantic conventions. It represents the represents the - // content type requested by the client. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: This attribute SHOULD be used when the client requests output of a - // specific type. The model may return zero or more outputs of this type. - // This attribute specifies the output modality and not the actual output - // format. For example, if an image is requested, the actual output could be a - // URL pointing to an image file. - // Additional output format details may be recorded in the future in the - // `gen_ai.output.{type}.*` attributes. - GenAIOutputTypeKey = attribute.Key("gen_ai.output.type") - - // GenAIPromptNameKey is the attribute Key conforming to the - // "gen_ai.prompt.name" semantic conventions. It represents the name of the - // prompt that uniquely identifies it. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "analyze-code" - GenAIPromptNameKey = attribute.Key("gen_ai.prompt.name") - - // GenAIProviderNameKey is the attribute Key conforming to the - // "gen_ai.provider.name" semantic conventions. It represents the Generative AI - // provider as identified by the client or server instrumentation. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: The attribute SHOULD be set based on the instrumentation's best - // knowledge and may differ from the actual model provider. - // - // Multiple providers, including Azure OpenAI, Gemini, and AI hosting platforms - // are accessible using the OpenAI REST API and corresponding client libraries, - // but may proxy or host models from different providers. - // - // The `gen_ai.request.model`, `gen_ai.response.model`, and `server.address` - // attributes may help identify the actual system in use. - // - // The `gen_ai.provider.name` attribute acts as a discriminator that - // identifies the GenAI telemetry format flavor specific to that provider - // within GenAI semantic conventions. - // It SHOULD be set consistently with provider-specific attributes and signals. - // For example, GenAI spans, metrics, and events related to AWS Bedrock - // should have the `gen_ai.provider.name` set to `aws.bedrock` and include - // applicable `aws.bedrock.*` attributes and are not expected to include - // `openai.*` attributes. - GenAIProviderNameKey = attribute.Key("gen_ai.provider.name") - - // GenAIRequestChoiceCountKey is the attribute Key conforming to the - // "gen_ai.request.choice.count" semantic conventions. It represents the target - // number of candidate completions to return. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 3 - GenAIRequestChoiceCountKey = attribute.Key("gen_ai.request.choice.count") - - // GenAIRequestEncodingFormatsKey is the attribute Key conforming to the - // "gen_ai.request.encoding_formats" semantic conventions. It represents the - // encoding formats requested in an embeddings operation, if specified. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "base64"], ["float", "binary" - // Note: In some GenAI systems the encoding formats are called embedding types. - // Also, some GenAI systems only accept a single format per request. - GenAIRequestEncodingFormatsKey = attribute.Key("gen_ai.request.encoding_formats") - - // GenAIRequestFrequencyPenaltyKey is the attribute Key conforming to the - // "gen_ai.request.frequency_penalty" semantic conventions. It represents the - // frequency penalty setting for the GenAI request. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 0.1 - GenAIRequestFrequencyPenaltyKey = attribute.Key("gen_ai.request.frequency_penalty") - - // GenAIRequestMaxTokensKey is the attribute Key conforming to the - // "gen_ai.request.max_tokens" semantic conventions. It represents the maximum - // number of tokens the model generates for a request. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 100 - GenAIRequestMaxTokensKey = attribute.Key("gen_ai.request.max_tokens") - - // GenAIRequestModelKey is the attribute Key conforming to the - // "gen_ai.request.model" semantic conventions. It represents the name of the - // GenAI model a request is being made to. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: gpt-4 - GenAIRequestModelKey = attribute.Key("gen_ai.request.model") - - // GenAIRequestPresencePenaltyKey is the attribute Key conforming to the - // "gen_ai.request.presence_penalty" semantic conventions. It represents the - // presence penalty setting for the GenAI request. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 0.1 - GenAIRequestPresencePenaltyKey = attribute.Key("gen_ai.request.presence_penalty") - - // GenAIRequestSeedKey is the attribute Key conforming to the - // "gen_ai.request.seed" semantic conventions. It represents the requests with - // same seed value more likely to return same result. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 100 - GenAIRequestSeedKey = attribute.Key("gen_ai.request.seed") - - // GenAIRequestStopSequencesKey is the attribute Key conforming to the - // "gen_ai.request.stop_sequences" semantic conventions. It represents the list - // of sequences that the model will use to stop generating further tokens. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "forest", "lived" - GenAIRequestStopSequencesKey = attribute.Key("gen_ai.request.stop_sequences") - - // GenAIRequestTemperatureKey is the attribute Key conforming to the - // "gen_ai.request.temperature" semantic conventions. It represents the - // temperature setting for the GenAI request. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 0.0 - GenAIRequestTemperatureKey = attribute.Key("gen_ai.request.temperature") - - // GenAIRequestTopKKey is the attribute Key conforming to the - // "gen_ai.request.top_k" semantic conventions. It represents the top_k sampling - // setting for the GenAI request. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 1.0 - GenAIRequestTopKKey = attribute.Key("gen_ai.request.top_k") - - // GenAIRequestTopPKey is the attribute Key conforming to the - // "gen_ai.request.top_p" semantic conventions. It represents the top_p sampling - // setting for the GenAI request. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 1.0 - GenAIRequestTopPKey = attribute.Key("gen_ai.request.top_p") - - // GenAIResponseFinishReasonsKey is the attribute Key conforming to the - // "gen_ai.response.finish_reasons" semantic conventions. It represents the - // array of reasons the model stopped generating tokens, corresponding to each - // generation received. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "stop"], ["stop", "length" - GenAIResponseFinishReasonsKey = attribute.Key("gen_ai.response.finish_reasons") - - // GenAIResponseIDKey is the attribute Key conforming to the - // "gen_ai.response.id" semantic conventions. It represents the unique - // identifier for the completion. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "chatcmpl-123" - GenAIResponseIDKey = attribute.Key("gen_ai.response.id") - - // GenAIResponseModelKey is the attribute Key conforming to the - // "gen_ai.response.model" semantic conventions. It represents the name of the - // model that generated the response. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "gpt-4-0613" - GenAIResponseModelKey = attribute.Key("gen_ai.response.model") - - // GenAISystemInstructionsKey is the attribute Key conforming to the - // "gen_ai.system_instructions" semantic conventions. It represents the system - // message or instructions provided to the GenAI model separately from the chat - // history. - // - // Type: any - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "[\n {\n "type": "text",\n "content": "You are an Agent that greet - // users, always use greetings tool to respond"\n }\n]\n", "[\n {\n "type": - // "text",\n "content": "You are a language translator."\n },\n {\n "type": - // "text",\n "content": "Your mission is to translate text in English to - // French."\n }\n]\n" - // Note: This attribute SHOULD be used when the corresponding provider or API - // allows to provide system instructions or messages separately from the - // chat history. - // - // Instructions that are part of the chat history SHOULD be recorded in - // `gen_ai.input.messages` attribute instead. - // - // Instrumentations MUST follow [System instructions JSON schema]. - // - // When recorded on spans, it MAY be recorded as a JSON string if structured - // format is not supported and SHOULD be recorded in structured form otherwise. - // - // Instrumentations MAY provide a way for users to filter or truncate - // system instructions. - // - // > [!Warning] - // > This attribute may contain sensitive information. - // - // See [Recording content on attributes] - // section for more details. - // - // [System instructions JSON schema]: /docs/gen-ai/gen-ai-system-instructions.json - // [Recording content on attributes]: /docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes - GenAISystemInstructionsKey = attribute.Key("gen_ai.system_instructions") - - // GenAITokenTypeKey is the attribute Key conforming to the "gen_ai.token.type" - // semantic conventions. It represents the type of token being counted. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "input", "output" - GenAITokenTypeKey = attribute.Key("gen_ai.token.type") - - // GenAIToolCallArgumentsKey is the attribute Key conforming to the - // "gen_ai.tool.call.arguments" semantic conventions. It represents the - // parameters passed to the tool call. - // - // Type: any - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "{\n "location": "San Francisco?",\n "date": "2025-10-01"\n}\n" - // Note: > [!WARNING] - // - // > This attribute may contain sensitive information. - // - // It's expected to be an object - in case a serialized string is available - // to the instrumentation, the instrumentation SHOULD do the best effort to - // deserialize it to an object. When recorded on spans, it MAY be recorded as a - // JSON string if structured format is not supported and SHOULD be recorded in - // structured form otherwise. - GenAIToolCallArgumentsKey = attribute.Key("gen_ai.tool.call.arguments") - - // GenAIToolCallIDKey is the attribute Key conforming to the - // "gen_ai.tool.call.id" semantic conventions. It represents the tool call - // identifier. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "call_mszuSIzqtI65i1wAUOE8w5H4" - GenAIToolCallIDKey = attribute.Key("gen_ai.tool.call.id") - - // GenAIToolCallResultKey is the attribute Key conforming to the - // "gen_ai.tool.call.result" semantic conventions. It represents the result - // returned by the tool call (if any and if execution was successful). - // - // Type: any - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "{\n "temperature_range": {\n "high": 75,\n "low": 60\n },\n - // "conditions": "sunny"\n}\n" - // Note: > [!WARNING] - // - // > This attribute may contain sensitive information. - // - // It's expected to be an object - in case a serialized string is available - // to the instrumentation, the instrumentation SHOULD do the best effort to - // deserialize it to an object. When recorded on spans, it MAY be recorded as a - // JSON string if structured format is not supported and SHOULD be recorded in - // structured form otherwise. - GenAIToolCallResultKey = attribute.Key("gen_ai.tool.call.result") - - // GenAIToolDefinitionsKey is the attribute Key conforming to the - // "gen_ai.tool.definitions" semantic conventions. It represents the list of - // source system tool definitions available to the GenAI agent or model. - // - // Type: any - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "[\n {\n "type": "function",\n "name": "get_current_weather",\n - // "description": "Get the current weather in a given location",\n "parameters": - // {\n "type": "object",\n "properties": {\n "location": {\n "type": "string",\n - // "description": "The city and state, e.g. San Francisco, CA"\n },\n "unit": - // {\n "type": "string",\n "enum": [\n "celsius",\n "fahrenheit"\n ]\n }\n },\n - // "required": [\n "location",\n "unit"\n ]\n }\n }\n]\n" - // Note: The value of this attribute matches source system tool definition - // format. - // - // It's expected to be an array of objects where each object represents a tool - // definition. In case a serialized string is available - // to the instrumentation, the instrumentation SHOULD do the best effort to - // deserialize it to an array. When recorded on spans, it MAY be recorded as a - // JSON string if structured format is not supported and SHOULD be recorded in - // structured form otherwise. - // - // Since this attribute could be large, it's NOT RECOMMENDED to populate - // it by default. Instrumentations MAY provide a way to enable - // populating this attribute. - GenAIToolDefinitionsKey = attribute.Key("gen_ai.tool.definitions") - - // GenAIToolDescriptionKey is the attribute Key conforming to the - // "gen_ai.tool.description" semantic conventions. It represents the tool - // description. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Multiply two numbers" - GenAIToolDescriptionKey = attribute.Key("gen_ai.tool.description") - - // GenAIToolNameKey is the attribute Key conforming to the "gen_ai.tool.name" - // semantic conventions. It represents the name of the tool utilized by the - // agent. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Flights" - GenAIToolNameKey = attribute.Key("gen_ai.tool.name") - - // GenAIToolTypeKey is the attribute Key conforming to the "gen_ai.tool.type" - // semantic conventions. It represents the type of the tool utilized by the - // agent. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "function", "extension", "datastore" - // Note: Extension: A tool executed on the agent-side to directly call external - // APIs, bridging the gap between the agent and real-world systems. - // Agent-side operations involve actions that are performed by the agent on the - // server or within the agent's controlled environment. - // Function: A tool executed on the client-side, where the agent generates - // parameters for a predefined function, and the client executes the logic. - // Client-side operations are actions taken on the user's end or within the - // client application. - // Datastore: A tool used by the agent to access and query structured or - // unstructured external data for retrieval-augmented tasks or knowledge - // updates. - GenAIToolTypeKey = attribute.Key("gen_ai.tool.type") - - // GenAIUsageInputTokensKey is the attribute Key conforming to the - // "gen_ai.usage.input_tokens" semantic conventions. It represents the number of - // tokens used in the GenAI input (prompt). - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 100 - GenAIUsageInputTokensKey = attribute.Key("gen_ai.usage.input_tokens") - - // GenAIUsageOutputTokensKey is the attribute Key conforming to the - // "gen_ai.usage.output_tokens" semantic conventions. It represents the number - // of tokens used in the GenAI response (completion). - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 180 - GenAIUsageOutputTokensKey = attribute.Key("gen_ai.usage.output_tokens") -) - -// GenAIAgentDescription returns an attribute KeyValue conforming to the -// "gen_ai.agent.description" semantic conventions. It represents the free-form -// description of the GenAI agent provided by the application. -func GenAIAgentDescription(val string) attribute.KeyValue { - return GenAIAgentDescriptionKey.String(val) -} - -// GenAIAgentID returns an attribute KeyValue conforming to the "gen_ai.agent.id" -// semantic conventions. It represents the unique identifier of the GenAI agent. -func GenAIAgentID(val string) attribute.KeyValue { - return GenAIAgentIDKey.String(val) -} - -// GenAIAgentName returns an attribute KeyValue conforming to the -// "gen_ai.agent.name" semantic conventions. It represents the human-readable -// name of the GenAI agent provided by the application. -func GenAIAgentName(val string) attribute.KeyValue { - return GenAIAgentNameKey.String(val) -} - -// GenAIConversationID returns an attribute KeyValue conforming to the -// "gen_ai.conversation.id" semantic conventions. It represents the unique -// identifier for a conversation (session, thread), used to store and correlate -// messages within this conversation. -func GenAIConversationID(val string) attribute.KeyValue { - return GenAIConversationIDKey.String(val) -} - -// GenAIDataSourceID returns an attribute KeyValue conforming to the -// "gen_ai.data_source.id" semantic conventions. It represents the data source -// identifier. -func GenAIDataSourceID(val string) attribute.KeyValue { - return GenAIDataSourceIDKey.String(val) -} - -// GenAIEmbeddingsDimensionCount returns an attribute KeyValue conforming to the -// "gen_ai.embeddings.dimension.count" semantic conventions. It represents the -// number of dimensions the resulting output embeddings should have. -func GenAIEmbeddingsDimensionCount(val int) attribute.KeyValue { - return GenAIEmbeddingsDimensionCountKey.Int(val) -} - -// GenAIEvaluationExplanation returns an attribute KeyValue conforming to the -// "gen_ai.evaluation.explanation" semantic conventions. It represents a -// free-form explanation for the assigned score provided by the evaluator. -func GenAIEvaluationExplanation(val string) attribute.KeyValue { - return GenAIEvaluationExplanationKey.String(val) -} - -// GenAIEvaluationName returns an attribute KeyValue conforming to the -// "gen_ai.evaluation.name" semantic conventions. It represents the name of the -// evaluation metric used for the GenAI response. -func GenAIEvaluationName(val string) attribute.KeyValue { - return GenAIEvaluationNameKey.String(val) -} - -// GenAIEvaluationScoreLabel returns an attribute KeyValue conforming to the -// "gen_ai.evaluation.score.label" semantic conventions. It represents the human -// readable label for evaluation. -func GenAIEvaluationScoreLabel(val string) attribute.KeyValue { - return GenAIEvaluationScoreLabelKey.String(val) -} - -// GenAIEvaluationScoreValue returns an attribute KeyValue conforming to the -// "gen_ai.evaluation.score.value" semantic conventions. It represents the -// evaluation score returned by the evaluator. -func GenAIEvaluationScoreValue(val float64) attribute.KeyValue { - return GenAIEvaluationScoreValueKey.Float64(val) -} - -// GenAIPromptName returns an attribute KeyValue conforming to the -// "gen_ai.prompt.name" semantic conventions. It represents the name of the -// prompt that uniquely identifies it. -func GenAIPromptName(val string) attribute.KeyValue { - return GenAIPromptNameKey.String(val) -} - -// GenAIRequestChoiceCount returns an attribute KeyValue conforming to the -// "gen_ai.request.choice.count" semantic conventions. It represents the target -// number of candidate completions to return. -func GenAIRequestChoiceCount(val int) attribute.KeyValue { - return GenAIRequestChoiceCountKey.Int(val) -} - -// GenAIRequestEncodingFormats returns an attribute KeyValue conforming to the -// "gen_ai.request.encoding_formats" semantic conventions. It represents the -// encoding formats requested in an embeddings operation, if specified. -func GenAIRequestEncodingFormats(val ...string) attribute.KeyValue { - return GenAIRequestEncodingFormatsKey.StringSlice(val) -} - -// GenAIRequestFrequencyPenalty returns an attribute KeyValue conforming to the -// "gen_ai.request.frequency_penalty" semantic conventions. It represents the -// frequency penalty setting for the GenAI request. -func GenAIRequestFrequencyPenalty(val float64) attribute.KeyValue { - return GenAIRequestFrequencyPenaltyKey.Float64(val) -} - -// GenAIRequestMaxTokens returns an attribute KeyValue conforming to the -// "gen_ai.request.max_tokens" semantic conventions. It represents the maximum -// number of tokens the model generates for a request. -func GenAIRequestMaxTokens(val int) attribute.KeyValue { - return GenAIRequestMaxTokensKey.Int(val) -} - -// GenAIRequestModel returns an attribute KeyValue conforming to the -// "gen_ai.request.model" semantic conventions. It represents the name of the -// GenAI model a request is being made to. -func GenAIRequestModel(val string) attribute.KeyValue { - return GenAIRequestModelKey.String(val) -} - -// GenAIRequestPresencePenalty returns an attribute KeyValue conforming to the -// "gen_ai.request.presence_penalty" semantic conventions. It represents the -// presence penalty setting for the GenAI request. -func GenAIRequestPresencePenalty(val float64) attribute.KeyValue { - return GenAIRequestPresencePenaltyKey.Float64(val) -} - -// GenAIRequestSeed returns an attribute KeyValue conforming to the -// "gen_ai.request.seed" semantic conventions. It represents the requests with -// same seed value more likely to return same result. -func GenAIRequestSeed(val int) attribute.KeyValue { - return GenAIRequestSeedKey.Int(val) -} - -// GenAIRequestStopSequences returns an attribute KeyValue conforming to the -// "gen_ai.request.stop_sequences" semantic conventions. It represents the list -// of sequences that the model will use to stop generating further tokens. -func GenAIRequestStopSequences(val ...string) attribute.KeyValue { - return GenAIRequestStopSequencesKey.StringSlice(val) -} - -// GenAIRequestTemperature returns an attribute KeyValue conforming to the -// "gen_ai.request.temperature" semantic conventions. It represents the -// temperature setting for the GenAI request. -func GenAIRequestTemperature(val float64) attribute.KeyValue { - return GenAIRequestTemperatureKey.Float64(val) -} - -// GenAIRequestTopK returns an attribute KeyValue conforming to the -// "gen_ai.request.top_k" semantic conventions. It represents the top_k sampling -// setting for the GenAI request. -func GenAIRequestTopK(val float64) attribute.KeyValue { - return GenAIRequestTopKKey.Float64(val) -} - -// GenAIRequestTopP returns an attribute KeyValue conforming to the -// "gen_ai.request.top_p" semantic conventions. It represents the top_p sampling -// setting for the GenAI request. -func GenAIRequestTopP(val float64) attribute.KeyValue { - return GenAIRequestTopPKey.Float64(val) -} - -// GenAIResponseFinishReasons returns an attribute KeyValue conforming to the -// "gen_ai.response.finish_reasons" semantic conventions. It represents the array -// of reasons the model stopped generating tokens, corresponding to each -// generation received. -func GenAIResponseFinishReasons(val ...string) attribute.KeyValue { - return GenAIResponseFinishReasonsKey.StringSlice(val) -} - -// GenAIResponseID returns an attribute KeyValue conforming to the -// "gen_ai.response.id" semantic conventions. It represents the unique identifier -// for the completion. -func GenAIResponseID(val string) attribute.KeyValue { - return GenAIResponseIDKey.String(val) -} - -// GenAIResponseModel returns an attribute KeyValue conforming to the -// "gen_ai.response.model" semantic conventions. It represents the name of the -// model that generated the response. -func GenAIResponseModel(val string) attribute.KeyValue { - return GenAIResponseModelKey.String(val) -} - -// GenAIToolCallID returns an attribute KeyValue conforming to the -// "gen_ai.tool.call.id" semantic conventions. It represents the tool call -// identifier. -func GenAIToolCallID(val string) attribute.KeyValue { - return GenAIToolCallIDKey.String(val) -} - -// GenAIToolDescription returns an attribute KeyValue conforming to the -// "gen_ai.tool.description" semantic conventions. It represents the tool -// description. -func GenAIToolDescription(val string) attribute.KeyValue { - return GenAIToolDescriptionKey.String(val) -} - -// GenAIToolName returns an attribute KeyValue conforming to the -// "gen_ai.tool.name" semantic conventions. It represents the name of the tool -// utilized by the agent. -func GenAIToolName(val string) attribute.KeyValue { - return GenAIToolNameKey.String(val) -} - -// GenAIToolType returns an attribute KeyValue conforming to the -// "gen_ai.tool.type" semantic conventions. It represents the type of the tool -// utilized by the agent. -func GenAIToolType(val string) attribute.KeyValue { - return GenAIToolTypeKey.String(val) -} - -// GenAIUsageInputTokens returns an attribute KeyValue conforming to the -// "gen_ai.usage.input_tokens" semantic conventions. It represents the number of -// tokens used in the GenAI input (prompt). -func GenAIUsageInputTokens(val int) attribute.KeyValue { - return GenAIUsageInputTokensKey.Int(val) -} - -// GenAIUsageOutputTokens returns an attribute KeyValue conforming to the -// "gen_ai.usage.output_tokens" semantic conventions. It represents the number of -// tokens used in the GenAI response (completion). -func GenAIUsageOutputTokens(val int) attribute.KeyValue { - return GenAIUsageOutputTokensKey.Int(val) -} - -// Enum values for gen_ai.operation.name -var ( - // Chat completion operation such as [OpenAI Chat API] - // Stability: development - // - // [OpenAI Chat API]: https://platform.openai.com/docs/api-reference/chat - GenAIOperationNameChat = GenAIOperationNameKey.String("chat") - // Multimodal content generation operation such as [Gemini Generate Content] - // Stability: development - // - // [Gemini Generate Content]: https://ai.google.dev/api/generate-content - GenAIOperationNameGenerateContent = GenAIOperationNameKey.String("generate_content") - // Text completions operation such as [OpenAI Completions API (Legacy)] - // Stability: development - // - // [OpenAI Completions API (Legacy)]: https://platform.openai.com/docs/api-reference/completions - GenAIOperationNameTextCompletion = GenAIOperationNameKey.String("text_completion") - // Embeddings operation such as [OpenAI Create embeddings API] - // Stability: development - // - // [OpenAI Create embeddings API]: https://platform.openai.com/docs/api-reference/embeddings/create - GenAIOperationNameEmbeddings = GenAIOperationNameKey.String("embeddings") - // Create GenAI agent - // Stability: development - GenAIOperationNameCreateAgent = GenAIOperationNameKey.String("create_agent") - // Invoke GenAI agent - // Stability: development - GenAIOperationNameInvokeAgent = GenAIOperationNameKey.String("invoke_agent") - // Execute a tool - // Stability: development - GenAIOperationNameExecuteTool = GenAIOperationNameKey.String("execute_tool") -) - -// Enum values for gen_ai.output.type -var ( - // Plain text - // Stability: development - GenAIOutputTypeText = GenAIOutputTypeKey.String("text") - // JSON object with known or unknown schema - // Stability: development - GenAIOutputTypeJSON = GenAIOutputTypeKey.String("json") - // Image - // Stability: development - GenAIOutputTypeImage = GenAIOutputTypeKey.String("image") - // Speech - // Stability: development - GenAIOutputTypeSpeech = GenAIOutputTypeKey.String("speech") -) - -// Enum values for gen_ai.provider.name -var ( - // [OpenAI] - // Stability: development - // - // [OpenAI]: https://openai.com/ - GenAIProviderNameOpenAI = GenAIProviderNameKey.String("openai") - // Any Google generative AI endpoint - // Stability: development - GenAIProviderNameGCPGenAI = GenAIProviderNameKey.String("gcp.gen_ai") - // [Vertex AI] - // Stability: development - // - // [Vertex AI]: https://cloud.google.com/vertex-ai - GenAIProviderNameGCPVertexAI = GenAIProviderNameKey.String("gcp.vertex_ai") - // [Gemini] - // Stability: development - // - // [Gemini]: https://cloud.google.com/products/gemini - GenAIProviderNameGCPGemini = GenAIProviderNameKey.String("gcp.gemini") - // [Anthropic] - // Stability: development - // - // [Anthropic]: https://www.anthropic.com/ - GenAIProviderNameAnthropic = GenAIProviderNameKey.String("anthropic") - // [Cohere] - // Stability: development - // - // [Cohere]: https://cohere.com/ - GenAIProviderNameCohere = GenAIProviderNameKey.String("cohere") - // Azure AI Inference - // Stability: development - GenAIProviderNameAzureAIInference = GenAIProviderNameKey.String("azure.ai.inference") - // [Azure OpenAI] - // Stability: development - // - // [Azure OpenAI]: https://azure.microsoft.com/products/ai-services/openai-service/ - GenAIProviderNameAzureAIOpenAI = GenAIProviderNameKey.String("azure.ai.openai") - // [IBM Watsonx AI] - // Stability: development - // - // [IBM Watsonx AI]: https://www.ibm.com/products/watsonx-ai - GenAIProviderNameIBMWatsonxAI = GenAIProviderNameKey.String("ibm.watsonx.ai") - // [AWS Bedrock] - // Stability: development - // - // [AWS Bedrock]: https://aws.amazon.com/bedrock - GenAIProviderNameAWSBedrock = GenAIProviderNameKey.String("aws.bedrock") - // [Perplexity] - // Stability: development - // - // [Perplexity]: https://www.perplexity.ai/ - GenAIProviderNamePerplexity = GenAIProviderNameKey.String("perplexity") - // [xAI] - // Stability: development - // - // [xAI]: https://x.ai/ - GenAIProviderNameXAI = GenAIProviderNameKey.String("x_ai") - // [DeepSeek] - // Stability: development - // - // [DeepSeek]: https://www.deepseek.com/ - GenAIProviderNameDeepseek = GenAIProviderNameKey.String("deepseek") - // [Groq] - // Stability: development - // - // [Groq]: https://groq.com/ - GenAIProviderNameGroq = GenAIProviderNameKey.String("groq") - // [Mistral AI] - // Stability: development - // - // [Mistral AI]: https://mistral.ai/ - GenAIProviderNameMistralAI = GenAIProviderNameKey.String("mistral_ai") -) - -// Enum values for gen_ai.token.type -var ( - // Input tokens (prompt, input, etc.) - // Stability: development - GenAITokenTypeInput = GenAITokenTypeKey.String("input") - // Output tokens (completion, response, etc.) - // Stability: development - GenAITokenTypeOutput = GenAITokenTypeKey.String("output") -) - -// Namespace: geo -const ( - // GeoContinentCodeKey is the attribute Key conforming to the - // "geo.continent.code" semantic conventions. It represents the two-letter code - // representing continent’s name. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - GeoContinentCodeKey = attribute.Key("geo.continent.code") - - // GeoCountryISOCodeKey is the attribute Key conforming to the - // "geo.country.iso_code" semantic conventions. It represents the two-letter ISO - // Country Code ([ISO 3166-1 alpha2]). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "CA" - // - // [ISO 3166-1 alpha2]: https://wikipedia.org/wiki/ISO_3166-1#Codes - GeoCountryISOCodeKey = attribute.Key("geo.country.iso_code") - - // GeoLocalityNameKey is the attribute Key conforming to the "geo.locality.name" - // semantic conventions. It represents the locality name. Represents the name of - // a city, town, village, or similar populated place. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Montreal", "Berlin" - GeoLocalityNameKey = attribute.Key("geo.locality.name") - - // GeoLocationLatKey is the attribute Key conforming to the "geo.location.lat" - // semantic conventions. It represents the latitude of the geo location in - // [WGS84]. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 45.505918 - // - // [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 - GeoLocationLatKey = attribute.Key("geo.location.lat") - - // GeoLocationLonKey is the attribute Key conforming to the "geo.location.lon" - // semantic conventions. It represents the longitude of the geo location in - // [WGS84]. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: -73.61483 - // - // [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 - GeoLocationLonKey = attribute.Key("geo.location.lon") - - // GeoPostalCodeKey is the attribute Key conforming to the "geo.postal_code" - // semantic conventions. It represents the postal code associated with the - // location. Values appropriate for this field may also be known as a postcode - // or ZIP code and will vary widely from country to country. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "94040" - GeoPostalCodeKey = attribute.Key("geo.postal_code") - - // GeoRegionISOCodeKey is the attribute Key conforming to the - // "geo.region.iso_code" semantic conventions. It represents the region ISO code - // ([ISO 3166-2]). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "CA-QC" - // - // [ISO 3166-2]: https://wikipedia.org/wiki/ISO_3166-2 - GeoRegionISOCodeKey = attribute.Key("geo.region.iso_code") -) - -// GeoCountryISOCode returns an attribute KeyValue conforming to the -// "geo.country.iso_code" semantic conventions. It represents the two-letter ISO -// Country Code ([ISO 3166-1 alpha2]). -// -// [ISO 3166-1 alpha2]: https://wikipedia.org/wiki/ISO_3166-1#Codes -func GeoCountryISOCode(val string) attribute.KeyValue { - return GeoCountryISOCodeKey.String(val) -} - -// GeoLocalityName returns an attribute KeyValue conforming to the -// "geo.locality.name" semantic conventions. It represents the locality name. -// Represents the name of a city, town, village, or similar populated place. -func GeoLocalityName(val string) attribute.KeyValue { - return GeoLocalityNameKey.String(val) -} - -// GeoLocationLat returns an attribute KeyValue conforming to the -// "geo.location.lat" semantic conventions. It represents the latitude of the geo -// location in [WGS84]. -// -// [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 -func GeoLocationLat(val float64) attribute.KeyValue { - return GeoLocationLatKey.Float64(val) -} - -// GeoLocationLon returns an attribute KeyValue conforming to the -// "geo.location.lon" semantic conventions. It represents the longitude of the -// geo location in [WGS84]. -// -// [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 -func GeoLocationLon(val float64) attribute.KeyValue { - return GeoLocationLonKey.Float64(val) -} - -// GeoPostalCode returns an attribute KeyValue conforming to the -// "geo.postal_code" semantic conventions. It represents the postal code -// associated with the location. Values appropriate for this field may also be -// known as a postcode or ZIP code and will vary widely from country to country. -func GeoPostalCode(val string) attribute.KeyValue { - return GeoPostalCodeKey.String(val) -} - -// GeoRegionISOCode returns an attribute KeyValue conforming to the -// "geo.region.iso_code" semantic conventions. It represents the region ISO code -// ([ISO 3166-2]). -// -// [ISO 3166-2]: https://wikipedia.org/wiki/ISO_3166-2 -func GeoRegionISOCode(val string) attribute.KeyValue { - return GeoRegionISOCodeKey.String(val) -} - -// Enum values for geo.continent.code -var ( - // Africa - // Stability: development - GeoContinentCodeAf = GeoContinentCodeKey.String("AF") - // Antarctica - // Stability: development - GeoContinentCodeAn = GeoContinentCodeKey.String("AN") - // Asia - // Stability: development - GeoContinentCodeAs = GeoContinentCodeKey.String("AS") - // Europe - // Stability: development - GeoContinentCodeEu = GeoContinentCodeKey.String("EU") - // North America - // Stability: development - GeoContinentCodeNa = GeoContinentCodeKey.String("NA") - // Oceania - // Stability: development - GeoContinentCodeOc = GeoContinentCodeKey.String("OC") - // South America - // Stability: development - GeoContinentCodeSa = GeoContinentCodeKey.String("SA") -) - -// Namespace: go -const ( - // GoMemoryTypeKey is the attribute Key conforming to the "go.memory.type" - // semantic conventions. It represents the type of memory. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "other", "stack" - GoMemoryTypeKey = attribute.Key("go.memory.type") -) - -// Enum values for go.memory.type -var ( - // Memory allocated from the heap that is reserved for stack space, whether or - // not it is currently in-use. - // Stability: development - GoMemoryTypeStack = GoMemoryTypeKey.String("stack") - // Memory used by the Go runtime, excluding other categories of memory usage - // described in this enumeration. - // Stability: development - GoMemoryTypeOther = GoMemoryTypeKey.String("other") -) - -// Namespace: graphql -const ( - // GraphQLDocumentKey is the attribute Key conforming to the "graphql.document" - // semantic conventions. It represents the GraphQL document being executed. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: query findBookById { bookById(id: ?) { name } } - // Note: The value may be sanitized to exclude sensitive information. - GraphQLDocumentKey = attribute.Key("graphql.document") - - // GraphQLOperationNameKey is the attribute Key conforming to the - // "graphql.operation.name" semantic conventions. It represents the name of the - // operation being executed. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: findBookById - GraphQLOperationNameKey = attribute.Key("graphql.operation.name") - - // GraphQLOperationTypeKey is the attribute Key conforming to the - // "graphql.operation.type" semantic conventions. It represents the type of the - // operation being executed. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "query", "mutation", "subscription" - GraphQLOperationTypeKey = attribute.Key("graphql.operation.type") -) - -// GraphQLDocument returns an attribute KeyValue conforming to the -// "graphql.document" semantic conventions. It represents the GraphQL document -// being executed. -func GraphQLDocument(val string) attribute.KeyValue { - return GraphQLDocumentKey.String(val) -} - -// GraphQLOperationName returns an attribute KeyValue conforming to the -// "graphql.operation.name" semantic conventions. It represents the name of the -// operation being executed. -func GraphQLOperationName(val string) attribute.KeyValue { - return GraphQLOperationNameKey.String(val) -} - -// Enum values for graphql.operation.type -var ( - // GraphQL query - // Stability: development - GraphQLOperationTypeQuery = GraphQLOperationTypeKey.String("query") - // GraphQL mutation - // Stability: development - GraphQLOperationTypeMutation = GraphQLOperationTypeKey.String("mutation") - // GraphQL subscription - // Stability: development - GraphQLOperationTypeSubscription = GraphQLOperationTypeKey.String("subscription") -) - -// Namespace: heroku -const ( - // HerokuAppIDKey is the attribute Key conforming to the "heroku.app.id" - // semantic conventions. It represents the unique identifier for the - // application. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "2daa2797-e42b-4624-9322-ec3f968df4da" - HerokuAppIDKey = attribute.Key("heroku.app.id") - - // HerokuReleaseCommitKey is the attribute Key conforming to the - // "heroku.release.commit" semantic conventions. It represents the commit hash - // for the current release. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "e6134959463efd8966b20e75b913cafe3f5ec" - HerokuReleaseCommitKey = attribute.Key("heroku.release.commit") - - // HerokuReleaseCreationTimestampKey is the attribute Key conforming to the - // "heroku.release.creation_timestamp" semantic conventions. It represents the - // time and date the release was created. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "2022-10-23T18:00:42Z" - HerokuReleaseCreationTimestampKey = attribute.Key("heroku.release.creation_timestamp") -) - -// HerokuAppID returns an attribute KeyValue conforming to the "heroku.app.id" -// semantic conventions. It represents the unique identifier for the application. -func HerokuAppID(val string) attribute.KeyValue { - return HerokuAppIDKey.String(val) -} - -// HerokuReleaseCommit returns an attribute KeyValue conforming to the -// "heroku.release.commit" semantic conventions. It represents the commit hash -// for the current release. -func HerokuReleaseCommit(val string) attribute.KeyValue { - return HerokuReleaseCommitKey.String(val) -} - -// HerokuReleaseCreationTimestamp returns an attribute KeyValue conforming to the -// "heroku.release.creation_timestamp" semantic conventions. It represents the -// time and date the release was created. -func HerokuReleaseCreationTimestamp(val string) attribute.KeyValue { - return HerokuReleaseCreationTimestampKey.String(val) -} - -// Namespace: host -const ( - // HostArchKey is the attribute Key conforming to the "host.arch" semantic - // conventions. It represents the CPU architecture the host system is running - // on. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - HostArchKey = attribute.Key("host.arch") - - // HostCPUCacheL2SizeKey is the attribute Key conforming to the - // "host.cpu.cache.l2.size" semantic conventions. It represents the amount of - // level 2 memory cache available to the processor (in Bytes). - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 12288000 - HostCPUCacheL2SizeKey = attribute.Key("host.cpu.cache.l2.size") - - // HostCPUFamilyKey is the attribute Key conforming to the "host.cpu.family" - // semantic conventions. It represents the family or generation of the CPU. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "6", "PA-RISC 1.1e" - HostCPUFamilyKey = attribute.Key("host.cpu.family") - - // HostCPUModelIDKey is the attribute Key conforming to the "host.cpu.model.id" - // semantic conventions. It represents the model identifier. It provides more - // granular information about the CPU, distinguishing it from other CPUs within - // the same family. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "6", "9000/778/B180L" - HostCPUModelIDKey = attribute.Key("host.cpu.model.id") - - // HostCPUModelNameKey is the attribute Key conforming to the - // "host.cpu.model.name" semantic conventions. It represents the model - // designation of the processor. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz" - HostCPUModelNameKey = attribute.Key("host.cpu.model.name") - - // HostCPUSteppingKey is the attribute Key conforming to the "host.cpu.stepping" - // semantic conventions. It represents the stepping or core revisions. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "1", "r1p1" - HostCPUSteppingKey = attribute.Key("host.cpu.stepping") - - // HostCPUVendorIDKey is the attribute Key conforming to the - // "host.cpu.vendor.id" semantic conventions. It represents the processor - // manufacturer identifier. A maximum 12-character string. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "GenuineIntel" - // Note: [CPUID] command returns the vendor ID string in EBX, EDX and ECX - // registers. Writing these to memory in this order results in a 12-character - // string. - // - // [CPUID]: https://wiki.osdev.org/CPUID - HostCPUVendorIDKey = attribute.Key("host.cpu.vendor.id") - - // HostIDKey is the attribute Key conforming to the "host.id" semantic - // conventions. It represents the unique host ID. For Cloud, this must be the - // instance_id assigned by the cloud provider. For non-containerized systems, - // this should be the `machine-id`. See the table below for the sources to use - // to determine the `machine-id` based on operating system. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "fdbf79e8af94cb7f9e8df36789187052" - HostIDKey = attribute.Key("host.id") - - // HostImageIDKey is the attribute Key conforming to the "host.image.id" - // semantic conventions. It represents the VM image ID or host OS image ID. For - // Cloud, this value is from the provider. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "ami-07b06b442921831e5" - HostImageIDKey = attribute.Key("host.image.id") - - // HostImageNameKey is the attribute Key conforming to the "host.image.name" - // semantic conventions. It represents the name of the VM image or OS install - // the host was instantiated from. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "infra-ami-eks-worker-node-7d4ec78312", "CentOS-8-x86_64-1905" - HostImageNameKey = attribute.Key("host.image.name") - - // HostImageVersionKey is the attribute Key conforming to the - // "host.image.version" semantic conventions. It represents the version string - // of the VM image or host OS as defined in [Version Attributes]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "0.1" - // - // [Version Attributes]: /docs/resource/README.md#version-attributes - HostImageVersionKey = attribute.Key("host.image.version") - - // HostIPKey is the attribute Key conforming to the "host.ip" semantic - // conventions. It represents the available IP addresses of the host, excluding - // loopback interfaces. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "192.168.1.140", "fe80::abc2:4a28:737a:609e" - // Note: IPv4 Addresses MUST be specified in dotted-quad notation. IPv6 - // addresses MUST be specified in the [RFC 5952] format. - // - // [RFC 5952]: https://www.rfc-editor.org/rfc/rfc5952.html - HostIPKey = attribute.Key("host.ip") - - // HostMacKey is the attribute Key conforming to the "host.mac" semantic - // conventions. It represents the available MAC addresses of the host, excluding - // loopback interfaces. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "AC-DE-48-23-45-67", "AC-DE-48-23-45-67-01-9F" - // Note: MAC Addresses MUST be represented in [IEEE RA hexadecimal form]: as - // hyphen-separated octets in uppercase hexadecimal form from most to least - // significant. - // - // [IEEE RA hexadecimal form]: https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf - HostMacKey = attribute.Key("host.mac") - - // HostNameKey is the attribute Key conforming to the "host.name" semantic - // conventions. It represents the name of the host. On Unix systems, it may - // contain what the hostname command returns, or the fully qualified hostname, - // or another name specified by the user. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "opentelemetry-test" - HostNameKey = attribute.Key("host.name") - - // HostTypeKey is the attribute Key conforming to the "host.type" semantic - // conventions. It represents the type of host. For Cloud, this must be the - // machine type. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "n1-standard-1" - HostTypeKey = attribute.Key("host.type") -) - -// HostCPUCacheL2Size returns an attribute KeyValue conforming to the -// "host.cpu.cache.l2.size" semantic conventions. It represents the amount of -// level 2 memory cache available to the processor (in Bytes). -func HostCPUCacheL2Size(val int) attribute.KeyValue { - return HostCPUCacheL2SizeKey.Int(val) -} - -// HostCPUFamily returns an attribute KeyValue conforming to the -// "host.cpu.family" semantic conventions. It represents the family or generation -// of the CPU. -func HostCPUFamily(val string) attribute.KeyValue { - return HostCPUFamilyKey.String(val) -} - -// HostCPUModelID returns an attribute KeyValue conforming to the -// "host.cpu.model.id" semantic conventions. It represents the model identifier. -// It provides more granular information about the CPU, distinguishing it from -// other CPUs within the same family. -func HostCPUModelID(val string) attribute.KeyValue { - return HostCPUModelIDKey.String(val) -} - -// HostCPUModelName returns an attribute KeyValue conforming to the -// "host.cpu.model.name" semantic conventions. It represents the model -// designation of the processor. -func HostCPUModelName(val string) attribute.KeyValue { - return HostCPUModelNameKey.String(val) -} - -// HostCPUStepping returns an attribute KeyValue conforming to the -// "host.cpu.stepping" semantic conventions. It represents the stepping or core -// revisions. -func HostCPUStepping(val string) attribute.KeyValue { - return HostCPUSteppingKey.String(val) -} - -// HostCPUVendorID returns an attribute KeyValue conforming to the -// "host.cpu.vendor.id" semantic conventions. It represents the processor -// manufacturer identifier. A maximum 12-character string. -func HostCPUVendorID(val string) attribute.KeyValue { - return HostCPUVendorIDKey.String(val) -} - -// HostID returns an attribute KeyValue conforming to the "host.id" semantic -// conventions. It represents the unique host ID. For Cloud, this must be the -// instance_id assigned by the cloud provider. For non-containerized systems, -// this should be the `machine-id`. See the table below for the sources to use to -// determine the `machine-id` based on operating system. -func HostID(val string) attribute.KeyValue { - return HostIDKey.String(val) -} - -// HostImageID returns an attribute KeyValue conforming to the "host.image.id" -// semantic conventions. It represents the VM image ID or host OS image ID. For -// Cloud, this value is from the provider. -func HostImageID(val string) attribute.KeyValue { - return HostImageIDKey.String(val) -} - -// HostImageName returns an attribute KeyValue conforming to the -// "host.image.name" semantic conventions. It represents the name of the VM image -// or OS install the host was instantiated from. -func HostImageName(val string) attribute.KeyValue { - return HostImageNameKey.String(val) -} - -// HostImageVersion returns an attribute KeyValue conforming to the -// "host.image.version" semantic conventions. It represents the version string of -// the VM image or host OS as defined in [Version Attributes]. -// -// [Version Attributes]: /docs/resource/README.md#version-attributes -func HostImageVersion(val string) attribute.KeyValue { - return HostImageVersionKey.String(val) -} - -// HostIP returns an attribute KeyValue conforming to the "host.ip" semantic -// conventions. It represents the available IP addresses of the host, excluding -// loopback interfaces. -func HostIP(val ...string) attribute.KeyValue { - return HostIPKey.StringSlice(val) -} - -// HostMac returns an attribute KeyValue conforming to the "host.mac" semantic -// conventions. It represents the available MAC addresses of the host, excluding -// loopback interfaces. -func HostMac(val ...string) attribute.KeyValue { - return HostMacKey.StringSlice(val) -} - -// HostName returns an attribute KeyValue conforming to the "host.name" semantic -// conventions. It represents the name of the host. On Unix systems, it may -// contain what the hostname command returns, or the fully qualified hostname, or -// another name specified by the user. -func HostName(val string) attribute.KeyValue { - return HostNameKey.String(val) -} - -// HostType returns an attribute KeyValue conforming to the "host.type" semantic -// conventions. It represents the type of host. For Cloud, this must be the -// machine type. -func HostType(val string) attribute.KeyValue { - return HostTypeKey.String(val) -} - -// Enum values for host.arch -var ( - // AMD64 - // Stability: development - HostArchAMD64 = HostArchKey.String("amd64") - // ARM32 - // Stability: development - HostArchARM32 = HostArchKey.String("arm32") - // ARM64 - // Stability: development - HostArchARM64 = HostArchKey.String("arm64") - // Itanium - // Stability: development - HostArchIA64 = HostArchKey.String("ia64") - // 32-bit PowerPC - // Stability: development - HostArchPPC32 = HostArchKey.String("ppc32") - // 64-bit PowerPC - // Stability: development - HostArchPPC64 = HostArchKey.String("ppc64") - // IBM z/Architecture - // Stability: development - HostArchS390x = HostArchKey.String("s390x") - // 32-bit x86 - // Stability: development - HostArchX86 = HostArchKey.String("x86") -) - -// Namespace: http -const ( - // HTTPConnectionStateKey is the attribute Key conforming to the - // "http.connection.state" semantic conventions. It represents the state of the - // HTTP connection in the HTTP connection pool. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "active", "idle" - HTTPConnectionStateKey = attribute.Key("http.connection.state") - - // HTTPRequestBodySizeKey is the attribute Key conforming to the - // "http.request.body.size" semantic conventions. It represents the size of the - // request payload body in bytes. This is the number of bytes transferred - // excluding headers and is often, but not always, present as the - // [Content-Length] header. For requests using transport encoding, this should - // be the compressed size. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length - HTTPRequestBodySizeKey = attribute.Key("http.request.body.size") - - // HTTPRequestMethodKey is the attribute Key conforming to the - // "http.request.method" semantic conventions. It represents the HTTP request - // method. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "GET", "POST", "HEAD" - // Note: HTTP request method value SHOULD be "known" to the instrumentation. - // By default, this convention defines "known" methods as the ones listed in - // [RFC9110], - // the PATCH method defined in [RFC5789] - // and the QUERY method defined in [httpbis-safe-method-w-body]. - // - // If the HTTP request method is not known to instrumentation, it MUST set the - // `http.request.method` attribute to `_OTHER`. - // - // If the HTTP instrumentation could end up converting valid HTTP request - // methods to `_OTHER`, then it MUST provide a way to override - // the list of known HTTP methods. If this override is done via environment - // variable, then the environment variable MUST be named - // OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of - // case-sensitive known HTTP methods - // (this list MUST be a full override of the default known method, it is not a - // list of known methods in addition to the defaults). - // - // HTTP method names are case-sensitive and `http.request.method` attribute - // value MUST match a known HTTP method name exactly. - // Instrumentations for specific web frameworks that consider HTTP methods to be - // case insensitive, SHOULD populate a canonical equivalent. - // Tracing instrumentations that do so, MUST also set - // `http.request.method_original` to the original value. - // - // [RFC9110]: https://www.rfc-editor.org/rfc/rfc9110.html#name-methods - // [RFC5789]: https://www.rfc-editor.org/rfc/rfc5789.html - // [httpbis-safe-method-w-body]: https://datatracker.ietf.org/doc/draft-ietf-httpbis-safe-method-w-body/?include_text=1 - HTTPRequestMethodKey = attribute.Key("http.request.method") - - // HTTPRequestMethodOriginalKey is the attribute Key conforming to the - // "http.request.method_original" semantic conventions. It represents the - // original HTTP method sent by the client in the request line. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "GeT", "ACL", "foo" - HTTPRequestMethodOriginalKey = attribute.Key("http.request.method_original") - - // HTTPRequestResendCountKey is the attribute Key conforming to the - // "http.request.resend_count" semantic conventions. It represents the ordinal - // number of request resending attempt (for any reason, including redirects). - // - // Type: int - // RequirementLevel: Recommended - // Stability: Stable - // - // Note: The resend count SHOULD be updated each time an HTTP request gets - // resent by the client, regardless of what was the cause of the resending (e.g. - // redirection, authorization failure, 503 Server Unavailable, network issues, - // or any other). - HTTPRequestResendCountKey = attribute.Key("http.request.resend_count") - - // HTTPRequestSizeKey is the attribute Key conforming to the "http.request.size" - // semantic conventions. It represents the total size of the request in bytes. - // This should be the total number of bytes sent over the wire, including the - // request line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and request - // body if any. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - HTTPRequestSizeKey = attribute.Key("http.request.size") - - // HTTPResponseBodySizeKey is the attribute Key conforming to the - // "http.response.body.size" semantic conventions. It represents the size of the - // response payload body in bytes. This is the number of bytes transferred - // excluding headers and is often, but not always, present as the - // [Content-Length] header. For requests using transport encoding, this should - // be the compressed size. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length - HTTPResponseBodySizeKey = attribute.Key("http.response.body.size") - - // HTTPResponseSizeKey is the attribute Key conforming to the - // "http.response.size" semantic conventions. It represents the total size of - // the response in bytes. This should be the total number of bytes sent over the - // wire, including the status line (HTTP/1.1), framing (HTTP/2 and HTTP/3), - // headers, and response body and trailers if any. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - HTTPResponseSizeKey = attribute.Key("http.response.size") - - // HTTPResponseStatusCodeKey is the attribute Key conforming to the - // "http.response.status_code" semantic conventions. It represents the - // [HTTP response status code]. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: 200 - // - // [HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6 - HTTPResponseStatusCodeKey = attribute.Key("http.response.status_code") - - // HTTPRouteKey is the attribute Key conforming to the "http.route" semantic - // conventions. It represents the matched route template for the request. This - // MUST be low-cardinality and include all static path segments, with dynamic - // path segments represented with placeholders. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "/users/:userID?", "my-controller/my-action/{id?}" - // Note: MUST NOT be populated when this is not supported by the HTTP server - // framework as the route attribute should have low-cardinality and the URI path - // can NOT substitute it. - // SHOULD include the [application root] if there is one. - // - // A static path segment is a part of the route template with a fixed, - // low-cardinality value. This includes literal strings like `/users/` and - // placeholders that - // are constrained to a finite, predefined set of values, e.g. `{controller}` or - // `{action}`. - // - // A dynamic path segment is a placeholder for a value that can have high - // cardinality and is not constrained to a predefined list like static path - // segments. - // - // Instrumentations SHOULD use routing information provided by the corresponding - // web framework. They SHOULD pick the most precise source of routing - // information and MAY - // support custom route formatting. Instrumentations SHOULD document the format - // and the API used to obtain the route string. - // - // [application root]: /docs/http/http-spans.md#http-server-definitions - HTTPRouteKey = attribute.Key("http.route") -) - -// HTTPRequestBodySize returns an attribute KeyValue conforming to the -// "http.request.body.size" semantic conventions. It represents the size of the -// request payload body in bytes. This is the number of bytes transferred -// excluding headers and is often, but not always, present as the -// [Content-Length] header. For requests using transport encoding, this should be -// the compressed size. -// -// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length -func HTTPRequestBodySize(val int) attribute.KeyValue { - return HTTPRequestBodySizeKey.Int(val) -} - -// HTTPRequestHeader returns an attribute KeyValue conforming to the -// "http.request.header" semantic conventions. It represents the HTTP request -// headers, `` being the normalized HTTP Header name (lowercase), the value -// being the header values. -func HTTPRequestHeader(key string, val ...string) attribute.KeyValue { - return attribute.StringSlice("http.request.header."+key, val) -} - -// HTTPRequestMethodOriginal returns an attribute KeyValue conforming to the -// "http.request.method_original" semantic conventions. It represents the -// original HTTP method sent by the client in the request line. -func HTTPRequestMethodOriginal(val string) attribute.KeyValue { - return HTTPRequestMethodOriginalKey.String(val) -} - -// HTTPRequestResendCount returns an attribute KeyValue conforming to the -// "http.request.resend_count" semantic conventions. It represents the ordinal -// number of request resending attempt (for any reason, including redirects). -func HTTPRequestResendCount(val int) attribute.KeyValue { - return HTTPRequestResendCountKey.Int(val) -} - -// HTTPRequestSize returns an attribute KeyValue conforming to the -// "http.request.size" semantic conventions. It represents the total size of the -// request in bytes. This should be the total number of bytes sent over the wire, -// including the request line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, -// and request body if any. -func HTTPRequestSize(val int) attribute.KeyValue { - return HTTPRequestSizeKey.Int(val) -} - -// HTTPResponseBodySize returns an attribute KeyValue conforming to the -// "http.response.body.size" semantic conventions. It represents the size of the -// response payload body in bytes. This is the number of bytes transferred -// excluding headers and is often, but not always, present as the -// [Content-Length] header. For requests using transport encoding, this should be -// the compressed size. -// -// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length -func HTTPResponseBodySize(val int) attribute.KeyValue { - return HTTPResponseBodySizeKey.Int(val) -} - -// HTTPResponseHeader returns an attribute KeyValue conforming to the -// "http.response.header" semantic conventions. It represents the HTTP response -// headers, `` being the normalized HTTP Header name (lowercase), the value -// being the header values. -func HTTPResponseHeader(key string, val ...string) attribute.KeyValue { - return attribute.StringSlice("http.response.header."+key, val) -} - -// HTTPResponseSize returns an attribute KeyValue conforming to the -// "http.response.size" semantic conventions. It represents the total size of the -// response in bytes. This should be the total number of bytes sent over the -// wire, including the status line (HTTP/1.1), framing (HTTP/2 and HTTP/3), -// headers, and response body and trailers if any. -func HTTPResponseSize(val int) attribute.KeyValue { - return HTTPResponseSizeKey.Int(val) -} - -// HTTPResponseStatusCode returns an attribute KeyValue conforming to the -// "http.response.status_code" semantic conventions. It represents the -// [HTTP response status code]. -// -// [HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6 -func HTTPResponseStatusCode(val int) attribute.KeyValue { - return HTTPResponseStatusCodeKey.Int(val) -} - -// HTTPRoute returns an attribute KeyValue conforming to the "http.route" -// semantic conventions. It represents the matched route template for the -// request. This MUST be low-cardinality and include all static path segments, -// with dynamic path segments represented with placeholders. -func HTTPRoute(val string) attribute.KeyValue { - return HTTPRouteKey.String(val) -} - -// Enum values for http.connection.state -var ( - // active state. - // Stability: development - HTTPConnectionStateActive = HTTPConnectionStateKey.String("active") - // idle state. - // Stability: development - HTTPConnectionStateIdle = HTTPConnectionStateKey.String("idle") -) - -// Enum values for http.request.method -var ( - // CONNECT method. - // Stability: stable - HTTPRequestMethodConnect = HTTPRequestMethodKey.String("CONNECT") - // DELETE method. - // Stability: stable - HTTPRequestMethodDelete = HTTPRequestMethodKey.String("DELETE") - // GET method. - // Stability: stable - HTTPRequestMethodGet = HTTPRequestMethodKey.String("GET") - // HEAD method. - // Stability: stable - HTTPRequestMethodHead = HTTPRequestMethodKey.String("HEAD") - // OPTIONS method. - // Stability: stable - HTTPRequestMethodOptions = HTTPRequestMethodKey.String("OPTIONS") - // PATCH method. - // Stability: stable - HTTPRequestMethodPatch = HTTPRequestMethodKey.String("PATCH") - // POST method. - // Stability: stable - HTTPRequestMethodPost = HTTPRequestMethodKey.String("POST") - // PUT method. - // Stability: stable - HTTPRequestMethodPut = HTTPRequestMethodKey.String("PUT") - // TRACE method. - // Stability: stable - HTTPRequestMethodTrace = HTTPRequestMethodKey.String("TRACE") - // QUERY method. - // Stability: development - HTTPRequestMethodQuery = HTTPRequestMethodKey.String("QUERY") - // Any HTTP method that the instrumentation has no prior knowledge of. - // Stability: stable - HTTPRequestMethodOther = HTTPRequestMethodKey.String("_OTHER") -) - -// Namespace: hw -const ( - // HwBatteryCapacityKey is the attribute Key conforming to the - // "hw.battery.capacity" semantic conventions. It represents the design capacity - // in Watts-hours or Amper-hours. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "9.3Ah", "50Wh" - HwBatteryCapacityKey = attribute.Key("hw.battery.capacity") - - // HwBatteryChemistryKey is the attribute Key conforming to the - // "hw.battery.chemistry" semantic conventions. It represents the battery - // [chemistry], e.g. Lithium-Ion, Nickel-Cadmium, etc. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Li-ion", "NiMH" - // - // [chemistry]: https://schemas.dmtf.org/wbem/cim-html/2.31.0/CIM_Battery.html - HwBatteryChemistryKey = attribute.Key("hw.battery.chemistry") - - // HwBatteryStateKey is the attribute Key conforming to the "hw.battery.state" - // semantic conventions. It represents the current state of the battery. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - HwBatteryStateKey = attribute.Key("hw.battery.state") - - // HwBiosVersionKey is the attribute Key conforming to the "hw.bios_version" - // semantic conventions. It represents the BIOS version of the hardware - // component. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "1.2.3" - HwBiosVersionKey = attribute.Key("hw.bios_version") - - // HwDriverVersionKey is the attribute Key conforming to the "hw.driver_version" - // semantic conventions. It represents the driver version for the hardware - // component. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "10.2.1-3" - HwDriverVersionKey = attribute.Key("hw.driver_version") - - // HwEnclosureTypeKey is the attribute Key conforming to the "hw.enclosure.type" - // semantic conventions. It represents the type of the enclosure (useful for - // modular systems). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Computer", "Storage", "Switch" - HwEnclosureTypeKey = attribute.Key("hw.enclosure.type") - - // HwFirmwareVersionKey is the attribute Key conforming to the - // "hw.firmware_version" semantic conventions. It represents the firmware - // version of the hardware component. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "2.0.1" - HwFirmwareVersionKey = attribute.Key("hw.firmware_version") - - // HwGpuTaskKey is the attribute Key conforming to the "hw.gpu.task" semantic - // conventions. It represents the type of task the GPU is performing. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - HwGpuTaskKey = attribute.Key("hw.gpu.task") - - // HwIDKey is the attribute Key conforming to the "hw.id" semantic conventions. - // It represents an identifier for the hardware component, unique within the - // monitored host. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "win32battery_battery_testsysa33_1" - HwIDKey = attribute.Key("hw.id") - - // HwLimitTypeKey is the attribute Key conforming to the "hw.limit_type" - // semantic conventions. It represents the type of limit for hardware - // components. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - HwLimitTypeKey = attribute.Key("hw.limit_type") - - // HwLogicalDiskRaidLevelKey is the attribute Key conforming to the - // "hw.logical_disk.raid_level" semantic conventions. It represents the RAID - // Level of the logical disk. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "RAID0+1", "RAID5", "RAID10" - HwLogicalDiskRaidLevelKey = attribute.Key("hw.logical_disk.raid_level") - - // HwLogicalDiskStateKey is the attribute Key conforming to the - // "hw.logical_disk.state" semantic conventions. It represents the state of the - // logical disk space usage. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - HwLogicalDiskStateKey = attribute.Key("hw.logical_disk.state") - - // HwMemoryTypeKey is the attribute Key conforming to the "hw.memory.type" - // semantic conventions. It represents the type of the memory module. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "DDR4", "DDR5", "LPDDR5" - HwMemoryTypeKey = attribute.Key("hw.memory.type") - - // HwModelKey is the attribute Key conforming to the "hw.model" semantic - // conventions. It represents the descriptive model name of the hardware - // component. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "PERC H740P", "Intel(R) Core(TM) i7-10700K", "Dell XPS 15 Battery" - HwModelKey = attribute.Key("hw.model") - - // HwNameKey is the attribute Key conforming to the "hw.name" semantic - // conventions. It represents an easily-recognizable name for the hardware - // component. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "eth0" - HwNameKey = attribute.Key("hw.name") - - // HwNetworkLogicalAddressesKey is the attribute Key conforming to the - // "hw.network.logical_addresses" semantic conventions. It represents the - // logical addresses of the adapter (e.g. IP address, or WWPN). - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "172.16.8.21", "57.11.193.42" - HwNetworkLogicalAddressesKey = attribute.Key("hw.network.logical_addresses") - - // HwNetworkPhysicalAddressKey is the attribute Key conforming to the - // "hw.network.physical_address" semantic conventions. It represents the - // physical address of the adapter (e.g. MAC address, or WWNN). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "00-90-F5-E9-7B-36" - HwNetworkPhysicalAddressKey = attribute.Key("hw.network.physical_address") - - // HwParentKey is the attribute Key conforming to the "hw.parent" semantic - // conventions. It represents the unique identifier of the parent component - // (typically the `hw.id` attribute of the enclosure, or disk controller). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "dellStorage_perc_0" - HwParentKey = attribute.Key("hw.parent") - - // HwPhysicalDiskSmartAttributeKey is the attribute Key conforming to the - // "hw.physical_disk.smart_attribute" semantic conventions. It represents the - // [S.M.A.R.T.] (Self-Monitoring, Analysis, and Reporting Technology) attribute - // of the physical disk. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Spin Retry Count", "Seek Error Rate", "Raw Read Error Rate" - // - // [S.M.A.R.T.]: https://wikipedia.org/wiki/S.M.A.R.T. - HwPhysicalDiskSmartAttributeKey = attribute.Key("hw.physical_disk.smart_attribute") - - // HwPhysicalDiskStateKey is the attribute Key conforming to the - // "hw.physical_disk.state" semantic conventions. It represents the state of the - // physical disk endurance utilization. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - HwPhysicalDiskStateKey = attribute.Key("hw.physical_disk.state") - - // HwPhysicalDiskTypeKey is the attribute Key conforming to the - // "hw.physical_disk.type" semantic conventions. It represents the type of the - // physical disk. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "HDD", "SSD", "10K" - HwPhysicalDiskTypeKey = attribute.Key("hw.physical_disk.type") - - // HwSensorLocationKey is the attribute Key conforming to the - // "hw.sensor_location" semantic conventions. It represents the location of the - // sensor. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "cpu0", "ps1", "INLET", "CPU0_DIE", "AMBIENT", "MOTHERBOARD", "PS0 - // V3_3", "MAIN_12V", "CPU_VCORE" - HwSensorLocationKey = attribute.Key("hw.sensor_location") - - // HwSerialNumberKey is the attribute Key conforming to the "hw.serial_number" - // semantic conventions. It represents the serial number of the hardware - // component. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "CNFCP0123456789" - HwSerialNumberKey = attribute.Key("hw.serial_number") - - // HwStateKey is the attribute Key conforming to the "hw.state" semantic - // conventions. It represents the current state of the component. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - HwStateKey = attribute.Key("hw.state") - - // HwTapeDriveOperationTypeKey is the attribute Key conforming to the - // "hw.tape_drive.operation_type" semantic conventions. It represents the type - // of tape drive operation. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - HwTapeDriveOperationTypeKey = attribute.Key("hw.tape_drive.operation_type") - - // HwTypeKey is the attribute Key conforming to the "hw.type" semantic - // conventions. It represents the type of the component. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: Describes the category of the hardware component for which `hw.state` - // is being reported. For example, `hw.type=temperature` along with - // `hw.state=degraded` would indicate that the temperature of the hardware - // component has been reported as `degraded`. - HwTypeKey = attribute.Key("hw.type") - - // HwVendorKey is the attribute Key conforming to the "hw.vendor" semantic - // conventions. It represents the vendor name of the hardware component. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Dell", "HP", "Intel", "AMD", "LSI", "Lenovo" - HwVendorKey = attribute.Key("hw.vendor") -) - -// HwBatteryCapacity returns an attribute KeyValue conforming to the -// "hw.battery.capacity" semantic conventions. It represents the design capacity -// in Watts-hours or Amper-hours. -func HwBatteryCapacity(val string) attribute.KeyValue { - return HwBatteryCapacityKey.String(val) -} - -// HwBatteryChemistry returns an attribute KeyValue conforming to the -// "hw.battery.chemistry" semantic conventions. It represents the battery -// [chemistry], e.g. Lithium-Ion, Nickel-Cadmium, etc. -// -// [chemistry]: https://schemas.dmtf.org/wbem/cim-html/2.31.0/CIM_Battery.html -func HwBatteryChemistry(val string) attribute.KeyValue { - return HwBatteryChemistryKey.String(val) -} - -// HwBiosVersion returns an attribute KeyValue conforming to the -// "hw.bios_version" semantic conventions. It represents the BIOS version of the -// hardware component. -func HwBiosVersion(val string) attribute.KeyValue { - return HwBiosVersionKey.String(val) -} - -// HwDriverVersion returns an attribute KeyValue conforming to the -// "hw.driver_version" semantic conventions. It represents the driver version for -// the hardware component. -func HwDriverVersion(val string) attribute.KeyValue { - return HwDriverVersionKey.String(val) -} - -// HwEnclosureType returns an attribute KeyValue conforming to the -// "hw.enclosure.type" semantic conventions. It represents the type of the -// enclosure (useful for modular systems). -func HwEnclosureType(val string) attribute.KeyValue { - return HwEnclosureTypeKey.String(val) -} - -// HwFirmwareVersion returns an attribute KeyValue conforming to the -// "hw.firmware_version" semantic conventions. It represents the firmware version -// of the hardware component. -func HwFirmwareVersion(val string) attribute.KeyValue { - return HwFirmwareVersionKey.String(val) -} - -// HwID returns an attribute KeyValue conforming to the "hw.id" semantic -// conventions. It represents an identifier for the hardware component, unique -// within the monitored host. -func HwID(val string) attribute.KeyValue { - return HwIDKey.String(val) -} - -// HwLogicalDiskRaidLevel returns an attribute KeyValue conforming to the -// "hw.logical_disk.raid_level" semantic conventions. It represents the RAID -// Level of the logical disk. -func HwLogicalDiskRaidLevel(val string) attribute.KeyValue { - return HwLogicalDiskRaidLevelKey.String(val) -} - -// HwMemoryType returns an attribute KeyValue conforming to the "hw.memory.type" -// semantic conventions. It represents the type of the memory module. -func HwMemoryType(val string) attribute.KeyValue { - return HwMemoryTypeKey.String(val) -} - -// HwModel returns an attribute KeyValue conforming to the "hw.model" semantic -// conventions. It represents the descriptive model name of the hardware -// component. -func HwModel(val string) attribute.KeyValue { - return HwModelKey.String(val) -} - -// HwName returns an attribute KeyValue conforming to the "hw.name" semantic -// conventions. It represents an easily-recognizable name for the hardware -// component. -func HwName(val string) attribute.KeyValue { - return HwNameKey.String(val) -} - -// HwNetworkLogicalAddresses returns an attribute KeyValue conforming to the -// "hw.network.logical_addresses" semantic conventions. It represents the logical -// addresses of the adapter (e.g. IP address, or WWPN). -func HwNetworkLogicalAddresses(val ...string) attribute.KeyValue { - return HwNetworkLogicalAddressesKey.StringSlice(val) -} - -// HwNetworkPhysicalAddress returns an attribute KeyValue conforming to the -// "hw.network.physical_address" semantic conventions. It represents the physical -// address of the adapter (e.g. MAC address, or WWNN). -func HwNetworkPhysicalAddress(val string) attribute.KeyValue { - return HwNetworkPhysicalAddressKey.String(val) -} - -// HwParent returns an attribute KeyValue conforming to the "hw.parent" semantic -// conventions. It represents the unique identifier of the parent component -// (typically the `hw.id` attribute of the enclosure, or disk controller). -func HwParent(val string) attribute.KeyValue { - return HwParentKey.String(val) -} - -// HwPhysicalDiskSmartAttribute returns an attribute KeyValue conforming to the -// "hw.physical_disk.smart_attribute" semantic conventions. It represents the -// [S.M.A.R.T.] (Self-Monitoring, Analysis, and Reporting Technology) attribute -// of the physical disk. -// -// [S.M.A.R.T.]: https://wikipedia.org/wiki/S.M.A.R.T. -func HwPhysicalDiskSmartAttribute(val string) attribute.KeyValue { - return HwPhysicalDiskSmartAttributeKey.String(val) -} - -// HwPhysicalDiskType returns an attribute KeyValue conforming to the -// "hw.physical_disk.type" semantic conventions. It represents the type of the -// physical disk. -func HwPhysicalDiskType(val string) attribute.KeyValue { - return HwPhysicalDiskTypeKey.String(val) -} - -// HwSensorLocation returns an attribute KeyValue conforming to the -// "hw.sensor_location" semantic conventions. It represents the location of the -// sensor. -func HwSensorLocation(val string) attribute.KeyValue { - return HwSensorLocationKey.String(val) -} - -// HwSerialNumber returns an attribute KeyValue conforming to the -// "hw.serial_number" semantic conventions. It represents the serial number of -// the hardware component. -func HwSerialNumber(val string) attribute.KeyValue { - return HwSerialNumberKey.String(val) -} - -// HwVendor returns an attribute KeyValue conforming to the "hw.vendor" semantic -// conventions. It represents the vendor name of the hardware component. -func HwVendor(val string) attribute.KeyValue { - return HwVendorKey.String(val) -} - -// Enum values for hw.battery.state -var ( - // Charging - // Stability: development - HwBatteryStateCharging = HwBatteryStateKey.String("charging") - // Discharging - // Stability: development - HwBatteryStateDischarging = HwBatteryStateKey.String("discharging") -) - -// Enum values for hw.gpu.task -var ( - // Decoder - // Stability: development - HwGpuTaskDecoder = HwGpuTaskKey.String("decoder") - // Encoder - // Stability: development - HwGpuTaskEncoder = HwGpuTaskKey.String("encoder") - // General - // Stability: development - HwGpuTaskGeneral = HwGpuTaskKey.String("general") -) - -// Enum values for hw.limit_type -var ( - // Critical - // Stability: development - HwLimitTypeCritical = HwLimitTypeKey.String("critical") - // Degraded - // Stability: development - HwLimitTypeDegraded = HwLimitTypeKey.String("degraded") - // High Critical - // Stability: development - HwLimitTypeHighCritical = HwLimitTypeKey.String("high.critical") - // High Degraded - // Stability: development - HwLimitTypeHighDegraded = HwLimitTypeKey.String("high.degraded") - // Low Critical - // Stability: development - HwLimitTypeLowCritical = HwLimitTypeKey.String("low.critical") - // Low Degraded - // Stability: development - HwLimitTypeLowDegraded = HwLimitTypeKey.String("low.degraded") - // Maximum - // Stability: development - HwLimitTypeMax = HwLimitTypeKey.String("max") - // Throttled - // Stability: development - HwLimitTypeThrottled = HwLimitTypeKey.String("throttled") - // Turbo - // Stability: development - HwLimitTypeTurbo = HwLimitTypeKey.String("turbo") -) - -// Enum values for hw.logical_disk.state -var ( - // Used - // Stability: development - HwLogicalDiskStateUsed = HwLogicalDiskStateKey.String("used") - // Free - // Stability: development - HwLogicalDiskStateFree = HwLogicalDiskStateKey.String("free") -) - -// Enum values for hw.physical_disk.state -var ( - // Remaining - // Stability: development - HwPhysicalDiskStateRemaining = HwPhysicalDiskStateKey.String("remaining") -) - -// Enum values for hw.state -var ( - // Degraded - // Stability: development - HwStateDegraded = HwStateKey.String("degraded") - // Failed - // Stability: development - HwStateFailed = HwStateKey.String("failed") - // Needs Cleaning - // Stability: development - HwStateNeedsCleaning = HwStateKey.String("needs_cleaning") - // OK - // Stability: development - HwStateOk = HwStateKey.String("ok") - // Predicted Failure - // Stability: development - HwStatePredictedFailure = HwStateKey.String("predicted_failure") -) - -// Enum values for hw.tape_drive.operation_type -var ( - // Mount - // Stability: development - HwTapeDriveOperationTypeMount = HwTapeDriveOperationTypeKey.String("mount") - // Unmount - // Stability: development - HwTapeDriveOperationTypeUnmount = HwTapeDriveOperationTypeKey.String("unmount") - // Clean - // Stability: development - HwTapeDriveOperationTypeClean = HwTapeDriveOperationTypeKey.String("clean") -) - -// Enum values for hw.type -var ( - // Battery - // Stability: development - HwTypeBattery = HwTypeKey.String("battery") - // CPU - // Stability: development - HwTypeCPU = HwTypeKey.String("cpu") - // Disk controller - // Stability: development - HwTypeDiskController = HwTypeKey.String("disk_controller") - // Enclosure - // Stability: development - HwTypeEnclosure = HwTypeKey.String("enclosure") - // Fan - // Stability: development - HwTypeFan = HwTypeKey.String("fan") - // GPU - // Stability: development - HwTypeGpu = HwTypeKey.String("gpu") - // Logical disk - // Stability: development - HwTypeLogicalDisk = HwTypeKey.String("logical_disk") - // Memory - // Stability: development - HwTypeMemory = HwTypeKey.String("memory") - // Network - // Stability: development - HwTypeNetwork = HwTypeKey.String("network") - // Physical disk - // Stability: development - HwTypePhysicalDisk = HwTypeKey.String("physical_disk") - // Power supply - // Stability: development - HwTypePowerSupply = HwTypeKey.String("power_supply") - // Tape drive - // Stability: development - HwTypeTapeDrive = HwTypeKey.String("tape_drive") - // Temperature - // Stability: development - HwTypeTemperature = HwTypeKey.String("temperature") - // Voltage - // Stability: development - HwTypeVoltage = HwTypeKey.String("voltage") -) - -// Namespace: ios -const ( - // IOSAppStateKey is the attribute Key conforming to the "ios.app.state" - // semantic conventions. It represents the this attribute represents the state - // of the application. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: The iOS lifecycle states are defined in the - // [UIApplicationDelegate documentation], and from which the `OS terminology` - // column values are derived. - // - // [UIApplicationDelegate documentation]: https://developer.apple.com/documentation/uikit/uiapplicationdelegate - IOSAppStateKey = attribute.Key("ios.app.state") -) - -// Enum values for ios.app.state -var ( - // The app has become `active`. Associated with UIKit notification - // `applicationDidBecomeActive`. - // - // Stability: development - IOSAppStateActive = IOSAppStateKey.String("active") - // The app is now `inactive`. Associated with UIKit notification - // `applicationWillResignActive`. - // - // Stability: development - IOSAppStateInactive = IOSAppStateKey.String("inactive") - // The app is now in the background. This value is associated with UIKit - // notification `applicationDidEnterBackground`. - // - // Stability: development - IOSAppStateBackground = IOSAppStateKey.String("background") - // The app is now in the foreground. This value is associated with UIKit - // notification `applicationWillEnterForeground`. - // - // Stability: development - IOSAppStateForeground = IOSAppStateKey.String("foreground") - // The app is about to terminate. Associated with UIKit notification - // `applicationWillTerminate`. - // - // Stability: development - IOSAppStateTerminate = IOSAppStateKey.String("terminate") -) - -// Namespace: jsonrpc -const ( - // JSONRPCProtocolVersionKey is the attribute Key conforming to the - // "jsonrpc.protocol.version" semantic conventions. It represents the protocol - // version, as specified in the `jsonrpc` property of the request and its - // corresponding response. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "2.0", "1.0" - JSONRPCProtocolVersionKey = attribute.Key("jsonrpc.protocol.version") - - // JSONRPCRequestIDKey is the attribute Key conforming to the - // "jsonrpc.request.id" semantic conventions. It represents a string - // representation of the `id` property of the request and its corresponding - // response. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "10", "request-7" - // Note: Under the [JSON-RPC specification], the `id` property may be a string, - // number, null, or omitted entirely. When omitted, the request is treated as a - // notification. Using `null` is not equivalent to omitting the `id`, but it is - // discouraged. - // Instrumentations SHOULD NOT capture this attribute when the `id` is `null` or - // omitted. - // - // [JSON-RPC specification]: https://www.jsonrpc.org/specification - JSONRPCRequestIDKey = attribute.Key("jsonrpc.request.id") -) - -// JSONRPCProtocolVersion returns an attribute KeyValue conforming to the -// "jsonrpc.protocol.version" semantic conventions. It represents the protocol -// version, as specified in the `jsonrpc` property of the request and its -// corresponding response. -func JSONRPCProtocolVersion(val string) attribute.KeyValue { - return JSONRPCProtocolVersionKey.String(val) -} - -// JSONRPCRequestID returns an attribute KeyValue conforming to the -// "jsonrpc.request.id" semantic conventions. It represents a string -// representation of the `id` property of the request and its corresponding -// response. -func JSONRPCRequestID(val string) attribute.KeyValue { - return JSONRPCRequestIDKey.String(val) -} - -// Namespace: k8s -const ( - // K8SClusterNameKey is the attribute Key conforming to the "k8s.cluster.name" - // semantic conventions. It represents the name of the cluster. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "opentelemetry-cluster" - K8SClusterNameKey = attribute.Key("k8s.cluster.name") - - // K8SClusterUIDKey is the attribute Key conforming to the "k8s.cluster.uid" - // semantic conventions. It represents a pseudo-ID for the cluster, set to the - // UID of the `kube-system` namespace. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" - // Note: K8s doesn't have support for obtaining a cluster ID. If this is ever - // added, we will recommend collecting the `k8s.cluster.uid` through the - // official APIs. In the meantime, we are able to use the `uid` of the - // `kube-system` namespace as a proxy for cluster ID. Read on for the - // rationale. - // - // Every object created in a K8s cluster is assigned a distinct UID. The - // `kube-system` namespace is used by Kubernetes itself and will exist - // for the lifetime of the cluster. Using the `uid` of the `kube-system` - // namespace is a reasonable proxy for the K8s ClusterID as it will only - // change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are - // UUIDs as standardized by - // [ISO/IEC 9834-8 and ITU-T X.667]. - // Which states: - // - // > If generated according to one of the mechanisms defined in Rec. - // > ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be - // > different from all other UUIDs generated before 3603 A.D., or is - // > extremely likely to be different (depending on the mechanism chosen). - // - // Therefore, UIDs between clusters should be extremely unlikely to - // conflict. - // - // [ISO/IEC 9834-8 and ITU-T X.667]: https://www.itu.int/ITU-T/studygroups/com17/oid.html - K8SClusterUIDKey = attribute.Key("k8s.cluster.uid") - - // K8SContainerNameKey is the attribute Key conforming to the - // "k8s.container.name" semantic conventions. It represents the name of the - // Container from Pod specification, must be unique within a Pod. Container - // runtime usually uses different globally unique name (`container.name`). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "redis" - K8SContainerNameKey = attribute.Key("k8s.container.name") - - // K8SContainerRestartCountKey is the attribute Key conforming to the - // "k8s.container.restart_count" semantic conventions. It represents the number - // of times the container was restarted. This attribute can be used to identify - // a particular container (running or stopped) within a container spec. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: - K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") - - // K8SContainerStatusLastTerminatedReasonKey is the attribute Key conforming to - // the "k8s.container.status.last_terminated_reason" semantic conventions. It - // represents the last terminated reason of the Container. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Evicted", "Error" - K8SContainerStatusLastTerminatedReasonKey = attribute.Key("k8s.container.status.last_terminated_reason") - - // K8SContainerStatusReasonKey is the attribute Key conforming to the - // "k8s.container.status.reason" semantic conventions. It represents the reason - // for the container state. Corresponds to the `reason` field of the: - // [K8s ContainerStateWaiting] or [K8s ContainerStateTerminated]. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "ContainerCreating", "CrashLoopBackOff", - // "CreateContainerConfigError", "ErrImagePull", "ImagePullBackOff", - // "OOMKilled", "Completed", "Error", "ContainerCannotRun" - // - // [K8s ContainerStateWaiting]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstatewaiting-v1-core - // [K8s ContainerStateTerminated]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstateterminated-v1-core - K8SContainerStatusReasonKey = attribute.Key("k8s.container.status.reason") - - // K8SContainerStatusStateKey is the attribute Key conforming to the - // "k8s.container.status.state" semantic conventions. It represents the state of - // the container. [K8s ContainerState]. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "terminated", "running", "waiting" - // - // [K8s ContainerState]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstate-v1-core - K8SContainerStatusStateKey = attribute.Key("k8s.container.status.state") - - // K8SCronJobNameKey is the attribute Key conforming to the "k8s.cronjob.name" - // semantic conventions. It represents the name of the CronJob. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "opentelemetry" - K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") - - // K8SCronJobUIDKey is the attribute Key conforming to the "k8s.cronjob.uid" - // semantic conventions. It represents the UID of the CronJob. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" - K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") - - // K8SDaemonSetNameKey is the attribute Key conforming to the - // "k8s.daemonset.name" semantic conventions. It represents the name of the - // DaemonSet. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "opentelemetry" - K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") - - // K8SDaemonSetUIDKey is the attribute Key conforming to the "k8s.daemonset.uid" - // semantic conventions. It represents the UID of the DaemonSet. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" - K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") - - // K8SDeploymentNameKey is the attribute Key conforming to the - // "k8s.deployment.name" semantic conventions. It represents the name of the - // Deployment. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "opentelemetry" - K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") - - // K8SDeploymentUIDKey is the attribute Key conforming to the - // "k8s.deployment.uid" semantic conventions. It represents the UID of the - // Deployment. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" - K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") - - // K8SHPAMetricTypeKey is the attribute Key conforming to the - // "k8s.hpa.metric.type" semantic conventions. It represents the type of metric - // source for the horizontal pod autoscaler. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Resource", "ContainerResource" - // Note: This attribute reflects the `type` field of spec.metrics[] in the HPA. - K8SHPAMetricTypeKey = attribute.Key("k8s.hpa.metric.type") - - // K8SHPANameKey is the attribute Key conforming to the "k8s.hpa.name" semantic - // conventions. It represents the name of the horizontal pod autoscaler. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "opentelemetry" - K8SHPANameKey = attribute.Key("k8s.hpa.name") - - // K8SHPAScaletargetrefAPIVersionKey is the attribute Key conforming to the - // "k8s.hpa.scaletargetref.api_version" semantic conventions. It represents the - // API version of the target resource to scale for the HorizontalPodAutoscaler. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "apps/v1", "autoscaling/v2" - // Note: This maps to the `apiVersion` field in the `scaleTargetRef` of the HPA - // spec. - K8SHPAScaletargetrefAPIVersionKey = attribute.Key("k8s.hpa.scaletargetref.api_version") - - // K8SHPAScaletargetrefKindKey is the attribute Key conforming to the - // "k8s.hpa.scaletargetref.kind" semantic conventions. It represents the kind of - // the target resource to scale for the HorizontalPodAutoscaler. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Deployment", "StatefulSet" - // Note: This maps to the `kind` field in the `scaleTargetRef` of the HPA spec. - K8SHPAScaletargetrefKindKey = attribute.Key("k8s.hpa.scaletargetref.kind") - - // K8SHPAScaletargetrefNameKey is the attribute Key conforming to the - // "k8s.hpa.scaletargetref.name" semantic conventions. It represents the name of - // the target resource to scale for the HorizontalPodAutoscaler. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "my-deployment", "my-statefulset" - // Note: This maps to the `name` field in the `scaleTargetRef` of the HPA spec. - K8SHPAScaletargetrefNameKey = attribute.Key("k8s.hpa.scaletargetref.name") - - // K8SHPAUIDKey is the attribute Key conforming to the "k8s.hpa.uid" semantic - // conventions. It represents the UID of the horizontal pod autoscaler. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" - K8SHPAUIDKey = attribute.Key("k8s.hpa.uid") - - // K8SHugepageSizeKey is the attribute Key conforming to the "k8s.hugepage.size" - // semantic conventions. It represents the size (identifier) of the K8s huge - // page. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "2Mi" - K8SHugepageSizeKey = attribute.Key("k8s.hugepage.size") - - // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" semantic - // conventions. It represents the name of the Job. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "opentelemetry" - K8SJobNameKey = attribute.Key("k8s.job.name") - - // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" semantic - // conventions. It represents the UID of the Job. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" - K8SJobUIDKey = attribute.Key("k8s.job.uid") - - // K8SNamespaceNameKey is the attribute Key conforming to the - // "k8s.namespace.name" semantic conventions. It represents the name of the - // namespace that the pod is running in. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "default" - K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") - - // K8SNamespacePhaseKey is the attribute Key conforming to the - // "k8s.namespace.phase" semantic conventions. It represents the phase of the - // K8s namespace. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "active", "terminating" - // Note: This attribute aligns with the `phase` field of the - // [K8s NamespaceStatus] - // - // [K8s NamespaceStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#namespacestatus-v1-core - K8SNamespacePhaseKey = attribute.Key("k8s.namespace.phase") - - // K8SNodeConditionStatusKey is the attribute Key conforming to the - // "k8s.node.condition.status" semantic conventions. It represents the status of - // the condition, one of True, False, Unknown. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "true", "false", "unknown" - // Note: This attribute aligns with the `status` field of the - // [NodeCondition] - // - // [NodeCondition]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#nodecondition-v1-core - K8SNodeConditionStatusKey = attribute.Key("k8s.node.condition.status") - - // K8SNodeConditionTypeKey is the attribute Key conforming to the - // "k8s.node.condition.type" semantic conventions. It represents the condition - // type of a K8s Node. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Ready", "DiskPressure" - // Note: K8s Node conditions as described - // by [K8s documentation]. - // - // This attribute aligns with the `type` field of the - // [NodeCondition] - // - // The set of possible values is not limited to those listed here. Managed - // Kubernetes environments, - // or custom controllers MAY introduce additional node condition types. - // When this occurs, the exact value as reported by the Kubernetes API SHOULD be - // used. - // - // [K8s documentation]: https://v1-32.docs.kubernetes.io/docs/reference/node/node-status/#condition - // [NodeCondition]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#nodecondition-v1-core - K8SNodeConditionTypeKey = attribute.Key("k8s.node.condition.type") - - // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" - // semantic conventions. It represents the name of the Node. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "node-1" - K8SNodeNameKey = attribute.Key("k8s.node.name") - - // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" semantic - // conventions. It represents the UID of the Node. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2" - K8SNodeUIDKey = attribute.Key("k8s.node.uid") - - // K8SPodHostnameKey is the attribute Key conforming to the "k8s.pod.hostname" - // semantic conventions. It represents the specifies the hostname of the Pod. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "collector-gateway" - // Note: The K8s Pod spec has an optional hostname field, which can be used to - // specify a hostname. - // Refer to [K8s docs] - // for more information about this field. - // - // This attribute aligns with the `hostname` field of the - // [K8s PodSpec]. - // - // [K8s docs]: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-hostname-and-subdomain-field - // [K8s PodSpec]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podspec-v1-core - K8SPodHostnameKey = attribute.Key("k8s.pod.hostname") - - // K8SPodIPKey is the attribute Key conforming to the "k8s.pod.ip" semantic - // conventions. It represents the IP address allocated to the Pod. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "172.18.0.2" - // Note: This attribute aligns with the `podIP` field of the - // [K8s PodStatus]. - // - // [K8s PodStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podstatus-v1-core - K8SPodIPKey = attribute.Key("k8s.pod.ip") - - // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" semantic - // conventions. It represents the name of the Pod. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "opentelemetry-pod-autoconf" - K8SPodNameKey = attribute.Key("k8s.pod.name") - - // K8SPodStartTimeKey is the attribute Key conforming to the - // "k8s.pod.start_time" semantic conventions. It represents the start timestamp - // of the Pod. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "2025-12-04T08:41:03Z" - // Note: Date and time at which the object was acknowledged by the Kubelet. - // This is before the Kubelet pulled the container image(s) for the pod. - // - // This attribute aligns with the `startTime` field of the - // [K8s PodStatus], - // in ISO 8601 (RFC 3339 compatible) format. - // - // [K8s PodStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podstatus-v1-core - K8SPodStartTimeKey = attribute.Key("k8s.pod.start_time") - - // K8SPodStatusPhaseKey is the attribute Key conforming to the - // "k8s.pod.status.phase" semantic conventions. It represents the phase for the - // pod. Corresponds to the `phase` field of the: [K8s PodStatus]. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Pending", "Running" - // - // [K8s PodStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.33/#podstatus-v1-core - K8SPodStatusPhaseKey = attribute.Key("k8s.pod.status.phase") - - // K8SPodStatusReasonKey is the attribute Key conforming to the - // "k8s.pod.status.reason" semantic conventions. It represents the reason for - // the pod state. Corresponds to the `reason` field of the: [K8s PodStatus]. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Evicted", "NodeAffinity" - // - // [K8s PodStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.33/#podstatus-v1-core - K8SPodStatusReasonKey = attribute.Key("k8s.pod.status.reason") - - // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" semantic - // conventions. It represents the UID of the Pod. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" - K8SPodUIDKey = attribute.Key("k8s.pod.uid") - - // K8SReplicaSetNameKey is the attribute Key conforming to the - // "k8s.replicaset.name" semantic conventions. It represents the name of the - // ReplicaSet. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "opentelemetry" - K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") - - // K8SReplicaSetUIDKey is the attribute Key conforming to the - // "k8s.replicaset.uid" semantic conventions. It represents the UID of the - // ReplicaSet. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" - K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") - - // K8SReplicationControllerNameKey is the attribute Key conforming to the - // "k8s.replicationcontroller.name" semantic conventions. It represents the name - // of the replication controller. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "opentelemetry" - K8SReplicationControllerNameKey = attribute.Key("k8s.replicationcontroller.name") - - // K8SReplicationControllerUIDKey is the attribute Key conforming to the - // "k8s.replicationcontroller.uid" semantic conventions. It represents the UID - // of the replication controller. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" - K8SReplicationControllerUIDKey = attribute.Key("k8s.replicationcontroller.uid") - - // K8SResourceQuotaNameKey is the attribute Key conforming to the - // "k8s.resourcequota.name" semantic conventions. It represents the name of the - // resource quota. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "opentelemetry" - K8SResourceQuotaNameKey = attribute.Key("k8s.resourcequota.name") - - // K8SResourceQuotaResourceNameKey is the attribute Key conforming to the - // "k8s.resourcequota.resource_name" semantic conventions. It represents the - // name of the K8s resource a resource quota defines. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "count/replicationcontrollers" - // Note: The value for this attribute can be either the full - // `count/[.]` string (e.g., count/deployments.apps, - // count/pods), or, for certain core Kubernetes resources, just the resource - // name (e.g., pods, services, configmaps). Both forms are supported by - // Kubernetes for object count quotas. See - // [Kubernetes Resource Quotas documentation] for more details. - // - // [Kubernetes Resource Quotas documentation]: https://kubernetes.io/docs/concepts/policy/resource-quotas/#quota-on-object-count - K8SResourceQuotaResourceNameKey = attribute.Key("k8s.resourcequota.resource_name") - - // K8SResourceQuotaUIDKey is the attribute Key conforming to the - // "k8s.resourcequota.uid" semantic conventions. It represents the UID of the - // resource quota. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" - K8SResourceQuotaUIDKey = attribute.Key("k8s.resourcequota.uid") - - // K8SStatefulSetNameKey is the attribute Key conforming to the - // "k8s.statefulset.name" semantic conventions. It represents the name of the - // StatefulSet. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "opentelemetry" - K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") - - // K8SStatefulSetUIDKey is the attribute Key conforming to the - // "k8s.statefulset.uid" semantic conventions. It represents the UID of the - // StatefulSet. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Alpha - // - // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" - K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") - - // K8SStorageclassNameKey is the attribute Key conforming to the - // "k8s.storageclass.name" semantic conventions. It represents the name of K8s - // [StorageClass] object. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "gold.storageclass.storage.k8s.io" - // - // [StorageClass]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#storageclass-v1-storage-k8s-io - K8SStorageclassNameKey = attribute.Key("k8s.storageclass.name") - - // K8SVolumeNameKey is the attribute Key conforming to the "k8s.volume.name" - // semantic conventions. It represents the name of the K8s volume. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "volume0" - K8SVolumeNameKey = attribute.Key("k8s.volume.name") - - // K8SVolumeTypeKey is the attribute Key conforming to the "k8s.volume.type" - // semantic conventions. It represents the type of the K8s volume. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "emptyDir", "persistentVolumeClaim" - K8SVolumeTypeKey = attribute.Key("k8s.volume.type") -) - -// K8SClusterName returns an attribute KeyValue conforming to the -// "k8s.cluster.name" semantic conventions. It represents the name of the -// cluster. -func K8SClusterName(val string) attribute.KeyValue { - return K8SClusterNameKey.String(val) -} - -// K8SClusterUID returns an attribute KeyValue conforming to the -// "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for the -// cluster, set to the UID of the `kube-system` namespace. -func K8SClusterUID(val string) attribute.KeyValue { - return K8SClusterUIDKey.String(val) -} - -// K8SContainerName returns an attribute KeyValue conforming to the -// "k8s.container.name" semantic conventions. It represents the name of the -// Container from Pod specification, must be unique within a Pod. Container -// runtime usually uses different globally unique name (`container.name`). -func K8SContainerName(val string) attribute.KeyValue { - return K8SContainerNameKey.String(val) -} - -// K8SContainerRestartCount returns an attribute KeyValue conforming to the -// "k8s.container.restart_count" semantic conventions. It represents the number -// of times the container was restarted. This attribute can be used to identify a -// particular container (running or stopped) within a container spec. -func K8SContainerRestartCount(val int) attribute.KeyValue { - return K8SContainerRestartCountKey.Int(val) -} - -// K8SContainerStatusLastTerminatedReason returns an attribute KeyValue -// conforming to the "k8s.container.status.last_terminated_reason" semantic -// conventions. It represents the last terminated reason of the Container. -func K8SContainerStatusLastTerminatedReason(val string) attribute.KeyValue { - return K8SContainerStatusLastTerminatedReasonKey.String(val) -} - -// K8SCronJobAnnotation returns an attribute KeyValue conforming to the -// "k8s.cronjob.annotation" semantic conventions. It represents the cronjob -// annotation placed on the CronJob, the `` being the annotation name, the -// value being the annotation value. -func K8SCronJobAnnotation(key string, val string) attribute.KeyValue { - return attribute.String("k8s.cronjob.annotation."+key, val) -} - -// K8SCronJobLabel returns an attribute KeyValue conforming to the -// "k8s.cronjob.label" semantic conventions. It represents the label placed on -// the CronJob, the `` being the label name, the value being the label -// value. -func K8SCronJobLabel(key string, val string) attribute.KeyValue { - return attribute.String("k8s.cronjob.label."+key, val) -} - -// K8SCronJobName returns an attribute KeyValue conforming to the -// "k8s.cronjob.name" semantic conventions. It represents the name of the -// CronJob. -func K8SCronJobName(val string) attribute.KeyValue { - return K8SCronJobNameKey.String(val) -} - -// K8SCronJobUID returns an attribute KeyValue conforming to the -// "k8s.cronjob.uid" semantic conventions. It represents the UID of the CronJob. -func K8SCronJobUID(val string) attribute.KeyValue { - return K8SCronJobUIDKey.String(val) -} - -// K8SDaemonSetAnnotation returns an attribute KeyValue conforming to the -// "k8s.daemonset.annotation" semantic conventions. It represents the annotation -// placed on the DaemonSet, the `` being the annotation name, the value -// being the annotation value, even if the value is empty. -func K8SDaemonSetAnnotation(key string, val string) attribute.KeyValue { - return attribute.String("k8s.daemonset.annotation."+key, val) -} - -// K8SDaemonSetLabel returns an attribute KeyValue conforming to the -// "k8s.daemonset.label" semantic conventions. It represents the label placed on -// the DaemonSet, the `` being the label name, the value being the label -// value, even if the value is empty. -func K8SDaemonSetLabel(key string, val string) attribute.KeyValue { - return attribute.String("k8s.daemonset.label."+key, val) -} - -// K8SDaemonSetName returns an attribute KeyValue conforming to the -// "k8s.daemonset.name" semantic conventions. It represents the name of the -// DaemonSet. -func K8SDaemonSetName(val string) attribute.KeyValue { - return K8SDaemonSetNameKey.String(val) -} - -// K8SDaemonSetUID returns an attribute KeyValue conforming to the -// "k8s.daemonset.uid" semantic conventions. It represents the UID of the -// DaemonSet. -func K8SDaemonSetUID(val string) attribute.KeyValue { - return K8SDaemonSetUIDKey.String(val) -} - -// K8SDeploymentAnnotation returns an attribute KeyValue conforming to the -// "k8s.deployment.annotation" semantic conventions. It represents the annotation -// placed on the Deployment, the `` being the annotation name, the value -// being the annotation value, even if the value is empty. -func K8SDeploymentAnnotation(key string, val string) attribute.KeyValue { - return attribute.String("k8s.deployment.annotation."+key, val) -} - -// K8SDeploymentLabel returns an attribute KeyValue conforming to the -// "k8s.deployment.label" semantic conventions. It represents the label placed on -// the Deployment, the `` being the label name, the value being the label -// value, even if the value is empty. -func K8SDeploymentLabel(key string, val string) attribute.KeyValue { - return attribute.String("k8s.deployment.label."+key, val) -} - -// K8SDeploymentName returns an attribute KeyValue conforming to the -// "k8s.deployment.name" semantic conventions. It represents the name of the -// Deployment. -func K8SDeploymentName(val string) attribute.KeyValue { - return K8SDeploymentNameKey.String(val) -} - -// K8SDeploymentUID returns an attribute KeyValue conforming to the -// "k8s.deployment.uid" semantic conventions. It represents the UID of the -// Deployment. -func K8SDeploymentUID(val string) attribute.KeyValue { - return K8SDeploymentUIDKey.String(val) -} - -// K8SHPAMetricType returns an attribute KeyValue conforming to the -// "k8s.hpa.metric.type" semantic conventions. It represents the type of metric -// source for the horizontal pod autoscaler. -func K8SHPAMetricType(val string) attribute.KeyValue { - return K8SHPAMetricTypeKey.String(val) -} - -// K8SHPAName returns an attribute KeyValue conforming to the "k8s.hpa.name" -// semantic conventions. It represents the name of the horizontal pod autoscaler. -func K8SHPAName(val string) attribute.KeyValue { - return K8SHPANameKey.String(val) -} - -// K8SHPAScaletargetrefAPIVersion returns an attribute KeyValue conforming to the -// "k8s.hpa.scaletargetref.api_version" semantic conventions. It represents the -// API version of the target resource to scale for the HorizontalPodAutoscaler. -func K8SHPAScaletargetrefAPIVersion(val string) attribute.KeyValue { - return K8SHPAScaletargetrefAPIVersionKey.String(val) -} - -// K8SHPAScaletargetrefKind returns an attribute KeyValue conforming to the -// "k8s.hpa.scaletargetref.kind" semantic conventions. It represents the kind of -// the target resource to scale for the HorizontalPodAutoscaler. -func K8SHPAScaletargetrefKind(val string) attribute.KeyValue { - return K8SHPAScaletargetrefKindKey.String(val) -} - -// K8SHPAScaletargetrefName returns an attribute KeyValue conforming to the -// "k8s.hpa.scaletargetref.name" semantic conventions. It represents the name of -// the target resource to scale for the HorizontalPodAutoscaler. -func K8SHPAScaletargetrefName(val string) attribute.KeyValue { - return K8SHPAScaletargetrefNameKey.String(val) -} - -// K8SHPAUID returns an attribute KeyValue conforming to the "k8s.hpa.uid" -// semantic conventions. It represents the UID of the horizontal pod autoscaler. -func K8SHPAUID(val string) attribute.KeyValue { - return K8SHPAUIDKey.String(val) -} - -// K8SHugepageSize returns an attribute KeyValue conforming to the -// "k8s.hugepage.size" semantic conventions. It represents the size (identifier) -// of the K8s huge page. -func K8SHugepageSize(val string) attribute.KeyValue { - return K8SHugepageSizeKey.String(val) -} - -// K8SJobAnnotation returns an attribute KeyValue conforming to the -// "k8s.job.annotation" semantic conventions. It represents the annotation placed -// on the Job, the `` being the annotation name, the value being the -// annotation value, even if the value is empty. -func K8SJobAnnotation(key string, val string) attribute.KeyValue { - return attribute.String("k8s.job.annotation."+key, val) -} - -// K8SJobLabel returns an attribute KeyValue conforming to the "k8s.job.label" -// semantic conventions. It represents the label placed on the Job, the `` -// being the label name, the value being the label value, even if the value is -// empty. -func K8SJobLabel(key string, val string) attribute.KeyValue { - return attribute.String("k8s.job.label."+key, val) -} - -// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" -// semantic conventions. It represents the name of the Job. -func K8SJobName(val string) attribute.KeyValue { - return K8SJobNameKey.String(val) -} - -// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" -// semantic conventions. It represents the UID of the Job. -func K8SJobUID(val string) attribute.KeyValue { - return K8SJobUIDKey.String(val) -} - -// K8SNamespaceAnnotation returns an attribute KeyValue conforming to the -// "k8s.namespace.annotation" semantic conventions. It represents the annotation -// placed on the Namespace, the `` being the annotation name, the value -// being the annotation value, even if the value is empty. -func K8SNamespaceAnnotation(key string, val string) attribute.KeyValue { - return attribute.String("k8s.namespace.annotation."+key, val) -} - -// K8SNamespaceLabel returns an attribute KeyValue conforming to the -// "k8s.namespace.label" semantic conventions. It represents the label placed on -// the Namespace, the `` being the label name, the value being the label -// value, even if the value is empty. -func K8SNamespaceLabel(key string, val string) attribute.KeyValue { - return attribute.String("k8s.namespace.label."+key, val) -} - -// K8SNamespaceName returns an attribute KeyValue conforming to the -// "k8s.namespace.name" semantic conventions. It represents the name of the -// namespace that the pod is running in. -func K8SNamespaceName(val string) attribute.KeyValue { - return K8SNamespaceNameKey.String(val) -} - -// K8SNodeAnnotation returns an attribute KeyValue conforming to the -// "k8s.node.annotation" semantic conventions. It represents the annotation -// placed on the Node, the `` being the annotation name, the value being the -// annotation value, even if the value is empty. -func K8SNodeAnnotation(key string, val string) attribute.KeyValue { - return attribute.String("k8s.node.annotation."+key, val) -} - -// K8SNodeLabel returns an attribute KeyValue conforming to the "k8s.node.label" -// semantic conventions. It represents the label placed on the Node, the `` -// being the label name, the value being the label value, even if the value is -// empty. -func K8SNodeLabel(key string, val string) attribute.KeyValue { - return attribute.String("k8s.node.label."+key, val) -} - -// K8SNodeName returns an attribute KeyValue conforming to the "k8s.node.name" -// semantic conventions. It represents the name of the Node. -func K8SNodeName(val string) attribute.KeyValue { - return K8SNodeNameKey.String(val) -} - -// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" -// semantic conventions. It represents the UID of the Node. -func K8SNodeUID(val string) attribute.KeyValue { - return K8SNodeUIDKey.String(val) -} - -// K8SPodAnnotation returns an attribute KeyValue conforming to the -// "k8s.pod.annotation" semantic conventions. It represents the annotation placed -// on the Pod, the `` being the annotation name, the value being the -// annotation value. -func K8SPodAnnotation(key string, val string) attribute.KeyValue { - return attribute.String("k8s.pod.annotation."+key, val) -} - -// K8SPodHostname returns an attribute KeyValue conforming to the -// "k8s.pod.hostname" semantic conventions. It represents the specifies the -// hostname of the Pod. -func K8SPodHostname(val string) attribute.KeyValue { - return K8SPodHostnameKey.String(val) -} - -// K8SPodIP returns an attribute KeyValue conforming to the "k8s.pod.ip" semantic -// conventions. It represents the IP address allocated to the Pod. -func K8SPodIP(val string) attribute.KeyValue { - return K8SPodIPKey.String(val) -} - -// K8SPodLabel returns an attribute KeyValue conforming to the "k8s.pod.label" -// semantic conventions. It represents the label placed on the Pod, the `` -// being the label name, the value being the label value. -func K8SPodLabel(key string, val string) attribute.KeyValue { - return attribute.String("k8s.pod.label."+key, val) -} - -// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" -// semantic conventions. It represents the name of the Pod. -func K8SPodName(val string) attribute.KeyValue { - return K8SPodNameKey.String(val) -} - -// K8SPodStartTime returns an attribute KeyValue conforming to the -// "k8s.pod.start_time" semantic conventions. It represents the start timestamp -// of the Pod. -func K8SPodStartTime(val string) attribute.KeyValue { - return K8SPodStartTimeKey.String(val) -} - -// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" -// semantic conventions. It represents the UID of the Pod. -func K8SPodUID(val string) attribute.KeyValue { - return K8SPodUIDKey.String(val) -} - -// K8SReplicaSetAnnotation returns an attribute KeyValue conforming to the -// "k8s.replicaset.annotation" semantic conventions. It represents the annotation -// placed on the ReplicaSet, the `` being the annotation name, the value -// being the annotation value, even if the value is empty. -func K8SReplicaSetAnnotation(key string, val string) attribute.KeyValue { - return attribute.String("k8s.replicaset.annotation."+key, val) -} - -// K8SReplicaSetLabel returns an attribute KeyValue conforming to the -// "k8s.replicaset.label" semantic conventions. It represents the label placed on -// the ReplicaSet, the `` being the label name, the value being the label -// value, even if the value is empty. -func K8SReplicaSetLabel(key string, val string) attribute.KeyValue { - return attribute.String("k8s.replicaset.label."+key, val) -} - -// K8SReplicaSetName returns an attribute KeyValue conforming to the -// "k8s.replicaset.name" semantic conventions. It represents the name of the -// ReplicaSet. -func K8SReplicaSetName(val string) attribute.KeyValue { - return K8SReplicaSetNameKey.String(val) -} - -// K8SReplicaSetUID returns an attribute KeyValue conforming to the -// "k8s.replicaset.uid" semantic conventions. It represents the UID of the -// ReplicaSet. -func K8SReplicaSetUID(val string) attribute.KeyValue { - return K8SReplicaSetUIDKey.String(val) -} - -// K8SReplicationControllerName returns an attribute KeyValue conforming to the -// "k8s.replicationcontroller.name" semantic conventions. It represents the name -// of the replication controller. -func K8SReplicationControllerName(val string) attribute.KeyValue { - return K8SReplicationControllerNameKey.String(val) -} - -// K8SReplicationControllerUID returns an attribute KeyValue conforming to the -// "k8s.replicationcontroller.uid" semantic conventions. It represents the UID of -// the replication controller. -func K8SReplicationControllerUID(val string) attribute.KeyValue { - return K8SReplicationControllerUIDKey.String(val) -} - -// K8SResourceQuotaName returns an attribute KeyValue conforming to the -// "k8s.resourcequota.name" semantic conventions. It represents the name of the -// resource quota. -func K8SResourceQuotaName(val string) attribute.KeyValue { - return K8SResourceQuotaNameKey.String(val) -} - -// K8SResourceQuotaResourceName returns an attribute KeyValue conforming to the -// "k8s.resourcequota.resource_name" semantic conventions. It represents the name -// of the K8s resource a resource quota defines. -func K8SResourceQuotaResourceName(val string) attribute.KeyValue { - return K8SResourceQuotaResourceNameKey.String(val) -} - -// K8SResourceQuotaUID returns an attribute KeyValue conforming to the -// "k8s.resourcequota.uid" semantic conventions. It represents the UID of the -// resource quota. -func K8SResourceQuotaUID(val string) attribute.KeyValue { - return K8SResourceQuotaUIDKey.String(val) -} - -// K8SStatefulSetAnnotation returns an attribute KeyValue conforming to the -// "k8s.statefulset.annotation" semantic conventions. It represents the -// annotation placed on the StatefulSet, the `` being the annotation name, -// the value being the annotation value, even if the value is empty. -func K8SStatefulSetAnnotation(key string, val string) attribute.KeyValue { - return attribute.String("k8s.statefulset.annotation."+key, val) -} - -// K8SStatefulSetLabel returns an attribute KeyValue conforming to the -// "k8s.statefulset.label" semantic conventions. It represents the label placed -// on the StatefulSet, the `` being the label name, the value being the -// label value, even if the value is empty. -func K8SStatefulSetLabel(key string, val string) attribute.KeyValue { - return attribute.String("k8s.statefulset.label."+key, val) -} - -// K8SStatefulSetName returns an attribute KeyValue conforming to the -// "k8s.statefulset.name" semantic conventions. It represents the name of the -// StatefulSet. -func K8SStatefulSetName(val string) attribute.KeyValue { - return K8SStatefulSetNameKey.String(val) -} - -// K8SStatefulSetUID returns an attribute KeyValue conforming to the -// "k8s.statefulset.uid" semantic conventions. It represents the UID of the -// StatefulSet. -func K8SStatefulSetUID(val string) attribute.KeyValue { - return K8SStatefulSetUIDKey.String(val) -} - -// K8SStorageclassName returns an attribute KeyValue conforming to the -// "k8s.storageclass.name" semantic conventions. It represents the name of K8s -// [StorageClass] object. -// -// [StorageClass]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#storageclass-v1-storage-k8s-io -func K8SStorageclassName(val string) attribute.KeyValue { - return K8SStorageclassNameKey.String(val) -} - -// K8SVolumeName returns an attribute KeyValue conforming to the -// "k8s.volume.name" semantic conventions. It represents the name of the K8s -// volume. -func K8SVolumeName(val string) attribute.KeyValue { - return K8SVolumeNameKey.String(val) -} - -// Enum values for k8s.container.status.reason -var ( - // The container is being created. - // Stability: development - K8SContainerStatusReasonContainerCreating = K8SContainerStatusReasonKey.String("ContainerCreating") - // The container is in a crash loop back off state. - // Stability: development - K8SContainerStatusReasonCrashLoopBackOff = K8SContainerStatusReasonKey.String("CrashLoopBackOff") - // There was an error creating the container configuration. - // Stability: development - K8SContainerStatusReasonCreateContainerConfigError = K8SContainerStatusReasonKey.String("CreateContainerConfigError") - // There was an error pulling the container image. - // Stability: development - K8SContainerStatusReasonErrImagePull = K8SContainerStatusReasonKey.String("ErrImagePull") - // The container image pull is in back off state. - // Stability: development - K8SContainerStatusReasonImagePullBackOff = K8SContainerStatusReasonKey.String("ImagePullBackOff") - // The container was killed due to out of memory. - // Stability: development - K8SContainerStatusReasonOomKilled = K8SContainerStatusReasonKey.String("OOMKilled") - // The container has completed execution. - // Stability: development - K8SContainerStatusReasonCompleted = K8SContainerStatusReasonKey.String("Completed") - // There was an error with the container. - // Stability: development - K8SContainerStatusReasonError = K8SContainerStatusReasonKey.String("Error") - // The container cannot run. - // Stability: development - K8SContainerStatusReasonContainerCannotRun = K8SContainerStatusReasonKey.String("ContainerCannotRun") -) - -// Enum values for k8s.container.status.state -var ( - // The container has terminated. - // Stability: development - K8SContainerStatusStateTerminated = K8SContainerStatusStateKey.String("terminated") - // The container is running. - // Stability: development - K8SContainerStatusStateRunning = K8SContainerStatusStateKey.String("running") - // The container is waiting. - // Stability: development - K8SContainerStatusStateWaiting = K8SContainerStatusStateKey.String("waiting") -) - -// Enum values for k8s.namespace.phase -var ( - // Active namespace phase as described by [K8s API] - // Stability: development - // - // [K8s API]: https://pkg.go.dev/k8s.io/api@v0.31.3/core/v1#NamespacePhase - K8SNamespacePhaseActive = K8SNamespacePhaseKey.String("active") - // Terminating namespace phase as described by [K8s API] - // Stability: development - // - // [K8s API]: https://pkg.go.dev/k8s.io/api@v0.31.3/core/v1#NamespacePhase - K8SNamespacePhaseTerminating = K8SNamespacePhaseKey.String("terminating") -) - -// Enum values for k8s.node.condition.status -var ( - // condition_true - // Stability: development - K8SNodeConditionStatusConditionTrue = K8SNodeConditionStatusKey.String("true") - // condition_false - // Stability: development - K8SNodeConditionStatusConditionFalse = K8SNodeConditionStatusKey.String("false") - // condition_unknown - // Stability: development - K8SNodeConditionStatusConditionUnknown = K8SNodeConditionStatusKey.String("unknown") -) - -// Enum values for k8s.node.condition.type -var ( - // The node is healthy and ready to accept pods - // Stability: development - K8SNodeConditionTypeReady = K8SNodeConditionTypeKey.String("Ready") - // Pressure exists on the disk size—that is, if the disk capacity is low - // Stability: development - K8SNodeConditionTypeDiskPressure = K8SNodeConditionTypeKey.String("DiskPressure") - // Pressure exists on the node memory—that is, if the node memory is low - // Stability: development - K8SNodeConditionTypeMemoryPressure = K8SNodeConditionTypeKey.String("MemoryPressure") - // Pressure exists on the processes—that is, if there are too many processes - // on the node - // Stability: development - K8SNodeConditionTypePIDPressure = K8SNodeConditionTypeKey.String("PIDPressure") - // The network for the node is not correctly configured - // Stability: development - K8SNodeConditionTypeNetworkUnavailable = K8SNodeConditionTypeKey.String("NetworkUnavailable") -) - -// Enum values for k8s.pod.status.phase -var ( - // The pod has been accepted by the system, but one or more of the containers - // has not been started. This includes time before being bound to a node, as - // well as time spent pulling images onto the host. - // - // Stability: development - K8SPodStatusPhasePending = K8SPodStatusPhaseKey.String("Pending") - // The pod has been bound to a node and all of the containers have been started. - // At least one container is still running or is in the process of being - // restarted. - // - // Stability: development - K8SPodStatusPhaseRunning = K8SPodStatusPhaseKey.String("Running") - // All containers in the pod have voluntarily terminated with a container exit - // code of 0, and the system is not going to restart any of these containers. - // - // Stability: development - K8SPodStatusPhaseSucceeded = K8SPodStatusPhaseKey.String("Succeeded") - // All containers in the pod have terminated, and at least one container has - // terminated in a failure (exited with a non-zero exit code or was stopped by - // the system). - // - // Stability: development - K8SPodStatusPhaseFailed = K8SPodStatusPhaseKey.String("Failed") - // For some reason the state of the pod could not be obtained, typically due to - // an error in communicating with the host of the pod. - // - // Stability: development - K8SPodStatusPhaseUnknown = K8SPodStatusPhaseKey.String("Unknown") -) - -// Enum values for k8s.pod.status.reason -var ( - // The pod is evicted. - // Stability: development - K8SPodStatusReasonEvicted = K8SPodStatusReasonKey.String("Evicted") - // The pod is in a status because of its node affinity - // Stability: development - K8SPodStatusReasonNodeAffinity = K8SPodStatusReasonKey.String("NodeAffinity") - // The reason on a pod when its state cannot be confirmed as kubelet is - // unresponsive on the node it is (was) running. - // - // Stability: development - K8SPodStatusReasonNodeLost = K8SPodStatusReasonKey.String("NodeLost") - // The node is shutdown - // Stability: development - K8SPodStatusReasonShutdown = K8SPodStatusReasonKey.String("Shutdown") - // The pod was rejected admission to the node because of an error during - // admission that could not be categorized. - // - // Stability: development - K8SPodStatusReasonUnexpectedAdmissionError = K8SPodStatusReasonKey.String("UnexpectedAdmissionError") -) - -// Enum values for k8s.volume.type -var ( - // A [persistentVolumeClaim] volume - // Stability: development - // - // [persistentVolumeClaim]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim - K8SVolumeTypePersistentVolumeClaim = K8SVolumeTypeKey.String("persistentVolumeClaim") - // A [configMap] volume - // Stability: development - // - // [configMap]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#configmap - K8SVolumeTypeConfigMap = K8SVolumeTypeKey.String("configMap") - // A [downwardAPI] volume - // Stability: development - // - // [downwardAPI]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#downwardapi - K8SVolumeTypeDownwardAPI = K8SVolumeTypeKey.String("downwardAPI") - // An [emptyDir] volume - // Stability: development - // - // [emptyDir]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#emptydir - K8SVolumeTypeEmptyDir = K8SVolumeTypeKey.String("emptyDir") - // A [secret] volume - // Stability: development - // - // [secret]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#secret - K8SVolumeTypeSecret = K8SVolumeTypeKey.String("secret") - // A [local] volume - // Stability: development - // - // [local]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#local - K8SVolumeTypeLocal = K8SVolumeTypeKey.String("local") -) - -// Namespace: log -const ( - // LogFileNameKey is the attribute Key conforming to the "log.file.name" - // semantic conventions. It represents the basename of the file. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "audit.log" - LogFileNameKey = attribute.Key("log.file.name") - - // LogFileNameResolvedKey is the attribute Key conforming to the - // "log.file.name_resolved" semantic conventions. It represents the basename of - // the file, with symlinks resolved. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "uuid.log" - LogFileNameResolvedKey = attribute.Key("log.file.name_resolved") - - // LogFilePathKey is the attribute Key conforming to the "log.file.path" - // semantic conventions. It represents the full path to the file. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "/var/log/mysql/audit.log" - LogFilePathKey = attribute.Key("log.file.path") - - // LogFilePathResolvedKey is the attribute Key conforming to the - // "log.file.path_resolved" semantic conventions. It represents the full path to - // the file, with symlinks resolved. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "/var/lib/docker/uuid.log" - LogFilePathResolvedKey = attribute.Key("log.file.path_resolved") - - // LogIostreamKey is the attribute Key conforming to the "log.iostream" semantic - // conventions. It represents the stream associated with the log. See below for - // a list of well-known values. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - LogIostreamKey = attribute.Key("log.iostream") - - // LogRecordOriginalKey is the attribute Key conforming to the - // "log.record.original" semantic conventions. It represents the complete - // original Log Record. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "77 <86>1 2015-08-06T21:58:59.694Z 192.168.2.133 inactive - - - - // Something happened", "[INFO] 8/3/24 12:34:56 Something happened" - // Note: This value MAY be added when processing a Log Record which was - // originally transmitted as a string or equivalent data type AND the Body field - // of the Log Record does not contain the same value. (e.g. a syslog or a log - // record read from a file.) - LogRecordOriginalKey = attribute.Key("log.record.original") - - // LogRecordUIDKey is the attribute Key conforming to the "log.record.uid" - // semantic conventions. It represents a unique identifier for the Log Record. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "01ARZ3NDEKTSV4RRFFQ69G5FAV" - // Note: If an id is provided, other log records with the same id will be - // considered duplicates and can be removed safely. This means, that two - // distinguishable log records MUST have different values. - // The id MAY be an - // [Universally Unique Lexicographically Sortable Identifier (ULID)], but other - // identifiers (e.g. UUID) may be used as needed. - // - // [Universally Unique Lexicographically Sortable Identifier (ULID)]: https://github.com/ulid/spec - LogRecordUIDKey = attribute.Key("log.record.uid") -) - -// LogFileName returns an attribute KeyValue conforming to the "log.file.name" -// semantic conventions. It represents the basename of the file. -func LogFileName(val string) attribute.KeyValue { - return LogFileNameKey.String(val) -} - -// LogFileNameResolved returns an attribute KeyValue conforming to the -// "log.file.name_resolved" semantic conventions. It represents the basename of -// the file, with symlinks resolved. -func LogFileNameResolved(val string) attribute.KeyValue { - return LogFileNameResolvedKey.String(val) -} - -// LogFilePath returns an attribute KeyValue conforming to the "log.file.path" -// semantic conventions. It represents the full path to the file. -func LogFilePath(val string) attribute.KeyValue { - return LogFilePathKey.String(val) -} - -// LogFilePathResolved returns an attribute KeyValue conforming to the -// "log.file.path_resolved" semantic conventions. It represents the full path to -// the file, with symlinks resolved. -func LogFilePathResolved(val string) attribute.KeyValue { - return LogFilePathResolvedKey.String(val) -} - -// LogRecordOriginal returns an attribute KeyValue conforming to the -// "log.record.original" semantic conventions. It represents the complete -// original Log Record. -func LogRecordOriginal(val string) attribute.KeyValue { - return LogRecordOriginalKey.String(val) -} - -// LogRecordUID returns an attribute KeyValue conforming to the "log.record.uid" -// semantic conventions. It represents a unique identifier for the Log Record. -func LogRecordUID(val string) attribute.KeyValue { - return LogRecordUIDKey.String(val) -} - -// Enum values for log.iostream -var ( - // Logs from stdout stream - // Stability: development - LogIostreamStdout = LogIostreamKey.String("stdout") - // Events from stderr stream - // Stability: development - LogIostreamStderr = LogIostreamKey.String("stderr") -) - -// Namespace: mainframe -const ( - // MainframeLparNameKey is the attribute Key conforming to the - // "mainframe.lpar.name" semantic conventions. It represents the name of the - // logical partition that hosts a systems with a mainframe operating system. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "LPAR01" - MainframeLparNameKey = attribute.Key("mainframe.lpar.name") -) - -// MainframeLparName returns an attribute KeyValue conforming to the -// "mainframe.lpar.name" semantic conventions. It represents the name of the -// logical partition that hosts a systems with a mainframe operating system. -func MainframeLparName(val string) attribute.KeyValue { - return MainframeLparNameKey.String(val) -} - -// Namespace: mcp -const ( - // McpMethodNameKey is the attribute Key conforming to the "mcp.method.name" - // semantic conventions. It represents the name of the request or notification - // method. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - McpMethodNameKey = attribute.Key("mcp.method.name") - - // McpProtocolVersionKey is the attribute Key conforming to the - // "mcp.protocol.version" semantic conventions. It represents the [version] of - // the Model Context Protocol used. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "2025-06-18" - // - // [version]: https://modelcontextprotocol.io/specification/versioning - McpProtocolVersionKey = attribute.Key("mcp.protocol.version") - - // McpResourceURIKey is the attribute Key conforming to the "mcp.resource.uri" - // semantic conventions. It represents the value of the resource uri. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "postgres://database/customers/schema", - // "file:///home/user/documents/report.pdf" - // Note: This is a URI of the resource provided in the following requests or - // notifications: `resources/read`, `resources/subscribe`, - // `resources/unsubscribe`, or `notifications/resources/updated`. - McpResourceURIKey = attribute.Key("mcp.resource.uri") - - // McpSessionIDKey is the attribute Key conforming to the "mcp.session.id" - // semantic conventions. It represents the identifies [MCP session]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "191c4850af6c49e08843a3f6c80e5046" - // - // [MCP session]: https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#session-management - McpSessionIDKey = attribute.Key("mcp.session.id") -) - -// McpProtocolVersion returns an attribute KeyValue conforming to the -// "mcp.protocol.version" semantic conventions. It represents the [version] of -// the Model Context Protocol used. -// -// [version]: https://modelcontextprotocol.io/specification/versioning -func McpProtocolVersion(val string) attribute.KeyValue { - return McpProtocolVersionKey.String(val) -} - -// McpResourceURI returns an attribute KeyValue conforming to the -// "mcp.resource.uri" semantic conventions. It represents the value of the -// resource uri. -func McpResourceURI(val string) attribute.KeyValue { - return McpResourceURIKey.String(val) -} - -// McpSessionID returns an attribute KeyValue conforming to the "mcp.session.id" -// semantic conventions. It represents the identifies [MCP session]. -// -// [MCP session]: https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#session-management -func McpSessionID(val string) attribute.KeyValue { - return McpSessionIDKey.String(val) -} - -// Enum values for mcp.method.name -var ( - // Notification cancelling a previously-issued request. - // - // Stability: development - McpMethodNameNotificationsCancelled = McpMethodNameKey.String("notifications/cancelled") - // Request to initialize the MCP client. - // - // Stability: development - McpMethodNameInitialize = McpMethodNameKey.String("initialize") - // Notification indicating that the MCP client has been initialized. - // - // Stability: development - McpMethodNameNotificationsInitialized = McpMethodNameKey.String("notifications/initialized") - // Notification indicating the progress for a long-running operation. - // - // Stability: development - McpMethodNameNotificationsProgress = McpMethodNameKey.String("notifications/progress") - // Request to check that the other party is still alive. - // - // Stability: development - McpMethodNamePing = McpMethodNameKey.String("ping") - // Request to list resources available on server. - // - // Stability: development - McpMethodNameResourcesList = McpMethodNameKey.String("resources/list") - // Request to list resource templates available on server. - // - // Stability: development - McpMethodNameResourcesTemplatesList = McpMethodNameKey.String("resources/templates/list") - // Request to read a resource. - // - // Stability: development - McpMethodNameResourcesRead = McpMethodNameKey.String("resources/read") - // Notification indicating that the list of resources has changed. - // - // Stability: development - McpMethodNameNotificationsResourcesListChanged = McpMethodNameKey.String("notifications/resources/list_changed") - // Request to subscribe to a resource. - // - // Stability: development - McpMethodNameResourcesSubscribe = McpMethodNameKey.String("resources/subscribe") - // Request to unsubscribe from resource updates. - // - // Stability: development - McpMethodNameResourcesUnsubscribe = McpMethodNameKey.String("resources/unsubscribe") - // Notification indicating that a resource has been updated. - // - // Stability: development - McpMethodNameNotificationsResourcesUpdated = McpMethodNameKey.String("notifications/resources/updated") - // Request to list prompts available on server. - // - // Stability: development - McpMethodNamePromptsList = McpMethodNameKey.String("prompts/list") - // Request to get a prompt. - // - // Stability: development - McpMethodNamePromptsGet = McpMethodNameKey.String("prompts/get") - // Notification indicating that the list of prompts has changed. - // - // Stability: development - McpMethodNameNotificationsPromptsListChanged = McpMethodNameKey.String("notifications/prompts/list_changed") - // Request to list tools available on server. - // - // Stability: development - McpMethodNameToolsList = McpMethodNameKey.String("tools/list") - // Request to call a tool. - // - // Stability: development - McpMethodNameToolsCall = McpMethodNameKey.String("tools/call") - // Notification indicating that the list of tools has changed. - // - // Stability: development - McpMethodNameNotificationsToolsListChanged = McpMethodNameKey.String("notifications/tools/list_changed") - // Request to set the logging level. - // - // Stability: development - McpMethodNameLoggingSetLevel = McpMethodNameKey.String("logging/setLevel") - // Notification indicating that a message has been received. - // - // Stability: development - McpMethodNameNotificationsMessage = McpMethodNameKey.String("notifications/message") - // Request to create a sampling message. - // - // Stability: development - McpMethodNameSamplingCreateMessage = McpMethodNameKey.String("sampling/createMessage") - // Request to complete a prompt. - // - // Stability: development - McpMethodNameCompletionComplete = McpMethodNameKey.String("completion/complete") - // Request to list roots available on server. - // - // Stability: development - McpMethodNameRootsList = McpMethodNameKey.String("roots/list") - // Notification indicating that the list of roots has changed. - // - // Stability: development - McpMethodNameNotificationsRootsListChanged = McpMethodNameKey.String("notifications/roots/list_changed") - // Request from the server to elicit additional information from the user via - // the client - // - // Stability: development - McpMethodNameElicitationCreate = McpMethodNameKey.String("elicitation/create") -) - -// Namespace: messaging -const ( - // MessagingBatchMessageCountKey is the attribute Key conforming to the - // "messaging.batch.message_count" semantic conventions. It represents the - // number of messages sent, received, or processed in the scope of the batching - // operation. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 0, 1, 2 - // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on - // spans that operate with a single message. When a messaging client library - // supports both batch and single-message API for the same operation, - // instrumentations SHOULD use `messaging.batch.message_count` for batching APIs - // and SHOULD NOT use it for single-message APIs. - MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") - - // MessagingClientIDKey is the attribute Key conforming to the - // "messaging.client.id" semantic conventions. It represents a unique identifier - // for the client that consumes or produces a message. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "client-5", "myhost@8742@s8083jm" - MessagingClientIDKey = attribute.Key("messaging.client.id") - - // MessagingConsumerGroupNameKey is the attribute Key conforming to the - // "messaging.consumer.group.name" semantic conventions. It represents the name - // of the consumer group with which a consumer is associated. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "my-group", "indexer" - // Note: Semantic conventions for individual messaging systems SHOULD document - // whether `messaging.consumer.group.name` is applicable and what it means in - // the context of that system. - MessagingConsumerGroupNameKey = attribute.Key("messaging.consumer.group.name") - - // MessagingDestinationAnonymousKey is the attribute Key conforming to the - // "messaging.destination.anonymous" semantic conventions. It represents a - // boolean that is true if the message destination is anonymous (could be - // unnamed or have auto-generated name). - // - // Type: boolean - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") - - // MessagingDestinationNameKey is the attribute Key conforming to the - // "messaging.destination.name" semantic conventions. It represents the message - // destination name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "MyQueue", "MyTopic" - // Note: Destination name SHOULD uniquely identify a specific queue, topic or - // other entity within the broker. If - // the broker doesn't have such notion, the destination name SHOULD uniquely - // identify the broker. - MessagingDestinationNameKey = attribute.Key("messaging.destination.name") - - // MessagingDestinationPartitionIDKey is the attribute Key conforming to the - // "messaging.destination.partition.id" semantic conventions. It represents the - // identifier of the partition messages are sent to or received from, unique - // within the `messaging.destination.name`. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 1 - MessagingDestinationPartitionIDKey = attribute.Key("messaging.destination.partition.id") - - // MessagingDestinationSubscriptionNameKey is the attribute Key conforming to - // the "messaging.destination.subscription.name" semantic conventions. It - // represents the name of the destination subscription from which a message is - // consumed. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "subscription-a" - // Note: Semantic conventions for individual messaging systems SHOULD document - // whether `messaging.destination.subscription.name` is applicable and what it - // means in the context of that system. - MessagingDestinationSubscriptionNameKey = attribute.Key("messaging.destination.subscription.name") - - // MessagingDestinationTemplateKey is the attribute Key conforming to the - // "messaging.destination.template" semantic conventions. It represents the low - // cardinality representation of the messaging destination name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "/customers/{customerId}" - // Note: Destination names could be constructed from templates. An example would - // be a destination name involving a user name or product id. Although the - // destination name in this case is of high cardinality, the underlying template - // is of low cardinality and can be effectively used for grouping and - // aggregation. - MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") - - // MessagingDestinationTemporaryKey is the attribute Key conforming to the - // "messaging.destination.temporary" semantic conventions. It represents a - // boolean that is true if the message destination is temporary and might not - // exist anymore after messages are processed. - // - // Type: boolean - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") - - // MessagingEventHubsMessageEnqueuedTimeKey is the attribute Key conforming to - // the "messaging.eventhubs.message.enqueued_time" semantic conventions. It - // represents the UTC epoch seconds at which the message has been accepted and - // stored in the entity. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - MessagingEventHubsMessageEnqueuedTimeKey = attribute.Key("messaging.eventhubs.message.enqueued_time") - - // MessagingGCPPubSubMessageAckDeadlineKey is the attribute Key conforming to - // the "messaging.gcp_pubsub.message.ack_deadline" semantic conventions. It - // represents the ack deadline in seconds set for the modify ack deadline - // request. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - MessagingGCPPubSubMessageAckDeadlineKey = attribute.Key("messaging.gcp_pubsub.message.ack_deadline") - - // MessagingGCPPubSubMessageAckIDKey is the attribute Key conforming to the - // "messaging.gcp_pubsub.message.ack_id" semantic conventions. It represents the - // ack id for a given message. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: ack_id - MessagingGCPPubSubMessageAckIDKey = attribute.Key("messaging.gcp_pubsub.message.ack_id") - - // MessagingGCPPubSubMessageDeliveryAttemptKey is the attribute Key conforming - // to the "messaging.gcp_pubsub.message.delivery_attempt" semantic conventions. - // It represents the delivery attempt for a given message. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - MessagingGCPPubSubMessageDeliveryAttemptKey = attribute.Key("messaging.gcp_pubsub.message.delivery_attempt") - - // MessagingGCPPubSubMessageOrderingKeyKey is the attribute Key conforming to - // the "messaging.gcp_pubsub.message.ordering_key" semantic conventions. It - // represents the ordering key for a given message. If the attribute is not - // present, the message does not have an ordering key. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: ordering_key - MessagingGCPPubSubMessageOrderingKeyKey = attribute.Key("messaging.gcp_pubsub.message.ordering_key") - - // MessagingKafkaMessageKeyKey is the attribute Key conforming to the - // "messaging.kafka.message.key" semantic conventions. It represents the message - // keys in Kafka are used for grouping alike messages to ensure they're - // processed on the same partition. They differ from `messaging.message.id` in - // that they're not unique. If the key is `null`, the attribute MUST NOT be set. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: myKey - // Note: If the key type is not string, it's string representation has to be - // supplied for the attribute. If the key has no unambiguous, canonical string - // form, don't include its value. - MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") - - // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the - // "messaging.kafka.message.tombstone" semantic conventions. It represents a - // boolean that is true if the message is a tombstone. - // - // Type: boolean - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") - - // MessagingKafkaOffsetKey is the attribute Key conforming to the - // "messaging.kafka.offset" semantic conventions. It represents the offset of a - // record in the corresponding Kafka partition. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - MessagingKafkaOffsetKey = attribute.Key("messaging.kafka.offset") - - // MessagingMessageBodySizeKey is the attribute Key conforming to the - // "messaging.message.body.size" semantic conventions. It represents the size of - // the message body in bytes. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Note: This can refer to both the compressed or uncompressed body size. If - // both sizes are known, the uncompressed - // body size should be used. - MessagingMessageBodySizeKey = attribute.Key("messaging.message.body.size") - - // MessagingMessageConversationIDKey is the attribute Key conforming to the - // "messaging.message.conversation_id" semantic conventions. It represents the - // conversation ID identifying the conversation to which the message belongs, - // represented as a string. Sometimes called "Correlation ID". - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: MyConversationId - MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") - - // MessagingMessageEnvelopeSizeKey is the attribute Key conforming to the - // "messaging.message.envelope.size" semantic conventions. It represents the - // size of the message body and metadata in bytes. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Note: This can refer to both the compressed or uncompressed size. If both - // sizes are known, the uncompressed - // size should be used. - MessagingMessageEnvelopeSizeKey = attribute.Key("messaging.message.envelope.size") - - // MessagingMessageIDKey is the attribute Key conforming to the - // "messaging.message.id" semantic conventions. It represents a value used by - // the messaging system as an identifier for the message, represented as a - // string. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 452a7c7c7c7048c2f887f61572b18fc2 - MessagingMessageIDKey = attribute.Key("messaging.message.id") - - // MessagingOperationNameKey is the attribute Key conforming to the - // "messaging.operation.name" semantic conventions. It represents the - // system-specific name of the messaging operation. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "ack", "nack", "send" - MessagingOperationNameKey = attribute.Key("messaging.operation.name") - - // MessagingOperationTypeKey is the attribute Key conforming to the - // "messaging.operation.type" semantic conventions. It represents a string - // identifying the type of the messaging operation. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: If a custom value is used, it MUST be of low cardinality. - MessagingOperationTypeKey = attribute.Key("messaging.operation.type") - - // MessagingRabbitMQDestinationRoutingKeyKey is the attribute Key conforming to - // the "messaging.rabbitmq.destination.routing_key" semantic conventions. It - // represents the rabbitMQ message routing key. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: myKey - MessagingRabbitMQDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") - - // MessagingRabbitMQMessageDeliveryTagKey is the attribute Key conforming to the - // "messaging.rabbitmq.message.delivery_tag" semantic conventions. It represents - // the rabbitMQ message delivery tag. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - MessagingRabbitMQMessageDeliveryTagKey = attribute.Key("messaging.rabbitmq.message.delivery_tag") - - // MessagingRocketMQConsumptionModelKey is the attribute Key conforming to the - // "messaging.rocketmq.consumption_model" semantic conventions. It represents - // the model of message consumption. This only applies to consumer spans. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - MessagingRocketMQConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") - - // MessagingRocketMQMessageDelayTimeLevelKey is the attribute Key conforming to - // the "messaging.rocketmq.message.delay_time_level" semantic conventions. It - // represents the delay time level for delay message, which determines the - // message delay time. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - MessagingRocketMQMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") - - // MessagingRocketMQMessageDeliveryTimestampKey is the attribute Key conforming - // to the "messaging.rocketmq.message.delivery_timestamp" semantic conventions. - // It represents the timestamp in milliseconds that the delay message is - // expected to be delivered to consumer. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - MessagingRocketMQMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") - - // MessagingRocketMQMessageGroupKey is the attribute Key conforming to the - // "messaging.rocketmq.message.group" semantic conventions. It represents the it - // is essential for FIFO message. Messages that belong to the same message group - // are always processed one by one within the same consumer group. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: myMessageGroup - MessagingRocketMQMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") - - // MessagingRocketMQMessageKeysKey is the attribute Key conforming to the - // "messaging.rocketmq.message.keys" semantic conventions. It represents the - // key(s) of message, another way to mark message besides message id. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "keyA", "keyB" - MessagingRocketMQMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") - - // MessagingRocketMQMessageTagKey is the attribute Key conforming to the - // "messaging.rocketmq.message.tag" semantic conventions. It represents the - // secondary classifier of message besides topic. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: tagA - MessagingRocketMQMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") - - // MessagingRocketMQMessageTypeKey is the attribute Key conforming to the - // "messaging.rocketmq.message.type" semantic conventions. It represents the - // type of message. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - MessagingRocketMQMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") - - // MessagingRocketMQNamespaceKey is the attribute Key conforming to the - // "messaging.rocketmq.namespace" semantic conventions. It represents the - // namespace of RocketMQ resources, resources in different namespaces are - // individual. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: myNamespace - MessagingRocketMQNamespaceKey = attribute.Key("messaging.rocketmq.namespace") - - // MessagingServiceBusDispositionStatusKey is the attribute Key conforming to - // the "messaging.servicebus.disposition_status" semantic conventions. It - // represents the describes the [settlement type]. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // - // [settlement type]: https://learn.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement#peeklock - MessagingServiceBusDispositionStatusKey = attribute.Key("messaging.servicebus.disposition_status") - - // MessagingServiceBusMessageDeliveryCountKey is the attribute Key conforming to - // the "messaging.servicebus.message.delivery_count" semantic conventions. It - // represents the number of deliveries that have been attempted for this - // message. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - MessagingServiceBusMessageDeliveryCountKey = attribute.Key("messaging.servicebus.message.delivery_count") - - // MessagingServiceBusMessageEnqueuedTimeKey is the attribute Key conforming to - // the "messaging.servicebus.message.enqueued_time" semantic conventions. It - // represents the UTC epoch seconds at which the message has been accepted and - // stored in the entity. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - MessagingServiceBusMessageEnqueuedTimeKey = attribute.Key("messaging.servicebus.message.enqueued_time") - - // MessagingSystemKey is the attribute Key conforming to the "messaging.system" - // semantic conventions. It represents the messaging system as identified by the - // client instrumentation. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: The actual messaging system may differ from the one known by the - // client. For example, when using Kafka client libraries to communicate with - // Azure Event Hubs, the `messaging.system` is set to `kafka` based on the - // instrumentation's best knowledge. - MessagingSystemKey = attribute.Key("messaging.system") -) - -// MessagingBatchMessageCount returns an attribute KeyValue conforming to the -// "messaging.batch.message_count" semantic conventions. It represents the number -// of messages sent, received, or processed in the scope of the batching -// operation. -func MessagingBatchMessageCount(val int) attribute.KeyValue { - return MessagingBatchMessageCountKey.Int(val) -} - -// MessagingClientID returns an attribute KeyValue conforming to the -// "messaging.client.id" semantic conventions. It represents a unique identifier -// for the client that consumes or produces a message. -func MessagingClientID(val string) attribute.KeyValue { - return MessagingClientIDKey.String(val) -} - -// MessagingConsumerGroupName returns an attribute KeyValue conforming to the -// "messaging.consumer.group.name" semantic conventions. It represents the name -// of the consumer group with which a consumer is associated. -func MessagingConsumerGroupName(val string) attribute.KeyValue { - return MessagingConsumerGroupNameKey.String(val) -} - -// MessagingDestinationAnonymous returns an attribute KeyValue conforming to the -// "messaging.destination.anonymous" semantic conventions. It represents a -// boolean that is true if the message destination is anonymous (could be unnamed -// or have auto-generated name). -func MessagingDestinationAnonymous(val bool) attribute.KeyValue { - return MessagingDestinationAnonymousKey.Bool(val) -} - -// MessagingDestinationName returns an attribute KeyValue conforming to the -// "messaging.destination.name" semantic conventions. It represents the message -// destination name. -func MessagingDestinationName(val string) attribute.KeyValue { - return MessagingDestinationNameKey.String(val) -} - -// MessagingDestinationPartitionID returns an attribute KeyValue conforming to -// the "messaging.destination.partition.id" semantic conventions. It represents -// the identifier of the partition messages are sent to or received from, unique -// within the `messaging.destination.name`. -func MessagingDestinationPartitionID(val string) attribute.KeyValue { - return MessagingDestinationPartitionIDKey.String(val) -} - -// MessagingDestinationSubscriptionName returns an attribute KeyValue conforming -// to the "messaging.destination.subscription.name" semantic conventions. It -// represents the name of the destination subscription from which a message is -// consumed. -func MessagingDestinationSubscriptionName(val string) attribute.KeyValue { - return MessagingDestinationSubscriptionNameKey.String(val) -} - -// MessagingDestinationTemplate returns an attribute KeyValue conforming to the -// "messaging.destination.template" semantic conventions. It represents the low -// cardinality representation of the messaging destination name. -func MessagingDestinationTemplate(val string) attribute.KeyValue { - return MessagingDestinationTemplateKey.String(val) -} - -// MessagingDestinationTemporary returns an attribute KeyValue conforming to the -// "messaging.destination.temporary" semantic conventions. It represents a -// boolean that is true if the message destination is temporary and might not -// exist anymore after messages are processed. -func MessagingDestinationTemporary(val bool) attribute.KeyValue { - return MessagingDestinationTemporaryKey.Bool(val) -} - -// MessagingEventHubsMessageEnqueuedTime returns an attribute KeyValue conforming -// to the "messaging.eventhubs.message.enqueued_time" semantic conventions. It -// represents the UTC epoch seconds at which the message has been accepted and -// stored in the entity. -func MessagingEventHubsMessageEnqueuedTime(val int) attribute.KeyValue { - return MessagingEventHubsMessageEnqueuedTimeKey.Int(val) -} - -// MessagingGCPPubSubMessageAckDeadline returns an attribute KeyValue conforming -// to the "messaging.gcp_pubsub.message.ack_deadline" semantic conventions. It -// represents the ack deadline in seconds set for the modify ack deadline -// request. -func MessagingGCPPubSubMessageAckDeadline(val int) attribute.KeyValue { - return MessagingGCPPubSubMessageAckDeadlineKey.Int(val) -} - -// MessagingGCPPubSubMessageAckID returns an attribute KeyValue conforming to the -// "messaging.gcp_pubsub.message.ack_id" semantic conventions. It represents the -// ack id for a given message. -func MessagingGCPPubSubMessageAckID(val string) attribute.KeyValue { - return MessagingGCPPubSubMessageAckIDKey.String(val) -} - -// MessagingGCPPubSubMessageDeliveryAttempt returns an attribute KeyValue -// conforming to the "messaging.gcp_pubsub.message.delivery_attempt" semantic -// conventions. It represents the delivery attempt for a given message. -func MessagingGCPPubSubMessageDeliveryAttempt(val int) attribute.KeyValue { - return MessagingGCPPubSubMessageDeliveryAttemptKey.Int(val) -} - -// MessagingGCPPubSubMessageOrderingKey returns an attribute KeyValue conforming -// to the "messaging.gcp_pubsub.message.ordering_key" semantic conventions. It -// represents the ordering key for a given message. If the attribute is not -// present, the message does not have an ordering key. -func MessagingGCPPubSubMessageOrderingKey(val string) attribute.KeyValue { - return MessagingGCPPubSubMessageOrderingKeyKey.String(val) -} - -// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the -// "messaging.kafka.message.key" semantic conventions. It represents the message -// keys in Kafka are used for grouping alike messages to ensure they're processed -// on the same partition. They differ from `messaging.message.id` in that they're -// not unique. If the key is `null`, the attribute MUST NOT be set. -func MessagingKafkaMessageKey(val string) attribute.KeyValue { - return MessagingKafkaMessageKeyKey.String(val) -} - -// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming to the -// "messaging.kafka.message.tombstone" semantic conventions. It represents a -// boolean that is true if the message is a tombstone. -func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { - return MessagingKafkaMessageTombstoneKey.Bool(val) -} - -// MessagingKafkaOffset returns an attribute KeyValue conforming to the -// "messaging.kafka.offset" semantic conventions. It represents the offset of a -// record in the corresponding Kafka partition. -func MessagingKafkaOffset(val int) attribute.KeyValue { - return MessagingKafkaOffsetKey.Int(val) -} - -// MessagingMessageBodySize returns an attribute KeyValue conforming to the -// "messaging.message.body.size" semantic conventions. It represents the size of -// the message body in bytes. -func MessagingMessageBodySize(val int) attribute.KeyValue { - return MessagingMessageBodySizeKey.Int(val) -} - -// MessagingMessageConversationID returns an attribute KeyValue conforming to the -// "messaging.message.conversation_id" semantic conventions. It represents the -// conversation ID identifying the conversation to which the message belongs, -// represented as a string. Sometimes called "Correlation ID". -func MessagingMessageConversationID(val string) attribute.KeyValue { - return MessagingMessageConversationIDKey.String(val) -} - -// MessagingMessageEnvelopeSize returns an attribute KeyValue conforming to the -// "messaging.message.envelope.size" semantic conventions. It represents the size -// of the message body and metadata in bytes. -func MessagingMessageEnvelopeSize(val int) attribute.KeyValue { - return MessagingMessageEnvelopeSizeKey.Int(val) -} - -// MessagingMessageID returns an attribute KeyValue conforming to the -// "messaging.message.id" semantic conventions. It represents a value used by the -// messaging system as an identifier for the message, represented as a string. -func MessagingMessageID(val string) attribute.KeyValue { - return MessagingMessageIDKey.String(val) -} - -// MessagingOperationName returns an attribute KeyValue conforming to the -// "messaging.operation.name" semantic conventions. It represents the -// system-specific name of the messaging operation. -func MessagingOperationName(val string) attribute.KeyValue { - return MessagingOperationNameKey.String(val) -} - -// MessagingRabbitMQDestinationRoutingKey returns an attribute KeyValue -// conforming to the "messaging.rabbitmq.destination.routing_key" semantic -// conventions. It represents the rabbitMQ message routing key. -func MessagingRabbitMQDestinationRoutingKey(val string) attribute.KeyValue { - return MessagingRabbitMQDestinationRoutingKeyKey.String(val) -} - -// MessagingRabbitMQMessageDeliveryTag returns an attribute KeyValue conforming -// to the "messaging.rabbitmq.message.delivery_tag" semantic conventions. It -// represents the rabbitMQ message delivery tag. -func MessagingRabbitMQMessageDeliveryTag(val int) attribute.KeyValue { - return MessagingRabbitMQMessageDeliveryTagKey.Int(val) -} - -// MessagingRocketMQMessageDelayTimeLevel returns an attribute KeyValue -// conforming to the "messaging.rocketmq.message.delay_time_level" semantic -// conventions. It represents the delay time level for delay message, which -// determines the message delay time. -func MessagingRocketMQMessageDelayTimeLevel(val int) attribute.KeyValue { - return MessagingRocketMQMessageDelayTimeLevelKey.Int(val) -} - -// MessagingRocketMQMessageDeliveryTimestamp returns an attribute KeyValue -// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic -// conventions. It represents the timestamp in milliseconds that the delay -// message is expected to be delivered to consumer. -func MessagingRocketMQMessageDeliveryTimestamp(val int) attribute.KeyValue { - return MessagingRocketMQMessageDeliveryTimestampKey.Int(val) -} - -// MessagingRocketMQMessageGroup returns an attribute KeyValue conforming to the -// "messaging.rocketmq.message.group" semantic conventions. It represents the it -// is essential for FIFO message. Messages that belong to the same message group -// are always processed one by one within the same consumer group. -func MessagingRocketMQMessageGroup(val string) attribute.KeyValue { - return MessagingRocketMQMessageGroupKey.String(val) -} - -// MessagingRocketMQMessageKeys returns an attribute KeyValue conforming to the -// "messaging.rocketmq.message.keys" semantic conventions. It represents the -// key(s) of message, another way to mark message besides message id. -func MessagingRocketMQMessageKeys(val ...string) attribute.KeyValue { - return MessagingRocketMQMessageKeysKey.StringSlice(val) -} - -// MessagingRocketMQMessageTag returns an attribute KeyValue conforming to the -// "messaging.rocketmq.message.tag" semantic conventions. It represents the -// secondary classifier of message besides topic. -func MessagingRocketMQMessageTag(val string) attribute.KeyValue { - return MessagingRocketMQMessageTagKey.String(val) -} - -// MessagingRocketMQNamespace returns an attribute KeyValue conforming to the -// "messaging.rocketmq.namespace" semantic conventions. It represents the -// namespace of RocketMQ resources, resources in different namespaces are -// individual. -func MessagingRocketMQNamespace(val string) attribute.KeyValue { - return MessagingRocketMQNamespaceKey.String(val) -} - -// MessagingServiceBusMessageDeliveryCount returns an attribute KeyValue -// conforming to the "messaging.servicebus.message.delivery_count" semantic -// conventions. It represents the number of deliveries that have been attempted -// for this message. -func MessagingServiceBusMessageDeliveryCount(val int) attribute.KeyValue { - return MessagingServiceBusMessageDeliveryCountKey.Int(val) -} - -// MessagingServiceBusMessageEnqueuedTime returns an attribute KeyValue -// conforming to the "messaging.servicebus.message.enqueued_time" semantic -// conventions. It represents the UTC epoch seconds at which the message has been -// accepted and stored in the entity. -func MessagingServiceBusMessageEnqueuedTime(val int) attribute.KeyValue { - return MessagingServiceBusMessageEnqueuedTimeKey.Int(val) -} - -// Enum values for messaging.operation.type -var ( - // A message is created. "Create" spans always refer to a single message and are - // used to provide a unique creation context for messages in batch sending - // scenarios. - // - // Stability: development - MessagingOperationTypeCreate = MessagingOperationTypeKey.String("create") - // One or more messages are provided for sending to an intermediary. If a single - // message is sent, the context of the "Send" span can be used as the creation - // context and no "Create" span needs to be created. - // - // Stability: development - MessagingOperationTypeSend = MessagingOperationTypeKey.String("send") - // One or more messages are requested by a consumer. This operation refers to - // pull-based scenarios, where consumers explicitly call methods of messaging - // SDKs to receive messages. - // - // Stability: development - MessagingOperationTypeReceive = MessagingOperationTypeKey.String("receive") - // One or more messages are processed by a consumer. - // - // Stability: development - MessagingOperationTypeProcess = MessagingOperationTypeKey.String("process") - // One or more messages are settled. - // - // Stability: development - MessagingOperationTypeSettle = MessagingOperationTypeKey.String("settle") -) - -// Enum values for messaging.rocketmq.consumption_model -var ( - // Clustering consumption model - // Stability: development - MessagingRocketMQConsumptionModelClustering = MessagingRocketMQConsumptionModelKey.String("clustering") - // Broadcasting consumption model - // Stability: development - MessagingRocketMQConsumptionModelBroadcasting = MessagingRocketMQConsumptionModelKey.String("broadcasting") -) - -// Enum values for messaging.rocketmq.message.type -var ( - // Normal message - // Stability: development - MessagingRocketMQMessageTypeNormal = MessagingRocketMQMessageTypeKey.String("normal") - // FIFO message - // Stability: development - MessagingRocketMQMessageTypeFifo = MessagingRocketMQMessageTypeKey.String("fifo") - // Delay message - // Stability: development - MessagingRocketMQMessageTypeDelay = MessagingRocketMQMessageTypeKey.String("delay") - // Transaction message - // Stability: development - MessagingRocketMQMessageTypeTransaction = MessagingRocketMQMessageTypeKey.String("transaction") -) - -// Enum values for messaging.servicebus.disposition_status -var ( - // Message is completed - // Stability: development - MessagingServiceBusDispositionStatusComplete = MessagingServiceBusDispositionStatusKey.String("complete") - // Message is abandoned - // Stability: development - MessagingServiceBusDispositionStatusAbandon = MessagingServiceBusDispositionStatusKey.String("abandon") - // Message is sent to dead letter queue - // Stability: development - MessagingServiceBusDispositionStatusDeadLetter = MessagingServiceBusDispositionStatusKey.String("dead_letter") - // Message is deferred - // Stability: development - MessagingServiceBusDispositionStatusDefer = MessagingServiceBusDispositionStatusKey.String("defer") -) - -// Enum values for messaging.system -var ( - // Apache ActiveMQ - // Stability: development - MessagingSystemActiveMQ = MessagingSystemKey.String("activemq") - // Amazon Simple Notification Service (SNS) - // Stability: development - MessagingSystemAWSSNS = MessagingSystemKey.String("aws.sns") - // Amazon Simple Queue Service (SQS) - // Stability: development - MessagingSystemAWSSQS = MessagingSystemKey.String("aws_sqs") - // Azure Event Grid - // Stability: development - MessagingSystemEventGrid = MessagingSystemKey.String("eventgrid") - // Azure Event Hubs - // Stability: development - MessagingSystemEventHubs = MessagingSystemKey.String("eventhubs") - // Azure Service Bus - // Stability: development - MessagingSystemServiceBus = MessagingSystemKey.String("servicebus") - // Google Cloud Pub/Sub - // Stability: development - MessagingSystemGCPPubSub = MessagingSystemKey.String("gcp_pubsub") - // Java Message Service - // Stability: development - MessagingSystemJMS = MessagingSystemKey.String("jms") - // Apache Kafka - // Stability: development - MessagingSystemKafka = MessagingSystemKey.String("kafka") - // RabbitMQ - // Stability: development - MessagingSystemRabbitMQ = MessagingSystemKey.String("rabbitmq") - // Apache RocketMQ - // Stability: development - MessagingSystemRocketMQ = MessagingSystemKey.String("rocketmq") - // Apache Pulsar - // Stability: development - MessagingSystemPulsar = MessagingSystemKey.String("pulsar") -) - -// Namespace: network -const ( - // NetworkCarrierICCKey is the attribute Key conforming to the - // "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 - // alpha-2 2-character country code associated with the mobile carrier network. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: DE - NetworkCarrierICCKey = attribute.Key("network.carrier.icc") - - // NetworkCarrierMCCKey is the attribute Key conforming to the - // "network.carrier.mcc" semantic conventions. It represents the mobile carrier - // country code. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 310 - NetworkCarrierMCCKey = attribute.Key("network.carrier.mcc") - - // NetworkCarrierMNCKey is the attribute Key conforming to the - // "network.carrier.mnc" semantic conventions. It represents the mobile carrier - // network code. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 001 - NetworkCarrierMNCKey = attribute.Key("network.carrier.mnc") - - // NetworkCarrierNameKey is the attribute Key conforming to the - // "network.carrier.name" semantic conventions. It represents the name of the - // mobile carrier. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: sprint - NetworkCarrierNameKey = attribute.Key("network.carrier.name") - - // NetworkConnectionStateKey is the attribute Key conforming to the - // "network.connection.state" semantic conventions. It represents the state of - // network connection. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "close_wait" - // Note: Connection states are defined as part of the [rfc9293] - // - // [rfc9293]: https://datatracker.ietf.org/doc/html/rfc9293#section-3.3.2 - NetworkConnectionStateKey = attribute.Key("network.connection.state") - - // NetworkConnectionSubtypeKey is the attribute Key conforming to the - // "network.connection.subtype" semantic conventions. It represents the this - // describes more details regarding the connection.type. It may be the type of - // cell technology connection, but it could be used for describing details about - // a wifi connection. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: LTE - NetworkConnectionSubtypeKey = attribute.Key("network.connection.subtype") - - // NetworkConnectionTypeKey is the attribute Key conforming to the - // "network.connection.type" semantic conventions. It represents the internet - // connection type. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: wifi - NetworkConnectionTypeKey = attribute.Key("network.connection.type") - - // NetworkInterfaceNameKey is the attribute Key conforming to the - // "network.interface.name" semantic conventions. It represents the network - // interface name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "lo", "eth0" - NetworkInterfaceNameKey = attribute.Key("network.interface.name") - - // NetworkIODirectionKey is the attribute Key conforming to the - // "network.io.direction" semantic conventions. It represents the network IO - // operation direction. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "transmit" - NetworkIODirectionKey = attribute.Key("network.io.direction") - - // NetworkLocalAddressKey is the attribute Key conforming to the - // "network.local.address" semantic conventions. It represents the local address - // of the network connection - IP address or Unix domain socket name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "10.1.2.80", "/tmp/my.sock" - NetworkLocalAddressKey = attribute.Key("network.local.address") - - // NetworkLocalPortKey is the attribute Key conforming to the - // "network.local.port" semantic conventions. It represents the local port - // number of the network connection. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: 65123 - NetworkLocalPortKey = attribute.Key("network.local.port") - - // NetworkPeerAddressKey is the attribute Key conforming to the - // "network.peer.address" semantic conventions. It represents the peer address - // of the network connection - IP address or Unix domain socket name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "10.1.2.80", "/tmp/my.sock" - NetworkPeerAddressKey = attribute.Key("network.peer.address") - - // NetworkPeerPortKey is the attribute Key conforming to the "network.peer.port" - // semantic conventions. It represents the peer port number of the network - // connection. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: 65123 - NetworkPeerPortKey = attribute.Key("network.peer.port") - - // NetworkProtocolNameKey is the attribute Key conforming to the - // "network.protocol.name" semantic conventions. It represents the - // [OSI application layer] or non-OSI equivalent. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "amqp", "http", "mqtt" - // Note: The value SHOULD be normalized to lowercase. - // - // [OSI application layer]: https://wikipedia.org/wiki/Application_layer - NetworkProtocolNameKey = attribute.Key("network.protocol.name") - - // NetworkProtocolVersionKey is the attribute Key conforming to the - // "network.protocol.version" semantic conventions. It represents the actual - // version of the protocol used for network communication. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "1.1", "2" - // Note: If protocol version is subject to negotiation (for example using [ALPN] - // ), this attribute SHOULD be set to the negotiated version. If the actual - // protocol version is not known, this attribute SHOULD NOT be set. - // - // [ALPN]: https://www.rfc-editor.org/rfc/rfc7301.html - NetworkProtocolVersionKey = attribute.Key("network.protocol.version") - - // NetworkTransportKey is the attribute Key conforming to the - // "network.transport" semantic conventions. It represents the - // [OSI transport layer] or [inter-process communication method]. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "tcp", "udp" - // Note: The value SHOULD be normalized to lowercase. - // - // Consider always setting the transport when setting a port number, since - // a port number is ambiguous without knowing the transport. For example - // different processes could be listening on TCP port 12345 and UDP port 12345. - // - // [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer - // [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication - NetworkTransportKey = attribute.Key("network.transport") - - // NetworkTypeKey is the attribute Key conforming to the "network.type" semantic - // conventions. It represents the [OSI network layer] or non-OSI equivalent. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "ipv4", "ipv6" - // Note: The value SHOULD be normalized to lowercase. - // - // [OSI network layer]: https://wikipedia.org/wiki/Network_layer - NetworkTypeKey = attribute.Key("network.type") -) - -// NetworkCarrierICC returns an attribute KeyValue conforming to the -// "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 -// alpha-2 2-character country code associated with the mobile carrier network. -func NetworkCarrierICC(val string) attribute.KeyValue { - return NetworkCarrierICCKey.String(val) -} - -// NetworkCarrierMCC returns an attribute KeyValue conforming to the -// "network.carrier.mcc" semantic conventions. It represents the mobile carrier -// country code. -func NetworkCarrierMCC(val string) attribute.KeyValue { - return NetworkCarrierMCCKey.String(val) -} - -// NetworkCarrierMNC returns an attribute KeyValue conforming to the -// "network.carrier.mnc" semantic conventions. It represents the mobile carrier -// network code. -func NetworkCarrierMNC(val string) attribute.KeyValue { - return NetworkCarrierMNCKey.String(val) -} - -// NetworkCarrierName returns an attribute KeyValue conforming to the -// "network.carrier.name" semantic conventions. It represents the name of the -// mobile carrier. -func NetworkCarrierName(val string) attribute.KeyValue { - return NetworkCarrierNameKey.String(val) -} - -// NetworkInterfaceName returns an attribute KeyValue conforming to the -// "network.interface.name" semantic conventions. It represents the network -// interface name. -func NetworkInterfaceName(val string) attribute.KeyValue { - return NetworkInterfaceNameKey.String(val) -} - -// NetworkLocalAddress returns an attribute KeyValue conforming to the -// "network.local.address" semantic conventions. It represents the local address -// of the network connection - IP address or Unix domain socket name. -func NetworkLocalAddress(val string) attribute.KeyValue { - return NetworkLocalAddressKey.String(val) -} - -// NetworkLocalPort returns an attribute KeyValue conforming to the -// "network.local.port" semantic conventions. It represents the local port number -// of the network connection. -func NetworkLocalPort(val int) attribute.KeyValue { - return NetworkLocalPortKey.Int(val) -} - -// NetworkPeerAddress returns an attribute KeyValue conforming to the -// "network.peer.address" semantic conventions. It represents the peer address of -// the network connection - IP address or Unix domain socket name. -func NetworkPeerAddress(val string) attribute.KeyValue { - return NetworkPeerAddressKey.String(val) -} - -// NetworkPeerPort returns an attribute KeyValue conforming to the -// "network.peer.port" semantic conventions. It represents the peer port number -// of the network connection. -func NetworkPeerPort(val int) attribute.KeyValue { - return NetworkPeerPortKey.Int(val) -} - -// NetworkProtocolName returns an attribute KeyValue conforming to the -// "network.protocol.name" semantic conventions. It represents the -// [OSI application layer] or non-OSI equivalent. -// -// [OSI application layer]: https://wikipedia.org/wiki/Application_layer -func NetworkProtocolName(val string) attribute.KeyValue { - return NetworkProtocolNameKey.String(val) -} - -// NetworkProtocolVersion returns an attribute KeyValue conforming to the -// "network.protocol.version" semantic conventions. It represents the actual -// version of the protocol used for network communication. -func NetworkProtocolVersion(val string) attribute.KeyValue { - return NetworkProtocolVersionKey.String(val) -} - -// Enum values for network.connection.state -var ( - // closed - // Stability: development - NetworkConnectionStateClosed = NetworkConnectionStateKey.String("closed") - // close_wait - // Stability: development - NetworkConnectionStateCloseWait = NetworkConnectionStateKey.String("close_wait") - // closing - // Stability: development - NetworkConnectionStateClosing = NetworkConnectionStateKey.String("closing") - // established - // Stability: development - NetworkConnectionStateEstablished = NetworkConnectionStateKey.String("established") - // fin_wait_1 - // Stability: development - NetworkConnectionStateFinWait1 = NetworkConnectionStateKey.String("fin_wait_1") - // fin_wait_2 - // Stability: development - NetworkConnectionStateFinWait2 = NetworkConnectionStateKey.String("fin_wait_2") - // last_ack - // Stability: development - NetworkConnectionStateLastAck = NetworkConnectionStateKey.String("last_ack") - // listen - // Stability: development - NetworkConnectionStateListen = NetworkConnectionStateKey.String("listen") - // syn_received - // Stability: development - NetworkConnectionStateSynReceived = NetworkConnectionStateKey.String("syn_received") - // syn_sent - // Stability: development - NetworkConnectionStateSynSent = NetworkConnectionStateKey.String("syn_sent") - // time_wait - // Stability: development - NetworkConnectionStateTimeWait = NetworkConnectionStateKey.String("time_wait") -) - -// Enum values for network.connection.subtype -var ( - // GPRS - // Stability: development - NetworkConnectionSubtypeGprs = NetworkConnectionSubtypeKey.String("gprs") - // EDGE - // Stability: development - NetworkConnectionSubtypeEdge = NetworkConnectionSubtypeKey.String("edge") - // UMTS - // Stability: development - NetworkConnectionSubtypeUmts = NetworkConnectionSubtypeKey.String("umts") - // CDMA - // Stability: development - NetworkConnectionSubtypeCdma = NetworkConnectionSubtypeKey.String("cdma") - // EVDO Rel. 0 - // Stability: development - NetworkConnectionSubtypeEvdo0 = NetworkConnectionSubtypeKey.String("evdo_0") - // EVDO Rev. A - // Stability: development - NetworkConnectionSubtypeEvdoA = NetworkConnectionSubtypeKey.String("evdo_a") - // CDMA2000 1XRTT - // Stability: development - NetworkConnectionSubtypeCdma20001xrtt = NetworkConnectionSubtypeKey.String("cdma2000_1xrtt") - // HSDPA - // Stability: development - NetworkConnectionSubtypeHsdpa = NetworkConnectionSubtypeKey.String("hsdpa") - // HSUPA - // Stability: development - NetworkConnectionSubtypeHsupa = NetworkConnectionSubtypeKey.String("hsupa") - // HSPA - // Stability: development - NetworkConnectionSubtypeHspa = NetworkConnectionSubtypeKey.String("hspa") - // IDEN - // Stability: development - NetworkConnectionSubtypeIden = NetworkConnectionSubtypeKey.String("iden") - // EVDO Rev. B - // Stability: development - NetworkConnectionSubtypeEvdoB = NetworkConnectionSubtypeKey.String("evdo_b") - // LTE - // Stability: development - NetworkConnectionSubtypeLte = NetworkConnectionSubtypeKey.String("lte") - // EHRPD - // Stability: development - NetworkConnectionSubtypeEhrpd = NetworkConnectionSubtypeKey.String("ehrpd") - // HSPAP - // Stability: development - NetworkConnectionSubtypeHspap = NetworkConnectionSubtypeKey.String("hspap") - // GSM - // Stability: development - NetworkConnectionSubtypeGsm = NetworkConnectionSubtypeKey.String("gsm") - // TD-SCDMA - // Stability: development - NetworkConnectionSubtypeTdScdma = NetworkConnectionSubtypeKey.String("td_scdma") - // IWLAN - // Stability: development - NetworkConnectionSubtypeIwlan = NetworkConnectionSubtypeKey.String("iwlan") - // 5G NR (New Radio) - // Stability: development - NetworkConnectionSubtypeNr = NetworkConnectionSubtypeKey.String("nr") - // 5G NRNSA (New Radio Non-Standalone) - // Stability: development - NetworkConnectionSubtypeNrnsa = NetworkConnectionSubtypeKey.String("nrnsa") - // LTE CA - // Stability: development - NetworkConnectionSubtypeLteCa = NetworkConnectionSubtypeKey.String("lte_ca") -) - -// Enum values for network.connection.type -var ( - // wifi - // Stability: development - NetworkConnectionTypeWifi = NetworkConnectionTypeKey.String("wifi") - // wired - // Stability: development - NetworkConnectionTypeWired = NetworkConnectionTypeKey.String("wired") - // cell - // Stability: development - NetworkConnectionTypeCell = NetworkConnectionTypeKey.String("cell") - // unavailable - // Stability: development - NetworkConnectionTypeUnavailable = NetworkConnectionTypeKey.String("unavailable") - // unknown - // Stability: development - NetworkConnectionTypeUnknown = NetworkConnectionTypeKey.String("unknown") -) - -// Enum values for network.io.direction -var ( - // transmit - // Stability: development - NetworkIODirectionTransmit = NetworkIODirectionKey.String("transmit") - // receive - // Stability: development - NetworkIODirectionReceive = NetworkIODirectionKey.String("receive") -) - -// Enum values for network.transport -var ( - // TCP - // Stability: stable - NetworkTransportTCP = NetworkTransportKey.String("tcp") - // UDP - // Stability: stable - NetworkTransportUDP = NetworkTransportKey.String("udp") - // Named or anonymous pipe. - // Stability: stable - NetworkTransportPipe = NetworkTransportKey.String("pipe") - // Unix domain socket - // Stability: stable - NetworkTransportUnix = NetworkTransportKey.String("unix") - // QUIC - // Stability: stable - NetworkTransportQUIC = NetworkTransportKey.String("quic") -) - -// Enum values for network.type -var ( - // IPv4 - // Stability: stable - NetworkTypeIPv4 = NetworkTypeKey.String("ipv4") - // IPv6 - // Stability: stable - NetworkTypeIPv6 = NetworkTypeKey.String("ipv6") -) - -// Namespace: nfs -const ( - // NfsOperationNameKey is the attribute Key conforming to the - // "nfs.operation.name" semantic conventions. It represents the NFSv4+ operation - // name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "OPEN", "READ", "GETATTR" - NfsOperationNameKey = attribute.Key("nfs.operation.name") - - // NfsServerRepcacheStatusKey is the attribute Key conforming to the - // "nfs.server.repcache.status" semantic conventions. It represents the linux: - // one of "hit" (NFSD_STATS_RC_HITS), "miss" (NFSD_STATS_RC_MISSES), or - // "nocache" (NFSD_STATS_RC_NOCACHE -- uncacheable). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: hit - NfsServerRepcacheStatusKey = attribute.Key("nfs.server.repcache.status") -) - -// NfsOperationName returns an attribute KeyValue conforming to the -// "nfs.operation.name" semantic conventions. It represents the NFSv4+ operation -// name. -func NfsOperationName(val string) attribute.KeyValue { - return NfsOperationNameKey.String(val) -} - -// NfsServerRepcacheStatus returns an attribute KeyValue conforming to the -// "nfs.server.repcache.status" semantic conventions. It represents the linux: -// one of "hit" (NFSD_STATS_RC_HITS), "miss" (NFSD_STATS_RC_MISSES), or "nocache" -// (NFSD_STATS_RC_NOCACHE -- uncacheable). -func NfsServerRepcacheStatus(val string) attribute.KeyValue { - return NfsServerRepcacheStatusKey.String(val) -} - -// Namespace: oci -const ( - // OCIManifestDigestKey is the attribute Key conforming to the - // "oci.manifest.digest" semantic conventions. It represents the digest of the - // OCI image manifest. For container images specifically is the digest by which - // the container image is known. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // "sha256:e4ca62c0d62f3e886e684806dfe9d4e0cda60d54986898173c1083856cfda0f4" - // Note: Follows [OCI Image Manifest Specification], and specifically the - // [Digest property]. - // An example can be found in [Example Image Manifest]. - // - // [OCI Image Manifest Specification]: https://github.com/opencontainers/image-spec/blob/main/manifest.md - // [Digest property]: https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests - // [Example Image Manifest]: https://github.com/opencontainers/image-spec/blob/main/manifest.md#example-image-manifest - OCIManifestDigestKey = attribute.Key("oci.manifest.digest") -) - -// OCIManifestDigest returns an attribute KeyValue conforming to the -// "oci.manifest.digest" semantic conventions. It represents the digest of the -// OCI image manifest. For container images specifically is the digest by which -// the container image is known. -func OCIManifestDigest(val string) attribute.KeyValue { - return OCIManifestDigestKey.String(val) -} - -// Namespace: onc_rpc -const ( - // OncRPCProcedureNameKey is the attribute Key conforming to the - // "onc_rpc.procedure.name" semantic conventions. It represents the ONC/Sun RPC - // procedure name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "OPEN", "READ", "GETATTR" - OncRPCProcedureNameKey = attribute.Key("onc_rpc.procedure.name") - - // OncRPCProcedureNumberKey is the attribute Key conforming to the - // "onc_rpc.procedure.number" semantic conventions. It represents the ONC/Sun - // RPC procedure number. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - OncRPCProcedureNumberKey = attribute.Key("onc_rpc.procedure.number") - - // OncRPCProgramNameKey is the attribute Key conforming to the - // "onc_rpc.program.name" semantic conventions. It represents the ONC/Sun RPC - // program name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "portmapper", "nfs" - OncRPCProgramNameKey = attribute.Key("onc_rpc.program.name") - - // OncRPCVersionKey is the attribute Key conforming to the "onc_rpc.version" - // semantic conventions. It represents the ONC/Sun RPC program version. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - OncRPCVersionKey = attribute.Key("onc_rpc.version") -) - -// OncRPCProcedureName returns an attribute KeyValue conforming to the -// "onc_rpc.procedure.name" semantic conventions. It represents the ONC/Sun RPC -// procedure name. -func OncRPCProcedureName(val string) attribute.KeyValue { - return OncRPCProcedureNameKey.String(val) -} - -// OncRPCProcedureNumber returns an attribute KeyValue conforming to the -// "onc_rpc.procedure.number" semantic conventions. It represents the ONC/Sun RPC -// procedure number. -func OncRPCProcedureNumber(val int) attribute.KeyValue { - return OncRPCProcedureNumberKey.Int(val) -} - -// OncRPCProgramName returns an attribute KeyValue conforming to the -// "onc_rpc.program.name" semantic conventions. It represents the ONC/Sun RPC -// program name. -func OncRPCProgramName(val string) attribute.KeyValue { - return OncRPCProgramNameKey.String(val) -} - -// OncRPCVersion returns an attribute KeyValue conforming to the -// "onc_rpc.version" semantic conventions. It represents the ONC/Sun RPC program -// version. -func OncRPCVersion(val int) attribute.KeyValue { - return OncRPCVersionKey.Int(val) -} - -// Namespace: openai -const ( - // OpenAIRequestServiceTierKey is the attribute Key conforming to the - // "openai.request.service_tier" semantic conventions. It represents the service - // tier requested. May be a specific tier, default, or auto. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "auto", "default" - OpenAIRequestServiceTierKey = attribute.Key("openai.request.service_tier") - - // OpenAIResponseServiceTierKey is the attribute Key conforming to the - // "openai.response.service_tier" semantic conventions. It represents the - // service tier used for the response. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "scale", "default" - OpenAIResponseServiceTierKey = attribute.Key("openai.response.service_tier") - - // OpenAIResponseSystemFingerprintKey is the attribute Key conforming to the - // "openai.response.system_fingerprint" semantic conventions. It represents a - // fingerprint to track any eventual change in the Generative AI environment. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "fp_44709d6fcb" - OpenAIResponseSystemFingerprintKey = attribute.Key("openai.response.system_fingerprint") -) - -// OpenAIResponseServiceTier returns an attribute KeyValue conforming to the -// "openai.response.service_tier" semantic conventions. It represents the service -// tier used for the response. -func OpenAIResponseServiceTier(val string) attribute.KeyValue { - return OpenAIResponseServiceTierKey.String(val) -} - -// OpenAIResponseSystemFingerprint returns an attribute KeyValue conforming to -// the "openai.response.system_fingerprint" semantic conventions. It represents a -// fingerprint to track any eventual change in the Generative AI environment. -func OpenAIResponseSystemFingerprint(val string) attribute.KeyValue { - return OpenAIResponseSystemFingerprintKey.String(val) -} - -// Enum values for openai.request.service_tier -var ( - // The system will utilize scale tier credits until they are exhausted. - // Stability: development - OpenAIRequestServiceTierAuto = OpenAIRequestServiceTierKey.String("auto") - // The system will utilize the default scale tier. - // Stability: development - OpenAIRequestServiceTierDefault = OpenAIRequestServiceTierKey.String("default") -) - -// Namespace: openshift -const ( - // OpenShiftClusterquotaNameKey is the attribute Key conforming to the - // "openshift.clusterquota.name" semantic conventions. It represents the name of - // the cluster quota. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "opentelemetry" - OpenShiftClusterquotaNameKey = attribute.Key("openshift.clusterquota.name") - - // OpenShiftClusterquotaUIDKey is the attribute Key conforming to the - // "openshift.clusterquota.uid" semantic conventions. It represents the UID of - // the cluster quota. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" - OpenShiftClusterquotaUIDKey = attribute.Key("openshift.clusterquota.uid") -) - -// OpenShiftClusterquotaName returns an attribute KeyValue conforming to the -// "openshift.clusterquota.name" semantic conventions. It represents the name of -// the cluster quota. -func OpenShiftClusterquotaName(val string) attribute.KeyValue { - return OpenShiftClusterquotaNameKey.String(val) -} - -// OpenShiftClusterquotaUID returns an attribute KeyValue conforming to the -// "openshift.clusterquota.uid" semantic conventions. It represents the UID of -// the cluster quota. -func OpenShiftClusterquotaUID(val string) attribute.KeyValue { - return OpenShiftClusterquotaUIDKey.String(val) -} - -// Namespace: opentracing -const ( - // OpenTracingRefTypeKey is the attribute Key conforming to the - // "opentracing.ref_type" semantic conventions. It represents the parent-child - // Reference type. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: The causal relationship between a child Span and a parent Span. - OpenTracingRefTypeKey = attribute.Key("opentracing.ref_type") -) - -// Enum values for opentracing.ref_type -var ( - // The parent Span depends on the child Span in some capacity - // Stability: development - OpenTracingRefTypeChildOf = OpenTracingRefTypeKey.String("child_of") - // The parent Span doesn't depend in any way on the result of the child Span - // Stability: development - OpenTracingRefTypeFollowsFrom = OpenTracingRefTypeKey.String("follows_from") -) - -// Namespace: os -const ( - // OSBuildIDKey is the attribute Key conforming to the "os.build_id" semantic - // conventions. It represents the unique identifier for a particular build or - // compilation of the operating system. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "TQ3C.230805.001.B2", "20E247", "22621" - OSBuildIDKey = attribute.Key("os.build_id") - - // OSDescriptionKey is the attribute Key conforming to the "os.description" - // semantic conventions. It represents the human readable (not intended to be - // parsed) OS version information, like e.g. reported by `ver` or - // `lsb_release -a` commands. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Microsoft Windows [Version 10.0.18363.778]", "Ubuntu 18.04.1 LTS" - OSDescriptionKey = attribute.Key("os.description") - - // OSNameKey is the attribute Key conforming to the "os.name" semantic - // conventions. It represents the human readable operating system name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "iOS", "Android", "Ubuntu" - OSNameKey = attribute.Key("os.name") - - // OSTypeKey is the attribute Key conforming to the "os.type" semantic - // conventions. It represents the operating system type. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - OSTypeKey = attribute.Key("os.type") - - // OSVersionKey is the attribute Key conforming to the "os.version" semantic - // conventions. It represents the version string of the operating system as - // defined in [Version Attributes]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "14.2.1", "18.04.1" - // - // [Version Attributes]: /docs/resource/README.md#version-attributes - OSVersionKey = attribute.Key("os.version") -) - -// OSBuildID returns an attribute KeyValue conforming to the "os.build_id" -// semantic conventions. It represents the unique identifier for a particular -// build or compilation of the operating system. -func OSBuildID(val string) attribute.KeyValue { - return OSBuildIDKey.String(val) -} - -// OSDescription returns an attribute KeyValue conforming to the "os.description" -// semantic conventions. It represents the human readable (not intended to be -// parsed) OS version information, like e.g. reported by `ver` or -// `lsb_release -a` commands. -func OSDescription(val string) attribute.KeyValue { - return OSDescriptionKey.String(val) -} - -// OSName returns an attribute KeyValue conforming to the "os.name" semantic -// conventions. It represents the human readable operating system name. -func OSName(val string) attribute.KeyValue { - return OSNameKey.String(val) -} - -// OSVersion returns an attribute KeyValue conforming to the "os.version" -// semantic conventions. It represents the version string of the operating system -// as defined in [Version Attributes]. -// -// [Version Attributes]: /docs/resource/README.md#version-attributes -func OSVersion(val string) attribute.KeyValue { - return OSVersionKey.String(val) -} - -// Enum values for os.type -var ( - // Microsoft Windows - // Stability: development - OSTypeWindows = OSTypeKey.String("windows") - // Linux - // Stability: development - OSTypeLinux = OSTypeKey.String("linux") - // Apple Darwin - // Stability: development - OSTypeDarwin = OSTypeKey.String("darwin") - // FreeBSD - // Stability: development - OSTypeFreeBSD = OSTypeKey.String("freebsd") - // NetBSD - // Stability: development - OSTypeNetBSD = OSTypeKey.String("netbsd") - // OpenBSD - // Stability: development - OSTypeOpenBSD = OSTypeKey.String("openbsd") - // DragonFly BSD - // Stability: development - OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") - // HP-UX (Hewlett Packard Unix) - // Stability: development - OSTypeHPUX = OSTypeKey.String("hpux") - // AIX (Advanced Interactive eXecutive) - // Stability: development - OSTypeAIX = OSTypeKey.String("aix") - // SunOS, Oracle Solaris - // Stability: development - OSTypeSolaris = OSTypeKey.String("solaris") - // IBM z/OS - // Stability: development - OSTypeZOS = OSTypeKey.String("zos") -) - -// Namespace: otel -const ( - // OTelComponentNameKey is the attribute Key conforming to the - // "otel.component.name" semantic conventions. It represents a name uniquely - // identifying the instance of the OpenTelemetry component within its containing - // SDK instance. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "otlp_grpc_span_exporter/0", "custom-name" - // Note: Implementations SHOULD ensure a low cardinality for this attribute, - // even across application or SDK restarts. - // E.g. implementations MUST NOT use UUIDs as values for this attribute. - // - // Implementations MAY achieve these goals by following a - // `/` pattern, e.g. - // `batching_span_processor/0`. - // Hereby `otel.component.type` refers to the corresponding attribute value of - // the component. - // - // The value of `instance-counter` MAY be automatically assigned by the - // component and uniqueness within the enclosing SDK instance MUST be - // guaranteed. - // For example, `` MAY be implemented by using a monotonically - // increasing counter (starting with `0`), which is incremented every time an - // instance of the given component type is started. - // - // With this implementation, for example the first Batching Span Processor would - // have `batching_span_processor/0` - // as `otel.component.name`, the second one `batching_span_processor/1` and so - // on. - // These values will therefore be reused in the case of an application restart. - OTelComponentNameKey = attribute.Key("otel.component.name") - - // OTelComponentTypeKey is the attribute Key conforming to the - // "otel.component.type" semantic conventions. It represents a name identifying - // the type of the OpenTelemetry component. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "batching_span_processor", "com.example.MySpanExporter" - // Note: If none of the standardized values apply, implementations SHOULD use - // the language-defined name of the type. - // E.g. for Java the fully qualified classname SHOULD be used in this case. - OTelComponentTypeKey = attribute.Key("otel.component.type") - - // OTelEventNameKey is the attribute Key conforming to the "otel.event.name" - // semantic conventions. It represents the identifies the class / type of event. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "browser.mouse.click", "device.app.lifecycle" - // Note: This attribute SHOULD be used by non-OTLP exporters when destination - // does not support `EventName` or equivalent field. This attribute MAY be used - // by applications using existing logging libraries so that it can be used to - // set the `EventName` field by Collector or SDK components. - OTelEventNameKey = attribute.Key("otel.event.name") - - // OTelScopeNameKey is the attribute Key conforming to the "otel.scope.name" - // semantic conventions. It represents the name of the instrumentation scope - ( - // `InstrumentationScope.Name` in OTLP). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "io.opentelemetry.contrib.mongodb" - OTelScopeNameKey = attribute.Key("otel.scope.name") - - // OTelScopeSchemaURLKey is the attribute Key conforming to the - // "otel.scope.schema_url" semantic conventions. It represents the schema URL of - // the instrumentation scope. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "https://opentelemetry.io/schemas/1.31.0" - OTelScopeSchemaURLKey = attribute.Key("otel.scope.schema_url") - - // OTelScopeVersionKey is the attribute Key conforming to the - // "otel.scope.version" semantic conventions. It represents the version of the - // instrumentation scope - (`InstrumentationScope.Version` in OTLP). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "1.0.0" - OTelScopeVersionKey = attribute.Key("otel.scope.version") - - // OTelSpanParentOriginKey is the attribute Key conforming to the - // "otel.span.parent.origin" semantic conventions. It represents the determines - // whether the span has a parent span, and if so, - // [whether it is a remote parent]. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // - // [whether it is a remote parent]: https://opentelemetry.io/docs/specs/otel/trace/api/#isremote - OTelSpanParentOriginKey = attribute.Key("otel.span.parent.origin") - - // OTelSpanSamplingResultKey is the attribute Key conforming to the - // "otel.span.sampling_result" semantic conventions. It represents the result - // value of the sampler for this span. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - OTelSpanSamplingResultKey = attribute.Key("otel.span.sampling_result") - - // OTelStatusCodeKey is the attribute Key conforming to the "otel.status_code" - // semantic conventions. It represents the name of the code, either "OK" or - // "ERROR". MUST NOT be set if the status code is UNSET. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: - OTelStatusCodeKey = attribute.Key("otel.status_code") - - // OTelStatusDescriptionKey is the attribute Key conforming to the - // "otel.status_description" semantic conventions. It represents the description - // of the Status if it has a value, otherwise not set. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "resource not found" - OTelStatusDescriptionKey = attribute.Key("otel.status_description") -) - -// OTelComponentName returns an attribute KeyValue conforming to the -// "otel.component.name" semantic conventions. It represents a name uniquely -// identifying the instance of the OpenTelemetry component within its containing -// SDK instance. -func OTelComponentName(val string) attribute.KeyValue { - return OTelComponentNameKey.String(val) -} - -// OTelEventName returns an attribute KeyValue conforming to the -// "otel.event.name" semantic conventions. It represents the identifies the class -// / type of event. -func OTelEventName(val string) attribute.KeyValue { - return OTelEventNameKey.String(val) -} - -// OTelScopeName returns an attribute KeyValue conforming to the -// "otel.scope.name" semantic conventions. It represents the name of the -// instrumentation scope - (`InstrumentationScope.Name` in OTLP). -func OTelScopeName(val string) attribute.KeyValue { - return OTelScopeNameKey.String(val) -} - -// OTelScopeSchemaURL returns an attribute KeyValue conforming to the -// "otel.scope.schema_url" semantic conventions. It represents the schema URL of -// the instrumentation scope. -func OTelScopeSchemaURL(val string) attribute.KeyValue { - return OTelScopeSchemaURLKey.String(val) -} - -// OTelScopeVersion returns an attribute KeyValue conforming to the -// "otel.scope.version" semantic conventions. It represents the version of the -// instrumentation scope - (`InstrumentationScope.Version` in OTLP). -func OTelScopeVersion(val string) attribute.KeyValue { - return OTelScopeVersionKey.String(val) -} - -// OTelStatusDescription returns an attribute KeyValue conforming to the -// "otel.status_description" semantic conventions. It represents the description -// of the Status if it has a value, otherwise not set. -func OTelStatusDescription(val string) attribute.KeyValue { - return OTelStatusDescriptionKey.String(val) -} - -// Enum values for otel.component.type -var ( - // The builtin SDK batching span processor - // - // Stability: development - OTelComponentTypeBatchingSpanProcessor = OTelComponentTypeKey.String("batching_span_processor") - // The builtin SDK simple span processor - // - // Stability: development - OTelComponentTypeSimpleSpanProcessor = OTelComponentTypeKey.String("simple_span_processor") - // The builtin SDK batching log record processor - // - // Stability: development - OTelComponentTypeBatchingLogProcessor = OTelComponentTypeKey.String("batching_log_processor") - // The builtin SDK simple log record processor - // - // Stability: development - OTelComponentTypeSimpleLogProcessor = OTelComponentTypeKey.String("simple_log_processor") - // OTLP span exporter over gRPC with protobuf serialization - // - // Stability: development - OTelComponentTypeOtlpGRPCSpanExporter = OTelComponentTypeKey.String("otlp_grpc_span_exporter") - // OTLP span exporter over HTTP with protobuf serialization - // - // Stability: development - OTelComponentTypeOtlpHTTPSpanExporter = OTelComponentTypeKey.String("otlp_http_span_exporter") - // OTLP span exporter over HTTP with JSON serialization - // - // Stability: development - OTelComponentTypeOtlpHTTPJSONSpanExporter = OTelComponentTypeKey.String("otlp_http_json_span_exporter") - // Zipkin span exporter over HTTP - // - // Stability: development - OTelComponentTypeZipkinHTTPSpanExporter = OTelComponentTypeKey.String("zipkin_http_span_exporter") - // OTLP log record exporter over gRPC with protobuf serialization - // - // Stability: development - OTelComponentTypeOtlpGRPCLogExporter = OTelComponentTypeKey.String("otlp_grpc_log_exporter") - // OTLP log record exporter over HTTP with protobuf serialization - // - // Stability: development - OTelComponentTypeOtlpHTTPLogExporter = OTelComponentTypeKey.String("otlp_http_log_exporter") - // OTLP log record exporter over HTTP with JSON serialization - // - // Stability: development - OTelComponentTypeOtlpHTTPJSONLogExporter = OTelComponentTypeKey.String("otlp_http_json_log_exporter") - // The builtin SDK periodically exporting metric reader - // - // Stability: development - OTelComponentTypePeriodicMetricReader = OTelComponentTypeKey.String("periodic_metric_reader") - // OTLP metric exporter over gRPC with protobuf serialization - // - // Stability: development - OTelComponentTypeOtlpGRPCMetricExporter = OTelComponentTypeKey.String("otlp_grpc_metric_exporter") - // OTLP metric exporter over HTTP with protobuf serialization - // - // Stability: development - OTelComponentTypeOtlpHTTPMetricExporter = OTelComponentTypeKey.String("otlp_http_metric_exporter") - // OTLP metric exporter over HTTP with JSON serialization - // - // Stability: development - OTelComponentTypeOtlpHTTPJSONMetricExporter = OTelComponentTypeKey.String("otlp_http_json_metric_exporter") - // Prometheus metric exporter over HTTP with the default text-based format - // - // Stability: development - OTelComponentTypePrometheusHTTPTextMetricExporter = OTelComponentTypeKey.String("prometheus_http_text_metric_exporter") -) - -// Enum values for otel.span.parent.origin -var ( - // The span does not have a parent, it is a root span - // Stability: development - OTelSpanParentOriginNone = OTelSpanParentOriginKey.String("none") - // The span has a parent and the parent's span context [isRemote()] is false - // Stability: development - // - // [isRemote()]: https://opentelemetry.io/docs/specs/otel/trace/api/#isremote - OTelSpanParentOriginLocal = OTelSpanParentOriginKey.String("local") - // The span has a parent and the parent's span context [isRemote()] is true - // Stability: development - // - // [isRemote()]: https://opentelemetry.io/docs/specs/otel/trace/api/#isremote - OTelSpanParentOriginRemote = OTelSpanParentOriginKey.String("remote") -) - -// Enum values for otel.span.sampling_result -var ( - // The span is not sampled and not recording - // Stability: development - OTelSpanSamplingResultDrop = OTelSpanSamplingResultKey.String("DROP") - // The span is not sampled, but recording - // Stability: development - OTelSpanSamplingResultRecordOnly = OTelSpanSamplingResultKey.String("RECORD_ONLY") - // The span is sampled and recording - // Stability: development - OTelSpanSamplingResultRecordAndSample = OTelSpanSamplingResultKey.String("RECORD_AND_SAMPLE") -) - -// Enum values for otel.status_code -var ( - // The operation has been validated by an Application developer or Operator to - // have completed successfully. - // Stability: stable - OTelStatusCodeOk = OTelStatusCodeKey.String("OK") - // The operation contains an error. - // Stability: stable - OTelStatusCodeError = OTelStatusCodeKey.String("ERROR") -) - -// Namespace: pprof -const ( - // PprofLocationIsFoldedKey is the attribute Key conforming to the - // "pprof.location.is_folded" semantic conventions. It represents the provides - // an indication that multiple symbols map to this location's address, for - // example due to identical code folding by the linker. In that case the line - // information represents one of the multiple symbols. This field must be - // recomputed when the symbolization state of the profile changes. - // - // Type: boolean - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - PprofLocationIsFoldedKey = attribute.Key("pprof.location.is_folded") - - // PprofMappingHasFilenamesKey is the attribute Key conforming to the - // "pprof.mapping.has_filenames" semantic conventions. It represents the - // indicates that there are filenames related to this mapping. - // - // Type: boolean - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - PprofMappingHasFilenamesKey = attribute.Key("pprof.mapping.has_filenames") - - // PprofMappingHasFunctionsKey is the attribute Key conforming to the - // "pprof.mapping.has_functions" semantic conventions. It represents the - // indicates that there are functions related to this mapping. - // - // Type: boolean - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - PprofMappingHasFunctionsKey = attribute.Key("pprof.mapping.has_functions") - - // PprofMappingHasInlineFramesKey is the attribute Key conforming to the - // "pprof.mapping.has_inline_frames" semantic conventions. It represents the - // indicates that there are inline frames related to this mapping. - // - // Type: boolean - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - PprofMappingHasInlineFramesKey = attribute.Key("pprof.mapping.has_inline_frames") - - // PprofMappingHasLineNumbersKey is the attribute Key conforming to the - // "pprof.mapping.has_line_numbers" semantic conventions. It represents the - // indicates that there are line numbers related to this mapping. - // - // Type: boolean - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - PprofMappingHasLineNumbersKey = attribute.Key("pprof.mapping.has_line_numbers") - - // PprofProfileCommentKey is the attribute Key conforming to the - // "pprof.profile.comment" semantic conventions. It represents the free-form - // text associated with the profile. This field should not be used to store any - // machine-readable information, it is only for human-friendly content. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "hello world", "bazinga" - PprofProfileCommentKey = attribute.Key("pprof.profile.comment") - - // PprofProfileDocURLKey is the attribute Key conforming to the - // "pprof.profile.doc_url" semantic conventions. It represents the documentation - // link for this profile type. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "http://pprof.example.com/cpu-profile.html" - // Note: The URL must be absolute and may be missing if the profile was - // generated by code that did not supply a link - PprofProfileDocURLKey = attribute.Key("pprof.profile.doc_url") - - // PprofProfileDropFramesKey is the attribute Key conforming to the - // "pprof.profile.drop_frames" semantic conventions. It represents the frames - // with Function.function_name fully matching the regexp will be dropped from - // the samples, along with their successors. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "/foobar/" - PprofProfileDropFramesKey = attribute.Key("pprof.profile.drop_frames") - - // PprofProfileKeepFramesKey is the attribute Key conforming to the - // "pprof.profile.keep_frames" semantic conventions. It represents the frames - // with Function.function_name fully matching the regexp will be kept, even if - // it matches drop_frames. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "/bazinga/" - PprofProfileKeepFramesKey = attribute.Key("pprof.profile.keep_frames") -) - -// PprofLocationIsFolded returns an attribute KeyValue conforming to the -// "pprof.location.is_folded" semantic conventions. It represents the provides an -// indication that multiple symbols map to this location's address, for example -// due to identical code folding by the linker. In that case the line information -// represents one of the multiple symbols. This field must be recomputed when the -// symbolization state of the profile changes. -func PprofLocationIsFolded(val bool) attribute.KeyValue { - return PprofLocationIsFoldedKey.Bool(val) -} - -// PprofMappingHasFilenames returns an attribute KeyValue conforming to the -// "pprof.mapping.has_filenames" semantic conventions. It represents the -// indicates that there are filenames related to this mapping. -func PprofMappingHasFilenames(val bool) attribute.KeyValue { - return PprofMappingHasFilenamesKey.Bool(val) -} - -// PprofMappingHasFunctions returns an attribute KeyValue conforming to the -// "pprof.mapping.has_functions" semantic conventions. It represents the -// indicates that there are functions related to this mapping. -func PprofMappingHasFunctions(val bool) attribute.KeyValue { - return PprofMappingHasFunctionsKey.Bool(val) -} - -// PprofMappingHasInlineFrames returns an attribute KeyValue conforming to the -// "pprof.mapping.has_inline_frames" semantic conventions. It represents the -// indicates that there are inline frames related to this mapping. -func PprofMappingHasInlineFrames(val bool) attribute.KeyValue { - return PprofMappingHasInlineFramesKey.Bool(val) -} - -// PprofMappingHasLineNumbers returns an attribute KeyValue conforming to the -// "pprof.mapping.has_line_numbers" semantic conventions. It represents the -// indicates that there are line numbers related to this mapping. -func PprofMappingHasLineNumbers(val bool) attribute.KeyValue { - return PprofMappingHasLineNumbersKey.Bool(val) -} - -// PprofProfileComment returns an attribute KeyValue conforming to the -// "pprof.profile.comment" semantic conventions. It represents the free-form text -// associated with the profile. This field should not be used to store any -// machine-readable information, it is only for human-friendly content. -func PprofProfileComment(val ...string) attribute.KeyValue { - return PprofProfileCommentKey.StringSlice(val) -} - -// PprofProfileDocURL returns an attribute KeyValue conforming to the -// "pprof.profile.doc_url" semantic conventions. It represents the documentation -// link for this profile type. -func PprofProfileDocURL(val string) attribute.KeyValue { - return PprofProfileDocURLKey.String(val) -} - -// PprofProfileDropFrames returns an attribute KeyValue conforming to the -// "pprof.profile.drop_frames" semantic conventions. It represents the frames -// with Function.function_name fully matching the regexp will be dropped from the -// samples, along with their successors. -func PprofProfileDropFrames(val string) attribute.KeyValue { - return PprofProfileDropFramesKey.String(val) -} - -// PprofProfileKeepFrames returns an attribute KeyValue conforming to the -// "pprof.profile.keep_frames" semantic conventions. It represents the frames -// with Function.function_name fully matching the regexp will be kept, even if it -// matches drop_frames. -func PprofProfileKeepFrames(val string) attribute.KeyValue { - return PprofProfileKeepFramesKey.String(val) -} - -// Namespace: process -const ( - // ProcessArgsCountKey is the attribute Key conforming to the - // "process.args_count" semantic conventions. It represents the length of the - // process.command_args array. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 4 - // Note: This field can be useful for querying or performing bucket analysis on - // how many arguments were provided to start a process. More arguments may be an - // indication of suspicious activity. - ProcessArgsCountKey = attribute.Key("process.args_count") - - // ProcessCommandKey is the attribute Key conforming to the "process.command" - // semantic conventions. It represents the command used to launch the process - // (i.e. the command name). On Linux based systems, can be set to the zeroth - // string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter - // extracted from `GetCommandLineW`. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "cmd/otelcol" - ProcessCommandKey = attribute.Key("process.command") - - // ProcessCommandArgsKey is the attribute Key conforming to the - // "process.command_args" semantic conventions. It represents the all the - // command arguments (including the command/executable itself) as received by - // the process. On Linux-based systems (and some other Unixoid systems - // supporting procfs), can be set according to the list of null-delimited - // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, this - // would be the full argv vector passed to `main`. SHOULD NOT be collected by - // default unless there is sanitization that excludes sensitive data. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "cmd/otecol", "--config=config.yaml" - ProcessCommandArgsKey = attribute.Key("process.command_args") - - // ProcessCommandLineKey is the attribute Key conforming to the - // "process.command_line" semantic conventions. It represents the full command - // used to launch the process as a single string representing the full command. - // On Windows, can be set to the result of `GetCommandLineW`. Do not set this if - // you have to assemble it just for monitoring; use `process.command_args` - // instead. SHOULD NOT be collected by default unless there is sanitization that - // excludes sensitive data. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "C:\cmd\otecol --config="my directory\config.yaml"" - ProcessCommandLineKey = attribute.Key("process.command_line") - - // ProcessContextSwitchTypeKey is the attribute Key conforming to the - // "process.context_switch.type" semantic conventions. It represents the - // specifies whether the context switches for this data point were voluntary or - // involuntary. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - ProcessContextSwitchTypeKey = attribute.Key("process.context_switch.type") - - // ProcessCreationTimeKey is the attribute Key conforming to the - // "process.creation.time" semantic conventions. It represents the date and time - // the process was created, in ISO 8601 format. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "2023-11-21T09:25:34.853Z" - ProcessCreationTimeKey = attribute.Key("process.creation.time") - - // ProcessExecutableBuildIDGNUKey is the attribute Key conforming to the - // "process.executable.build_id.gnu" semantic conventions. It represents the GNU - // build ID as found in the `.note.gnu.build-id` ELF section (hex string). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "c89b11207f6479603b0d49bf291c092c2b719293" - ProcessExecutableBuildIDGNUKey = attribute.Key("process.executable.build_id.gnu") - - // ProcessExecutableBuildIDGoKey is the attribute Key conforming to the - // "process.executable.build_id.go" semantic conventions. It represents the Go - // build ID as retrieved by `go tool buildid `. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // "foh3mEXu7BLZjsN9pOwG/kATcXlYVCDEFouRMQed_/WwRFB1hPo9LBkekthSPG/x8hMC8emW2cCjXD0_1aY" - ProcessExecutableBuildIDGoKey = attribute.Key("process.executable.build_id.go") - - // ProcessExecutableBuildIDHtlhashKey is the attribute Key conforming to the - // "process.executable.build_id.htlhash" semantic conventions. It represents the - // profiling specific build ID for executables. See the OTel specification for - // Profiles for more information. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "600DCAFE4A110000F2BF38C493F5FB92" - ProcessExecutableBuildIDHtlhashKey = attribute.Key("process.executable.build_id.htlhash") - - // ProcessExecutableNameKey is the attribute Key conforming to the - // "process.executable.name" semantic conventions. It represents the name of the - // process executable. On Linux based systems, this SHOULD be set to the base - // name of the target of `/proc/[pid]/exe`. On Windows, this SHOULD be set to - // the base name of `GetProcessImageFileNameW`. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "otelcol" - ProcessExecutableNameKey = attribute.Key("process.executable.name") - - // ProcessExecutablePathKey is the attribute Key conforming to the - // "process.executable.path" semantic conventions. It represents the full path - // to the process executable. On Linux based systems, can be set to the target - // of `proc/[pid]/exe`. On Windows, can be set to the result of - // `GetProcessImageFileNameW`. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "/usr/bin/cmd/otelcol" - ProcessExecutablePathKey = attribute.Key("process.executable.path") - - // ProcessExitCodeKey is the attribute Key conforming to the "process.exit.code" - // semantic conventions. It represents the exit code of the process. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 127 - ProcessExitCodeKey = attribute.Key("process.exit.code") - - // ProcessExitTimeKey is the attribute Key conforming to the "process.exit.time" - // semantic conventions. It represents the date and time the process exited, in - // ISO 8601 format. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "2023-11-21T09:26:12.315Z" - ProcessExitTimeKey = attribute.Key("process.exit.time") - - // ProcessGroupLeaderPIDKey is the attribute Key conforming to the - // "process.group_leader.pid" semantic conventions. It represents the PID of the - // process's group leader. This is also the process group ID (PGID) of the - // process. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 23 - ProcessGroupLeaderPIDKey = attribute.Key("process.group_leader.pid") - - // ProcessInteractiveKey is the attribute Key conforming to the - // "process.interactive" semantic conventions. It represents the whether the - // process is connected to an interactive shell. - // - // Type: boolean - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - ProcessInteractiveKey = attribute.Key("process.interactive") - - // ProcessLinuxCgroupKey is the attribute Key conforming to the - // "process.linux.cgroup" semantic conventions. It represents the control group - // associated with the process. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "1:name=systemd:/user.slice/user-1000.slice/session-3.scope", - // "0::/user.slice/user-1000.slice/user@1000.service/tmux-spawn-0267755b-4639-4a27-90ed-f19f88e53748.scope" - // Note: Control groups (cgroups) are a kernel feature used to organize and - // manage process resources. This attribute provides the path(s) to the - // cgroup(s) associated with the process, which should match the contents of the - // [/proc/[PID]/cgroup] file. - // - // [/proc/[PID]/cgroup]: https://man7.org/linux/man-pages/man7/cgroups.7.html - ProcessLinuxCgroupKey = attribute.Key("process.linux.cgroup") - - // ProcessOwnerKey is the attribute Key conforming to the "process.owner" - // semantic conventions. It represents the username of the user that owns the - // process. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "root" - ProcessOwnerKey = attribute.Key("process.owner") - - // ProcessParentPIDKey is the attribute Key conforming to the - // "process.parent_pid" semantic conventions. It represents the parent Process - // identifier (PPID). - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 111 - ProcessParentPIDKey = attribute.Key("process.parent_pid") - - // ProcessPIDKey is the attribute Key conforming to the "process.pid" semantic - // conventions. It represents the process identifier (PID). - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 1234 - ProcessPIDKey = attribute.Key("process.pid") - - // ProcessRealUserIDKey is the attribute Key conforming to the - // "process.real_user.id" semantic conventions. It represents the real user ID - // (RUID) of the process. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 1000 - ProcessRealUserIDKey = attribute.Key("process.real_user.id") - - // ProcessRealUserNameKey is the attribute Key conforming to the - // "process.real_user.name" semantic conventions. It represents the username of - // the real user of the process. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "operator" - ProcessRealUserNameKey = attribute.Key("process.real_user.name") - - // ProcessRuntimeDescriptionKey is the attribute Key conforming to the - // "process.runtime.description" semantic conventions. It represents an - // additional description about the runtime of the process, for example a - // specific vendor customization of the runtime environment. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0 - ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") - - // ProcessRuntimeNameKey is the attribute Key conforming to the - // "process.runtime.name" semantic conventions. It represents the name of the - // runtime of this process. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "OpenJDK Runtime Environment" - ProcessRuntimeNameKey = attribute.Key("process.runtime.name") - - // ProcessRuntimeVersionKey is the attribute Key conforming to the - // "process.runtime.version" semantic conventions. It represents the version of - // the runtime of this process, as returned by the runtime without modification. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 14.0.2 - ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") - - // ProcessSavedUserIDKey is the attribute Key conforming to the - // "process.saved_user.id" semantic conventions. It represents the saved user ID - // (SUID) of the process. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 1002 - ProcessSavedUserIDKey = attribute.Key("process.saved_user.id") - - // ProcessSavedUserNameKey is the attribute Key conforming to the - // "process.saved_user.name" semantic conventions. It represents the username of - // the saved user. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "operator" - ProcessSavedUserNameKey = attribute.Key("process.saved_user.name") - - // ProcessSessionLeaderPIDKey is the attribute Key conforming to the - // "process.session_leader.pid" semantic conventions. It represents the PID of - // the process's session leader. This is also the session ID (SID) of the - // process. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 14 - ProcessSessionLeaderPIDKey = attribute.Key("process.session_leader.pid") - - // ProcessStateKey is the attribute Key conforming to the "process.state" - // semantic conventions. It represents the process state, e.g., - // [Linux Process State Codes]. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "running" - // - // [Linux Process State Codes]: https://man7.org/linux/man-pages/man1/ps.1.html#PROCESS_STATE_CODES - ProcessStateKey = attribute.Key("process.state") - - // ProcessTitleKey is the attribute Key conforming to the "process.title" - // semantic conventions. It represents the process title (proctitle). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "cat /etc/hostname", "xfce4-session", "bash" - // Note: In many Unix-like systems, process title (proctitle), is the string - // that represents the name or command line of a running process, displayed by - // system monitoring tools like ps, top, and htop. - ProcessTitleKey = attribute.Key("process.title") - - // ProcessUserIDKey is the attribute Key conforming to the "process.user.id" - // semantic conventions. It represents the effective user ID (EUID) of the - // process. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 1001 - ProcessUserIDKey = attribute.Key("process.user.id") - - // ProcessUserNameKey is the attribute Key conforming to the "process.user.name" - // semantic conventions. It represents the username of the effective user of the - // process. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "root" - ProcessUserNameKey = attribute.Key("process.user.name") - - // ProcessVpidKey is the attribute Key conforming to the "process.vpid" semantic - // conventions. It represents the virtual process identifier. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 12 - // Note: The process ID within a PID namespace. This is not necessarily unique - // across all processes on the host but it is unique within the process - // namespace that the process exists within. - ProcessVpidKey = attribute.Key("process.vpid") - - // ProcessWorkingDirectoryKey is the attribute Key conforming to the - // "process.working_directory" semantic conventions. It represents the working - // directory of the process. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "/root" - ProcessWorkingDirectoryKey = attribute.Key("process.working_directory") -) - -// ProcessArgsCount returns an attribute KeyValue conforming to the -// "process.args_count" semantic conventions. It represents the length of the -// process.command_args array. -func ProcessArgsCount(val int) attribute.KeyValue { - return ProcessArgsCountKey.Int(val) -} - -// ProcessCommand returns an attribute KeyValue conforming to the -// "process.command" semantic conventions. It represents the command used to -// launch the process (i.e. the command name). On Linux based systems, can be set -// to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the -// first parameter extracted from `GetCommandLineW`. -func ProcessCommand(val string) attribute.KeyValue { - return ProcessCommandKey.String(val) -} - -// ProcessCommandArgs returns an attribute KeyValue conforming to the -// "process.command_args" semantic conventions. It represents the all the command -// arguments (including the command/executable itself) as received by the -// process. On Linux-based systems (and some other Unixoid systems supporting -// procfs), can be set according to the list of null-delimited strings extracted -// from `proc/[pid]/cmdline`. For libc-based executables, this would be the full -// argv vector passed to `main`. SHOULD NOT be collected by default unless there -// is sanitization that excludes sensitive data. -func ProcessCommandArgs(val ...string) attribute.KeyValue { - return ProcessCommandArgsKey.StringSlice(val) -} - -// ProcessCommandLine returns an attribute KeyValue conforming to the -// "process.command_line" semantic conventions. It represents the full command -// used to launch the process as a single string representing the full command. -// On Windows, can be set to the result of `GetCommandLineW`. Do not set this if -// you have to assemble it just for monitoring; use `process.command_args` -// instead. SHOULD NOT be collected by default unless there is sanitization that -// excludes sensitive data. -func ProcessCommandLine(val string) attribute.KeyValue { - return ProcessCommandLineKey.String(val) -} - -// ProcessCreationTime returns an attribute KeyValue conforming to the -// "process.creation.time" semantic conventions. It represents the date and time -// the process was created, in ISO 8601 format. -func ProcessCreationTime(val string) attribute.KeyValue { - return ProcessCreationTimeKey.String(val) -} - -// ProcessEnvironmentVariable returns an attribute KeyValue conforming to the -// "process.environment_variable" semantic conventions. It represents the process -// environment variables, `` being the environment variable name, the value -// being the environment variable value. -func ProcessEnvironmentVariable(key string, val string) attribute.KeyValue { - return attribute.String("process.environment_variable."+key, val) -} - -// ProcessExecutableBuildIDGNU returns an attribute KeyValue conforming to the -// "process.executable.build_id.gnu" semantic conventions. It represents the GNU -// build ID as found in the `.note.gnu.build-id` ELF section (hex string). -func ProcessExecutableBuildIDGNU(val string) attribute.KeyValue { - return ProcessExecutableBuildIDGNUKey.String(val) -} - -// ProcessExecutableBuildIDGo returns an attribute KeyValue conforming to the -// "process.executable.build_id.go" semantic conventions. It represents the Go -// build ID as retrieved by `go tool buildid `. -func ProcessExecutableBuildIDGo(val string) attribute.KeyValue { - return ProcessExecutableBuildIDGoKey.String(val) -} - -// ProcessExecutableBuildIDHtlhash returns an attribute KeyValue conforming to -// the "process.executable.build_id.htlhash" semantic conventions. It represents -// the profiling specific build ID for executables. See the OTel specification -// for Profiles for more information. -func ProcessExecutableBuildIDHtlhash(val string) attribute.KeyValue { - return ProcessExecutableBuildIDHtlhashKey.String(val) -} - -// ProcessExecutableName returns an attribute KeyValue conforming to the -// "process.executable.name" semantic conventions. It represents the name of the -// process executable. On Linux based systems, this SHOULD be set to the base -// name of the target of `/proc/[pid]/exe`. On Windows, this SHOULD be set to the -// base name of `GetProcessImageFileNameW`. -func ProcessExecutableName(val string) attribute.KeyValue { - return ProcessExecutableNameKey.String(val) -} - -// ProcessExecutablePath returns an attribute KeyValue conforming to the -// "process.executable.path" semantic conventions. It represents the full path to -// the process executable. On Linux based systems, can be set to the target of -// `proc/[pid]/exe`. On Windows, can be set to the result of -// `GetProcessImageFileNameW`. -func ProcessExecutablePath(val string) attribute.KeyValue { - return ProcessExecutablePathKey.String(val) -} - -// ProcessExitCode returns an attribute KeyValue conforming to the -// "process.exit.code" semantic conventions. It represents the exit code of the -// process. -func ProcessExitCode(val int) attribute.KeyValue { - return ProcessExitCodeKey.Int(val) -} - -// ProcessExitTime returns an attribute KeyValue conforming to the -// "process.exit.time" semantic conventions. It represents the date and time the -// process exited, in ISO 8601 format. -func ProcessExitTime(val string) attribute.KeyValue { - return ProcessExitTimeKey.String(val) -} - -// ProcessGroupLeaderPID returns an attribute KeyValue conforming to the -// "process.group_leader.pid" semantic conventions. It represents the PID of the -// process's group leader. This is also the process group ID (PGID) of the -// process. -func ProcessGroupLeaderPID(val int) attribute.KeyValue { - return ProcessGroupLeaderPIDKey.Int(val) -} - -// ProcessInteractive returns an attribute KeyValue conforming to the -// "process.interactive" semantic conventions. It represents the whether the -// process is connected to an interactive shell. -func ProcessInteractive(val bool) attribute.KeyValue { - return ProcessInteractiveKey.Bool(val) -} - -// ProcessLinuxCgroup returns an attribute KeyValue conforming to the -// "process.linux.cgroup" semantic conventions. It represents the control group -// associated with the process. -func ProcessLinuxCgroup(val string) attribute.KeyValue { - return ProcessLinuxCgroupKey.String(val) -} - -// ProcessOwner returns an attribute KeyValue conforming to the "process.owner" -// semantic conventions. It represents the username of the user that owns the -// process. -func ProcessOwner(val string) attribute.KeyValue { - return ProcessOwnerKey.String(val) -} - -// ProcessParentPID returns an attribute KeyValue conforming to the -// "process.parent_pid" semantic conventions. It represents the parent Process -// identifier (PPID). -func ProcessParentPID(val int) attribute.KeyValue { - return ProcessParentPIDKey.Int(val) -} - -// ProcessPID returns an attribute KeyValue conforming to the "process.pid" -// semantic conventions. It represents the process identifier (PID). -func ProcessPID(val int) attribute.KeyValue { - return ProcessPIDKey.Int(val) -} - -// ProcessRealUserID returns an attribute KeyValue conforming to the -// "process.real_user.id" semantic conventions. It represents the real user ID -// (RUID) of the process. -func ProcessRealUserID(val int) attribute.KeyValue { - return ProcessRealUserIDKey.Int(val) -} - -// ProcessRealUserName returns an attribute KeyValue conforming to the -// "process.real_user.name" semantic conventions. It represents the username of -// the real user of the process. -func ProcessRealUserName(val string) attribute.KeyValue { - return ProcessRealUserNameKey.String(val) -} - -// ProcessRuntimeDescription returns an attribute KeyValue conforming to the -// "process.runtime.description" semantic conventions. It represents an -// additional description about the runtime of the process, for example a -// specific vendor customization of the runtime environment. -func ProcessRuntimeDescription(val string) attribute.KeyValue { - return ProcessRuntimeDescriptionKey.String(val) -} - -// ProcessRuntimeName returns an attribute KeyValue conforming to the -// "process.runtime.name" semantic conventions. It represents the name of the -// runtime of this process. -func ProcessRuntimeName(val string) attribute.KeyValue { - return ProcessRuntimeNameKey.String(val) -} - -// ProcessRuntimeVersion returns an attribute KeyValue conforming to the -// "process.runtime.version" semantic conventions. It represents the version of -// the runtime of this process, as returned by the runtime without modification. -func ProcessRuntimeVersion(val string) attribute.KeyValue { - return ProcessRuntimeVersionKey.String(val) -} - -// ProcessSavedUserID returns an attribute KeyValue conforming to the -// "process.saved_user.id" semantic conventions. It represents the saved user ID -// (SUID) of the process. -func ProcessSavedUserID(val int) attribute.KeyValue { - return ProcessSavedUserIDKey.Int(val) -} - -// ProcessSavedUserName returns an attribute KeyValue conforming to the -// "process.saved_user.name" semantic conventions. It represents the username of -// the saved user. -func ProcessSavedUserName(val string) attribute.KeyValue { - return ProcessSavedUserNameKey.String(val) -} - -// ProcessSessionLeaderPID returns an attribute KeyValue conforming to the -// "process.session_leader.pid" semantic conventions. It represents the PID of -// the process's session leader. This is also the session ID (SID) of the -// process. -func ProcessSessionLeaderPID(val int) attribute.KeyValue { - return ProcessSessionLeaderPIDKey.Int(val) -} - -// ProcessTitle returns an attribute KeyValue conforming to the "process.title" -// semantic conventions. It represents the process title (proctitle). -func ProcessTitle(val string) attribute.KeyValue { - return ProcessTitleKey.String(val) -} - -// ProcessUserID returns an attribute KeyValue conforming to the -// "process.user.id" semantic conventions. It represents the effective user ID -// (EUID) of the process. -func ProcessUserID(val int) attribute.KeyValue { - return ProcessUserIDKey.Int(val) -} - -// ProcessUserName returns an attribute KeyValue conforming to the -// "process.user.name" semantic conventions. It represents the username of the -// effective user of the process. -func ProcessUserName(val string) attribute.KeyValue { - return ProcessUserNameKey.String(val) -} - -// ProcessVpid returns an attribute KeyValue conforming to the "process.vpid" -// semantic conventions. It represents the virtual process identifier. -func ProcessVpid(val int) attribute.KeyValue { - return ProcessVpidKey.Int(val) -} - -// ProcessWorkingDirectory returns an attribute KeyValue conforming to the -// "process.working_directory" semantic conventions. It represents the working -// directory of the process. -func ProcessWorkingDirectory(val string) attribute.KeyValue { - return ProcessWorkingDirectoryKey.String(val) -} - -// Enum values for process.context_switch.type -var ( - // voluntary - // Stability: development - ProcessContextSwitchTypeVoluntary = ProcessContextSwitchTypeKey.String("voluntary") - // involuntary - // Stability: development - ProcessContextSwitchTypeInvoluntary = ProcessContextSwitchTypeKey.String("involuntary") -) - -// Enum values for process.state -var ( - // running - // Stability: development - ProcessStateRunning = ProcessStateKey.String("running") - // sleeping - // Stability: development - ProcessStateSleeping = ProcessStateKey.String("sleeping") - // stopped - // Stability: development - ProcessStateStopped = ProcessStateKey.String("stopped") - // defunct - // Stability: development - ProcessStateDefunct = ProcessStateKey.String("defunct") -) - -// Namespace: profile -const ( - // ProfileFrameTypeKey is the attribute Key conforming to the - // "profile.frame.type" semantic conventions. It represents the describes the - // interpreter or compiler of a single frame. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "cpython" - ProfileFrameTypeKey = attribute.Key("profile.frame.type") -) - -// Enum values for profile.frame.type -var ( - // [.NET] - // - // Stability: development - // - // [.NET]: https://wikipedia.org/wiki/.NET - ProfileFrameTypeDotnet = ProfileFrameTypeKey.String("dotnet") - // [JVM] - // - // Stability: development - // - // [JVM]: https://wikipedia.org/wiki/Java_virtual_machine - ProfileFrameTypeJVM = ProfileFrameTypeKey.String("jvm") - // [Kernel] - // - // Stability: development - // - // [Kernel]: https://wikipedia.org/wiki/Kernel_(operating_system) - ProfileFrameTypeKernel = ProfileFrameTypeKey.String("kernel") - // Can be one of but not limited to [C], [C++], [Go] or [Rust]. If possible, a - // more precise value MUST be used. - // - // Stability: development - // - // [C]: https://wikipedia.org/wiki/C_(programming_language) - // [C++]: https://wikipedia.org/wiki/C%2B%2B - // [Go]: https://wikipedia.org/wiki/Go_(programming_language) - // [Rust]: https://wikipedia.org/wiki/Rust_(programming_language) - ProfileFrameTypeNative = ProfileFrameTypeKey.String("native") - // [Perl] - // - // Stability: development - // - // [Perl]: https://wikipedia.org/wiki/Perl - ProfileFrameTypePerl = ProfileFrameTypeKey.String("perl") - // [PHP] - // - // Stability: development - // - // [PHP]: https://wikipedia.org/wiki/PHP - ProfileFrameTypePHP = ProfileFrameTypeKey.String("php") - // [Python] - // - // Stability: development - // - // [Python]: https://wikipedia.org/wiki/Python_(programming_language) - ProfileFrameTypeCpython = ProfileFrameTypeKey.String("cpython") - // [Ruby] - // - // Stability: development - // - // [Ruby]: https://wikipedia.org/wiki/Ruby_(programming_language) - ProfileFrameTypeRuby = ProfileFrameTypeKey.String("ruby") - // [V8JS] - // - // Stability: development - // - // [V8JS]: https://wikipedia.org/wiki/V8_(JavaScript_engine) - ProfileFrameTypeV8JS = ProfileFrameTypeKey.String("v8js") - // [Erlang] - // - // Stability: development - // - // [Erlang]: https://en.wikipedia.org/wiki/BEAM_(Erlang_virtual_machine) - ProfileFrameTypeBeam = ProfileFrameTypeKey.String("beam") - // [Go], - // - // Stability: development - // - // [Go]: https://wikipedia.org/wiki/Go_(programming_language) - ProfileFrameTypeGo = ProfileFrameTypeKey.String("go") - // [Rust] - // - // Stability: development - // - // [Rust]: https://wikipedia.org/wiki/Rust_(programming_language) - ProfileFrameTypeRust = ProfileFrameTypeKey.String("rust") -) - -// Namespace: rpc -const ( - // RPCMessageCompressedSizeKey is the attribute Key conforming to the - // "rpc.message.compressed_size" semantic conventions. It represents the - // compressed size of the message in bytes. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - RPCMessageCompressedSizeKey = attribute.Key("rpc.message.compressed_size") - - // RPCMessageIDKey is the attribute Key conforming to the "rpc.message.id" - // semantic conventions. It MUST be calculated as two different counters - // starting from `1` one for sent messages and one for received message.. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: This way we guarantee that the values will be consistent between - // different implementations. - RPCMessageIDKey = attribute.Key("rpc.message.id") - - // RPCMessageTypeKey is the attribute Key conforming to the "rpc.message.type" - // semantic conventions. It represents the whether this is a received or sent - // message. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - RPCMessageTypeKey = attribute.Key("rpc.message.type") - - // RPCMessageUncompressedSizeKey is the attribute Key conforming to the - // "rpc.message.uncompressed_size" semantic conventions. It represents the - // uncompressed size of the message in bytes. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - RPCMessageUncompressedSizeKey = attribute.Key("rpc.message.uncompressed_size") - - // RPCMethodKey is the attribute Key conforming to the "rpc.method" semantic - // conventions. It represents the fully-qualified logical name of the method - // from the RPC interface perspective. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "com.example.ExampleService/exampleMethod", "EchoService/Echo", - // "_OTHER" - // Note: The method name MAY have unbounded cardinality in edge or error cases. - // - // Some RPC frameworks or libraries provide a fixed set of recognized methods - // for client stubs and server implementations. Instrumentations for such - // frameworks MUST set this attribute to the original method name only - // when the method is recognized by the framework or library. - // - // When the method is not recognized, for example, when the server receives - // a request for a method that is not predefined on the server, or when - // instrumentation is not able to reliably detect if the method is predefined, - // the attribute MUST be set to `_OTHER`. In such cases, tracing - // instrumentations MUST also set `rpc.method_original` attribute to - // the original method value. - // - // If the RPC instrumentation could end up converting valid RPC methods to - // `_OTHER`, then it SHOULD provide a way to configure the list of recognized - // RPC methods. - // - // The `rpc.method` can be different from the name of any implementing - // method/function. - // The `code.function.name` attribute may be used to record the fully-qualified - // method actually executing the call on the server side, or the - // RPC client stub method on the client side. - RPCMethodKey = attribute.Key("rpc.method") - - // RPCMethodOriginalKey is the attribute Key conforming to the - // "rpc.method_original" semantic conventions. It represents the original name - // of the method used by the client. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "com.myservice.EchoService/catchAll", - // "com.myservice.EchoService/unknownMethod", "InvalidMethod" - RPCMethodOriginalKey = attribute.Key("rpc.method_original") - - // RPCResponseStatusCodeKey is the attribute Key conforming to the - // "rpc.response.status_code" semantic conventions. It represents the status - // code of the RPC returned by the RPC server or generated by the client. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "OK", "DEADLINE_EXCEEDED", "-32602" - // Note: Usually it represents an error code, but may also represent partial - // success, warning, or differentiate between various types of successful - // outcomes. - // Semantic conventions for individual RPC frameworks SHOULD document what - // `rpc.response.status_code` means in the context of that system and which - // values are considered to represent errors. - RPCResponseStatusCodeKey = attribute.Key("rpc.response.status_code") - - // RPCSystemNameKey is the attribute Key conforming to the "rpc.system.name" - // semantic conventions. It represents the Remote Procedure Call (RPC) system. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: The client and server RPC systems may differ for the same RPC - // interaction. For example, a client may use Apache Dubbo or Connect RPC to - // communicate with a server that uses gRPC since both protocols provide - // compatibility with gRPC. - RPCSystemNameKey = attribute.Key("rpc.system.name") -) - -// RPCMessageCompressedSize returns an attribute KeyValue conforming to the -// "rpc.message.compressed_size" semantic conventions. It represents the -// compressed size of the message in bytes. -func RPCMessageCompressedSize(val int) attribute.KeyValue { - return RPCMessageCompressedSizeKey.Int(val) -} - -// RPCMessageID returns an attribute KeyValue conforming to the "rpc.message.id" -// semantic conventions. It MUST be calculated as two different counters starting -// from `1` one for sent messages and one for received message.. -func RPCMessageID(val int) attribute.KeyValue { - return RPCMessageIDKey.Int(val) -} - -// RPCMessageUncompressedSize returns an attribute KeyValue conforming to the -// "rpc.message.uncompressed_size" semantic conventions. It represents the -// uncompressed size of the message in bytes. -func RPCMessageUncompressedSize(val int) attribute.KeyValue { - return RPCMessageUncompressedSizeKey.Int(val) -} - -// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" -// semantic conventions. It represents the fully-qualified logical name of the -// method from the RPC interface perspective. -func RPCMethod(val string) attribute.KeyValue { - return RPCMethodKey.String(val) -} - -// RPCMethodOriginal returns an attribute KeyValue conforming to the -// "rpc.method_original" semantic conventions. It represents the original name of -// the method used by the client. -func RPCMethodOriginal(val string) attribute.KeyValue { - return RPCMethodOriginalKey.String(val) -} - -// RPCRequestMetadata returns an attribute KeyValue conforming to the -// "rpc.request.metadata" semantic conventions. It represents the RPC request -// metadata, `` being the normalized RPC metadata key (lowercase), the value -// being the metadata values. -func RPCRequestMetadata(key string, val ...string) attribute.KeyValue { - return attribute.StringSlice("rpc.request.metadata."+key, val) -} - -// RPCResponseMetadata returns an attribute KeyValue conforming to the -// "rpc.response.metadata" semantic conventions. It represents the RPC response -// metadata, `` being the normalized RPC metadata key (lowercase), the value -// being the metadata values. -func RPCResponseMetadata(key string, val ...string) attribute.KeyValue { - return attribute.StringSlice("rpc.response.metadata."+key, val) -} - -// RPCResponseStatusCode returns an attribute KeyValue conforming to the -// "rpc.response.status_code" semantic conventions. It represents the status code -// of the RPC returned by the RPC server or generated by the client. -func RPCResponseStatusCode(val string) attribute.KeyValue { - return RPCResponseStatusCodeKey.String(val) -} - -// Enum values for rpc.message.type -var ( - // sent - // Stability: development - RPCMessageTypeSent = RPCMessageTypeKey.String("SENT") - // received - // Stability: development - RPCMessageTypeReceived = RPCMessageTypeKey.String("RECEIVED") -) - -// Enum values for rpc.system.name -var ( - // [gRPC] - // Stability: development - // - // [gRPC]: https://grpc.io/ - RPCSystemNameGRPC = RPCSystemNameKey.String("grpc") - // [Apache Dubbo] - // Stability: development - // - // [Apache Dubbo]: https://dubbo.apache.org/ - RPCSystemNameDubbo = RPCSystemNameKey.String("dubbo") - // [Connect RPC] - // Stability: development - // - // [Connect RPC]: https://connectrpc.com/ - RPCSystemNameConnectrpc = RPCSystemNameKey.String("connectrpc") - // [JSON-RPC] - // Stability: development - // - // [JSON-RPC]: https://www.jsonrpc.org/ - RPCSystemNameJSONRPC = RPCSystemNameKey.String("jsonrpc") -) - -// Namespace: security_rule -const ( - // SecurityRuleCategoryKey is the attribute Key conforming to the - // "security_rule.category" semantic conventions. It represents a categorization - // value keyword used by the entity using the rule for detection of this event. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Attempted Information Leak" - SecurityRuleCategoryKey = attribute.Key("security_rule.category") - - // SecurityRuleDescriptionKey is the attribute Key conforming to the - // "security_rule.description" semantic conventions. It represents the - // description of the rule generating the event. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Block requests to public DNS over HTTPS / TLS protocols" - SecurityRuleDescriptionKey = attribute.Key("security_rule.description") - - // SecurityRuleLicenseKey is the attribute Key conforming to the - // "security_rule.license" semantic conventions. It represents the name of the - // license under which the rule used to generate this event is made available. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Apache 2.0" - SecurityRuleLicenseKey = attribute.Key("security_rule.license") - - // SecurityRuleNameKey is the attribute Key conforming to the - // "security_rule.name" semantic conventions. It represents the name of the rule - // or signature generating the event. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "BLOCK_DNS_over_TLS" - SecurityRuleNameKey = attribute.Key("security_rule.name") - - // SecurityRuleReferenceKey is the attribute Key conforming to the - // "security_rule.reference" semantic conventions. It represents the reference - // URL to additional information about the rule used to generate this event. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "https://en.wikipedia.org/wiki/DNS_over_TLS" - // Note: The URL can point to the vendor’s documentation about the rule. If - // that’s not available, it can also be a link to a more general page - // describing this type of alert. - SecurityRuleReferenceKey = attribute.Key("security_rule.reference") - - // SecurityRuleRulesetNameKey is the attribute Key conforming to the - // "security_rule.ruleset.name" semantic conventions. It represents the name of - // the ruleset, policy, group, or parent category in which the rule used to - // generate this event is a member. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Standard_Protocol_Filters" - SecurityRuleRulesetNameKey = attribute.Key("security_rule.ruleset.name") - - // SecurityRuleUUIDKey is the attribute Key conforming to the - // "security_rule.uuid" semantic conventions. It represents a rule ID that is - // unique within the scope of a set or group of agents, observers, or other - // entities using the rule for detection of this event. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "550e8400-e29b-41d4-a716-446655440000", "1100110011" - SecurityRuleUUIDKey = attribute.Key("security_rule.uuid") - - // SecurityRuleVersionKey is the attribute Key conforming to the - // "security_rule.version" semantic conventions. It represents the version / - // revision of the rule being used for analysis. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "1.0.0" - SecurityRuleVersionKey = attribute.Key("security_rule.version") -) - -// SecurityRuleCategory returns an attribute KeyValue conforming to the -// "security_rule.category" semantic conventions. It represents a categorization -// value keyword used by the entity using the rule for detection of this event. -func SecurityRuleCategory(val string) attribute.KeyValue { - return SecurityRuleCategoryKey.String(val) -} - -// SecurityRuleDescription returns an attribute KeyValue conforming to the -// "security_rule.description" semantic conventions. It represents the -// description of the rule generating the event. -func SecurityRuleDescription(val string) attribute.KeyValue { - return SecurityRuleDescriptionKey.String(val) -} - -// SecurityRuleLicense returns an attribute KeyValue conforming to the -// "security_rule.license" semantic conventions. It represents the name of the -// license under which the rule used to generate this event is made available. -func SecurityRuleLicense(val string) attribute.KeyValue { - return SecurityRuleLicenseKey.String(val) -} - -// SecurityRuleName returns an attribute KeyValue conforming to the -// "security_rule.name" semantic conventions. It represents the name of the rule -// or signature generating the event. -func SecurityRuleName(val string) attribute.KeyValue { - return SecurityRuleNameKey.String(val) -} - -// SecurityRuleReference returns an attribute KeyValue conforming to the -// "security_rule.reference" semantic conventions. It represents the reference -// URL to additional information about the rule used to generate this event. -func SecurityRuleReference(val string) attribute.KeyValue { - return SecurityRuleReferenceKey.String(val) -} - -// SecurityRuleRulesetName returns an attribute KeyValue conforming to the -// "security_rule.ruleset.name" semantic conventions. It represents the name of -// the ruleset, policy, group, or parent category in which the rule used to -// generate this event is a member. -func SecurityRuleRulesetName(val string) attribute.KeyValue { - return SecurityRuleRulesetNameKey.String(val) -} - -// SecurityRuleUUID returns an attribute KeyValue conforming to the -// "security_rule.uuid" semantic conventions. It represents a rule ID that is -// unique within the scope of a set or group of agents, observers, or other -// entities using the rule for detection of this event. -func SecurityRuleUUID(val string) attribute.KeyValue { - return SecurityRuleUUIDKey.String(val) -} - -// SecurityRuleVersion returns an attribute KeyValue conforming to the -// "security_rule.version" semantic conventions. It represents the version / -// revision of the rule being used for analysis. -func SecurityRuleVersion(val string) attribute.KeyValue { - return SecurityRuleVersionKey.String(val) -} - -// Namespace: server -const ( - // ServerAddressKey is the attribute Key conforming to the "server.address" - // semantic conventions. It represents the server domain name if available - // without reverse DNS lookup; otherwise, IP address or Unix domain socket name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "example.com", "10.1.2.80", "/tmp/my.sock" - // Note: When observed from the client side, and when communicating through an - // intermediary, `server.address` SHOULD represent the server address behind any - // intermediaries, for example proxies, if it's available. - ServerAddressKey = attribute.Key("server.address") - - // ServerPortKey is the attribute Key conforming to the "server.port" semantic - // conventions. It represents the server port number. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: 80, 8080, 443 - // Note: When observed from the client side, and when communicating through an - // intermediary, `server.port` SHOULD represent the server port behind any - // intermediaries, for example proxies, if it's available. - ServerPortKey = attribute.Key("server.port") -) - -// ServerAddress returns an attribute KeyValue conforming to the "server.address" -// semantic conventions. It represents the server domain name if available -// without reverse DNS lookup; otherwise, IP address or Unix domain socket name. -func ServerAddress(val string) attribute.KeyValue { - return ServerAddressKey.String(val) -} - -// ServerPort returns an attribute KeyValue conforming to the "server.port" -// semantic conventions. It represents the server port number. -func ServerPort(val int) attribute.KeyValue { - return ServerPortKey.Int(val) -} - -// Namespace: service -const ( - // ServiceInstanceIDKey is the attribute Key conforming to the - // "service.instance.id" semantic conventions. It represents the string ID of - // the service instance. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "627cc493-f310-47de-96bd-71410b7dec09" - // Note: MUST be unique for each instance of the same - // `service.namespace,service.name` pair (in other words - // `service.namespace,service.name,service.instance.id` triplet MUST be globally - // unique). The ID helps to - // distinguish instances of the same service that exist at the same time (e.g. - // instances of a horizontally scaled - // service). - // - // Implementations, such as SDKs, are recommended to generate a random Version 1 - // or Version 4 [RFC - // 4122] UUID, but are free to use an inherent unique ID as - // the source of - // this value if stability is desirable. In that case, the ID SHOULD be used as - // source of a UUID Version 5 and - // SHOULD use the following UUID as the namespace: - // `4d63009a-8d0f-11ee-aad7-4c796ed8e320`. - // - // UUIDs are typically recommended, as only an opaque value for the purposes of - // identifying a service instance is - // needed. Similar to what can be seen in the man page for the - // [`/etc/machine-id`] file, the underlying - // data, such as pod name and namespace should be treated as confidential, being - // the user's choice to expose it - // or not via another resource attribute. - // - // For applications running behind an application server (like unicorn), we do - // not recommend using one identifier - // for all processes participating in the application. Instead, it's recommended - // each division (e.g. a worker - // thread in unicorn) to have its own instance.id. - // - // It's not recommended for a Collector to set `service.instance.id` if it can't - // unambiguously determine the - // service instance that is generating that telemetry. For instance, creating an - // UUID based on `pod.name` will - // likely be wrong, as the Collector might not know from which container within - // that pod the telemetry originated. - // However, Collectors can set the `service.instance.id` if they can - // unambiguously determine the service instance - // for that telemetry. This is typically the case for scraping receivers, as - // they know the target address and - // port. - // - // [RFC - // 4122]: https://www.ietf.org/rfc/rfc4122.txt - // [`/etc/machine-id`]: https://www.freedesktop.org/software/systemd/man/latest/machine-id.html - ServiceInstanceIDKey = attribute.Key("service.instance.id") - - // ServiceNameKey is the attribute Key conforming to the "service.name" semantic - // conventions. It represents the logical name of the service. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "shoppingcart" - // Note: MUST be the same for all instances of horizontally scaled services. If - // the value was not specified, SDKs MUST fallback to `unknown_service:` - // concatenated with [`process.executable.name`], e.g. `unknown_service:bash`. - // If `process.executable.name` is not available, the value MUST be set to - // `unknown_service`. - // - // [`process.executable.name`]: process.md - ServiceNameKey = attribute.Key("service.name") - - // ServiceNamespaceKey is the attribute Key conforming to the - // "service.namespace" semantic conventions. It represents a namespace for - // `service.name`. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Shop" - // Note: A string value having a meaning that helps to distinguish a group of - // services, for example the team name that owns a group of services. - // `service.name` is expected to be unique within the same namespace. If - // `service.namespace` is not specified in the Resource then `service.name` is - // expected to be unique for all services that have no explicit namespace - // defined (so the empty/unspecified namespace is simply one more valid - // namespace). Zero-length namespace string is assumed equal to unspecified - // namespace. - ServiceNamespaceKey = attribute.Key("service.namespace") - - // ServicePeerNameKey is the attribute Key conforming to the "service.peer.name" - // semantic conventions. It represents the logical name of the service on the - // other side of the connection. SHOULD be equal to the actual [`service.name`] - // resource attribute of the remote service if any. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "shoppingcart" - // - // [`service.name`]: /docs/resource/README.md#service - ServicePeerNameKey = attribute.Key("service.peer.name") - - // ServicePeerNamespaceKey is the attribute Key conforming to the - // "service.peer.namespace" semantic conventions. It represents the logical - // namespace of the service on the other side of the connection. SHOULD be equal - // to the actual [`service.namespace`] resource attribute of the remote service - // if any. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Shop" - // - // [`service.namespace`]: /docs/resource/README.md#service - ServicePeerNamespaceKey = attribute.Key("service.peer.namespace") - - // ServiceVersionKey is the attribute Key conforming to the "service.version" - // semantic conventions. It represents the version string of the service - // component. The format is not defined by these conventions. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "2.0.0", "a01dbef8a" - ServiceVersionKey = attribute.Key("service.version") -) - -// ServiceInstanceID returns an attribute KeyValue conforming to the -// "service.instance.id" semantic conventions. It represents the string ID of the -// service instance. -func ServiceInstanceID(val string) attribute.KeyValue { - return ServiceInstanceIDKey.String(val) -} - -// ServiceName returns an attribute KeyValue conforming to the "service.name" -// semantic conventions. It represents the logical name of the service. -func ServiceName(val string) attribute.KeyValue { - return ServiceNameKey.String(val) -} - -// ServiceNamespace returns an attribute KeyValue conforming to the -// "service.namespace" semantic conventions. It represents a namespace for -// `service.name`. -func ServiceNamespace(val string) attribute.KeyValue { - return ServiceNamespaceKey.String(val) -} - -// ServicePeerName returns an attribute KeyValue conforming to the -// "service.peer.name" semantic conventions. It represents the logical name of -// the service on the other side of the connection. SHOULD be equal to the actual -// [`service.name`] resource attribute of the remote service if any. -// -// [`service.name`]: /docs/resource/README.md#service -func ServicePeerName(val string) attribute.KeyValue { - return ServicePeerNameKey.String(val) -} - -// ServicePeerNamespace returns an attribute KeyValue conforming to the -// "service.peer.namespace" semantic conventions. It represents the logical -// namespace of the service on the other side of the connection. SHOULD be equal -// to the actual [`service.namespace`] resource attribute of the remote service -// if any. -// -// [`service.namespace`]: /docs/resource/README.md#service -func ServicePeerNamespace(val string) attribute.KeyValue { - return ServicePeerNamespaceKey.String(val) -} - -// ServiceVersion returns an attribute KeyValue conforming to the -// "service.version" semantic conventions. It represents the version string of -// the service component. The format is not defined by these conventions. -func ServiceVersion(val string) attribute.KeyValue { - return ServiceVersionKey.String(val) -} - -// Namespace: session -const ( - // SessionIDKey is the attribute Key conforming to the "session.id" semantic - // conventions. It represents a unique id to identify a session. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 00112233-4455-6677-8899-aabbccddeeff - SessionIDKey = attribute.Key("session.id") - - // SessionPreviousIDKey is the attribute Key conforming to the - // "session.previous_id" semantic conventions. It represents the previous - // `session.id` for this user, when known. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 00112233-4455-6677-8899-aabbccddeeff - SessionPreviousIDKey = attribute.Key("session.previous_id") -) - -// SessionID returns an attribute KeyValue conforming to the "session.id" -// semantic conventions. It represents a unique id to identify a session. -func SessionID(val string) attribute.KeyValue { - return SessionIDKey.String(val) -} - -// SessionPreviousID returns an attribute KeyValue conforming to the -// "session.previous_id" semantic conventions. It represents the previous -// `session.id` for this user, when known. -func SessionPreviousID(val string) attribute.KeyValue { - return SessionPreviousIDKey.String(val) -} - -// Namespace: signalr -const ( - // SignalRConnectionStatusKey is the attribute Key conforming to the - // "signalr.connection.status" semantic conventions. It represents the signalR - // HTTP connection closure status. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "app_shutdown", "timeout" - SignalRConnectionStatusKey = attribute.Key("signalr.connection.status") - - // SignalRTransportKey is the attribute Key conforming to the - // "signalr.transport" semantic conventions. It represents the - // [SignalR transport type]. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "web_sockets", "long_polling" - // - // [SignalR transport type]: https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md - SignalRTransportKey = attribute.Key("signalr.transport") -) - -// Enum values for signalr.connection.status -var ( - // The connection was closed normally. - // Stability: stable - SignalRConnectionStatusNormalClosure = SignalRConnectionStatusKey.String("normal_closure") - // The connection was closed due to a timeout. - // Stability: stable - SignalRConnectionStatusTimeout = SignalRConnectionStatusKey.String("timeout") - // The connection was closed because the app is shutting down. - // Stability: stable - SignalRConnectionStatusAppShutdown = SignalRConnectionStatusKey.String("app_shutdown") -) - -// Enum values for signalr.transport -var ( - // ServerSentEvents protocol - // Stability: stable - SignalRTransportServerSentEvents = SignalRTransportKey.String("server_sent_events") - // LongPolling protocol - // Stability: stable - SignalRTransportLongPolling = SignalRTransportKey.String("long_polling") - // WebSockets protocol - // Stability: stable - SignalRTransportWebSockets = SignalRTransportKey.String("web_sockets") -) - -// Namespace: source -const ( - // SourceAddressKey is the attribute Key conforming to the "source.address" - // semantic conventions. It represents the source address - domain name if - // available without reverse DNS lookup; otherwise, IP address or Unix domain - // socket name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "source.example.com", "10.1.2.80", "/tmp/my.sock" - // Note: When observed from the destination side, and when communicating through - // an intermediary, `source.address` SHOULD represent the source address behind - // any intermediaries, for example proxies, if it's available. - SourceAddressKey = attribute.Key("source.address") - - // SourcePortKey is the attribute Key conforming to the "source.port" semantic - // conventions. It represents the source port number. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 3389, 2888 - SourcePortKey = attribute.Key("source.port") -) - -// SourceAddress returns an attribute KeyValue conforming to the "source.address" -// semantic conventions. It represents the source address - domain name if -// available without reverse DNS lookup; otherwise, IP address or Unix domain -// socket name. -func SourceAddress(val string) attribute.KeyValue { - return SourceAddressKey.String(val) -} - -// SourcePort returns an attribute KeyValue conforming to the "source.port" -// semantic conventions. It represents the source port number. -func SourcePort(val int) attribute.KeyValue { - return SourcePortKey.Int(val) -} - -// Namespace: system -const ( - // SystemDeviceKey is the attribute Key conforming to the "system.device" - // semantic conventions. It represents the device identifier. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "(identifier)" - SystemDeviceKey = attribute.Key("system.device") - - // SystemFilesystemModeKey is the attribute Key conforming to the - // "system.filesystem.mode" semantic conventions. It represents the filesystem - // mode. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "rw, ro" - SystemFilesystemModeKey = attribute.Key("system.filesystem.mode") - - // SystemFilesystemMountpointKey is the attribute Key conforming to the - // "system.filesystem.mountpoint" semantic conventions. It represents the - // filesystem mount path. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "/mnt/data" - SystemFilesystemMountpointKey = attribute.Key("system.filesystem.mountpoint") - - // SystemFilesystemStateKey is the attribute Key conforming to the - // "system.filesystem.state" semantic conventions. It represents the filesystem - // state. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "used" - SystemFilesystemStateKey = attribute.Key("system.filesystem.state") - - // SystemFilesystemTypeKey is the attribute Key conforming to the - // "system.filesystem.type" semantic conventions. It represents the filesystem - // type. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "ext4" - SystemFilesystemTypeKey = attribute.Key("system.filesystem.type") - - // SystemMemoryLinuxSlabStateKey is the attribute Key conforming to the - // "system.memory.linux.slab.state" semantic conventions. It represents the - // Linux Slab memory state. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "reclaimable", "unreclaimable" - SystemMemoryLinuxSlabStateKey = attribute.Key("system.memory.linux.slab.state") - - // SystemMemoryStateKey is the attribute Key conforming to the - // "system.memory.state" semantic conventions. It represents the memory state. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "free", "cached" - SystemMemoryStateKey = attribute.Key("system.memory.state") - - // SystemPagingDirectionKey is the attribute Key conforming to the - // "system.paging.direction" semantic conventions. It represents the paging - // access direction. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "in" - SystemPagingDirectionKey = attribute.Key("system.paging.direction") - - // SystemPagingFaultTypeKey is the attribute Key conforming to the - // "system.paging.fault.type" semantic conventions. It represents the paging - // fault type. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "minor" - SystemPagingFaultTypeKey = attribute.Key("system.paging.fault.type") - - // SystemPagingStateKey is the attribute Key conforming to the - // "system.paging.state" semantic conventions. It represents the memory paging - // state. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "free" - SystemPagingStateKey = attribute.Key("system.paging.state") -) - -// SystemDevice returns an attribute KeyValue conforming to the "system.device" -// semantic conventions. It represents the device identifier. -func SystemDevice(val string) attribute.KeyValue { - return SystemDeviceKey.String(val) -} - -// SystemFilesystemMode returns an attribute KeyValue conforming to the -// "system.filesystem.mode" semantic conventions. It represents the filesystem -// mode. -func SystemFilesystemMode(val string) attribute.KeyValue { - return SystemFilesystemModeKey.String(val) -} - -// SystemFilesystemMountpoint returns an attribute KeyValue conforming to the -// "system.filesystem.mountpoint" semantic conventions. It represents the -// filesystem mount path. -func SystemFilesystemMountpoint(val string) attribute.KeyValue { - return SystemFilesystemMountpointKey.String(val) -} - -// Enum values for system.filesystem.state -var ( - // used - // Stability: development - SystemFilesystemStateUsed = SystemFilesystemStateKey.String("used") - // free - // Stability: development - SystemFilesystemStateFree = SystemFilesystemStateKey.String("free") - // reserved - // Stability: development - SystemFilesystemStateReserved = SystemFilesystemStateKey.String("reserved") -) - -// Enum values for system.filesystem.type -var ( - // fat32 - // Stability: development - SystemFilesystemTypeFat32 = SystemFilesystemTypeKey.String("fat32") - // exfat - // Stability: development - SystemFilesystemTypeExfat = SystemFilesystemTypeKey.String("exfat") - // ntfs - // Stability: development - SystemFilesystemTypeNtfs = SystemFilesystemTypeKey.String("ntfs") - // refs - // Stability: development - SystemFilesystemTypeRefs = SystemFilesystemTypeKey.String("refs") - // hfsplus - // Stability: development - SystemFilesystemTypeHfsplus = SystemFilesystemTypeKey.String("hfsplus") - // ext4 - // Stability: development - SystemFilesystemTypeExt4 = SystemFilesystemTypeKey.String("ext4") -) - -// Enum values for system.memory.linux.slab.state -var ( - // reclaimable - // Stability: development - SystemMemoryLinuxSlabStateReclaimable = SystemMemoryLinuxSlabStateKey.String("reclaimable") - // unreclaimable - // Stability: development - SystemMemoryLinuxSlabStateUnreclaimable = SystemMemoryLinuxSlabStateKey.String("unreclaimable") -) - -// Enum values for system.memory.state -var ( - // Actual used virtual memory in bytes. - // Stability: development - SystemMemoryStateUsed = SystemMemoryStateKey.String("used") - // free - // Stability: development - SystemMemoryStateFree = SystemMemoryStateKey.String("free") - // buffers - // Stability: development - SystemMemoryStateBuffers = SystemMemoryStateKey.String("buffers") - // cached - // Stability: development - SystemMemoryStateCached = SystemMemoryStateKey.String("cached") -) - -// Enum values for system.paging.direction -var ( - // in - // Stability: development - SystemPagingDirectionIn = SystemPagingDirectionKey.String("in") - // out - // Stability: development - SystemPagingDirectionOut = SystemPagingDirectionKey.String("out") -) - -// Enum values for system.paging.fault.type -var ( - // major - // Stability: development - SystemPagingFaultTypeMajor = SystemPagingFaultTypeKey.String("major") - // minor - // Stability: development - SystemPagingFaultTypeMinor = SystemPagingFaultTypeKey.String("minor") -) - -// Enum values for system.paging.state -var ( - // used - // Stability: development - SystemPagingStateUsed = SystemPagingStateKey.String("used") - // free - // Stability: development - SystemPagingStateFree = SystemPagingStateKey.String("free") -) - -// Namespace: telemetry -const ( - // TelemetryDistroNameKey is the attribute Key conforming to the - // "telemetry.distro.name" semantic conventions. It represents the name of the - // auto instrumentation agent or distribution, if used. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "parts-unlimited-java" - // Note: Official auto instrumentation agents and distributions SHOULD set the - // `telemetry.distro.name` attribute to - // a string starting with `opentelemetry-`, e.g. - // `opentelemetry-java-instrumentation`. - TelemetryDistroNameKey = attribute.Key("telemetry.distro.name") - - // TelemetryDistroVersionKey is the attribute Key conforming to the - // "telemetry.distro.version" semantic conventions. It represents the version - // string of the auto instrumentation agent or distribution, if used. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "1.2.3" - TelemetryDistroVersionKey = attribute.Key("telemetry.distro.version") - - // TelemetrySDKLanguageKey is the attribute Key conforming to the - // "telemetry.sdk.language" semantic conventions. It represents the language of - // the telemetry SDK. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: - TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") - - // TelemetrySDKNameKey is the attribute Key conforming to the - // "telemetry.sdk.name" semantic conventions. It represents the name of the - // telemetry SDK as defined above. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "opentelemetry" - // Note: The OpenTelemetry SDK MUST set the `telemetry.sdk.name` attribute to - // `opentelemetry`. - // If another SDK, like a fork or a vendor-provided implementation, is used, - // this SDK MUST set the - // `telemetry.sdk.name` attribute to the fully-qualified class or module name of - // this SDK's main entry point - // or another suitable identifier depending on the language. - // The identifier `opentelemetry` is reserved and MUST NOT be used in this case. - // All custom identifiers SHOULD be stable across different versions of an - // implementation. - TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") - - // TelemetrySDKVersionKey is the attribute Key conforming to the - // "telemetry.sdk.version" semantic conventions. It represents the version - // string of the telemetry SDK. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "1.2.3" - TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") -) - -// TelemetryDistroName returns an attribute KeyValue conforming to the -// "telemetry.distro.name" semantic conventions. It represents the name of the -// auto instrumentation agent or distribution, if used. -func TelemetryDistroName(val string) attribute.KeyValue { - return TelemetryDistroNameKey.String(val) -} - -// TelemetryDistroVersion returns an attribute KeyValue conforming to the -// "telemetry.distro.version" semantic conventions. It represents the version -// string of the auto instrumentation agent or distribution, if used. -func TelemetryDistroVersion(val string) attribute.KeyValue { - return TelemetryDistroVersionKey.String(val) -} - -// TelemetrySDKName returns an attribute KeyValue conforming to the -// "telemetry.sdk.name" semantic conventions. It represents the name of the -// telemetry SDK as defined above. -func TelemetrySDKName(val string) attribute.KeyValue { - return TelemetrySDKNameKey.String(val) -} - -// TelemetrySDKVersion returns an attribute KeyValue conforming to the -// "telemetry.sdk.version" semantic conventions. It represents the version string -// of the telemetry SDK. -func TelemetrySDKVersion(val string) attribute.KeyValue { - return TelemetrySDKVersionKey.String(val) -} - -// Enum values for telemetry.sdk.language -var ( - // cpp - // Stability: stable - TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") - // dotnet - // Stability: stable - TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") - // erlang - // Stability: stable - TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") - // go - // Stability: stable - TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") - // java - // Stability: stable - TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") - // nodejs - // Stability: stable - TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") - // php - // Stability: stable - TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") - // python - // Stability: stable - TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") - // ruby - // Stability: stable - TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") - // rust - // Stability: stable - TelemetrySDKLanguageRust = TelemetrySDKLanguageKey.String("rust") - // swift - // Stability: stable - TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") - // webjs - // Stability: stable - TelemetrySDKLanguageWebJS = TelemetrySDKLanguageKey.String("webjs") -) - -// Namespace: test -const ( - // TestCaseNameKey is the attribute Key conforming to the "test.case.name" - // semantic conventions. It represents the fully qualified human readable name - // of the [test case]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "org.example.TestCase1.test1", "example/tests/TestCase1.test1", - // "ExampleTestCase1_test1" - // - // [test case]: https://wikipedia.org/wiki/Test_case - TestCaseNameKey = attribute.Key("test.case.name") - - // TestCaseResultStatusKey is the attribute Key conforming to the - // "test.case.result.status" semantic conventions. It represents the status of - // the actual test case result from test execution. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "pass", "fail" - TestCaseResultStatusKey = attribute.Key("test.case.result.status") - - // TestSuiteNameKey is the attribute Key conforming to the "test.suite.name" - // semantic conventions. It represents the human readable name of a [test suite] - // . - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "TestSuite1" - // - // [test suite]: https://wikipedia.org/wiki/Test_suite - TestSuiteNameKey = attribute.Key("test.suite.name") - - // TestSuiteRunStatusKey is the attribute Key conforming to the - // "test.suite.run.status" semantic conventions. It represents the status of the - // test suite run. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "success", "failure", "skipped", "aborted", "timed_out", - // "in_progress" - TestSuiteRunStatusKey = attribute.Key("test.suite.run.status") -) - -// TestCaseName returns an attribute KeyValue conforming to the "test.case.name" -// semantic conventions. It represents the fully qualified human readable name of -// the [test case]. -// -// [test case]: https://wikipedia.org/wiki/Test_case -func TestCaseName(val string) attribute.KeyValue { - return TestCaseNameKey.String(val) -} - -// TestSuiteName returns an attribute KeyValue conforming to the -// "test.suite.name" semantic conventions. It represents the human readable name -// of a [test suite]. -// -// [test suite]: https://wikipedia.org/wiki/Test_suite -func TestSuiteName(val string) attribute.KeyValue { - return TestSuiteNameKey.String(val) -} - -// Enum values for test.case.result.status -var ( - // pass - // Stability: development - TestCaseResultStatusPass = TestCaseResultStatusKey.String("pass") - // fail - // Stability: development - TestCaseResultStatusFail = TestCaseResultStatusKey.String("fail") -) - -// Enum values for test.suite.run.status -var ( - // success - // Stability: development - TestSuiteRunStatusSuccess = TestSuiteRunStatusKey.String("success") - // failure - // Stability: development - TestSuiteRunStatusFailure = TestSuiteRunStatusKey.String("failure") - // skipped - // Stability: development - TestSuiteRunStatusSkipped = TestSuiteRunStatusKey.String("skipped") - // aborted - // Stability: development - TestSuiteRunStatusAborted = TestSuiteRunStatusKey.String("aborted") - // timed_out - // Stability: development - TestSuiteRunStatusTimedOut = TestSuiteRunStatusKey.String("timed_out") - // in_progress - // Stability: development - TestSuiteRunStatusInProgress = TestSuiteRunStatusKey.String("in_progress") -) - -// Namespace: thread -const ( - // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic - // conventions. It represents the current "managed" thread ID (as opposed to OS - // thread ID). - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Note: - // Examples of where the value can be extracted from: - // - // | Language or platform | Source | - // | --- | --- | - // | JVM | `Thread.currentThread().threadId()` | - // | .NET | `Thread.CurrentThread.ManagedThreadId` | - // | Python | `threading.current_thread().ident` | - // | Ruby | `Thread.current.object_id` | - // | C++ | `std::this_thread::get_id()` | - // | Erlang | `erlang:self()` | - ThreadIDKey = attribute.Key("thread.id") - - // ThreadNameKey is the attribute Key conforming to the "thread.name" semantic - // conventions. It represents the current thread name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: main - // Note: - // Examples of where the value can be extracted from: - // - // | Language or platform | Source | - // | --- | --- | - // | JVM | `Thread.currentThread().getName()` | - // | .NET | `Thread.CurrentThread.Name` | - // | Python | `threading.current_thread().name` | - // | Ruby | `Thread.current.name` | - // | Erlang | `erlang:process_info(self(), registered_name)` | - ThreadNameKey = attribute.Key("thread.name") -) - -// ThreadID returns an attribute KeyValue conforming to the "thread.id" semantic -// conventions. It represents the current "managed" thread ID (as opposed to OS -// thread ID). -func ThreadID(val int) attribute.KeyValue { - return ThreadIDKey.Int(val) -} - -// ThreadName returns an attribute KeyValue conforming to the "thread.name" -// semantic conventions. It represents the current thread name. -func ThreadName(val string) attribute.KeyValue { - return ThreadNameKey.String(val) -} - -// Namespace: tls -const ( - // TLSCipherKey is the attribute Key conforming to the "tls.cipher" semantic - // conventions. It represents the string indicating the [cipher] used during the - // current connection. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "TLS_RSA_WITH_3DES_EDE_CBC_SHA", - // "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" - // Note: The values allowed for `tls.cipher` MUST be one of the `Descriptions` - // of the [registered TLS Cipher Suits]. - // - // [cipher]: https://datatracker.ietf.org/doc/html/rfc5246#appendix-A.5 - // [registered TLS Cipher Suits]: https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#table-tls-parameters-4 - TLSCipherKey = attribute.Key("tls.cipher") - - // TLSClientCertificateKey is the attribute Key conforming to the - // "tls.client.certificate" semantic conventions. It represents the PEM-encoded - // stand-alone certificate offered by the client. This is usually - // mutually-exclusive of `client.certificate_chain` since this value also exists - // in that list. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "MII..." - TLSClientCertificateKey = attribute.Key("tls.client.certificate") - - // TLSClientCertificateChainKey is the attribute Key conforming to the - // "tls.client.certificate_chain" semantic conventions. It represents the array - // of PEM-encoded certificates that make up the certificate chain offered by the - // client. This is usually mutually-exclusive of `client.certificate` since that - // value should be the first certificate in the chain. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "MII...", "MI..." - TLSClientCertificateChainKey = attribute.Key("tls.client.certificate_chain") - - // TLSClientHashMd5Key is the attribute Key conforming to the - // "tls.client.hash.md5" semantic conventions. It represents the certificate - // fingerprint using the MD5 digest of DER-encoded version of certificate - // offered by the client. For consistency with other hash values, this value - // should be formatted as an uppercase hash. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "0F76C7F2C55BFD7D8E8B8F4BFBF0C9EC" - TLSClientHashMd5Key = attribute.Key("tls.client.hash.md5") - - // TLSClientHashSha1Key is the attribute Key conforming to the - // "tls.client.hash.sha1" semantic conventions. It represents the certificate - // fingerprint using the SHA1 digest of DER-encoded version of certificate - // offered by the client. For consistency with other hash values, this value - // should be formatted as an uppercase hash. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "9E393D93138888D288266C2D915214D1D1CCEB2A" - TLSClientHashSha1Key = attribute.Key("tls.client.hash.sha1") - - // TLSClientHashSha256Key is the attribute Key conforming to the - // "tls.client.hash.sha256" semantic conventions. It represents the certificate - // fingerprint using the SHA256 digest of DER-encoded version of certificate - // offered by the client. For consistency with other hash values, this value - // should be formatted as an uppercase hash. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "0687F666A054EF17A08E2F2162EAB4CBC0D265E1D7875BE74BF3C712CA92DAF0" - TLSClientHashSha256Key = attribute.Key("tls.client.hash.sha256") - - // TLSClientIssuerKey is the attribute Key conforming to the "tls.client.issuer" - // semantic conventions. It represents the distinguished name of [subject] of - // the issuer of the x.509 certificate presented by the client. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "CN=Example Root CA, OU=Infrastructure Team, DC=example, DC=com" - // - // [subject]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6 - TLSClientIssuerKey = attribute.Key("tls.client.issuer") - - // TLSClientJa3Key is the attribute Key conforming to the "tls.client.ja3" - // semantic conventions. It represents a hash that identifies clients based on - // how they perform an SSL/TLS handshake. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "d4e5b18d6b55c71272893221c96ba240" - TLSClientJa3Key = attribute.Key("tls.client.ja3") - - // TLSClientNotAfterKey is the attribute Key conforming to the - // "tls.client.not_after" semantic conventions. It represents the date/Time - // indicating when client certificate is no longer considered valid. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "2021-01-01T00:00:00.000Z" - TLSClientNotAfterKey = attribute.Key("tls.client.not_after") - - // TLSClientNotBeforeKey is the attribute Key conforming to the - // "tls.client.not_before" semantic conventions. It represents the date/Time - // indicating when client certificate is first considered valid. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "1970-01-01T00:00:00.000Z" - TLSClientNotBeforeKey = attribute.Key("tls.client.not_before") - - // TLSClientSubjectKey is the attribute Key conforming to the - // "tls.client.subject" semantic conventions. It represents the distinguished - // name of subject of the x.509 certificate presented by the client. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "CN=myclient, OU=Documentation Team, DC=example, DC=com" - TLSClientSubjectKey = attribute.Key("tls.client.subject") - - // TLSClientSupportedCiphersKey is the attribute Key conforming to the - // "tls.client.supported_ciphers" semantic conventions. It represents the array - // of ciphers offered by the client during the client hello. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", - // "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" - TLSClientSupportedCiphersKey = attribute.Key("tls.client.supported_ciphers") - - // TLSCurveKey is the attribute Key conforming to the "tls.curve" semantic - // conventions. It represents the string indicating the curve used for the given - // cipher, when applicable. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "secp256r1" - TLSCurveKey = attribute.Key("tls.curve") - - // TLSEstablishedKey is the attribute Key conforming to the "tls.established" - // semantic conventions. It represents the boolean flag indicating if the TLS - // negotiation was successful and transitioned to an encrypted tunnel. - // - // Type: boolean - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: true - TLSEstablishedKey = attribute.Key("tls.established") - - // TLSNextProtocolKey is the attribute Key conforming to the "tls.next_protocol" - // semantic conventions. It represents the string indicating the protocol being - // tunneled. Per the values in the [IANA registry], this string should be lower - // case. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "http/1.1" - // - // [IANA registry]: https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids - TLSNextProtocolKey = attribute.Key("tls.next_protocol") - - // TLSProtocolNameKey is the attribute Key conforming to the "tls.protocol.name" - // semantic conventions. It represents the normalized lowercase protocol name - // parsed from original string of the negotiated [SSL/TLS protocol version]. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // - // [SSL/TLS protocol version]: https://docs.openssl.org/1.1.1/man3/SSL_get_version/#return-values - TLSProtocolNameKey = attribute.Key("tls.protocol.name") - - // TLSProtocolVersionKey is the attribute Key conforming to the - // "tls.protocol.version" semantic conventions. It represents the numeric part - // of the version parsed from the original string of the negotiated - // [SSL/TLS protocol version]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "1.2", "3" - // - // [SSL/TLS protocol version]: https://docs.openssl.org/1.1.1/man3/SSL_get_version/#return-values - TLSProtocolVersionKey = attribute.Key("tls.protocol.version") - - // TLSResumedKey is the attribute Key conforming to the "tls.resumed" semantic - // conventions. It represents the boolean flag indicating if this TLS connection - // was resumed from an existing TLS negotiation. - // - // Type: boolean - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: true - TLSResumedKey = attribute.Key("tls.resumed") - - // TLSServerCertificateKey is the attribute Key conforming to the - // "tls.server.certificate" semantic conventions. It represents the PEM-encoded - // stand-alone certificate offered by the server. This is usually - // mutually-exclusive of `server.certificate_chain` since this value also exists - // in that list. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "MII..." - TLSServerCertificateKey = attribute.Key("tls.server.certificate") - - // TLSServerCertificateChainKey is the attribute Key conforming to the - // "tls.server.certificate_chain" semantic conventions. It represents the array - // of PEM-encoded certificates that make up the certificate chain offered by the - // server. This is usually mutually-exclusive of `server.certificate` since that - // value should be the first certificate in the chain. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "MII...", "MI..." - TLSServerCertificateChainKey = attribute.Key("tls.server.certificate_chain") - - // TLSServerHashMd5Key is the attribute Key conforming to the - // "tls.server.hash.md5" semantic conventions. It represents the certificate - // fingerprint using the MD5 digest of DER-encoded version of certificate - // offered by the server. For consistency with other hash values, this value - // should be formatted as an uppercase hash. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "0F76C7F2C55BFD7D8E8B8F4BFBF0C9EC" - TLSServerHashMd5Key = attribute.Key("tls.server.hash.md5") - - // TLSServerHashSha1Key is the attribute Key conforming to the - // "tls.server.hash.sha1" semantic conventions. It represents the certificate - // fingerprint using the SHA1 digest of DER-encoded version of certificate - // offered by the server. For consistency with other hash values, this value - // should be formatted as an uppercase hash. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "9E393D93138888D288266C2D915214D1D1CCEB2A" - TLSServerHashSha1Key = attribute.Key("tls.server.hash.sha1") - - // TLSServerHashSha256Key is the attribute Key conforming to the - // "tls.server.hash.sha256" semantic conventions. It represents the certificate - // fingerprint using the SHA256 digest of DER-encoded version of certificate - // offered by the server. For consistency with other hash values, this value - // should be formatted as an uppercase hash. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "0687F666A054EF17A08E2F2162EAB4CBC0D265E1D7875BE74BF3C712CA92DAF0" - TLSServerHashSha256Key = attribute.Key("tls.server.hash.sha256") - - // TLSServerIssuerKey is the attribute Key conforming to the "tls.server.issuer" - // semantic conventions. It represents the distinguished name of [subject] of - // the issuer of the x.509 certificate presented by the client. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "CN=Example Root CA, OU=Infrastructure Team, DC=example, DC=com" - // - // [subject]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6 - TLSServerIssuerKey = attribute.Key("tls.server.issuer") - - // TLSServerJa3sKey is the attribute Key conforming to the "tls.server.ja3s" - // semantic conventions. It represents a hash that identifies servers based on - // how they perform an SSL/TLS handshake. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "d4e5b18d6b55c71272893221c96ba240" - TLSServerJa3sKey = attribute.Key("tls.server.ja3s") - - // TLSServerNotAfterKey is the attribute Key conforming to the - // "tls.server.not_after" semantic conventions. It represents the date/Time - // indicating when server certificate is no longer considered valid. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "2021-01-01T00:00:00.000Z" - TLSServerNotAfterKey = attribute.Key("tls.server.not_after") - - // TLSServerNotBeforeKey is the attribute Key conforming to the - // "tls.server.not_before" semantic conventions. It represents the date/Time - // indicating when server certificate is first considered valid. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "1970-01-01T00:00:00.000Z" - TLSServerNotBeforeKey = attribute.Key("tls.server.not_before") - - // TLSServerSubjectKey is the attribute Key conforming to the - // "tls.server.subject" semantic conventions. It represents the distinguished - // name of subject of the x.509 certificate presented by the server. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "CN=myserver, OU=Documentation Team, DC=example, DC=com" - TLSServerSubjectKey = attribute.Key("tls.server.subject") -) - -// TLSCipher returns an attribute KeyValue conforming to the "tls.cipher" -// semantic conventions. It represents the string indicating the [cipher] used -// during the current connection. -// -// [cipher]: https://datatracker.ietf.org/doc/html/rfc5246#appendix-A.5 -func TLSCipher(val string) attribute.KeyValue { - return TLSCipherKey.String(val) -} - -// TLSClientCertificate returns an attribute KeyValue conforming to the -// "tls.client.certificate" semantic conventions. It represents the PEM-encoded -// stand-alone certificate offered by the client. This is usually -// mutually-exclusive of `client.certificate_chain` since this value also exists -// in that list. -func TLSClientCertificate(val string) attribute.KeyValue { - return TLSClientCertificateKey.String(val) -} - -// TLSClientCertificateChain returns an attribute KeyValue conforming to the -// "tls.client.certificate_chain" semantic conventions. It represents the array -// of PEM-encoded certificates that make up the certificate chain offered by the -// client. This is usually mutually-exclusive of `client.certificate` since that -// value should be the first certificate in the chain. -func TLSClientCertificateChain(val ...string) attribute.KeyValue { - return TLSClientCertificateChainKey.StringSlice(val) -} - -// TLSClientHashMd5 returns an attribute KeyValue conforming to the -// "tls.client.hash.md5" semantic conventions. It represents the certificate -// fingerprint using the MD5 digest of DER-encoded version of certificate offered -// by the client. For consistency with other hash values, this value should be -// formatted as an uppercase hash. -func TLSClientHashMd5(val string) attribute.KeyValue { - return TLSClientHashMd5Key.String(val) -} - -// TLSClientHashSha1 returns an attribute KeyValue conforming to the -// "tls.client.hash.sha1" semantic conventions. It represents the certificate -// fingerprint using the SHA1 digest of DER-encoded version of certificate -// offered by the client. For consistency with other hash values, this value -// should be formatted as an uppercase hash. -func TLSClientHashSha1(val string) attribute.KeyValue { - return TLSClientHashSha1Key.String(val) -} - -// TLSClientHashSha256 returns an attribute KeyValue conforming to the -// "tls.client.hash.sha256" semantic conventions. It represents the certificate -// fingerprint using the SHA256 digest of DER-encoded version of certificate -// offered by the client. For consistency with other hash values, this value -// should be formatted as an uppercase hash. -func TLSClientHashSha256(val string) attribute.KeyValue { - return TLSClientHashSha256Key.String(val) -} - -// TLSClientIssuer returns an attribute KeyValue conforming to the -// "tls.client.issuer" semantic conventions. It represents the distinguished name -// of [subject] of the issuer of the x.509 certificate presented by the client. -// -// [subject]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6 -func TLSClientIssuer(val string) attribute.KeyValue { - return TLSClientIssuerKey.String(val) -} - -// TLSClientJa3 returns an attribute KeyValue conforming to the "tls.client.ja3" -// semantic conventions. It represents a hash that identifies clients based on -// how they perform an SSL/TLS handshake. -func TLSClientJa3(val string) attribute.KeyValue { - return TLSClientJa3Key.String(val) -} - -// TLSClientNotAfter returns an attribute KeyValue conforming to the -// "tls.client.not_after" semantic conventions. It represents the date/Time -// indicating when client certificate is no longer considered valid. -func TLSClientNotAfter(val string) attribute.KeyValue { - return TLSClientNotAfterKey.String(val) -} - -// TLSClientNotBefore returns an attribute KeyValue conforming to the -// "tls.client.not_before" semantic conventions. It represents the date/Time -// indicating when client certificate is first considered valid. -func TLSClientNotBefore(val string) attribute.KeyValue { - return TLSClientNotBeforeKey.String(val) -} - -// TLSClientSubject returns an attribute KeyValue conforming to the -// "tls.client.subject" semantic conventions. It represents the distinguished -// name of subject of the x.509 certificate presented by the client. -func TLSClientSubject(val string) attribute.KeyValue { - return TLSClientSubjectKey.String(val) -} - -// TLSClientSupportedCiphers returns an attribute KeyValue conforming to the -// "tls.client.supported_ciphers" semantic conventions. It represents the array -// of ciphers offered by the client during the client hello. -func TLSClientSupportedCiphers(val ...string) attribute.KeyValue { - return TLSClientSupportedCiphersKey.StringSlice(val) -} - -// TLSCurve returns an attribute KeyValue conforming to the "tls.curve" semantic -// conventions. It represents the string indicating the curve used for the given -// cipher, when applicable. -func TLSCurve(val string) attribute.KeyValue { - return TLSCurveKey.String(val) -} - -// TLSEstablished returns an attribute KeyValue conforming to the -// "tls.established" semantic conventions. It represents the boolean flag -// indicating if the TLS negotiation was successful and transitioned to an -// encrypted tunnel. -func TLSEstablished(val bool) attribute.KeyValue { - return TLSEstablishedKey.Bool(val) -} - -// TLSNextProtocol returns an attribute KeyValue conforming to the -// "tls.next_protocol" semantic conventions. It represents the string indicating -// the protocol being tunneled. Per the values in the [IANA registry], this -// string should be lower case. -// -// [IANA registry]: https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids -func TLSNextProtocol(val string) attribute.KeyValue { - return TLSNextProtocolKey.String(val) -} - -// TLSProtocolVersion returns an attribute KeyValue conforming to the -// "tls.protocol.version" semantic conventions. It represents the numeric part of -// the version parsed from the original string of the negotiated -// [SSL/TLS protocol version]. -// -// [SSL/TLS protocol version]: https://docs.openssl.org/1.1.1/man3/SSL_get_version/#return-values -func TLSProtocolVersion(val string) attribute.KeyValue { - return TLSProtocolVersionKey.String(val) -} - -// TLSResumed returns an attribute KeyValue conforming to the "tls.resumed" -// semantic conventions. It represents the boolean flag indicating if this TLS -// connection was resumed from an existing TLS negotiation. -func TLSResumed(val bool) attribute.KeyValue { - return TLSResumedKey.Bool(val) -} - -// TLSServerCertificate returns an attribute KeyValue conforming to the -// "tls.server.certificate" semantic conventions. It represents the PEM-encoded -// stand-alone certificate offered by the server. This is usually -// mutually-exclusive of `server.certificate_chain` since this value also exists -// in that list. -func TLSServerCertificate(val string) attribute.KeyValue { - return TLSServerCertificateKey.String(val) -} - -// TLSServerCertificateChain returns an attribute KeyValue conforming to the -// "tls.server.certificate_chain" semantic conventions. It represents the array -// of PEM-encoded certificates that make up the certificate chain offered by the -// server. This is usually mutually-exclusive of `server.certificate` since that -// value should be the first certificate in the chain. -func TLSServerCertificateChain(val ...string) attribute.KeyValue { - return TLSServerCertificateChainKey.StringSlice(val) -} - -// TLSServerHashMd5 returns an attribute KeyValue conforming to the -// "tls.server.hash.md5" semantic conventions. It represents the certificate -// fingerprint using the MD5 digest of DER-encoded version of certificate offered -// by the server. For consistency with other hash values, this value should be -// formatted as an uppercase hash. -func TLSServerHashMd5(val string) attribute.KeyValue { - return TLSServerHashMd5Key.String(val) -} - -// TLSServerHashSha1 returns an attribute KeyValue conforming to the -// "tls.server.hash.sha1" semantic conventions. It represents the certificate -// fingerprint using the SHA1 digest of DER-encoded version of certificate -// offered by the server. For consistency with other hash values, this value -// should be formatted as an uppercase hash. -func TLSServerHashSha1(val string) attribute.KeyValue { - return TLSServerHashSha1Key.String(val) -} - -// TLSServerHashSha256 returns an attribute KeyValue conforming to the -// "tls.server.hash.sha256" semantic conventions. It represents the certificate -// fingerprint using the SHA256 digest of DER-encoded version of certificate -// offered by the server. For consistency with other hash values, this value -// should be formatted as an uppercase hash. -func TLSServerHashSha256(val string) attribute.KeyValue { - return TLSServerHashSha256Key.String(val) -} - -// TLSServerIssuer returns an attribute KeyValue conforming to the -// "tls.server.issuer" semantic conventions. It represents the distinguished name -// of [subject] of the issuer of the x.509 certificate presented by the client. -// -// [subject]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6 -func TLSServerIssuer(val string) attribute.KeyValue { - return TLSServerIssuerKey.String(val) -} - -// TLSServerJa3s returns an attribute KeyValue conforming to the -// "tls.server.ja3s" semantic conventions. It represents a hash that identifies -// servers based on how they perform an SSL/TLS handshake. -func TLSServerJa3s(val string) attribute.KeyValue { - return TLSServerJa3sKey.String(val) -} - -// TLSServerNotAfter returns an attribute KeyValue conforming to the -// "tls.server.not_after" semantic conventions. It represents the date/Time -// indicating when server certificate is no longer considered valid. -func TLSServerNotAfter(val string) attribute.KeyValue { - return TLSServerNotAfterKey.String(val) -} - -// TLSServerNotBefore returns an attribute KeyValue conforming to the -// "tls.server.not_before" semantic conventions. It represents the date/Time -// indicating when server certificate is first considered valid. -func TLSServerNotBefore(val string) attribute.KeyValue { - return TLSServerNotBeforeKey.String(val) -} - -// TLSServerSubject returns an attribute KeyValue conforming to the -// "tls.server.subject" semantic conventions. It represents the distinguished -// name of subject of the x.509 certificate presented by the server. -func TLSServerSubject(val string) attribute.KeyValue { - return TLSServerSubjectKey.String(val) -} - -// Enum values for tls.protocol.name -var ( - // ssl - // Stability: development - TLSProtocolNameSsl = TLSProtocolNameKey.String("ssl") - // tls - // Stability: development - TLSProtocolNameTLS = TLSProtocolNameKey.String("tls") -) - -// Namespace: url -const ( - // URLDomainKey is the attribute Key conforming to the "url.domain" semantic - // conventions. It represents the domain extracted from the `url.full`, such as - // "opentelemetry.io". - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "www.foo.bar", "opentelemetry.io", "3.12.167.2", - // "[1080:0:0:0:8:800:200C:417A]" - // Note: In some cases a URL may refer to an IP and/or port directly, without a - // domain name. In this case, the IP address would go to the domain field. If - // the URL contains a [literal IPv6 address] enclosed by `[` and `]`, the `[` - // and `]` characters should also be captured in the domain field. - // - // [literal IPv6 address]: https://www.rfc-editor.org/rfc/rfc2732#section-2 - URLDomainKey = attribute.Key("url.domain") - - // URLExtensionKey is the attribute Key conforming to the "url.extension" - // semantic conventions. It represents the file extension extracted from the - // `url.full`, excluding the leading dot. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "png", "gz" - // Note: The file extension is only set if it exists, as not every url has a - // file extension. When the file name has multiple extensions `example.tar.gz`, - // only the last one should be captured `gz`, not `tar.gz`. - URLExtensionKey = attribute.Key("url.extension") - - // URLFragmentKey is the attribute Key conforming to the "url.fragment" semantic - // conventions. It represents the [URI fragment] component. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "SemConv" - // - // [URI fragment]: https://www.rfc-editor.org/rfc/rfc3986#section-3.5 - URLFragmentKey = attribute.Key("url.fragment") - - // URLFullKey is the attribute Key conforming to the "url.full" semantic - // conventions. It represents the absolute URL describing a network resource - // according to [RFC3986]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "https://www.foo.bar/search?q=OpenTelemetry#SemConv", "//localhost" - // Note: For network calls, URL usually has - // `scheme://host[:port][path][?query][#fragment]` format, where the fragment - // is not transmitted over HTTP, but if it is known, it SHOULD be included - // nevertheless. - // - // `url.full` MUST NOT contain credentials passed via URL in form of - // `https://username:password@www.example.com/`. - // In such case username and password SHOULD be redacted and attribute's value - // SHOULD be `https://REDACTED:REDACTED@www.example.com/`. - // - // `url.full` SHOULD capture the absolute URL when it is available (or can be - // reconstructed). - // - // Sensitive content provided in `url.full` SHOULD be scrubbed when - // instrumentations can identify it. - // - // - // Query string values for the following keys SHOULD be redacted by default and - // replaced by the - // value `REDACTED`: - // - // - [`AWSAccessKeyId`] - // - [`Signature`] - // - [`sig`] - // - [`X-Goog-Signature`] - // - // This list is subject to change over time. - // - // When a query string value is redacted, the query string key SHOULD still be - // preserved, e.g. - // `https://www.example.com/path?color=blue&sig=REDACTED`. - // - // [RFC3986]: https://www.rfc-editor.org/rfc/rfc3986 - // [`AWSAccessKeyId`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth - // [`Signature`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth - // [`sig`]: https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token - // [`X-Goog-Signature`]: https://cloud.google.com/storage/docs/access-control/signed-urls - URLFullKey = attribute.Key("url.full") - - // URLOriginalKey is the attribute Key conforming to the "url.original" semantic - // conventions. It represents the unmodified original URL as seen in the event - // source. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "https://www.foo.bar/search?q=OpenTelemetry#SemConv", - // "search?q=OpenTelemetry" - // Note: In network monitoring, the observed URL may be a full URL, whereas in - // access logs, the URL is often just represented as a path. This field is meant - // to represent the URL as it was observed, complete or not. - // `url.original` might contain credentials passed via URL in form of - // `https://username:password@www.example.com/`. In such case password and - // username SHOULD NOT be redacted and attribute's value SHOULD remain the same. - URLOriginalKey = attribute.Key("url.original") - - // URLPathKey is the attribute Key conforming to the "url.path" semantic - // conventions. It represents the [URI path] component. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "/search" - // Note: Sensitive content provided in `url.path` SHOULD be scrubbed when - // instrumentations can identify it. - // - // [URI path]: https://www.rfc-editor.org/rfc/rfc3986#section-3.3 - URLPathKey = attribute.Key("url.path") - - // URLPortKey is the attribute Key conforming to the "url.port" semantic - // conventions. It represents the port extracted from the `url.full`. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 443 - URLPortKey = attribute.Key("url.port") - - // URLQueryKey is the attribute Key conforming to the "url.query" semantic - // conventions. It represents the [URI query] component. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "q=OpenTelemetry" - // Note: Sensitive content provided in `url.query` SHOULD be scrubbed when - // instrumentations can identify it. - // - // - // Query string values for the following keys SHOULD be redacted by default and - // replaced by the value `REDACTED`: - // - // - [`AWSAccessKeyId`] - // - [`Signature`] - // - [`sig`] - // - [`X-Goog-Signature`] - // - // This list is subject to change over time. - // - // When a query string value is redacted, the query string key SHOULD still be - // preserved, e.g. - // `q=OpenTelemetry&sig=REDACTED`. - // - // [URI query]: https://www.rfc-editor.org/rfc/rfc3986#section-3.4 - // [`AWSAccessKeyId`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth - // [`Signature`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth - // [`sig`]: https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token - // [`X-Goog-Signature`]: https://cloud.google.com/storage/docs/access-control/signed-urls - URLQueryKey = attribute.Key("url.query") - - // URLRegisteredDomainKey is the attribute Key conforming to the - // "url.registered_domain" semantic conventions. It represents the highest - // registered url domain, stripped of the subdomain. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "example.com", "foo.co.uk" - // Note: This value can be determined precisely with the [public suffix list]. - // For example, the registered domain for `foo.example.com` is `example.com`. - // Trying to approximate this by simply taking the last two labels will not work - // well for TLDs such as `co.uk`. - // - // [public suffix list]: https://publicsuffix.org/ - URLRegisteredDomainKey = attribute.Key("url.registered_domain") - - // URLSchemeKey is the attribute Key conforming to the "url.scheme" semantic - // conventions. It represents the [URI scheme] component identifying the used - // protocol. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "https", "ftp", "telnet" - // - // [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 - URLSchemeKey = attribute.Key("url.scheme") - - // URLSubdomainKey is the attribute Key conforming to the "url.subdomain" - // semantic conventions. It represents the subdomain portion of a fully - // qualified domain name includes all of the names except the host name under - // the registered_domain. In a partially qualified domain, or if the - // qualification level of the full name cannot be determined, subdomain contains - // all of the names below the registered domain. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "east", "sub2.sub1" - // Note: The subdomain portion of `www.east.mydomain.co.uk` is `east`. If the - // domain has multiple levels of subdomain, such as `sub2.sub1.example.com`, the - // subdomain field should contain `sub2.sub1`, with no trailing period. - URLSubdomainKey = attribute.Key("url.subdomain") - - // URLTemplateKey is the attribute Key conforming to the "url.template" semantic - // conventions. It represents the low-cardinality template of an - // [absolute path reference]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "/users/{id}", "/users/:id", "/users?id={id}" - // - // [absolute path reference]: https://www.rfc-editor.org/rfc/rfc3986#section-4.2 - URLTemplateKey = attribute.Key("url.template") - - // URLTopLevelDomainKey is the attribute Key conforming to the - // "url.top_level_domain" semantic conventions. It represents the effective top - // level domain (eTLD), also known as the domain suffix, is the last part of the - // domain name. For example, the top level domain for example.com is `com`. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "com", "co.uk" - // Note: This value can be determined precisely with the [public suffix list]. - // - // [public suffix list]: https://publicsuffix.org/ - URLTopLevelDomainKey = attribute.Key("url.top_level_domain") -) - -// URLDomain returns an attribute KeyValue conforming to the "url.domain" -// semantic conventions. It represents the domain extracted from the `url.full`, -// such as "opentelemetry.io". -func URLDomain(val string) attribute.KeyValue { - return URLDomainKey.String(val) -} - -// URLExtension returns an attribute KeyValue conforming to the "url.extension" -// semantic conventions. It represents the file extension extracted from the -// `url.full`, excluding the leading dot. -func URLExtension(val string) attribute.KeyValue { - return URLExtensionKey.String(val) -} - -// URLFragment returns an attribute KeyValue conforming to the "url.fragment" -// semantic conventions. It represents the [URI fragment] component. -// -// [URI fragment]: https://www.rfc-editor.org/rfc/rfc3986#section-3.5 -func URLFragment(val string) attribute.KeyValue { - return URLFragmentKey.String(val) -} - -// URLFull returns an attribute KeyValue conforming to the "url.full" semantic -// conventions. It represents the absolute URL describing a network resource -// according to [RFC3986]. -// -// [RFC3986]: https://www.rfc-editor.org/rfc/rfc3986 -func URLFull(val string) attribute.KeyValue { - return URLFullKey.String(val) -} - -// URLOriginal returns an attribute KeyValue conforming to the "url.original" -// semantic conventions. It represents the unmodified original URL as seen in the -// event source. -func URLOriginal(val string) attribute.KeyValue { - return URLOriginalKey.String(val) -} - -// URLPath returns an attribute KeyValue conforming to the "url.path" semantic -// conventions. It represents the [URI path] component. -// -// [URI path]: https://www.rfc-editor.org/rfc/rfc3986#section-3.3 -func URLPath(val string) attribute.KeyValue { - return URLPathKey.String(val) -} - -// URLPort returns an attribute KeyValue conforming to the "url.port" semantic -// conventions. It represents the port extracted from the `url.full`. -func URLPort(val int) attribute.KeyValue { - return URLPortKey.Int(val) -} - -// URLQuery returns an attribute KeyValue conforming to the "url.query" semantic -// conventions. It represents the [URI query] component. -// -// [URI query]: https://www.rfc-editor.org/rfc/rfc3986#section-3.4 -func URLQuery(val string) attribute.KeyValue { - return URLQueryKey.String(val) -} - -// URLRegisteredDomain returns an attribute KeyValue conforming to the -// "url.registered_domain" semantic conventions. It represents the highest -// registered url domain, stripped of the subdomain. -func URLRegisteredDomain(val string) attribute.KeyValue { - return URLRegisteredDomainKey.String(val) -} - -// URLScheme returns an attribute KeyValue conforming to the "url.scheme" -// semantic conventions. It represents the [URI scheme] component identifying the -// used protocol. -// -// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 -func URLScheme(val string) attribute.KeyValue { - return URLSchemeKey.String(val) -} - -// URLSubdomain returns an attribute KeyValue conforming to the "url.subdomain" -// semantic conventions. It represents the subdomain portion of a fully qualified -// domain name includes all of the names except the host name under the -// registered_domain. In a partially qualified domain, or if the qualification -// level of the full name cannot be determined, subdomain contains all of the -// names below the registered domain. -func URLSubdomain(val string) attribute.KeyValue { - return URLSubdomainKey.String(val) -} - -// URLTemplate returns an attribute KeyValue conforming to the "url.template" -// semantic conventions. It represents the low-cardinality template of an -// [absolute path reference]. -// -// [absolute path reference]: https://www.rfc-editor.org/rfc/rfc3986#section-4.2 -func URLTemplate(val string) attribute.KeyValue { - return URLTemplateKey.String(val) -} - -// URLTopLevelDomain returns an attribute KeyValue conforming to the -// "url.top_level_domain" semantic conventions. It represents the effective top -// level domain (eTLD), also known as the domain suffix, is the last part of the -// domain name. For example, the top level domain for example.com is `com`. -func URLTopLevelDomain(val string) attribute.KeyValue { - return URLTopLevelDomainKey.String(val) -} - -// Namespace: user -const ( - // UserEmailKey is the attribute Key conforming to the "user.email" semantic - // conventions. It represents the user email address. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "a.einstein@example.com" - UserEmailKey = attribute.Key("user.email") - - // UserFullNameKey is the attribute Key conforming to the "user.full_name" - // semantic conventions. It represents the user's full name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Albert Einstein" - UserFullNameKey = attribute.Key("user.full_name") - - // UserHashKey is the attribute Key conforming to the "user.hash" semantic - // conventions. It represents the unique user hash to correlate information for - // a user in anonymized form. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "364fc68eaf4c8acec74a4e52d7d1feaa" - // Note: Useful if `user.id` or `user.name` contain confidential information and - // cannot be used. - UserHashKey = attribute.Key("user.hash") - - // UserIDKey is the attribute Key conforming to the "user.id" semantic - // conventions. It represents the unique identifier of the user. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "S-1-5-21-202424912787-2692429404-2351956786-1000" - UserIDKey = attribute.Key("user.id") - - // UserNameKey is the attribute Key conforming to the "user.name" semantic - // conventions. It represents the short name or login/username of the user. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "a.einstein" - UserNameKey = attribute.Key("user.name") - - // UserRolesKey is the attribute Key conforming to the "user.roles" semantic - // conventions. It represents the array of user roles at the time of the event. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "admin", "reporting_user" - UserRolesKey = attribute.Key("user.roles") -) - -// UserEmail returns an attribute KeyValue conforming to the "user.email" -// semantic conventions. It represents the user email address. -func UserEmail(val string) attribute.KeyValue { - return UserEmailKey.String(val) -} - -// UserFullName returns an attribute KeyValue conforming to the "user.full_name" -// semantic conventions. It represents the user's full name. -func UserFullName(val string) attribute.KeyValue { - return UserFullNameKey.String(val) -} - -// UserHash returns an attribute KeyValue conforming to the "user.hash" semantic -// conventions. It represents the unique user hash to correlate information for a -// user in anonymized form. -func UserHash(val string) attribute.KeyValue { - return UserHashKey.String(val) -} - -// UserID returns an attribute KeyValue conforming to the "user.id" semantic -// conventions. It represents the unique identifier of the user. -func UserID(val string) attribute.KeyValue { - return UserIDKey.String(val) -} - -// UserName returns an attribute KeyValue conforming to the "user.name" semantic -// conventions. It represents the short name or login/username of the user. -func UserName(val string) attribute.KeyValue { - return UserNameKey.String(val) -} - -// UserRoles returns an attribute KeyValue conforming to the "user.roles" -// semantic conventions. It represents the array of user roles at the time of the -// event. -func UserRoles(val ...string) attribute.KeyValue { - return UserRolesKey.StringSlice(val) -} - -// Namespace: user_agent -const ( - // UserAgentNameKey is the attribute Key conforming to the "user_agent.name" - // semantic conventions. It represents the name of the user-agent extracted from - // original. Usually refers to the browser's name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Safari", "YourApp" - // Note: [Example] of extracting browser's name from original string. In the - // case of using a user-agent for non-browser products, such as microservices - // with multiple names/versions inside the `user_agent.original`, the most - // significant name SHOULD be selected. In such a scenario it should align with - // `user_agent.version` - // - // [Example]: https://uaparser.dev/#demo - UserAgentNameKey = attribute.Key("user_agent.name") - - // UserAgentOriginalKey is the attribute Key conforming to the - // "user_agent.original" semantic conventions. It represents the value of the - // [HTTP User-Agent] header sent by the client. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Stable - // - // Examples: "CERN-LineMode/2.15 libwww/2.17b3", "Mozilla/5.0 (iPhone; CPU - // iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) - // Version/14.1.2 Mobile/15E148 Safari/604.1", "YourApp/1.0.0 - // grpc-java-okhttp/1.27.2" - // - // [HTTP User-Agent]: https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent - UserAgentOriginalKey = attribute.Key("user_agent.original") - - // UserAgentOSNameKey is the attribute Key conforming to the - // "user_agent.os.name" semantic conventions. It represents the human readable - // operating system name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "iOS", "Android", "Ubuntu" - // Note: For mapping user agent strings to OS names, libraries such as - // [ua-parser] can be utilized. - // - // [ua-parser]: https://github.com/ua-parser - UserAgentOSNameKey = attribute.Key("user_agent.os.name") - - // UserAgentOSVersionKey is the attribute Key conforming to the - // "user_agent.os.version" semantic conventions. It represents the version - // string of the operating system as defined in [Version Attributes]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "14.2.1", "18.04.1" - // Note: For mapping user agent strings to OS versions, libraries such as - // [ua-parser] can be utilized. - // - // [Version Attributes]: /docs/resource/README.md#version-attributes - // [ua-parser]: https://github.com/ua-parser - UserAgentOSVersionKey = attribute.Key("user_agent.os.version") - - // UserAgentSyntheticTypeKey is the attribute Key conforming to the - // "user_agent.synthetic.type" semantic conventions. It represents the specifies - // the category of synthetic traffic, such as tests or bots. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: This attribute MAY be derived from the contents of the - // `user_agent.original` attribute. Components that populate the attribute are - // responsible for determining what they consider to be synthetic bot or test - // traffic. This attribute can either be set for self-identification purposes, - // or on telemetry detected to be generated as a result of a synthetic request. - // This attribute is useful for distinguishing between genuine client traffic - // and synthetic traffic generated by bots or tests. - UserAgentSyntheticTypeKey = attribute.Key("user_agent.synthetic.type") - - // UserAgentVersionKey is the attribute Key conforming to the - // "user_agent.version" semantic conventions. It represents the version of the - // user-agent extracted from original. Usually refers to the browser's version. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "14.1.2", "1.0.0" - // Note: [Example] of extracting browser's version from original string. In the - // case of using a user-agent for non-browser products, such as microservices - // with multiple names/versions inside the `user_agent.original`, the most - // significant version SHOULD be selected. In such a scenario it should align - // with `user_agent.name` - // - // [Example]: https://uaparser.dev/#demo - UserAgentVersionKey = attribute.Key("user_agent.version") -) - -// UserAgentName returns an attribute KeyValue conforming to the -// "user_agent.name" semantic conventions. It represents the name of the -// user-agent extracted from original. Usually refers to the browser's name. -func UserAgentName(val string) attribute.KeyValue { - return UserAgentNameKey.String(val) -} - -// UserAgentOriginal returns an attribute KeyValue conforming to the -// "user_agent.original" semantic conventions. It represents the value of the -// [HTTP User-Agent] header sent by the client. -// -// [HTTP User-Agent]: https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent -func UserAgentOriginal(val string) attribute.KeyValue { - return UserAgentOriginalKey.String(val) -} - -// UserAgentOSName returns an attribute KeyValue conforming to the -// "user_agent.os.name" semantic conventions. It represents the human readable -// operating system name. -func UserAgentOSName(val string) attribute.KeyValue { - return UserAgentOSNameKey.String(val) -} - -// UserAgentOSVersion returns an attribute KeyValue conforming to the -// "user_agent.os.version" semantic conventions. It represents the version string -// of the operating system as defined in [Version Attributes]. -// -// [Version Attributes]: /docs/resource/README.md#version-attributes -func UserAgentOSVersion(val string) attribute.KeyValue { - return UserAgentOSVersionKey.String(val) -} - -// UserAgentVersion returns an attribute KeyValue conforming to the -// "user_agent.version" semantic conventions. It represents the version of the -// user-agent extracted from original. Usually refers to the browser's version. -func UserAgentVersion(val string) attribute.KeyValue { - return UserAgentVersionKey.String(val) -} - -// Enum values for user_agent.synthetic.type -var ( - // Bot source. - // Stability: development - UserAgentSyntheticTypeBot = UserAgentSyntheticTypeKey.String("bot") - // Synthetic test source. - // Stability: development - UserAgentSyntheticTypeTest = UserAgentSyntheticTypeKey.String("test") -) - -// Namespace: vcs -const ( - // VCSChangeIDKey is the attribute Key conforming to the "vcs.change.id" - // semantic conventions. It represents the ID of the change (pull request/merge - // request/changelist) if applicable. This is usually a unique (within - // repository) identifier generated by the VCS system. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "123" - VCSChangeIDKey = attribute.Key("vcs.change.id") - - // VCSChangeStateKey is the attribute Key conforming to the "vcs.change.state" - // semantic conventions. It represents the state of the change (pull - // request/merge request/changelist). - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "open", "closed", "merged" - VCSChangeStateKey = attribute.Key("vcs.change.state") - - // VCSChangeTitleKey is the attribute Key conforming to the "vcs.change.title" - // semantic conventions. It represents the human readable title of the change - // (pull request/merge request/changelist). This title is often a brief summary - // of the change and may get merged in to a ref as the commit summary. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Fixes broken thing", "feat: add my new feature", "[chore] update - // dependency" - VCSChangeTitleKey = attribute.Key("vcs.change.title") - - // VCSLineChangeTypeKey is the attribute Key conforming to the - // "vcs.line_change.type" semantic conventions. It represents the type of line - // change being measured on a branch or change. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "added", "removed" - VCSLineChangeTypeKey = attribute.Key("vcs.line_change.type") - - // VCSOwnerNameKey is the attribute Key conforming to the "vcs.owner.name" - // semantic conventions. It represents the group owner within the version - // control system. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "my-org", "myteam", "business-unit" - VCSOwnerNameKey = attribute.Key("vcs.owner.name") - - // VCSProviderNameKey is the attribute Key conforming to the "vcs.provider.name" - // semantic conventions. It represents the name of the version control system - // provider. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "github", "gitlab", "gitea", "bitbucket" - VCSProviderNameKey = attribute.Key("vcs.provider.name") - - // VCSRefBaseNameKey is the attribute Key conforming to the "vcs.ref.base.name" - // semantic conventions. It represents the name of the [reference] such as - // **branch** or **tag** in the repository. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "my-feature-branch", "tag-1-test" - // Note: `base` refers to the starting point of a change. For example, `main` - // would be the base reference of type branch if you've created a new - // reference of type branch from it and created new commits. - // - // [reference]: https://git-scm.com/docs/gitglossary#def_ref - VCSRefBaseNameKey = attribute.Key("vcs.ref.base.name") - - // VCSRefBaseRevisionKey is the attribute Key conforming to the - // "vcs.ref.base.revision" semantic conventions. It represents the revision, - // literally [revised version], The revision most often refers to a commit - // object in Git, or a revision number in SVN. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "9d59409acf479dfa0df1aa568182e43e43df8bbe28d60fcf2bc52e30068802cc", - // "main", "123", "HEAD" - // Note: `base` refers to the starting point of a change. For example, `main` - // would be the base reference of type branch if you've created a new - // reference of type branch from it and created new commits. The - // revision can be a full [hash value (see - // glossary)], - // of the recorded change to a ref within a repository pointing to a - // commit [commit] object. It does - // not necessarily have to be a hash; it can simply define a [revision - // number] - // which is an integer that is monotonically increasing. In cases where - // it is identical to the `ref.base.name`, it SHOULD still be included. - // It is up to the implementer to decide which value to set as the - // revision based on the VCS system and situational context. - // - // [revised version]: https://www.merriam-webster.com/dictionary/revision - // [hash value (see - // glossary)]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf - // [commit]: https://git-scm.com/docs/git-commit - // [revision - // number]: https://svnbook.red-bean.com/en/1.7/svn.tour.revs.specifiers.html - VCSRefBaseRevisionKey = attribute.Key("vcs.ref.base.revision") - - // VCSRefBaseTypeKey is the attribute Key conforming to the "vcs.ref.base.type" - // semantic conventions. It represents the type of the [reference] in the - // repository. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "branch", "tag" - // Note: `base` refers to the starting point of a change. For example, `main` - // would be the base reference of type branch if you've created a new - // reference of type branch from it and created new commits. - // - // [reference]: https://git-scm.com/docs/gitglossary#def_ref - VCSRefBaseTypeKey = attribute.Key("vcs.ref.base.type") - - // VCSRefHeadNameKey is the attribute Key conforming to the "vcs.ref.head.name" - // semantic conventions. It represents the name of the [reference] such as - // **branch** or **tag** in the repository. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "my-feature-branch", "tag-1-test" - // Note: `head` refers to where you are right now; the current reference at a - // given time. - // - // [reference]: https://git-scm.com/docs/gitglossary#def_ref - VCSRefHeadNameKey = attribute.Key("vcs.ref.head.name") - - // VCSRefHeadRevisionKey is the attribute Key conforming to the - // "vcs.ref.head.revision" semantic conventions. It represents the revision, - // literally [revised version], The revision most often refers to a commit - // object in Git, or a revision number in SVN. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "9d59409acf479dfa0df1aa568182e43e43df8bbe28d60fcf2bc52e30068802cc", - // "main", "123", "HEAD" - // Note: `head` refers to where you are right now; the current reference at a - // given time.The revision can be a full [hash value (see - // glossary)], - // of the recorded change to a ref within a repository pointing to a - // commit [commit] object. It does - // not necessarily have to be a hash; it can simply define a [revision - // number] - // which is an integer that is monotonically increasing. In cases where - // it is identical to the `ref.head.name`, it SHOULD still be included. - // It is up to the implementer to decide which value to set as the - // revision based on the VCS system and situational context. - // - // [revised version]: https://www.merriam-webster.com/dictionary/revision - // [hash value (see - // glossary)]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf - // [commit]: https://git-scm.com/docs/git-commit - // [revision - // number]: https://svnbook.red-bean.com/en/1.7/svn.tour.revs.specifiers.html - VCSRefHeadRevisionKey = attribute.Key("vcs.ref.head.revision") - - // VCSRefHeadTypeKey is the attribute Key conforming to the "vcs.ref.head.type" - // semantic conventions. It represents the type of the [reference] in the - // repository. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "branch", "tag" - // Note: `head` refers to where you are right now; the current reference at a - // given time. - // - // [reference]: https://git-scm.com/docs/gitglossary#def_ref - VCSRefHeadTypeKey = attribute.Key("vcs.ref.head.type") - - // VCSRefTypeKey is the attribute Key conforming to the "vcs.ref.type" semantic - // conventions. It represents the type of the [reference] in the repository. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "branch", "tag" - // - // [reference]: https://git-scm.com/docs/gitglossary#def_ref - VCSRefTypeKey = attribute.Key("vcs.ref.type") - - // VCSRepositoryNameKey is the attribute Key conforming to the - // "vcs.repository.name" semantic conventions. It represents the human readable - // name of the repository. It SHOULD NOT include any additional identifier like - // Group/SubGroup in GitLab or organization in GitHub. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "semantic-conventions", "my-cool-repo" - // Note: Due to it only being the name, it can clash with forks of the same - // repository if collecting telemetry across multiple orgs or groups in - // the same backends. - VCSRepositoryNameKey = attribute.Key("vcs.repository.name") - - // VCSRepositoryURLFullKey is the attribute Key conforming to the - // "vcs.repository.url.full" semantic conventions. It represents the - // [canonical URL] of the repository providing the complete HTTP(S) address in - // order to locate and identify the repository through a browser. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // "https://github.com/opentelemetry/open-telemetry-collector-contrib", - // "https://gitlab.com/my-org/my-project/my-projects-project/repo" - // Note: In Git Version Control Systems, the canonical URL SHOULD NOT include - // the `.git` extension. - // - // [canonical URL]: https://support.google.com/webmasters/answer/10347851 - VCSRepositoryURLFullKey = attribute.Key("vcs.repository.url.full") - - // VCSRevisionDeltaDirectionKey is the attribute Key conforming to the - // "vcs.revision_delta.direction" semantic conventions. It represents the type - // of revision comparison. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "ahead", "behind" - VCSRevisionDeltaDirectionKey = attribute.Key("vcs.revision_delta.direction") -) - -// VCSChangeID returns an attribute KeyValue conforming to the "vcs.change.id" -// semantic conventions. It represents the ID of the change (pull request/merge -// request/changelist) if applicable. This is usually a unique (within -// repository) identifier generated by the VCS system. -func VCSChangeID(val string) attribute.KeyValue { - return VCSChangeIDKey.String(val) -} - -// VCSChangeTitle returns an attribute KeyValue conforming to the -// "vcs.change.title" semantic conventions. It represents the human readable -// title of the change (pull request/merge request/changelist). This title is -// often a brief summary of the change and may get merged in to a ref as the -// commit summary. -func VCSChangeTitle(val string) attribute.KeyValue { - return VCSChangeTitleKey.String(val) -} - -// VCSOwnerName returns an attribute KeyValue conforming to the "vcs.owner.name" -// semantic conventions. It represents the group owner within the version control -// system. -func VCSOwnerName(val string) attribute.KeyValue { - return VCSOwnerNameKey.String(val) -} - -// VCSRefBaseName returns an attribute KeyValue conforming to the -// "vcs.ref.base.name" semantic conventions. It represents the name of the -// [reference] such as **branch** or **tag** in the repository. -// -// [reference]: https://git-scm.com/docs/gitglossary#def_ref -func VCSRefBaseName(val string) attribute.KeyValue { - return VCSRefBaseNameKey.String(val) -} - -// VCSRefBaseRevision returns an attribute KeyValue conforming to the -// "vcs.ref.base.revision" semantic conventions. It represents the revision, -// literally [revised version], The revision most often refers to a commit object -// in Git, or a revision number in SVN. -// -// [revised version]: https://www.merriam-webster.com/dictionary/revision -func VCSRefBaseRevision(val string) attribute.KeyValue { - return VCSRefBaseRevisionKey.String(val) -} - -// VCSRefHeadName returns an attribute KeyValue conforming to the -// "vcs.ref.head.name" semantic conventions. It represents the name of the -// [reference] such as **branch** or **tag** in the repository. -// -// [reference]: https://git-scm.com/docs/gitglossary#def_ref -func VCSRefHeadName(val string) attribute.KeyValue { - return VCSRefHeadNameKey.String(val) -} - -// VCSRefHeadRevision returns an attribute KeyValue conforming to the -// "vcs.ref.head.revision" semantic conventions. It represents the revision, -// literally [revised version], The revision most often refers to a commit object -// in Git, or a revision number in SVN. -// -// [revised version]: https://www.merriam-webster.com/dictionary/revision -func VCSRefHeadRevision(val string) attribute.KeyValue { - return VCSRefHeadRevisionKey.String(val) -} - -// VCSRepositoryName returns an attribute KeyValue conforming to the -// "vcs.repository.name" semantic conventions. It represents the human readable -// name of the repository. It SHOULD NOT include any additional identifier like -// Group/SubGroup in GitLab or organization in GitHub. -func VCSRepositoryName(val string) attribute.KeyValue { - return VCSRepositoryNameKey.String(val) -} - -// VCSRepositoryURLFull returns an attribute KeyValue conforming to the -// "vcs.repository.url.full" semantic conventions. It represents the -// [canonical URL] of the repository providing the complete HTTP(S) address in -// order to locate and identify the repository through a browser. -// -// [canonical URL]: https://support.google.com/webmasters/answer/10347851 -func VCSRepositoryURLFull(val string) attribute.KeyValue { - return VCSRepositoryURLFullKey.String(val) -} - -// Enum values for vcs.change.state -var ( - // Open means the change is currently active and under review. It hasn't been - // merged into the target branch yet, and it's still possible to make changes or - // add comments. - // Stability: development - VCSChangeStateOpen = VCSChangeStateKey.String("open") - // WIP (work-in-progress, draft) means the change is still in progress and not - // yet ready for a full review. It might still undergo significant changes. - // Stability: development - VCSChangeStateWip = VCSChangeStateKey.String("wip") - // Closed means the merge request has been closed without merging. This can - // happen for various reasons, such as the changes being deemed unnecessary, the - // issue being resolved in another way, or the author deciding to withdraw the - // request. - // Stability: development - VCSChangeStateClosed = VCSChangeStateKey.String("closed") - // Merged indicates that the change has been successfully integrated into the - // target codebase. - // Stability: development - VCSChangeStateMerged = VCSChangeStateKey.String("merged") -) - -// Enum values for vcs.line_change.type -var ( - // How many lines were added. - // Stability: development - VCSLineChangeTypeAdded = VCSLineChangeTypeKey.String("added") - // How many lines were removed. - // Stability: development - VCSLineChangeTypeRemoved = VCSLineChangeTypeKey.String("removed") -) - -// Enum values for vcs.provider.name -var ( - // [GitHub] - // Stability: development - // - // [GitHub]: https://github.com - VCSProviderNameGithub = VCSProviderNameKey.String("github") - // [GitLab] - // Stability: development - // - // [GitLab]: https://gitlab.com - VCSProviderNameGitlab = VCSProviderNameKey.String("gitlab") - // [Gitea] - // Stability: development - // - // [Gitea]: https://gitea.io - VCSProviderNameGitea = VCSProviderNameKey.String("gitea") - // [Bitbucket] - // Stability: development - // - // [Bitbucket]: https://bitbucket.org - VCSProviderNameBitbucket = VCSProviderNameKey.String("bitbucket") -) - -// Enum values for vcs.ref.base.type -var ( - // [branch] - // Stability: development - // - // [branch]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch - VCSRefBaseTypeBranch = VCSRefBaseTypeKey.String("branch") - // [tag] - // Stability: development - // - // [tag]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag - VCSRefBaseTypeTag = VCSRefBaseTypeKey.String("tag") -) - -// Enum values for vcs.ref.head.type -var ( - // [branch] - // Stability: development - // - // [branch]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch - VCSRefHeadTypeBranch = VCSRefHeadTypeKey.String("branch") - // [tag] - // Stability: development - // - // [tag]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag - VCSRefHeadTypeTag = VCSRefHeadTypeKey.String("tag") -) - -// Enum values for vcs.ref.type -var ( - // [branch] - // Stability: development - // - // [branch]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch - VCSRefTypeBranch = VCSRefTypeKey.String("branch") - // [tag] - // Stability: development - // - // [tag]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag - VCSRefTypeTag = VCSRefTypeKey.String("tag") -) - -// Enum values for vcs.revision_delta.direction -var ( - // How many revisions the change is behind the target ref. - // Stability: development - VCSRevisionDeltaDirectionBehind = VCSRevisionDeltaDirectionKey.String("behind") - // How many revisions the change is ahead of the target ref. - // Stability: development - VCSRevisionDeltaDirectionAhead = VCSRevisionDeltaDirectionKey.String("ahead") -) - -// Namespace: webengine -const ( - // WebEngineDescriptionKey is the attribute Key conforming to the - // "webengine.description" semantic conventions. It represents the additional - // description of the web engine (e.g. detailed version and edition - // information). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - - // 2.2.2.Final" - WebEngineDescriptionKey = attribute.Key("webengine.description") - - // WebEngineNameKey is the attribute Key conforming to the "webengine.name" - // semantic conventions. It represents the name of the web engine. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "WildFly" - WebEngineNameKey = attribute.Key("webengine.name") - - // WebEngineVersionKey is the attribute Key conforming to the - // "webengine.version" semantic conventions. It represents the version of the - // web engine. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "21.0.0" - WebEngineVersionKey = attribute.Key("webengine.version") -) - -// WebEngineDescription returns an attribute KeyValue conforming to the -// "webengine.description" semantic conventions. It represents the additional -// description of the web engine (e.g. detailed version and edition information). -func WebEngineDescription(val string) attribute.KeyValue { - return WebEngineDescriptionKey.String(val) -} - -// WebEngineName returns an attribute KeyValue conforming to the "webengine.name" -// semantic conventions. It represents the name of the web engine. -func WebEngineName(val string) attribute.KeyValue { - return WebEngineNameKey.String(val) -} - -// WebEngineVersion returns an attribute KeyValue conforming to the -// "webengine.version" semantic conventions. It represents the version of the web -// engine. -func WebEngineVersion(val string) attribute.KeyValue { - return WebEngineVersionKey.String(val) -} - -// Namespace: zos -const ( - // ZOSSmfIDKey is the attribute Key conforming to the "zos.smf.id" semantic - // conventions. It represents the System Management Facility (SMF) Identifier - // uniquely identified a z/OS system within a SYSPLEX or mainframe environment - // and is used for system and performance analysis. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "SYS1" - ZOSSmfIDKey = attribute.Key("zos.smf.id") - - // ZOSSysplexNameKey is the attribute Key conforming to the "zos.sysplex.name" - // semantic conventions. It represents the name of the SYSPLEX to which the z/OS - // system belongs too. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "SYSPLEX1" - ZOSSysplexNameKey = attribute.Key("zos.sysplex.name") -) - -// ZOSSmfID returns an attribute KeyValue conforming to the "zos.smf.id" semantic -// conventions. It represents the System Management Facility (SMF) Identifier -// uniquely identified a z/OS system within a SYSPLEX or mainframe environment -// and is used for system and performance analysis. -func ZOSSmfID(val string) attribute.KeyValue { - return ZOSSmfIDKey.String(val) -} - -// ZOSSysplexName returns an attribute KeyValue conforming to the -// "zos.sysplex.name" semantic conventions. It represents the name of the SYSPLEX -// to which the z/OS system belongs too. -func ZOSSysplexName(val string) attribute.KeyValue { - return ZOSSysplexNameKey.String(val) -} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/doc.go deleted file mode 100644 index 852362ef77..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Package semconv implements OpenTelemetry semantic conventions. -// -// OpenTelemetry semantic conventions are agreed standardized naming -// patterns for OpenTelemetry things. This package represents the v1.39.0 -// version of the OpenTelemetry semantic conventions. -package semconv // import "go.opentelemetry.io/otel/semconv/v1.39.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/error_type.go b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/error_type.go deleted file mode 100644 index 84cf636a72..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/error_type.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.39.0" - -import ( - "reflect" - - "go.opentelemetry.io/otel/attribute" -) - -// ErrorType returns an [attribute.KeyValue] identifying the error type of err. -// -// If err is nil, the returned attribute has the default value -// [ErrorTypeOther]. -// -// If err's type has the method -// -// ErrorType() string -// -// then the returned attribute has the value of err.ErrorType(). Otherwise, the -// returned attribute has a value derived from the concrete type of err. -// -// The key of the returned attribute is [ErrorTypeKey]. -func ErrorType(err error) attribute.KeyValue { - if err == nil { - return ErrorTypeOther - } - - return ErrorTypeKey.String(errorType(err)) -} - -func errorType(err error) string { - var s string - if et, ok := err.(interface{ ErrorType() string }); ok { - // Prioritize the ErrorType method if available. - s = et.ErrorType() - } - if s == "" { - // Fallback to reflection if the ErrorType method is not supported or - // returns an empty value. - - t := reflect.TypeOf(err) - pkg, name := t.PkgPath(), t.Name() - if pkg != "" && name != "" { - s = pkg + "." + name - } else { - // The type has no package path or name (predeclared, not-defined, - // or alias for a not-defined type). - // - // This is not guaranteed to be unique, but is a best effort. - s = t.String() - } - } - return s -} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/exception.go deleted file mode 100644 index 7b688ecc33..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/exception.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.39.0" - -const ( - // ExceptionEventName is the name of the Span event representing an exception. - ExceptionEventName = "exception" -) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/rpcconv/metric.go b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/rpcconv/metric.go deleted file mode 100644 index ac0a9c9960..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/rpcconv/metric.go +++ /dev/null @@ -1,1141 +0,0 @@ -// Code generated from semantic convention specification. DO NOT EDIT. - -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Package rpcconv provides types and functionality for OpenTelemetry semantic -// conventions in the "rpc" namespace. -package rpcconv - -import ( - "context" - "sync" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" -) - -var ( - addOptPool = &sync.Pool{New: func() any { return &[]metric.AddOption{} }} - recOptPool = &sync.Pool{New: func() any { return &[]metric.RecordOption{} }} -) - -// ErrorTypeAttr is an attribute conforming to the error.type semantic -// conventions. It represents the describes a class of error the operation ended -// with. -type ErrorTypeAttr string - -// ErrorTypeOther is a fallback error value to be used when the instrumentation -// doesn't define a custom value. -var ErrorTypeOther ErrorTypeAttr = "_OTHER" - -// NetworkTransportAttr is an attribute conforming to the network.transport -// semantic conventions. It represents the [OSI transport layer] or -// [inter-process communication method]. -// -// [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer -// [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication -type NetworkTransportAttr string - -var ( - // NetworkTransportTCP is the TCP. - NetworkTransportTCP NetworkTransportAttr = "tcp" - // NetworkTransportUDP is the UDP. - NetworkTransportUDP NetworkTransportAttr = "udp" - // NetworkTransportPipe is the named or anonymous pipe. - NetworkTransportPipe NetworkTransportAttr = "pipe" - // NetworkTransportUnix is the unix domain socket. - NetworkTransportUnix NetworkTransportAttr = "unix" - // NetworkTransportQUIC is the QUIC. - NetworkTransportQUIC NetworkTransportAttr = "quic" -) - -// SystemNameAttr is an attribute conforming to the rpc.system.name semantic -// conventions. It represents the Remote Procedure Call (RPC) system. -type SystemNameAttr string - -var ( - // SystemNameGRPC is the [gRPC]. - // - // [gRPC]: https://grpc.io/ - SystemNameGRPC SystemNameAttr = "grpc" - // SystemNameDubbo is the [Apache Dubbo]. - // - // [Apache Dubbo]: https://dubbo.apache.org/ - SystemNameDubbo SystemNameAttr = "dubbo" - // SystemNameConnectrpc is the [Connect RPC]. - // - // [Connect RPC]: https://connectrpc.com/ - SystemNameConnectrpc SystemNameAttr = "connectrpc" - // SystemNameJSONRPC is the [JSON-RPC]. - // - // [JSON-RPC]: https://www.jsonrpc.org/ - SystemNameJSONRPC SystemNameAttr = "jsonrpc" -) - -// ClientCallDuration is an instrument used to record metric values conforming to -// the "rpc.client.call.duration" semantic conventions. It represents the -// measures the duration of outbound remote procedure calls (RPC). -type ClientCallDuration struct { - metric.Float64Histogram -} - -var newClientCallDurationOpts = []metric.Float64HistogramOption{ - metric.WithDescription("Measures the duration of outbound remote procedure calls (RPC)."), - metric.WithUnit("s"), -} - -// NewClientCallDuration returns a new ClientCallDuration instrument. -func NewClientCallDuration( - m metric.Meter, - opt ...metric.Float64HistogramOption, -) (ClientCallDuration, error) { - // Check if the meter is nil. - if m == nil { - return ClientCallDuration{noop.Float64Histogram{}}, nil - } - - if len(opt) == 0 { - opt = newClientCallDurationOpts - } else { - opt = append(opt, newClientCallDurationOpts...) - } - - i, err := m.Float64Histogram( - "rpc.client.call.duration", - opt..., - ) - if err != nil { - return ClientCallDuration{noop.Float64Histogram{}}, err - } - return ClientCallDuration{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m ClientCallDuration) Inst() metric.Float64Histogram { - return m.Float64Histogram -} - -// Name returns the semantic convention name of the instrument. -func (ClientCallDuration) Name() string { - return "rpc.client.call.duration" -} - -// Unit returns the semantic convention unit of the instrument -func (ClientCallDuration) Unit() string { - return "s" -} - -// Description returns the semantic convention description of the instrument -func (ClientCallDuration) Description() string { - return "Measures the duration of outbound remote procedure calls (RPC)." -} - -// Record records val to the current distribution for attrs. -// -// The systemName is the the Remote Procedure Call (RPC) system. -// -// All additional attrs passed are included in the recorded value. -// -// When this metric is reported alongside an RPC client span, the metric value -// SHOULD be the same as the RPC client span duration. -func (m ClientCallDuration) Record( - ctx context.Context, - val float64, - systemName SystemNameAttr, - attrs ...attribute.KeyValue, -) { - if len(attrs) == 0 { - m.Float64Histogram.Record(ctx, val, metric.WithAttributes( - attribute.String("rpc.system.name", string(systemName)), - )) - return - } - - o := recOptPool.Get().(*[]metric.RecordOption) - defer func() { - *o = (*o)[:0] - recOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - append( - attrs, - attribute.String("rpc.system.name", string(systemName)), - )..., - ), - ) - - m.Float64Histogram.Record(ctx, val, *o...) -} - -// RecordSet records val to the current distribution for set. -// -// When this metric is reported alongside an RPC client span, the metric value -// SHOULD be the same as the RPC client span duration. -func (m ClientCallDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { - if set.Len() == 0 { - m.Float64Histogram.Record(ctx, val) - return - } - - o := recOptPool.Get().(*[]metric.RecordOption) - defer func() { - *o = (*o)[:0] - recOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Float64Histogram.Record(ctx, val, *o...) -} - -// AttrErrorType returns an optional attribute for the "error.type" semantic -// convention. It represents the describes a class of error the operation ended -// with. -func (ClientCallDuration) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { - return attribute.String("error.type", string(val)) -} - -// AttrMethod returns an optional attribute for the "rpc.method" semantic -// convention. It represents the fully-qualified logical name of the method from -// the RPC interface perspective. -func (ClientCallDuration) AttrMethod(val string) attribute.KeyValue { - return attribute.String("rpc.method", val) -} - -// AttrResponseStatusCode returns an optional attribute for the -// "rpc.response.status_code" semantic convention. It represents the status code -// of the RPC returned by the RPC server or generated by the client. -func (ClientCallDuration) AttrResponseStatusCode(val string) attribute.KeyValue { - return attribute.String("rpc.response.status_code", val) -} - -// AttrServerAddress returns an optional attribute for the "server.address" -// semantic convention. It represents the RPC server [host name]. -// -// [host name]: https://grpc.github.io/grpc/core/md_doc_naming.html -func (ClientCallDuration) AttrServerAddress(val string) attribute.KeyValue { - return attribute.String("server.address", val) -} - -// AttrServerPort returns an optional attribute for the "server.port" semantic -// convention. It represents the server port number. -func (ClientCallDuration) AttrServerPort(val int) attribute.KeyValue { - return attribute.Int("server.port", val) -} - -// AttrNetworkProtocolName returns an optional attribute for the -// "network.protocol.name" semantic convention. It represents the -// [OSI application layer] or non-OSI equivalent. -// -// [OSI application layer]: https://wikipedia.org/wiki/Application_layer -func (ClientCallDuration) AttrNetworkProtocolName(val string) attribute.KeyValue { - return attribute.String("network.protocol.name", val) -} - -// AttrNetworkProtocolVersion returns an optional attribute for the -// "network.protocol.version" semantic convention. It represents the actual -// version of the protocol used for network communication. -func (ClientCallDuration) AttrNetworkProtocolVersion(val string) attribute.KeyValue { - return attribute.String("network.protocol.version", val) -} - -// AttrNetworkTransport returns an optional attribute for the "network.transport" -// semantic convention. It represents the [OSI transport layer] or -// [inter-process communication method]. -// -// [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer -// [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication -func (ClientCallDuration) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue { - return attribute.String("network.transport", string(val)) -} - -// ClientRequestSize is an instrument used to record metric values conforming to -// the "rpc.client.request.size" semantic conventions. It represents the measures -// the size of RPC request messages (uncompressed). -type ClientRequestSize struct { - metric.Int64Histogram -} - -var newClientRequestSizeOpts = []metric.Int64HistogramOption{ - metric.WithDescription("Measures the size of RPC request messages (uncompressed)."), - metric.WithUnit("By"), -} - -// NewClientRequestSize returns a new ClientRequestSize instrument. -func NewClientRequestSize( - m metric.Meter, - opt ...metric.Int64HistogramOption, -) (ClientRequestSize, error) { - // Check if the meter is nil. - if m == nil { - return ClientRequestSize{noop.Int64Histogram{}}, nil - } - - if len(opt) == 0 { - opt = newClientRequestSizeOpts - } else { - opt = append(opt, newClientRequestSizeOpts...) - } - - i, err := m.Int64Histogram( - "rpc.client.request.size", - opt..., - ) - if err != nil { - return ClientRequestSize{noop.Int64Histogram{}}, err - } - return ClientRequestSize{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m ClientRequestSize) Inst() metric.Int64Histogram { - return m.Int64Histogram -} - -// Name returns the semantic convention name of the instrument. -func (ClientRequestSize) Name() string { - return "rpc.client.request.size" -} - -// Unit returns the semantic convention unit of the instrument -func (ClientRequestSize) Unit() string { - return "By" -} - -// Description returns the semantic convention description of the instrument -func (ClientRequestSize) Description() string { - return "Measures the size of RPC request messages (uncompressed)." -} - -// Record records val to the current distribution for attrs. -// -// The systemName is the the Remote Procedure Call (RPC) system. -// -// All additional attrs passed are included in the recorded value. -// -// **Streaming**: Recorded per message in a streaming batch -func (m ClientRequestSize) Record( - ctx context.Context, - val int64, - systemName SystemNameAttr, - attrs ...attribute.KeyValue, -) { - if len(attrs) == 0 { - m.Int64Histogram.Record(ctx, val, metric.WithAttributes( - attribute.String("rpc.system.name", string(systemName)), - )) - return - } - - o := recOptPool.Get().(*[]metric.RecordOption) - defer func() { - *o = (*o)[:0] - recOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - append( - attrs, - attribute.String("rpc.system.name", string(systemName)), - )..., - ), - ) - - m.Int64Histogram.Record(ctx, val, *o...) -} - -// RecordSet records val to the current distribution for set. -// -// **Streaming**: Recorded per message in a streaming batch -func (m ClientRequestSize) RecordSet(ctx context.Context, val int64, set attribute.Set) { - if set.Len() == 0 { - m.Int64Histogram.Record(ctx, val) - return - } - - o := recOptPool.Get().(*[]metric.RecordOption) - defer func() { - *o = (*o)[:0] - recOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Int64Histogram.Record(ctx, val, *o...) -} - -// AttrErrorType returns an optional attribute for the "error.type" semantic -// convention. It represents the describes a class of error the operation ended -// with. -func (ClientRequestSize) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { - return attribute.String("error.type", string(val)) -} - -// AttrMethod returns an optional attribute for the "rpc.method" semantic -// convention. It represents the fully-qualified logical name of the method from -// the RPC interface perspective. -func (ClientRequestSize) AttrMethod(val string) attribute.KeyValue { - return attribute.String("rpc.method", val) -} - -// AttrResponseStatusCode returns an optional attribute for the -// "rpc.response.status_code" semantic convention. It represents the status code -// of the RPC returned by the RPC server or generated by the client. -func (ClientRequestSize) AttrResponseStatusCode(val string) attribute.KeyValue { - return attribute.String("rpc.response.status_code", val) -} - -// AttrServerAddress returns an optional attribute for the "server.address" -// semantic convention. It represents the RPC server [host name]. -// -// [host name]: https://grpc.github.io/grpc/core/md_doc_naming.html -func (ClientRequestSize) AttrServerAddress(val string) attribute.KeyValue { - return attribute.String("server.address", val) -} - -// AttrServerPort returns an optional attribute for the "server.port" semantic -// convention. It represents the server port number. -func (ClientRequestSize) AttrServerPort(val int) attribute.KeyValue { - return attribute.Int("server.port", val) -} - -// AttrNetworkProtocolName returns an optional attribute for the -// "network.protocol.name" semantic convention. It represents the -// [OSI application layer] or non-OSI equivalent. -// -// [OSI application layer]: https://wikipedia.org/wiki/Application_layer -func (ClientRequestSize) AttrNetworkProtocolName(val string) attribute.KeyValue { - return attribute.String("network.protocol.name", val) -} - -// AttrNetworkProtocolVersion returns an optional attribute for the -// "network.protocol.version" semantic convention. It represents the actual -// version of the protocol used for network communication. -func (ClientRequestSize) AttrNetworkProtocolVersion(val string) attribute.KeyValue { - return attribute.String("network.protocol.version", val) -} - -// AttrNetworkTransport returns an optional attribute for the "network.transport" -// semantic convention. It represents the [OSI transport layer] or -// [inter-process communication method]. -// -// [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer -// [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication -func (ClientRequestSize) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue { - return attribute.String("network.transport", string(val)) -} - -// ClientResponseSize is an instrument used to record metric values conforming to -// the "rpc.client.response.size" semantic conventions. It represents the -// measures the size of RPC response messages (uncompressed). -type ClientResponseSize struct { - metric.Int64Histogram -} - -var newClientResponseSizeOpts = []metric.Int64HistogramOption{ - metric.WithDescription("Measures the size of RPC response messages (uncompressed)."), - metric.WithUnit("By"), -} - -// NewClientResponseSize returns a new ClientResponseSize instrument. -func NewClientResponseSize( - m metric.Meter, - opt ...metric.Int64HistogramOption, -) (ClientResponseSize, error) { - // Check if the meter is nil. - if m == nil { - return ClientResponseSize{noop.Int64Histogram{}}, nil - } - - if len(opt) == 0 { - opt = newClientResponseSizeOpts - } else { - opt = append(opt, newClientResponseSizeOpts...) - } - - i, err := m.Int64Histogram( - "rpc.client.response.size", - opt..., - ) - if err != nil { - return ClientResponseSize{noop.Int64Histogram{}}, err - } - return ClientResponseSize{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m ClientResponseSize) Inst() metric.Int64Histogram { - return m.Int64Histogram -} - -// Name returns the semantic convention name of the instrument. -func (ClientResponseSize) Name() string { - return "rpc.client.response.size" -} - -// Unit returns the semantic convention unit of the instrument -func (ClientResponseSize) Unit() string { - return "By" -} - -// Description returns the semantic convention description of the instrument -func (ClientResponseSize) Description() string { - return "Measures the size of RPC response messages (uncompressed)." -} - -// Record records val to the current distribution for attrs. -// -// The systemName is the the Remote Procedure Call (RPC) system. -// -// All additional attrs passed are included in the recorded value. -// -// **Streaming**: Recorded per response in a streaming batch -func (m ClientResponseSize) Record( - ctx context.Context, - val int64, - systemName SystemNameAttr, - attrs ...attribute.KeyValue, -) { - if len(attrs) == 0 { - m.Int64Histogram.Record(ctx, val, metric.WithAttributes( - attribute.String("rpc.system.name", string(systemName)), - )) - return - } - - o := recOptPool.Get().(*[]metric.RecordOption) - defer func() { - *o = (*o)[:0] - recOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - append( - attrs, - attribute.String("rpc.system.name", string(systemName)), - )..., - ), - ) - - m.Int64Histogram.Record(ctx, val, *o...) -} - -// RecordSet records val to the current distribution for set. -// -// **Streaming**: Recorded per response in a streaming batch -func (m ClientResponseSize) RecordSet(ctx context.Context, val int64, set attribute.Set) { - if set.Len() == 0 { - m.Int64Histogram.Record(ctx, val) - return - } - - o := recOptPool.Get().(*[]metric.RecordOption) - defer func() { - *o = (*o)[:0] - recOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Int64Histogram.Record(ctx, val, *o...) -} - -// AttrErrorType returns an optional attribute for the "error.type" semantic -// convention. It represents the describes a class of error the operation ended -// with. -func (ClientResponseSize) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { - return attribute.String("error.type", string(val)) -} - -// AttrMethod returns an optional attribute for the "rpc.method" semantic -// convention. It represents the fully-qualified logical name of the method from -// the RPC interface perspective. -func (ClientResponseSize) AttrMethod(val string) attribute.KeyValue { - return attribute.String("rpc.method", val) -} - -// AttrResponseStatusCode returns an optional attribute for the -// "rpc.response.status_code" semantic convention. It represents the status code -// of the RPC returned by the RPC server or generated by the client. -func (ClientResponseSize) AttrResponseStatusCode(val string) attribute.KeyValue { - return attribute.String("rpc.response.status_code", val) -} - -// AttrServerAddress returns an optional attribute for the "server.address" -// semantic convention. It represents the RPC server [host name]. -// -// [host name]: https://grpc.github.io/grpc/core/md_doc_naming.html -func (ClientResponseSize) AttrServerAddress(val string) attribute.KeyValue { - return attribute.String("server.address", val) -} - -// AttrServerPort returns an optional attribute for the "server.port" semantic -// convention. It represents the server port number. -func (ClientResponseSize) AttrServerPort(val int) attribute.KeyValue { - return attribute.Int("server.port", val) -} - -// AttrNetworkProtocolName returns an optional attribute for the -// "network.protocol.name" semantic convention. It represents the -// [OSI application layer] or non-OSI equivalent. -// -// [OSI application layer]: https://wikipedia.org/wiki/Application_layer -func (ClientResponseSize) AttrNetworkProtocolName(val string) attribute.KeyValue { - return attribute.String("network.protocol.name", val) -} - -// AttrNetworkProtocolVersion returns an optional attribute for the -// "network.protocol.version" semantic convention. It represents the actual -// version of the protocol used for network communication. -func (ClientResponseSize) AttrNetworkProtocolVersion(val string) attribute.KeyValue { - return attribute.String("network.protocol.version", val) -} - -// AttrNetworkTransport returns an optional attribute for the "network.transport" -// semantic convention. It represents the [OSI transport layer] or -// [inter-process communication method]. -// -// [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer -// [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication -func (ClientResponseSize) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue { - return attribute.String("network.transport", string(val)) -} - -// ServerCallDuration is an instrument used to record metric values conforming to -// the "rpc.server.call.duration" semantic conventions. It represents the -// measures the duration of inbound remote procedure calls (RPC). -type ServerCallDuration struct { - metric.Float64Histogram -} - -var newServerCallDurationOpts = []metric.Float64HistogramOption{ - metric.WithDescription("Measures the duration of inbound remote procedure calls (RPC)."), - metric.WithUnit("s"), -} - -// NewServerCallDuration returns a new ServerCallDuration instrument. -func NewServerCallDuration( - m metric.Meter, - opt ...metric.Float64HistogramOption, -) (ServerCallDuration, error) { - // Check if the meter is nil. - if m == nil { - return ServerCallDuration{noop.Float64Histogram{}}, nil - } - - if len(opt) == 0 { - opt = newServerCallDurationOpts - } else { - opt = append(opt, newServerCallDurationOpts...) - } - - i, err := m.Float64Histogram( - "rpc.server.call.duration", - opt..., - ) - if err != nil { - return ServerCallDuration{noop.Float64Histogram{}}, err - } - return ServerCallDuration{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m ServerCallDuration) Inst() metric.Float64Histogram { - return m.Float64Histogram -} - -// Name returns the semantic convention name of the instrument. -func (ServerCallDuration) Name() string { - return "rpc.server.call.duration" -} - -// Unit returns the semantic convention unit of the instrument -func (ServerCallDuration) Unit() string { - return "s" -} - -// Description returns the semantic convention description of the instrument -func (ServerCallDuration) Description() string { - return "Measures the duration of inbound remote procedure calls (RPC)." -} - -// Record records val to the current distribution for attrs. -// -// The systemName is the the Remote Procedure Call (RPC) system. -// -// All additional attrs passed are included in the recorded value. -// -// When this metric is reported alongside an RPC server span, the metric value -// SHOULD be the same as the RPC server span duration. -func (m ServerCallDuration) Record( - ctx context.Context, - val float64, - systemName SystemNameAttr, - attrs ...attribute.KeyValue, -) { - if len(attrs) == 0 { - m.Float64Histogram.Record(ctx, val, metric.WithAttributes( - attribute.String("rpc.system.name", string(systemName)), - )) - return - } - - o := recOptPool.Get().(*[]metric.RecordOption) - defer func() { - *o = (*o)[:0] - recOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - append( - attrs, - attribute.String("rpc.system.name", string(systemName)), - )..., - ), - ) - - m.Float64Histogram.Record(ctx, val, *o...) -} - -// RecordSet records val to the current distribution for set. -// -// When this metric is reported alongside an RPC server span, the metric value -// SHOULD be the same as the RPC server span duration. -func (m ServerCallDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { - if set.Len() == 0 { - m.Float64Histogram.Record(ctx, val) - return - } - - o := recOptPool.Get().(*[]metric.RecordOption) - defer func() { - *o = (*o)[:0] - recOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Float64Histogram.Record(ctx, val, *o...) -} - -// AttrErrorType returns an optional attribute for the "error.type" semantic -// convention. It represents the describes a class of error the operation ended -// with. -func (ServerCallDuration) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { - return attribute.String("error.type", string(val)) -} - -// AttrMethod returns an optional attribute for the "rpc.method" semantic -// convention. It represents the fully-qualified logical name of the method from -// the RPC interface perspective. -func (ServerCallDuration) AttrMethod(val string) attribute.KeyValue { - return attribute.String("rpc.method", val) -} - -// AttrResponseStatusCode returns an optional attribute for the -// "rpc.response.status_code" semantic convention. It represents the status code -// of the RPC returned by the RPC server or generated by the client. -func (ServerCallDuration) AttrResponseStatusCode(val string) attribute.KeyValue { - return attribute.String("rpc.response.status_code", val) -} - -// AttrNetworkProtocolName returns an optional attribute for the -// "network.protocol.name" semantic convention. It represents the -// [OSI application layer] or non-OSI equivalent. -// -// [OSI application layer]: https://wikipedia.org/wiki/Application_layer -func (ServerCallDuration) AttrNetworkProtocolName(val string) attribute.KeyValue { - return attribute.String("network.protocol.name", val) -} - -// AttrNetworkProtocolVersion returns an optional attribute for the -// "network.protocol.version" semantic convention. It represents the actual -// version of the protocol used for network communication. -func (ServerCallDuration) AttrNetworkProtocolVersion(val string) attribute.KeyValue { - return attribute.String("network.protocol.version", val) -} - -// AttrNetworkTransport returns an optional attribute for the "network.transport" -// semantic convention. It represents the [OSI transport layer] or -// [inter-process communication method]. -// -// [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer -// [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication -func (ServerCallDuration) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue { - return attribute.String("network.transport", string(val)) -} - -// AttrServerAddress returns an optional attribute for the "server.address" -// semantic convention. It represents the RPC server [host name]. -// -// [host name]: https://grpc.github.io/grpc/core/md_doc_naming.html -func (ServerCallDuration) AttrServerAddress(val string) attribute.KeyValue { - return attribute.String("server.address", val) -} - -// AttrServerPort returns an optional attribute for the "server.port" semantic -// convention. It represents the server port number. -func (ServerCallDuration) AttrServerPort(val int) attribute.KeyValue { - return attribute.Int("server.port", val) -} - -// ServerRequestSize is an instrument used to record metric values conforming to -// the "rpc.server.request.size" semantic conventions. It represents the measures -// the size of RPC request messages (uncompressed). -type ServerRequestSize struct { - metric.Int64Histogram -} - -var newServerRequestSizeOpts = []metric.Int64HistogramOption{ - metric.WithDescription("Measures the size of RPC request messages (uncompressed)."), - metric.WithUnit("By"), -} - -// NewServerRequestSize returns a new ServerRequestSize instrument. -func NewServerRequestSize( - m metric.Meter, - opt ...metric.Int64HistogramOption, -) (ServerRequestSize, error) { - // Check if the meter is nil. - if m == nil { - return ServerRequestSize{noop.Int64Histogram{}}, nil - } - - if len(opt) == 0 { - opt = newServerRequestSizeOpts - } else { - opt = append(opt, newServerRequestSizeOpts...) - } - - i, err := m.Int64Histogram( - "rpc.server.request.size", - opt..., - ) - if err != nil { - return ServerRequestSize{noop.Int64Histogram{}}, err - } - return ServerRequestSize{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m ServerRequestSize) Inst() metric.Int64Histogram { - return m.Int64Histogram -} - -// Name returns the semantic convention name of the instrument. -func (ServerRequestSize) Name() string { - return "rpc.server.request.size" -} - -// Unit returns the semantic convention unit of the instrument -func (ServerRequestSize) Unit() string { - return "By" -} - -// Description returns the semantic convention description of the instrument -func (ServerRequestSize) Description() string { - return "Measures the size of RPC request messages (uncompressed)." -} - -// Record records val to the current distribution for attrs. -// -// The systemName is the the Remote Procedure Call (RPC) system. -// -// All additional attrs passed are included in the recorded value. -// -// **Streaming**: Recorded per message in a streaming batch -func (m ServerRequestSize) Record( - ctx context.Context, - val int64, - systemName SystemNameAttr, - attrs ...attribute.KeyValue, -) { - if len(attrs) == 0 { - m.Int64Histogram.Record(ctx, val, metric.WithAttributes( - attribute.String("rpc.system.name", string(systemName)), - )) - return - } - - o := recOptPool.Get().(*[]metric.RecordOption) - defer func() { - *o = (*o)[:0] - recOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - append( - attrs, - attribute.String("rpc.system.name", string(systemName)), - )..., - ), - ) - - m.Int64Histogram.Record(ctx, val, *o...) -} - -// RecordSet records val to the current distribution for set. -// -// **Streaming**: Recorded per message in a streaming batch -func (m ServerRequestSize) RecordSet(ctx context.Context, val int64, set attribute.Set) { - if set.Len() == 0 { - m.Int64Histogram.Record(ctx, val) - return - } - - o := recOptPool.Get().(*[]metric.RecordOption) - defer func() { - *o = (*o)[:0] - recOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Int64Histogram.Record(ctx, val, *o...) -} - -// AttrErrorType returns an optional attribute for the "error.type" semantic -// convention. It represents the describes a class of error the operation ended -// with. -func (ServerRequestSize) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { - return attribute.String("error.type", string(val)) -} - -// AttrMethod returns an optional attribute for the "rpc.method" semantic -// convention. It represents the fully-qualified logical name of the method from -// the RPC interface perspective. -func (ServerRequestSize) AttrMethod(val string) attribute.KeyValue { - return attribute.String("rpc.method", val) -} - -// AttrResponseStatusCode returns an optional attribute for the -// "rpc.response.status_code" semantic convention. It represents the status code -// of the RPC returned by the RPC server or generated by the client. -func (ServerRequestSize) AttrResponseStatusCode(val string) attribute.KeyValue { - return attribute.String("rpc.response.status_code", val) -} - -// AttrNetworkProtocolName returns an optional attribute for the -// "network.protocol.name" semantic convention. It represents the -// [OSI application layer] or non-OSI equivalent. -// -// [OSI application layer]: https://wikipedia.org/wiki/Application_layer -func (ServerRequestSize) AttrNetworkProtocolName(val string) attribute.KeyValue { - return attribute.String("network.protocol.name", val) -} - -// AttrNetworkProtocolVersion returns an optional attribute for the -// "network.protocol.version" semantic convention. It represents the actual -// version of the protocol used for network communication. -func (ServerRequestSize) AttrNetworkProtocolVersion(val string) attribute.KeyValue { - return attribute.String("network.protocol.version", val) -} - -// AttrNetworkTransport returns an optional attribute for the "network.transport" -// semantic convention. It represents the [OSI transport layer] or -// [inter-process communication method]. -// -// [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer -// [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication -func (ServerRequestSize) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue { - return attribute.String("network.transport", string(val)) -} - -// AttrServerAddress returns an optional attribute for the "server.address" -// semantic convention. It represents the RPC server [host name]. -// -// [host name]: https://grpc.github.io/grpc/core/md_doc_naming.html -func (ServerRequestSize) AttrServerAddress(val string) attribute.KeyValue { - return attribute.String("server.address", val) -} - -// AttrServerPort returns an optional attribute for the "server.port" semantic -// convention. It represents the server port number. -func (ServerRequestSize) AttrServerPort(val int) attribute.KeyValue { - return attribute.Int("server.port", val) -} - -// ServerResponseSize is an instrument used to record metric values conforming to -// the "rpc.server.response.size" semantic conventions. It represents the -// measures the size of RPC response messages (uncompressed). -type ServerResponseSize struct { - metric.Int64Histogram -} - -var newServerResponseSizeOpts = []metric.Int64HistogramOption{ - metric.WithDescription("Measures the size of RPC response messages (uncompressed)."), - metric.WithUnit("By"), -} - -// NewServerResponseSize returns a new ServerResponseSize instrument. -func NewServerResponseSize( - m metric.Meter, - opt ...metric.Int64HistogramOption, -) (ServerResponseSize, error) { - // Check if the meter is nil. - if m == nil { - return ServerResponseSize{noop.Int64Histogram{}}, nil - } - - if len(opt) == 0 { - opt = newServerResponseSizeOpts - } else { - opt = append(opt, newServerResponseSizeOpts...) - } - - i, err := m.Int64Histogram( - "rpc.server.response.size", - opt..., - ) - if err != nil { - return ServerResponseSize{noop.Int64Histogram{}}, err - } - return ServerResponseSize{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m ServerResponseSize) Inst() metric.Int64Histogram { - return m.Int64Histogram -} - -// Name returns the semantic convention name of the instrument. -func (ServerResponseSize) Name() string { - return "rpc.server.response.size" -} - -// Unit returns the semantic convention unit of the instrument -func (ServerResponseSize) Unit() string { - return "By" -} - -// Description returns the semantic convention description of the instrument -func (ServerResponseSize) Description() string { - return "Measures the size of RPC response messages (uncompressed)." -} - -// Record records val to the current distribution for attrs. -// -// The systemName is the the Remote Procedure Call (RPC) system. -// -// All additional attrs passed are included in the recorded value. -// -// **Streaming**: Recorded per response in a streaming batch -func (m ServerResponseSize) Record( - ctx context.Context, - val int64, - systemName SystemNameAttr, - attrs ...attribute.KeyValue, -) { - if len(attrs) == 0 { - m.Int64Histogram.Record(ctx, val, metric.WithAttributes( - attribute.String("rpc.system.name", string(systemName)), - )) - return - } - - o := recOptPool.Get().(*[]metric.RecordOption) - defer func() { - *o = (*o)[:0] - recOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - append( - attrs, - attribute.String("rpc.system.name", string(systemName)), - )..., - ), - ) - - m.Int64Histogram.Record(ctx, val, *o...) -} - -// RecordSet records val to the current distribution for set. -// -// **Streaming**: Recorded per response in a streaming batch -func (m ServerResponseSize) RecordSet(ctx context.Context, val int64, set attribute.Set) { - if set.Len() == 0 { - m.Int64Histogram.Record(ctx, val) - return - } - - o := recOptPool.Get().(*[]metric.RecordOption) - defer func() { - *o = (*o)[:0] - recOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Int64Histogram.Record(ctx, val, *o...) -} - -// AttrErrorType returns an optional attribute for the "error.type" semantic -// convention. It represents the describes a class of error the operation ended -// with. -func (ServerResponseSize) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { - return attribute.String("error.type", string(val)) -} - -// AttrMethod returns an optional attribute for the "rpc.method" semantic -// convention. It represents the fully-qualified logical name of the method from -// the RPC interface perspective. -func (ServerResponseSize) AttrMethod(val string) attribute.KeyValue { - return attribute.String("rpc.method", val) -} - -// AttrResponseStatusCode returns an optional attribute for the -// "rpc.response.status_code" semantic convention. It represents the status code -// of the RPC returned by the RPC server or generated by the client. -func (ServerResponseSize) AttrResponseStatusCode(val string) attribute.KeyValue { - return attribute.String("rpc.response.status_code", val) -} - -// AttrNetworkProtocolName returns an optional attribute for the -// "network.protocol.name" semantic convention. It represents the -// [OSI application layer] or non-OSI equivalent. -// -// [OSI application layer]: https://wikipedia.org/wiki/Application_layer -func (ServerResponseSize) AttrNetworkProtocolName(val string) attribute.KeyValue { - return attribute.String("network.protocol.name", val) -} - -// AttrNetworkProtocolVersion returns an optional attribute for the -// "network.protocol.version" semantic convention. It represents the actual -// version of the protocol used for network communication. -func (ServerResponseSize) AttrNetworkProtocolVersion(val string) attribute.KeyValue { - return attribute.String("network.protocol.version", val) -} - -// AttrNetworkTransport returns an optional attribute for the "network.transport" -// semantic convention. It represents the [OSI transport layer] or -// [inter-process communication method]. -// -// [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer -// [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication -func (ServerResponseSize) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue { - return attribute.String("network.transport", string(val)) -} - -// AttrServerAddress returns an optional attribute for the "server.address" -// semantic convention. It represents the RPC server [host name]. -// -// [host name]: https://grpc.github.io/grpc/core/md_doc_naming.html -func (ServerResponseSize) AttrServerAddress(val string) attribute.KeyValue { - return attribute.String("server.address", val) -} - -// AttrServerPort returns an optional attribute for the "server.port" semantic -// convention. It represents the server port number. -func (ServerResponseSize) AttrServerPort(val int) attribute.KeyValue { - return attribute.Int("server.port", val) -} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/schema.go deleted file mode 100644 index e1a199d89b..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/schema.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.39.0" - -// SchemaURL is the schema URL that matches the version of the semantic conventions -// that this package defines. Semconv packages starting from v1.4.0 must declare -// non-empty schema URL in the form https://opentelemetry.io/schemas/ -const SchemaURL = "https://opentelemetry.io/schemas/1.39.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/otelconv/metric.go b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/otelconv/metric.go deleted file mode 100644 index ba9d29e9d1..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/otelconv/metric.go +++ /dev/null @@ -1,2298 +0,0 @@ -// Code generated from semantic convention specification. DO NOT EDIT. - -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Package otelconv provides types and functionality for OpenTelemetry semantic -// conventions in the "otel" namespace. -package otelconv - -import ( - "context" - "sync" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" -) - -var ( - addOptPool = &sync.Pool{New: func() any { return &[]metric.AddOption{} }} - recOptPool = &sync.Pool{New: func() any { return &[]metric.RecordOption{} }} -) - -// ErrorTypeAttr is an attribute conforming to the error.type semantic -// conventions. It represents the describes a class of error the operation ended -// with. -type ErrorTypeAttr string - -// ErrorTypeOther is a fallback error value to be used when the instrumentation -// doesn't define a custom value. -var ErrorTypeOther ErrorTypeAttr = "_OTHER" - -// ComponentTypeAttr is an attribute conforming to the otel.component.type -// semantic conventions. It represents a name identifying the type of the -// OpenTelemetry component. -type ComponentTypeAttr string - -var ( - // ComponentTypeBatchingSpanProcessor is the builtin SDK batching span - // processor. - ComponentTypeBatchingSpanProcessor ComponentTypeAttr = "batching_span_processor" - // ComponentTypeSimpleSpanProcessor is the builtin SDK simple span processor. - ComponentTypeSimpleSpanProcessor ComponentTypeAttr = "simple_span_processor" - // ComponentTypeBatchingLogProcessor is the builtin SDK batching log record - // processor. - ComponentTypeBatchingLogProcessor ComponentTypeAttr = "batching_log_processor" - // ComponentTypeSimpleLogProcessor is the builtin SDK simple log record - // processor. - ComponentTypeSimpleLogProcessor ComponentTypeAttr = "simple_log_processor" - // ComponentTypeOtlpGRPCSpanExporter is the OTLP span exporter over gRPC with - // protobuf serialization. - ComponentTypeOtlpGRPCSpanExporter ComponentTypeAttr = "otlp_grpc_span_exporter" - // ComponentTypeOtlpHTTPSpanExporter is the OTLP span exporter over HTTP with - // protobuf serialization. - ComponentTypeOtlpHTTPSpanExporter ComponentTypeAttr = "otlp_http_span_exporter" - // ComponentTypeOtlpHTTPJSONSpanExporter is the OTLP span exporter over HTTP - // with JSON serialization. - ComponentTypeOtlpHTTPJSONSpanExporter ComponentTypeAttr = "otlp_http_json_span_exporter" - // ComponentTypeZipkinHTTPSpanExporter is the zipkin span exporter over HTTP. - ComponentTypeZipkinHTTPSpanExporter ComponentTypeAttr = "zipkin_http_span_exporter" - // ComponentTypeOtlpGRPCLogExporter is the OTLP log record exporter over gRPC - // with protobuf serialization. - ComponentTypeOtlpGRPCLogExporter ComponentTypeAttr = "otlp_grpc_log_exporter" - // ComponentTypeOtlpHTTPLogExporter is the OTLP log record exporter over HTTP - // with protobuf serialization. - ComponentTypeOtlpHTTPLogExporter ComponentTypeAttr = "otlp_http_log_exporter" - // ComponentTypeOtlpHTTPJSONLogExporter is the OTLP log record exporter over - // HTTP with JSON serialization. - ComponentTypeOtlpHTTPJSONLogExporter ComponentTypeAttr = "otlp_http_json_log_exporter" - // ComponentTypePeriodicMetricReader is the builtin SDK periodically exporting - // metric reader. - ComponentTypePeriodicMetricReader ComponentTypeAttr = "periodic_metric_reader" - // ComponentTypeOtlpGRPCMetricExporter is the OTLP metric exporter over gRPC - // with protobuf serialization. - ComponentTypeOtlpGRPCMetricExporter ComponentTypeAttr = "otlp_grpc_metric_exporter" - // ComponentTypeOtlpHTTPMetricExporter is the OTLP metric exporter over HTTP - // with protobuf serialization. - ComponentTypeOtlpHTTPMetricExporter ComponentTypeAttr = "otlp_http_metric_exporter" - // ComponentTypeOtlpHTTPJSONMetricExporter is the OTLP metric exporter over HTTP - // with JSON serialization. - ComponentTypeOtlpHTTPJSONMetricExporter ComponentTypeAttr = "otlp_http_json_metric_exporter" - // ComponentTypePrometheusHTTPTextMetricExporter is the prometheus metric - // exporter over HTTP with the default text-based format. - ComponentTypePrometheusHTTPTextMetricExporter ComponentTypeAttr = "prometheus_http_text_metric_exporter" -) - -// SpanParentOriginAttr is an attribute conforming to the otel.span.parent.origin -// semantic conventions. It represents the determines whether the span has a -// parent span, and if so, [whether it is a remote parent]. -// -// [whether it is a remote parent]: https://opentelemetry.io/docs/specs/otel/trace/api/#isremote -type SpanParentOriginAttr string - -var ( - // SpanParentOriginNone is the span does not have a parent, it is a root span. - SpanParentOriginNone SpanParentOriginAttr = "none" - // SpanParentOriginLocal is the span has a parent and the parent's span context - // [isRemote()] is false. - // - // [isRemote()]: https://opentelemetry.io/docs/specs/otel/trace/api/#isremote - SpanParentOriginLocal SpanParentOriginAttr = "local" - // SpanParentOriginRemote is the span has a parent and the parent's span context - // [isRemote()] is true. - // - // [isRemote()]: https://opentelemetry.io/docs/specs/otel/trace/api/#isremote - SpanParentOriginRemote SpanParentOriginAttr = "remote" -) - -// SpanSamplingResultAttr is an attribute conforming to the -// otel.span.sampling_result semantic conventions. It represents the result value -// of the sampler for this span. -type SpanSamplingResultAttr string - -var ( - // SpanSamplingResultDrop is the span is not sampled and not recording. - SpanSamplingResultDrop SpanSamplingResultAttr = "DROP" - // SpanSamplingResultRecordOnly is the span is not sampled, but recording. - SpanSamplingResultRecordOnly SpanSamplingResultAttr = "RECORD_ONLY" - // SpanSamplingResultRecordAndSample is the span is sampled and recording. - SpanSamplingResultRecordAndSample SpanSamplingResultAttr = "RECORD_AND_SAMPLE" -) - -// SDKExporterLogExported is an instrument used to record metric values -// conforming to the "otel.sdk.exporter.log.exported" semantic conventions. It -// represents the number of log records for which the export has finished, either -// successful or failed. -type SDKExporterLogExported struct { - metric.Int64Counter -} - -var newSDKExporterLogExportedOpts = []metric.Int64CounterOption{ - metric.WithDescription("The number of log records for which the export has finished, either successful or failed."), - metric.WithUnit("{log_record}"), -} - -// NewSDKExporterLogExported returns a new SDKExporterLogExported instrument. -func NewSDKExporterLogExported( - m metric.Meter, - opt ...metric.Int64CounterOption, -) (SDKExporterLogExported, error) { - // Check if the meter is nil. - if m == nil { - return SDKExporterLogExported{noop.Int64Counter{}}, nil - } - - if len(opt) == 0 { - opt = newSDKExporterLogExportedOpts - } else { - opt = append(opt, newSDKExporterLogExportedOpts...) - } - - i, err := m.Int64Counter( - "otel.sdk.exporter.log.exported", - opt..., - ) - if err != nil { - return SDKExporterLogExported{noop.Int64Counter{}}, err - } - return SDKExporterLogExported{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m SDKExporterLogExported) Inst() metric.Int64Counter { - return m.Int64Counter -} - -// Name returns the semantic convention name of the instrument. -func (SDKExporterLogExported) Name() string { - return "otel.sdk.exporter.log.exported" -} - -// Unit returns the semantic convention unit of the instrument -func (SDKExporterLogExported) Unit() string { - return "{log_record}" -} - -// Description returns the semantic convention description of the instrument -func (SDKExporterLogExported) Description() string { - return "The number of log records for which the export has finished, either successful or failed." -} - -// Add adds incr to the existing count for attrs. -// -// All additional attrs passed are included in the recorded value. -// -// For successful exports, `error.type` MUST NOT be set. For failed exports, -// `error.type` MUST contain the failure cause. -// For exporters with partial success semantics (e.g. OTLP with -// `rejected_log_records`), rejected log records MUST count as failed and only -// non-rejected log records count as success. -// If no rejection reason is available, `rejected` SHOULD be used as value for -// `error.type`. -func (m SDKExporterLogExported) Add( - ctx context.Context, - incr int64, - attrs ...attribute.KeyValue, -) { - if !m.Int64Counter.Enabled(ctx) { - return - } - if len(attrs) == 0 { - m.Int64Counter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - attrs..., - ), - ) - - m.Int64Counter.Add(ctx, incr, *o...) -} - -// AddSet adds incr to the existing count for set. -// -// For successful exports, `error.type` MUST NOT be set. For failed exports, -// `error.type` MUST contain the failure cause. -// For exporters with partial success semantics (e.g. OTLP with -// `rejected_log_records`), rejected log records MUST count as failed and only -// non-rejected log records count as success. -// If no rejection reason is available, `rejected` SHOULD be used as value for -// `error.type`. -func (m SDKExporterLogExported) AddSet(ctx context.Context, incr int64, set attribute.Set) { - if !m.Int64Counter.Enabled(ctx) { - return - } - if set.Len() == 0 { - m.Int64Counter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Int64Counter.Add(ctx, incr, *o...) -} - -// AttrErrorType returns an optional attribute for the "error.type" semantic -// convention. It represents the describes a class of error the operation ended -// with. -func (SDKExporterLogExported) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { - return attribute.String("error.type", string(val)) -} - -// AttrComponentName returns an optional attribute for the "otel.component.name" -// semantic convention. It represents a name uniquely identifying the instance of -// the OpenTelemetry component within its containing SDK instance. -func (SDKExporterLogExported) AttrComponentName(val string) attribute.KeyValue { - return attribute.String("otel.component.name", val) -} - -// AttrComponentType returns an optional attribute for the "otel.component.type" -// semantic convention. It represents a name identifying the type of the -// OpenTelemetry component. -func (SDKExporterLogExported) AttrComponentType(val ComponentTypeAttr) attribute.KeyValue { - return attribute.String("otel.component.type", string(val)) -} - -// AttrServerAddress returns an optional attribute for the "server.address" -// semantic convention. It represents the server domain name if available without -// reverse DNS lookup; otherwise, IP address or Unix domain socket name. -func (SDKExporterLogExported) AttrServerAddress(val string) attribute.KeyValue { - return attribute.String("server.address", val) -} - -// AttrServerPort returns an optional attribute for the "server.port" semantic -// convention. It represents the server port number. -func (SDKExporterLogExported) AttrServerPort(val int) attribute.KeyValue { - return attribute.Int("server.port", val) -} - -// SDKExporterLogInflight is an instrument used to record metric values -// conforming to the "otel.sdk.exporter.log.inflight" semantic conventions. It -// represents the number of log records which were passed to the exporter, but -// that have not been exported yet (neither successful, nor failed). -type SDKExporterLogInflight struct { - metric.Int64UpDownCounter -} - -var newSDKExporterLogInflightOpts = []metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of log records which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)."), - metric.WithUnit("{log_record}"), -} - -// NewSDKExporterLogInflight returns a new SDKExporterLogInflight instrument. -func NewSDKExporterLogInflight( - m metric.Meter, - opt ...metric.Int64UpDownCounterOption, -) (SDKExporterLogInflight, error) { - // Check if the meter is nil. - if m == nil { - return SDKExporterLogInflight{noop.Int64UpDownCounter{}}, nil - } - - if len(opt) == 0 { - opt = newSDKExporterLogInflightOpts - } else { - opt = append(opt, newSDKExporterLogInflightOpts...) - } - - i, err := m.Int64UpDownCounter( - "otel.sdk.exporter.log.inflight", - opt..., - ) - if err != nil { - return SDKExporterLogInflight{noop.Int64UpDownCounter{}}, err - } - return SDKExporterLogInflight{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m SDKExporterLogInflight) Inst() metric.Int64UpDownCounter { - return m.Int64UpDownCounter -} - -// Name returns the semantic convention name of the instrument. -func (SDKExporterLogInflight) Name() string { - return "otel.sdk.exporter.log.inflight" -} - -// Unit returns the semantic convention unit of the instrument -func (SDKExporterLogInflight) Unit() string { - return "{log_record}" -} - -// Description returns the semantic convention description of the instrument -func (SDKExporterLogInflight) Description() string { - return "The number of log records which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)." -} - -// Add adds incr to the existing count for attrs. -// -// All additional attrs passed are included in the recorded value. -// -// For successful exports, `error.type` MUST NOT be set. For failed exports, -// `error.type` MUST contain the failure cause. -func (m SDKExporterLogInflight) Add( - ctx context.Context, - incr int64, - attrs ...attribute.KeyValue, -) { - if !m.Int64UpDownCounter.Enabled(ctx) { - return - } - if len(attrs) == 0 { - m.Int64UpDownCounter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - attrs..., - ), - ) - - m.Int64UpDownCounter.Add(ctx, incr, *o...) -} - -// AddSet adds incr to the existing count for set. -// -// For successful exports, `error.type` MUST NOT be set. For failed exports, -// `error.type` MUST contain the failure cause. -func (m SDKExporterLogInflight) AddSet(ctx context.Context, incr int64, set attribute.Set) { - if !m.Int64UpDownCounter.Enabled(ctx) { - return - } - if set.Len() == 0 { - m.Int64UpDownCounter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Int64UpDownCounter.Add(ctx, incr, *o...) -} - -// AttrComponentName returns an optional attribute for the "otel.component.name" -// semantic convention. It represents a name uniquely identifying the instance of -// the OpenTelemetry component within its containing SDK instance. -func (SDKExporterLogInflight) AttrComponentName(val string) attribute.KeyValue { - return attribute.String("otel.component.name", val) -} - -// AttrComponentType returns an optional attribute for the "otel.component.type" -// semantic convention. It represents a name identifying the type of the -// OpenTelemetry component. -func (SDKExporterLogInflight) AttrComponentType(val ComponentTypeAttr) attribute.KeyValue { - return attribute.String("otel.component.type", string(val)) -} - -// AttrServerAddress returns an optional attribute for the "server.address" -// semantic convention. It represents the server domain name if available without -// reverse DNS lookup; otherwise, IP address or Unix domain socket name. -func (SDKExporterLogInflight) AttrServerAddress(val string) attribute.KeyValue { - return attribute.String("server.address", val) -} - -// AttrServerPort returns an optional attribute for the "server.port" semantic -// convention. It represents the server port number. -func (SDKExporterLogInflight) AttrServerPort(val int) attribute.KeyValue { - return attribute.Int("server.port", val) -} - -// SDKExporterMetricDataPointExported is an instrument used to record metric -// values conforming to the "otel.sdk.exporter.metric_data_point.exported" -// semantic conventions. It represents the number of metric data points for which -// the export has finished, either successful or failed. -type SDKExporterMetricDataPointExported struct { - metric.Int64Counter -} - -var newSDKExporterMetricDataPointExportedOpts = []metric.Int64CounterOption{ - metric.WithDescription("The number of metric data points for which the export has finished, either successful or failed."), - metric.WithUnit("{data_point}"), -} - -// NewSDKExporterMetricDataPointExported returns a new -// SDKExporterMetricDataPointExported instrument. -func NewSDKExporterMetricDataPointExported( - m metric.Meter, - opt ...metric.Int64CounterOption, -) (SDKExporterMetricDataPointExported, error) { - // Check if the meter is nil. - if m == nil { - return SDKExporterMetricDataPointExported{noop.Int64Counter{}}, nil - } - - if len(opt) == 0 { - opt = newSDKExporterMetricDataPointExportedOpts - } else { - opt = append(opt, newSDKExporterMetricDataPointExportedOpts...) - } - - i, err := m.Int64Counter( - "otel.sdk.exporter.metric_data_point.exported", - opt..., - ) - if err != nil { - return SDKExporterMetricDataPointExported{noop.Int64Counter{}}, err - } - return SDKExporterMetricDataPointExported{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m SDKExporterMetricDataPointExported) Inst() metric.Int64Counter { - return m.Int64Counter -} - -// Name returns the semantic convention name of the instrument. -func (SDKExporterMetricDataPointExported) Name() string { - return "otel.sdk.exporter.metric_data_point.exported" -} - -// Unit returns the semantic convention unit of the instrument -func (SDKExporterMetricDataPointExported) Unit() string { - return "{data_point}" -} - -// Description returns the semantic convention description of the instrument -func (SDKExporterMetricDataPointExported) Description() string { - return "The number of metric data points for which the export has finished, either successful or failed." -} - -// Add adds incr to the existing count for attrs. -// -// All additional attrs passed are included in the recorded value. -// -// For successful exports, `error.type` MUST NOT be set. For failed exports, -// `error.type` MUST contain the failure cause. -// For exporters with partial success semantics (e.g. OTLP with -// `rejected_data_points`), rejected data points MUST count as failed and only -// non-rejected data points count as success. -// If no rejection reason is available, `rejected` SHOULD be used as value for -// `error.type`. -func (m SDKExporterMetricDataPointExported) Add( - ctx context.Context, - incr int64, - attrs ...attribute.KeyValue, -) { - if !m.Int64Counter.Enabled(ctx) { - return - } - if len(attrs) == 0 { - m.Int64Counter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - attrs..., - ), - ) - - m.Int64Counter.Add(ctx, incr, *o...) -} - -// AddSet adds incr to the existing count for set. -// -// For successful exports, `error.type` MUST NOT be set. For failed exports, -// `error.type` MUST contain the failure cause. -// For exporters with partial success semantics (e.g. OTLP with -// `rejected_data_points`), rejected data points MUST count as failed and only -// non-rejected data points count as success. -// If no rejection reason is available, `rejected` SHOULD be used as value for -// `error.type`. -func (m SDKExporterMetricDataPointExported) AddSet(ctx context.Context, incr int64, set attribute.Set) { - if !m.Int64Counter.Enabled(ctx) { - return - } - if set.Len() == 0 { - m.Int64Counter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Int64Counter.Add(ctx, incr, *o...) -} - -// AttrErrorType returns an optional attribute for the "error.type" semantic -// convention. It represents the describes a class of error the operation ended -// with. -func (SDKExporterMetricDataPointExported) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { - return attribute.String("error.type", string(val)) -} - -// AttrComponentName returns an optional attribute for the "otel.component.name" -// semantic convention. It represents a name uniquely identifying the instance of -// the OpenTelemetry component within its containing SDK instance. -func (SDKExporterMetricDataPointExported) AttrComponentName(val string) attribute.KeyValue { - return attribute.String("otel.component.name", val) -} - -// AttrComponentType returns an optional attribute for the "otel.component.type" -// semantic convention. It represents a name identifying the type of the -// OpenTelemetry component. -func (SDKExporterMetricDataPointExported) AttrComponentType(val ComponentTypeAttr) attribute.KeyValue { - return attribute.String("otel.component.type", string(val)) -} - -// AttrServerAddress returns an optional attribute for the "server.address" -// semantic convention. It represents the server domain name if available without -// reverse DNS lookup; otherwise, IP address or Unix domain socket name. -func (SDKExporterMetricDataPointExported) AttrServerAddress(val string) attribute.KeyValue { - return attribute.String("server.address", val) -} - -// AttrServerPort returns an optional attribute for the "server.port" semantic -// convention. It represents the server port number. -func (SDKExporterMetricDataPointExported) AttrServerPort(val int) attribute.KeyValue { - return attribute.Int("server.port", val) -} - -// SDKExporterMetricDataPointInflight is an instrument used to record metric -// values conforming to the "otel.sdk.exporter.metric_data_point.inflight" -// semantic conventions. It represents the number of metric data points which -// were passed to the exporter, but that have not been exported yet (neither -// successful, nor failed). -type SDKExporterMetricDataPointInflight struct { - metric.Int64UpDownCounter -} - -var newSDKExporterMetricDataPointInflightOpts = []metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of metric data points which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)."), - metric.WithUnit("{data_point}"), -} - -// NewSDKExporterMetricDataPointInflight returns a new -// SDKExporterMetricDataPointInflight instrument. -func NewSDKExporterMetricDataPointInflight( - m metric.Meter, - opt ...metric.Int64UpDownCounterOption, -) (SDKExporterMetricDataPointInflight, error) { - // Check if the meter is nil. - if m == nil { - return SDKExporterMetricDataPointInflight{noop.Int64UpDownCounter{}}, nil - } - - if len(opt) == 0 { - opt = newSDKExporterMetricDataPointInflightOpts - } else { - opt = append(opt, newSDKExporterMetricDataPointInflightOpts...) - } - - i, err := m.Int64UpDownCounter( - "otel.sdk.exporter.metric_data_point.inflight", - opt..., - ) - if err != nil { - return SDKExporterMetricDataPointInflight{noop.Int64UpDownCounter{}}, err - } - return SDKExporterMetricDataPointInflight{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m SDKExporterMetricDataPointInflight) Inst() metric.Int64UpDownCounter { - return m.Int64UpDownCounter -} - -// Name returns the semantic convention name of the instrument. -func (SDKExporterMetricDataPointInflight) Name() string { - return "otel.sdk.exporter.metric_data_point.inflight" -} - -// Unit returns the semantic convention unit of the instrument -func (SDKExporterMetricDataPointInflight) Unit() string { - return "{data_point}" -} - -// Description returns the semantic convention description of the instrument -func (SDKExporterMetricDataPointInflight) Description() string { - return "The number of metric data points which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)." -} - -// Add adds incr to the existing count for attrs. -// -// All additional attrs passed are included in the recorded value. -// -// For successful exports, `error.type` MUST NOT be set. For failed exports, -// `error.type` MUST contain the failure cause. -func (m SDKExporterMetricDataPointInflight) Add( - ctx context.Context, - incr int64, - attrs ...attribute.KeyValue, -) { - if !m.Int64UpDownCounter.Enabled(ctx) { - return - } - if len(attrs) == 0 { - m.Int64UpDownCounter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - attrs..., - ), - ) - - m.Int64UpDownCounter.Add(ctx, incr, *o...) -} - -// AddSet adds incr to the existing count for set. -// -// For successful exports, `error.type` MUST NOT be set. For failed exports, -// `error.type` MUST contain the failure cause. -func (m SDKExporterMetricDataPointInflight) AddSet(ctx context.Context, incr int64, set attribute.Set) { - if !m.Int64UpDownCounter.Enabled(ctx) { - return - } - if set.Len() == 0 { - m.Int64UpDownCounter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Int64UpDownCounter.Add(ctx, incr, *o...) -} - -// AttrComponentName returns an optional attribute for the "otel.component.name" -// semantic convention. It represents a name uniquely identifying the instance of -// the OpenTelemetry component within its containing SDK instance. -func (SDKExporterMetricDataPointInflight) AttrComponentName(val string) attribute.KeyValue { - return attribute.String("otel.component.name", val) -} - -// AttrComponentType returns an optional attribute for the "otel.component.type" -// semantic convention. It represents a name identifying the type of the -// OpenTelemetry component. -func (SDKExporterMetricDataPointInflight) AttrComponentType(val ComponentTypeAttr) attribute.KeyValue { - return attribute.String("otel.component.type", string(val)) -} - -// AttrServerAddress returns an optional attribute for the "server.address" -// semantic convention. It represents the server domain name if available without -// reverse DNS lookup; otherwise, IP address or Unix domain socket name. -func (SDKExporterMetricDataPointInflight) AttrServerAddress(val string) attribute.KeyValue { - return attribute.String("server.address", val) -} - -// AttrServerPort returns an optional attribute for the "server.port" semantic -// convention. It represents the server port number. -func (SDKExporterMetricDataPointInflight) AttrServerPort(val int) attribute.KeyValue { - return attribute.Int("server.port", val) -} - -// SDKExporterOperationDuration is an instrument used to record metric values -// conforming to the "otel.sdk.exporter.operation.duration" semantic conventions. -// It represents the duration of exporting a batch of telemetry records. -type SDKExporterOperationDuration struct { - metric.Float64Histogram -} - -var newSDKExporterOperationDurationOpts = []metric.Float64HistogramOption{ - metric.WithDescription("The duration of exporting a batch of telemetry records."), - metric.WithUnit("s"), -} - -// NewSDKExporterOperationDuration returns a new SDKExporterOperationDuration -// instrument. -func NewSDKExporterOperationDuration( - m metric.Meter, - opt ...metric.Float64HistogramOption, -) (SDKExporterOperationDuration, error) { - // Check if the meter is nil. - if m == nil { - return SDKExporterOperationDuration{noop.Float64Histogram{}}, nil - } - - if len(opt) == 0 { - opt = newSDKExporterOperationDurationOpts - } else { - opt = append(opt, newSDKExporterOperationDurationOpts...) - } - - i, err := m.Float64Histogram( - "otel.sdk.exporter.operation.duration", - opt..., - ) - if err != nil { - return SDKExporterOperationDuration{noop.Float64Histogram{}}, err - } - return SDKExporterOperationDuration{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m SDKExporterOperationDuration) Inst() metric.Float64Histogram { - return m.Float64Histogram -} - -// Name returns the semantic convention name of the instrument. -func (SDKExporterOperationDuration) Name() string { - return "otel.sdk.exporter.operation.duration" -} - -// Unit returns the semantic convention unit of the instrument -func (SDKExporterOperationDuration) Unit() string { - return "s" -} - -// Description returns the semantic convention description of the instrument -func (SDKExporterOperationDuration) Description() string { - return "The duration of exporting a batch of telemetry records." -} - -// Record records val to the current distribution for attrs. -// -// All additional attrs passed are included in the recorded value. -// -// This metric defines successful operations using the full success definitions -// for [http] -// and [grpc]. Anything else is defined as an unsuccessful operation. For -// successful -// operations, `error.type` MUST NOT be set. For unsuccessful export operations, -// `error.type` MUST contain a relevant failure cause. -// -// [http]: https://github.com/open-telemetry/opentelemetry-proto/blob/v1.5.0/docs/specification.md#full-success-1 -// [grpc]: https://github.com/open-telemetry/opentelemetry-proto/blob/v1.5.0/docs/specification.md#full-success -func (m SDKExporterOperationDuration) Record( - ctx context.Context, - val float64, - attrs ...attribute.KeyValue, -) { - if !m.Float64Histogram.Enabled(ctx) { - return - } - if len(attrs) == 0 { - m.Float64Histogram.Record(ctx, val) - return - } - - o := recOptPool.Get().(*[]metric.RecordOption) - defer func() { - *o = (*o)[:0] - recOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - attrs..., - ), - ) - - m.Float64Histogram.Record(ctx, val, *o...) -} - -// RecordSet records val to the current distribution for set. -// -// This metric defines successful operations using the full success definitions -// for [http] -// and [grpc]. Anything else is defined as an unsuccessful operation. For -// successful -// operations, `error.type` MUST NOT be set. For unsuccessful export operations, -// `error.type` MUST contain a relevant failure cause. -// -// [http]: https://github.com/open-telemetry/opentelemetry-proto/blob/v1.5.0/docs/specification.md#full-success-1 -// [grpc]: https://github.com/open-telemetry/opentelemetry-proto/blob/v1.5.0/docs/specification.md#full-success -func (m SDKExporterOperationDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { - if !m.Float64Histogram.Enabled(ctx) { - return - } - if set.Len() == 0 { - m.Float64Histogram.Record(ctx, val) - return - } - - o := recOptPool.Get().(*[]metric.RecordOption) - defer func() { - *o = (*o)[:0] - recOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Float64Histogram.Record(ctx, val, *o...) -} - -// AttrErrorType returns an optional attribute for the "error.type" semantic -// convention. It represents the describes a class of error the operation ended -// with. -func (SDKExporterOperationDuration) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { - return attribute.String("error.type", string(val)) -} - -// AttrHTTPResponseStatusCode returns an optional attribute for the -// "http.response.status_code" semantic convention. It represents the HTTP status -// code of the last HTTP request performed in scope of this export call. -func (SDKExporterOperationDuration) AttrHTTPResponseStatusCode(val int) attribute.KeyValue { - return attribute.Int("http.response.status_code", val) -} - -// AttrComponentName returns an optional attribute for the "otel.component.name" -// semantic convention. It represents a name uniquely identifying the instance of -// the OpenTelemetry component within its containing SDK instance. -func (SDKExporterOperationDuration) AttrComponentName(val string) attribute.KeyValue { - return attribute.String("otel.component.name", val) -} - -// AttrComponentType returns an optional attribute for the "otel.component.type" -// semantic convention. It represents a name identifying the type of the -// OpenTelemetry component. -func (SDKExporterOperationDuration) AttrComponentType(val ComponentTypeAttr) attribute.KeyValue { - return attribute.String("otel.component.type", string(val)) -} - -// AttrRPCResponseStatusCode returns an optional attribute for the -// "rpc.response.status_code" semantic convention. It represents the gRPC status -// code of the last gRPC request performed in scope of this export call. -func (SDKExporterOperationDuration) AttrRPCResponseStatusCode(val string) attribute.KeyValue { - return attribute.String("rpc.response.status_code", val) -} - -// AttrServerAddress returns an optional attribute for the "server.address" -// semantic convention. It represents the server domain name if available without -// reverse DNS lookup; otherwise, IP address or Unix domain socket name. -func (SDKExporterOperationDuration) AttrServerAddress(val string) attribute.KeyValue { - return attribute.String("server.address", val) -} - -// AttrServerPort returns an optional attribute for the "server.port" semantic -// convention. It represents the server port number. -func (SDKExporterOperationDuration) AttrServerPort(val int) attribute.KeyValue { - return attribute.Int("server.port", val) -} - -// SDKExporterSpanExported is an instrument used to record metric values -// conforming to the "otel.sdk.exporter.span.exported" semantic conventions. It -// represents the number of spans for which the export has finished, either -// successful or failed. -type SDKExporterSpanExported struct { - metric.Int64Counter -} - -var newSDKExporterSpanExportedOpts = []metric.Int64CounterOption{ - metric.WithDescription("The number of spans for which the export has finished, either successful or failed."), - metric.WithUnit("{span}"), -} - -// NewSDKExporterSpanExported returns a new SDKExporterSpanExported instrument. -func NewSDKExporterSpanExported( - m metric.Meter, - opt ...metric.Int64CounterOption, -) (SDKExporterSpanExported, error) { - // Check if the meter is nil. - if m == nil { - return SDKExporterSpanExported{noop.Int64Counter{}}, nil - } - - if len(opt) == 0 { - opt = newSDKExporterSpanExportedOpts - } else { - opt = append(opt, newSDKExporterSpanExportedOpts...) - } - - i, err := m.Int64Counter( - "otel.sdk.exporter.span.exported", - opt..., - ) - if err != nil { - return SDKExporterSpanExported{noop.Int64Counter{}}, err - } - return SDKExporterSpanExported{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m SDKExporterSpanExported) Inst() metric.Int64Counter { - return m.Int64Counter -} - -// Name returns the semantic convention name of the instrument. -func (SDKExporterSpanExported) Name() string { - return "otel.sdk.exporter.span.exported" -} - -// Unit returns the semantic convention unit of the instrument -func (SDKExporterSpanExported) Unit() string { - return "{span}" -} - -// Description returns the semantic convention description of the instrument -func (SDKExporterSpanExported) Description() string { - return "The number of spans for which the export has finished, either successful or failed." -} - -// Add adds incr to the existing count for attrs. -// -// All additional attrs passed are included in the recorded value. -// -// For successful exports, `error.type` MUST NOT be set. For failed exports, -// `error.type` MUST contain the failure cause. -// For exporters with partial success semantics (e.g. OTLP with `rejected_spans` -// ), rejected spans MUST count as failed and only non-rejected spans count as -// success. -// If no rejection reason is available, `rejected` SHOULD be used as value for -// `error.type`. -func (m SDKExporterSpanExported) Add( - ctx context.Context, - incr int64, - attrs ...attribute.KeyValue, -) { - if !m.Int64Counter.Enabled(ctx) { - return - } - if len(attrs) == 0 { - m.Int64Counter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - attrs..., - ), - ) - - m.Int64Counter.Add(ctx, incr, *o...) -} - -// AddSet adds incr to the existing count for set. -// -// For successful exports, `error.type` MUST NOT be set. For failed exports, -// `error.type` MUST contain the failure cause. -// For exporters with partial success semantics (e.g. OTLP with `rejected_spans` -// ), rejected spans MUST count as failed and only non-rejected spans count as -// success. -// If no rejection reason is available, `rejected` SHOULD be used as value for -// `error.type`. -func (m SDKExporterSpanExported) AddSet(ctx context.Context, incr int64, set attribute.Set) { - if !m.Int64Counter.Enabled(ctx) { - return - } - if set.Len() == 0 { - m.Int64Counter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Int64Counter.Add(ctx, incr, *o...) -} - -// AttrErrorType returns an optional attribute for the "error.type" semantic -// convention. It represents the describes a class of error the operation ended -// with. -func (SDKExporterSpanExported) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { - return attribute.String("error.type", string(val)) -} - -// AttrComponentName returns an optional attribute for the "otel.component.name" -// semantic convention. It represents a name uniquely identifying the instance of -// the OpenTelemetry component within its containing SDK instance. -func (SDKExporterSpanExported) AttrComponentName(val string) attribute.KeyValue { - return attribute.String("otel.component.name", val) -} - -// AttrComponentType returns an optional attribute for the "otel.component.type" -// semantic convention. It represents a name identifying the type of the -// OpenTelemetry component. -func (SDKExporterSpanExported) AttrComponentType(val ComponentTypeAttr) attribute.KeyValue { - return attribute.String("otel.component.type", string(val)) -} - -// AttrServerAddress returns an optional attribute for the "server.address" -// semantic convention. It represents the server domain name if available without -// reverse DNS lookup; otherwise, IP address or Unix domain socket name. -func (SDKExporterSpanExported) AttrServerAddress(val string) attribute.KeyValue { - return attribute.String("server.address", val) -} - -// AttrServerPort returns an optional attribute for the "server.port" semantic -// convention. It represents the server port number. -func (SDKExporterSpanExported) AttrServerPort(val int) attribute.KeyValue { - return attribute.Int("server.port", val) -} - -// SDKExporterSpanInflight is an instrument used to record metric values -// conforming to the "otel.sdk.exporter.span.inflight" semantic conventions. It -// represents the number of spans which were passed to the exporter, but that -// have not been exported yet (neither successful, nor failed). -type SDKExporterSpanInflight struct { - metric.Int64UpDownCounter -} - -var newSDKExporterSpanInflightOpts = []metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of spans which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)."), - metric.WithUnit("{span}"), -} - -// NewSDKExporterSpanInflight returns a new SDKExporterSpanInflight instrument. -func NewSDKExporterSpanInflight( - m metric.Meter, - opt ...metric.Int64UpDownCounterOption, -) (SDKExporterSpanInflight, error) { - // Check if the meter is nil. - if m == nil { - return SDKExporterSpanInflight{noop.Int64UpDownCounter{}}, nil - } - - if len(opt) == 0 { - opt = newSDKExporterSpanInflightOpts - } else { - opt = append(opt, newSDKExporterSpanInflightOpts...) - } - - i, err := m.Int64UpDownCounter( - "otel.sdk.exporter.span.inflight", - opt..., - ) - if err != nil { - return SDKExporterSpanInflight{noop.Int64UpDownCounter{}}, err - } - return SDKExporterSpanInflight{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m SDKExporterSpanInflight) Inst() metric.Int64UpDownCounter { - return m.Int64UpDownCounter -} - -// Name returns the semantic convention name of the instrument. -func (SDKExporterSpanInflight) Name() string { - return "otel.sdk.exporter.span.inflight" -} - -// Unit returns the semantic convention unit of the instrument -func (SDKExporterSpanInflight) Unit() string { - return "{span}" -} - -// Description returns the semantic convention description of the instrument -func (SDKExporterSpanInflight) Description() string { - return "The number of spans which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)." -} - -// Add adds incr to the existing count for attrs. -// -// All additional attrs passed are included in the recorded value. -// -// For successful exports, `error.type` MUST NOT be set. For failed exports, -// `error.type` MUST contain the failure cause. -func (m SDKExporterSpanInflight) Add( - ctx context.Context, - incr int64, - attrs ...attribute.KeyValue, -) { - if !m.Int64UpDownCounter.Enabled(ctx) { - return - } - if len(attrs) == 0 { - m.Int64UpDownCounter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - attrs..., - ), - ) - - m.Int64UpDownCounter.Add(ctx, incr, *o...) -} - -// AddSet adds incr to the existing count for set. -// -// For successful exports, `error.type` MUST NOT be set. For failed exports, -// `error.type` MUST contain the failure cause. -func (m SDKExporterSpanInflight) AddSet(ctx context.Context, incr int64, set attribute.Set) { - if !m.Int64UpDownCounter.Enabled(ctx) { - return - } - if set.Len() == 0 { - m.Int64UpDownCounter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Int64UpDownCounter.Add(ctx, incr, *o...) -} - -// AttrComponentName returns an optional attribute for the "otel.component.name" -// semantic convention. It represents a name uniquely identifying the instance of -// the OpenTelemetry component within its containing SDK instance. -func (SDKExporterSpanInflight) AttrComponentName(val string) attribute.KeyValue { - return attribute.String("otel.component.name", val) -} - -// AttrComponentType returns an optional attribute for the "otel.component.type" -// semantic convention. It represents a name identifying the type of the -// OpenTelemetry component. -func (SDKExporterSpanInflight) AttrComponentType(val ComponentTypeAttr) attribute.KeyValue { - return attribute.String("otel.component.type", string(val)) -} - -// AttrServerAddress returns an optional attribute for the "server.address" -// semantic convention. It represents the server domain name if available without -// reverse DNS lookup; otherwise, IP address or Unix domain socket name. -func (SDKExporterSpanInflight) AttrServerAddress(val string) attribute.KeyValue { - return attribute.String("server.address", val) -} - -// AttrServerPort returns an optional attribute for the "server.port" semantic -// convention. It represents the server port number. -func (SDKExporterSpanInflight) AttrServerPort(val int) attribute.KeyValue { - return attribute.Int("server.port", val) -} - -// SDKLogCreated is an instrument used to record metric values conforming to the -// "otel.sdk.log.created" semantic conventions. It represents the number of logs -// submitted to enabled SDK Loggers. -type SDKLogCreated struct { - metric.Int64Counter -} - -var newSDKLogCreatedOpts = []metric.Int64CounterOption{ - metric.WithDescription("The number of logs submitted to enabled SDK Loggers."), - metric.WithUnit("{log_record}"), -} - -// NewSDKLogCreated returns a new SDKLogCreated instrument. -func NewSDKLogCreated( - m metric.Meter, - opt ...metric.Int64CounterOption, -) (SDKLogCreated, error) { - // Check if the meter is nil. - if m == nil { - return SDKLogCreated{noop.Int64Counter{}}, nil - } - - if len(opt) == 0 { - opt = newSDKLogCreatedOpts - } else { - opt = append(opt, newSDKLogCreatedOpts...) - } - - i, err := m.Int64Counter( - "otel.sdk.log.created", - opt..., - ) - if err != nil { - return SDKLogCreated{noop.Int64Counter{}}, err - } - return SDKLogCreated{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m SDKLogCreated) Inst() metric.Int64Counter { - return m.Int64Counter -} - -// Name returns the semantic convention name of the instrument. -func (SDKLogCreated) Name() string { - return "otel.sdk.log.created" -} - -// Unit returns the semantic convention unit of the instrument -func (SDKLogCreated) Unit() string { - return "{log_record}" -} - -// Description returns the semantic convention description of the instrument -func (SDKLogCreated) Description() string { - return "The number of logs submitted to enabled SDK Loggers." -} - -// Add adds incr to the existing count for attrs. -func (m SDKLogCreated) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) { - if !m.Int64Counter.Enabled(ctx) { - return - } - if len(attrs) == 0 { - m.Int64Counter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributes(attrs...)) - m.Int64Counter.Add(ctx, incr, *o...) -} - -// AddSet adds incr to the existing count for set. -func (m SDKLogCreated) AddSet(ctx context.Context, incr int64, set attribute.Set) { - if !m.Int64Counter.Enabled(ctx) { - return - } - if set.Len() == 0 { - m.Int64Counter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Int64Counter.Add(ctx, incr, *o...) -} - -// SDKMetricReaderCollectionDuration is an instrument used to record metric -// values conforming to the "otel.sdk.metric_reader.collection.duration" semantic -// conventions. It represents the duration of the collect operation of the metric -// reader. -type SDKMetricReaderCollectionDuration struct { - metric.Float64Histogram -} - -var newSDKMetricReaderCollectionDurationOpts = []metric.Float64HistogramOption{ - metric.WithDescription("The duration of the collect operation of the metric reader."), - metric.WithUnit("s"), -} - -// NewSDKMetricReaderCollectionDuration returns a new -// SDKMetricReaderCollectionDuration instrument. -func NewSDKMetricReaderCollectionDuration( - m metric.Meter, - opt ...metric.Float64HistogramOption, -) (SDKMetricReaderCollectionDuration, error) { - // Check if the meter is nil. - if m == nil { - return SDKMetricReaderCollectionDuration{noop.Float64Histogram{}}, nil - } - - if len(opt) == 0 { - opt = newSDKMetricReaderCollectionDurationOpts - } else { - opt = append(opt, newSDKMetricReaderCollectionDurationOpts...) - } - - i, err := m.Float64Histogram( - "otel.sdk.metric_reader.collection.duration", - opt..., - ) - if err != nil { - return SDKMetricReaderCollectionDuration{noop.Float64Histogram{}}, err - } - return SDKMetricReaderCollectionDuration{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m SDKMetricReaderCollectionDuration) Inst() metric.Float64Histogram { - return m.Float64Histogram -} - -// Name returns the semantic convention name of the instrument. -func (SDKMetricReaderCollectionDuration) Name() string { - return "otel.sdk.metric_reader.collection.duration" -} - -// Unit returns the semantic convention unit of the instrument -func (SDKMetricReaderCollectionDuration) Unit() string { - return "s" -} - -// Description returns the semantic convention description of the instrument -func (SDKMetricReaderCollectionDuration) Description() string { - return "The duration of the collect operation of the metric reader." -} - -// Record records val to the current distribution for attrs. -// -// All additional attrs passed are included in the recorded value. -// -// For successful collections, `error.type` MUST NOT be set. For failed -// collections, `error.type` SHOULD contain the failure cause. -// It can happen that metrics collection is successful for some MetricProducers, -// while others fail. In that case `error.type` SHOULD be set to any of the -// failure causes. -func (m SDKMetricReaderCollectionDuration) Record( - ctx context.Context, - val float64, - attrs ...attribute.KeyValue, -) { - if !m.Float64Histogram.Enabled(ctx) { - return - } - if len(attrs) == 0 { - m.Float64Histogram.Record(ctx, val) - return - } - - o := recOptPool.Get().(*[]metric.RecordOption) - defer func() { - *o = (*o)[:0] - recOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - attrs..., - ), - ) - - m.Float64Histogram.Record(ctx, val, *o...) -} - -// RecordSet records val to the current distribution for set. -// -// For successful collections, `error.type` MUST NOT be set. For failed -// collections, `error.type` SHOULD contain the failure cause. -// It can happen that metrics collection is successful for some MetricProducers, -// while others fail. In that case `error.type` SHOULD be set to any of the -// failure causes. -func (m SDKMetricReaderCollectionDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { - if !m.Float64Histogram.Enabled(ctx) { - return - } - if set.Len() == 0 { - m.Float64Histogram.Record(ctx, val) - return - } - - o := recOptPool.Get().(*[]metric.RecordOption) - defer func() { - *o = (*o)[:0] - recOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Float64Histogram.Record(ctx, val, *o...) -} - -// AttrErrorType returns an optional attribute for the "error.type" semantic -// convention. It represents the describes a class of error the operation ended -// with. -func (SDKMetricReaderCollectionDuration) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { - return attribute.String("error.type", string(val)) -} - -// AttrComponentName returns an optional attribute for the "otel.component.name" -// semantic convention. It represents a name uniquely identifying the instance of -// the OpenTelemetry component within its containing SDK instance. -func (SDKMetricReaderCollectionDuration) AttrComponentName(val string) attribute.KeyValue { - return attribute.String("otel.component.name", val) -} - -// AttrComponentType returns an optional attribute for the "otel.component.type" -// semantic convention. It represents a name identifying the type of the -// OpenTelemetry component. -func (SDKMetricReaderCollectionDuration) AttrComponentType(val ComponentTypeAttr) attribute.KeyValue { - return attribute.String("otel.component.type", string(val)) -} - -// SDKProcessorLogProcessed is an instrument used to record metric values -// conforming to the "otel.sdk.processor.log.processed" semantic conventions. It -// represents the number of log records for which the processing has finished, -// either successful or failed. -type SDKProcessorLogProcessed struct { - metric.Int64Counter -} - -var newSDKProcessorLogProcessedOpts = []metric.Int64CounterOption{ - metric.WithDescription("The number of log records for which the processing has finished, either successful or failed."), - metric.WithUnit("{log_record}"), -} - -// NewSDKProcessorLogProcessed returns a new SDKProcessorLogProcessed instrument. -func NewSDKProcessorLogProcessed( - m metric.Meter, - opt ...metric.Int64CounterOption, -) (SDKProcessorLogProcessed, error) { - // Check if the meter is nil. - if m == nil { - return SDKProcessorLogProcessed{noop.Int64Counter{}}, nil - } - - if len(opt) == 0 { - opt = newSDKProcessorLogProcessedOpts - } else { - opt = append(opt, newSDKProcessorLogProcessedOpts...) - } - - i, err := m.Int64Counter( - "otel.sdk.processor.log.processed", - opt..., - ) - if err != nil { - return SDKProcessorLogProcessed{noop.Int64Counter{}}, err - } - return SDKProcessorLogProcessed{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m SDKProcessorLogProcessed) Inst() metric.Int64Counter { - return m.Int64Counter -} - -// Name returns the semantic convention name of the instrument. -func (SDKProcessorLogProcessed) Name() string { - return "otel.sdk.processor.log.processed" -} - -// Unit returns the semantic convention unit of the instrument -func (SDKProcessorLogProcessed) Unit() string { - return "{log_record}" -} - -// Description returns the semantic convention description of the instrument -func (SDKProcessorLogProcessed) Description() string { - return "The number of log records for which the processing has finished, either successful or failed." -} - -// Add adds incr to the existing count for attrs. -// -// All additional attrs passed are included in the recorded value. -// -// For successful processing, `error.type` MUST NOT be set. For failed -// processing, `error.type` MUST contain the failure cause. -// For the SDK Simple and Batching Log Record Processor a log record is -// considered to be processed already when it has been submitted to the exporter, -// not when the corresponding export call has finished. -func (m SDKProcessorLogProcessed) Add( - ctx context.Context, - incr int64, - attrs ...attribute.KeyValue, -) { - if !m.Int64Counter.Enabled(ctx) { - return - } - if len(attrs) == 0 { - m.Int64Counter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - attrs..., - ), - ) - - m.Int64Counter.Add(ctx, incr, *o...) -} - -// AddSet adds incr to the existing count for set. -// -// For successful processing, `error.type` MUST NOT be set. For failed -// processing, `error.type` MUST contain the failure cause. -// For the SDK Simple and Batching Log Record Processor a log record is -// considered to be processed already when it has been submitted to the exporter, -// not when the corresponding export call has finished. -func (m SDKProcessorLogProcessed) AddSet(ctx context.Context, incr int64, set attribute.Set) { - if !m.Int64Counter.Enabled(ctx) { - return - } - if set.Len() == 0 { - m.Int64Counter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Int64Counter.Add(ctx, incr, *o...) -} - -// AttrErrorType returns an optional attribute for the "error.type" semantic -// convention. It represents a low-cardinality description of the failure reason. -// SDK Batching Log Record Processors MUST use `queue_full` for log records -// dropped due to a full queue. -func (SDKProcessorLogProcessed) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { - return attribute.String("error.type", string(val)) -} - -// AttrComponentName returns an optional attribute for the "otel.component.name" -// semantic convention. It represents a name uniquely identifying the instance of -// the OpenTelemetry component within its containing SDK instance. -func (SDKProcessorLogProcessed) AttrComponentName(val string) attribute.KeyValue { - return attribute.String("otel.component.name", val) -} - -// AttrComponentType returns an optional attribute for the "otel.component.type" -// semantic convention. It represents a name identifying the type of the -// OpenTelemetry component. -func (SDKProcessorLogProcessed) AttrComponentType(val ComponentTypeAttr) attribute.KeyValue { - return attribute.String("otel.component.type", string(val)) -} - -// SDKProcessorLogQueueCapacity is an instrument used to record metric values -// conforming to the "otel.sdk.processor.log.queue.capacity" semantic -// conventions. It represents the maximum number of log records the queue of a -// given instance of an SDK Log Record processor can hold. -type SDKProcessorLogQueueCapacity struct { - metric.Int64ObservableUpDownCounter -} - -var newSDKProcessorLogQueueCapacityOpts = []metric.Int64ObservableUpDownCounterOption{ - metric.WithDescription("The maximum number of log records the queue of a given instance of an SDK Log Record processor can hold."), - metric.WithUnit("{log_record}"), -} - -// NewSDKProcessorLogQueueCapacity returns a new SDKProcessorLogQueueCapacity -// instrument. -func NewSDKProcessorLogQueueCapacity( - m metric.Meter, - opt ...metric.Int64ObservableUpDownCounterOption, -) (SDKProcessorLogQueueCapacity, error) { - // Check if the meter is nil. - if m == nil { - return SDKProcessorLogQueueCapacity{noop.Int64ObservableUpDownCounter{}}, nil - } - - if len(opt) == 0 { - opt = newSDKProcessorLogQueueCapacityOpts - } else { - opt = append(opt, newSDKProcessorLogQueueCapacityOpts...) - } - - i, err := m.Int64ObservableUpDownCounter( - "otel.sdk.processor.log.queue.capacity", - opt..., - ) - if err != nil { - return SDKProcessorLogQueueCapacity{noop.Int64ObservableUpDownCounter{}}, err - } - return SDKProcessorLogQueueCapacity{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m SDKProcessorLogQueueCapacity) Inst() metric.Int64ObservableUpDownCounter { - return m.Int64ObservableUpDownCounter -} - -// Name returns the semantic convention name of the instrument. -func (SDKProcessorLogQueueCapacity) Name() string { - return "otel.sdk.processor.log.queue.capacity" -} - -// Unit returns the semantic convention unit of the instrument -func (SDKProcessorLogQueueCapacity) Unit() string { - return "{log_record}" -} - -// Description returns the semantic convention description of the instrument -func (SDKProcessorLogQueueCapacity) Description() string { - return "The maximum number of log records the queue of a given instance of an SDK Log Record processor can hold." -} - -// AttrComponentName returns an optional attribute for the "otel.component.name" -// semantic convention. It represents a name uniquely identifying the instance of -// the OpenTelemetry component within its containing SDK instance. -func (SDKProcessorLogQueueCapacity) AttrComponentName(val string) attribute.KeyValue { - return attribute.String("otel.component.name", val) -} - -// AttrComponentType returns an optional attribute for the "otel.component.type" -// semantic convention. It represents a name identifying the type of the -// OpenTelemetry component. -func (SDKProcessorLogQueueCapacity) AttrComponentType(val ComponentTypeAttr) attribute.KeyValue { - return attribute.String("otel.component.type", string(val)) -} - -// SDKProcessorLogQueueSize is an instrument used to record metric values -// conforming to the "otel.sdk.processor.log.queue.size" semantic conventions. It -// represents the number of log records in the queue of a given instance of an -// SDK log processor. -type SDKProcessorLogQueueSize struct { - metric.Int64ObservableUpDownCounter -} - -var newSDKProcessorLogQueueSizeOpts = []metric.Int64ObservableUpDownCounterOption{ - metric.WithDescription("The number of log records in the queue of a given instance of an SDK log processor."), - metric.WithUnit("{log_record}"), -} - -// NewSDKProcessorLogQueueSize returns a new SDKProcessorLogQueueSize instrument. -func NewSDKProcessorLogQueueSize( - m metric.Meter, - opt ...metric.Int64ObservableUpDownCounterOption, -) (SDKProcessorLogQueueSize, error) { - // Check if the meter is nil. - if m == nil { - return SDKProcessorLogQueueSize{noop.Int64ObservableUpDownCounter{}}, nil - } - - if len(opt) == 0 { - opt = newSDKProcessorLogQueueSizeOpts - } else { - opt = append(opt, newSDKProcessorLogQueueSizeOpts...) - } - - i, err := m.Int64ObservableUpDownCounter( - "otel.sdk.processor.log.queue.size", - opt..., - ) - if err != nil { - return SDKProcessorLogQueueSize{noop.Int64ObservableUpDownCounter{}}, err - } - return SDKProcessorLogQueueSize{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m SDKProcessorLogQueueSize) Inst() metric.Int64ObservableUpDownCounter { - return m.Int64ObservableUpDownCounter -} - -// Name returns the semantic convention name of the instrument. -func (SDKProcessorLogQueueSize) Name() string { - return "otel.sdk.processor.log.queue.size" -} - -// Unit returns the semantic convention unit of the instrument -func (SDKProcessorLogQueueSize) Unit() string { - return "{log_record}" -} - -// Description returns the semantic convention description of the instrument -func (SDKProcessorLogQueueSize) Description() string { - return "The number of log records in the queue of a given instance of an SDK log processor." -} - -// AttrComponentName returns an optional attribute for the "otel.component.name" -// semantic convention. It represents a name uniquely identifying the instance of -// the OpenTelemetry component within its containing SDK instance. -func (SDKProcessorLogQueueSize) AttrComponentName(val string) attribute.KeyValue { - return attribute.String("otel.component.name", val) -} - -// AttrComponentType returns an optional attribute for the "otel.component.type" -// semantic convention. It represents a name identifying the type of the -// OpenTelemetry component. -func (SDKProcessorLogQueueSize) AttrComponentType(val ComponentTypeAttr) attribute.KeyValue { - return attribute.String("otel.component.type", string(val)) -} - -// SDKProcessorSpanProcessed is an instrument used to record metric values -// conforming to the "otel.sdk.processor.span.processed" semantic conventions. It -// represents the number of spans for which the processing has finished, either -// successful or failed. -type SDKProcessorSpanProcessed struct { - metric.Int64Counter -} - -var newSDKProcessorSpanProcessedOpts = []metric.Int64CounterOption{ - metric.WithDescription("The number of spans for which the processing has finished, either successful or failed."), - metric.WithUnit("{span}"), -} - -// NewSDKProcessorSpanProcessed returns a new SDKProcessorSpanProcessed -// instrument. -func NewSDKProcessorSpanProcessed( - m metric.Meter, - opt ...metric.Int64CounterOption, -) (SDKProcessorSpanProcessed, error) { - // Check if the meter is nil. - if m == nil { - return SDKProcessorSpanProcessed{noop.Int64Counter{}}, nil - } - - if len(opt) == 0 { - opt = newSDKProcessorSpanProcessedOpts - } else { - opt = append(opt, newSDKProcessorSpanProcessedOpts...) - } - - i, err := m.Int64Counter( - "otel.sdk.processor.span.processed", - opt..., - ) - if err != nil { - return SDKProcessorSpanProcessed{noop.Int64Counter{}}, err - } - return SDKProcessorSpanProcessed{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m SDKProcessorSpanProcessed) Inst() metric.Int64Counter { - return m.Int64Counter -} - -// Name returns the semantic convention name of the instrument. -func (SDKProcessorSpanProcessed) Name() string { - return "otel.sdk.processor.span.processed" -} - -// Unit returns the semantic convention unit of the instrument -func (SDKProcessorSpanProcessed) Unit() string { - return "{span}" -} - -// Description returns the semantic convention description of the instrument -func (SDKProcessorSpanProcessed) Description() string { - return "The number of spans for which the processing has finished, either successful or failed." -} - -// Add adds incr to the existing count for attrs. -// -// All additional attrs passed are included in the recorded value. -// -// For successful processing, `error.type` MUST NOT be set. For failed -// processing, `error.type` MUST contain the failure cause. -// For the SDK Simple and Batching Span Processor a span is considered to be -// processed already when it has been submitted to the exporter, not when the -// corresponding export call has finished. -func (m SDKProcessorSpanProcessed) Add( - ctx context.Context, - incr int64, - attrs ...attribute.KeyValue, -) { - if !m.Int64Counter.Enabled(ctx) { - return - } - if len(attrs) == 0 { - m.Int64Counter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - attrs..., - ), - ) - - m.Int64Counter.Add(ctx, incr, *o...) -} - -// AddSet adds incr to the existing count for set. -// -// For successful processing, `error.type` MUST NOT be set. For failed -// processing, `error.type` MUST contain the failure cause. -// For the SDK Simple and Batching Span Processor a span is considered to be -// processed already when it has been submitted to the exporter, not when the -// corresponding export call has finished. -func (m SDKProcessorSpanProcessed) AddSet(ctx context.Context, incr int64, set attribute.Set) { - if !m.Int64Counter.Enabled(ctx) { - return - } - if set.Len() == 0 { - m.Int64Counter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Int64Counter.Add(ctx, incr, *o...) -} - -// AttrErrorType returns an optional attribute for the "error.type" semantic -// convention. It represents a low-cardinality description of the failure reason. -// SDK Batching Span Processors MUST use `queue_full` for spans dropped due to a -// full queue. -func (SDKProcessorSpanProcessed) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { - return attribute.String("error.type", string(val)) -} - -// AttrComponentName returns an optional attribute for the "otel.component.name" -// semantic convention. It represents a name uniquely identifying the instance of -// the OpenTelemetry component within its containing SDK instance. -func (SDKProcessorSpanProcessed) AttrComponentName(val string) attribute.KeyValue { - return attribute.String("otel.component.name", val) -} - -// AttrComponentType returns an optional attribute for the "otel.component.type" -// semantic convention. It represents a name identifying the type of the -// OpenTelemetry component. -func (SDKProcessorSpanProcessed) AttrComponentType(val ComponentTypeAttr) attribute.KeyValue { - return attribute.String("otel.component.type", string(val)) -} - -// SDKProcessorSpanQueueCapacity is an instrument used to record metric values -// conforming to the "otel.sdk.processor.span.queue.capacity" semantic -// conventions. It represents the maximum number of spans the queue of a given -// instance of an SDK span processor can hold. -type SDKProcessorSpanQueueCapacity struct { - metric.Int64ObservableUpDownCounter -} - -var newSDKProcessorSpanQueueCapacityOpts = []metric.Int64ObservableUpDownCounterOption{ - metric.WithDescription("The maximum number of spans the queue of a given instance of an SDK span processor can hold."), - metric.WithUnit("{span}"), -} - -// NewSDKProcessorSpanQueueCapacity returns a new SDKProcessorSpanQueueCapacity -// instrument. -func NewSDKProcessorSpanQueueCapacity( - m metric.Meter, - opt ...metric.Int64ObservableUpDownCounterOption, -) (SDKProcessorSpanQueueCapacity, error) { - // Check if the meter is nil. - if m == nil { - return SDKProcessorSpanQueueCapacity{noop.Int64ObservableUpDownCounter{}}, nil - } - - if len(opt) == 0 { - opt = newSDKProcessorSpanQueueCapacityOpts - } else { - opt = append(opt, newSDKProcessorSpanQueueCapacityOpts...) - } - - i, err := m.Int64ObservableUpDownCounter( - "otel.sdk.processor.span.queue.capacity", - opt..., - ) - if err != nil { - return SDKProcessorSpanQueueCapacity{noop.Int64ObservableUpDownCounter{}}, err - } - return SDKProcessorSpanQueueCapacity{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m SDKProcessorSpanQueueCapacity) Inst() metric.Int64ObservableUpDownCounter { - return m.Int64ObservableUpDownCounter -} - -// Name returns the semantic convention name of the instrument. -func (SDKProcessorSpanQueueCapacity) Name() string { - return "otel.sdk.processor.span.queue.capacity" -} - -// Unit returns the semantic convention unit of the instrument -func (SDKProcessorSpanQueueCapacity) Unit() string { - return "{span}" -} - -// Description returns the semantic convention description of the instrument -func (SDKProcessorSpanQueueCapacity) Description() string { - return "The maximum number of spans the queue of a given instance of an SDK span processor can hold." -} - -// AttrComponentName returns an optional attribute for the "otel.component.name" -// semantic convention. It represents a name uniquely identifying the instance of -// the OpenTelemetry component within its containing SDK instance. -func (SDKProcessorSpanQueueCapacity) AttrComponentName(val string) attribute.KeyValue { - return attribute.String("otel.component.name", val) -} - -// AttrComponentType returns an optional attribute for the "otel.component.type" -// semantic convention. It represents a name identifying the type of the -// OpenTelemetry component. -func (SDKProcessorSpanQueueCapacity) AttrComponentType(val ComponentTypeAttr) attribute.KeyValue { - return attribute.String("otel.component.type", string(val)) -} - -// SDKProcessorSpanQueueSize is an instrument used to record metric values -// conforming to the "otel.sdk.processor.span.queue.size" semantic conventions. -// It represents the number of spans in the queue of a given instance of an SDK -// span processor. -type SDKProcessorSpanQueueSize struct { - metric.Int64ObservableUpDownCounter -} - -var newSDKProcessorSpanQueueSizeOpts = []metric.Int64ObservableUpDownCounterOption{ - metric.WithDescription("The number of spans in the queue of a given instance of an SDK span processor."), - metric.WithUnit("{span}"), -} - -// NewSDKProcessorSpanQueueSize returns a new SDKProcessorSpanQueueSize -// instrument. -func NewSDKProcessorSpanQueueSize( - m metric.Meter, - opt ...metric.Int64ObservableUpDownCounterOption, -) (SDKProcessorSpanQueueSize, error) { - // Check if the meter is nil. - if m == nil { - return SDKProcessorSpanQueueSize{noop.Int64ObservableUpDownCounter{}}, nil - } - - if len(opt) == 0 { - opt = newSDKProcessorSpanQueueSizeOpts - } else { - opt = append(opt, newSDKProcessorSpanQueueSizeOpts...) - } - - i, err := m.Int64ObservableUpDownCounter( - "otel.sdk.processor.span.queue.size", - opt..., - ) - if err != nil { - return SDKProcessorSpanQueueSize{noop.Int64ObservableUpDownCounter{}}, err - } - return SDKProcessorSpanQueueSize{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m SDKProcessorSpanQueueSize) Inst() metric.Int64ObservableUpDownCounter { - return m.Int64ObservableUpDownCounter -} - -// Name returns the semantic convention name of the instrument. -func (SDKProcessorSpanQueueSize) Name() string { - return "otel.sdk.processor.span.queue.size" -} - -// Unit returns the semantic convention unit of the instrument -func (SDKProcessorSpanQueueSize) Unit() string { - return "{span}" -} - -// Description returns the semantic convention description of the instrument -func (SDKProcessorSpanQueueSize) Description() string { - return "The number of spans in the queue of a given instance of an SDK span processor." -} - -// AttrComponentName returns an optional attribute for the "otel.component.name" -// semantic convention. It represents a name uniquely identifying the instance of -// the OpenTelemetry component within its containing SDK instance. -func (SDKProcessorSpanQueueSize) AttrComponentName(val string) attribute.KeyValue { - return attribute.String("otel.component.name", val) -} - -// AttrComponentType returns an optional attribute for the "otel.component.type" -// semantic convention. It represents a name identifying the type of the -// OpenTelemetry component. -func (SDKProcessorSpanQueueSize) AttrComponentType(val ComponentTypeAttr) attribute.KeyValue { - return attribute.String("otel.component.type", string(val)) -} - -// SDKSpanLive is an instrument used to record metric values conforming to the -// "otel.sdk.span.live" semantic conventions. It represents the number of created -// spans with `recording=true` for which the end operation has not been called -// yet. -type SDKSpanLive struct { - metric.Int64UpDownCounter -} - -var newSDKSpanLiveOpts = []metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of created spans with `recording=true` for which the end operation has not been called yet."), - metric.WithUnit("{span}"), -} - -// NewSDKSpanLive returns a new SDKSpanLive instrument. -func NewSDKSpanLive( - m metric.Meter, - opt ...metric.Int64UpDownCounterOption, -) (SDKSpanLive, error) { - // Check if the meter is nil. - if m == nil { - return SDKSpanLive{noop.Int64UpDownCounter{}}, nil - } - - if len(opt) == 0 { - opt = newSDKSpanLiveOpts - } else { - opt = append(opt, newSDKSpanLiveOpts...) - } - - i, err := m.Int64UpDownCounter( - "otel.sdk.span.live", - opt..., - ) - if err != nil { - return SDKSpanLive{noop.Int64UpDownCounter{}}, err - } - return SDKSpanLive{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m SDKSpanLive) Inst() metric.Int64UpDownCounter { - return m.Int64UpDownCounter -} - -// Name returns the semantic convention name of the instrument. -func (SDKSpanLive) Name() string { - return "otel.sdk.span.live" -} - -// Unit returns the semantic convention unit of the instrument -func (SDKSpanLive) Unit() string { - return "{span}" -} - -// Description returns the semantic convention description of the instrument -func (SDKSpanLive) Description() string { - return "The number of created spans with `recording=true` for which the end operation has not been called yet." -} - -// Add adds incr to the existing count for attrs. -// -// All additional attrs passed are included in the recorded value. -func (m SDKSpanLive) Add( - ctx context.Context, - incr int64, - attrs ...attribute.KeyValue, -) { - if !m.Int64UpDownCounter.Enabled(ctx) { - return - } - if len(attrs) == 0 { - m.Int64UpDownCounter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - attrs..., - ), - ) - - m.Int64UpDownCounter.Add(ctx, incr, *o...) -} - -// AddSet adds incr to the existing count for set. -func (m SDKSpanLive) AddSet(ctx context.Context, incr int64, set attribute.Set) { - if !m.Int64UpDownCounter.Enabled(ctx) { - return - } - if set.Len() == 0 { - m.Int64UpDownCounter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Int64UpDownCounter.Add(ctx, incr, *o...) -} - -// AttrSpanSamplingResult returns an optional attribute for the -// "otel.span.sampling_result" semantic convention. It represents the result -// value of the sampler for this span. -func (SDKSpanLive) AttrSpanSamplingResult(val SpanSamplingResultAttr) attribute.KeyValue { - return attribute.String("otel.span.sampling_result", string(val)) -} - -// SDKSpanStarted is an instrument used to record metric values conforming to the -// "otel.sdk.span.started" semantic conventions. It represents the number of -// created spans. -type SDKSpanStarted struct { - metric.Int64Counter -} - -var newSDKSpanStartedOpts = []metric.Int64CounterOption{ - metric.WithDescription("The number of created spans."), - metric.WithUnit("{span}"), -} - -// NewSDKSpanStarted returns a new SDKSpanStarted instrument. -func NewSDKSpanStarted( - m metric.Meter, - opt ...metric.Int64CounterOption, -) (SDKSpanStarted, error) { - // Check if the meter is nil. - if m == nil { - return SDKSpanStarted{noop.Int64Counter{}}, nil - } - - if len(opt) == 0 { - opt = newSDKSpanStartedOpts - } else { - opt = append(opt, newSDKSpanStartedOpts...) - } - - i, err := m.Int64Counter( - "otel.sdk.span.started", - opt..., - ) - if err != nil { - return SDKSpanStarted{noop.Int64Counter{}}, err - } - return SDKSpanStarted{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m SDKSpanStarted) Inst() metric.Int64Counter { - return m.Int64Counter -} - -// Name returns the semantic convention name of the instrument. -func (SDKSpanStarted) Name() string { - return "otel.sdk.span.started" -} - -// Unit returns the semantic convention unit of the instrument -func (SDKSpanStarted) Unit() string { - return "{span}" -} - -// Description returns the semantic convention description of the instrument -func (SDKSpanStarted) Description() string { - return "The number of created spans." -} - -// Add adds incr to the existing count for attrs. -// -// All additional attrs passed are included in the recorded value. -// -// Implementations MUST record this metric for all spans, even for non-recording -// ones. -func (m SDKSpanStarted) Add( - ctx context.Context, - incr int64, - attrs ...attribute.KeyValue, -) { - if !m.Int64Counter.Enabled(ctx) { - return - } - if len(attrs) == 0 { - m.Int64Counter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - attrs..., - ), - ) - - m.Int64Counter.Add(ctx, incr, *o...) -} - -// AddSet adds incr to the existing count for set. -// -// Implementations MUST record this metric for all spans, even for non-recording -// ones. -func (m SDKSpanStarted) AddSet(ctx context.Context, incr int64, set attribute.Set) { - if !m.Int64Counter.Enabled(ctx) { - return - } - if set.Len() == 0 { - m.Int64Counter.Add(ctx, incr) - return - } - - o := addOptPool.Get().(*[]metric.AddOption) - defer func() { - *o = (*o)[:0] - addOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Int64Counter.Add(ctx, incr, *o...) -} - -// AttrSpanParentOrigin returns an optional attribute for the -// "otel.span.parent.origin" semantic convention. It represents the determines -// whether the span has a parent span, and if so, [whether it is a remote parent] -// . -// -// [whether it is a remote parent]: https://opentelemetry.io/docs/specs/otel/trace/api/#isremote -func (SDKSpanStarted) AttrSpanParentOrigin(val SpanParentOriginAttr) attribute.KeyValue { - return attribute.String("otel.span.parent.origin", string(val)) -} - -// AttrSpanSamplingResult returns an optional attribute for the -// "otel.span.sampling_result" semantic convention. It represents the result -// value of the sampler for this span. -func (SDKSpanStarted) AttrSpanSamplingResult(val SpanSamplingResultAttr) attribute.KeyValue { - return attribute.String("otel.span.sampling_result", string(val)) -} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/rpcconv/metric.go b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/rpcconv/metric.go new file mode 100644 index 0000000000..0ab550d474 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/rpcconv/metric.go @@ -0,0 +1,370 @@ +// Code generated from semantic convention specification. DO NOT EDIT. + +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package rpcconv provides types and functionality for OpenTelemetry semantic +// conventions in the "rpc" namespace. +package rpcconv + +import ( + "context" + "sync" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/noop" +) + +var ( + addOptPool = &sync.Pool{New: func() any { return &[]metric.AddOption{} }} + recOptPool = &sync.Pool{New: func() any { return &[]metric.RecordOption{} }} +) + +// ErrorTypeAttr is an attribute conforming to the error.type semantic +// conventions. It represents the describes a class of error the operation ended +// with. +type ErrorTypeAttr string + +// ErrorTypeOther is a fallback error value to be used when the instrumentation +// doesn't define a custom value. +var ErrorTypeOther ErrorTypeAttr = "_OTHER" + +// SystemNameAttr is an attribute conforming to the rpc.system.name semantic +// conventions. It represents the Remote Procedure Call (RPC) system. +type SystemNameAttr string + +var ( + // SystemNameGRPC is the [gRPC]. + // + // [gRPC]: https://grpc.io/ + SystemNameGRPC SystemNameAttr = "grpc" + // SystemNameDubbo is the [Apache Dubbo]. + // + // [Apache Dubbo]: https://dubbo.apache.org/ + SystemNameDubbo SystemNameAttr = "dubbo" + // SystemNameConnectrpc is the [Connect RPC]. + // + // [Connect RPC]: https://connectrpc.com/ + SystemNameConnectrpc SystemNameAttr = "connectrpc" + // SystemNameJSONRPC is the [JSON-RPC]. + // + // [JSON-RPC]: https://www.jsonrpc.org/ + SystemNameJSONRPC SystemNameAttr = "jsonrpc" +) + +// ClientCallDuration is an instrument used to record metric values conforming to +// the "rpc.client.call.duration" semantic conventions. It represents the +// measures the duration of an outgoing Remote Procedure Call (RPC). +type ClientCallDuration struct { + metric.Float64Histogram +} + +var newClientCallDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Measures the duration of an outgoing Remote Procedure Call (RPC)."), + metric.WithUnit("s"), +} + +// NewClientCallDuration returns a new ClientCallDuration instrument. +func NewClientCallDuration( + m metric.Meter, + opt ...metric.Float64HistogramOption, +) (ClientCallDuration, error) { + // Check if the meter is nil. + if m == nil { + return ClientCallDuration{noop.Float64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientCallDurationOpts + } else { + opt = append(opt, newClientCallDurationOpts...) + } + + i, err := m.Float64Histogram( + "rpc.client.call.duration", + opt..., + ) + if err != nil { + return ClientCallDuration{noop.Float64Histogram{}}, err + } + return ClientCallDuration{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientCallDuration) Inst() metric.Float64Histogram { + return m.Float64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientCallDuration) Name() string { + return "rpc.client.call.duration" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientCallDuration) Unit() string { + return "s" +} + +// Description returns the semantic convention description of the instrument +func (ClientCallDuration) Description() string { + return "Measures the duration of an outgoing Remote Procedure Call (RPC)." +} + +// Record records val to the current distribution for attrs. +// +// The systemName is the the Remote Procedure Call (RPC) system. +// +// All additional attrs passed are included in the recorded value. +// +// When this metric is reported alongside an RPC client span, the metric value +// SHOULD be the same as the RPC client span duration. +func (m ClientCallDuration) Record( + ctx context.Context, + val float64, + systemName SystemNameAttr, + attrs ...attribute.KeyValue, +) { + if !m.Float64Histogram.Enabled(ctx) { + return + } + if len(attrs) == 0 { + m.Float64Histogram.Record(ctx, val, metric.WithAttributes( + attribute.String("rpc.system.name", string(systemName)), + )) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs[:len(attrs):len(attrs)], + attribute.String("rpc.system.name", string(systemName)), + )..., + ), + ) + + m.Float64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// When this metric is reported alongside an RPC client span, the metric value +// SHOULD be the same as the RPC client span duration. +func (m ClientCallDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { + if !m.Float64Histogram.Enabled(ctx) { + return + } + if set.Len() == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Float64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ClientCallDuration) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrMethod returns an optional attribute for the "rpc.method" semantic +// convention. It represents the fully-qualified logical name of the method from +// the RPC interface perspective. +func (ClientCallDuration) AttrMethod(val string) attribute.KeyValue { + return attribute.String("rpc.method", val) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "rpc.response.status_code" semantic convention. It represents the status code +// of the RPC returned by the RPC server or generated by the client. +func (ClientCallDuration) AttrResponseStatusCode(val string) attribute.KeyValue { + return attribute.String("rpc.response.status_code", val) +} + +// AttrServerAddress returns an optional attribute for the "server.address" +// semantic convention. It represents a string identifying a group of RPC server +// instances request is sent to. +func (ClientCallDuration) AttrServerAddress(val string) attribute.KeyValue { + return attribute.String("server.address", val) +} + +// AttrServerPort returns an optional attribute for the "server.port" semantic +// convention. It represents the server port number. +func (ClientCallDuration) AttrServerPort(val int) attribute.KeyValue { + return attribute.Int("server.port", val) +} + +// ServerCallDuration is an instrument used to record metric values conforming to +// the "rpc.server.call.duration" semantic conventions. It represents the +// measures the duration of an incoming Remote Procedure Call (RPC). +type ServerCallDuration struct { + metric.Float64Histogram +} + +var newServerCallDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Measures the duration of an incoming Remote Procedure Call (RPC)."), + metric.WithUnit("s"), +} + +// NewServerCallDuration returns a new ServerCallDuration instrument. +func NewServerCallDuration( + m metric.Meter, + opt ...metric.Float64HistogramOption, +) (ServerCallDuration, error) { + // Check if the meter is nil. + if m == nil { + return ServerCallDuration{noop.Float64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerCallDurationOpts + } else { + opt = append(opt, newServerCallDurationOpts...) + } + + i, err := m.Float64Histogram( + "rpc.server.call.duration", + opt..., + ) + if err != nil { + return ServerCallDuration{noop.Float64Histogram{}}, err + } + return ServerCallDuration{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerCallDuration) Inst() metric.Float64Histogram { + return m.Float64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerCallDuration) Name() string { + return "rpc.server.call.duration" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerCallDuration) Unit() string { + return "s" +} + +// Description returns the semantic convention description of the instrument +func (ServerCallDuration) Description() string { + return "Measures the duration of an incoming Remote Procedure Call (RPC)." +} + +// Record records val to the current distribution for attrs. +// +// The systemName is the the Remote Procedure Call (RPC) system. +// +// All additional attrs passed are included in the recorded value. +// +// When this metric is reported alongside an RPC server span, the metric value +// SHOULD be the same as the RPC server span duration. +func (m ServerCallDuration) Record( + ctx context.Context, + val float64, + systemName SystemNameAttr, + attrs ...attribute.KeyValue, +) { + if !m.Float64Histogram.Enabled(ctx) { + return + } + if len(attrs) == 0 { + m.Float64Histogram.Record(ctx, val, metric.WithAttributes( + attribute.String("rpc.system.name", string(systemName)), + )) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs[:len(attrs):len(attrs)], + attribute.String("rpc.system.name", string(systemName)), + )..., + ), + ) + + m.Float64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// When this metric is reported alongside an RPC server span, the metric value +// SHOULD be the same as the RPC server span duration. +func (m ServerCallDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { + if !m.Float64Histogram.Enabled(ctx) { + return + } + if set.Len() == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Float64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ServerCallDuration) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrMethod returns an optional attribute for the "rpc.method" semantic +// convention. It represents the fully-qualified logical name of the method from +// the RPC interface perspective. +func (ServerCallDuration) AttrMethod(val string) attribute.KeyValue { + return attribute.String("rpc.method", val) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "rpc.response.status_code" semantic convention. It represents the status code +// of the RPC returned by the RPC server or generated by the client. +func (ServerCallDuration) AttrResponseStatusCode(val string) attribute.KeyValue { + return attribute.String("rpc.response.status_code", val) +} + +// AttrServerAddress returns an optional attribute for the "server.address" +// semantic convention. It represents a string identifying a group of RPC server +// instances request is sent to. +func (ServerCallDuration) AttrServerAddress(val string) attribute.KeyValue { + return attribute.String("server.address", val) +} + +// AttrServerPort returns an optional attribute for the "server.port" semantic +// convention. It represents the server port number. +func (ServerCallDuration) AttrServerPort(val int) attribute.KeyValue { + return attribute.Int("server.port", val) +} diff --git a/vendor/k8s.io/api/admission/v1/types.go b/vendor/k8s.io/api/admission/v1/types.go index 34cbf2f59b..f9a79ecd75 100644 --- a/vendor/k8s.io/api/admission/v1/types.go +++ b/vendor/k8s.io/api/admission/v1/types.go @@ -28,7 +28,7 @@ import ( // AdmissionReview describes an admission review request/response. type AdmissionReview struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // request describes the attributes for the admission request. // +optional Request *AdmissionRequest `json:"request,omitempty" protobuf:"bytes,1,opt,name=request"` diff --git a/vendor/k8s.io/api/admission/v1beta1/types.go b/vendor/k8s.io/api/admission/v1beta1/types.go index 015dc8ba3e..cb32a2fa07 100644 --- a/vendor/k8s.io/api/admission/v1beta1/types.go +++ b/vendor/k8s.io/api/admission/v1beta1/types.go @@ -32,7 +32,7 @@ import ( // AdmissionReview describes an admission review request/response. type AdmissionReview struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // request describes the attributes for the admission request. // +optional Request *AdmissionRequest `json:"request,omitempty" protobuf:"bytes,1,opt,name=request"` diff --git a/vendor/k8s.io/api/admissionregistration/v1/generated.proto b/vendor/k8s.io/api/admissionregistration/v1/generated.proto index 89c1475b2e..718b7c14e8 100644 --- a/vendor/k8s.io/api/admissionregistration/v1/generated.proto +++ b/vendor/k8s.io/api/admissionregistration/v1/generated.proto @@ -872,6 +872,7 @@ message TypeChecking { } // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. +// +k8s:supportsSubresource="/status" message ValidatingAdmissionPolicy { // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional @@ -926,7 +927,7 @@ message ValidatingAdmissionPolicyBindingSpec { // If the referenced resource does not exist, this binding is considered invalid and will be ignored // Required. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string policyName = 1; // paramRef specifies the parameter resource used to configure the admission control policy. @@ -985,7 +986,7 @@ message ValidatingAdmissionPolicyBindingSpec { // Required. // +listType=set // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required repeated string validationActions = 4; } @@ -1099,6 +1100,9 @@ message ValidatingAdmissionPolicyStatus { // +optional // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 3; } diff --git a/vendor/k8s.io/api/admissionregistration/v1/types.go b/vendor/k8s.io/api/admissionregistration/v1/types.go index f7a07b6453..8047d5c5f9 100644 --- a/vendor/k8s.io/api/admissionregistration/v1/types.go +++ b/vendor/k8s.io/api/admissionregistration/v1/types.go @@ -139,8 +139,9 @@ const ( // +k8s:prerelease-lifecycle-gen:introduced=1.30 // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. +// +k8s:supportsSubresource="/status" type ValidatingAdmissionPolicy struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -167,6 +168,9 @@ type ValidatingAdmissionPolicyStatus struct { // +optional // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type Conditions []metav1.Condition `json:"conditions,omitempty" protobuf:"bytes,3,rep,name=conditions"` } @@ -199,7 +203,7 @@ type ExpressionWarning struct { // ValidatingAdmissionPolicyList is a list of ValidatingAdmissionPolicy. type ValidatingAdmissionPolicyList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -447,7 +451,7 @@ type AuditAnnotation struct { // Adding/removing policies, bindings, or params can not affect whether a // given (policy, binding, param) combination is within its own CEL budget. type ValidatingAdmissionPolicyBinding struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -461,7 +465,7 @@ type ValidatingAdmissionPolicyBinding struct { // ValidatingAdmissionPolicyBindingList is a list of ValidatingAdmissionPolicyBinding. type ValidatingAdmissionPolicyBindingList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -476,7 +480,7 @@ type ValidatingAdmissionPolicyBindingSpec struct { // If the referenced resource does not exist, this binding is considered invalid and will be ignored // Required. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required PolicyName string `json:"policyName,omitempty" protobuf:"bytes,1,rep,name=policyName"` // paramRef specifies the parameter resource used to configure the admission control policy. @@ -535,7 +539,7 @@ type ValidatingAdmissionPolicyBindingSpec struct { // Required. // +listType=set // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required ValidationActions []ValidationAction `json:"validationActions,omitempty" protobuf:"bytes,4,rep,name=validationActions"` } @@ -714,7 +718,7 @@ type NamedRuleWithOperations struct { // +optional ResourceNames []string `json:"resourceNames,omitempty" protobuf:"bytes,1,rep,name=resourceNames"` // RuleWithOperations is a tuple of Operations and Resources. - RuleWithOperations `json:",inline" protobuf:"bytes,2,opt,name=ruleWithOperations"` + RuleWithOperations `json:"" protobuf:"bytes,2,opt,name=ruleWithOperations"` } // +genclient @@ -724,7 +728,7 @@ type NamedRuleWithOperations struct { // ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it. type ValidatingWebhookConfiguration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -742,7 +746,7 @@ type ValidatingWebhookConfiguration struct { // ValidatingWebhookConfigurationList is a list of ValidatingWebhookConfiguration. type ValidatingWebhookConfigurationList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -758,7 +762,7 @@ type ValidatingWebhookConfigurationList struct { // MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object. type MutatingWebhookConfiguration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -776,7 +780,7 @@ type MutatingWebhookConfiguration struct { // MutatingWebhookConfigurationList is a list of MutatingWebhookConfiguration. type MutatingWebhookConfigurationList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -1110,7 +1114,7 @@ type MutatingWebhook struct { // MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain. type MutatingAdmissionPolicy struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -1123,7 +1127,7 @@ type MutatingAdmissionPolicy struct { // MutatingAdmissionPolicyList is a list of MutatingAdmissionPolicy. type MutatingAdmissionPolicyList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -1383,7 +1387,7 @@ type JSONPatch struct { // Adding/removing policies, bindings, or params can not affect whether a // given (policy, binding, param) combination is within its own CEL budget. type MutatingAdmissionPolicyBinding struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -1396,7 +1400,7 @@ type MutatingAdmissionPolicyBinding struct { // MutatingAdmissionPolicyBindingList is a list of MutatingAdmissionPolicyBinding. type MutatingAdmissionPolicyBindingList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -1458,7 +1462,7 @@ type RuleWithOperations struct { Operations []OperationType `json:"operations,omitempty" protobuf:"bytes,1,rep,name=operations,casttype=OperationType"` // Rule is embedded, it describes other criteria of the rule, like // APIGroups, APIVersions, Resources, etc. - Rule `json:",inline" protobuf:"bytes,2,opt,name=rule"` + Rule `json:"" protobuf:"bytes,2,opt,name=rule"` } // OperationType specifies an operation for a request. diff --git a/vendor/k8s.io/api/admissionregistration/v1alpha1/generated.proto b/vendor/k8s.io/api/admissionregistration/v1alpha1/generated.proto index 57c7cd2b1d..8802ac92db 100644 --- a/vendor/k8s.io/api/admissionregistration/v1alpha1/generated.proto +++ b/vendor/k8s.io/api/admissionregistration/v1alpha1/generated.proto @@ -594,6 +594,7 @@ message TypeChecking { } // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. +// +k8s:supportsSubresource="/status" message ValidatingAdmissionPolicy { // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional @@ -648,7 +649,7 @@ message ValidatingAdmissionPolicyBindingSpec { // If the referenced resource does not exist, this binding is considered invalid and will be ignored // Required. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string policyName = 1; // paramRef specifies the parameter resource used to configure the admission control policy. @@ -707,7 +708,7 @@ message ValidatingAdmissionPolicyBindingSpec { // Required. // +listType=set // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required repeated string validationActions = 4; } @@ -821,6 +822,9 @@ message ValidatingAdmissionPolicyStatus { // +optional // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 3; } diff --git a/vendor/k8s.io/api/admissionregistration/v1alpha1/types.go b/vendor/k8s.io/api/admissionregistration/v1alpha1/types.go index 6a789b2d7f..39ff0abdc3 100644 --- a/vendor/k8s.io/api/admissionregistration/v1alpha1/types.go +++ b/vendor/k8s.io/api/admissionregistration/v1alpha1/types.go @@ -81,8 +81,9 @@ const ( // +k8s:prerelease-lifecycle-gen:introduced=1.26 // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. +// +k8s:supportsSubresource="/status" type ValidatingAdmissionPolicy struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -109,6 +110,9 @@ type ValidatingAdmissionPolicyStatus struct { // +optional // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type Conditions []metav1.Condition `json:"conditions,omitempty" protobuf:"bytes,3,rep,name=conditions"` } @@ -138,7 +142,7 @@ type ExpressionWarning struct { // ValidatingAdmissionPolicyList is a list of ValidatingAdmissionPolicy. type ValidatingAdmissionPolicyList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -387,7 +391,7 @@ type AuditAnnotation struct { // Adding/removing policies, bindings, or params can not affect whether a // given (policy, binding, param) combination is within its own CEL budget. type ValidatingAdmissionPolicyBinding struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -401,7 +405,7 @@ type ValidatingAdmissionPolicyBinding struct { // ValidatingAdmissionPolicyBindingList is a list of ValidatingAdmissionPolicyBinding. type ValidatingAdmissionPolicyBindingList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -416,7 +420,7 @@ type ValidatingAdmissionPolicyBindingSpec struct { // If the referenced resource does not exist, this binding is considered invalid and will be ignored // Required. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required PolicyName string `json:"policyName,omitempty" protobuf:"bytes,1,rep,name=policyName"` // paramRef specifies the parameter resource used to configure the admission control policy. @@ -475,7 +479,7 @@ type ValidatingAdmissionPolicyBindingSpec struct { // Required. // +listType=set // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required ValidationActions []ValidationAction `json:"validationActions,omitempty" protobuf:"bytes,4,rep,name=validationActions"` } @@ -652,7 +656,7 @@ type NamedRuleWithOperations struct { // +optional ResourceNames []string `json:"resourceNames,omitempty" protobuf:"bytes,1,rep,name=resourceNames"` // RuleWithOperations is a tuple of Operations and Resources. - RuleWithOperations `json:",inline" protobuf:"bytes,2,opt,name=ruleWithOperations"` + RuleWithOperations `json:"" protobuf:"bytes,2,opt,name=ruleWithOperations"` } // RuleWithOperations is a tuple of Operations and Resources. It is recommended to make @@ -679,7 +683,7 @@ const ( // MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain. type MutatingAdmissionPolicy struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -692,7 +696,7 @@ type MutatingAdmissionPolicy struct { // MutatingAdmissionPolicyList is a list of MutatingAdmissionPolicy. type MutatingAdmissionPolicyList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -967,7 +971,7 @@ const ( // Adding/removing policies, bindings, or params can not affect whether a // given (policy, binding, param) combination is within its own CEL budget. type MutatingAdmissionPolicyBinding struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -980,7 +984,7 @@ type MutatingAdmissionPolicyBinding struct { // MutatingAdmissionPolicyBindingList is a list of MutatingAdmissionPolicyBinding. type MutatingAdmissionPolicyBindingList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional diff --git a/vendor/k8s.io/api/admissionregistration/v1beta1/generated.proto b/vendor/k8s.io/api/admissionregistration/v1beta1/generated.proto index 5fcb74f8ba..4654292316 100644 --- a/vendor/k8s.io/api/admissionregistration/v1beta1/generated.proto +++ b/vendor/k8s.io/api/admissionregistration/v1beta1/generated.proto @@ -820,6 +820,7 @@ message TypeChecking { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.28 // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. +// +k8s:supportsSubresource="/status" message ValidatingAdmissionPolicy { // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional @@ -874,7 +875,7 @@ message ValidatingAdmissionPolicyBindingSpec { // If the referenced resource does not exist, this binding is considered invalid and will be ignored // Required. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string policyName = 1; // paramRef specifies the parameter resource used to configure the admission control policy. @@ -933,7 +934,7 @@ message ValidatingAdmissionPolicyBindingSpec { // Required. // +listType=set // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required repeated string validationActions = 4; } @@ -1049,6 +1050,9 @@ message ValidatingAdmissionPolicyStatus { // +optional // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 3; } diff --git a/vendor/k8s.io/api/admissionregistration/v1beta1/types.go b/vendor/k8s.io/api/admissionregistration/v1beta1/types.go index 734a606f4b..1fb6728fc0 100644 --- a/vendor/k8s.io/api/admissionregistration/v1beta1/types.go +++ b/vendor/k8s.io/api/admissionregistration/v1beta1/types.go @@ -93,8 +93,9 @@ const ( // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.28 // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. +// +k8s:supportsSubresource="/status" type ValidatingAdmissionPolicy struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -121,6 +122,9 @@ type ValidatingAdmissionPolicyStatus struct { // +optional // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type Conditions []metav1.Condition `json:"conditions,omitempty" protobuf:"bytes,3,rep,name=conditions"` } @@ -152,7 +156,7 @@ type ExpressionWarning struct { // +k8s:prerelease-lifecycle-gen:introduced=1.28 // ValidatingAdmissionPolicyList is a list of ValidatingAdmissionPolicy. type ValidatingAdmissionPolicyList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -400,7 +404,7 @@ type AuditAnnotation struct { // Adding/removing policies, bindings, or params can not affect whether a // given (policy, binding, param) combination is within its own CEL budget. type ValidatingAdmissionPolicyBinding struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -414,7 +418,7 @@ type ValidatingAdmissionPolicyBinding struct { // ValidatingAdmissionPolicyBindingList is a list of ValidatingAdmissionPolicyBinding. type ValidatingAdmissionPolicyBindingList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -429,7 +433,7 @@ type ValidatingAdmissionPolicyBindingSpec struct { // If the referenced resource does not exist, this binding is considered invalid and will be ignored // Required. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required PolicyName string `json:"policyName,omitempty" protobuf:"bytes,1,rep,name=policyName"` // paramRef specifies the parameter resource used to configure the admission control policy. @@ -488,7 +492,7 @@ type ValidatingAdmissionPolicyBindingSpec struct { // Required. // +listType=set // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required ValidationActions []ValidationAction `json:"validationActions,omitempty" protobuf:"bytes,4,rep,name=validationActions"` } @@ -667,7 +671,7 @@ type NamedRuleWithOperations struct { // +optional ResourceNames []string `json:"resourceNames,omitempty" protobuf:"bytes,1,rep,name=resourceNames"` // RuleWithOperations is a tuple of Operations and Resources. - RuleWithOperations `json:",inline" protobuf:"bytes,2,opt,name=ruleWithOperations"` + RuleWithOperations `json:"" protobuf:"bytes,2,opt,name=ruleWithOperations"` } // +genclient @@ -681,7 +685,7 @@ type NamedRuleWithOperations struct { // ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it. // Deprecated in v1.16, planned for removal in v1.19. Use admissionregistration.k8s.io/v1 ValidatingWebhookConfiguration instead. type ValidatingWebhookConfiguration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -702,7 +706,7 @@ type ValidatingWebhookConfiguration struct { // ValidatingWebhookConfigurationList is a list of ValidatingWebhookConfiguration. type ValidatingWebhookConfigurationList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -722,7 +726,7 @@ type ValidatingWebhookConfigurationList struct { // MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object. // Deprecated in v1.16, planned for removal in v1.19. Use admissionregistration.k8s.io/v1 MutatingWebhookConfiguration instead. type MutatingWebhookConfiguration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -743,7 +747,7 @@ type MutatingWebhookConfiguration struct { // MutatingWebhookConfigurationList is a list of MutatingWebhookConfiguration. type MutatingWebhookConfigurationList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -1213,7 +1217,7 @@ type MatchCondition struct { // MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain. type MutatingAdmissionPolicy struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -1227,7 +1231,7 @@ type MutatingAdmissionPolicy struct { // MutatingAdmissionPolicyList is a list of MutatingAdmissionPolicy. type MutatingAdmissionPolicyList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -1488,7 +1492,7 @@ type JSONPatch struct { // Adding/removing policies, bindings, or params can not affect whether a // given (policy, binding, param) combination is within its own CEL budget. type MutatingAdmissionPolicyBinding struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -1502,7 +1506,7 @@ type MutatingAdmissionPolicyBinding struct { // MutatingAdmissionPolicyBindingList is a list of MutatingAdmissionPolicyBinding. type MutatingAdmissionPolicyBindingList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional diff --git a/vendor/k8s.io/api/apidiscovery/v2/generated.proto b/vendor/k8s.io/api/apidiscovery/v2/generated.proto index 7f58048e17..e42fec4711 100644 --- a/vendor/k8s.io/api/apidiscovery/v2/generated.proto +++ b/vendor/k8s.io/api/apidiscovery/v2/generated.proto @@ -38,12 +38,14 @@ message APIGroupDiscovery { // name is allowed to be "" to represent the legacy, ungroupified resources. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // versions are the versions supported in this group. They are sorted in descending order of preference, // with the preferred version being the first entry. // +listType=map // +listMapKey=version + // +optional repeated APIVersionDiscovery versions = 2; } @@ -58,6 +60,7 @@ message APIGroupDiscoveryList { optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; // items is the list of groups for discovery. The groups are listed in priority order. + // +optional repeated APIGroupDiscovery items = 2; } @@ -67,40 +70,48 @@ message APIResourceDiscovery { // for this resource across all versions in the API group. // Resources with non-empty groups are located at /apis/// // Resources with empty groups are located at /api/v1/ + // +optional optional string resource = 1; // responseKind describes the group, version, and kind of the serialization schema for the object type this endpoint typically returns. // APIs may return other objects types at their discretion, such as error conditions, requests for alternate representations, or other operation specific behavior. // This value will be null or empty if an APIService reports subresources but supports no operations on the parent resource + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.GroupVersionKind responseKind = 2; // scope indicates the scope of a resource, either Cluster or Namespaced + // +optional optional string scope = 3; // singularResource is the singular name of the resource. This allows clients to handle plural and singular opaquely. // For many clients the singular form of the resource will be more understandable to users reading messages and should be used when integrating the name of the resource into a sentence. // The command line tool kubectl, for example, allows use of the singular resource name in place of plurals. // The singular form of a resource should always be an optional element - when in doubt use the canonical resource name. + // +optional optional string singularResource = 4; // verbs is a list of supported API operation types (this includes // but is not limited to get, list, watch, create, update, patch, // delete, deletecollection, and proxy). // +listType=set + // +optional repeated string verbs = 5; // shortNames is a list of suggested short names of the resource. // +listType=set + // +optional repeated string shortNames = 6; // categories is a list of the grouped resources this resource belongs to (e.g. 'all'). // Clients may use this to simplify acting on multiple resource types at once. // +listType=set + // +optional repeated string categories = 7; // subresources is a list of subresources provided by this resource. Subresources are located at /apis////name-of-instance/ // +listType=map // +listMapKey=subresource + // +optional repeated APISubresourceDiscovery subresources = 8; } @@ -108,10 +119,12 @@ message APIResourceDiscovery { message APISubresourceDiscovery { // subresource is the name of the subresource. This is used in the URL path and is the unique identifier // for this resource across all versions. + // +optional optional string subresource = 1; // responseKind describes the group, version, and kind of the serialization schema for the object type this endpoint typically returns. // Some subresources do not return normal resources, these will have null or empty return types. + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.GroupVersionKind responseKind = 2; // acceptedTypes describes the kinds that this endpoint accepts. @@ -122,6 +135,7 @@ message APISubresourceDiscovery { // +listMapKey=group // +listMapKey=version // +listMapKey=kind + // +optional repeated .k8s.io.apimachinery.pkg.apis.meta.v1.GroupVersionKind acceptedTypes = 3; // verbs is a list of supported API operation types (this includes @@ -131,17 +145,20 @@ message APISubresourceDiscovery { // should expect the behavior of standard verbs to align with // Kubernetes interaction conventions. // +listType=set + // +optional repeated string verbs = 4; } // APIVersionDiscovery holds a list of APIResourceDiscovery types that are served for a particular version within an API Group. message APIVersionDiscovery { // version is the name of the version within a group version. + // +optional optional string version = 1; // resources is a list of APIResourceDiscovery objects for the corresponding group version. // +listType=map // +listMapKey=resource + // +optional repeated APIResourceDiscovery resources = 2; // freshness marks whether a group version's discovery document is up to date. @@ -151,6 +168,7 @@ message APIVersionDiscovery { // significantly out of date. Clients that require the latest // version of the discovery information be retrieved before // performing an operation should not use the aggregated document + // +optional optional string freshness = 3; } diff --git a/vendor/k8s.io/api/apidiscovery/v2/types.go b/vendor/k8s.io/api/apidiscovery/v2/types.go index 761bb6990b..5cf6d9c551 100644 --- a/vendor/k8s.io/api/apidiscovery/v2/types.go +++ b/vendor/k8s.io/api/apidiscovery/v2/types.go @@ -28,12 +28,13 @@ import ( // list of API resources (built-ins, Custom Resource Definitions, resources from aggregated servers) // that a cluster supports. type APIGroupDiscoveryList struct { - v1.TypeMeta `json:",inline"` + v1.TypeMeta `json:""` // ResourceVersion will not be set, because this does not have a replayable ordering among multiple apiservers. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional v1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // items is the list of groups for discovery. The groups are listed in priority order. + // +optional Items []APIGroupDiscovery `json:"items" protobuf:"bytes,2,rep,name=items"` } @@ -44,28 +45,32 @@ type APIGroupDiscoveryList struct { // It contains a list of APIVersionDiscovery that holds a list of APIResourceDiscovery types served for a version. // Versions are in descending order of preference, with the first version being the preferred entry. type APIGroupDiscovery struct { - v1.TypeMeta `json:",inline"` + v1.TypeMeta `json:""` // metadata is standard object's metadata. // The only field completed will be name. For instance, resourceVersion will be empty. // name is the name of the API group whose discovery information is presented here. // name is allowed to be "" to represent the legacy, ungroupified resources. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // versions are the versions supported in this group. They are sorted in descending order of preference, // with the preferred version being the first entry. // +listType=map // +listMapKey=version + // +optional Versions []APIVersionDiscovery `json:"versions,omitempty" protobuf:"bytes,2,rep,name=versions"` } // APIVersionDiscovery holds a list of APIResourceDiscovery types that are served for a particular version within an API Group. type APIVersionDiscovery struct { // version is the name of the version within a group version. + // +optional Version string `json:"version" protobuf:"bytes,1,opt,name=version"` // resources is a list of APIResourceDiscovery objects for the corresponding group version. // +listType=map // +listMapKey=resource + // +optional Resources []APIResourceDiscovery `json:"resources,omitempty" protobuf:"bytes,2,rep,name=resources"` // freshness marks whether a group version's discovery document is up to date. // "Current" indicates the discovery document was recently @@ -74,6 +79,7 @@ type APIVersionDiscovery struct { // significantly out of date. Clients that require the latest // version of the discovery information be retrieved before // performing an operation should not use the aggregated document + // +optional Freshness DiscoveryFreshness `json:"freshness,omitempty" protobuf:"bytes,3,opt,name=freshness"` } @@ -83,33 +89,41 @@ type APIResourceDiscovery struct { // for this resource across all versions in the API group. // Resources with non-empty groups are located at /apis/// // Resources with empty groups are located at /api/v1/ + // +optional Resource string `json:"resource" protobuf:"bytes,1,opt,name=resource"` // responseKind describes the group, version, and kind of the serialization schema for the object type this endpoint typically returns. // APIs may return other objects types at their discretion, such as error conditions, requests for alternate representations, or other operation specific behavior. // This value will be null or empty if an APIService reports subresources but supports no operations on the parent resource + // +optional ResponseKind *v1.GroupVersionKind `json:"responseKind,omitempty" protobuf:"bytes,2,opt,name=responseKind"` // scope indicates the scope of a resource, either Cluster or Namespaced + // +optional Scope ResourceScope `json:"scope" protobuf:"bytes,3,opt,name=scope"` // singularResource is the singular name of the resource. This allows clients to handle plural and singular opaquely. // For many clients the singular form of the resource will be more understandable to users reading messages and should be used when integrating the name of the resource into a sentence. // The command line tool kubectl, for example, allows use of the singular resource name in place of plurals. // The singular form of a resource should always be an optional element - when in doubt use the canonical resource name. + // +optional SingularResource string `json:"singularResource" protobuf:"bytes,4,opt,name=singularResource"` // verbs is a list of supported API operation types (this includes // but is not limited to get, list, watch, create, update, patch, // delete, deletecollection, and proxy). // +listType=set + // +optional Verbs []string `json:"verbs" protobuf:"bytes,5,opt,name=verbs"` // shortNames is a list of suggested short names of the resource. // +listType=set + // +optional ShortNames []string `json:"shortNames,omitempty" protobuf:"bytes,6,rep,name=shortNames"` // categories is a list of the grouped resources this resource belongs to (e.g. 'all'). // Clients may use this to simplify acting on multiple resource types at once. // +listType=set + // +optional Categories []string `json:"categories,omitempty" protobuf:"bytes,7,rep,name=categories"` // subresources is a list of subresources provided by this resource. Subresources are located at /apis////name-of-instance/ // +listType=map // +listMapKey=subresource + // +optional Subresources []APISubresourceDiscovery `json:"subresources,omitempty" protobuf:"bytes,8,rep,name=subresources"` } @@ -133,9 +147,11 @@ const ( type APISubresourceDiscovery struct { // subresource is the name of the subresource. This is used in the URL path and is the unique identifier // for this resource across all versions. + // +optional Subresource string `json:"subresource" protobuf:"bytes,1,opt,name=subresource"` // responseKind describes the group, version, and kind of the serialization schema for the object type this endpoint typically returns. // Some subresources do not return normal resources, these will have null or empty return types. + // +optional ResponseKind *v1.GroupVersionKind `json:"responseKind,omitempty" protobuf:"bytes,2,opt,name=responseKind"` // acceptedTypes describes the kinds that this endpoint accepts. // Subresources may accept the standard content types or define @@ -145,6 +161,7 @@ type APISubresourceDiscovery struct { // +listMapKey=group // +listMapKey=version // +listMapKey=kind + // +optional AcceptedTypes []v1.GroupVersionKind `json:"acceptedTypes,omitempty" protobuf:"bytes,3,rep,name=acceptedTypes"` // verbs is a list of supported API operation types (this includes // but is not limited to get, list, watch, create, update, patch, @@ -153,5 +170,6 @@ type APISubresourceDiscovery struct { // should expect the behavior of standard verbs to align with // Kubernetes interaction conventions. // +listType=set + // +optional Verbs []string `json:"verbs" protobuf:"bytes,4,opt,name=verbs"` } diff --git a/vendor/k8s.io/api/apidiscovery/v2beta1/generated.proto b/vendor/k8s.io/api/apidiscovery/v2beta1/generated.proto index f81449e6a9..a02b437939 100644 --- a/vendor/k8s.io/api/apidiscovery/v2beta1/generated.proto +++ b/vendor/k8s.io/api/apidiscovery/v2beta1/generated.proto @@ -38,12 +38,14 @@ message APIGroupDiscovery { // name is allowed to be "" to represent the legacy, ungroupified resources. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // versions are the versions supported in this group. They are sorted in descending order of preference, // with the preferred version being the first entry. // +listType=map // +listMapKey=version + // +optional repeated APIVersionDiscovery versions = 2; } @@ -58,6 +60,7 @@ message APIGroupDiscoveryList { optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; // items is the list of groups for discovery. The groups are listed in priority order. + // +optional repeated APIGroupDiscovery items = 2; } @@ -67,40 +70,48 @@ message APIResourceDiscovery { // for this resource across all versions in the API group. // Resources with non-empty groups are located at /apis/// // Resources with empty groups are located at /api/v1/ + // +optional optional string resource = 1; // responseKind describes the group, version, and kind of the serialization schema for the object type this endpoint typically returns. // APIs may return other objects types at their discretion, such as error conditions, requests for alternate representations, or other operation specific behavior. // This value will be null or empty if an APIService reports subresources but supports no operations on the parent resource + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.GroupVersionKind responseKind = 2; // scope indicates the scope of a resource, either Cluster or Namespaced + // +optional optional string scope = 3; // singularResource is the singular name of the resource. This allows clients to handle plural and singular opaquely. // For many clients the singular form of the resource will be more understandable to users reading messages and should be used when integrating the name of the resource into a sentence. // The command line tool kubectl, for example, allows use of the singular resource name in place of plurals. // The singular form of a resource should always be an optional element - when in doubt use the canonical resource name. + // +optional optional string singularResource = 4; // verbs is a list of supported API operation types (this includes // but is not limited to get, list, watch, create, update, patch, // delete, deletecollection, and proxy). // +listType=set + // +optional repeated string verbs = 5; // shortNames is a list of suggested short names of the resource. // +listType=set + // +optional repeated string shortNames = 6; // categories is a list of the grouped resources this resource belongs to (e.g. 'all'). // Clients may use this to simplify acting on multiple resource types at once. // +listType=set + // +optional repeated string categories = 7; // subresources is a list of subresources provided by this resource. Subresources are located at /apis////name-of-instance/ // +listType=map // +listMapKey=subresource + // +optional repeated APISubresourceDiscovery subresources = 8; } @@ -108,10 +119,12 @@ message APIResourceDiscovery { message APISubresourceDiscovery { // subresource is the name of the subresource. This is used in the URL path and is the unique identifier // for this resource across all versions. + // +optional optional string subresource = 1; // responseKind describes the group, version, and kind of the serialization schema for the object type this endpoint typically returns. // Some subresources do not return normal resources, these will have null or empty return types. + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.GroupVersionKind responseKind = 2; // acceptedTypes describes the kinds that this endpoint accepts. @@ -122,6 +135,7 @@ message APISubresourceDiscovery { // +listMapKey=group // +listMapKey=version // +listMapKey=kind + // +optional repeated .k8s.io.apimachinery.pkg.apis.meta.v1.GroupVersionKind acceptedTypes = 3; // verbs is a list of supported API operation types (this includes @@ -131,17 +145,20 @@ message APISubresourceDiscovery { // should expect the behavior of standard verbs to align with // Kubernetes interaction conventions. // +listType=set + // +optional repeated string verbs = 4; } // APIVersionDiscovery holds a list of APIResourceDiscovery types that are served for a particular version within an API Group. message APIVersionDiscovery { // version is the name of the version within a group version. + // +optional optional string version = 1; // resources is a list of APIResourceDiscovery objects for the corresponding group version. // +listType=map // +listMapKey=resource + // +optional repeated APIResourceDiscovery resources = 2; // freshness marks whether a group version's discovery document is up to date. @@ -151,6 +168,7 @@ message APIVersionDiscovery { // significantly out of date. Clients that require the latest // version of the discovery information be retrieved before // performing an operation should not use the aggregated document + // +optional optional string freshness = 3; } diff --git a/vendor/k8s.io/api/apidiscovery/v2beta1/types.go b/vendor/k8s.io/api/apidiscovery/v2beta1/types.go index 306264da4d..b2050955a3 100644 --- a/vendor/k8s.io/api/apidiscovery/v2beta1/types.go +++ b/vendor/k8s.io/api/apidiscovery/v2beta1/types.go @@ -31,12 +31,13 @@ import ( // list of API resources (built-ins, Custom Resource Definitions, resources from aggregated servers) // that a cluster supports. type APIGroupDiscoveryList struct { - v1.TypeMeta `json:",inline"` + v1.TypeMeta `json:""` // ResourceVersion will not be set, because this does not have a replayable ordering among multiple apiservers. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional v1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // items is the list of groups for discovery. The groups are listed in priority order. + // +optional Items []APIGroupDiscovery `json:"items" protobuf:"bytes,2,rep,name=items"` } @@ -50,28 +51,32 @@ type APIGroupDiscoveryList struct { // It contains a list of APIVersionDiscovery that holds a list of APIResourceDiscovery types served for a version. // Versions are in descending order of preference, with the first version being the preferred entry. type APIGroupDiscovery struct { - v1.TypeMeta `json:",inline"` + v1.TypeMeta `json:""` // metadata is standard object's metadata. // The only field completed will be name. For instance, resourceVersion will be empty. // name is the name of the API group whose discovery information is presented here. // name is allowed to be "" to represent the legacy, ungroupified resources. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // versions are the versions supported in this group. They are sorted in descending order of preference, // with the preferred version being the first entry. // +listType=map // +listMapKey=version + // +optional Versions []APIVersionDiscovery `json:"versions,omitempty" protobuf:"bytes,2,rep,name=versions"` } // APIVersionDiscovery holds a list of APIResourceDiscovery types that are served for a particular version within an API Group. type APIVersionDiscovery struct { // version is the name of the version within a group version. + // +optional Version string `json:"version" protobuf:"bytes,1,opt,name=version"` // resources is a list of APIResourceDiscovery objects for the corresponding group version. // +listType=map // +listMapKey=resource + // +optional Resources []APIResourceDiscovery `json:"resources,omitempty" protobuf:"bytes,2,rep,name=resources"` // freshness marks whether a group version's discovery document is up to date. // "Current" indicates the discovery document was recently @@ -80,6 +85,7 @@ type APIVersionDiscovery struct { // significantly out of date. Clients that require the latest // version of the discovery information be retrieved before // performing an operation should not use the aggregated document + // +optional Freshness DiscoveryFreshness `json:"freshness,omitempty" protobuf:"bytes,3,opt,name=freshness"` } @@ -89,33 +95,41 @@ type APIResourceDiscovery struct { // for this resource across all versions in the API group. // Resources with non-empty groups are located at /apis/// // Resources with empty groups are located at /api/v1/ + // +optional Resource string `json:"resource" protobuf:"bytes,1,opt,name=resource"` // responseKind describes the group, version, and kind of the serialization schema for the object type this endpoint typically returns. // APIs may return other objects types at their discretion, such as error conditions, requests for alternate representations, or other operation specific behavior. // This value will be null or empty if an APIService reports subresources but supports no operations on the parent resource + // +optional ResponseKind *v1.GroupVersionKind `json:"responseKind,omitempty" protobuf:"bytes,2,opt,name=responseKind"` // scope indicates the scope of a resource, either Cluster or Namespaced + // +optional Scope ResourceScope `json:"scope" protobuf:"bytes,3,opt,name=scope"` // singularResource is the singular name of the resource. This allows clients to handle plural and singular opaquely. // For many clients the singular form of the resource will be more understandable to users reading messages and should be used when integrating the name of the resource into a sentence. // The command line tool kubectl, for example, allows use of the singular resource name in place of plurals. // The singular form of a resource should always be an optional element - when in doubt use the canonical resource name. + // +optional SingularResource string `json:"singularResource" protobuf:"bytes,4,opt,name=singularResource"` // verbs is a list of supported API operation types (this includes // but is not limited to get, list, watch, create, update, patch, // delete, deletecollection, and proxy). // +listType=set + // +optional Verbs []string `json:"verbs" protobuf:"bytes,5,opt,name=verbs"` // shortNames is a list of suggested short names of the resource. // +listType=set + // +optional ShortNames []string `json:"shortNames,omitempty" protobuf:"bytes,6,rep,name=shortNames"` // categories is a list of the grouped resources this resource belongs to (e.g. 'all'). // Clients may use this to simplify acting on multiple resource types at once. // +listType=set + // +optional Categories []string `json:"categories,omitempty" protobuf:"bytes,7,rep,name=categories"` // subresources is a list of subresources provided by this resource. Subresources are located at /apis////name-of-instance/ // +listType=map // +listMapKey=subresource + // +optional Subresources []APISubresourceDiscovery `json:"subresources,omitempty" protobuf:"bytes,8,rep,name=subresources"` } @@ -139,9 +153,11 @@ const ( type APISubresourceDiscovery struct { // subresource is the name of the subresource. This is used in the URL path and is the unique identifier // for this resource across all versions. + // +optional Subresource string `json:"subresource" protobuf:"bytes,1,opt,name=subresource"` // responseKind describes the group, version, and kind of the serialization schema for the object type this endpoint typically returns. // Some subresources do not return normal resources, these will have null or empty return types. + // +optional ResponseKind *v1.GroupVersionKind `json:"responseKind,omitempty" protobuf:"bytes,2,opt,name=responseKind"` // acceptedTypes describes the kinds that this endpoint accepts. // Subresources may accept the standard content types or define @@ -151,6 +167,7 @@ type APISubresourceDiscovery struct { // +listMapKey=group // +listMapKey=version // +listMapKey=kind + // +optional AcceptedTypes []v1.GroupVersionKind `json:"acceptedTypes,omitempty" protobuf:"bytes,3,rep,name=acceptedTypes"` // verbs is a list of supported API operation types (this includes // but is not limited to get, list, watch, create, update, patch, @@ -159,5 +176,6 @@ type APISubresourceDiscovery struct { // should expect the behavior of standard verbs to align with // Kubernetes interaction conventions. // +listType=set + // +optional Verbs []string `json:"verbs" protobuf:"bytes,4,opt,name=verbs"` } diff --git a/vendor/k8s.io/api/apiserverinternal/v1alpha1/generated.proto b/vendor/k8s.io/api/apiserverinternal/v1alpha1/generated.proto index e8f8c339df..73f007a651 100644 --- a/vendor/k8s.io/api/apiserverinternal/v1alpha1/generated.proto +++ b/vendor/k8s.io/api/apiserverinternal/v1alpha1/generated.proto @@ -55,6 +55,7 @@ message ServerStorageVersion { } // Storage version of a specific resource. +// +k8s:supportsSubresource="/status" message StorageVersion { // metadata is the standard object metadata. // The name is .. diff --git a/vendor/k8s.io/api/apiserverinternal/v1alpha1/types.go b/vendor/k8s.io/api/apiserverinternal/v1alpha1/types.go index 69c21fd3c4..f30cc53813 100644 --- a/vendor/k8s.io/api/apiserverinternal/v1alpha1/types.go +++ b/vendor/k8s.io/api/apiserverinternal/v1alpha1/types.go @@ -25,8 +25,9 @@ import ( // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // Storage version of a specific resource. +// +k8s:supportsSubresource="/status" type StorageVersion struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object metadata. // The name is .. // +required @@ -135,7 +136,7 @@ type StorageVersionCondition struct { // A list of StorageVersions. type StorageVersionList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional diff --git a/vendor/k8s.io/api/apps/v1/generated.proto b/vendor/k8s.io/api/apps/v1/generated.proto index 42d5415c2f..0c55e2ebce 100644 --- a/vendor/k8s.io/api/apps/v1/generated.proto +++ b/vendor/k8s.io/api/apps/v1/generated.proto @@ -46,9 +46,11 @@ message ControllerRevision { optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Data is the serialized representation of the state. + // +required optional .k8s.io.apimachinery.pkg.runtime.RawExtension data = 2; // Revision indicates the revision of the state represented by Data. + // +optional optional int64 revision = 3; } @@ -63,6 +65,7 @@ message ControllerRevisionList { } // DaemonSet represents the configuration of a daemon set. +// +k8s:supportsSubresource="/status" message DaemonSet { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -71,7 +74,7 @@ message DaemonSet { // The desired behavior of this daemon set. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required optional DaemonSetSpec spec = 2; // The current status of this daemon set. This data may be @@ -86,9 +89,11 @@ message DaemonSet { // DaemonSetCondition describes the state of a DaemonSet at a certain point. message DaemonSetCondition { // Type of DaemonSet condition. + // +optional optional string type = 1; // Status of the condition, one of True, False, Unknown. + // +optional optional string status = 2; // Last time the condition transitioned from one status to another. @@ -121,6 +126,7 @@ message DaemonSetSpec { // Must match in order to be controlled. // It must match the pod template's labels. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + // +required optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 1; // An object that describes the pod that will be created. @@ -129,6 +135,7 @@ message DaemonSetSpec { // selector is specified). // The only allowed template.spec.restartPolicy value is "Always". // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template + // +required optional .k8s.io.api.core.v1.PodTemplateSpec template = 2; // An update strategy to replace existing DaemonSet pods with new pods. @@ -221,6 +228,8 @@ message DaemonSetUpdateStrategy { } // Deployment enables declarative updates for Pods and ReplicaSets. +// +k8s:supportsSubresource="/scale" +// +k8s:supportsSubresource="/status" message Deployment { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -228,7 +237,7 @@ message Deployment { optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Specification of the desired behavior of the Deployment. - // +optional + // +required optional DeploymentSpec spec = 2; // Most recently observed status of the Deployment. @@ -239,21 +248,27 @@ message Deployment { // DeploymentCondition describes the state of a deployment at a certain point. message DeploymentCondition { // Type of deployment condition. + // +optional optional string type = 1; // Status of the condition, one of True, False, Unknown. + // +optional optional string status = 2; // The last time this condition was updated. + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastUpdateTime = 6; // Last time the condition transitioned from one status to another. + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 7; // The reason for the condition's last transition. + // +optional optional string reason = 4; // A human readable message indicating details about the transition. + // +optional optional string message = 5; } @@ -277,10 +292,12 @@ message DeploymentSpec { // Label selector for pods. Existing ReplicaSets whose pods are // selected by this will be the ones affected by this deployment. // It must match the pod template's labels. + // +required optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2; // Template describes the pods that will be created. // The only allowed template.spec.restartPolicy value is "Always". + // +required optional .k8s.io.api.core.v1.PodTemplateSpec template = 3; // The deployment strategy to use to replace existing pods with new ones. @@ -309,6 +326,7 @@ message DeploymentSpec { // process failed deployments and a condition with a ProgressDeadlineExceeded // reason will be surfaced in the deployment status. Note that progress will // not be estimated during the time a deployment is paused. Defaults to 600s. + // +optional optional int32 progressDeadlineSeconds = 9; } @@ -377,6 +395,8 @@ message DeploymentStrategy { } // ReplicaSet ensures that a specified number of pod replicas are running at any given time. +// +k8s:supportsSubresource="/scale" +// +k8s:supportsSubresource="/status" message ReplicaSet { // If the Labels of a ReplicaSet are empty, they are defaulted to // be the same as the Pod(s) that the ReplicaSet manages. @@ -387,7 +407,7 @@ message ReplicaSet { // Spec defines the specification of the desired behavior of the ReplicaSet. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required optional ReplicaSetSpec spec = 2; // Status is the most recently observed status of the ReplicaSet. @@ -402,9 +422,11 @@ message ReplicaSet { // ReplicaSetCondition describes the state of a replica set at a certain point. message ReplicaSetCondition { // Type of replica set condition. + // +optional optional string type = 1; // Status of the condition, one of True, False, Unknown. + // +optional optional string status = 2; // The last time the condition transitioned from one status to another. @@ -451,6 +473,7 @@ message ReplicaSetSpec { // Label keys and values that must match in order to be controlled by this replica set. // It must match the pod template's labels. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + // +required optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2; // Template is the object that describes the pod that will be created if @@ -598,6 +621,8 @@ message RollingUpdateStatefulSetStrategy { // // The StatefulSet guarantees that a given network identity will always // map to the same storage identity. +// +k8s:supportsSubresource="/scale" +// +k8s:supportsSubresource="/status" message StatefulSet { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -605,7 +630,7 @@ message StatefulSet { optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Spec defines the desired identities of pods in this set. - // +optional + // +required optional StatefulSetSpec spec = 2; // Status is the current status of Pods in this StatefulSet. This data @@ -617,9 +642,11 @@ message StatefulSet { // StatefulSetCondition describes the state of a statefulset at a certain point. message StatefulSetCondition { // Type of statefulset condition. + // +optional optional string type = 1; // Status of the condition, one of True, False, Unknown. + // +optional optional string status = 2; // Last time the condition transitioned from one status to another. @@ -668,6 +695,7 @@ message StatefulSetPersistentVolumeClaimRetentionPolicy { // VolumeClaimTemplates when the StatefulSet is deleted. The default policy // of `Retain` causes PVCs to not be affected by StatefulSet deletion. The // `Delete` policy causes those PVCs to be deleted. + // +optional optional string whenDeleted = 1; // WhenScaled specifies what happens to PVCs created from StatefulSet @@ -675,6 +703,7 @@ message StatefulSetPersistentVolumeClaimRetentionPolicy { // policy of `Retain` causes PVCs to not be affected by a scaledown. The // `Delete` policy causes the associated PVCs for any excess pods above // the replica count to be deleted. + // +optional optional string whenScaled = 2; } @@ -691,6 +720,9 @@ message StatefulSetSpec { // selector is a label query over pods that should match the replica count. // It must match the pod template's labels. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + // +required + // +k8s:alpha(since: "1.37")=+k8s:required + // +k8s:alpha(since: "1.37")=+k8s:immutable optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2; // template is the object that describes the pod that will be created if @@ -700,6 +732,7 @@ message StatefulSetSpec { // -. For example, a pod in a StatefulSet named // "web" with index number "3" would be named "web-3". // The only allowed template.spec.restartPolicy value is "Always". + // +required optional .k8s.io.api.core.v1.PodTemplateSpec template = 3; // volumeClaimTemplates is a list of claims that pods are allowed to reference. @@ -710,6 +743,9 @@ message StatefulSetSpec { // any volumes in the template, with the same name. // TODO: Define the behavior if a claim already exists with the same name. // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:opaqueType // +listType=atomic repeated .k8s.io.api.core.v1.PersistentVolumeClaim volumeClaimTemplates = 4; @@ -719,6 +755,8 @@ message StatefulSetSpec { // pattern: pod-specific-string.serviceName.default.svc.cluster.local // where "pod-specific-string" is managed by the StatefulSet controller. // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable + // +k8s:alpha(since: "1.37")=+k8s:optional optional string serviceName = 5; // podManagementPolicy controls how pods are created during initial scale up, @@ -730,17 +768,21 @@ message StatefulSetSpec { // to match the desired scale without waiting, and on scale down will delete // all pods at once. // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable + // +k8s:alpha(since: "1.37")=+k8s:optional optional string podManagementPolicy = 6; // updateStrategy indicates the StatefulSetUpdateStrategy that will be // employed to update Pods in the StatefulSet when a revision is made to // Template. + // +optional optional StatefulSetUpdateStrategy updateStrategy = 7; // revisionHistoryLimit is the maximum number of revisions that will // be maintained in the StatefulSet's revision history. The revision history // consists of all revisions not represented by a currently applied // StatefulSetSpec version. The default value is 10. + // +optional optional int32 revisionHistoryLimit = 8; // Minimum number of seconds for which a newly created pod should be ready diff --git a/vendor/k8s.io/api/apps/v1/types.go b/vendor/k8s.io/api/apps/v1/types.go index b8989c1406..c43afb8819 100644 --- a/vendor/k8s.io/api/apps/v1/types.go +++ b/vendor/k8s.io/api/apps/v1/types.go @@ -46,15 +46,17 @@ const ( // // The StatefulSet guarantees that a given network identity will always // map to the same storage identity. +// +k8s:supportsSubresource="/scale" +// +k8s:supportsSubresource="/status" type StatefulSet struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec defines the desired identities of pods in this set. - // +optional + // +required Spec StatefulSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // Status is the current status of Pods in this StatefulSet. This data @@ -104,12 +106,22 @@ const ( // strategy, new Pods will be created from the specification version indicated // by the StatefulSet's updateRevision. RollingUpdateStatefulSetStrategyType StatefulSetUpdateStrategyType = "RollingUpdate" - // OnDeleteStatefulSetStrategyType triggers the legacy behavior. Version - // tracking and ordered rolling restarts are disabled. Pods are recreated - // from the StatefulSetSpec when they are manually deleted. When a scale - // operation is performed with this strategy,specification version indicated - // by the StatefulSet's currentRevision. + // OnDeleteStatefulSetStrategyType disables ordered rolling restarts. Version + // tracking is done on a best-effort basis - the controller will try to + // eventually converge StatefulSet's currentRevision with updateRevision. + // Pods are recreated from the StatefulSetSpec when they are manually deleted. + // When a scale operation is performed with this strategy, new Pods will be + // created from the specification version indicated by the StatefulSet's updateRevision. OnDeleteStatefulSetStrategyType StatefulSetUpdateStrategyType = "OnDelete" + // RecreateStatefulSetStrategyType indicates that all existing pods will be + // deleted and fully terminated before any new-revision pods are created. + // This ensures that old and new revision Pods never run at the same time. + // This is an alpha type and requires enabling StatefulSetRecreateStrategy feature gate. + // Switching to the Recreate strategy is allowed when the feature gate is enabled, + // and switching away from it to a different update strategy is also allowed. + // + // +featureGate=StatefulSetRecreateStrategy + RecreateStatefulSetStrategyType StatefulSetUpdateStrategyType = "Recreate" ) // RollingUpdateStatefulSetStrategy is used to communicate parameter for RollingUpdateStatefulSetStrategyType. @@ -158,12 +170,14 @@ type StatefulSetPersistentVolumeClaimRetentionPolicy struct { // VolumeClaimTemplates when the StatefulSet is deleted. The default policy // of `Retain` causes PVCs to not be affected by StatefulSet deletion. The // `Delete` policy causes those PVCs to be deleted. + // +optional WhenDeleted PersistentVolumeClaimRetentionPolicyType `json:"whenDeleted,omitempty" protobuf:"bytes,1,opt,name=whenDeleted,casttype=PersistentVolumeClaimRetentionPolicyType"` // WhenScaled specifies what happens to PVCs created from StatefulSet // VolumeClaimTemplates when the StatefulSet is scaled down. The default // policy of `Retain` causes PVCs to not be affected by a scaledown. The // `Delete` policy causes the associated PVCs for any excess pods above // the replica count to be deleted. + // +optional WhenScaled PersistentVolumeClaimRetentionPolicyType `json:"whenScaled,omitempty" protobuf:"bytes,2,opt,name=whenScaled,casttype=PersistentVolumeClaimRetentionPolicyType"` } @@ -195,6 +209,9 @@ type StatefulSetSpec struct { // selector is a label query over pods that should match the replica count. // It must match the pod template's labels. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + // +required + // +k8s:alpha(since: "1.37")=+k8s:required + // +k8s:alpha(since: "1.37")=+k8s:immutable Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,2,opt,name=selector"` // template is the object that describes the pod that will be created if @@ -204,6 +221,7 @@ type StatefulSetSpec struct { // -. For example, a pod in a StatefulSet named // "web" with index number "3" would be named "web-3". // The only allowed template.spec.restartPolicy value is "Always". + // +required Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"` // volumeClaimTemplates is a list of claims that pods are allowed to reference. @@ -214,6 +232,9 @@ type StatefulSetSpec struct { // any volumes in the template, with the same name. // TODO: Define the behavior if a claim already exists with the same name. // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:opaqueType // +listType=atomic VolumeClaimTemplates []v1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty" protobuf:"bytes,4,rep,name=volumeClaimTemplates"` @@ -223,6 +244,8 @@ type StatefulSetSpec struct { // pattern: pod-specific-string.serviceName.default.svc.cluster.local // where "pod-specific-string" is managed by the StatefulSet controller. // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable + // +k8s:alpha(since: "1.37")=+k8s:optional ServiceName string `json:"serviceName" protobuf:"bytes,5,opt,name=serviceName"` // podManagementPolicy controls how pods are created during initial scale up, @@ -234,17 +257,21 @@ type StatefulSetSpec struct { // to match the desired scale without waiting, and on scale down will delete // all pods at once. // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable + // +k8s:alpha(since: "1.37")=+k8s:optional PodManagementPolicy PodManagementPolicyType `json:"podManagementPolicy,omitempty" protobuf:"bytes,6,opt,name=podManagementPolicy,casttype=PodManagementPolicyType"` // updateStrategy indicates the StatefulSetUpdateStrategy that will be // employed to update Pods in the StatefulSet when a revision is made to // Template. + // +optional UpdateStrategy StatefulSetUpdateStrategy `json:"updateStrategy,omitempty" protobuf:"bytes,7,opt,name=updateStrategy"` // revisionHistoryLimit is the maximum number of revisions that will // be maintained in the StatefulSet's revision history. The revision history // consists of all revisions not represented by a currently applied // StatefulSetSpec version. The default value is 10. + // +optional RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,8,opt,name=revisionHistoryLimit"` // Minimum number of seconds for which a newly created pod should be ready @@ -319,11 +346,19 @@ type StatefulSetStatus struct { type StatefulSetConditionType string +const ( + // StatefulSetProgressing means the StatefulSet is progressing through an update. + // This condition is an alpha type and requires enabling StatefulSetRecreateStrategy feature gate. + StatefulSetProgressing StatefulSetConditionType = "Progressing" +) + // StatefulSetCondition describes the state of a statefulset at a certain point. type StatefulSetCondition struct { // Type of statefulset condition. + // +optional Type StatefulSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=StatefulSetConditionType"` // Status of the condition, one of True, False, Unknown. + // +optional Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"` // Last time the condition transitioned from one status to another. // +optional @@ -341,7 +376,7 @@ type StatefulSetCondition struct { // StatefulSetList is a collection of StatefulSets. type StatefulSetList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -359,15 +394,17 @@ type StatefulSetList struct { // +k8s:prerelease-lifecycle-gen:introduced=1.9 // Deployment enables declarative updates for Pods and ReplicaSets. +// +k8s:supportsSubresource="/scale" +// +k8s:supportsSubresource="/status" type Deployment struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Specification of the desired behavior of the Deployment. - // +optional + // +required Spec DeploymentSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // Most recently observed status of the Deployment. @@ -385,10 +422,12 @@ type DeploymentSpec struct { // Label selector for pods. Existing ReplicaSets whose pods are // selected by this will be the ones affected by this deployment. // It must match the pod template's labels. + // +required Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,2,opt,name=selector"` // Template describes the pods that will be created. // The only allowed template.spec.restartPolicy value is "Always". + // +required Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"` // The deployment strategy to use to replace existing pods with new ones. @@ -417,6 +456,7 @@ type DeploymentSpec struct { // process failed deployments and a condition with a ProgressDeadlineExceeded // reason will be surfaced in the deployment status. Note that progress will // not be estimated during the time a deployment is paused. Defaults to 600s. + // +optional ProgressDeadlineSeconds *int32 `json:"progressDeadlineSeconds,omitempty" protobuf:"varint,9,opt,name=progressDeadlineSeconds"` } @@ -552,16 +592,22 @@ const ( // DeploymentCondition describes the state of a deployment at a certain point. type DeploymentCondition struct { // Type of deployment condition. + // +optional Type DeploymentConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=DeploymentConditionType"` // Status of the condition, one of True, False, Unknown. + // +optional Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"` // The last time this condition was updated. + // +optional LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty" protobuf:"bytes,6,opt,name=lastUpdateTime"` // Last time the condition transitioned from one status to another. + // +optional LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,7,opt,name=lastTransitionTime"` // The reason for the condition's last transition. + // +optional Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` // A human readable message indicating details about the transition. + // +optional Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` } @@ -570,7 +616,7 @@ type DeploymentCondition struct { // DeploymentList is a list of Deployments. type DeploymentList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -652,6 +698,7 @@ type DaemonSetSpec struct { // Must match in order to be controlled. // It must match the pod template's labels. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + // +required Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,1,opt,name=selector"` // An object that describes the pod that will be created. @@ -660,6 +707,7 @@ type DaemonSetSpec struct { // selector is specified). // The only allowed template.spec.restartPolicy value is "Always". // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template + // +required Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,2,opt,name=template"` // An update strategy to replace existing DaemonSet pods with new pods. @@ -743,8 +791,10 @@ type DaemonSetConditionType string // DaemonSetCondition describes the state of a DaemonSet at a certain point. type DaemonSetCondition struct { // Type of DaemonSet condition. + // +optional Type DaemonSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=DaemonSetConditionType"` // Status of the condition, one of True, False, Unknown. + // +optional Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"` // Last time the condition transitioned from one status to another. // +optional @@ -762,8 +812,9 @@ type DaemonSetCondition struct { // +k8s:prerelease-lifecycle-gen:introduced=1.9 // DaemonSet represents the configuration of a daemon set. +// +k8s:supportsSubresource="/status" type DaemonSet struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -771,7 +822,7 @@ type DaemonSet struct { // The desired behavior of this daemon set. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required Spec DaemonSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // The current status of this daemon set. This data may be @@ -795,7 +846,7 @@ const ( // DaemonSetList is a collection of daemon sets. type DaemonSetList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -813,8 +864,10 @@ type DaemonSetList struct { // +k8s:prerelease-lifecycle-gen:introduced=1.9 // ReplicaSet ensures that a specified number of pod replicas are running at any given time. +// +k8s:supportsSubresource="/scale" +// +k8s:supportsSubresource="/status" type ReplicaSet struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // If the Labels of a ReplicaSet are empty, they are defaulted to // be the same as the Pod(s) that the ReplicaSet manages. @@ -825,7 +878,7 @@ type ReplicaSet struct { // Spec defines the specification of the desired behavior of the ReplicaSet. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required Spec ReplicaSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // Status is the most recently observed status of the ReplicaSet. @@ -842,7 +895,7 @@ type ReplicaSet struct { // ReplicaSetList is a collection of ReplicaSets. type ReplicaSetList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -872,6 +925,7 @@ type ReplicaSetSpec struct { // Label keys and values that must match in order to be controlled by this replica set. // It must match the pod template's labels. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + // +required Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,2,opt,name=selector"` // Template is the object that describes the pod that will be created if @@ -932,8 +986,10 @@ const ( // ReplicaSetCondition describes the state of a replica set at a certain point. type ReplicaSetCondition struct { // Type of replica set condition. + // +optional Type ReplicaSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=ReplicaSetConditionType"` // Status of the condition, one of True, False, Unknown. + // +optional Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"` // The last time the condition transitioned from one status to another. // +optional @@ -960,16 +1016,18 @@ type ReplicaSetCondition struct { // it may be subject to name and representation changes in future releases, and clients should not // depend on its stability. It is primarily for internal use by controllers. type ControllerRevision struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Data is the serialized representation of the state. - Data runtime.RawExtension `json:"data,omitempty" protobuf:"bytes,2,opt,name=data"` + // +required + Data runtime.RawExtension `json:"data" protobuf:"bytes,2,opt,name=data"` // Revision indicates the revision of the state represented by Data. + // +optional Revision int64 `json:"revision" protobuf:"varint,3,opt,name=revision"` } @@ -978,7 +1036,7 @@ type ControllerRevision struct { // ControllerRevisionList is a resource containing a list of ControllerRevision objects. type ControllerRevisionList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional diff --git a/vendor/k8s.io/api/apps/v1beta1/generated.proto b/vendor/k8s.io/api/apps/v1beta1/generated.proto index c6f0628e0c..9d23883347 100644 --- a/vendor/k8s.io/api/apps/v1beta1/generated.proto +++ b/vendor/k8s.io/api/apps/v1beta1/generated.proto @@ -48,9 +48,11 @@ message ControllerRevision { optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // data is the serialized representation of the state. + // +required optional .k8s.io.apimachinery.pkg.runtime.RawExtension data = 2; // revision indicates the revision of the state represented by Data. + // +optional optional int64 revision = 3; } @@ -67,13 +69,15 @@ message ControllerRevisionList { // DEPRECATED - This group version of Deployment is deprecated by apps/v1beta2/Deployment. See the release notes for // more information. // Deployment enables declarative updates for Pods and ReplicaSets. +// +k8s:supportsSubresource="/scale" +// +k8s:supportsSubresource="/status" message Deployment { // Standard object metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Specification of the desired behavior of the Deployment. - // +optional + // +required optional DeploymentSpec spec = 2; // Most recently observed status of the Deployment. @@ -84,21 +88,27 @@ message Deployment { // DeploymentCondition describes the state of a deployment at a certain point. message DeploymentCondition { // Type of deployment condition. + // +optional optional string type = 1; // Status of the condition, one of True, False, Unknown. + // +optional optional string status = 2; // The last time this condition was updated. + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastUpdateTime = 6; // Last time the condition transitioned from one status to another. + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 7; // The reason for the condition's last transition. + // +optional optional string reason = 4; // A human readable message indicating details about the transition. + // +optional optional string message = 5; } @@ -116,6 +126,7 @@ message DeploymentList { // DeploymentRollback stores the information required to rollback a deployment. message DeploymentRollback { // Required: This must match the Name of a deployment. + // +required optional string name = 1; // The annotations to be updated to a deployment @@ -123,6 +134,7 @@ message DeploymentRollback { map updatedAnnotations = 2; // The config of this deployment rollback. + // +optional optional RollbackConfig rollbackTo = 3; } @@ -140,6 +152,7 @@ message DeploymentSpec { // Template describes the pods that will be created. // The only allowed template.spec.restartPolicy value is "Always". + // +required optional .k8s.io.api.core.v1.PodTemplateSpec template = 3; // The deployment strategy to use to replace existing pods with new ones. @@ -284,6 +297,7 @@ message RollingUpdateStatefulSetStrategy { // for updates. During a rolling update, all pods from ordinal Replicas-1 to // Partition are updated. All pods from ordinal Partition-1 to 0 remain untouched. // This is helpful in being able to do a canary based deployment. The default value is 0. + // +optional optional int32 partition = 1; // maxUnavailable is the maximum number of pods that can be unavailable during the update. @@ -303,6 +317,7 @@ message RollingUpdateStatefulSetStrategy { message Scale { // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. @@ -318,15 +333,16 @@ message Scale { message ScaleSpec { // replicas is the number of observed instances of the scaled object. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +default=0 - // +k8s:alpha(since: "1.36")=+k8s:minimum=0 + // +k8s:beta(since: "1.37")=+k8s:minimum=0 optional int32 replicas = 1; } // ScaleStatus represents the current status of a scale subresource. message ScaleStatus { // replias is the actual number of observed instances of the scaled object. + // +optional optional int32 replicas = 1; // selector is a label query over pods that should match the replicas count. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ @@ -352,12 +368,14 @@ message ScaleStatus { // // The StatefulSet guarantees that a given network identity will always // map to the same storage identity. +// +k8s:supportsSubresource="/scale" +// +k8s:supportsSubresource="/status" message StatefulSet { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Spec defines the desired identities of pods in this set. - // +optional + // +required optional StatefulSetSpec spec = 2; // Status is the current status of Pods in this StatefulSet. This data @@ -369,9 +387,11 @@ message StatefulSet { // StatefulSetCondition describes the state of a statefulset at a certain point. message StatefulSetCondition { // Type of statefulset condition. + // +optional optional string type = 1; // Status of the condition, one of True, False, Unknown. + // +optional optional string status = 2; // Last time the condition transitioned from one status to another. @@ -417,6 +437,7 @@ message StatefulSetPersistentVolumeClaimRetentionPolicy { // VolumeClaimTemplates when the StatefulSet is deleted. The default policy // of `Retain` causes PVCs to not be affected by StatefulSet deletion. The // `Delete` policy causes those PVCs to be deleted. + // +optional optional string whenDeleted = 1; // whenScaled specifies what happens to PVCs created from StatefulSet @@ -424,6 +445,7 @@ message StatefulSetPersistentVolumeClaimRetentionPolicy { // policy of `Retain` causes PVCs to not be affected by a scaledown. The // `Delete` policy causes the associated PVCs for any excess pods above // the replica count to be deleted. + // +optional optional string whenScaled = 2; } @@ -438,9 +460,11 @@ message StatefulSetSpec { optional int32 replicas = 1; // selector is a label query over pods that should match the replica count. - // If empty, defaulted to labels on the pod template. + // It must match the pod template's labels. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors - // +optional + // +required + // +k8s:alpha(since: "1.37")=+k8s:required + // +k8s:alpha(since: "1.37")=+k8s:immutable optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2; // template is the object that describes the pod that will be created if @@ -449,6 +473,7 @@ message StatefulSetSpec { // of the StatefulSet. Each pod will be named with the format // -. For example, a pod in a StatefulSet named // "web" with index number "3" would be named "web-3". + // +required optional .k8s.io.api.core.v1.PodTemplateSpec template = 3; // volumeClaimTemplates is a list of claims that pods are allowed to reference. @@ -459,7 +484,10 @@ message StatefulSetSpec { // any volumes in the template, with the same name. // TODO: Define the behavior if a claim already exists with the same name. // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable + // +k8s:alpha(since: "1.37")=+k8s:optional // +listType=atomic + // +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:opaqueType repeated .k8s.io.api.core.v1.PersistentVolumeClaim volumeClaimTemplates = 4; // serviceName is the name of the service that governs this StatefulSet. @@ -468,6 +496,8 @@ message StatefulSetSpec { // pattern: pod-specific-string.serviceName.default.svc.cluster.local // where "pod-specific-string" is managed by the StatefulSet controller. // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable + // +k8s:alpha(since: "1.37")=+k8s:optional optional string serviceName = 5; // podManagementPolicy controls how pods are created during initial scale up, @@ -479,17 +509,21 @@ message StatefulSetSpec { // to match the desired scale without waiting, and on scale down will delete // all pods at once. // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable + // +k8s:alpha(since: "1.37")=+k8s:optional optional string podManagementPolicy = 6; // updateStrategy indicates the StatefulSetUpdateStrategy that will be // employed to update Pods in the StatefulSet when a revision is made to // Template. + // +optional optional StatefulSetUpdateStrategy updateStrategy = 7; // revisionHistoryLimit is the maximum number of revisions that will // be maintained in the StatefulSet's revision history. The revision history // consists of all revisions not represented by a currently applied // StatefulSetSpec version. The default value is 10. + // +optional optional int32 revisionHistoryLimit = 8; // minReadySeconds is the minimum number of seconds for which a newly created pod should be ready @@ -567,9 +601,11 @@ message StatefulSetStatus { // necessary to perform the update for the indicated strategy. message StatefulSetUpdateStrategy { // Type indicates the type of the StatefulSetUpdateStrategy. + // +optional optional string type = 1; // RollingUpdate is used to communicate parameters when Type is RollingUpdateStatefulSetStrategyType. + // +optional optional RollingUpdateStatefulSetStrategy rollingUpdate = 2; } diff --git a/vendor/k8s.io/api/apps/v1beta1/types.go b/vendor/k8s.io/api/apps/v1beta1/types.go index 4e67338e36..9960ac0b39 100644 --- a/vendor/k8s.io/api/apps/v1beta1/types.go +++ b/vendor/k8s.io/api/apps/v1beta1/types.go @@ -33,15 +33,16 @@ const ( type ScaleSpec struct { // replicas is the number of observed instances of the scaled object. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +default=0 - // +k8s:alpha(since: "1.36")=+k8s:minimum=0 + // +k8s:beta(since: "1.37")=+k8s:minimum=0 Replicas int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` } // ScaleStatus represents the current status of a scale subresource. type ScaleStatus struct { // replias is the actual number of observed instances of the scaled object. + // +optional Replicas int32 `json:"replicas" protobuf:"varint,1,opt,name=replicas"` // selector is a label query over pods that should match the replicas count. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ @@ -67,9 +68,10 @@ type ScaleStatus struct { // Scale represents a scaling request for a resource. type Scale struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. @@ -97,13 +99,15 @@ type Scale struct { // // The StatefulSet guarantees that a given network identity will always // map to the same storage identity. +// +k8s:supportsSubresource="/scale" +// +k8s:supportsSubresource="/status" type StatefulSet struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec defines the desired identities of pods in this set. - // +optional + // +required Spec StatefulSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // Status is the current status of Pods in this StatefulSet. This data @@ -132,8 +136,10 @@ const ( // necessary to perform the update for the indicated strategy. type StatefulSetUpdateStrategy struct { // Type indicates the type of the StatefulSetUpdateStrategy. + // +optional Type StatefulSetUpdateStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=StatefulSetStrategyType"` // RollingUpdate is used to communicate parameters when Type is RollingUpdateStatefulSetStrategyType. + // +optional RollingUpdate *RollingUpdateStatefulSetStrategy `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"` } @@ -148,11 +154,12 @@ const ( // strategy, new Pods will be created from the specification version indicated // by the StatefulSet's updateRevision. RollingUpdateStatefulSetStrategyType StatefulSetUpdateStrategyType = "RollingUpdate" - // OnDeleteStatefulSetStrategyType triggers the legacy behavior. Version - // tracking and ordered rolling restarts are disabled. Pods are recreated - // from the StatefulSetSpec when they are manually deleted. When a scale - // operation is performed with this strategy,specification version indicated - // by the StatefulSet's currentRevision. + // OnDeleteStatefulSetStrategyType disables ordered rolling restarts. Version + // tracking is done on a best-effort basis - the controller will try to + // eventually converge StatefulSet's currentRevision with updateRevision. + // Pods are recreated from the StatefulSetSpec when they are manually deleted. + // When a scale operation is performed with this strategy, new Pods will be + // created from the specification version indicated by the StatefulSet's updateRevision. OnDeleteStatefulSetStrategyType StatefulSetUpdateStrategyType = "OnDelete" ) @@ -162,6 +169,7 @@ type RollingUpdateStatefulSetStrategy struct { // for updates. During a rolling update, all pods from ordinal Replicas-1 to // Partition are updated. All pods from ordinal Partition-1 to 0 remain untouched. // This is helpful in being able to do a canary based deployment. The default value is 0. + // +optional Partition *int32 `json:"partition,omitempty" protobuf:"varint,1,opt,name=partition"` // maxUnavailable is the maximum number of pods that can be unavailable during the update. // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). @@ -201,12 +209,14 @@ type StatefulSetPersistentVolumeClaimRetentionPolicy struct { // VolumeClaimTemplates when the StatefulSet is deleted. The default policy // of `Retain` causes PVCs to not be affected by StatefulSet deletion. The // `Delete` policy causes those PVCs to be deleted. + // +optional WhenDeleted PersistentVolumeClaimRetentionPolicyType `json:"whenDeleted,omitempty" protobuf:"bytes,1,opt,name=whenDeleted,casttype=PersistentVolumeClaimRetentionPolicyType"` // whenScaled specifies what happens to PVCs created from StatefulSet // VolumeClaimTemplates when the StatefulSet is scaled down. The default // policy of `Retain` causes PVCs to not be affected by a scaledown. The // `Delete` policy causes the associated PVCs for any excess pods above // the replica count to be deleted. + // +optional WhenScaled PersistentVolumeClaimRetentionPolicyType `json:"whenScaled,omitempty" protobuf:"bytes,2,opt,name=whenScaled,casttype=PersistentVolumeClaimRetentionPolicyType"` } @@ -236,9 +246,11 @@ type StatefulSetSpec struct { Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` // selector is a label query over pods that should match the replica count. - // If empty, defaulted to labels on the pod template. + // It must match the pod template's labels. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors - // +optional + // +required + // +k8s:alpha(since: "1.37")=+k8s:required + // +k8s:alpha(since: "1.37")=+k8s:immutable Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"` // template is the object that describes the pod that will be created if @@ -247,6 +259,7 @@ type StatefulSetSpec struct { // of the StatefulSet. Each pod will be named with the format // -. For example, a pod in a StatefulSet named // "web" with index number "3" would be named "web-3". + // +required Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"` // volumeClaimTemplates is a list of claims that pods are allowed to reference. @@ -257,7 +270,10 @@ type StatefulSetSpec struct { // any volumes in the template, with the same name. // TODO: Define the behavior if a claim already exists with the same name. // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable + // +k8s:alpha(since: "1.37")=+k8s:optional // +listType=atomic + // +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:opaqueType VolumeClaimTemplates []v1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty" protobuf:"bytes,4,rep,name=volumeClaimTemplates"` // serviceName is the name of the service that governs this StatefulSet. @@ -266,6 +282,8 @@ type StatefulSetSpec struct { // pattern: pod-specific-string.serviceName.default.svc.cluster.local // where "pod-specific-string" is managed by the StatefulSet controller. // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable + // +k8s:alpha(since: "1.37")=+k8s:optional ServiceName string `json:"serviceName" protobuf:"bytes,5,opt,name=serviceName"` // podManagementPolicy controls how pods are created during initial scale up, @@ -277,17 +295,21 @@ type StatefulSetSpec struct { // to match the desired scale without waiting, and on scale down will delete // all pods at once. // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable + // +k8s:alpha(since: "1.37")=+k8s:optional PodManagementPolicy PodManagementPolicyType `json:"podManagementPolicy,omitempty" protobuf:"bytes,6,opt,name=podManagementPolicy,casttype=PodManagementPolicyType"` // updateStrategy indicates the StatefulSetUpdateStrategy that will be // employed to update Pods in the StatefulSet when a revision is made to // Template. + // +optional UpdateStrategy StatefulSetUpdateStrategy `json:"updateStrategy,omitempty" protobuf:"bytes,7,opt,name=updateStrategy"` // revisionHistoryLimit is the maximum number of revisions that will // be maintained in the StatefulSet's revision history. The revision history // consists of all revisions not represented by a currently applied // StatefulSetSpec version. The default value is 10. + // +optional RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,8,opt,name=revisionHistoryLimit"` // minReadySeconds is the minimum number of seconds for which a newly created pod should be ready @@ -365,8 +387,10 @@ type StatefulSetConditionType string // StatefulSetCondition describes the state of a statefulset at a certain point. type StatefulSetCondition struct { // Type of statefulset condition. + // +optional Type StatefulSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=StatefulSetConditionType"` // Status of the condition, one of True, False, Unknown. + // +optional Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"` // Last time the condition transitioned from one status to another. // +optional @@ -387,7 +411,7 @@ type StatefulSetCondition struct { // StatefulSetList is a collection of StatefulSets. type StatefulSetList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` Items []StatefulSet `json:"items" protobuf:"bytes,2,rep,name=items"` @@ -403,14 +427,16 @@ type StatefulSetList struct { // DEPRECATED - This group version of Deployment is deprecated by apps/v1beta2/Deployment. See the release notes for // more information. // Deployment enables declarative updates for Pods and ReplicaSets. +// +k8s:supportsSubresource="/scale" +// +k8s:supportsSubresource="/status" type Deployment struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Specification of the desired behavior of the Deployment. - // +optional + // +required Spec DeploymentSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // Most recently observed status of the Deployment. @@ -432,6 +458,7 @@ type DeploymentSpec struct { // Template describes the pods that will be created. // The only allowed template.spec.restartPolicy value is "Always". + // +required Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"` // The deployment strategy to use to replace existing pods with new ones. @@ -478,13 +505,15 @@ type DeploymentSpec struct { // DEPRECATED. // DeploymentRollback stores the information required to rollback a deployment. type DeploymentRollback struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Required: This must match the Name of a deployment. + // +required Name string `json:"name" protobuf:"bytes,1,opt,name=name"` // The annotations to be updated to a deployment // +optional UpdatedAnnotations map[string]string `json:"updatedAnnotations,omitempty" protobuf:"bytes,2,rep,name=updatedAnnotations"` // The config of this deployment rollback. + // +optional RollbackTo RollbackConfig `json:"rollbackTo" protobuf:"bytes,3,opt,name=rollbackTo"` } @@ -626,16 +655,22 @@ const ( // DeploymentCondition describes the state of a deployment at a certain point. type DeploymentCondition struct { // Type of deployment condition. + // +optional Type DeploymentConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=DeploymentConditionType"` // Status of the condition, one of True, False, Unknown. + // +optional Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"` // The last time this condition was updated. + // +optional LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty" protobuf:"bytes,6,opt,name=lastUpdateTime"` // Last time the condition transitioned from one status to another. + // +optional LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,7,opt,name=lastTransitionTime"` // The reason for the condition's last transition. + // +optional Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` // A human readable message indicating details about the transition. + // +optional Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` } @@ -647,7 +682,7 @@ type DeploymentCondition struct { // DeploymentList is a list of Deployments. type DeploymentList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -675,16 +710,18 @@ type DeploymentList struct { // it may be subject to name and representation changes in future releases, and clients should not // depend on its stability. It is primarily for internal use by controllers. type ControllerRevision struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // data is the serialized representation of the state. - Data runtime.RawExtension `json:"data,omitempty" protobuf:"bytes,2,opt,name=data"` + // +required + Data runtime.RawExtension `json:"data" protobuf:"bytes,2,opt,name=data"` // revision indicates the revision of the state represented by Data. + // +optional Revision int64 `json:"revision" protobuf:"varint,3,opt,name=revision"` } @@ -696,7 +733,7 @@ type ControllerRevision struct { // ControllerRevisionList is a resource containing a list of ControllerRevision objects. type ControllerRevisionList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional diff --git a/vendor/k8s.io/api/apps/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/apps/v1beta1/types_swagger_doc_generated.go index a6f7a11927..e0efc96cd2 100644 --- a/vendor/k8s.io/api/apps/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/apps/v1beta1/types_swagger_doc_generated.go @@ -251,7 +251,7 @@ func (StatefulSetPersistentVolumeClaimRetentionPolicy) SwaggerDoc() map[string]s var map_StatefulSetSpec = map[string]string{ "": "A StatefulSetSpec is the specification of a StatefulSet.", "replicas": "replicas is the desired number of replicas of the given Template. These are replicas in the sense that they are instantiations of the same Template, but individual replicas also have a consistent identity. If unspecified, defaults to 1.", - "selector": "selector is a label query over pods that should match the replica count. If empty, defaulted to labels on the pod template. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors", + "selector": "selector is a label query over pods that should match the replica count. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors", "template": "template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the StatefulSet will fulfill this Template, but have a unique identity from the rest of the StatefulSet. Each pod will be named with the format -. For example, a pod in a StatefulSet named \"web\" with index number \"3\" would be named \"web-3\".", "volumeClaimTemplates": "volumeClaimTemplates is a list of claims that pods are allowed to reference. The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name.", "serviceName": "serviceName is the name of the service that governs this StatefulSet. This service must exist before the StatefulSet, and is responsible for the network identity of the set. Pods get DNS/hostnames that follow the pattern: pod-specific-string.serviceName.default.svc.cluster.local where \"pod-specific-string\" is managed by the StatefulSet controller.", diff --git a/vendor/k8s.io/api/apps/v1beta2/generated.proto b/vendor/k8s.io/api/apps/v1beta2/generated.proto index d680c9663e..738b1236e2 100644 --- a/vendor/k8s.io/api/apps/v1beta2/generated.proto +++ b/vendor/k8s.io/api/apps/v1beta2/generated.proto @@ -48,9 +48,11 @@ message ControllerRevision { optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Data is the serialized representation of the state. + // +required optional .k8s.io.apimachinery.pkg.runtime.RawExtension data = 2; // Revision indicates the revision of the state represented by Data. + // +optional optional int64 revision = 3; } @@ -67,6 +69,7 @@ message ControllerRevisionList { // DEPRECATED - This group version of DaemonSet is deprecated by apps/v1/DaemonSet. See the release notes for // more information. // DaemonSet represents the configuration of a daemon set. +// +k8s:supportsSubresource="/status" message DaemonSet { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -75,7 +78,7 @@ message DaemonSet { // The desired behavior of this daemon set. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required optional DaemonSetSpec spec = 2; // The current status of this daemon set. This data may be @@ -90,9 +93,11 @@ message DaemonSet { // DaemonSetCondition describes the state of a DaemonSet at a certain point. message DaemonSetCondition { // Type of DaemonSet condition. + // +optional optional string type = 1; // Status of the condition, one of True, False, Unknown. + // +optional optional string status = 2; // Last time the condition transitioned from one status to another. @@ -125,6 +130,7 @@ message DaemonSetSpec { // Must match in order to be controlled. // It must match the pod template's labels. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + // +required optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 1; // An object that describes the pod that will be created. @@ -133,6 +139,7 @@ message DaemonSetSpec { // selector is specified). // The only allowed template.spec.restartPolicy value is "Always". // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template + // +required optional .k8s.io.api.core.v1.PodTemplateSpec template = 2; // An update strategy to replace existing DaemonSet pods with new pods. @@ -227,13 +234,15 @@ message DaemonSetUpdateStrategy { // DEPRECATED - This group version of Deployment is deprecated by apps/v1/Deployment. See the release notes for // more information. // Deployment enables declarative updates for Pods and ReplicaSets. +// +k8s:supportsSubresource="/scale" +// +k8s:supportsSubresource="/status" message Deployment { // Standard object metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Specification of the desired behavior of the Deployment. - // +optional + // +required optional DeploymentSpec spec = 2; // Most recently observed status of the Deployment. @@ -244,21 +253,27 @@ message Deployment { // DeploymentCondition describes the state of a deployment at a certain point. message DeploymentCondition { // Type of deployment condition. + // +optional optional string type = 1; // Status of the condition, one of True, False, Unknown. + // +optional optional string status = 2; // The last time this condition was updated. + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastUpdateTime = 6; // Last time the condition transitioned from one status to another. + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 7; // The reason for the condition's last transition. + // +optional optional string reason = 4; // A human readable message indicating details about the transition. + // +optional optional string message = 5; } @@ -282,10 +297,12 @@ message DeploymentSpec { // Label selector for pods. Existing ReplicaSets whose pods are // selected by this will be the ones affected by this deployment. // It must match the pod template's labels. + // +required optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2; // Template describes the pods that will be created. // The only allowed template.spec.restartPolicy value is "Always". + // +required optional .k8s.io.api.core.v1.PodTemplateSpec template = 3; // The deployment strategy to use to replace existing pods with new ones. @@ -314,6 +331,7 @@ message DeploymentSpec { // process failed deployments and a condition with a ProgressDeadlineExceeded // reason will be surfaced in the deployment status. Note that progress will // not be estimated during the time a deployment is paused. Defaults to 600s. + // +optional optional int32 progressDeadlineSeconds = 9; } @@ -384,6 +402,8 @@ message DeploymentStrategy { // DEPRECATED - This group version of ReplicaSet is deprecated by apps/v1/ReplicaSet. See the release notes for // more information. // ReplicaSet ensures that a specified number of pod replicas are running at any given time. +// +k8s:supportsSubresource="/scale" +// +k8s:supportsSubresource="/status" message ReplicaSet { // If the Labels of a ReplicaSet are empty, they are defaulted to // be the same as the Pod(s) that the ReplicaSet manages. @@ -393,7 +413,7 @@ message ReplicaSet { // Spec defines the specification of the desired behavior of the ReplicaSet. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required optional ReplicaSetSpec spec = 2; // Status is the most recently observed status of the ReplicaSet. @@ -408,9 +428,11 @@ message ReplicaSet { // ReplicaSetCondition describes the state of a replica set at a certain point. message ReplicaSetCondition { // Type of replica set condition. + // +optional optional string type = 1; // Status of the condition, one of True, False, Unknown. + // +optional optional string status = 2; // The last time the condition transitioned from one status to another. @@ -457,6 +479,7 @@ message ReplicaSetSpec { // Label keys and values that must match in order to be controlled by this replica set. // It must match the pod template's labels. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + // +required optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2; // Template is the object that describes the pod that will be created if @@ -601,6 +624,7 @@ message RollingUpdateStatefulSetStrategy { message Scale { // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. @@ -616,15 +640,16 @@ message Scale { message ScaleSpec { // desired number of instances for the scaled object. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +default=0 - // +k8s:alpha(since: "1.36")=+k8s:minimum=0 + // +k8s:beta(since: "1.37")=+k8s:minimum=0 optional int32 replicas = 1; } // ScaleStatus represents the current status of a scale subresource. message ScaleStatus { // actual number of observed instances of the scaled object. + // +optional optional int32 replicas = 1; // selector is a label query over pods that should match the replicas count. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ @@ -651,12 +676,14 @@ message ScaleStatus { // // The StatefulSet guarantees that a given network identity will always // map to the same storage identity. +// +k8s:supportsSubresource="/scale" +// +k8s:supportsSubresource="/status" message StatefulSet { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Spec defines the desired identities of pods in this set. - // +optional + // +required optional StatefulSetSpec spec = 2; // Status is the current status of Pods in this StatefulSet. This data @@ -668,9 +695,11 @@ message StatefulSet { // StatefulSetCondition describes the state of a statefulset at a certain point. message StatefulSetCondition { // Type of statefulset condition. + // +optional optional string type = 1; // Status of the condition, one of True, False, Unknown. + // +optional optional string status = 2; // Last time the condition transitioned from one status to another. @@ -716,6 +745,7 @@ message StatefulSetPersistentVolumeClaimRetentionPolicy { // VolumeClaimTemplates when the StatefulSet is deleted. The default policy // of `Retain` causes PVCs to not be affected by StatefulSet deletion. The // `Delete` policy causes those PVCs to be deleted. + // +optional optional string whenDeleted = 1; // WhenScaled specifies what happens to PVCs created from StatefulSet @@ -723,6 +753,7 @@ message StatefulSetPersistentVolumeClaimRetentionPolicy { // policy of `Retain` causes PVCs to not be affected by a scaledown. The // `Delete` policy causes the associated PVCs for any excess pods above // the replica count to be deleted. + // +optional optional string whenScaled = 2; } @@ -739,6 +770,9 @@ message StatefulSetSpec { // selector is a label query over pods that should match the replica count. // It must match the pod template's labels. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + // +required + // +k8s:alpha(since: "1.37")=+k8s:required + // +k8s:alpha(since: "1.37")=+k8s:immutable optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2; // template is the object that describes the pod that will be created if @@ -748,6 +782,7 @@ message StatefulSetSpec { // -. For example, a pod in a StatefulSet named // "web" with index number "3" would be named "web-3". // The only allowed template.spec.restartPolicy value is "Always". + // +required optional .k8s.io.api.core.v1.PodTemplateSpec template = 3; // volumeClaimTemplates is a list of claims that pods are allowed to reference. @@ -758,7 +793,10 @@ message StatefulSetSpec { // any volumes in the template, with the same name. // TODO: Define the behavior if a claim already exists with the same name. // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable + // +k8s:alpha(since: "1.37")=+k8s:optional // +listType=atomic + // +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:opaqueType repeated .k8s.io.api.core.v1.PersistentVolumeClaim volumeClaimTemplates = 4; // serviceName is the name of the service that governs this StatefulSet. @@ -767,6 +805,8 @@ message StatefulSetSpec { // pattern: pod-specific-string.serviceName.default.svc.cluster.local // where "pod-specific-string" is managed by the StatefulSet controller. // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable + // +k8s:alpha(since: "1.37")=+k8s:optional optional string serviceName = 5; // podManagementPolicy controls how pods are created during initial scale up, @@ -778,17 +818,21 @@ message StatefulSetSpec { // to match the desired scale without waiting, and on scale down will delete // all pods at once. // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable + // +k8s:alpha(since: "1.37")=+k8s:optional optional string podManagementPolicy = 6; // updateStrategy indicates the StatefulSetUpdateStrategy that will be // employed to update Pods in the StatefulSet when a revision is made to // Template. + // +optional optional StatefulSetUpdateStrategy updateStrategy = 7; // revisionHistoryLimit is the maximum number of revisions that will // be maintained in the StatefulSet's revision history. The revision history // consists of all revisions not represented by a currently applied // StatefulSetSpec version. The default value is 10. + // +optional optional int32 revisionHistoryLimit = 8; // Minimum number of seconds for which a newly created pod should be ready diff --git a/vendor/k8s.io/api/apps/v1beta2/types.go b/vendor/k8s.io/api/apps/v1beta2/types.go index d4d4a7e0dc..138039f025 100644 --- a/vendor/k8s.io/api/apps/v1beta2/types.go +++ b/vendor/k8s.io/api/apps/v1beta2/types.go @@ -35,15 +35,16 @@ const ( type ScaleSpec struct { // desired number of instances for the scaled object. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +default=0 - // +k8s:alpha(since: "1.36")=+k8s:minimum=0 + // +k8s:beta(since: "1.37")=+k8s:minimum=0 Replicas int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` } // ScaleStatus represents the current status of a scale subresource. type ScaleStatus struct { // actual number of observed instances of the scaled object. + // +optional Replicas int32 `json:"replicas" protobuf:"varint,1,opt,name=replicas"` // selector is a label query over pods that should match the replicas count. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ @@ -70,9 +71,10 @@ type ScaleStatus struct { // Scale represents a scaling request for a resource. type Scale struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. @@ -103,13 +105,15 @@ type Scale struct { // // The StatefulSet guarantees that a given network identity will always // map to the same storage identity. +// +k8s:supportsSubresource="/scale" +// +k8s:supportsSubresource="/status" type StatefulSet struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec defines the desired identities of pods in this set. - // +optional + // +required Spec StatefulSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // Status is the current status of Pods in this StatefulSet. This data @@ -157,11 +161,12 @@ const ( // strategy, new Pods will be created from the specification version indicated // by the StatefulSet's updateRevision. RollingUpdateStatefulSetStrategyType StatefulSetUpdateStrategyType = "RollingUpdate" - // OnDeleteStatefulSetStrategyType triggers the legacy behavior. Version - // tracking and ordered rolling restarts are disabled. Pods are recreated - // from the StatefulSetSpec when they are manually deleted. When a scale - // operation is performed with this strategy,specification version indicated - // by the StatefulSet's currentRevision. + // OnDeleteStatefulSetStrategyType disables ordered rolling restarts. Version + // tracking is done on a best-effort basis - the controller will try to + // eventually converge StatefulSet's currentRevision with updateRevision. + // Pods are recreated from the StatefulSetSpec when they are manually deleted. + // When a scale operation is performed with this strategy, new Pods will be + // created from the specification version indicated by the StatefulSet's updateRevision. OnDeleteStatefulSetStrategyType StatefulSetUpdateStrategyType = "OnDelete" ) @@ -211,12 +216,14 @@ type StatefulSetPersistentVolumeClaimRetentionPolicy struct { // VolumeClaimTemplates when the StatefulSet is deleted. The default policy // of `Retain` causes PVCs to not be affected by StatefulSet deletion. The // `Delete` policy causes those PVCs to be deleted. + // +optional WhenDeleted PersistentVolumeClaimRetentionPolicyType `json:"whenDeleted,omitempty" protobuf:"bytes,1,opt,name=whenDeleted,casttype=PersistentVolumeClaimRetentionPolicyType"` // WhenScaled specifies what happens to PVCs created from StatefulSet // VolumeClaimTemplates when the StatefulSet is scaled down. The default // policy of `Retain` causes PVCs to not be affected by a scaledown. The // `Delete` policy causes the associated PVCs for any excess pods above // the replica count to be deleted. + // +optional WhenScaled PersistentVolumeClaimRetentionPolicyType `json:"whenScaled,omitempty" protobuf:"bytes,2,opt,name=whenScaled,casttype=PersistentVolumeClaimRetentionPolicyType"` } @@ -248,6 +255,9 @@ type StatefulSetSpec struct { // selector is a label query over pods that should match the replica count. // It must match the pod template's labels. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + // +required + // +k8s:alpha(since: "1.37")=+k8s:required + // +k8s:alpha(since: "1.37")=+k8s:immutable Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,2,opt,name=selector"` // template is the object that describes the pod that will be created if @@ -257,6 +267,7 @@ type StatefulSetSpec struct { // -. For example, a pod in a StatefulSet named // "web" with index number "3" would be named "web-3". // The only allowed template.spec.restartPolicy value is "Always". + // +required Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"` // volumeClaimTemplates is a list of claims that pods are allowed to reference. @@ -267,7 +278,10 @@ type StatefulSetSpec struct { // any volumes in the template, with the same name. // TODO: Define the behavior if a claim already exists with the same name. // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable + // +k8s:alpha(since: "1.37")=+k8s:optional // +listType=atomic + // +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:opaqueType VolumeClaimTemplates []v1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty" protobuf:"bytes,4,rep,name=volumeClaimTemplates"` // serviceName is the name of the service that governs this StatefulSet. @@ -276,6 +290,8 @@ type StatefulSetSpec struct { // pattern: pod-specific-string.serviceName.default.svc.cluster.local // where "pod-specific-string" is managed by the StatefulSet controller. // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable + // +k8s:alpha(since: "1.37")=+k8s:optional ServiceName string `json:"serviceName" protobuf:"bytes,5,opt,name=serviceName"` // podManagementPolicy controls how pods are created during initial scale up, @@ -287,17 +303,21 @@ type StatefulSetSpec struct { // to match the desired scale without waiting, and on scale down will delete // all pods at once. // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable + // +k8s:alpha(since: "1.37")=+k8s:optional PodManagementPolicy PodManagementPolicyType `json:"podManagementPolicy,omitempty" protobuf:"bytes,6,opt,name=podManagementPolicy,casttype=PodManagementPolicyType"` // updateStrategy indicates the StatefulSetUpdateStrategy that will be // employed to update Pods in the StatefulSet when a revision is made to // Template. + // +optional UpdateStrategy StatefulSetUpdateStrategy `json:"updateStrategy,omitempty" protobuf:"bytes,7,opt,name=updateStrategy"` // revisionHistoryLimit is the maximum number of revisions that will // be maintained in the StatefulSet's revision history. The revision history // consists of all revisions not represented by a currently applied // StatefulSetSpec version. The default value is 10. + // +optional RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,8,opt,name=revisionHistoryLimit"` // Minimum number of seconds for which a newly created pod should be ready @@ -375,8 +395,10 @@ type StatefulSetConditionType string // StatefulSetCondition describes the state of a statefulset at a certain point. type StatefulSetCondition struct { // Type of statefulset condition. + // +optional Type StatefulSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=StatefulSetConditionType"` // Status of the condition, one of True, False, Unknown. + // +optional Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"` // Last time the condition transitioned from one status to another. // +optional @@ -397,7 +419,7 @@ type StatefulSetCondition struct { // StatefulSetList is a collection of StatefulSets. type StatefulSetList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` Items []StatefulSet `json:"items" protobuf:"bytes,2,rep,name=items"` @@ -413,14 +435,16 @@ type StatefulSetList struct { // DEPRECATED - This group version of Deployment is deprecated by apps/v1/Deployment. See the release notes for // more information. // Deployment enables declarative updates for Pods and ReplicaSets. +// +k8s:supportsSubresource="/scale" +// +k8s:supportsSubresource="/status" type Deployment struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Specification of the desired behavior of the Deployment. - // +optional + // +required Spec DeploymentSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // Most recently observed status of the Deployment. @@ -438,10 +462,12 @@ type DeploymentSpec struct { // Label selector for pods. Existing ReplicaSets whose pods are // selected by this will be the ones affected by this deployment. // It must match the pod template's labels. + // +required Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,2,opt,name=selector"` // Template describes the pods that will be created. // The only allowed template.spec.restartPolicy value is "Always". + // +required Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"` // The deployment strategy to use to replace existing pods with new ones. @@ -470,6 +496,7 @@ type DeploymentSpec struct { // process failed deployments and a condition with a ProgressDeadlineExceeded // reason will be surfaced in the deployment status. Note that progress will // not be estimated during the time a deployment is paused. Defaults to 600s. + // +optional ProgressDeadlineSeconds *int32 `json:"progressDeadlineSeconds,omitempty" protobuf:"varint,9,opt,name=progressDeadlineSeconds"` } @@ -604,16 +631,22 @@ const ( // DeploymentCondition describes the state of a deployment at a certain point. type DeploymentCondition struct { // Type of deployment condition. + // +optional Type DeploymentConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=DeploymentConditionType"` // Status of the condition, one of True, False, Unknown. + // +optional Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"` // The last time this condition was updated. + // +optional LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty" protobuf:"bytes,6,opt,name=lastUpdateTime"` // Last time the condition transitioned from one status to another. + // +optional LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,7,opt,name=lastTransitionTime"` // The reason for the condition's last transition. + // +optional Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` // A human readable message indicating details about the transition. + // +optional Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` } @@ -625,7 +658,7 @@ type DeploymentCondition struct { // DeploymentList is a list of Deployments. type DeploymentList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -706,6 +739,7 @@ type DaemonSetSpec struct { // Must match in order to be controlled. // It must match the pod template's labels. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + // +required Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,1,opt,name=selector"` // An object that describes the pod that will be created. @@ -714,6 +748,7 @@ type DaemonSetSpec struct { // selector is specified). // The only allowed template.spec.restartPolicy value is "Always". // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template + // +required Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,2,opt,name=template"` // An update strategy to replace existing DaemonSet pods with new pods. @@ -797,8 +832,10 @@ type DaemonSetConditionType string // DaemonSetCondition describes the state of a DaemonSet at a certain point. type DaemonSetCondition struct { // Type of DaemonSet condition. + // +optional Type DaemonSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=DaemonSetConditionType"` // Status of the condition, one of True, False, Unknown. + // +optional Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"` // Last time the condition transitioned from one status to another. // +optional @@ -821,8 +858,9 @@ type DaemonSetCondition struct { // DEPRECATED - This group version of DaemonSet is deprecated by apps/v1/DaemonSet. See the release notes for // more information. // DaemonSet represents the configuration of a daemon set. +// +k8s:supportsSubresource="/status" type DaemonSet struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -830,7 +868,7 @@ type DaemonSet struct { // The desired behavior of this daemon set. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required Spec DaemonSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // The current status of this daemon set. This data may be @@ -857,7 +895,7 @@ const ( // DaemonSetList is a collection of daemon sets. type DaemonSetList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -877,8 +915,10 @@ type DaemonSetList struct { // DEPRECATED - This group version of ReplicaSet is deprecated by apps/v1/ReplicaSet. See the release notes for // more information. // ReplicaSet ensures that a specified number of pod replicas are running at any given time. +// +k8s:supportsSubresource="/scale" +// +k8s:supportsSubresource="/status" type ReplicaSet struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // If the Labels of a ReplicaSet are empty, they are defaulted to // be the same as the Pod(s) that the ReplicaSet manages. @@ -888,7 +928,7 @@ type ReplicaSet struct { // Spec defines the specification of the desired behavior of the ReplicaSet. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required Spec ReplicaSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // Status is the most recently observed status of the ReplicaSet. @@ -908,7 +948,7 @@ type ReplicaSet struct { // ReplicaSetList is a collection of ReplicaSets. type ReplicaSetList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -938,6 +978,7 @@ type ReplicaSetSpec struct { // Label keys and values that must match in order to be controlled by this replica set. // It must match the pod template's labels. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + // +required Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,2,opt,name=selector"` // Template is the object that describes the pod that will be created if @@ -998,8 +1039,10 @@ const ( // ReplicaSetCondition describes the state of a replica set at a certain point. type ReplicaSetCondition struct { // Type of replica set condition. + // +optional Type ReplicaSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=ReplicaSetConditionType"` // Status of the condition, one of True, False, Unknown. + // +optional Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"` // The last time the condition transitioned from one status to another. // +optional @@ -1031,16 +1074,18 @@ type ReplicaSetCondition struct { // it may be subject to name and representation changes in future releases, and clients should not // depend on its stability. It is primarily for internal use by controllers. type ControllerRevision struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Data is the serialized representation of the state. - Data runtime.RawExtension `json:"data,omitempty" protobuf:"bytes,2,opt,name=data"` + // +required + Data runtime.RawExtension `json:"data" protobuf:"bytes,2,opt,name=data"` // Revision indicates the revision of the state represented by Data. + // +optional Revision int64 `json:"revision" protobuf:"varint,3,opt,name=revision"` } @@ -1052,7 +1097,7 @@ type ControllerRevision struct { // ControllerRevisionList is a resource containing a list of ControllerRevision objects. type ControllerRevisionList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional diff --git a/vendor/k8s.io/api/authentication/v1/generated.pb.go b/vendor/k8s.io/api/authentication/v1/generated.pb.go index 2b872c453e..8547b769fd 100644 --- a/vendor/k8s.io/api/authentication/v1/generated.pb.go +++ b/vendor/k8s.io/api/authentication/v1/generated.pb.go @@ -32,6 +32,8 @@ import ( k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" ) +func (m *AttestationValue) Reset() { *m = AttestationValue{} } + func (m *BoundObjectReference) Reset() { *m = BoundObjectReference{} } func (m *ExtraValue) Reset() { *m = ExtraValue{} } @@ -54,6 +56,38 @@ func (m *TokenReviewStatus) Reset() { *m = TokenReviewStatus{} } func (m *UserInfo) Reset() { *m = UserInfo{} } +func (m AttestationValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m AttestationValue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m AttestationValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m) > 0 { + for iNdEx := len(m) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m[iNdEx]) + copy(dAtA[i:], m[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *BoundObjectReference) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -278,6 +312,35 @@ func (m *TokenRequestSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Attestations) > 0 { + keysForAttestations := make([]string, 0, len(m.Attestations)) + for k := range m.Attestations { + keysForAttestations = append(keysForAttestations, string(k)) + } + sort.Strings(keysForAttestations) + for iNdEx := len(keysForAttestations) - 1; iNdEx >= 0; iNdEx-- { + v := m.Attestations[string(keysForAttestations[iNdEx])] + baseI := i + { + size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + i -= len(keysForAttestations[iNdEx]) + copy(dAtA[i:], keysForAttestations[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(keysForAttestations[iNdEx]))) + i-- + dAtA[i] = 0xa + i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x2a + } + } if m.ExpirationSeconds != nil { i = encodeVarintGenerated(dAtA, i, uint64(*m.ExpirationSeconds)) i-- @@ -572,6 +635,21 @@ func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m AttestationValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m) > 0 { + for _, s := range m { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + func (m *BoundObjectReference) Size() (n int) { if m == nil { return 0 @@ -662,6 +740,15 @@ func (m *TokenRequestSpec) Size() (n int) { if m.ExpirationSeconds != nil { n += 1 + sovGenerated(uint64(*m.ExpirationSeconds)) } + if len(m.Attestations) > 0 { + for k, v := range m.Attestations { + _ = k + _ = v + l = v.Size() + mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) + n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + } + } return n } @@ -814,10 +901,21 @@ func (this *TokenRequestSpec) String() string { if this == nil { return "nil" } + keysForAttestations := make([]string, 0, len(this.Attestations)) + for k := range this.Attestations { + keysForAttestations = append(keysForAttestations, k) + } + sort.Strings(keysForAttestations) + mapStringForAttestations := "map[string]AttestationValue{" + for _, k := range keysForAttestations { + mapStringForAttestations += fmt.Sprintf("%v: %v,", k, this.Attestations[k]) + } + mapStringForAttestations += "}" s := strings.Join([]string{`&TokenRequestSpec{`, `Audiences:` + fmt.Sprintf("%v", this.Audiences) + `,`, `BoundObjectRef:` + strings.Replace(this.BoundObjectRef.String(), "BoundObjectReference", "BoundObjectReference", 1) + `,`, `ExpirationSeconds:` + valueToStringGenerated(this.ExpirationSeconds) + `,`, + `Attestations:` + mapStringForAttestations + `,`, `}`, }, "") return s @@ -900,6 +998,88 @@ func valueToStringGenerated(v interface{}) string { pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } +func (m *AttestationValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AttestationValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AttestationValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + *m = append(*m, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *BoundObjectReference) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1625,6 +1805,135 @@ func (m *TokenRequestSpec) Unmarshal(dAtA []byte) error { } } m.ExpirationSeconds = &v + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attestations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Attestations == nil { + m.Attestations = make(map[string]AttestationValue) + } + var mapkey string + mapvalue := &AttestationValue{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthGenerated + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthGenerated + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthGenerated + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &AttestationValue{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Attestations[mapkey] = *mapvalue + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/vendor/k8s.io/api/authentication/v1/generated.proto b/vendor/k8s.io/api/authentication/v1/generated.proto index 82ff7c3c51..c7b99158a0 100644 --- a/vendor/k8s.io/api/authentication/v1/generated.proto +++ b/vendor/k8s.io/api/authentication/v1/generated.proto @@ -28,9 +28,19 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; // Package-wide variables from generator "generated". option go_package = "k8s.io/api/authentication/v1"; +// AttestationValue masks the value so protobuf can generate +// +protobuf.nullable=true +// +protobuf.options.(gogoproto.goproto_stringer)=false +message AttestationValue { + // items, if empty, will result in an empty slice + + repeated string items = 1; +} + // BoundObjectReference is a reference to an object that a token is bound to. message BoundObjectReference { - // kind of the referent. Valid kinds are 'Pod' and 'Secret'. + // kind of the referent. Valid kinds are 'Pod', 'Secret', 'Node', + // 'ValidatingWebhookConfiguration', and 'MutatingWebhookConfiguration'. // +optional optional string kind = 1; @@ -59,10 +69,12 @@ message ExtraValue { // SelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. // When using impersonation, users will receive the user info of the user being impersonated. If impersonation or // request header authentication is used, any extra keys will have their case ignored and returned as lowercase. +// +k8s:supportsSubresource="/status" message SelfSubjectReview { // metadata is standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // status is filled in by the server with the user attributes. @@ -82,6 +94,7 @@ message TokenRequest { // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec holds information about the request being evaluated @@ -118,6 +131,14 @@ message TokenRequestSpec { // small if you want prompt revocation. // +optional optional BoundObjectReference boundObjectRef = 3; + + // attestations is a map of well-known keys to string-slice values. + // The values for each key have a specific semantic meaning, which is + // documented on the key definition. Requesters of tokens may ask + // the Kubernetes API Server to attest to certain claims. The API Server + // may perform authorization checks depending on the key of this map. + // +optional + map attestations = 5; } // TokenRequestStatus is the result of a token request. @@ -134,10 +155,12 @@ message TokenRequestStatus { // TokenReview attempts to authenticate a token to a known user. // Note: TokenReview requests may be cached by the webhook token authenticator // plugin in the kube-apiserver. +// +k8s:supportsSubresource="/status" message TokenReview { // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec holds information about the request being evaluated diff --git a/vendor/k8s.io/api/authentication/v1/types.go b/vendor/k8s.io/api/authentication/v1/types.go index c28bded50a..1eee2b5049 100644 --- a/vendor/k8s.io/api/authentication/v1/types.go +++ b/vendor/k8s.io/api/authentication/v1/types.go @@ -39,6 +39,33 @@ const ( // It can be repeated multiplied times for multiple map keys and the same key can be repeated multiple // times to have multiple elements in the slice under a single key ImpersonateUserExtraHeaderPrefix = "Impersonate-Extra-" + + // AttestationAdmissionReviewAPIGroups is the map key for the + // admissionReviewAPIGroups claim. It represents the APIGroup that a token + // authorizes its bearer to query admission webhooks about. The value + // corresponding to this key must be a slice of length 1, and the first and + // only element of this slice must match the APIGroup of the AdmissionReview + // request being made of the webhook. The empty string is invalid as the + // first and only element of the value slice. The special value "*" means + // "all api groups", and requires matching permissions (described below). + // + // For this claim to be considered valid, the TokenRequest must meet two + // conditions. First, the BoundObjectRef must be one of + // ValidatingWebhookConfiguration or MutatingWebhookConfiguration; the + // Webhook Configuration in question must have a Rule governing a resource + // under the APIGroup named in the value to this key. Second, the requested + // audience must match one of the following patterns: + // 1. When the webhook is configured with a URL, the audience must match + // the URL field exactly. + // 2. When the webhook is configured with a service, the audience must + // match the pattern `https://$name.$namespace.svc:$port[/$path]`, where + // `/$path` is optional. + // + // The service account for which the TokenRequest is being made must have + // "attest" permissions on group "authentication.k8s.io", resource + // "admissionReviewAPIGroups", and a resource name matching exactly either + // "*", or the API group named in the value to this key. + AttestationAdmissionReviewAPIGroups = "admissionReviewAPIGroups" ) // +genclient @@ -50,11 +77,13 @@ const ( // TokenReview attempts to authenticate a token to a known user. // Note: TokenReview requests may be cached by the webhook token authenticator // plugin in the kube-apiserver. +// +k8s:supportsSubresource="/status" type TokenReview struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec holds information about the request being evaluated @@ -135,15 +164,25 @@ func (t ExtraValue) String() string { return fmt.Sprintf("%v", []string(t)) } +// AttestationValue masks the value so protobuf can generate +// +protobuf.nullable=true +// +protobuf.options.(gogoproto.goproto_stringer)=false +type AttestationValue []string + +func (a AttestationValue) String() string { + return fmt.Sprintf("%v", []string(a)) +} + // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.10 // TokenRequest requests a token for a given service account. type TokenRequest struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec holds information about the request being evaluated @@ -180,6 +219,14 @@ type TokenRequestSpec struct { // small if you want prompt revocation. // +optional BoundObjectRef *BoundObjectReference `json:"boundObjectRef" protobuf:"bytes,3,opt,name=boundObjectRef"` + + // attestations is a map of well-known keys to string-slice values. + // The values for each key have a specific semantic meaning, which is + // documented on the key definition. Requesters of tokens may ask + // the Kubernetes API Server to attest to certain claims. The API Server + // may perform authorization checks depending on the key of this map. + // +optional + Attestations map[string]AttestationValue `json:"attestations,omitempty" protobuf:"bytes,5,rep,name=attestations"` } // TokenRequestStatus is the result of a token request. @@ -194,7 +241,8 @@ type TokenRequestStatus struct { // BoundObjectReference is a reference to an object that a token is bound to. type BoundObjectReference struct { - // kind of the referent. Valid kinds are 'Pod' and 'Secret'. + // kind of the referent. Valid kinds are 'Pod', 'Secret', 'Node', + // 'ValidatingWebhookConfiguration', and 'MutatingWebhookConfiguration'. // +optional Kind string `json:"kind,omitempty" protobuf:"bytes,1,opt,name=kind"` // apiVersion is API version of the referent. @@ -218,11 +266,13 @@ type BoundObjectReference struct { // SelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. // When using impersonation, users will receive the user info of the user being impersonated. If impersonation or // request header authentication is used, any extra keys will have their case ignored and returned as lowercase. +// +k8s:supportsSubresource="/status" type SelfSubjectReview struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // status is filled in by the server with the user attributes. // +optional diff --git a/vendor/k8s.io/api/authentication/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/authentication/v1/types_swagger_doc_generated.go index ea3acbb681..eb50e71546 100644 --- a/vendor/k8s.io/api/authentication/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/authentication/v1/types_swagger_doc_generated.go @@ -29,7 +29,7 @@ package v1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_BoundObjectReference = map[string]string{ "": "BoundObjectReference is a reference to an object that a token is bound to.", - "kind": "kind of the referent. Valid kinds are 'Pod' and 'Secret'.", + "kind": "kind of the referent. Valid kinds are 'Pod', 'Secret', 'Node', 'ValidatingWebhookConfiguration', and 'MutatingWebhookConfiguration'.", "apiVersion": "apiVersion is API version of the referent.", "name": "name of the referent.", "uid": "uid of the referent.", @@ -74,6 +74,7 @@ var map_TokenRequestSpec = map[string]string{ "audiences": "audiences are the intendend audiences of the token. A recipient of a token must identify themself with an identifier in the list of audiences of the token, and otherwise should reject the token. A token issued for multiple audiences may be used to authenticate against any of the audiences listed but implies a high degree of trust between the target audiences.", "expirationSeconds": "expirationSeconds is the requested duration of validity of the request. The token issuer may return a token with a different validity duration so a client needs to check the 'expiration' field in a response.", "boundObjectRef": "boundObjectRef is a reference to an object that the token will be bound to. The token will only be valid for as long as the bound object exists. NOTE: The API server's TokenReview endpoint will validate the BoundObjectRef, but other audiences may not. Keep ExpirationSeconds small if you want prompt revocation.", + "attestations": "attestations is a map of well-known keys to string-slice values. The values for each key have a specific semantic meaning, which is documented on the key definition. Requesters of tokens may ask the Kubernetes API Server to attest to certain claims. The API Server may perform authorization checks depending on the key of this map.", } func (TokenRequestSpec) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/authentication/v1/zz_generated.deepcopy.go b/vendor/k8s.io/api/authentication/v1/zz_generated.deepcopy.go index 369c89b863..6bc649268d 100644 --- a/vendor/k8s.io/api/authentication/v1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/authentication/v1/zz_generated.deepcopy.go @@ -25,6 +25,26 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in AttestationValue) DeepCopyInto(out *AttestationValue) { + { + in := &in + *out = make(AttestationValue, len(*in)) + copy(*out, *in) + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AttestationValue. +func (in AttestationValue) DeepCopy() AttestationValue { + if in == nil { + return nil + } + out := new(AttestationValue) + in.DeepCopyInto(out) + return *out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BoundObjectReference) DeepCopyInto(out *BoundObjectReference) { *out = *in @@ -151,6 +171,21 @@ func (in *TokenRequestSpec) DeepCopyInto(out *TokenRequestSpec) { *out = new(BoundObjectReference) **out = **in } + if in.Attestations != nil { + in, out := &in.Attestations, &out.Attestations + *out = make(map[string]AttestationValue, len(*in)) + for key, val := range *in { + var outVal []string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = make(AttestationValue, len(*in)) + copy(*out, *in) + } + (*out)[key] = outVal + } + } return } diff --git a/vendor/k8s.io/api/authentication/v1alpha1/generated.proto b/vendor/k8s.io/api/authentication/v1alpha1/generated.proto index 2bf836d730..cd806bb8aa 100644 --- a/vendor/k8s.io/api/authentication/v1alpha1/generated.proto +++ b/vendor/k8s.io/api/authentication/v1alpha1/generated.proto @@ -32,10 +32,12 @@ option go_package = "k8s.io/api/authentication/v1alpha1"; // SelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. // When using impersonation, users will receive the user info of the user being impersonated. If impersonation or // request header authentication is used, any extra keys will have their case ignored and returned as lowercase. +// +k8s:supportsSubresource="/status" message SelfSubjectReview { // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // status is filled in by the server with the user attributes. diff --git a/vendor/k8s.io/api/authentication/v1alpha1/types.go b/vendor/k8s.io/api/authentication/v1alpha1/types.go index 7e02470c96..5a76a91a37 100644 --- a/vendor/k8s.io/api/authentication/v1alpha1/types.go +++ b/vendor/k8s.io/api/authentication/v1alpha1/types.go @@ -30,11 +30,13 @@ import ( // SelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. // When using impersonation, users will receive the user info of the user being impersonated. If impersonation or // request header authentication is used, any extra keys will have their case ignored and returned as lowercase. +// +k8s:supportsSubresource="/status" type SelfSubjectReview struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // status is filled in by the server with the user attributes. // +optional diff --git a/vendor/k8s.io/api/authentication/v1beta1/generated.proto b/vendor/k8s.io/api/authentication/v1beta1/generated.proto index 999c65156d..e5992bcaa2 100644 --- a/vendor/k8s.io/api/authentication/v1beta1/generated.proto +++ b/vendor/k8s.io/api/authentication/v1beta1/generated.proto @@ -41,10 +41,12 @@ message ExtraValue { // SelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. // When using impersonation, users will receive the user info of the user being impersonated. If impersonation or // request header authentication is used, any extra keys will have their case ignored and returned as lowercase. +// +k8s:supportsSubresource="/status" message SelfSubjectReview { // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // status is filled in by the server with the user attributes. @@ -62,10 +64,12 @@ message SelfSubjectReviewStatus { // TokenReview attempts to authenticate a token to a known user. // Note: TokenReview requests may be cached by the webhook token authenticator // plugin in the kube-apiserver. +// +k8s:supportsSubresource="/status" message TokenReview { // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec holds information about the request being evaluated diff --git a/vendor/k8s.io/api/authentication/v1beta1/types.go b/vendor/k8s.io/api/authentication/v1beta1/types.go index 33dacdb723..8873d5d2a7 100644 --- a/vendor/k8s.io/api/authentication/v1beta1/types.go +++ b/vendor/k8s.io/api/authentication/v1beta1/types.go @@ -34,11 +34,13 @@ import ( // TokenReview attempts to authenticate a token to a known user. // Note: TokenReview requests may be cached by the webhook token authenticator // plugin in the kube-apiserver. +// +k8s:supportsSubresource="/status" type TokenReview struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec holds information about the request being evaluated @@ -128,11 +130,13 @@ func (t ExtraValue) String() string { // SelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. // When using impersonation, users will receive the user info of the user being impersonated. If impersonation or // request header authentication is used, any extra keys will have their case ignored and returned as lowercase. +// +k8s:supportsSubresource="/status" type SelfSubjectReview struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // status is filled in by the server with the user attributes. // +optional diff --git a/vendor/k8s.io/api/authorization/v1/generated.proto b/vendor/k8s.io/api/authorization/v1/generated.proto index c47449f911..40753aa434 100644 --- a/vendor/k8s.io/api/authorization/v1/generated.proto +++ b/vendor/k8s.io/api/authorization/v1/generated.proto @@ -94,10 +94,12 @@ message LabelSelectorAttributes { // LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. // Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions // checking. +// +k8s:supportsSubresource="/status" message LocalSubjectAccessReview { // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec holds information about the request being evaluated. spec.namespace must be equal to the namespace @@ -203,10 +205,12 @@ message ResourceRule { // SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a // spec.namespace means "in all namespaces". Self is a special case, because users should always be able // to check whether they can perform an action +// +k8s:supportsSubresource="/status" message SelfSubjectAccessReview { // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec holds information about the request being evaluated. user and groups must be empty @@ -222,10 +226,14 @@ message SelfSubjectAccessReview { message SelfSubjectAccessReviewSpec { // resourceAttributes describes information for a resource access request // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:unionMember optional ResourceAttributes resourceAttributes = 1; // nonResourceAttributes describes information for a non-resource access request // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:unionMember optional NonResourceAttributes nonResourceAttributes = 2; } @@ -235,10 +243,12 @@ message SelfSubjectAccessReviewSpec { // or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to // drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. // SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server. +// +k8s:supportsSubresource="/status" message SelfSubjectRulesReview { // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec holds information about the request being evaluated. @@ -256,10 +266,12 @@ message SelfSubjectRulesReviewSpec { } // SubjectAccessReview checks whether or not a user or group can perform an action. +// +k8s:supportsSubresource="/status" message SubjectAccessReview { // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec holds information about the request being evaluated @@ -275,10 +287,14 @@ message SubjectAccessReview { message SubjectAccessReviewSpec { // resourceAttributes describes information for a resource access request // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:unionMember optional ResourceAttributes resourceAttributes = 1; // nonResourceAttributes describes information for a non-resource access request // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:unionMember optional NonResourceAttributes nonResourceAttributes = 2; // user is the user you're testing for. diff --git a/vendor/k8s.io/api/authorization/v1/types.go b/vendor/k8s.io/api/authorization/v1/types.go index dcc9b0f853..eb9f808cf7 100644 --- a/vendor/k8s.io/api/authorization/v1/types.go +++ b/vendor/k8s.io/api/authorization/v1/types.go @@ -29,11 +29,13 @@ import ( // +k8s:prerelease-lifecycle-gen:introduced=1.6 // SubjectAccessReview checks whether or not a user or group can perform an action. +// +k8s:supportsSubresource="/status" type SubjectAccessReview struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec holds information about the request being evaluated @@ -53,11 +55,13 @@ type SubjectAccessReview struct { // SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a // spec.namespace means "in all namespaces". Self is a special case, because users should always be able // to check whether they can perform an action +// +k8s:supportsSubresource="/status" type SelfSubjectAccessReview struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec holds information about the request being evaluated. user and groups must be empty @@ -76,11 +80,13 @@ type SelfSubjectAccessReview struct { // LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. // Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions // checking. +// +k8s:supportsSubresource="/status" type LocalSubjectAccessReview struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec holds information about the request being evaluated. spec.namespace must be equal to the namespace @@ -195,9 +201,13 @@ type NonResourceAttributes struct { type SubjectAccessReviewSpec struct { // resourceAttributes describes information for a resource access request // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:unionMember ResourceAttributes *ResourceAttributes `json:"resourceAttributes,omitempty" protobuf:"bytes,1,opt,name=resourceAttributes"` // nonResourceAttributes describes information for a non-resource access request // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:unionMember NonResourceAttributes *NonResourceAttributes `json:"nonResourceAttributes,omitempty" protobuf:"bytes,2,opt,name=nonResourceAttributes"` // user is the user you're testing for. @@ -231,9 +241,13 @@ func (t ExtraValue) String() string { type SelfSubjectAccessReviewSpec struct { // resourceAttributes describes information for a resource access request // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:unionMember ResourceAttributes *ResourceAttributes `json:"resourceAttributes,omitempty" protobuf:"bytes,1,opt,name=resourceAttributes"` // nonResourceAttributes describes information for a non-resource access request // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:unionMember NonResourceAttributes *NonResourceAttributes `json:"nonResourceAttributes,omitempty" protobuf:"bytes,2,opt,name=nonResourceAttributes"` } @@ -269,11 +283,13 @@ type SubjectAccessReviewStatus struct { // or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to // drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. // SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server. +// +k8s:supportsSubresource="/status" type SelfSubjectRulesReview struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec holds information about the request being evaluated. diff --git a/vendor/k8s.io/api/authorization/v1beta1/generated.proto b/vendor/k8s.io/api/authorization/v1beta1/generated.proto index 8095ab4dbb..37618f077f 100644 --- a/vendor/k8s.io/api/authorization/v1beta1/generated.proto +++ b/vendor/k8s.io/api/authorization/v1beta1/generated.proto @@ -41,10 +41,12 @@ message ExtraValue { // LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. // Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions // checking. +// +k8s:supportsSubresource="/status" message LocalSubjectAccessReview { // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec holds information about the request being evaluated. spec.namespace must be equal to the namespace @@ -150,10 +152,12 @@ message ResourceRule { // SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a // spec.namespace means "in all namespaces". Self is a special case, because users should always be able // to check whether they can perform an action +// +k8s:supportsSubresource="/status" message SelfSubjectAccessReview { // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec holds information about the request being evaluated. user and groups must be empty @@ -169,10 +173,14 @@ message SelfSubjectAccessReview { message SelfSubjectAccessReviewSpec { // resourceAttributes describes information for a resource access request // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:unionMember optional ResourceAttributes resourceAttributes = 1; // nonResourceAttributes describes information for a non-resource access request // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:unionMember optional NonResourceAttributes nonResourceAttributes = 2; } @@ -182,10 +190,12 @@ message SelfSubjectAccessReviewSpec { // or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to // drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. // SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server. +// +k8s:supportsSubresource="/status" message SelfSubjectRulesReview { // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec holds information about the request being evaluated. @@ -203,10 +213,12 @@ message SelfSubjectRulesReviewSpec { } // SubjectAccessReview checks whether or not a user or group can perform an action. +// +k8s:supportsSubresource="/status" message SubjectAccessReview { // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec holds information about the request being evaluated @@ -222,10 +234,14 @@ message SubjectAccessReview { message SubjectAccessReviewSpec { // resourceAttributes describes information for a resource access request // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:unionMember optional ResourceAttributes resourceAttributes = 1; // nonResourceAttributes describes information for a non-resource access request // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:unionMember optional NonResourceAttributes nonResourceAttributes = 2; // user is the user you're testing for. diff --git a/vendor/k8s.io/api/authorization/v1beta1/types.go b/vendor/k8s.io/api/authorization/v1beta1/types.go index 204559fd20..7dc8409af6 100644 --- a/vendor/k8s.io/api/authorization/v1beta1/types.go +++ b/vendor/k8s.io/api/authorization/v1beta1/types.go @@ -32,11 +32,13 @@ import ( // +k8s:prerelease-lifecycle-gen:replacement=authorization.k8s.io,v1,SubjectAccessReview // SubjectAccessReview checks whether or not a user or group can perform an action. +// +k8s:supportsSubresource="/status" type SubjectAccessReview struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec holds information about the request being evaluated @@ -58,11 +60,13 @@ type SubjectAccessReview struct { // SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a // spec.namespace means "in all namespaces". Self is a special case, because users should always be able // to check whether they can perform an action +// +k8s:supportsSubresource="/status" type SelfSubjectAccessReview struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec holds information about the request being evaluated. user and groups must be empty @@ -83,11 +87,13 @@ type SelfSubjectAccessReview struct { // LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. // Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions // checking. +// +k8s:supportsSubresource="/status" type LocalSubjectAccessReview struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec holds information about the request being evaluated. spec.namespace must be equal to the namespace @@ -148,9 +154,13 @@ type NonResourceAttributes struct { type SubjectAccessReviewSpec struct { // resourceAttributes describes information for a resource access request // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:unionMember ResourceAttributes *ResourceAttributes `json:"resourceAttributes,omitempty" protobuf:"bytes,1,opt,name=resourceAttributes"` // nonResourceAttributes describes information for a non-resource access request // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:unionMember NonResourceAttributes *NonResourceAttributes `json:"nonResourceAttributes,omitempty" protobuf:"bytes,2,opt,name=nonResourceAttributes"` // user is the user you're testing for. @@ -184,9 +194,13 @@ func (t ExtraValue) String() string { type SelfSubjectAccessReviewSpec struct { // resourceAttributes describes information for a resource access request // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:unionMember ResourceAttributes *ResourceAttributes `json:"resourceAttributes,omitempty" protobuf:"bytes,1,opt,name=resourceAttributes"` // nonResourceAttributes describes information for a non-resource access request // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:unionMember NonResourceAttributes *NonResourceAttributes `json:"nonResourceAttributes,omitempty" protobuf:"bytes,2,opt,name=nonResourceAttributes"` } @@ -224,11 +238,13 @@ type SubjectAccessReviewStatus struct { // or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to // drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. // SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server. +// +k8s:supportsSubresource="/status" type SelfSubjectRulesReview struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec holds information about the request being evaluated. diff --git a/vendor/k8s.io/api/autoscaling/v1/generated.pb.go b/vendor/k8s.io/api/autoscaling/v1/generated.pb.go index 6028054aef..681c0c44c7 100644 --- a/vendor/k8s.io/api/autoscaling/v1/generated.pb.go +++ b/vendor/k8s.io/api/autoscaling/v1/generated.pb.go @@ -410,6 +410,11 @@ func (m *HorizontalPodAutoscalerCondition) MarshalToSizedBuffer(dAtA []byte) (in _ = i var l int _ = l + if m.ObservedGeneration != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.ObservedGeneration)) + i-- + dAtA[i] = 0x30 + } i -= len(m.Message) copy(dAtA[i:], m.Message) i = encodeVarintGenerated(dAtA, i, uint64(len(m.Message))) @@ -1344,6 +1349,9 @@ func (m *HorizontalPodAutoscalerCondition) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) l = len(m.Message) n += 1 + l + sovGenerated(uint64(l)) + if m.ObservedGeneration != nil { + n += 1 + sovGenerated(uint64(*m.ObservedGeneration)) + } return n } @@ -1708,6 +1716,7 @@ func (this *HorizontalPodAutoscalerCondition) String() string { `LastTransitionTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastTransitionTime), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, `Reason:` + fmt.Sprintf("%v", this.Reason) + `,`, `Message:` + fmt.Sprintf("%v", this.Message) + `,`, + `ObservedGeneration:` + valueToStringGenerated(this.ObservedGeneration) + `,`, `}`, }, "") return s @@ -3101,6 +3110,26 @@ func (m *HorizontalPodAutoscalerCondition) Unmarshal(dAtA []byte) error { } m.Message = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ObservedGeneration", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ObservedGeneration = &v default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/vendor/k8s.io/api/autoscaling/v1/generated.proto b/vendor/k8s.io/api/autoscaling/v1/generated.proto index 6ef1facb6a..a20b92a793 100644 --- a/vendor/k8s.io/api/autoscaling/v1/generated.proto +++ b/vendor/k8s.io/api/autoscaling/v1/generated.proto @@ -88,9 +88,11 @@ message ContainerResourceMetricStatus { // +structType=atomic message CrossVersionObjectReference { // kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + // +k8s:alpha(since: "1.37")=+k8s:required optional string kind = 1; // name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + // +k8s:alpha(since: "1.37")=+k8s:required optional string name = 2; // apiVersion is the API version of the referent @@ -142,8 +144,9 @@ message ExternalMetricStatus { } // configuration of a horizontal pod autoscaler. +// +k8s:supportsSubresource="/status" message HorizontalPodAutoscaler { - // Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -178,6 +181,12 @@ message HorizontalPodAutoscalerCondition { // the transition // +optional optional string message = 5; + + // observedGeneration represents the .metadata.generation that the condition was set based upon. + // For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + // with respect to the current state of the instance. + // +optional + optional int64 observedGeneration = 6; } // list of horizontal pod autoscaler objects. @@ -192,7 +201,7 @@ message HorizontalPodAutoscalerList { // specification of a horizontal pod autoscaler. message HorizontalPodAutoscalerSpec { - // reference to scaled resource; horizontal pod autoscaler will learn the current resource consumption + // scaleTargetRef is the reference to scaled resource; horizontal pod autoscaler will learn the current resource consumption // and will set the desired number of pods by using its Scale subresource. optional CrossVersionObjectReference scaleTargetRef = 1; @@ -202,15 +211,15 @@ message HorizontalPodAutoscalerSpec { // metric is configured. Scaling is active as long as at least one metric value is // available. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:ifEnabled(HPAScaleToZero)=+k8s:minimum=0 - // +k8s:alpha(since: "1.36")=+k8s:ifDisabled(HPAScaleToZero)=+k8s:minimum=1 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifEnabled(HPAScaleToZero)=+k8s:minimum=0 + // +k8s:beta(since: "1.37")=+k8s:ifDisabled(HPAScaleToZero)=+k8s:minimum=1 optional int32 minReplicas = 2; // maxReplicas is the upper limit for the number of pods that can be set by the autoscaler; cannot be smaller than MinReplicas. // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:minimum=1 + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:minimum=1 optional int32 maxReplicas = 3; // targetCPUUtilizationPercentage is the target average CPU utilization (represented as a percentage of requested CPU) over all the pods; @@ -461,8 +470,9 @@ message ResourceMetricStatus { // Scale represents a scaling request for a resource. message Scale { - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. @@ -478,9 +488,9 @@ message Scale { message ScaleSpec { // replicas is the desired number of instances for the scaled object. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +default=0 - // +k8s:alpha(since: "1.36")=+k8s:minimum=0 + // +k8s:beta(since: "1.37")=+k8s:minimum=0 optional int32 replicas = 1; } diff --git a/vendor/k8s.io/api/autoscaling/v1/types.go b/vendor/k8s.io/api/autoscaling/v1/types.go index 97222afc08..5554e62713 100644 --- a/vendor/k8s.io/api/autoscaling/v1/types.go +++ b/vendor/k8s.io/api/autoscaling/v1/types.go @@ -26,9 +26,11 @@ import ( // +structType=atomic type CrossVersionObjectReference struct { // kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + // +k8s:alpha(since: "1.37")=+k8s:required Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"` // name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + // +k8s:alpha(since: "1.37")=+k8s:required Name string `json:"name" protobuf:"bytes,2,opt,name=name"` // apiVersion is the API version of the referent @@ -38,7 +40,7 @@ type CrossVersionObjectReference struct { // specification of a horizontal pod autoscaler. type HorizontalPodAutoscalerSpec struct { - // reference to scaled resource; horizontal pod autoscaler will learn the current resource consumption + // scaleTargetRef is the reference to scaled resource; horizontal pod autoscaler will learn the current resource consumption // and will set the desired number of pods by using its Scale subresource. ScaleTargetRef CrossVersionObjectReference `json:"scaleTargetRef" protobuf:"bytes,1,opt,name=scaleTargetRef"` // minReplicas is the lower limit for the number of replicas to which the autoscaler @@ -47,15 +49,15 @@ type HorizontalPodAutoscalerSpec struct { // metric is configured. Scaling is active as long as at least one metric value is // available. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:ifEnabled(HPAScaleToZero)=+k8s:minimum=0 - // +k8s:alpha(since: "1.36")=+k8s:ifDisabled(HPAScaleToZero)=+k8s:minimum=1 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifEnabled(HPAScaleToZero)=+k8s:minimum=0 + // +k8s:beta(since: "1.37")=+k8s:ifDisabled(HPAScaleToZero)=+k8s:minimum=1 MinReplicas *int32 `json:"minReplicas,omitempty" protobuf:"varint,2,opt,name=minReplicas"` // maxReplicas is the upper limit for the number of pods that can be set by the autoscaler; cannot be smaller than MinReplicas. // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:minimum=1 + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:minimum=1 MaxReplicas int32 `json:"maxReplicas" protobuf:"varint,3,opt,name=maxReplicas"` // targetCPUUtilizationPercentage is the target average CPU utilization (represented as a percentage of requested CPU) over all the pods; @@ -92,9 +94,10 @@ type HorizontalPodAutoscalerStatus struct { // +k8s:prerelease-lifecycle-gen:introduced=1.2 // configuration of a horizontal pod autoscaler. +// +k8s:supportsSubresource="/status" type HorizontalPodAutoscaler struct { - metav1.TypeMeta `json:",inline"` - // Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -112,7 +115,7 @@ type HorizontalPodAutoscaler struct { // list of horizontal pod autoscaler objects. type HorizontalPodAutoscalerList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -127,9 +130,10 @@ type HorizontalPodAutoscalerList struct { // Scale represents a scaling request for a resource. type Scale struct { - metav1.TypeMeta `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. @@ -145,9 +149,9 @@ type Scale struct { type ScaleSpec struct { // replicas is the desired number of instances for the scaled object. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +default=0 - // +k8s:alpha(since: "1.36")=+k8s:minimum=0 + // +k8s:beta(since: "1.37")=+k8s:minimum=0 Replicas int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` } @@ -440,6 +444,12 @@ type HorizontalPodAutoscalerCondition struct { // the transition // +optional Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` + + // observedGeneration represents the .metadata.generation that the condition was set based upon. + // For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + // with respect to the current state of the instance. + // +optional + ObservedGeneration *int64 `json:"observedGeneration,omitempty" protobuf:"varint,6,opt,name=observedGeneration"` } // ObjectMetricStatus indicates the current value of a metric describing a diff --git a/vendor/k8s.io/api/autoscaling/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/autoscaling/v1/types_swagger_doc_generated.go index ba43d06c10..4132f42d68 100644 --- a/vendor/k8s.io/api/autoscaling/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/autoscaling/v1/types_swagger_doc_generated.go @@ -88,7 +88,7 @@ func (ExternalMetricStatus) SwaggerDoc() map[string]string { var map_HorizontalPodAutoscaler = map[string]string{ "": "configuration of a horizontal pod autoscaler.", - "metadata": "Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec defines the behaviour of autoscaler. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.", "status": "status is the current information about the autoscaler.", } @@ -104,6 +104,7 @@ var map_HorizontalPodAutoscalerCondition = map[string]string{ "lastTransitionTime": "lastTransitionTime is the last time the condition transitioned from one status to another", "reason": "reason is the reason for the condition's last transition.", "message": "message is a human-readable explanation containing details about the transition", + "observedGeneration": "observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.", } func (HorizontalPodAutoscalerCondition) SwaggerDoc() map[string]string { @@ -122,7 +123,7 @@ func (HorizontalPodAutoscalerList) SwaggerDoc() map[string]string { var map_HorizontalPodAutoscalerSpec = map[string]string{ "": "specification of a horizontal pod autoscaler.", - "scaleTargetRef": "reference to scaled resource; horizontal pod autoscaler will learn the current resource consumption and will set the desired number of pods by using its Scale subresource.", + "scaleTargetRef": "scaleTargetRef is the reference to scaled resource; horizontal pod autoscaler will learn the current resource consumption and will set the desired number of pods by using its Scale subresource.", "minReplicas": "minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the alpha feature gate HPAScaleToZero is enabled and at least one Object or External metric is configured. Scaling is active as long as at least one metric value is available.", "maxReplicas": "maxReplicas is the upper limit for the number of pods that can be set by the autoscaler; cannot be smaller than MinReplicas.", "targetCPUUtilizationPercentage": "targetCPUUtilizationPercentage is the target average CPU utilization (represented as a percentage of requested CPU) over all the pods; if not specified the default autoscaling policy will be used.", @@ -245,7 +246,7 @@ func (ResourceMetricStatus) SwaggerDoc() map[string]string { var map_Scale = map[string]string{ "": "Scale represents a scaling request for a resource.", - "metadata": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", "spec": "spec defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.", "status": "status is the current status of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. Read-only.", } diff --git a/vendor/k8s.io/api/autoscaling/v1/zz_generated.deepcopy.go b/vendor/k8s.io/api/autoscaling/v1/zz_generated.deepcopy.go index 603e6aa8cb..e0ad1668ce 100644 --- a/vendor/k8s.io/api/autoscaling/v1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/autoscaling/v1/zz_generated.deepcopy.go @@ -180,6 +180,11 @@ func (in *HorizontalPodAutoscaler) DeepCopyObject() runtime.Object { func (in *HorizontalPodAutoscalerCondition) DeepCopyInto(out *HorizontalPodAutoscalerCondition) { *out = *in in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + if in.ObservedGeneration != nil { + in, out := &in.ObservedGeneration, &out.ObservedGeneration + *out = new(int64) + **out = **in + } return } diff --git a/vendor/k8s.io/api/autoscaling/v2/generated.pb.go b/vendor/k8s.io/api/autoscaling/v2/generated.pb.go index 7505c7592f..0f663d46e3 100644 --- a/vendor/k8s.io/api/autoscaling/v2/generated.pb.go +++ b/vendor/k8s.io/api/autoscaling/v2/generated.pb.go @@ -506,6 +506,11 @@ func (m *HorizontalPodAutoscalerCondition) MarshalToSizedBuffer(dAtA []byte) (in _ = i var l int _ = l + if m.ObservedGeneration != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.ObservedGeneration)) + i-- + dAtA[i] = 0x30 + } i -= len(m.Message) copy(dAtA[i:], m.Message) i = encodeVarintGenerated(dAtA, i, uint64(len(m.Message))) @@ -1489,6 +1494,9 @@ func (m *HorizontalPodAutoscalerCondition) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) l = len(m.Message) n += 1 + l + sovGenerated(uint64(l)) + if m.ObservedGeneration != nil { + n += 1 + sovGenerated(uint64(*m.ObservedGeneration)) + } return n } @@ -1892,6 +1900,7 @@ func (this *HorizontalPodAutoscalerCondition) String() string { `LastTransitionTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastTransitionTime), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, `Reason:` + fmt.Sprintf("%v", this.Reason) + `,`, `Message:` + fmt.Sprintf("%v", this.Message) + `,`, + `ObservedGeneration:` + valueToStringGenerated(this.ObservedGeneration) + `,`, `}`, }, "") return s @@ -3524,6 +3533,26 @@ func (m *HorizontalPodAutoscalerCondition) Unmarshal(dAtA []byte) error { } m.Message = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ObservedGeneration", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ObservedGeneration = &v default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/vendor/k8s.io/api/autoscaling/v2/generated.proto b/vendor/k8s.io/api/autoscaling/v2/generated.proto index f56b8c749d..d9a31f941a 100644 --- a/vendor/k8s.io/api/autoscaling/v2/generated.proto +++ b/vendor/k8s.io/api/autoscaling/v2/generated.proto @@ -67,9 +67,11 @@ message ContainerResourceMetricStatus { // CrossVersionObjectReference contains enough information to let you identify the referred resource. message CrossVersionObjectReference { // kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + // +k8s:alpha(since: "1.37")=+k8s:required optional string kind = 1; // name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + // +k8s:alpha(since: "1.37")=+k8s:required optional string name = 2; // apiVersion is the API version of the referent @@ -122,8 +124,7 @@ message HPAScalingPolicy { // window is chosen. // // The tolerance is applied to the metric values and prevents scaling too -// eagerly for small metric variations. (Note that setting a tolerance requires -// the beta HPAConfigurableTolerance feature gate to be enabled.) +// eagerly for small metric variations. message HPAScalingRules { // stabilizationWindowSeconds is the number of seconds for which past recommendations should be // considered while scaling up or scaling down. @@ -156,9 +157,6 @@ message HPAScalingRules { // and scale-down and scale-up tolerances of 5% and 1% respectively, scaling will be // triggered when the actual consumption falls below 95Mi or exceeds 101Mi. // - // This is an beta field and requires the HPAConfigurableTolerance feature - // gate to be enabled. - // // +featureGate=HPAConfigurableTolerance // +optional optional .k8s.io.apimachinery.pkg.api.resource.Quantity tolerance = 4; @@ -167,6 +165,7 @@ message HPAScalingRules { // HorizontalPodAutoscaler is the configuration for a horizontal pod // autoscaler, which automatically manages the replica count of any resource // implementing the scale subresource based on the metrics specified. +// +k8s:supportsSubresource="/status" message HorizontalPodAutoscaler { // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -224,6 +223,12 @@ message HorizontalPodAutoscalerCondition { // the transition // +optional optional string message = 5; + + // observedGeneration represents the .metadata.generation that the condition was set based upon. + // For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + // with respect to the current state of the instance. + // +optional + optional int64 observedGeneration = 6; } // HorizontalPodAutoscalerList is a list of horizontal pod autoscaler objects. @@ -248,16 +253,16 @@ message HorizontalPodAutoscalerSpec { // metric is configured. Scaling is active as long as at least one metric value is // available. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:ifEnabled(HPAScaleToZero)=+k8s:minimum=0 - // +k8s:alpha(since: "1.36")=+k8s:ifDisabled(HPAScaleToZero)=+k8s:minimum=1 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifEnabled(HPAScaleToZero)=+k8s:minimum=0 + // +k8s:beta(since: "1.37")=+k8s:ifDisabled(HPAScaleToZero)=+k8s:minimum=1 optional int32 minReplicas = 2; // maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. // It cannot be less that minReplicas. // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:minimum=1 + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:minimum=1 optional int32 maxReplicas = 3; // metrics contains the specifications for which to use to calculate the @@ -270,6 +275,7 @@ message HorizontalPodAutoscalerSpec { // If not set, the default metric will be set to 80% average CPU utilization. // +listType=atomic // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional repeated MetricSpec metrics = 4; // behavior configures the scaling behavior of the target @@ -302,6 +308,7 @@ message HorizontalPodAutoscalerStatus { // currentMetrics is the last read state of the metrics used by this autoscaler. // +listType=atomic // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional repeated MetricStatus currentMetrics = 5; // conditions is the set of conditions required for this autoscaler to scale its target, @@ -336,6 +343,8 @@ message MetricSpec { // object refers to a metric describing a single kubernetes object // (for example, hits-per-second on an Ingress object). // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:opaqueType optional ObjectMetricSource object = 2; // pods refers to a metric describing each pod in the current scale target @@ -378,6 +387,8 @@ message MetricStatus { // object refers to a metric describing a single kubernetes object // (for example, hits-per-second on an Ingress object). // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:opaqueType optional ObjectMetricStatus object = 2; // pods refers to a metric describing each pod in the current scale target @@ -394,7 +405,7 @@ message MetricStatus { // +optional optional ResourceMetricStatus resource = 4; - // container resource refers to a resource metric (such as those specified in + // containerResource refers to a resource metric (such as those specified in // requests and limits) known to Kubernetes describing a single container in each pod in the // current scale target (e.g. CPU or memory). Such metrics are built in to // Kubernetes, and have special scaling options on top of those available @@ -444,7 +455,7 @@ message MetricValueStatus { // +optional optional .k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 2; - // currentAverageUtilization is the current value of the average of the + // averageUtilization is the current value of the average of the // resource metric across all relevant pods, represented as a percentage of // the requested value of the resource for the pods. // +optional @@ -473,7 +484,7 @@ message ObjectMetricStatus { // current contains the current value for the given metric optional MetricValueStatus current = 2; - // DescribedObject specifies the descriptions of a object,such as kind,name apiVersion + // describedObject specifies the descriptions of a object,such as kind,name apiVersion optional CrossVersionObjectReference describedObject = 3; } diff --git a/vendor/k8s.io/api/autoscaling/v2/types.go b/vendor/k8s.io/api/autoscaling/v2/types.go index ad10169a01..49c9e751c2 100644 --- a/vendor/k8s.io/api/autoscaling/v2/types.go +++ b/vendor/k8s.io/api/autoscaling/v2/types.go @@ -31,8 +31,9 @@ import ( // HorizontalPodAutoscaler is the configuration for a horizontal pod // autoscaler, which automatically manages the replica count of any resource // implementing the scale subresource based on the metrics specified. +// +k8s:supportsSubresource="/status" type HorizontalPodAutoscaler struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -59,16 +60,16 @@ type HorizontalPodAutoscalerSpec struct { // metric is configured. Scaling is active as long as at least one metric value is // available. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:ifEnabled(HPAScaleToZero)=+k8s:minimum=0 - // +k8s:alpha(since: "1.36")=+k8s:ifDisabled(HPAScaleToZero)=+k8s:minimum=1 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifEnabled(HPAScaleToZero)=+k8s:minimum=0 + // +k8s:beta(since: "1.37")=+k8s:ifDisabled(HPAScaleToZero)=+k8s:minimum=1 MinReplicas *int32 `json:"minReplicas,omitempty" protobuf:"varint,2,opt,name=minReplicas"` // maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. // It cannot be less that minReplicas. // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:minimum=1 + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:minimum=1 MaxReplicas int32 `json:"maxReplicas" protobuf:"varint,3,opt,name=maxReplicas"` // metrics contains the specifications for which to use to calculate the @@ -81,6 +82,7 @@ type HorizontalPodAutoscalerSpec struct { // If not set, the default metric will be set to 80% average CPU utilization. // +listType=atomic // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional Metrics []MetricSpec `json:"metrics,omitempty" protobuf:"bytes,4,rep,name=metrics"` // behavior configures the scaling behavior of the target @@ -93,9 +95,11 @@ type HorizontalPodAutoscalerSpec struct { // CrossVersionObjectReference contains enough information to let you identify the referred resource. type CrossVersionObjectReference struct { // kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + // +k8s:alpha(since: "1.37")=+k8s:required Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"` // name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + // +k8s:alpha(since: "1.37")=+k8s:required Name string `json:"name" protobuf:"bytes,2,opt,name=name"` // apiVersion is the API version of the referent @@ -113,6 +117,8 @@ type MetricSpec struct { // object refers to a metric describing a single kubernetes object // (for example, hits-per-second on an Ingress object). // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:opaqueType Object *ObjectMetricSource `json:"object,omitempty" protobuf:"bytes,2,opt,name=object"` // pods refers to a metric describing each pod in the current scale target @@ -187,8 +193,7 @@ const ( // window is chosen. // // The tolerance is applied to the metric values and prevents scaling too -// eagerly for small metric variations. (Note that setting a tolerance requires -// the beta HPAConfigurableTolerance feature gate to be enabled.) +// eagerly for small metric variations. type HPAScalingRules struct { // stabilizationWindowSeconds is the number of seconds for which past recommendations should be // considered while scaling up or scaling down. @@ -221,9 +226,6 @@ type HPAScalingRules struct { // and scale-down and scale-up tolerances of 5% and 1% respectively, scaling will be // triggered when the actual consumption falls below 95Mi or exceeds 101Mi. // - // This is an beta field and requires the HPAConfigurableTolerance feature - // gate to be enabled. - // // +featureGate=HPAConfigurableTolerance // +optional Tolerance *resource.Quantity `json:"tolerance,omitempty" protobuf:"bytes,4,opt,name=tolerance"` @@ -424,6 +426,7 @@ type HorizontalPodAutoscalerStatus struct { // currentMetrics is the last read state of the metrics used by this autoscaler. // +listType=atomic // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional CurrentMetrics []MetricStatus `json:"currentMetrics" protobuf:"bytes,5,rep,name=currentMetrics"` // conditions is the set of conditions required for this autoscaler to scale its target, @@ -476,6 +479,12 @@ type HorizontalPodAutoscalerCondition struct { // the transition // +optional Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` + + // observedGeneration represents the .metadata.generation that the condition was set based upon. + // For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + // with respect to the current state of the instance. + // +optional + ObservedGeneration *int64 `json:"observedGeneration,omitempty" protobuf:"varint,6,opt,name=observedGeneration"` } // MetricStatus describes the last-read state of a single metric. @@ -487,6 +496,8 @@ type MetricStatus struct { // object refers to a metric describing a single kubernetes object // (for example, hits-per-second on an Ingress object). // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:opaqueType Object *ObjectMetricStatus `json:"object,omitempty" protobuf:"bytes,2,opt,name=object"` // pods refers to a metric describing each pod in the current scale target @@ -503,7 +514,7 @@ type MetricStatus struct { // +optional Resource *ResourceMetricStatus `json:"resource,omitempty" protobuf:"bytes,4,opt,name=resource"` - // container resource refers to a resource metric (such as those specified in + // containerResource refers to a resource metric (such as those specified in // requests and limits) known to Kubernetes describing a single container in each pod in the // current scale target (e.g. CPU or memory). Such metrics are built in to // Kubernetes, and have special scaling options on top of those available @@ -529,7 +540,7 @@ type ObjectMetricStatus struct { // current contains the current value for the given metric Current MetricValueStatus `json:"current" protobuf:"bytes,2,name=current"` - // DescribedObject specifies the descriptions of a object,such as kind,name apiVersion + // describedObject specifies the descriptions of a object,such as kind,name apiVersion DescribedObject CrossVersionObjectReference `json:"describedObject" protobuf:"bytes,3,name=describedObject"` } @@ -593,7 +604,7 @@ type MetricValueStatus struct { // +optional AverageValue *resource.Quantity `json:"averageValue,omitempty" protobuf:"bytes,2,opt,name=averageValue"` - // currentAverageUtilization is the current value of the average of the + // averageUtilization is the current value of the average of the // resource metric across all relevant pods, represented as a percentage of // the requested value of the resource for the pods. // +optional @@ -605,7 +616,7 @@ type MetricValueStatus struct { // HorizontalPodAutoscalerList is a list of horizontal pod autoscaler objects. type HorizontalPodAutoscalerList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata is the standard list metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/vendor/k8s.io/api/autoscaling/v2/types_swagger_doc_generated.go b/vendor/k8s.io/api/autoscaling/v2/types_swagger_doc_generated.go index af3f3022da..de5a6b3897 100644 --- a/vendor/k8s.io/api/autoscaling/v2/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/autoscaling/v2/types_swagger_doc_generated.go @@ -92,11 +92,11 @@ func (HPAScalingPolicy) SwaggerDoc() map[string]string { } var map_HPAScalingRules = map[string]string{ - "": "HPAScalingRules configures the scaling behavior for one direction via scaling Policy Rules and a configurable metric tolerance.\n\nScaling Policy Rules are applied after calculating DesiredReplicas from metrics for the HPA. They can limit the scaling velocity by specifying scaling policies. They can prevent flapping by specifying the stabilization window, so that the number of replicas is not set instantly, instead, the safest value from the stabilization window is chosen.\n\nThe tolerance is applied to the metric values and prevents scaling too eagerly for small metric variations. (Note that setting a tolerance requires the beta HPAConfigurableTolerance feature gate to be enabled.)", + "": "HPAScalingRules configures the scaling behavior for one direction via scaling Policy Rules and a configurable metric tolerance.\n\nScaling Policy Rules are applied after calculating DesiredReplicas from metrics for the HPA. They can limit the scaling velocity by specifying scaling policies. They can prevent flapping by specifying the stabilization window, so that the number of replicas is not set instantly, instead, the safest value from the stabilization window is chosen.\n\nThe tolerance is applied to the metric values and prevents scaling too eagerly for small metric variations.", "stabilizationWindowSeconds": "stabilizationWindowSeconds is the number of seconds for which past recommendations should be considered while scaling up or scaling down. StabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour). If not set, use the default values: - For scale up: 0 (i.e. no stabilization is done). - For scale down: 300 (i.e. the stabilization window is 300 seconds long).", "selectPolicy": "selectPolicy is used to specify which policy should be used. If not set, the default value Max is used.", "policies": "policies is a list of potential scaling polices which can be used during scaling. If not set, use the default values: - For scale up: allow doubling the number of pods, or an absolute change of 4 pods in a 15s window. - For scale down: allow all pods to be removed in a 15s window.", - "tolerance": "tolerance is the tolerance on the ratio between the current and desired metric value under which no updates are made to the desired number of replicas (e.g. 0.01 for 1%). Must be greater than or equal to zero. If not set, the default cluster-wide tolerance is applied (by default 10%).\n\nFor example, if autoscaling is configured with a memory consumption target of 100Mi, and scale-down and scale-up tolerances of 5% and 1% respectively, scaling will be triggered when the actual consumption falls below 95Mi or exceeds 101Mi.\n\nThis is an beta field and requires the HPAConfigurableTolerance feature gate to be enabled.", + "tolerance": "tolerance is the tolerance on the ratio between the current and desired metric value under which no updates are made to the desired number of replicas (e.g. 0.01 for 1%). Must be greater than or equal to zero. If not set, the default cluster-wide tolerance is applied (by default 10%).\n\nFor example, if autoscaling is configured with a memory consumption target of 100Mi, and scale-down and scale-up tolerances of 5% and 1% respectively, scaling will be triggered when the actual consumption falls below 95Mi or exceeds 101Mi.", } func (HPAScalingRules) SwaggerDoc() map[string]string { @@ -131,6 +131,7 @@ var map_HorizontalPodAutoscalerCondition = map[string]string{ "lastTransitionTime": "lastTransitionTime is the last time the condition transitioned from one status to another", "reason": "reason is the reason for the condition's last transition.", "message": "message is a human-readable explanation containing details about the transition", + "observedGeneration": "observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.", } func (HorizontalPodAutoscalerCondition) SwaggerDoc() map[string]string { @@ -204,7 +205,7 @@ var map_MetricStatus = map[string]string{ "object": "object refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object).", "pods": "pods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value.", "resource": "resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.", - "containerResource": "container resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.", + "containerResource": "containerResource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.", "external": "external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).", } @@ -228,7 +229,7 @@ var map_MetricValueStatus = map[string]string{ "": "MetricValueStatus holds the current value for a metric", "value": "value is the current value of the metric (as a quantity).", "averageValue": "averageValue is the current value of the average of the metric across all relevant pods (as a quantity)", - "averageUtilization": "currentAverageUtilization is the current value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods.", + "averageUtilization": "averageUtilization is the current value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods.", } func (MetricValueStatus) SwaggerDoc() map[string]string { @@ -250,7 +251,7 @@ var map_ObjectMetricStatus = map[string]string{ "": "ObjectMetricStatus indicates the current value of a metric describing a kubernetes object (for example, hits-per-second on an Ingress object).", "metric": "metric identifies the target metric by name and selector", "current": "current contains the current value for the given metric", - "describedObject": "DescribedObject specifies the descriptions of a object,such as kind,name apiVersion", + "describedObject": "describedObject specifies the descriptions of a object,such as kind,name apiVersion", } func (ObjectMetricStatus) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/autoscaling/v2/zz_generated.deepcopy.go b/vendor/k8s.io/api/autoscaling/v2/zz_generated.deepcopy.go index 5fbcf9f807..ace4fa2fd3 100644 --- a/vendor/k8s.io/api/autoscaling/v2/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/autoscaling/v2/zz_generated.deepcopy.go @@ -222,6 +222,11 @@ func (in *HorizontalPodAutoscalerBehavior) DeepCopy() *HorizontalPodAutoscalerBe func (in *HorizontalPodAutoscalerCondition) DeepCopyInto(out *HorizontalPodAutoscalerCondition) { *out = *in in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + if in.ObservedGeneration != nil { + in, out := &in.ObservedGeneration, &out.ObservedGeneration + *out = new(int64) + **out = **in + } return } diff --git a/vendor/k8s.io/api/batch/v1/generated.pb.go b/vendor/k8s.io/api/batch/v1/generated.pb.go index 099350e734..7c086a41c2 100644 --- a/vendor/k8s.io/api/batch/v1/generated.pb.go +++ b/vendor/k8s.io/api/batch/v1/generated.pb.go @@ -26,6 +26,7 @@ import ( k8s_io_api_core_v1 "k8s.io/api/core/v1" v11 "k8s.io/api/core/v1" + v1alpha3 "k8s.io/api/scheduling/v1alpha3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" math_bits "math/bits" @@ -49,6 +50,8 @@ func (m *JobCondition) Reset() { *m = JobCondition{} } func (m *JobList) Reset() { *m = JobList{} } +func (m *JobSchedulingConfiguration) Reset() { *m = JobSchedulingConfiguration{} } + func (m *JobSpec) Reset() { *m = JobSpec{} } func (m *JobStatus) Reset() { *m = JobStatus{} } @@ -472,6 +475,79 @@ func (m *JobList) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *JobSchedulingConfiguration) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *JobSchedulingConfiguration) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *JobSchedulingConfiguration) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ResourceClaims) > 0 { + for iNdEx := len(m.ResourceClaims) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ResourceClaims[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.DisruptionMode != nil { + { + size, err := m.DisruptionMode.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.SchedulingConstraints != nil { + { + size, err := m.SchedulingConstraints.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.SchedulingPolicy != nil { + { + size, err := m.SchedulingPolicy.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *JobSpec) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -492,6 +568,20 @@ func (m *JobSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Scheduling != nil { + { + size, err := m.Scheduling.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x8a + } if m.SuccessPolicy != nil { { size, err := m.SuccessPolicy.MarshalToSizedBuffer(dAtA[:i]) @@ -1195,6 +1285,33 @@ func (m *JobList) Size() (n int) { return n } +func (m *JobSchedulingConfiguration) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SchedulingPolicy != nil { + l = m.SchedulingPolicy.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.SchedulingConstraints != nil { + l = m.SchedulingConstraints.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.DisruptionMode != nil { + l = m.DisruptionMode.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.ResourceClaims) > 0 { + for _, e := range m.ResourceClaims { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + func (m *JobSpec) Size() (n int) { if m == nil { return 0 @@ -1254,6 +1371,10 @@ func (m *JobSpec) Size() (n int) { l = m.SuccessPolicy.Size() n += 2 + l + sovGenerated(uint64(l)) } + if m.Scheduling != nil { + l = m.Scheduling.Size() + n += 2 + l + sovGenerated(uint64(l)) + } return n } @@ -1544,6 +1665,24 @@ func (this *JobList) String() string { }, "") return s } +func (this *JobSchedulingConfiguration) String() string { + if this == nil { + return "nil" + } + repeatedStringForResourceClaims := "[]WorkloadPodGroupResourceClaim{" + for _, f := range this.ResourceClaims { + repeatedStringForResourceClaims += fmt.Sprintf("%v", f) + "," + } + repeatedStringForResourceClaims += "}" + s := strings.Join([]string{`&JobSchedulingConfiguration{`, + `SchedulingPolicy:` + strings.Replace(fmt.Sprintf("%v", this.SchedulingPolicy), "WorkloadPodGroupSchedulingPolicy", "v1alpha3.WorkloadPodGroupSchedulingPolicy", 1) + `,`, + `SchedulingConstraints:` + strings.Replace(fmt.Sprintf("%v", this.SchedulingConstraints), "WorkloadPodGroupSchedulingConstraints", "v1alpha3.WorkloadPodGroupSchedulingConstraints", 1) + `,`, + `DisruptionMode:` + strings.Replace(fmt.Sprintf("%v", this.DisruptionMode), "WorkloadPodGroupDisruptionMode", "v1alpha3.WorkloadPodGroupDisruptionMode", 1) + `,`, + `ResourceClaims:` + repeatedStringForResourceClaims + `,`, + `}`, + }, "") + return s +} func (this *JobSpec) String() string { if this == nil { return "nil" @@ -1565,6 +1704,7 @@ func (this *JobSpec) String() string { `PodReplacementPolicy:` + valueToStringGenerated(this.PodReplacementPolicy) + `,`, `ManagedBy:` + valueToStringGenerated(this.ManagedBy) + `,`, `SuccessPolicy:` + strings.Replace(this.SuccessPolicy.String(), "SuccessPolicy", "SuccessPolicy", 1) + `,`, + `Scheduling:` + strings.Replace(this.Scheduling.String(), "JobSchedulingConfiguration", "JobSchedulingConfiguration", 1) + `,`, `}`, }, "") return s @@ -2898,6 +3038,198 @@ func (m *JobList) Unmarshal(dAtA []byte) error { } return nil } +func (m *JobSchedulingConfiguration) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: JobSchedulingConfiguration: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: JobSchedulingConfiguration: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingPolicy", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SchedulingPolicy == nil { + m.SchedulingPolicy = &v1alpha3.WorkloadPodGroupSchedulingPolicy{} + } + if err := m.SchedulingPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingConstraints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SchedulingConstraints == nil { + m.SchedulingConstraints = &v1alpha3.WorkloadPodGroupSchedulingConstraints{} + } + if err := m.SchedulingConstraints.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisruptionMode", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DisruptionMode == nil { + m.DisruptionMode = &v1alpha3.WorkloadPodGroupDisruptionMode{} + } + if err := m.DisruptionMode.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaims", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceClaims = append(m.ResourceClaims, v1alpha3.WorkloadPodGroupResourceClaim{}) + if err := m.ResourceClaims[len(m.ResourceClaims)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *JobSpec) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3349,6 +3681,42 @@ func (m *JobSpec) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 17: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Scheduling", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Scheduling == nil { + m.Scheduling = &JobSchedulingConfiguration{} + } + if err := m.Scheduling.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/vendor/k8s.io/api/batch/v1/generated.proto b/vendor/k8s.io/api/batch/v1/generated.proto index 5c35012852..da24d6d939 100644 --- a/vendor/k8s.io/api/batch/v1/generated.proto +++ b/vendor/k8s.io/api/batch/v1/generated.proto @@ -22,6 +22,7 @@ syntax = "proto2"; package k8s.io.api.batch.v1; import "k8s.io/api/core/v1/generated.proto"; +import "k8s.io/api/scheduling/v1alpha3/generated.proto"; import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; import "k8s.io/apimachinery/pkg/runtime/generated.proto"; import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; @@ -30,6 +31,7 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; option go_package = "k8s.io/api/batch/v1"; // CronJob represents the configuration of a single cron job. +// +k8s:supportsSubresource="/status" message CronJob { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -62,7 +64,7 @@ message CronJobList { message CronJobSpec { // The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string schedule = 1; // The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. @@ -127,6 +129,7 @@ message CronJobStatus { } // Job represents the configuration of a single job. +// +k8s:supportsSubresource="/status" message Job { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -180,6 +183,62 @@ message JobList { repeated Job items = 2; } +// JobSchedulingConfiguration composes the reusable workload-aware +// scheduling building blocks. +message JobSchedulingConfiguration { + // SchedulingPolicy defines the scheduling policy for this Job. + // Exactly one of Basic or Gang must be set. + // This field is immutable after creation: the policy may not be added or + // removed. The policy variant (basic/gang) is frozen by hand-written + // validation; only schedulingPolicy.gang.minCount may be changed. + // + // +optional + // +k8s:optional + // +k8s:update=NoSet + // +k8s:update=NoUnset + optional .k8s.io.api.scheduling.v1alpha3.WorkloadPodGroupSchedulingPolicy schedulingPolicy = 1; + + // SchedulingConstraints defines scheduling constraints (e.g. topology) + // for the Job's pods. + // This field is immutable after creation. + // + // +optional + // +k8s:optional + // +k8s:immutable + optional .k8s.io.api.scheduling.v1alpha3.WorkloadPodGroupSchedulingConstraints schedulingConstraints = 2; + + // DisruptionMode defines the mode in which the Job's pods can be disrupted. + // One of Single, All. + // This field is immutable after creation: it may not be added or removed, + // and the selected mode may not be changed. + // + // +optional + // +k8s:optional + // +k8s:immutable + optional .k8s.io.api.scheduling.v1alpha3.WorkloadPodGroupDisruptionMode disruptionMode = 3; + + // ResourceClaims defines which ResourceClaims may be shared among Pods in + // the Job. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // At most 4 claims may be set, matching the limit on the resulting PodGroup. + // This list is immutable after creation: entries may neither be added, + // removed, nor modified. + // + // +optional + // +patchMergeKey=name + // +patchStrategy=merge + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +k8s:immutable + repeated .k8s.io.api.scheduling.v1alpha3.WorkloadPodGroupResourceClaim resourceClaims = 4; +} + // JobSpec describes how the job execution will look like. message JobSpec { // Specifies the maximum desired number of pods the job should @@ -251,6 +310,8 @@ message JobSpec { // It can be null or up to completions. It is required and must be // less than or equal to 10^4 when is completions greater than 10^5. // +optional + // +k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:dependentRequired("backoffLimitPerIndex") optional int32 maxFailedIndexes = 13; // A label query over pods that should match the pod count. @@ -346,6 +407,23 @@ message JobSpec { // This field is immutable. // +optional optional string managedBy = 15; + + // scheduling defines the Workload-aware Scheduling configuration for this Job. + // When set, it specifies the scheduling policy (basic or gang), topology + // constraints, disruption mode, and shared resource claims. + // When omitted, the Job defaults to the basic scheduling policy, which behaves + // as standard pod-by-pod scheduling. + // This field is alpha-level and requires the WorkloadWithJob feature gate. + // This field is immutable, including whether it is set at all, only + // policy.gang.minCount may be changed after creation. + // + // +featureGate=WorkloadWithJob + // +optional + // +k8s:ifDisabled(WorkloadWithJob)=+k8s:forbidden + // +k8s:optional + // +k8s:update=NoSet + // +k8s:update=NoUnset + optional JobSchedulingConfiguration scheduling = 17; } // JobStatus represents the current state of a Job. @@ -408,9 +486,6 @@ message JobStatus { // The number of pods which are terminating (in phase Pending or Running // and have a deletionTimestamp). - // - // This field is beta-level. The job controller populates the field when - // the feature gate JobPodReplacementPolicy is enabled (enabled by default). // +optional optional int32 terminating = 11; @@ -465,6 +540,7 @@ message JobTemplateSpec { // Standard object's metadata of the jobs created from this template. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Specification of the desired behavior of the job. diff --git a/vendor/k8s.io/api/batch/v1/types.go b/vendor/k8s.io/api/batch/v1/types.go index d4894e2ef6..8e35cb228f 100644 --- a/vendor/k8s.io/api/batch/v1/types.go +++ b/vendor/k8s.io/api/batch/v1/types.go @@ -18,6 +18,7 @@ package v1 import ( corev1 "k8s.io/api/core/v1" + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" ) @@ -66,8 +67,9 @@ const ( // +k8s:prerelease-lifecycle-gen:introduced=1.2 // Job represents the configuration of a single job. +// +k8s:supportsSubresource="/status" type Job struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -89,7 +91,7 @@ type Job struct { // JobList is a collection of jobs. type JobList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -371,6 +373,8 @@ type JobSpec struct { // It can be null or up to completions. It is required and must be // less than or equal to 10^4 when is completions greater than 10^5. // +optional + // +k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:dependentRequired("backoffLimitPerIndex") MaxFailedIndexes *int32 `json:"maxFailedIndexes,omitempty" protobuf:"varint,13,opt,name=maxFailedIndexes"` // TODO enabled it when https://github.com/kubernetes/kubernetes/issues/28486 has been fixed @@ -471,6 +475,79 @@ type JobSpec struct { // This field is immutable. // +optional ManagedBy *string `json:"managedBy,omitempty" protobuf:"bytes,15,opt,name=managedBy"` + + // scheduling defines the Workload-aware Scheduling configuration for this Job. + // When set, it specifies the scheduling policy (basic or gang), topology + // constraints, disruption mode, and shared resource claims. + // When omitted, the Job defaults to the basic scheduling policy, which behaves + // as standard pod-by-pod scheduling. + // This field is alpha-level and requires the WorkloadWithJob feature gate. + // This field is immutable, including whether it is set at all, only + // policy.gang.minCount may be changed after creation. + // + // +featureGate=WorkloadWithJob + // +optional + // +k8s:ifDisabled(WorkloadWithJob)=+k8s:forbidden + // +k8s:optional + // +k8s:update=NoSet + // +k8s:update=NoUnset + Scheduling *JobSchedulingConfiguration `json:"scheduling,omitempty" protobuf:"bytes,17,opt,name=scheduling"` +} + +// JobSchedulingConfiguration composes the reusable workload-aware +// scheduling building blocks. +type JobSchedulingConfiguration struct { + // SchedulingPolicy defines the scheduling policy for this Job. + // Exactly one of Basic or Gang must be set. + // This field is immutable after creation: the policy may not be added or + // removed. The policy variant (basic/gang) is frozen by hand-written + // validation; only schedulingPolicy.gang.minCount may be changed. + // + // +optional + // +k8s:optional + // +k8s:update=NoSet + // +k8s:update=NoUnset + SchedulingPolicy *schedulingv1alpha3.WorkloadPodGroupSchedulingPolicy `json:"schedulingPolicy,omitempty" protobuf:"bytes,1,opt,name=schedulingPolicy"` + + // SchedulingConstraints defines scheduling constraints (e.g. topology) + // for the Job's pods. + // This field is immutable after creation. + // + // +optional + // +k8s:optional + // +k8s:immutable + SchedulingConstraints *schedulingv1alpha3.WorkloadPodGroupSchedulingConstraints `json:"schedulingConstraints,omitempty" protobuf:"bytes,2,opt,name=schedulingConstraints"` + + // DisruptionMode defines the mode in which the Job's pods can be disrupted. + // One of Single, All. + // This field is immutable after creation: it may not be added or removed, + // and the selected mode may not be changed. + // + // +optional + // +k8s:optional + // +k8s:immutable + DisruptionMode *schedulingv1alpha3.WorkloadPodGroupDisruptionMode `json:"disruptionMode,omitempty" protobuf:"bytes,3,opt,name=disruptionMode"` + + // ResourceClaims defines which ResourceClaims may be shared among Pods in + // the Job. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // At most 4 claims may be set, matching the limit on the resulting PodGroup. + // This list is immutable after creation: entries may neither be added, + // removed, nor modified. + // + // +optional + // +patchMergeKey=name + // +patchStrategy=merge + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +k8s:immutable + ResourceClaims []schedulingv1alpha3.WorkloadPodGroupResourceClaim `json:"resourceClaims,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,4,rep,name=resourceClaims"` } // JobStatus represents the current state of a Job. @@ -533,9 +610,6 @@ type JobStatus struct { // The number of pods which are terminating (in phase Pending or Running // and have a deletionTimestamp). - // - // This field is beta-level. The job controller populates the field when - // the feature gate JobPodReplacementPolicy is enabled (enabled by default). // +optional Terminating *int32 `json:"terminating,omitempty" protobuf:"varint,11,opt,name=terminating"` @@ -626,10 +700,8 @@ const ( // JobReasponDeadlineExceeded means job duration is past ActiveDeadline JobReasonDeadlineExceeded string = "DeadlineExceeded" // JobReasonMaxFailedIndexesExceeded indicates that an indexed of a job failed - // This const is used in beta-level feature: https://kep.k8s.io/3850. JobReasonMaxFailedIndexesExceeded string = "MaxFailedIndexesExceeded" // JobReasonFailedIndexes means Job has failed indexes. - // This const is used in beta-level feature: https://kep.k8s.io/3850. JobReasonFailedIndexes string = "FailedIndexes" // JobReasonSuccessPolicy reason indicates a SuccessCriteriaMet condition is added due to // a Job met successPolicy. @@ -664,6 +736,7 @@ type JobTemplateSpec struct { // Standard object's metadata of the jobs created from this template. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Specification of the desired behavior of the job. @@ -677,8 +750,9 @@ type JobTemplateSpec struct { // +k8s:prerelease-lifecycle-gen:introduced=1.21 // CronJob represents the configuration of a single cron job. +// +k8s:supportsSubresource="/status" type CronJob struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -700,7 +774,7 @@ type CronJob struct { // CronJobList is a collection of cron jobs. type CronJobList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -716,7 +790,7 @@ type CronJobSpec struct { // The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Schedule string `json:"schedule" protobuf:"bytes,1,opt,name=schedule"` // The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. diff --git a/vendor/k8s.io/api/batch/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/batch/v1/types_swagger_doc_generated.go index 267df42926..ddf64555a4 100644 --- a/vendor/k8s.io/api/batch/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/batch/v1/types_swagger_doc_generated.go @@ -110,6 +110,18 @@ func (JobList) SwaggerDoc() map[string]string { return map_JobList } +var map_JobSchedulingConfiguration = map[string]string{ + "": "JobSchedulingConfiguration composes the reusable workload-aware scheduling building blocks.", + "schedulingPolicy": "SchedulingPolicy defines the scheduling policy for this Job. Exactly one of Basic or Gang must be set. This field is immutable after creation: the policy may not be added or removed. The policy variant (basic/gang) is frozen by hand-written validation; only schedulingPolicy.gang.minCount may be changed.", + "schedulingConstraints": "SchedulingConstraints defines scheduling constraints (e.g. topology) for the Job's pods. This field is immutable after creation.", + "disruptionMode": "DisruptionMode defines the mode in which the Job's pods can be disrupted. One of Single, All. This field is immutable after creation: it may not be added or removed, and the selected mode may not be changed.", + "resourceClaims": "ResourceClaims defines which ResourceClaims may be shared among Pods in the Job. Pods consume the devices allocated to a PodGroup's claim by defining a claim in its own Spec.ResourceClaims that matches the PodGroup's claim exactly. The claim must have the same name and refer to the same ResourceClaim or ResourceClaimTemplate. At most 4 claims may be set, matching the limit on the resulting PodGroup. This list is immutable after creation: entries may neither be added, removed, nor modified.", +} + +func (JobSchedulingConfiguration) SwaggerDoc() map[string]string { + return map_JobSchedulingConfiguration +} + var map_JobSpec = map[string]string{ "": "JobSpec describes how the job execution will look like.", "parallelism": "Specifies the maximum desired number of pods the job should run at any given time. The actual number of pods running in steady state will be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism), i.e. when the work left to do is less than max parallelism. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/", @@ -128,6 +140,7 @@ var map_JobSpec = map[string]string{ "suspend": "suspend specifies whether the Job controller should create Pods or not. If a Job is created with suspend set to true, no Pods are created by the Job controller. If a Job is suspended after creation (i.e. the flag goes from false to true), the Job controller will delete all active Pods associated with this Job. Users must design their workload to gracefully handle this. Suspending a Job will reset the StartTime field of the Job, effectively resetting the ActiveDeadlineSeconds timer too. Defaults to false.", "podReplacementPolicy": "podReplacementPolicy specifies when to create replacement Pods. Possible values are: - TerminatingOrFailed means that we recreate pods\n when they are terminating (has a metadata.deletionTimestamp) or failed.\n- Failed means to wait until a previously created Pod is fully terminated (has phase\n Failed or Succeeded) before creating a replacement Pod.\n\nWhen using podFailurePolicy, Failed is the the only allowed value. TerminatingOrFailed and Failed are allowed values when podFailurePolicy is not in use.", "managedBy": "ManagedBy field indicates the controller that manages a Job. The k8s Job controller reconciles jobs which don't have this field at all or the field value is the reserved string `kubernetes.io/job-controller`, but skips reconciling Jobs with a custom value for this field. The value must be a valid domain-prefixed path (e.g. acme.io/foo) - all characters before the first \"/\" must be a valid subdomain as defined by RFC 1123. All characters trailing the first \"/\" must be valid HTTP Path characters as defined by RFC 3986. The value cannot exceed 63 characters. This field is immutable.", + "scheduling": "scheduling defines the Workload-aware Scheduling configuration for this Job. When set, it specifies the scheduling policy (basic or gang), topology constraints, disruption mode, and shared resource claims. When omitted, the Job defaults to the basic scheduling policy, which behaves as standard pod-by-pod scheduling. This field is alpha-level and requires the WorkloadWithJob feature gate. This field is immutable, including whether it is set at all, only policy.gang.minCount may be changed after creation.", } func (JobSpec) SwaggerDoc() map[string]string { @@ -142,7 +155,7 @@ var map_JobStatus = map[string]string{ "active": "The number of pending and running pods which are not terminating (without a deletionTimestamp). The value is zero for finished jobs.", "succeeded": "The number of pods which reached phase Succeeded. The value increases monotonically for a given spec. However, it may decrease in reaction to scale down of elastic indexed jobs.", "failed": "The number of pods which reached phase Failed. The value increases monotonically.", - "terminating": "The number of pods which are terminating (in phase Pending or Running and have a deletionTimestamp).\n\nThis field is beta-level. The job controller populates the field when the feature gate JobPodReplacementPolicy is enabled (enabled by default).", + "terminating": "The number of pods which are terminating (in phase Pending or Running and have a deletionTimestamp).", "completedIndexes": "completedIndexes holds the completed indexes when .spec.completionMode = \"Indexed\" in a text format. The indexes are represented as decimal integers separated by commas. The numbers are listed in increasing order. Three or more consecutive numbers are compressed and represented by the first and last element of the series, separated by a hyphen. For example, if the completed indexes are 1, 3, 4, 5 and 7, they are represented as \"1,3-5,7\".", "failedIndexes": "FailedIndexes holds the failed indexes when spec.backoffLimitPerIndex is set. The indexes are represented in the text format analogous as for the `completedIndexes` field, ie. they are kept as decimal integers separated by commas. The numbers are listed in increasing order. Three or more consecutive numbers are compressed and represented by the first and last element of the series, separated by a hyphen. For example, if the failed indexes are 1, 3, 4, 5 and 7, they are represented as \"1,3-5,7\". The set of failed indexes cannot overlap with the set of completed indexes.", "uncountedTerminatedPods": "uncountedTerminatedPods holds the UIDs of Pods that have terminated but the job controller hasn't yet accounted for in the status counters.\n\nThe job controller creates pods with a finalizer. When a pod terminates (succeeded or failed), the controller does three steps to account for it in the job status:\n\n1. Add the pod UID to the arrays in this field. 2. Remove the pod finalizer. 3. Remove the pod UID from the arrays while increasing the corresponding\n counter.\n\nOld jobs might not be tracked using this field, in which case the field remains null. The structure is empty for finished jobs.", diff --git a/vendor/k8s.io/api/batch/v1/zz_generated.deepcopy.go b/vendor/k8s.io/api/batch/v1/zz_generated.deepcopy.go index 88c58b3d11..50d47596f4 100644 --- a/vendor/k8s.io/api/batch/v1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/batch/v1/zz_generated.deepcopy.go @@ -23,6 +23,7 @@ package v1 import ( corev1 "k8s.io/api/core/v1" + v1alpha3 "k8s.io/api/scheduling/v1alpha3" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" types "k8s.io/apimachinery/pkg/types" @@ -239,6 +240,44 @@ func (in *JobList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JobSchedulingConfiguration) DeepCopyInto(out *JobSchedulingConfiguration) { + *out = *in + if in.SchedulingPolicy != nil { + in, out := &in.SchedulingPolicy, &out.SchedulingPolicy + *out = new(v1alpha3.WorkloadPodGroupSchedulingPolicy) + (*in).DeepCopyInto(*out) + } + if in.SchedulingConstraints != nil { + in, out := &in.SchedulingConstraints, &out.SchedulingConstraints + *out = new(v1alpha3.WorkloadPodGroupSchedulingConstraints) + (*in).DeepCopyInto(*out) + } + if in.DisruptionMode != nil { + in, out := &in.DisruptionMode, &out.DisruptionMode + *out = new(v1alpha3.WorkloadPodGroupDisruptionMode) + (*in).DeepCopyInto(*out) + } + if in.ResourceClaims != nil { + in, out := &in.ResourceClaims, &out.ResourceClaims + *out = make([]v1alpha3.WorkloadPodGroupResourceClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobSchedulingConfiguration. +func (in *JobSchedulingConfiguration) DeepCopy() *JobSchedulingConfiguration { + if in == nil { + return nil + } + out := new(JobSchedulingConfiguration) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *JobSpec) DeepCopyInto(out *JobSpec) { *out = *in @@ -318,6 +357,11 @@ func (in *JobSpec) DeepCopyInto(out *JobSpec) { *out = new(string) **out = **in } + if in.Scheduling != nil { + in, out := &in.Scheduling, &out.Scheduling + *out = new(JobSchedulingConfiguration) + (*in).DeepCopyInto(*out) + } return } diff --git a/vendor/k8s.io/api/batch/v1/zz_generated.model_name.go b/vendor/k8s.io/api/batch/v1/zz_generated.model_name.go index c5b86f29cd..d7305143a7 100644 --- a/vendor/k8s.io/api/batch/v1/zz_generated.model_name.go +++ b/vendor/k8s.io/api/batch/v1/zz_generated.model_name.go @@ -56,6 +56,11 @@ func (in JobList) OpenAPIModelName() string { return "io.k8s.api.batch.v1.JobList" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in JobSchedulingConfiguration) OpenAPIModelName() string { + return "io.k8s.api.batch.v1.JobSchedulingConfiguration" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in JobSpec) OpenAPIModelName() string { return "io.k8s.api.batch.v1.JobSpec" diff --git a/vendor/k8s.io/api/batch/v1beta1/generated.proto b/vendor/k8s.io/api/batch/v1beta1/generated.proto index 47000470c6..411d681d0a 100644 --- a/vendor/k8s.io/api/batch/v1beta1/generated.proto +++ b/vendor/k8s.io/api/batch/v1beta1/generated.proto @@ -31,6 +31,7 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; option go_package = "k8s.io/api/batch/v1beta1"; // CronJob represents the configuration of a single cron job. +// +k8s:supportsSubresource="/status" message CronJob { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -63,7 +64,7 @@ message CronJobList { message CronJobSpec { // The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string schedule = 1; // The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. @@ -134,6 +135,7 @@ message JobTemplateSpec { // Standard object's metadata of the jobs created from this template. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Specification of the desired behavior of the job. diff --git a/vendor/k8s.io/api/batch/v1beta1/types.go b/vendor/k8s.io/api/batch/v1beta1/types.go index 9e1a1b4704..dea910b828 100644 --- a/vendor/k8s.io/api/batch/v1beta1/types.go +++ b/vendor/k8s.io/api/batch/v1beta1/types.go @@ -27,6 +27,7 @@ type JobTemplateSpec struct { // Standard object's metadata of the jobs created from this template. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Specification of the desired behavior of the job. @@ -43,8 +44,9 @@ type JobTemplateSpec struct { // +k8s:prerelease-lifecycle-gen:replacement=batch,v1,CronJob // CronJob represents the configuration of a single cron job. +// +k8s:supportsSubresource="/status" type CronJob struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -69,7 +71,7 @@ type CronJob struct { // CronJobList is a collection of cron jobs. type CronJobList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -85,7 +87,7 @@ type CronJobSpec struct { // The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Schedule string `json:"schedule" protobuf:"bytes,1,opt,name=schedule"` // The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. diff --git a/vendor/k8s.io/api/certificates/v1/generated.pb.go b/vendor/k8s.io/api/certificates/v1/generated.pb.go index e47a42e62e..5b103ff8d5 100644 --- a/vendor/k8s.io/api/certificates/v1/generated.pb.go +++ b/vendor/k8s.io/api/certificates/v1/generated.pb.go @@ -26,10 +26,13 @@ import ( "sort" k8s_io_api_core_v1 "k8s.io/api/core/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" math_bits "math/bits" reflect "reflect" strings "strings" + + k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" ) func (m *CertificateSigningRequest) Reset() { *m = CertificateSigningRequest{} } @@ -42,8 +45,22 @@ func (m *CertificateSigningRequestSpec) Reset() { *m = CertificateSigningRequest func (m *CertificateSigningRequestStatus) Reset() { *m = CertificateSigningRequestStatus{} } +func (m *ClusterTrustBundle) Reset() { *m = ClusterTrustBundle{} } + +func (m *ClusterTrustBundleList) Reset() { *m = ClusterTrustBundleList{} } + +func (m *ClusterTrustBundleSpec) Reset() { *m = ClusterTrustBundleSpec{} } + func (m *ExtraValue) Reset() { *m = ExtraValue{} } +func (m *PodCertificateRequest) Reset() { *m = PodCertificateRequest{} } + +func (m *PodCertificateRequestList) Reset() { *m = PodCertificateRequestList{} } + +func (m *PodCertificateRequestSpec) Reset() { *m = PodCertificateRequestSpec{} } + +func (m *PodCertificateRequestStatus) Reset() { *m = PodCertificateRequestStatus{} } + func (m *CertificateSigningRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -348,7 +365,7 @@ func (m *CertificateSigningRequestStatus) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } -func (m ExtraValue) Marshal() (dAtA []byte, err error) { +func (m *ClusterTrustBundle) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -358,270 +375,2058 @@ func (m ExtraValue) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m ExtraValue) MarshalTo(dAtA []byte) (int, error) { +func (m *ClusterTrustBundle) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m ExtraValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ClusterTrustBundle) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m) > 0 { - for iNdEx := len(m) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m[iNdEx]) - copy(dAtA[i:], m[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m[iNdEx]))) - i-- - dAtA[i] = 0xa + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *ClusterTrustBundleList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *CertificateSigningRequest) Size() (n int) { - if m == nil { - return 0 - } + +func (m *ClusterTrustBundleList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClusterTrustBundleList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *CertificateSigningRequestCondition) Size() (n int) { - if m == nil { - return 0 +func (m *ClusterTrustBundleSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *ClusterTrustBundleSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClusterTrustBundleSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Type) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Reason) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Message) - n += 1 + l + sovGenerated(uint64(l)) - l = m.LastUpdateTime.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.LastTransitionTime.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Status) - n += 1 + l + sovGenerated(uint64(l)) - return n + i -= len(m.TrustBundle) + copy(dAtA[i:], m.TrustBundle) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.TrustBundle))) + i-- + dAtA[i] = 0x12 + i -= len(m.SignerName) + copy(dAtA[i:], m.SignerName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.SignerName))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *CertificateSigningRequestList) Size() (n int) { - if m == nil { - return 0 +func (m ExtraValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m ExtraValue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m ExtraValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) + if len(m) > 0 { + for iNdEx := len(m) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m[iNdEx]) + copy(dAtA[i:], m[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m[iNdEx]))) + i-- + dAtA[i] = 0xa } } - return n + return len(dAtA) - i, nil } -func (m *CertificateSigningRequestSpec) Size() (n int) { - if m == nil { - return 0 +func (m *PodCertificateRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *PodCertificateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodCertificateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.Request != nil { - l = len(m.Request) - n += 1 + l + sovGenerated(uint64(l)) - } - l = len(m.Username) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.UID) - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Groups) > 0 { - for _, s := range m.Groups { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - if len(m.Usages) > 0 { - for _, s := range m.Usages { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - if len(m.Extra) > 0 { - for k, v := range m.Extra { - _ = k - _ = v - l = v.Size() - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) - n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - l = len(m.SignerName) - n += 1 + l + sovGenerated(uint64(l)) - if m.ExpirationSeconds != nil { - n += 1 + sovGenerated(uint64(*m.ExpirationSeconds)) - } - return n + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *CertificateSigningRequestStatus) Size() (n int) { - if m == nil { - return 0 +func (m *PodCertificateRequestList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *PodCertificateRequestList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodCertificateRequestList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.Conditions) > 0 { - for _, e := range m.Conditions { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } } - if m.Certificate != nil { - l = len(m.Certificate) - n += 1 + l + sovGenerated(uint64(l)) + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - return n + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m ExtraValue) Size() (n int) { - if m == nil { - return 0 +func (m *PodCertificateRequestSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *PodCertificateRequestSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodCertificateRequestSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m) > 0 { - for _, s := range m { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) + if m.StubPKCS10Request != nil { + i -= len(m.StubPKCS10Request) + copy(dAtA[i:], m.StubPKCS10Request) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.StubPKCS10Request))) + i-- + dAtA[i] = 0x62 + } + if len(m.UnverifiedUserAnnotations) > 0 { + keysForUnverifiedUserAnnotations := make([]string, 0, len(m.UnverifiedUserAnnotations)) + for k := range m.UnverifiedUserAnnotations { + keysForUnverifiedUserAnnotations = append(keysForUnverifiedUserAnnotations, string(k)) + } + sort.Strings(keysForUnverifiedUserAnnotations) + for iNdEx := len(keysForUnverifiedUserAnnotations) - 1; iNdEx >= 0; iNdEx-- { + v := m.UnverifiedUserAnnotations[string(keysForUnverifiedUserAnnotations[iNdEx])] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintGenerated(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(keysForUnverifiedUserAnnotations[iNdEx]) + copy(dAtA[i:], keysForUnverifiedUserAnnotations[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(keysForUnverifiedUserAnnotations[iNdEx]))) + i-- + dAtA[i] = 0xa + i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x5a } } - return n + if m.MaxExpirationSeconds != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.MaxExpirationSeconds)) + i-- + dAtA[i] = 0x40 + } + i -= len(m.NodeUID) + copy(dAtA[i:], m.NodeUID) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.NodeUID))) + i-- + dAtA[i] = 0x3a + i -= len(m.NodeName) + copy(dAtA[i:], m.NodeName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.NodeName))) + i-- + dAtA[i] = 0x32 + i -= len(m.ServiceAccountUID) + copy(dAtA[i:], m.ServiceAccountUID) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.ServiceAccountUID))) + i-- + dAtA[i] = 0x2a + i -= len(m.ServiceAccountName) + copy(dAtA[i:], m.ServiceAccountName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.ServiceAccountName))) + i-- + dAtA[i] = 0x22 + i -= len(m.PodUID) + copy(dAtA[i:], m.PodUID) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.PodUID))) + i-- + dAtA[i] = 0x1a + i -= len(m.PodName) + copy(dAtA[i:], m.PodName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.PodName))) + i-- + dAtA[i] = 0x12 + i -= len(m.SignerName) + copy(dAtA[i:], m.SignerName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.SignerName))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *CertificateSigningRequest) String() string { - if this == nil { - return "nil" +func (m *PodCertificateRequestStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - s := strings.Join([]string{`&CertificateSigningRequest{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "CertificateSigningRequestSpec", "CertificateSigningRequestSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "CertificateSigningRequestStatus", "CertificateSigningRequestStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s + return dAtA[:n], nil } -func (this *CertificateSigningRequestCondition) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&CertificateSigningRequestCondition{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Reason:` + fmt.Sprintf("%v", this.Reason) + `,`, - `Message:` + fmt.Sprintf("%v", this.Message) + `,`, - `LastUpdateTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastUpdateTime), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, - `LastTransitionTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastTransitionTime), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, - `Status:` + fmt.Sprintf("%v", this.Status) + `,`, - `}`, - }, "") - return s + +func (m *PodCertificateRequestStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (this *CertificateSigningRequestList) String() string { - if this == nil { - return "nil" + +func (m *PodCertificateRequestStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.NotAfter != nil { + { + size, err := m.NotAfter.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 } - repeatedStringForItems := "[]CertificateSigningRequest{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "CertificateSigningRequest", "CertificateSigningRequest", 1), `&`, ``, 1) + "," + if m.BeginRefreshAt != nil { + { + size, err := m.BeginRefreshAt.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a } - repeatedStringForItems += "}" - s := strings.Join([]string{`&CertificateSigningRequestList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *CertificateSigningRequestSpec) String() string { - if this == nil { - return "nil" + if m.NotBefore != nil { + { + size, err := m.NotBefore.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 } - keysForExtra := make([]string, 0, len(this.Extra)) - for k := range this.Extra { - keysForExtra = append(keysForExtra, k) + i -= len(m.CertificateChain) + copy(dAtA[i:], m.CertificateChain) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.CertificateChain))) + i-- + dAtA[i] = 0x12 + if len(m.Conditions) > 0 { + for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - sort.Strings(keysForExtra) - mapStringForExtra := "map[string]ExtraValue{" - for _, k := range keysForExtra { - mapStringForExtra += fmt.Sprintf("%v: %v,", k, this.Extra[k]) + return len(dAtA) - i, nil +} + +func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { + offset -= sovGenerated(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ } - mapStringForExtra += "}" - s := strings.Join([]string{`&CertificateSigningRequestSpec{`, - `Request:` + valueToStringGenerated(this.Request) + `,`, - `Username:` + fmt.Sprintf("%v", this.Username) + `,`, - `UID:` + fmt.Sprintf("%v", this.UID) + `,`, - `Groups:` + fmt.Sprintf("%v", this.Groups) + `,`, - `Usages:` + fmt.Sprintf("%v", this.Usages) + `,`, - `Extra:` + mapStringForExtra + `,`, - `SignerName:` + fmt.Sprintf("%v", this.SignerName) + `,`, - `ExpirationSeconds:` + valueToStringGenerated(this.ExpirationSeconds) + `,`, - `}`, - }, "") - return s + dAtA[offset] = uint8(v) + return base } -func (this *CertificateSigningRequestStatus) String() string { - if this == nil { - return "nil" +func (m *CertificateSigningRequest) Size() (n int) { + if m == nil { + return 0 } - repeatedStringForConditions := "[]CertificateSigningRequestCondition{" - for _, f := range this.Conditions { - repeatedStringForConditions += strings.Replace(strings.Replace(f.String(), "CertificateSigningRequestCondition", "CertificateSigningRequestCondition", 1), `&`, ``, 1) + "," + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *CertificateSigningRequestCondition) Size() (n int) { + if m == nil { + return 0 } - repeatedStringForConditions += "}" - s := strings.Join([]string{`&CertificateSigningRequestStatus{`, - `Conditions:` + repeatedStringForConditions + `,`, - `Certificate:` + valueToStringGenerated(this.Certificate) + `,`, - `}`, - }, "") - return s + var l int + _ = l + l = len(m.Type) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Reason) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Message) + n += 1 + l + sovGenerated(uint64(l)) + l = m.LastUpdateTime.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.LastTransitionTime.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Status) + n += 1 + l + sovGenerated(uint64(l)) + return n } -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" + +func (m *CertificateSigningRequestList) Size() (n int) { + if m == nil { + return 0 } - pv := reflect.Indirect(rv).Interface() + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *CertificateSigningRequestSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Request != nil { + l = len(m.Request) + n += 1 + l + sovGenerated(uint64(l)) + } + l = len(m.Username) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.UID) + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Groups) > 0 { + for _, s := range m.Groups { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.Usages) > 0 { + for _, s := range m.Usages { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.Extra) > 0 { + for k, v := range m.Extra { + _ = k + _ = v + l = v.Size() + mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) + n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + } + } + l = len(m.SignerName) + n += 1 + l + sovGenerated(uint64(l)) + if m.ExpirationSeconds != nil { + n += 1 + sovGenerated(uint64(*m.ExpirationSeconds)) + } + return n +} + +func (m *CertificateSigningRequestStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Conditions) > 0 { + for _, e := range m.Conditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if m.Certificate != nil { + l = len(m.Certificate) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *ClusterTrustBundle) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ClusterTrustBundleList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *ClusterTrustBundleSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SignerName) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.TrustBundle) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m ExtraValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m) > 0 { + for _, s := range m { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *PodCertificateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *PodCertificateRequestList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *PodCertificateRequestSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SignerName) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.PodName) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.PodUID) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.ServiceAccountName) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.ServiceAccountUID) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.NodeName) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.NodeUID) + n += 1 + l + sovGenerated(uint64(l)) + if m.MaxExpirationSeconds != nil { + n += 1 + sovGenerated(uint64(*m.MaxExpirationSeconds)) + } + if len(m.UnverifiedUserAnnotations) > 0 { + for k, v := range m.UnverifiedUserAnnotations { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) + n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + } + } + if m.StubPKCS10Request != nil { + l = len(m.StubPKCS10Request) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *PodCertificateRequestStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Conditions) > 0 { + for _, e := range m.Conditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + l = len(m.CertificateChain) + n += 1 + l + sovGenerated(uint64(l)) + if m.NotBefore != nil { + l = m.NotBefore.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.BeginRefreshAt != nil { + l = m.BeginRefreshAt.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.NotAfter != nil { + l = m.NotAfter.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func sovGenerated(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenerated(x uint64) (n int) { + return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *CertificateSigningRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CertificateSigningRequest{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "CertificateSigningRequestSpec", "CertificateSigningRequestSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "CertificateSigningRequestStatus", "CertificateSigningRequestStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *CertificateSigningRequestCondition) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CertificateSigningRequestCondition{`, + `Type:` + fmt.Sprintf("%v", this.Type) + `,`, + `Reason:` + fmt.Sprintf("%v", this.Reason) + `,`, + `Message:` + fmt.Sprintf("%v", this.Message) + `,`, + `LastUpdateTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastUpdateTime), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, + `LastTransitionTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastTransitionTime), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, + `Status:` + fmt.Sprintf("%v", this.Status) + `,`, + `}`, + }, "") + return s +} +func (this *CertificateSigningRequestList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]CertificateSigningRequest{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "CertificateSigningRequest", "CertificateSigningRequest", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&CertificateSigningRequestList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *CertificateSigningRequestSpec) String() string { + if this == nil { + return "nil" + } + keysForExtra := make([]string, 0, len(this.Extra)) + for k := range this.Extra { + keysForExtra = append(keysForExtra, k) + } + sort.Strings(keysForExtra) + mapStringForExtra := "map[string]ExtraValue{" + for _, k := range keysForExtra { + mapStringForExtra += fmt.Sprintf("%v: %v,", k, this.Extra[k]) + } + mapStringForExtra += "}" + s := strings.Join([]string{`&CertificateSigningRequestSpec{`, + `Request:` + valueToStringGenerated(this.Request) + `,`, + `Username:` + fmt.Sprintf("%v", this.Username) + `,`, + `UID:` + fmt.Sprintf("%v", this.UID) + `,`, + `Groups:` + fmt.Sprintf("%v", this.Groups) + `,`, + `Usages:` + fmt.Sprintf("%v", this.Usages) + `,`, + `Extra:` + mapStringForExtra + `,`, + `SignerName:` + fmt.Sprintf("%v", this.SignerName) + `,`, + `ExpirationSeconds:` + valueToStringGenerated(this.ExpirationSeconds) + `,`, + `}`, + }, "") + return s +} +func (this *CertificateSigningRequestStatus) String() string { + if this == nil { + return "nil" + } + repeatedStringForConditions := "[]CertificateSigningRequestCondition{" + for _, f := range this.Conditions { + repeatedStringForConditions += strings.Replace(strings.Replace(f.String(), "CertificateSigningRequestCondition", "CertificateSigningRequestCondition", 1), `&`, ``, 1) + "," + } + repeatedStringForConditions += "}" + s := strings.Join([]string{`&CertificateSigningRequestStatus{`, + `Conditions:` + repeatedStringForConditions + `,`, + `Certificate:` + valueToStringGenerated(this.Certificate) + `,`, + `}`, + }, "") + return s +} +func (this *ClusterTrustBundle) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ClusterTrustBundle{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ClusterTrustBundleSpec", "ClusterTrustBundleSpec", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ClusterTrustBundleList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]ClusterTrustBundle{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ClusterTrustBundle", "ClusterTrustBundle", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&ClusterTrustBundleList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *ClusterTrustBundleSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ClusterTrustBundleSpec{`, + `SignerName:` + fmt.Sprintf("%v", this.SignerName) + `,`, + `TrustBundle:` + fmt.Sprintf("%v", this.TrustBundle) + `,`, + `}`, + }, "") + return s +} +func (this *PodCertificateRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PodCertificateRequest{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "PodCertificateRequestSpec", "PodCertificateRequestSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "PodCertificateRequestStatus", "PodCertificateRequestStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *PodCertificateRequestList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]PodCertificateRequest{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "PodCertificateRequest", "PodCertificateRequest", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&PodCertificateRequestList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *PodCertificateRequestSpec) String() string { + if this == nil { + return "nil" + } + keysForUnverifiedUserAnnotations := make([]string, 0, len(this.UnverifiedUserAnnotations)) + for k := range this.UnverifiedUserAnnotations { + keysForUnverifiedUserAnnotations = append(keysForUnverifiedUserAnnotations, k) + } + sort.Strings(keysForUnverifiedUserAnnotations) + mapStringForUnverifiedUserAnnotations := "map[string]string{" + for _, k := range keysForUnverifiedUserAnnotations { + mapStringForUnverifiedUserAnnotations += fmt.Sprintf("%v: %v,", k, this.UnverifiedUserAnnotations[k]) + } + mapStringForUnverifiedUserAnnotations += "}" + s := strings.Join([]string{`&PodCertificateRequestSpec{`, + `SignerName:` + fmt.Sprintf("%v", this.SignerName) + `,`, + `PodName:` + fmt.Sprintf("%v", this.PodName) + `,`, + `PodUID:` + fmt.Sprintf("%v", this.PodUID) + `,`, + `ServiceAccountName:` + fmt.Sprintf("%v", this.ServiceAccountName) + `,`, + `ServiceAccountUID:` + fmt.Sprintf("%v", this.ServiceAccountUID) + `,`, + `NodeName:` + fmt.Sprintf("%v", this.NodeName) + `,`, + `NodeUID:` + fmt.Sprintf("%v", this.NodeUID) + `,`, + `MaxExpirationSeconds:` + valueToStringGenerated(this.MaxExpirationSeconds) + `,`, + `UnverifiedUserAnnotations:` + mapStringForUnverifiedUserAnnotations + `,`, + `StubPKCS10Request:` + valueToStringGenerated(this.StubPKCS10Request) + `,`, + `}`, + }, "") + return s +} +func (this *PodCertificateRequestStatus) String() string { + if this == nil { + return "nil" + } + repeatedStringForConditions := "[]Condition{" + for _, f := range this.Conditions { + repeatedStringForConditions += fmt.Sprintf("%v", f) + "," + } + repeatedStringForConditions += "}" + s := strings.Join([]string{`&PodCertificateRequestStatus{`, + `Conditions:` + repeatedStringForConditions + `,`, + `CertificateChain:` + fmt.Sprintf("%v", this.CertificateChain) + `,`, + `NotBefore:` + strings.Replace(fmt.Sprintf("%v", this.NotBefore), "Time", "v1.Time", 1) + `,`, + `BeginRefreshAt:` + strings.Replace(fmt.Sprintf("%v", this.BeginRefreshAt), "Time", "v1.Time", 1) + `,`, + `NotAfter:` + strings.Replace(fmt.Sprintf("%v", this.NotAfter), "Time", "v1.Time", 1) + `,`, + `}`, + }, "") + return s +} +func valueToStringGenerated(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } -func (m *CertificateSigningRequest) Unmarshal(dAtA []byte) error { +func (m *CertificateSigningRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CertificateSigningRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CertificateSigningRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CertificateSigningRequestCondition) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CertificateSigningRequestCondition: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CertificateSigningRequestCondition: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = RequestConditionType(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Reason = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Message = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastUpdateTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LastUpdateTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastTransitionTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LastTransitionTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Status = k8s_io_api_core_v1.ConditionStatus(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CertificateSigningRequestList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CertificateSigningRequestList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CertificateSigningRequestList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, CertificateSigningRequest{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CertificateSigningRequestSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CertificateSigningRequestSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CertificateSigningRequestSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Request", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Request = append(m.Request[:0], dAtA[iNdEx:postIndex]...) + if m.Request == nil { + m.Request = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Username", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Username = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Groups", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Groups = append(m.Groups, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Usages", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Usages = append(m.Usages, KeyUsage(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Extra", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Extra == nil { + m.Extra = make(map[string]ExtraValue) + } + var mapkey string + mapvalue := &ExtraValue{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthGenerated + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthGenerated + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthGenerated + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &ExtraValue{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Extra[mapkey] = *mapvalue + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SignerName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SignerName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpirationSeconds", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ExpirationSeconds = &v + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CertificateSigningRequestStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CertificateSigningRequestStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CertificateSigningRequestStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Conditions = append(m.Conditions, CertificateSigningRequestCondition{}) + if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Certificate", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Certificate = append(m.Certificate[:0], dAtA[iNdEx:postIndex]...) + if m.Certificate == nil { + m.Certificate = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClusterTrustBundle) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ClusterTrustBundle: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClusterTrustBundle: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClusterTrustBundleList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -644,15 +2449,15 @@ func (m *CertificateSigningRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CertificateSigningRequest: wiretype end group for non-group") + return fmt.Errorf("proto: ClusterTrustBundleList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CertificateSigningRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ClusterTrustBundleList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -679,46 +2484,13 @@ func (m *CertificateSigningRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -745,7 +2517,8 @@ func (m *CertificateSigningRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Items = append(m.Items, ClusterTrustBundle{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -770,7 +2543,7 @@ func (m *CertificateSigningRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *CertificateSigningRequestCondition) Unmarshal(dAtA []byte) error { +func (m *ClusterTrustBundleSpec) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -793,15 +2566,15 @@ func (m *CertificateSigningRequestCondition) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CertificateSigningRequestCondition: wiretype end group for non-group") + return fmt.Errorf("proto: ClusterTrustBundleSpec: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CertificateSigningRequestCondition: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ClusterTrustBundleSpec: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SignerName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -829,11 +2602,11 @@ func (m *CertificateSigningRequestCondition) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Type = RequestConditionType(dAtA[iNdEx:postIndex]) + m.SignerName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TrustBundle", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -861,11 +2634,61 @@ func (m *CertificateSigningRequestCondition) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Reason = string(dAtA[iNdEx:postIndex]) + m.TrustBundle = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ExtraValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ExtraValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExtraValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -893,11 +2716,61 @@ func (m *CertificateSigningRequestCondition) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Message = string(dAtA[iNdEx:postIndex]) + *m = append(*m, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 4: + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodCertificateRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodCertificateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodCertificateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastUpdateTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -924,13 +2797,13 @@ func (m *CertificateSigningRequestCondition) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.LastUpdateTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 5: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastTransitionTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -957,15 +2830,15 @@ func (m *CertificateSigningRequestCondition) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.LastTransitionTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 6: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -975,23 +2848,24 @@ func (m *CertificateSigningRequestCondition) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Status = k8s_io_api_core_v1.ConditionStatus(dAtA[iNdEx:postIndex]) + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -1014,7 +2888,7 @@ func (m *CertificateSigningRequestCondition) Unmarshal(dAtA []byte) error { } return nil } -func (m *CertificateSigningRequestList) Unmarshal(dAtA []byte) error { +func (m *PodCertificateRequestList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1037,10 +2911,10 @@ func (m *CertificateSigningRequestList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CertificateSigningRequestList: wiretype end group for non-group") + return fmt.Errorf("proto: PodCertificateRequestList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CertificateSigningRequestList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PodCertificateRequestList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1105,7 +2979,7 @@ func (m *CertificateSigningRequestList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Items = append(m.Items, CertificateSigningRequest{}) + m.Items = append(m.Items, PodCertificateRequest{}) if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1131,7 +3005,7 @@ func (m *CertificateSigningRequestList) Unmarshal(dAtA []byte) error { } return nil } -func (m *CertificateSigningRequestSpec) Unmarshal(dAtA []byte) error { +func (m *PodCertificateRequestSpec) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1141,30 +3015,94 @@ func (m *CertificateSigningRequestSpec) Unmarshal(dAtA []byte) error { if shift >= 64 { return ErrIntOverflowGenerated } - if iNdEx >= l { - return io.ErrUnexpectedEOF + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodCertificateRequestSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodCertificateRequestSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SignerName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SignerName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PodName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + if postIndex > l { + return io.ErrUnexpectedEOF } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CertificateSigningRequestSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CertificateSigningRequestSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + m.PodName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Request", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PodUID", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -1174,29 +3112,27 @@ func (m *CertificateSigningRequestSpec) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Request = append(m.Request[:0], dAtA[iNdEx:postIndex]...) - if m.Request == nil { - m.Request = []byte{} - } + m.PodUID = k8s_io_apimachinery_pkg_types.UID(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Username", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ServiceAccountName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1224,11 +3160,11 @@ func (m *CertificateSigningRequestSpec) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Username = string(dAtA[iNdEx:postIndex]) + m.ServiceAccountName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ServiceAccountUID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1256,11 +3192,11 @@ func (m *CertificateSigningRequestSpec) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.UID = string(dAtA[iNdEx:postIndex]) + m.ServiceAccountUID = k8s_io_apimachinery_pkg_types.UID(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Groups", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NodeName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1288,11 +3224,11 @@ func (m *CertificateSigningRequestSpec) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Groups = append(m.Groups, string(dAtA[iNdEx:postIndex])) + m.NodeName = k8s_io_apimachinery_pkg_types.NodeName(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Usages", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NodeUID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1320,11 +3256,31 @@ func (m *CertificateSigningRequestSpec) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Usages = append(m.Usages, KeyUsage(dAtA[iNdEx:postIndex])) + m.NodeUID = k8s_io_apimachinery_pkg_types.UID(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxExpirationSeconds", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.MaxExpirationSeconds = &v + case 11: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Extra", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UnverifiedUserAnnotations", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1351,11 +3307,11 @@ func (m *CertificateSigningRequestSpec) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Extra == nil { - m.Extra = make(map[string]ExtraValue) + if m.UnverifiedUserAnnotations == nil { + m.UnverifiedUserAnnotations = make(map[string]string) } var mapkey string - mapvalue := &ExtraValue{} + var mapvalue string for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 @@ -1404,7 +3360,7 @@ func (m *CertificateSigningRequestSpec) Unmarshal(dAtA []byte) error { mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { - var mapmsglen int + var stringLenmapvalue uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -1414,26 +3370,24 @@ func (m *CertificateSigningRequestSpec) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - mapmsglen |= int(b&0x7F) << shift + stringLenmapvalue |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if mapmsglen < 0 { + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { return ErrInvalidLengthGenerated } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { return ErrInvalidLengthGenerated } - if postmsgIndex > l { + if postStringIndexmapvalue > l { return io.ErrUnexpectedEOF } - mapvalue = &ExtraValue{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue } else { iNdEx = entryPreIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -1449,13 +3403,13 @@ func (m *CertificateSigningRequestSpec) Unmarshal(dAtA []byte) error { iNdEx += skippy } } - m.Extra[mapkey] = *mapvalue + m.UnverifiedUserAnnotations[mapkey] = mapvalue iNdEx = postIndex - case 7: + case 12: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SignerName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StubPKCS10Request", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -1465,44 +3419,26 @@ func (m *CertificateSigningRequestSpec) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.SignerName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpirationSeconds", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } + m.StubPKCS10Request = append(m.StubPKCS10Request[:0], dAtA[iNdEx:postIndex]...) + if m.StubPKCS10Request == nil { + m.StubPKCS10Request = []byte{} } - m.ExpirationSeconds = &v + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -1524,7 +3460,7 @@ func (m *CertificateSigningRequestSpec) Unmarshal(dAtA []byte) error { } return nil } -func (m *CertificateSigningRequestStatus) Unmarshal(dAtA []byte) error { +func (m *PodCertificateRequestStatus) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1547,10 +3483,10 @@ func (m *CertificateSigningRequestStatus) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CertificateSigningRequestStatus: wiretype end group for non-group") + return fmt.Errorf("proto: PodCertificateRequestStatus: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CertificateSigningRequestStatus: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PodCertificateRequestStatus: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1582,16 +3518,16 @@ func (m *CertificateSigningRequestStatus) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Conditions = append(m.Conditions, CertificateSigningRequestCondition{}) + m.Conditions = append(m.Conditions, v1.Condition{}) if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Certificate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CertificateChain", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -1601,81 +3537,101 @@ func (m *CertificateSigningRequestStatus) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Certificate = append(m.Certificate[:0], dAtA[iNdEx:postIndex]...) - if m.Certificate == nil { - m.Certificate = []byte{} - } + m.CertificateChain = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NotBefore", wireType) } - if (skippy < 0) || (iNdEx+skippy) < 0 { + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { return ErrInvalidLengthGenerated } - if (iNdEx + skippy) > l { + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { return io.ErrUnexpectedEOF } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ExtraValue) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated + if m.NotBefore == nil { + m.NotBefore = &v1.Time{} } - if iNdEx >= l { + if err := m.NotBefore.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BeginRefreshAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + if m.BeginRefreshAt == nil { + m.BeginRefreshAt = &v1.Time{} } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ExtraValue: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExtraValue: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + if err := m.BeginRefreshAt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NotAfter", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -1685,23 +3641,27 @@ func (m *ExtraValue) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - *m = append(*m, string(dAtA[iNdEx:postIndex])) + if m.NotAfter == nil { + m.NotAfter = &v1.Time{} + } + if err := m.NotAfter.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex diff --git a/vendor/k8s.io/api/certificates/v1/generated.proto b/vendor/k8s.io/api/certificates/v1/generated.proto index a334db4e18..8c97f12395 100644 --- a/vendor/k8s.io/api/certificates/v1/generated.proto +++ b/vendor/k8s.io/api/certificates/v1/generated.proto @@ -204,12 +204,12 @@ message CertificateSigningRequestStatus { // +listType=map // +listMapKey=type // +optional - // +k8s:alpha(since: "1.36")=+k8s:listType=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=type - // +k8s:alpha(since: "1.36")=+k8s:customUnique - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:item(type: "Approved")=+k8s:zeroOrOneOfMember - // +k8s:alpha(since: "1.36")=+k8s:item(type: "Denied")=+k8s:zeroOrOneOfMember + // +k8s:beta(since: "1.37")=+k8s:listType=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=type + // +k8s:beta(since: "1.37")=+k8s:customUnique + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:item(type: "Approved")=+k8s:zeroOrOneOfMember + // +k8s:beta(since: "1.37")=+k8s:item(type: "Denied")=+k8s:zeroOrOneOfMember repeated CertificateSigningRequestCondition conditions = 1; // certificate is populated with an issued certificate by the signer after an Approved condition is present. @@ -243,6 +243,81 @@ message CertificateSigningRequestStatus { optional bytes certificate = 2; } +// ClusterTrustBundle is a cluster-scoped container for X.509 trust anchors +// (root certificates). +// +// ClusterTrustBundle objects are considered to be readable by any authenticated +// user in the cluster, because they can be mounted by pods using the +// `clusterTrustBundle` projection. All service accounts have read access to +// ClusterTrustBundles by default. Users who only have namespace-level access +// to a cluster can read ClusterTrustBundles by impersonating a serviceaccount +// that they have access to. +// +// It can be optionally associated with a particular signer, in which case it +// contains one valid set of trust anchors for that signer. Signers may have +// multiple associated ClusterTrustBundles; each is an independent set of trust +// anchors for that signer. Admission control is used to enforce that only users +// with permissions on the signer can create or modify the corresponding bundle. +message ClusterTrustBundle { + // metadata contains the object metadata. + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // spec contains the signer (if any) and trust anchors. + optional ClusterTrustBundleSpec spec = 2; +} + +// ClusterTrustBundleList is a collection of ClusterTrustBundle objects +message ClusterTrustBundleList { + // metadata contains the list metadata. + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // items is a collection of ClusterTrustBundle objects + repeated ClusterTrustBundle items = 2; +} + +// ClusterTrustBundleSpec contains the signer and trust anchors. +message ClusterTrustBundleSpec { + // signerName indicates the associated signer, if any. + // + // In order to create or update a ClusterTrustBundle that sets signerName, + // you must have the following cluster-scoped permission: + // group=certificates.k8s.io resource=signers resourceName= + // verb=attest. + // + // If signerName is not empty, then the ClusterTrustBundle object must be + // named with the signer name as a prefix (translating slashes to colons). + // For example, for the signer name `example.com/foo`, valid + // ClusterTrustBundle object names include `example.com:foo:abc` and + // `example.com:foo:v1`. + // + // If signerName is empty, then the ClusterTrustBundle object's name must + // not have such a prefix. + // + // List/watch requests for ClusterTrustBundles can filter on this field + // using a `spec.signerName=NAME` field selector. + // + // +optional + // +k8s:alpha(since:"1.37")=+k8s:optional + // +k8s:alpha(since:"1.37")=+k8s:immutable + optional string signerName = 1; + + // trustBundle contains the individual X.509 trust anchors for this + // bundle, as PEM bundle of PEM-wrapped, DER-formatted X.509 certificates. + // + // The data must consist only of PEM certificate blocks that parse as valid + // X.509 certificates. Each certificate must include a basic constraints + // extension with the CA bit set. The API server will reject objects that + // contain duplicate certificates, or that use PEM block headers. + // + // Users of ClusterTrustBundles, including Kubelet, are free to reorder and + // deduplicate certificate blocks in this file according to their own logic, + // as well as to drop PEM block headers and inter-block data. + optional string trustBundle = 2; +} + // ExtraValue masks the value so protobuf can generate // +protobuf.nullable=true // +protobuf.options.(gogoproto.goproto_stringer)=false @@ -252,3 +327,209 @@ message ExtraValue { repeated string items = 1; } +// PodCertificateRequest encodes a pod requesting a certificate from a given +// signer. +// +// Kubelets use this API to implement podCertificate projected volumes +// +k8s:supportsSubresource="/status" +message PodCertificateRequest { + // metadata contains the object metadata. + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // spec contains the details about the certificate being requested. + // +required + optional PodCertificateRequestSpec spec = 2; + + // status contains the issued certificate, and a standard set of conditions. + // +optional + optional PodCertificateRequestStatus status = 3; +} + +// PodCertificateRequestList is a collection of PodCertificateRequest objects +message PodCertificateRequestList { + // metadata contains the list metadata. + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // items is a collection of PodCertificateRequest objects + repeated PodCertificateRequest items = 2; +} + +// PodCertificateRequestSpec describes the certificate request. All fields are +// immutable after creation. +message PodCertificateRequestSpec { + // signerName indicates the requested signer. + // + // All signer names beginning with `kubernetes.io` are reserved for use by + // the Kubernetes project. There is currently one well-known signer + // documented by the Kubernetes project, + // `kubernetes.io/kube-apiserver-client-pod`, which will issue client + // certificates understood by kube-apiserver. It is currently + // unimplemented. + // + // +required + optional string signerName = 1; + + // podName is the name of the pod into which the certificate will be mounted. + // + // +required + optional string podName = 2; + + // podUID is the UID of the pod into which the certificate will be mounted. + // + // +required + optional string podUID = 3; + + // serviceAccountName is the name of the service account the pod is running as. + // + // +required + optional string serviceAccountName = 4; + + // serviceAccountUID is the UID of the service account the pod is running as. + // + // +required + optional string serviceAccountUID = 5; + + // nodeName is the name of the node the pod is assigned to. + // + // +required + optional string nodeName = 6; + + // nodeUID is the UID of the node the pod is assigned to. + // + // +required + optional string nodeUID = 7; + + // maxExpirationSeconds is the maximum lifetime permitted for the + // certificate. + // + // If omitted, kube-apiserver will set it to 86400(24 hours). kube-apiserver + // will reject values shorter than 3600 (1 hour). The maximum allowable + // value is 7862400 (91 days). + // + // The signer implementation is then free to issue a certificate with any + // lifetime *shorter* than MaxExpirationSeconds, but no shorter than 3600 + // seconds (1 hour). This constraint is enforced by kube-apiserver. + // `kubernetes.io` signers will never issue certificates with a lifetime + // longer than 24 hours. + // + // +optional + // +default=86400 + optional int32 maxExpirationSeconds = 8; + + // A PKCS#10 certificate signing request (DER-serialized) generated by + // Kubelet using the subject private key. + // + // Most signer implementations will ignore the contents of the CSR except to + // extract the subject public key. The API server automatically verifies the + // CSR signature during admission, so the signer does not need to repeat the + // verification. CSRs generated by kubelet are completely empty. + // + // The subject public key must be one of RSA3072, RSA4096, ECDSAP256, + // ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in + // the future. + // + // Signer implementations do not need to support all key types supported by + // kube-apiserver and kubelet. If a signer does not support the key type + // used for a given PodCertificateRequest, it must deny the request by + // setting a status.conditions entry with a type of "Denied" and a reason of + // "UnsupportedKeyType". It may also suggest a key type that it does support + // in the message field. + // + // +required + optional bytes stubPKCS10Request = 12; + + // unverifiedUserAnnotations allow pod authors to pass additional information to + // the signer implementation. Kubernetes does not restrict or validate this + // metadata in any way. + // + // Entries are subject to the same validation as object metadata annotations, + // with the addition that all keys must be domain-prefixed. No restrictions + // are placed on values, except an overall size limitation on the entire field. + // + // Signers should document the keys and values they support. Signers should + // deny requests that contain keys they do not recognize. + // + // +optional + map unverifiedUserAnnotations = 11; +} + +// PodCertificateRequestStatus describes the status of the request, and holds +// the certificate data if the request is issued. +message PodCertificateRequestStatus { + // conditions applied to the request. + // + // The types "Issued", "Denied", and "Failed" have special handling. At + // most one of these conditions may be present, and they must have status + // "True". + // + // If the request is denied with `Reason=UnsupportedKeyType`, the signer may + // suggest a key type that will work in the message field. + // + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // +optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1; + + // certificateChain is populated with an issued certificate by the signer. + // This field is set via the /status subresource. Once populated, this field + // is immutable. + // + // If the certificate signing request is denied, a condition of type + // "Denied" is added and this field remains empty. If the signer cannot + // issue the certificate, a condition of type "Failed" is added and this + // field remains empty. + // + // Validation requirements: + // 1. certificateChain must consist of one or more PEM-formatted certificates. + // 2. Each entry must be a valid PEM-wrapped, DER-encoded ASN.1 Certificate as + // described in section 4 of RFC5280. + // + // If more than one block is present, and the definition of the requested + // spec.signerName does not indicate otherwise, the first block is the + // issued certificate, and subsequent blocks should be treated as + // intermediate certificates and presented in TLS handshakes. When + // projecting the chain into a pod volume, kubelet will drop any data + // in-between the PEM blocks, as well as any PEM block headers. + // + // +optional + optional string certificateChain = 2; + + // notBefore is the time at which the certificate becomes valid. The value + // must be the same as the notBefore value in the leaf certificate in + // certificateChain. This field is set via the /status subresource. Once + // populated, it is immutable. The signer must set this field at the same + // time it sets certificateChain. + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time notBefore = 4; + + // beginRefreshAt is the time at which the kubelet should begin trying to + // refresh the certificate. This field is set via the /status subresource, + // and must be set at the same time as certificateChain. Once populated, + // this field is immutable. + // + // This field is only a hint. Kubelet may start refreshing before or after + // this time if necessary. + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time beginRefreshAt = 5; + + // notAfter is the time at which the certificate expires. The value must be + // the same as the notAfter value in the leaf certificate in + // certificateChain. This field is set via the /status subresource. Once + // populated, it is immutable. The signer must set this field at the same + // time it sets certificateChain. + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time notAfter = 6; +} + diff --git a/vendor/k8s.io/api/certificates/v1/register.go b/vendor/k8s.io/api/certificates/v1/register.go index 2dac94ada0..474b8b032c 100644 --- a/vendor/k8s.io/api/certificates/v1/register.go +++ b/vendor/k8s.io/api/certificates/v1/register.go @@ -53,6 +53,10 @@ func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &CertificateSigningRequest{}, &CertificateSigningRequestList{}, + &ClusterTrustBundle{}, + &ClusterTrustBundleList{}, + &PodCertificateRequest{}, + &PodCertificateRequestList{}, ) // Add the watch version that applies diff --git a/vendor/k8s.io/api/certificates/v1/types.go b/vendor/k8s.io/api/certificates/v1/types.go index 9a86af13a8..b90179ea4c 100644 --- a/vendor/k8s.io/api/certificates/v1/types.go +++ b/vendor/k8s.io/api/certificates/v1/types.go @@ -21,6 +21,7 @@ import ( v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" ) // +genclient @@ -42,7 +43,7 @@ import ( // +k8s:supportsSubresource="/status" // +k8s:supportsSubresource="/approval" type CertificateSigningRequest struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -179,12 +180,12 @@ type CertificateSigningRequestStatus struct { // +listType=map // +listMapKey=type // +optional - // +k8s:alpha(since: "1.36")=+k8s:listType=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=type - // +k8s:alpha(since: "1.36")=+k8s:customUnique - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:item(type: "Approved")=+k8s:zeroOrOneOfMember - // +k8s:alpha(since: "1.36")=+k8s:item(type: "Denied")=+k8s:zeroOrOneOfMember + // +k8s:beta(since: "1.37")=+k8s:listType=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=type + // +k8s:beta(since: "1.37")=+k8s:customUnique + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:item(type: "Approved")=+k8s:zeroOrOneOfMember + // +k8s:beta(since: "1.37")=+k8s:item(type: "Denied")=+k8s:zeroOrOneOfMember Conditions []CertificateSigningRequestCondition `json:"conditions,omitempty" protobuf:"bytes,1,rep,name=conditions"` // certificate is populated with an issued certificate by the signer after an Approved condition is present. @@ -273,7 +274,7 @@ type CertificateSigningRequestCondition struct { // CertificateSigningRequestList is a collection of CertificateSigningRequest objects type CertificateSigningRequestList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -316,3 +317,326 @@ const ( UsageMicrosoftSGC KeyUsage = "microsoft sgc" UsageNetscapeSGC KeyUsage = "netscape sgc" ) + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.37 + +// ClusterTrustBundle is a cluster-scoped container for X.509 trust anchors +// (root certificates). +// +// ClusterTrustBundle objects are considered to be readable by any authenticated +// user in the cluster, because they can be mounted by pods using the +// `clusterTrustBundle` projection. All service accounts have read access to +// ClusterTrustBundles by default. Users who only have namespace-level access +// to a cluster can read ClusterTrustBundles by impersonating a serviceaccount +// that they have access to. +// +// It can be optionally associated with a particular signer, in which case it +// contains one valid set of trust anchors for that signer. Signers may have +// multiple associated ClusterTrustBundles; each is an independent set of trust +// anchors for that signer. Admission control is used to enforce that only users +// with permissions on the signer can create or modify the corresponding bundle. +type ClusterTrustBundle struct { + metav1.TypeMeta `json:""` + + // metadata contains the object metadata. + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // spec contains the signer (if any) and trust anchors. + Spec ClusterTrustBundleSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` +} + +// ClusterTrustBundleSpec contains the signer and trust anchors. +type ClusterTrustBundleSpec struct { + // signerName indicates the associated signer, if any. + // + // In order to create or update a ClusterTrustBundle that sets signerName, + // you must have the following cluster-scoped permission: + // group=certificates.k8s.io resource=signers resourceName= + // verb=attest. + // + // If signerName is not empty, then the ClusterTrustBundle object must be + // named with the signer name as a prefix (translating slashes to colons). + // For example, for the signer name `example.com/foo`, valid + // ClusterTrustBundle object names include `example.com:foo:abc` and + // `example.com:foo:v1`. + // + // If signerName is empty, then the ClusterTrustBundle object's name must + // not have such a prefix. + // + // List/watch requests for ClusterTrustBundles can filter on this field + // using a `spec.signerName=NAME` field selector. + // + // +optional + // +k8s:alpha(since:"1.37")=+k8s:optional + // +k8s:alpha(since:"1.37")=+k8s:immutable + SignerName string `json:"signerName,omitempty" protobuf:"bytes,1,opt,name=signerName"` + + // trustBundle contains the individual X.509 trust anchors for this + // bundle, as PEM bundle of PEM-wrapped, DER-formatted X.509 certificates. + // + // The data must consist only of PEM certificate blocks that parse as valid + // X.509 certificates. Each certificate must include a basic constraints + // extension with the CA bit set. The API server will reject objects that + // contain duplicate certificates, or that use PEM block headers. + // + // Users of ClusterTrustBundles, including Kubelet, are free to reorder and + // deduplicate certificate blocks in this file according to their own logic, + // as well as to drop PEM block headers and inter-block data. + TrustBundle string `json:"trustBundle" protobuf:"bytes,2,opt,name=trustBundle"` +} + +// +k8s:prerelease-lifecycle-gen:introduced=1.37 +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ClusterTrustBundleList is a collection of ClusterTrustBundle objects +type ClusterTrustBundleList struct { + metav1.TypeMeta `json:""` + + // metadata contains the list metadata. + // + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // items is a collection of ClusterTrustBundle objects + Items []ClusterTrustBundle `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// +genclient +// +k8s:prerelease-lifecycle-gen:introduced=1.37 +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PodCertificateRequest encodes a pod requesting a certificate from a given +// signer. +// +// Kubelets use this API to implement podCertificate projected volumes +// +k8s:supportsSubresource="/status" +type PodCertificateRequest struct { + metav1.TypeMeta `json:""` + + // metadata contains the object metadata. + // + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // spec contains the details about the certificate being requested. + // +required + Spec PodCertificateRequestSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` + + // status contains the issued certificate, and a standard set of conditions. + // +optional + Status PodCertificateRequestStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// PodCertificateRequestSpec describes the certificate request. All fields are +// immutable after creation. +type PodCertificateRequestSpec struct { + // signerName indicates the requested signer. + // + // All signer names beginning with `kubernetes.io` are reserved for use by + // the Kubernetes project. There is currently one well-known signer + // documented by the Kubernetes project, + // `kubernetes.io/kube-apiserver-client-pod`, which will issue client + // certificates understood by kube-apiserver. It is currently + // unimplemented. + // + // +required + SignerName string `json:"signerName" protobuf:"bytes,1,opt,name=signerName"` + + // podName is the name of the pod into which the certificate will be mounted. + // + // +required + PodName string `json:"podName" protobuf:"bytes,2,opt,name=podName"` + // podUID is the UID of the pod into which the certificate will be mounted. + // + // +required + PodUID types.UID `json:"podUID" protobuf:"bytes,3,opt,name=podUID"` + + // serviceAccountName is the name of the service account the pod is running as. + // + // +required + ServiceAccountName string `json:"serviceAccountName" protobuf:"bytes,4,opt,name=serviceAccountName"` + // serviceAccountUID is the UID of the service account the pod is running as. + // + // +required + ServiceAccountUID types.UID `json:"serviceAccountUID" protobuf:"bytes,5,opt,name=serviceAccountUID"` + + // nodeName is the name of the node the pod is assigned to. + // + // +required + NodeName types.NodeName `json:"nodeName" protobuf:"bytes,6,opt,name=nodeName"` + // nodeUID is the UID of the node the pod is assigned to. + // + // +required + NodeUID types.UID `json:"nodeUID" protobuf:"bytes,7,opt,name=nodeUID"` + + // maxExpirationSeconds is the maximum lifetime permitted for the + // certificate. + // + // If omitted, kube-apiserver will set it to 86400(24 hours). kube-apiserver + // will reject values shorter than 3600 (1 hour). The maximum allowable + // value is 7862400 (91 days). + // + // The signer implementation is then free to issue a certificate with any + // lifetime *shorter* than MaxExpirationSeconds, but no shorter than 3600 + // seconds (1 hour). This constraint is enforced by kube-apiserver. + // `kubernetes.io` signers will never issue certificates with a lifetime + // longer than 24 hours. + // + // +optional + // +default=86400 + MaxExpirationSeconds *int32 `json:"maxExpirationSeconds,omitempty" protobuf:"varint,8,opt,name=maxExpirationSeconds"` + + // A PKCS#10 certificate signing request (DER-serialized) generated by + // Kubelet using the subject private key. + // + // Most signer implementations will ignore the contents of the CSR except to + // extract the subject public key. The API server automatically verifies the + // CSR signature during admission, so the signer does not need to repeat the + // verification. CSRs generated by kubelet are completely empty. + // + // The subject public key must be one of RSA3072, RSA4096, ECDSAP256, + // ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in + // the future. + // + // Signer implementations do not need to support all key types supported by + // kube-apiserver and kubelet. If a signer does not support the key type + // used for a given PodCertificateRequest, it must deny the request by + // setting a status.conditions entry with a type of "Denied" and a reason of + // "UnsupportedKeyType". It may also suggest a key type that it does support + // in the message field. + // + // +required + StubPKCS10Request []byte `json:"stubPKCS10Request" protobuf:"bytes,12,opt,name=stubPKCS10Request"` + + // unverifiedUserAnnotations allow pod authors to pass additional information to + // the signer implementation. Kubernetes does not restrict or validate this + // metadata in any way. + // + // Entries are subject to the same validation as object metadata annotations, + // with the addition that all keys must be domain-prefixed. No restrictions + // are placed on values, except an overall size limitation on the entire field. + // + // Signers should document the keys and values they support. Signers should + // deny requests that contain keys they do not recognize. + // + // +optional + UnverifiedUserAnnotations map[string]string `json:"unverifiedUserAnnotations,omitempty" protobuf:"bytes,11,opt,name=unverifiedUserAnnotations"` +} + +// PodCertificateRequestStatus describes the status of the request, and holds +// the certificate data if the request is issued. +type PodCertificateRequestStatus struct { + // conditions applied to the request. + // + // The types "Issued", "Denied", and "Failed" have special handling. At + // most one of these conditions may be present, and they must have status + // "True". + // + // If the request is denied with `Reason=UnsupportedKeyType`, the signer may + // suggest a key type that will work in the message field. + // + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // +optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + + // certificateChain is populated with an issued certificate by the signer. + // This field is set via the /status subresource. Once populated, this field + // is immutable. + // + // If the certificate signing request is denied, a condition of type + // "Denied" is added and this field remains empty. If the signer cannot + // issue the certificate, a condition of type "Failed" is added and this + // field remains empty. + // + // Validation requirements: + // 1. certificateChain must consist of one or more PEM-formatted certificates. + // 2. Each entry must be a valid PEM-wrapped, DER-encoded ASN.1 Certificate as + // described in section 4 of RFC5280. + // + // If more than one block is present, and the definition of the requested + // spec.signerName does not indicate otherwise, the first block is the + // issued certificate, and subsequent blocks should be treated as + // intermediate certificates and presented in TLS handshakes. When + // projecting the chain into a pod volume, kubelet will drop any data + // in-between the PEM blocks, as well as any PEM block headers. + // + // +optional + CertificateChain string `json:"certificateChain,omitempty" protobuf:"bytes,2,opt,name=certificateChain"` + + // notBefore is the time at which the certificate becomes valid. The value + // must be the same as the notBefore value in the leaf certificate in + // certificateChain. This field is set via the /status subresource. Once + // populated, it is immutable. The signer must set this field at the same + // time it sets certificateChain. + // + // +optional + NotBefore *metav1.Time `json:"notBefore,omitempty" protobuf:"bytes,4,opt,name=notBefore"` + + // beginRefreshAt is the time at which the kubelet should begin trying to + // refresh the certificate. This field is set via the /status subresource, + // and must be set at the same time as certificateChain. Once populated, + // this field is immutable. + // + // This field is only a hint. Kubelet may start refreshing before or after + // this time if necessary. + // + // +optional + BeginRefreshAt *metav1.Time `json:"beginRefreshAt,omitempty" protobuf:"bytes,5,opt,name=beginRefreshAt"` + + // notAfter is the time at which the certificate expires. The value must be + // the same as the notAfter value in the leaf certificate in + // certificateChain. This field is set via the /status subresource. Once + // populated, it is immutable. The signer must set this field at the same + // time it sets certificateChain. + // + // +optional + NotAfter *metav1.Time `json:"notAfter,omitempty" protobuf:"bytes,6,opt,name=notAfter"` +} + +// Well-known condition types for PodCertificateRequests +const ( + // Denied indicates the request was denied by the signer. + PodCertificateRequestConditionTypeDenied string = "Denied" + // Failed indicates the signer failed to issue the certificate. + PodCertificateRequestConditionTypeFailed string = "Failed" + // Issued indicates the certificate has been issued. + PodCertificateRequestConditionTypeIssued string = "Issued" +) + +// Well-known condition reasons for PodCertificateRequests +const ( + // UnsupportedKeyType should be set on "Denied" conditions when the signer + // doesn't support the key type of publicKey. + PodCertificateRequestConditionUnsupportedKeyType string = "UnsupportedKeyType" + + // InvalidUnverifiedUserAnnotations should be set on "Denied" conditions when the signer + // does not recognize one of the keys passed in userConfig, or if the signer + // otherwise considers the userConfig of the request to be invalid. + PodCertificateRequestConditionInvalidUserConfig string = "InvalidUnverifiedUserAnnotations" +) + +// +k8s:prerelease-lifecycle-gen:introduced=1.37 +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PodCertificateRequestList is a collection of PodCertificateRequest objects +type PodCertificateRequestList struct { + metav1.TypeMeta `json:""` + + // metadata contains the list metadata. + // + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // items is a collection of PodCertificateRequest objects + Items []PodCertificateRequest `json:"items" protobuf:"bytes,2,rep,name=items"` +} diff --git a/vendor/k8s.io/api/certificates/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/certificates/v1/types_swagger_doc_generated.go index 4bdf39ebb3..503de052a7 100644 --- a/vendor/k8s.io/api/certificates/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/certificates/v1/types_swagger_doc_generated.go @@ -86,4 +86,86 @@ func (CertificateSigningRequestStatus) SwaggerDoc() map[string]string { return map_CertificateSigningRequestStatus } +var map_ClusterTrustBundle = map[string]string{ + "": "ClusterTrustBundle is a cluster-scoped container for X.509 trust anchors (root certificates).\n\nClusterTrustBundle objects are considered to be readable by any authenticated user in the cluster, because they can be mounted by pods using the `clusterTrustBundle` projection. All service accounts have read access to ClusterTrustBundles by default. Users who only have namespace-level access to a cluster can read ClusterTrustBundles by impersonating a serviceaccount that they have access to.\n\nIt can be optionally associated with a particular signer, in which case it contains one valid set of trust anchors for that signer. Signers may have multiple associated ClusterTrustBundles; each is an independent set of trust anchors for that signer. Admission control is used to enforce that only users with permissions on the signer can create or modify the corresponding bundle.", + "metadata": "metadata contains the object metadata.", + "spec": "spec contains the signer (if any) and trust anchors.", +} + +func (ClusterTrustBundle) SwaggerDoc() map[string]string { + return map_ClusterTrustBundle +} + +var map_ClusterTrustBundleList = map[string]string{ + "": "ClusterTrustBundleList is a collection of ClusterTrustBundle objects", + "metadata": "metadata contains the list metadata.", + "items": "items is a collection of ClusterTrustBundle objects", +} + +func (ClusterTrustBundleList) SwaggerDoc() map[string]string { + return map_ClusterTrustBundleList +} + +var map_ClusterTrustBundleSpec = map[string]string{ + "": "ClusterTrustBundleSpec contains the signer and trust anchors.", + "signerName": "signerName indicates the associated signer, if any.\n\nIn order to create or update a ClusterTrustBundle that sets signerName, you must have the following cluster-scoped permission: group=certificates.k8s.io resource=signers resourceName= verb=attest.\n\nIf signerName is not empty, then the ClusterTrustBundle object must be named with the signer name as a prefix (translating slashes to colons). For example, for the signer name `example.com/foo`, valid ClusterTrustBundle object names include `example.com:foo:abc` and `example.com:foo:v1`.\n\nIf signerName is empty, then the ClusterTrustBundle object's name must not have such a prefix.\n\nList/watch requests for ClusterTrustBundles can filter on this field using a `spec.signerName=NAME` field selector.", + "trustBundle": "trustBundle contains the individual X.509 trust anchors for this bundle, as PEM bundle of PEM-wrapped, DER-formatted X.509 certificates.\n\nThe data must consist only of PEM certificate blocks that parse as valid X.509 certificates. Each certificate must include a basic constraints extension with the CA bit set. The API server will reject objects that contain duplicate certificates, or that use PEM block headers.\n\nUsers of ClusterTrustBundles, including Kubelet, are free to reorder and deduplicate certificate blocks in this file according to their own logic, as well as to drop PEM block headers and inter-block data.", +} + +func (ClusterTrustBundleSpec) SwaggerDoc() map[string]string { + return map_ClusterTrustBundleSpec +} + +var map_PodCertificateRequest = map[string]string{ + "": "PodCertificateRequest encodes a pod requesting a certificate from a given signer.\n\nKubelets use this API to implement podCertificate projected volumes", + "metadata": "metadata contains the object metadata.", + "spec": "spec contains the details about the certificate being requested.", + "status": "status contains the issued certificate, and a standard set of conditions.", +} + +func (PodCertificateRequest) SwaggerDoc() map[string]string { + return map_PodCertificateRequest +} + +var map_PodCertificateRequestList = map[string]string{ + "": "PodCertificateRequestList is a collection of PodCertificateRequest objects", + "metadata": "metadata contains the list metadata.", + "items": "items is a collection of PodCertificateRequest objects", +} + +func (PodCertificateRequestList) SwaggerDoc() map[string]string { + return map_PodCertificateRequestList +} + +var map_PodCertificateRequestSpec = map[string]string{ + "": "PodCertificateRequestSpec describes the certificate request. All fields are immutable after creation.", + "signerName": "signerName indicates the requested signer.\n\nAll signer names beginning with `kubernetes.io` are reserved for use by the Kubernetes project. There is currently one well-known signer documented by the Kubernetes project, `kubernetes.io/kube-apiserver-client-pod`, which will issue client certificates understood by kube-apiserver. It is currently unimplemented.", + "podName": "podName is the name of the pod into which the certificate will be mounted.", + "podUID": "podUID is the UID of the pod into which the certificate will be mounted.", + "serviceAccountName": "serviceAccountName is the name of the service account the pod is running as.", + "serviceAccountUID": "serviceAccountUID is the UID of the service account the pod is running as.", + "nodeName": "nodeName is the name of the node the pod is assigned to.", + "nodeUID": "nodeUID is the UID of the node the pod is assigned to.", + "maxExpirationSeconds": "maxExpirationSeconds is the maximum lifetime permitted for the certificate.\n\nIf omitted, kube-apiserver will set it to 86400(24 hours). kube-apiserver will reject values shorter than 3600 (1 hour). The maximum allowable value is 7862400 (91 days).\n\nThe signer implementation is then free to issue a certificate with any lifetime *shorter* than MaxExpirationSeconds, but no shorter than 3600 seconds (1 hour). This constraint is enforced by kube-apiserver. `kubernetes.io` signers will never issue certificates with a lifetime longer than 24 hours.", + "stubPKCS10Request": "A PKCS#10 certificate signing request (DER-serialized) generated by Kubelet using the subject private key.\n\nMost signer implementations will ignore the contents of the CSR except to extract the subject public key. The API server automatically verifies the CSR signature during admission, so the signer does not need to repeat the verification. CSRs generated by kubelet are completely empty.\n\nThe subject public key must be one of RSA3072, RSA4096, ECDSAP256, ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in the future.\n\nSigner implementations do not need to support all key types supported by kube-apiserver and kubelet. If a signer does not support the key type used for a given PodCertificateRequest, it must deny the request by setting a status.conditions entry with a type of \"Denied\" and a reason of \"UnsupportedKeyType\". It may also suggest a key type that it does support in the message field.", + "unverifiedUserAnnotations": "unverifiedUserAnnotations allow pod authors to pass additional information to the signer implementation. Kubernetes does not restrict or validate this metadata in any way.\n\nEntries are subject to the same validation as object metadata annotations, with the addition that all keys must be domain-prefixed. No restrictions are placed on values, except an overall size limitation on the entire field.\n\nSigners should document the keys and values they support. Signers should deny requests that contain keys they do not recognize.", +} + +func (PodCertificateRequestSpec) SwaggerDoc() map[string]string { + return map_PodCertificateRequestSpec +} + +var map_PodCertificateRequestStatus = map[string]string{ + "": "PodCertificateRequestStatus describes the status of the request, and holds the certificate data if the request is issued.", + "conditions": "conditions applied to the request.\n\nThe types \"Issued\", \"Denied\", and \"Failed\" have special handling. At most one of these conditions may be present, and they must have status \"True\".\n\nIf the request is denied with `Reason=UnsupportedKeyType`, the signer may suggest a key type that will work in the message field.", + "certificateChain": "certificateChain is populated with an issued certificate by the signer. This field is set via the /status subresource. Once populated, this field is immutable.\n\nIf the certificate signing request is denied, a condition of type \"Denied\" is added and this field remains empty. If the signer cannot issue the certificate, a condition of type \"Failed\" is added and this field remains empty.\n\nValidation requirements:\n 1. certificateChain must consist of one or more PEM-formatted certificates.\n 2. Each entry must be a valid PEM-wrapped, DER-encoded ASN.1 Certificate as\n described in section 4 of RFC5280.\n\nIf more than one block is present, and the definition of the requested spec.signerName does not indicate otherwise, the first block is the issued certificate, and subsequent blocks should be treated as intermediate certificates and presented in TLS handshakes. When projecting the chain into a pod volume, kubelet will drop any data in-between the PEM blocks, as well as any PEM block headers.", + "notBefore": "notBefore is the time at which the certificate becomes valid. The value must be the same as the notBefore value in the leaf certificate in certificateChain. This field is set via the /status subresource. Once populated, it is immutable. The signer must set this field at the same time it sets certificateChain.", + "beginRefreshAt": "beginRefreshAt is the time at which the kubelet should begin trying to refresh the certificate. This field is set via the /status subresource, and must be set at the same time as certificateChain. Once populated, this field is immutable.\n\nThis field is only a hint. Kubelet may start refreshing before or after this time if necessary.", + "notAfter": "notAfter is the time at which the certificate expires. The value must be the same as the notAfter value in the leaf certificate in certificateChain. This field is set via the /status subresource. Once populated, it is immutable. The signer must set this field at the same time it sets certificateChain.", +} + +func (PodCertificateRequestStatus) SwaggerDoc() map[string]string { + return map_PodCertificateRequestStatus +} + // AUTO-GENERATED FUNCTIONS END HERE diff --git a/vendor/k8s.io/api/certificates/v1/zz_generated.deepcopy.go b/vendor/k8s.io/api/certificates/v1/zz_generated.deepcopy.go index aefa604117..b25937758d 100644 --- a/vendor/k8s.io/api/certificates/v1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/certificates/v1/zz_generated.deepcopy.go @@ -22,6 +22,7 @@ limitations under the License. package v1 import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -183,6 +184,82 @@ func (in *CertificateSigningRequestStatus) DeepCopy() *CertificateSigningRequest return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterTrustBundle) DeepCopyInto(out *ClusterTrustBundle) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterTrustBundle. +func (in *ClusterTrustBundle) DeepCopy() *ClusterTrustBundle { + if in == nil { + return nil + } + out := new(ClusterTrustBundle) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterTrustBundle) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterTrustBundleList) DeepCopyInto(out *ClusterTrustBundleList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterTrustBundle, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterTrustBundleList. +func (in *ClusterTrustBundleList) DeepCopy() *ClusterTrustBundleList { + if in == nil { + return nil + } + out := new(ClusterTrustBundleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterTrustBundleList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterTrustBundleSpec) DeepCopyInto(out *ClusterTrustBundleSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterTrustBundleSpec. +func (in *ClusterTrustBundleSpec) DeepCopy() *ClusterTrustBundleSpec { + if in == nil { + return nil + } + out := new(ClusterTrustBundleSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in ExtraValue) DeepCopyInto(out *ExtraValue) { { @@ -202,3 +279,132 @@ func (in ExtraValue) DeepCopy() ExtraValue { in.DeepCopyInto(out) return *out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodCertificateRequest) DeepCopyInto(out *PodCertificateRequest) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodCertificateRequest. +func (in *PodCertificateRequest) DeepCopy() *PodCertificateRequest { + if in == nil { + return nil + } + out := new(PodCertificateRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PodCertificateRequest) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodCertificateRequestList) DeepCopyInto(out *PodCertificateRequestList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]PodCertificateRequest, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodCertificateRequestList. +func (in *PodCertificateRequestList) DeepCopy() *PodCertificateRequestList { + if in == nil { + return nil + } + out := new(PodCertificateRequestList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PodCertificateRequestList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodCertificateRequestSpec) DeepCopyInto(out *PodCertificateRequestSpec) { + *out = *in + if in.MaxExpirationSeconds != nil { + in, out := &in.MaxExpirationSeconds, &out.MaxExpirationSeconds + *out = new(int32) + **out = **in + } + if in.StubPKCS10Request != nil { + in, out := &in.StubPKCS10Request, &out.StubPKCS10Request + *out = make([]byte, len(*in)) + copy(*out, *in) + } + if in.UnverifiedUserAnnotations != nil { + in, out := &in.UnverifiedUserAnnotations, &out.UnverifiedUserAnnotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodCertificateRequestSpec. +func (in *PodCertificateRequestSpec) DeepCopy() *PodCertificateRequestSpec { + if in == nil { + return nil + } + out := new(PodCertificateRequestSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodCertificateRequestStatus) DeepCopyInto(out *PodCertificateRequestStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.NotBefore != nil { + in, out := &in.NotBefore, &out.NotBefore + *out = (*in).DeepCopy() + } + if in.BeginRefreshAt != nil { + in, out := &in.BeginRefreshAt, &out.BeginRefreshAt + *out = (*in).DeepCopy() + } + if in.NotAfter != nil { + in, out := &in.NotAfter, &out.NotAfter + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodCertificateRequestStatus. +func (in *PodCertificateRequestStatus) DeepCopy() *PodCertificateRequestStatus { + if in == nil { + return nil + } + out := new(PodCertificateRequestStatus) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/k8s.io/api/certificates/v1/zz_generated.model_name.go b/vendor/k8s.io/api/certificates/v1/zz_generated.model_name.go index 9c7ad07a2c..73457044cc 100644 --- a/vendor/k8s.io/api/certificates/v1/zz_generated.model_name.go +++ b/vendor/k8s.io/api/certificates/v1/zz_generated.model_name.go @@ -45,3 +45,38 @@ func (in CertificateSigningRequestSpec) OpenAPIModelName() string { func (in CertificateSigningRequestStatus) OpenAPIModelName() string { return "io.k8s.api.certificates.v1.CertificateSigningRequestStatus" } + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in ClusterTrustBundle) OpenAPIModelName() string { + return "io.k8s.api.certificates.v1.ClusterTrustBundle" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in ClusterTrustBundleList) OpenAPIModelName() string { + return "io.k8s.api.certificates.v1.ClusterTrustBundleList" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in ClusterTrustBundleSpec) OpenAPIModelName() string { + return "io.k8s.api.certificates.v1.ClusterTrustBundleSpec" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodCertificateRequest) OpenAPIModelName() string { + return "io.k8s.api.certificates.v1.PodCertificateRequest" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodCertificateRequestList) OpenAPIModelName() string { + return "io.k8s.api.certificates.v1.PodCertificateRequestList" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodCertificateRequestSpec) OpenAPIModelName() string { + return "io.k8s.api.certificates.v1.PodCertificateRequestSpec" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodCertificateRequestStatus) OpenAPIModelName() string { + return "io.k8s.api.certificates.v1.PodCertificateRequestStatus" +} diff --git a/vendor/k8s.io/api/certificates/v1/zz_generated.prerelease-lifecycle.go b/vendor/k8s.io/api/certificates/v1/zz_generated.prerelease-lifecycle.go index 3a2b274030..522a9bee5d 100644 --- a/vendor/k8s.io/api/certificates/v1/zz_generated.prerelease-lifecycle.go +++ b/vendor/k8s.io/api/certificates/v1/zz_generated.prerelease-lifecycle.go @@ -32,3 +32,27 @@ func (in *CertificateSigningRequest) APILifecycleIntroduced() (major, minor int) func (in *CertificateSigningRequestList) APILifecycleIntroduced() (major, minor int) { return 1, 19 } + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *ClusterTrustBundle) APILifecycleIntroduced() (major, minor int) { + return 1, 37 +} + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *ClusterTrustBundleList) APILifecycleIntroduced() (major, minor int) { + return 1, 37 +} + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *PodCertificateRequest) APILifecycleIntroduced() (major, minor int) { + return 1, 37 +} + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *PodCertificateRequestList) APILifecycleIntroduced() (major, minor int) { + return 1, 37 +} diff --git a/vendor/k8s.io/api/certificates/v1alpha1/generated.proto b/vendor/k8s.io/api/certificates/v1alpha1/generated.proto index 7155f778cf..914d8e269d 100644 --- a/vendor/k8s.io/api/certificates/v1alpha1/generated.proto +++ b/vendor/k8s.io/api/certificates/v1alpha1/generated.proto @@ -38,7 +38,7 @@ option go_package = "k8s.io/api/certificates/v1alpha1"; // to a cluster can read ClusterTrustBundles by impersonating a serviceaccount // that they have access to. // -// It can be optionally associated with a particular assigner, in which case it +// It can be optionally associated with a particular signer, in which case it // contains one valid set of trust anchors for that signer. Signers may have // multiple associated ClusterTrustBundles; each is an independent set of trust // anchors for that signer. Admission control is used to enforce that only users @@ -85,6 +85,8 @@ message ClusterTrustBundleSpec { // using a `spec.signerName=NAME` field selector. // // +optional + // +k8s:alpha(since:"1.37")=+k8s:optional + // +k8s:alpha(since:"1.37")=+k8s:immutable optional string signerName = 1; // trustBundle contains the individual X.509 trust anchors for this diff --git a/vendor/k8s.io/api/certificates/v1alpha1/types.go b/vendor/k8s.io/api/certificates/v1alpha1/types.go index beef02599d..bdac6657cc 100644 --- a/vendor/k8s.io/api/certificates/v1alpha1/types.go +++ b/vendor/k8s.io/api/certificates/v1alpha1/types.go @@ -36,13 +36,13 @@ import ( // to a cluster can read ClusterTrustBundles by impersonating a serviceaccount // that they have access to. // -// It can be optionally associated with a particular assigner, in which case it +// It can be optionally associated with a particular signer, in which case it // contains one valid set of trust anchors for that signer. Signers may have // multiple associated ClusterTrustBundles; each is an independent set of trust // anchors for that signer. Admission control is used to enforce that only users // with permissions on the signer can create or modify the corresponding bundle. type ClusterTrustBundle struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata contains the object metadata. // +optional @@ -74,6 +74,8 @@ type ClusterTrustBundleSpec struct { // using a `spec.signerName=NAME` field selector. // // +optional + // +k8s:alpha(since:"1.37")=+k8s:optional + // +k8s:alpha(since:"1.37")=+k8s:immutable SignerName string `json:"signerName,omitempty" protobuf:"bytes,1,opt,name=signerName"` // trustBundle contains the individual X.509 trust anchors for this @@ -96,7 +98,7 @@ type ClusterTrustBundleSpec struct { // ClusterTrustBundleList is a collection of ClusterTrustBundle objects type ClusterTrustBundleList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata contains the list metadata. // diff --git a/vendor/k8s.io/api/certificates/v1alpha1/types_swagger_doc_generated.go b/vendor/k8s.io/api/certificates/v1alpha1/types_swagger_doc_generated.go index bff649e3cb..862897e97b 100644 --- a/vendor/k8s.io/api/certificates/v1alpha1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/certificates/v1alpha1/types_swagger_doc_generated.go @@ -28,7 +28,7 @@ package v1alpha1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_ClusterTrustBundle = map[string]string{ - "": "ClusterTrustBundle is a cluster-scoped container for X.509 trust anchors (root certificates).\n\nClusterTrustBundle objects are considered to be readable by any authenticated user in the cluster, because they can be mounted by pods using the `clusterTrustBundle` projection. All service accounts have read access to ClusterTrustBundles by default. Users who only have namespace-level access to a cluster can read ClusterTrustBundles by impersonating a serviceaccount that they have access to.\n\nIt can be optionally associated with a particular assigner, in which case it contains one valid set of trust anchors for that signer. Signers may have multiple associated ClusterTrustBundles; each is an independent set of trust anchors for that signer. Admission control is used to enforce that only users with permissions on the signer can create or modify the corresponding bundle.", + "": "ClusterTrustBundle is a cluster-scoped container for X.509 trust anchors (root certificates).\n\nClusterTrustBundle objects are considered to be readable by any authenticated user in the cluster, because they can be mounted by pods using the `clusterTrustBundle` projection. All service accounts have read access to ClusterTrustBundles by default. Users who only have namespace-level access to a cluster can read ClusterTrustBundles by impersonating a serviceaccount that they have access to.\n\nIt can be optionally associated with a particular signer, in which case it contains one valid set of trust anchors for that signer. Signers may have multiple associated ClusterTrustBundles; each is an independent set of trust anchors for that signer. Admission control is used to enforce that only users with permissions on the signer can create or modify the corresponding bundle.", "metadata": "metadata contains the object metadata.", "spec": "spec contains the signer (if any) and trust anchors.", } diff --git a/vendor/k8s.io/api/certificates/v1beta1/generated.proto b/vendor/k8s.io/api/certificates/v1beta1/generated.proto index cc46dee16d..25561abbc3 100644 --- a/vendor/k8s.io/api/certificates/v1beta1/generated.proto +++ b/vendor/k8s.io/api/certificates/v1beta1/generated.proto @@ -183,12 +183,12 @@ message CertificateSigningRequestStatus { // +listType=map // +listMapKey=type // +optional - // +k8s:alpha(since: "1.36")=+k8s:listType=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=type - // +k8s:alpha(since: "1.36")=+k8s:customUnique - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:item(type: "Approved")=+k8s:zeroOrOneOfMember - // +k8s:alpha(since: "1.36")=+k8s:item(type: "Denied")=+k8s:zeroOrOneOfMember + // +k8s:beta(since: "1.37")=+k8s:listType=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=type + // +k8s:beta(since: "1.37")=+k8s:customUnique + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:item(type: "Approved")=+k8s:zeroOrOneOfMember + // +k8s:beta(since: "1.37")=+k8s:item(type: "Denied")=+k8s:zeroOrOneOfMember repeated CertificateSigningRequestCondition conditions = 1; // If request was approved, the controller will place the issued certificate here. @@ -206,7 +206,7 @@ message CertificateSigningRequestStatus { // to a cluster can read ClusterTrustBundles by impersonating a serviceaccount // that they have access to. // -// It can be optionally associated with a particular assigner, in which case it +// It can be optionally associated with a particular signer, in which case it // contains one valid set of trust anchors for that signer. Signers may have // multiple associated ClusterTrustBundles; each is an independent set of trust // anchors for that signer. Admission control is used to enforce that only users @@ -253,6 +253,8 @@ message ClusterTrustBundleSpec { // using a `spec.signerName=NAME` field selector. // // +optional + // +k8s:alpha(since:"1.37")=+k8s:optional + // +k8s:alpha(since:"1.37")=+k8s:immutable optional string signerName = 1; // trustBundle contains the individual X.509 trust anchors for this @@ -282,6 +284,7 @@ message ExtraValue { // signer. // // Kubelets use this API to implement podCertificate projected volumes +// +k8s:supportsSubresource="/status" message PodCertificateRequest { // metadata contains the object metadata. // @@ -467,6 +470,9 @@ message PodCertificateRequestStatus { // +listType=map // +listMapKey=type // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1; // certificateChain is populated with an issued certificate by the signer. diff --git a/vendor/k8s.io/api/certificates/v1beta1/types.go b/vendor/k8s.io/api/certificates/v1beta1/types.go index e8ffa41e6d..eaa77c194d 100644 --- a/vendor/k8s.io/api/certificates/v1beta1/types.go +++ b/vendor/k8s.io/api/certificates/v1beta1/types.go @@ -35,7 +35,7 @@ import ( // +k8s:supportsSubresource="/status" // +k8s:supportsSubresource="/approval" type CertificateSigningRequest struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -177,12 +177,12 @@ type CertificateSigningRequestStatus struct { // +listType=map // +listMapKey=type // +optional - // +k8s:alpha(since: "1.36")=+k8s:listType=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=type - // +k8s:alpha(since: "1.36")=+k8s:customUnique - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:item(type: "Approved")=+k8s:zeroOrOneOfMember - // +k8s:alpha(since: "1.36")=+k8s:item(type: "Denied")=+k8s:zeroOrOneOfMember + // +k8s:beta(since: "1.37")=+k8s:listType=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=type + // +k8s:beta(since: "1.37")=+k8s:customUnique + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:item(type: "Approved")=+k8s:zeroOrOneOfMember + // +k8s:beta(since: "1.37")=+k8s:item(type: "Denied")=+k8s:zeroOrOneOfMember Conditions []CertificateSigningRequestCondition `json:"conditions,omitempty" protobuf:"bytes,1,rep,name=conditions"` // If request was approved, the controller will place the issued certificate here. @@ -230,7 +230,7 @@ type CertificateSigningRequestCondition struct { // +k8s:prerelease-lifecycle-gen:replacement=certificates.k8s.io,v1,CertificateSigningRequestList type CertificateSigningRequestList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -274,6 +274,7 @@ const ( // +genclient:nonNamespaced // +k8s:prerelease-lifecycle-gen:introduced=1.33 // +k8s:prerelease-lifecycle-gen:deprecated=1.37 +// +k8s:prerelease-lifecycle-gen:replacement=certificates.k8s.io,v1,ClusterTrustBundle // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // ClusterTrustBundle is a cluster-scoped container for X.509 trust anchors @@ -286,13 +287,13 @@ const ( // to a cluster can read ClusterTrustBundles by impersonating a serviceaccount // that they have access to. // -// It can be optionally associated with a particular assigner, in which case it +// It can be optionally associated with a particular signer, in which case it // contains one valid set of trust anchors for that signer. Signers may have // multiple associated ClusterTrustBundles; each is an independent set of trust // anchors for that signer. Admission control is used to enforce that only users // with permissions on the signer can create or modify the corresponding bundle. type ClusterTrustBundle struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata contains the object metadata. // +optional @@ -324,6 +325,8 @@ type ClusterTrustBundleSpec struct { // using a `spec.signerName=NAME` field selector. // // +optional + // +k8s:alpha(since:"1.37")=+k8s:optional + // +k8s:alpha(since:"1.37")=+k8s:immutable SignerName string `json:"signerName,omitempty" protobuf:"bytes,1,opt,name=signerName"` // trustBundle contains the individual X.509 trust anchors for this @@ -342,11 +345,12 @@ type ClusterTrustBundleSpec struct { // +k8s:prerelease-lifecycle-gen:introduced=1.33 // +k8s:prerelease-lifecycle-gen:deprecated=1.37 +// +k8s:prerelease-lifecycle-gen:replacement=certificates.k8s.io,v1,ClusterTrustBundleList // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // ClusterTrustBundleList is a collection of ClusterTrustBundle objects type ClusterTrustBundleList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata contains the list metadata. // @@ -359,14 +363,17 @@ type ClusterTrustBundleList struct { // +genclient // +k8s:prerelease-lifecycle-gen:introduced=1.35 +// +k8s:prerelease-lifecycle-gen:deprecated=1.37 +// +k8s:prerelease-lifecycle-gen:replacement=certificates.k8s.io,v1,PodCertificateRequest // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // PodCertificateRequest encodes a pod requesting a certificate from a given // signer. // // Kubelets use this API to implement podCertificate projected volumes +// +k8s:supportsSubresource="/status" type PodCertificateRequest struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata contains the object metadata. // @@ -538,6 +545,9 @@ type PodCertificateRequestStatus struct { // +listType=map // +listMapKey=type // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` // certificateChain is populated with an issued certificate by the signer. @@ -618,10 +628,12 @@ const ( // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.35 +// +k8s:prerelease-lifecycle-gen:deprecated=1.37 +// +k8s:prerelease-lifecycle-gen:replacement=certificates.k8s.io,v1,PodCertificateRequestList // PodCertificateRequestList is a collection of PodCertificateRequest objects type PodCertificateRequestList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // metadata contains the list metadata. // diff --git a/vendor/k8s.io/api/certificates/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/certificates/v1beta1/types_swagger_doc_generated.go index cad8768a59..c5352a7aca 100644 --- a/vendor/k8s.io/api/certificates/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/certificates/v1beta1/types_swagger_doc_generated.go @@ -76,7 +76,7 @@ func (CertificateSigningRequestStatus) SwaggerDoc() map[string]string { } var map_ClusterTrustBundle = map[string]string{ - "": "ClusterTrustBundle is a cluster-scoped container for X.509 trust anchors (root certificates).\n\nClusterTrustBundle objects are considered to be readable by any authenticated user in the cluster, because they can be mounted by pods using the `clusterTrustBundle` projection. All service accounts have read access to ClusterTrustBundles by default. Users who only have namespace-level access to a cluster can read ClusterTrustBundles by impersonating a serviceaccount that they have access to.\n\nIt can be optionally associated with a particular assigner, in which case it contains one valid set of trust anchors for that signer. Signers may have multiple associated ClusterTrustBundles; each is an independent set of trust anchors for that signer. Admission control is used to enforce that only users with permissions on the signer can create or modify the corresponding bundle.", + "": "ClusterTrustBundle is a cluster-scoped container for X.509 trust anchors (root certificates).\n\nClusterTrustBundle objects are considered to be readable by any authenticated user in the cluster, because they can be mounted by pods using the `clusterTrustBundle` projection. All service accounts have read access to ClusterTrustBundles by default. Users who only have namespace-level access to a cluster can read ClusterTrustBundles by impersonating a serviceaccount that they have access to.\n\nIt can be optionally associated with a particular signer, in which case it contains one valid set of trust anchors for that signer. Signers may have multiple associated ClusterTrustBundles; each is an independent set of trust anchors for that signer. Admission control is used to enforce that only users with permissions on the signer can create or modify the corresponding bundle.", "metadata": "metadata contains the object metadata.", "spec": "spec contains the signer (if any) and trust anchors.", } diff --git a/vendor/k8s.io/api/certificates/v1beta1/zz_generated.prerelease-lifecycle.go b/vendor/k8s.io/api/certificates/v1beta1/zz_generated.prerelease-lifecycle.go index d541ffb005..3b6f17e3e5 100644 --- a/vendor/k8s.io/api/certificates/v1beta1/zz_generated.prerelease-lifecycle.go +++ b/vendor/k8s.io/api/certificates/v1beta1/zz_generated.prerelease-lifecycle.go @@ -85,6 +85,12 @@ func (in *ClusterTrustBundle) APILifecycleDeprecated() (major, minor int) { return 1, 37 } +// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type. +// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=,," tags in types.go. +func (in *ClusterTrustBundle) APILifecycleReplacement() schema.GroupVersionKind { + return schema.GroupVersionKind{Group: "certificates.k8s.io", Version: "v1", Kind: "ClusterTrustBundle"} +} + // APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. func (in *ClusterTrustBundle) APILifecycleRemoved() (major, minor int) { @@ -103,6 +109,12 @@ func (in *ClusterTrustBundleList) APILifecycleDeprecated() (major, minor int) { return 1, 37 } +// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type. +// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=,," tags in types.go. +func (in *ClusterTrustBundleList) APILifecycleReplacement() schema.GroupVersionKind { + return schema.GroupVersionKind{Group: "certificates.k8s.io", Version: "v1", Kind: "ClusterTrustBundleList"} +} + // APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. func (in *ClusterTrustBundleList) APILifecycleRemoved() (major, minor int) { @@ -118,13 +130,19 @@ func (in *PodCertificateRequest) APILifecycleIntroduced() (major, minor int) { // APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. func (in *PodCertificateRequest) APILifecycleDeprecated() (major, minor int) { - return 1, 38 + return 1, 37 +} + +// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type. +// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=,," tags in types.go. +func (in *PodCertificateRequest) APILifecycleReplacement() schema.GroupVersionKind { + return schema.GroupVersionKind{Group: "certificates.k8s.io", Version: "v1", Kind: "PodCertificateRequest"} } // APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. func (in *PodCertificateRequest) APILifecycleRemoved() (major, minor int) { - return 1, 41 + return 1, 40 } // APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. @@ -136,11 +154,17 @@ func (in *PodCertificateRequestList) APILifecycleIntroduced() (major, minor int) // APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. func (in *PodCertificateRequestList) APILifecycleDeprecated() (major, minor int) { - return 1, 38 + return 1, 37 +} + +// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type. +// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=,," tags in types.go. +func (in *PodCertificateRequestList) APILifecycleReplacement() schema.GroupVersionKind { + return schema.GroupVersionKind{Group: "certificates.k8s.io", Version: "v1", Kind: "PodCertificateRequestList"} } // APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. func (in *PodCertificateRequestList) APILifecycleRemoved() (major, minor int) { - return 1, 41 + return 1, 40 } diff --git a/vendor/k8s.io/api/coordination/v1/generated.proto b/vendor/k8s.io/api/coordination/v1/generated.proto index 4d4f7e08f4..75f1c9acff 100644 --- a/vendor/k8s.io/api/coordination/v1/generated.proto +++ b/vendor/k8s.io/api/coordination/v1/generated.proto @@ -30,6 +30,7 @@ option go_package = "k8s.io/api/coordination/v1"; // Lease defines a lease concept. message Lease { + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -79,14 +80,14 @@ message LeaseSpec { // +optional optional int32 leaseTransitions = 5; - // Strategy indicates the strategy for picking the leader for coordinated leader election. + // strategy indicates the strategy for picking the leader for coordinated leader election. // If the field is not specified, there is no active coordination for this lease. // (Alpha) Using this field requires the CoordinatedLeaderElection feature gate to be enabled. // +featureGate=CoordinatedLeaderElection // +optional optional string strategy = 6; - // PreferredHolder signals to a lease holder that the lease has a + // preferredHolder signals to a lease holder that the lease has a // more optimal holder and should be given up. // This field can only be set if Strategy is also set. // +featureGate=CoordinatedLeaderElection diff --git a/vendor/k8s.io/api/coordination/v1/types.go b/vendor/k8s.io/api/coordination/v1/types.go index 5307cea88f..297ec32cb9 100644 --- a/vendor/k8s.io/api/coordination/v1/types.go +++ b/vendor/k8s.io/api/coordination/v1/types.go @@ -38,7 +38,8 @@ const ( // Lease defines a lease concept. type Lease struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -72,13 +73,13 @@ type LeaseSpec struct { // holders. // +optional LeaseTransitions *int32 `json:"leaseTransitions,omitempty" protobuf:"varint,5,opt,name=leaseTransitions"` - // Strategy indicates the strategy for picking the leader for coordinated leader election. + // strategy indicates the strategy for picking the leader for coordinated leader election. // If the field is not specified, there is no active coordination for this lease. // (Alpha) Using this field requires the CoordinatedLeaderElection feature gate to be enabled. // +featureGate=CoordinatedLeaderElection // +optional Strategy *CoordinatedLeaseStrategy `json:"strategy,omitempty" protobuf:"bytes,6,opt,name=strategy"` - // PreferredHolder signals to a lease holder that the lease has a + // preferredHolder signals to a lease holder that the lease has a // more optimal holder and should be given up. // This field can only be set if Strategy is also set. // +featureGate=CoordinatedLeaderElection @@ -91,7 +92,7 @@ type LeaseSpec struct { // LeaseList is a list of Lease objects. type LeaseList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional diff --git a/vendor/k8s.io/api/coordination/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/coordination/v1/types_swagger_doc_generated.go index 6c1a7ea8b9..c8bdb1e42e 100644 --- a/vendor/k8s.io/api/coordination/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/coordination/v1/types_swagger_doc_generated.go @@ -29,7 +29,7 @@ package v1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_Lease = map[string]string{ "": "Lease defines a lease concept.", - "metadata": "More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec contains the specification of the Lease. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", } @@ -54,8 +54,8 @@ var map_LeaseSpec = map[string]string{ "acquireTime": "acquireTime is a time when the current lease was acquired.", "renewTime": "renewTime is a time when the current holder of a lease has last updated the lease.", "leaseTransitions": "leaseTransitions is the number of transitions of a lease between holders.", - "strategy": "Strategy indicates the strategy for picking the leader for coordinated leader election. If the field is not specified, there is no active coordination for this lease. (Alpha) Using this field requires the CoordinatedLeaderElection feature gate to be enabled.", - "preferredHolder": "PreferredHolder signals to a lease holder that the lease has a more optimal holder and should be given up. This field can only be set if Strategy is also set.", + "strategy": "strategy indicates the strategy for picking the leader for coordinated leader election. If the field is not specified, there is no active coordination for this lease. (Alpha) Using this field requires the CoordinatedLeaderElection feature gate to be enabled.", + "preferredHolder": "preferredHolder signals to a lease holder that the lease has a more optimal holder and should be given up. This field can only be set if Strategy is also set.", } func (LeaseSpec) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/coordination/v1alpha2/generated.proto b/vendor/k8s.io/api/coordination/v1alpha2/generated.proto index 379fcf0d5d..7e1c0e0efa 100644 --- a/vendor/k8s.io/api/coordination/v1alpha2/generated.proto +++ b/vendor/k8s.io/api/coordination/v1alpha2/generated.proto @@ -32,6 +32,7 @@ option go_package = "k8s.io/api/coordination/v1alpha2"; // LeaseCandidate defines a candidate for a Lease object. // Candidates are created such that coordinated leader election will pick the best leader from the list of candidates. message LeaseCandidate { + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -55,19 +56,19 @@ message LeaseCandidateList { // LeaseCandidateSpec is a specification of a Lease. message LeaseCandidateSpec { - // LeaseName is the name of the lease for which this candidate is contending. + // leaseName is the name of the lease for which this candidate is contending. // This field is immutable. // +required optional string leaseName = 1; - // PingTime is the last time that the server has requested the LeaseCandidate + // pingTime is the last time that the server has requested the LeaseCandidate // to renew. It is only done during leader election to check if any // LeaseCandidates have become ineligible. When PingTime is updated, the // LeaseCandidate will respond by updating RenewTime. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.MicroTime pingTime = 2; - // RenewTime is the time that the LeaseCandidate was last updated. + // renewTime is the time that the LeaseCandidate was last updated. // Any time a Lease needs to do leader election, the PingTime field // is updated to signal to the LeaseCandidate that they should update // the RenewTime. @@ -77,18 +78,18 @@ message LeaseCandidateSpec { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.MicroTime renewTime = 3; - // BinaryVersion is the binary version. It must be in a semver format without leading `v`. + // binaryVersion is the binary version. It must be in a semver format without leading `v`. // This field is required. // +required optional string binaryVersion = 4; - // EmulationVersion is the emulation version. It must be in a semver format without leading `v`. + // emulationVersion is the emulation version. It must be in a semver format without leading `v`. // EmulationVersion must be less than or equal to BinaryVersion. // This field is required when strategy is "OldestEmulationVersion" // +optional optional string emulationVersion = 5; - // Strategy is the strategy that coordinated leader election will use for picking the leader. + // strategy is the strategy that coordinated leader election will use for picking the leader. // If multiple candidates for the same Lease return different strategies, the strategy provided // by the candidate with the latest BinaryVersion will be used. If there is still conflict, // this is a user error and coordinated leader election will not operate the Lease until resolved. diff --git a/vendor/k8s.io/api/coordination/v1alpha2/types.go b/vendor/k8s.io/api/coordination/v1alpha2/types.go index f8a6d33af1..ff32ee16fb 100644 --- a/vendor/k8s.io/api/coordination/v1alpha2/types.go +++ b/vendor/k8s.io/api/coordination/v1alpha2/types.go @@ -28,7 +28,8 @@ import ( // LeaseCandidate defines a candidate for a Lease object. // Candidates are created such that coordinated leader election will pick the best leader from the list of candidates. type LeaseCandidate struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -41,17 +42,17 @@ type LeaseCandidate struct { // LeaseCandidateSpec is a specification of a Lease. type LeaseCandidateSpec struct { - // LeaseName is the name of the lease for which this candidate is contending. + // leaseName is the name of the lease for which this candidate is contending. // This field is immutable. // +required LeaseName string `json:"leaseName" protobuf:"bytes,1,name=leaseName"` - // PingTime is the last time that the server has requested the LeaseCandidate + // pingTime is the last time that the server has requested the LeaseCandidate // to renew. It is only done during leader election to check if any // LeaseCandidates have become ineligible. When PingTime is updated, the // LeaseCandidate will respond by updating RenewTime. // +optional PingTime *metav1.MicroTime `json:"pingTime,omitempty" protobuf:"bytes,2,opt,name=pingTime"` - // RenewTime is the time that the LeaseCandidate was last updated. + // renewTime is the time that the LeaseCandidate was last updated. // Any time a Lease needs to do leader election, the PingTime field // is updated to signal to the LeaseCandidate that they should update // the RenewTime. @@ -60,16 +61,16 @@ type LeaseCandidateSpec struct { // garbage collection for still active LeaseCandidates. // +optional RenewTime *metav1.MicroTime `json:"renewTime,omitempty" protobuf:"bytes,3,opt,name=renewTime"` - // BinaryVersion is the binary version. It must be in a semver format without leading `v`. + // binaryVersion is the binary version. It must be in a semver format without leading `v`. // This field is required. // +required BinaryVersion string `json:"binaryVersion" protobuf:"bytes,4,name=binaryVersion"` - // EmulationVersion is the emulation version. It must be in a semver format without leading `v`. + // emulationVersion is the emulation version. It must be in a semver format without leading `v`. // EmulationVersion must be less than or equal to BinaryVersion. // This field is required when strategy is "OldestEmulationVersion" // +optional EmulationVersion string `json:"emulationVersion,omitempty" protobuf:"bytes,5,opt,name=emulationVersion"` - // Strategy is the strategy that coordinated leader election will use for picking the leader. + // strategy is the strategy that coordinated leader election will use for picking the leader. // If multiple candidates for the same Lease return different strategies, the strategy provided // by the candidate with the latest BinaryVersion will be used. If there is still conflict, // this is a user error and coordinated leader election will not operate the Lease until resolved. @@ -82,7 +83,7 @@ type LeaseCandidateSpec struct { // LeaseCandidateList is a list of Lease objects. type LeaseCandidateList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional diff --git a/vendor/k8s.io/api/coordination/v1alpha2/types_swagger_doc_generated.go b/vendor/k8s.io/api/coordination/v1alpha2/types_swagger_doc_generated.go index f7e29849e4..2ab18a6f6b 100644 --- a/vendor/k8s.io/api/coordination/v1alpha2/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/coordination/v1alpha2/types_swagger_doc_generated.go @@ -29,7 +29,7 @@ package v1alpha2 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_LeaseCandidate = map[string]string{ "": "LeaseCandidate defines a candidate for a Lease object. Candidates are created such that coordinated leader election will pick the best leader from the list of candidates.", - "metadata": "More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec contains the specification of the Lease. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", } @@ -49,12 +49,12 @@ func (LeaseCandidateList) SwaggerDoc() map[string]string { var map_LeaseCandidateSpec = map[string]string{ "": "LeaseCandidateSpec is a specification of a Lease.", - "leaseName": "LeaseName is the name of the lease for which this candidate is contending. This field is immutable.", - "pingTime": "PingTime is the last time that the server has requested the LeaseCandidate to renew. It is only done during leader election to check if any LeaseCandidates have become ineligible. When PingTime is updated, the LeaseCandidate will respond by updating RenewTime.", - "renewTime": "RenewTime is the time that the LeaseCandidate was last updated. Any time a Lease needs to do leader election, the PingTime field is updated to signal to the LeaseCandidate that they should update the RenewTime. Old LeaseCandidate objects are also garbage collected if it has been hours since the last renew. The PingTime field is updated regularly to prevent garbage collection for still active LeaseCandidates.", - "binaryVersion": "BinaryVersion is the binary version. It must be in a semver format without leading `v`. This field is required.", - "emulationVersion": "EmulationVersion is the emulation version. It must be in a semver format without leading `v`. EmulationVersion must be less than or equal to BinaryVersion. This field is required when strategy is \"OldestEmulationVersion\"", - "strategy": "Strategy is the strategy that coordinated leader election will use for picking the leader. If multiple candidates for the same Lease return different strategies, the strategy provided by the candidate with the latest BinaryVersion will be used. If there is still conflict, this is a user error and coordinated leader election will not operate the Lease until resolved.", + "leaseName": "leaseName is the name of the lease for which this candidate is contending. This field is immutable.", + "pingTime": "pingTime is the last time that the server has requested the LeaseCandidate to renew. It is only done during leader election to check if any LeaseCandidates have become ineligible. When PingTime is updated, the LeaseCandidate will respond by updating RenewTime.", + "renewTime": "renewTime is the time that the LeaseCandidate was last updated. Any time a Lease needs to do leader election, the PingTime field is updated to signal to the LeaseCandidate that they should update the RenewTime. Old LeaseCandidate objects are also garbage collected if it has been hours since the last renew. The PingTime field is updated regularly to prevent garbage collection for still active LeaseCandidates.", + "binaryVersion": "binaryVersion is the binary version. It must be in a semver format without leading `v`. This field is required.", + "emulationVersion": "emulationVersion is the emulation version. It must be in a semver format without leading `v`. EmulationVersion must be less than or equal to BinaryVersion. This field is required when strategy is \"OldestEmulationVersion\"", + "strategy": "strategy is the strategy that coordinated leader election will use for picking the leader. If multiple candidates for the same Lease return different strategies, the strategy provided by the candidate with the latest BinaryVersion will be used. If there is still conflict, this is a user error and coordinated leader election will not operate the Lease until resolved.", } func (LeaseCandidateSpec) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/coordination/v1beta1/generated.proto b/vendor/k8s.io/api/coordination/v1beta1/generated.proto index 74df40c64f..510b230f79 100644 --- a/vendor/k8s.io/api/coordination/v1beta1/generated.proto +++ b/vendor/k8s.io/api/coordination/v1beta1/generated.proto @@ -31,6 +31,7 @@ option go_package = "k8s.io/api/coordination/v1beta1"; // Lease defines a lease concept. message Lease { + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -44,6 +45,7 @@ message Lease { // LeaseCandidate defines a candidate for a Lease object. // Candidates are created such that coordinated leader election will pick the best leader from the list of candidates. message LeaseCandidate { + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -67,21 +69,21 @@ message LeaseCandidateList { // LeaseCandidateSpec is a specification of a Lease. message LeaseCandidateSpec { - // LeaseName is the name of the lease for which this candidate is contending. + // leaseName is the name of the lease for which this candidate is contending. // The limits on this field are the same as on Lease.name. Multiple lease candidates // may reference the same Lease.name. // This field is immutable. // +required optional string leaseName = 1; - // PingTime is the last time that the server has requested the LeaseCandidate + // pingTime is the last time that the server has requested the LeaseCandidate // to renew. It is only done during leader election to check if any // LeaseCandidates have become ineligible. When PingTime is updated, the // LeaseCandidate will respond by updating RenewTime. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.MicroTime pingTime = 2; - // RenewTime is the time that the LeaseCandidate was last updated. + // renewTime is the time that the LeaseCandidate was last updated. // Any time a Lease needs to do leader election, the PingTime field // is updated to signal to the LeaseCandidate that they should update // the RenewTime. @@ -91,18 +93,18 @@ message LeaseCandidateSpec { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.MicroTime renewTime = 3; - // BinaryVersion is the binary version. It must be in a semver format without leading `v`. + // binaryVersion is the binary version. It must be in a semver format without leading `v`. // This field is required. // +required optional string binaryVersion = 4; - // EmulationVersion is the emulation version. It must be in a semver format without leading `v`. + // emulationVersion is the emulation version. It must be in a semver format without leading `v`. // EmulationVersion must be less than or equal to BinaryVersion. // This field is required when strategy is "OldestEmulationVersion" // +optional optional string emulationVersion = 5; - // Strategy is the strategy that coordinated leader election will use for picking the leader. + // strategy is the strategy that coordinated leader election will use for picking the leader. // If multiple candidates for the same Lease return different strategies, the strategy provided // by the candidate with the latest BinaryVersion will be used. If there is still conflict, // this is a user error and coordinated leader election will not operate the Lease until resolved. @@ -149,13 +151,13 @@ message LeaseSpec { // +optional optional int32 leaseTransitions = 5; - // Strategy indicates the strategy for picking the leader for coordinated leader election + // strategy indicates the strategy for picking the leader for coordinated leader election. // (Alpha) Using this field requires the CoordinatedLeaderElection feature gate to be enabled. // +featureGate=CoordinatedLeaderElection // +optional optional string strategy = 6; - // PreferredHolder signals to a lease holder that the lease has a + // preferredHolder signals to a lease holder that the lease has a // more optimal holder and should be given up. // +featureGate=CoordinatedLeaderElection // +optional diff --git a/vendor/k8s.io/api/coordination/v1beta1/types.go b/vendor/k8s.io/api/coordination/v1beta1/types.go index ba6d6aa095..3141d7062a 100644 --- a/vendor/k8s.io/api/coordination/v1beta1/types.go +++ b/vendor/k8s.io/api/coordination/v1beta1/types.go @@ -29,7 +29,8 @@ import ( // Lease defines a lease concept. type Lease struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -63,12 +64,12 @@ type LeaseSpec struct { // holders. // +optional LeaseTransitions *int32 `json:"leaseTransitions,omitempty" protobuf:"varint,5,opt,name=leaseTransitions"` - // Strategy indicates the strategy for picking the leader for coordinated leader election + // strategy indicates the strategy for picking the leader for coordinated leader election. // (Alpha) Using this field requires the CoordinatedLeaderElection feature gate to be enabled. // +featureGate=CoordinatedLeaderElection // +optional Strategy *v1.CoordinatedLeaseStrategy `json:"strategy,omitempty" protobuf:"bytes,6,opt,name=strategy"` - // PreferredHolder signals to a lease holder that the lease has a + // preferredHolder signals to a lease holder that the lease has a // more optimal holder and should be given up. // +featureGate=CoordinatedLeaderElection // +optional @@ -82,7 +83,7 @@ type LeaseSpec struct { // LeaseList is a list of Lease objects. type LeaseList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -99,7 +100,8 @@ type LeaseList struct { // LeaseCandidate defines a candidate for a Lease object. // Candidates are created such that coordinated leader election will pick the best leader from the list of candidates. type LeaseCandidate struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -112,19 +114,19 @@ type LeaseCandidate struct { // LeaseCandidateSpec is a specification of a Lease. type LeaseCandidateSpec struct { - // LeaseName is the name of the lease for which this candidate is contending. + // leaseName is the name of the lease for which this candidate is contending. // The limits on this field are the same as on Lease.name. Multiple lease candidates // may reference the same Lease.name. // This field is immutable. // +required LeaseName string `json:"leaseName" protobuf:"bytes,1,name=leaseName"` - // PingTime is the last time that the server has requested the LeaseCandidate + // pingTime is the last time that the server has requested the LeaseCandidate // to renew. It is only done during leader election to check if any // LeaseCandidates have become ineligible. When PingTime is updated, the // LeaseCandidate will respond by updating RenewTime. // +optional PingTime *metav1.MicroTime `json:"pingTime,omitempty" protobuf:"bytes,2,opt,name=pingTime"` - // RenewTime is the time that the LeaseCandidate was last updated. + // renewTime is the time that the LeaseCandidate was last updated. // Any time a Lease needs to do leader election, the PingTime field // is updated to signal to the LeaseCandidate that they should update // the RenewTime. @@ -133,16 +135,16 @@ type LeaseCandidateSpec struct { // garbage collection for still active LeaseCandidates. // +optional RenewTime *metav1.MicroTime `json:"renewTime,omitempty" protobuf:"bytes,3,opt,name=renewTime"` - // BinaryVersion is the binary version. It must be in a semver format without leading `v`. + // binaryVersion is the binary version. It must be in a semver format without leading `v`. // This field is required. // +required BinaryVersion string `json:"binaryVersion" protobuf:"bytes,4,name=binaryVersion"` - // EmulationVersion is the emulation version. It must be in a semver format without leading `v`. + // emulationVersion is the emulation version. It must be in a semver format without leading `v`. // EmulationVersion must be less than or equal to BinaryVersion. // This field is required when strategy is "OldestEmulationVersion" // +optional EmulationVersion string `json:"emulationVersion,omitempty" protobuf:"bytes,5,opt,name=emulationVersion"` - // Strategy is the strategy that coordinated leader election will use for picking the leader. + // strategy is the strategy that coordinated leader election will use for picking the leader. // If multiple candidates for the same Lease return different strategies, the strategy provided // by the candidate with the latest BinaryVersion will be used. If there is still conflict, // this is a user error and coordinated leader election will not operate the Lease until resolved. @@ -155,7 +157,7 @@ type LeaseCandidateSpec struct { // LeaseCandidateList is a list of Lease objects. type LeaseCandidateList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional diff --git a/vendor/k8s.io/api/coordination/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/coordination/v1beta1/types_swagger_doc_generated.go index 35812b77f3..c4297c5698 100644 --- a/vendor/k8s.io/api/coordination/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/coordination/v1beta1/types_swagger_doc_generated.go @@ -29,7 +29,7 @@ package v1beta1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_Lease = map[string]string{ "": "Lease defines a lease concept.", - "metadata": "More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec contains the specification of the Lease. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", } @@ -39,7 +39,7 @@ func (Lease) SwaggerDoc() map[string]string { var map_LeaseCandidate = map[string]string{ "": "LeaseCandidate defines a candidate for a Lease object. Candidates are created such that coordinated leader election will pick the best leader from the list of candidates.", - "metadata": "More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec contains the specification of the Lease. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", } @@ -59,12 +59,12 @@ func (LeaseCandidateList) SwaggerDoc() map[string]string { var map_LeaseCandidateSpec = map[string]string{ "": "LeaseCandidateSpec is a specification of a Lease.", - "leaseName": "LeaseName is the name of the lease for which this candidate is contending. The limits on this field are the same as on Lease.name. Multiple lease candidates may reference the same Lease.name. This field is immutable.", - "pingTime": "PingTime is the last time that the server has requested the LeaseCandidate to renew. It is only done during leader election to check if any LeaseCandidates have become ineligible. When PingTime is updated, the LeaseCandidate will respond by updating RenewTime.", - "renewTime": "RenewTime is the time that the LeaseCandidate was last updated. Any time a Lease needs to do leader election, the PingTime field is updated to signal to the LeaseCandidate that they should update the RenewTime. Old LeaseCandidate objects are also garbage collected if it has been hours since the last renew. The PingTime field is updated regularly to prevent garbage collection for still active LeaseCandidates.", - "binaryVersion": "BinaryVersion is the binary version. It must be in a semver format without leading `v`. This field is required.", - "emulationVersion": "EmulationVersion is the emulation version. It must be in a semver format without leading `v`. EmulationVersion must be less than or equal to BinaryVersion. This field is required when strategy is \"OldestEmulationVersion\"", - "strategy": "Strategy is the strategy that coordinated leader election will use for picking the leader. If multiple candidates for the same Lease return different strategies, the strategy provided by the candidate with the latest BinaryVersion will be used. If there is still conflict, this is a user error and coordinated leader election will not operate the Lease until resolved.", + "leaseName": "leaseName is the name of the lease for which this candidate is contending. The limits on this field are the same as on Lease.name. Multiple lease candidates may reference the same Lease.name. This field is immutable.", + "pingTime": "pingTime is the last time that the server has requested the LeaseCandidate to renew. It is only done during leader election to check if any LeaseCandidates have become ineligible. When PingTime is updated, the LeaseCandidate will respond by updating RenewTime.", + "renewTime": "renewTime is the time that the LeaseCandidate was last updated. Any time a Lease needs to do leader election, the PingTime field is updated to signal to the LeaseCandidate that they should update the RenewTime. Old LeaseCandidate objects are also garbage collected if it has been hours since the last renew. The PingTime field is updated regularly to prevent garbage collection for still active LeaseCandidates.", + "binaryVersion": "binaryVersion is the binary version. It must be in a semver format without leading `v`. This field is required.", + "emulationVersion": "emulationVersion is the emulation version. It must be in a semver format without leading `v`. EmulationVersion must be less than or equal to BinaryVersion. This field is required when strategy is \"OldestEmulationVersion\"", + "strategy": "strategy is the strategy that coordinated leader election will use for picking the leader. If multiple candidates for the same Lease return different strategies, the strategy provided by the candidate with the latest BinaryVersion will be used. If there is still conflict, this is a user error and coordinated leader election will not operate the Lease until resolved.", } func (LeaseCandidateSpec) SwaggerDoc() map[string]string { @@ -88,8 +88,8 @@ var map_LeaseSpec = map[string]string{ "acquireTime": "acquireTime is a time when the current lease was acquired.", "renewTime": "renewTime is a time when the current holder of a lease has last updated the lease.", "leaseTransitions": "leaseTransitions is the number of transitions of a lease between holders.", - "strategy": "Strategy indicates the strategy for picking the leader for coordinated leader election (Alpha) Using this field requires the CoordinatedLeaderElection feature gate to be enabled.", - "preferredHolder": "PreferredHolder signals to a lease holder that the lease has a more optimal holder and should be given up.", + "strategy": "strategy indicates the strategy for picking the leader for coordinated leader election. (Alpha) Using this field requires the CoordinatedLeaderElection feature gate to be enabled.", + "preferredHolder": "preferredHolder signals to a lease holder that the lease has a more optimal holder and should be given up.", } func (LeaseSpec) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/core/v1/generated.pb.go b/vendor/k8s.io/api/core/v1/generated.pb.go index 0fcbd5edf7..41bf20df28 100644 --- a/vendor/k8s.io/api/core/v1/generated.pb.go +++ b/vendor/k8s.io/api/core/v1/generated.pb.go @@ -158,6 +158,8 @@ func (m *EventSeries) Reset() { *m = EventSeries{} } func (m *EventSource) Reset() { *m = EventSource{} } +func (m *EvictionResponder) Reset() { *m = EvictionResponder{} } + func (m *ExecAction) Reset() { *m = ExecAction{} } func (m *FCVolumeSource) Reset() { *m = FCVolumeSource{} } @@ -244,6 +246,10 @@ func (m *NodeAddress) Reset() { *m = NodeAddress{} } func (m *NodeAffinity) Reset() { *m = NodeAffinity{} } +func (m *NodeAllocatableMappedResources) Reset() { *m = NodeAllocatableMappedResources{} } + +func (m *NodeAllocatableOverheadResources) Reset() { *m = NodeAllocatableOverheadResources{} } + func (m *NodeAllocatableResourceClaimStatus) Reset() { *m = NodeAllocatableResourceClaimStatus{} } func (m *NodeCondition) Reset() { *m = NodeCondition{} } @@ -258,6 +264,8 @@ func (m *NodeFeatures) Reset() { *m = NodeFeatures{} } func (m *NodeList) Reset() { *m = NodeList{} } +func (m *NodePodPreemptionPolicy) Reset() { *m = NodePodPreemptionPolicy{} } + func (m *NodeProxyOptions) Reset() { *m = NodeProxyOptions{} } func (m *NodeRuntimeHandler) Reset() { *m = NodeRuntimeHandler{} } @@ -360,14 +368,14 @@ func (m *PodSpec) Reset() { *m = PodSpec{} } func (m *PodStatus) Reset() { *m = PodStatus{} } -func (m *PodStatusResult) Reset() { *m = PodStatusResult{} } - func (m *PodTemplate) Reset() { *m = PodTemplate{} } func (m *PodTemplateList) Reset() { *m = PodTemplateList{} } func (m *PodTemplateSpec) Reset() { *m = PodTemplateSpec{} } +func (m *PodVolumeHealth) Reset() { *m = PodVolumeHealth{} } + func (m *PortStatus) Reset() { *m = PortStatus{} } func (m *PortworxVolumeSource) Reset() { *m = PortworxVolumeSource{} } @@ -498,6 +506,10 @@ func (m *Volume) Reset() { *m = Volume{} } func (m *VolumeDevice) Reset() { *m = VolumeDevice{} } +func (m *VolumeHealthCondition) Reset() { *m = VolumeHealthCondition{} } + +func (m *VolumeHealthStatus) Reset() { *m = VolumeHealthStatus{} } + func (m *VolumeMount) Reset() { *m = VolumeMount{} } func (m *VolumeMountStatus) Reset() { *m = VolumeMountStatus{} } @@ -1462,6 +1474,11 @@ func (m *ClusterTrustBundleProjection) MarshalToSizedBuffer(dAtA []byte) (int, e _ = i var l int _ = l + if m.User != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.User)) + i-- + dAtA[i] = 0x30 + } if m.Optional != nil { i-- if *m.Optional { @@ -1999,6 +2016,11 @@ func (m *ConfigMapVolumeSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.DefaultUser != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.DefaultUser)) + i-- + dAtA[i] = 0x28 + } if m.Optional != nil { i-- if *m.Optional { @@ -3035,6 +3057,11 @@ func (m *DownwardAPIVolumeFile) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.User != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.User)) + i-- + dAtA[i] = 0x28 + } if m.Mode != nil { i = encodeVarintGenerated(dAtA, i, uint64(*m.Mode)) i-- @@ -3092,6 +3119,11 @@ func (m *DownwardAPIVolumeSource) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l + if m.DefaultUser != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.DefaultUser)) + i-- + dAtA[i] = 0x18 + } if m.DefaultMode != nil { i = encodeVarintGenerated(dAtA, i, uint64(*m.DefaultMode)) i-- @@ -3134,6 +3166,11 @@ func (m *EmptyDirVolumeSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Mode != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.Mode)) + i-- + dAtA[i] = 0x18 + } if m.SizeLimit != nil { { size, err := m.SizeLimit.MarshalToSizedBuffer(dAtA[:i]) @@ -4207,6 +4244,39 @@ func (m *EventSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EvictionResponder) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EvictionResponder) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EvictionResponder) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Priority != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.Priority)) + i-- + dAtA[i] = 0x10 + } + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *ExecAction) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -4597,6 +4667,13 @@ func (m *GRPCAction) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Mode != nil { + i -= len(*m.Mode) + copy(dAtA[i:], *m.Mode) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Mode))) + i-- + dAtA[i] = 0x1a + } if m.Service != nil { i -= len(*m.Service) copy(dAtA[i:], *m.Service) @@ -4757,6 +4834,13 @@ func (m *HTTPGetAction) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Protocol != nil { + i -= len(*m.Protocol) + copy(dAtA[i:], *m.Protocol) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Protocol))) + i-- + dAtA[i] = 0x32 + } if len(m.HTTPHeaders) > 0 { for iNdEx := len(m.HTTPHeaders) - 1; iNdEx >= 0; iNdEx-- { { @@ -5209,6 +5293,11 @@ func (m *KeyToPath) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.User != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.User)) + i-- + dAtA[i] = 0x20 + } if m.Mode != nil { i = encodeVarintGenerated(dAtA, i, uint64(*m.Mode)) i-- @@ -6325,6 +6414,98 @@ func (m *NodeAffinity) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *NodeAllocatableMappedResources) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeAllocatableMappedResources) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeAllocatableMappedResources) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Quantity != nil { + { + size, err := m.Quantity.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *NodeAllocatableOverheadResources) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeAllocatableOverheadResources) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeAllocatableOverheadResources) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PerContainer != nil { + { + size, err := m.PerContainer.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.PerPod != nil { + { + size, err := m.PerPod.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *NodeAllocatableResourceClaimStatus) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -6345,17 +6526,10 @@ func (m *NodeAllocatableResourceClaimStatus) MarshalToSizedBuffer(dAtA []byte) ( _ = i var l int _ = l - if len(m.Resources) > 0 { - keysForResources := make([]string, 0, len(m.Resources)) - for k := range m.Resources { - keysForResources = append(keysForResources, string(k)) - } - sort.Strings(keysForResources) - for iNdEx := len(keysForResources) - 1; iNdEx >= 0; iNdEx-- { - v := m.Resources[ResourceName(keysForResources[iNdEx])] - baseI := i + if len(m.Overhead) > 0 { + for iNdEx := len(m.Overhead) - 1; iNdEx >= 0; iNdEx-- { { - size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Overhead[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -6363,15 +6537,21 @@ func (m *NodeAllocatableResourceClaimStatus) MarshalToSizedBuffer(dAtA []byte) ( i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - i -= len(keysForResources[iNdEx]) - copy(dAtA[i:], keysForResources[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(keysForResources[iNdEx]))) - i-- - dAtA[i] = 0xa - i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) + dAtA[i] = 0x2a + } + } + if len(m.Mapping) > 0 { + for iNdEx := len(m.Mapping) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Mapping[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } } if len(m.Containers) > 0 { @@ -6666,6 +6846,38 @@ func (m *NodeList) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *NodePodPreemptionPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodePodPreemptionPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodePodPreemptionPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DisableResizePreemption) > 0 { + for iNdEx := len(m.DisableResizePreemption) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.DisableResizePreemption[iNdEx]) + copy(dAtA[i:], m.DisableResizePreemption[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.DisableResizePreemption[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *NodeProxyOptions) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -6927,6 +7139,18 @@ func (m *NodeSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.PodPreemptionPolicy != nil { + { + size, err := m.PodPreemptionPolicy.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } if len(m.PodCIDRs) > 0 { for iNdEx := len(m.PodCIDRs) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.PodCIDRs[iNdEx]) @@ -7254,6 +7478,16 @@ func (m *NodeSystemInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.RunningInUserNamespace != nil { + i-- + if *m.RunningInUserNamespace { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x60 + } if m.Swap != nil { { size, err := m.Swap.MarshalToSizedBuffer(dAtA[:i]) @@ -7750,6 +7984,18 @@ func (m *PersistentVolumeClaimStatus) MarshalToSizedBuffer(dAtA []byte) (int, er _ = i var l int _ = l + if m.HealthStatus != nil { + { + size, err := m.HealthStatus.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + } if m.ModifyVolumeStatus != nil { { size, err := m.ModifyVolumeStatus.MarshalToSizedBuffer(dAtA[:i]) @@ -8834,6 +9080,11 @@ func (m *PodCertificateProjection) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l + if m.User != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.User)) + i-- + dAtA[i] = 0x40 + } if len(m.UserAnnotations) > 0 { keysForUserAnnotations := make([]string, 0, len(m.UserAnnotations)) for k := range m.UserAnnotations { @@ -9769,6 +10020,22 @@ func (m *PodSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.EvictionResponders) > 0 { + for iNdEx := len(m.EvictionResponders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.EvictionResponders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2 + i-- + dAtA[i] = 0xe2 + } + } if m.SchedulingGroup != nil { { size, err := m.SchedulingGroup.MarshalToSizedBuffer(dAtA[:i]) @@ -10280,6 +10547,22 @@ func (m *PodStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.VolumeHealth) > 0 { + for iNdEx := len(m.VolumeHealth) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.VolumeHealth[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xb2 + } + } if len(m.NodeAllocatableResourceClaimStatuses) > 0 { for iNdEx := len(m.NodeAllocatableResourceClaimStatuses) - 1; iNdEx >= 0; iNdEx-- { { @@ -10515,49 +10798,6 @@ func (m *PodStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *PodStatusResult) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PodStatusResult) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PodStatusResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - func (m *PodTemplate) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -10691,6 +10931,58 @@ func (m *PodTemplateSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *PodVolumeHealth) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodVolumeHealth) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodVolumeHealth) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.LastTransitionTime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.HealthConditions) > 0 { + for iNdEx := len(m.HealthConditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.HealthConditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *PortStatus) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -11033,6 +11325,11 @@ func (m *ProjectedVolumeSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.DefaultUser != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.DefaultUser)) + i-- + dAtA[i] = 0x18 + } if m.DefaultMode != nil { i = encodeVarintGenerated(dAtA, i, uint64(*m.DefaultMode)) i-- @@ -12764,6 +13061,11 @@ func (m *SecretVolumeSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.DefaultUser != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.DefaultUser)) + i-- + dAtA[i] = 0x28 + } if m.Optional != nil { i-- if *m.Optional { @@ -13165,6 +13467,11 @@ func (m *ServiceAccountTokenProjection) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if m.User != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.User)) + i-- + dAtA[i] = 0x20 + } i -= len(m.Path) copy(dAtA[i:], m.Path) i = encodeVarintGenerated(dAtA, i, uint64(len(m.Path))) @@ -14217,6 +14524,91 @@ func (m *VolumeDevice) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *VolumeHealthCondition) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VolumeHealthCondition) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VolumeHealthCondition) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Message) + copy(dAtA[i:], m.Message) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Message))) + i-- + dAtA[i] = 0x1a + i -= len(m.Reason) + copy(dAtA[i:], m.Reason) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Reason))) + i-- + dAtA[i] = 0x12 + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Status))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *VolumeHealthStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VolumeHealthStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VolumeHealthStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.LastTransitionTime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.HealthConditions) > 0 { + for iNdEx := len(m.HealthConditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.HealthConditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *VolumeMount) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -14237,6 +14629,15 @@ func (m *VolumeMount) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.BindMountOptions) > 0 { + for iNdEx := len(m.BindMountOptions) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.BindMountOptions[iNdEx]) + copy(dAtA[i:], m.BindMountOptions[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.BindMountOptions[iNdEx]))) + i-- + dAtA[i] = 0x42 + } + } if m.RecursiveReadOnly != nil { i -= len(*m.RecursiveReadOnly) copy(dAtA[i:], *m.RecursiveReadOnly) @@ -15515,6 +15916,9 @@ func (m *ClusterTrustBundleProjection) Size() (n int) { if m.Optional != nil { n += 2 } + if m.User != nil { + n += 1 + sovGenerated(uint64(*m.User)) + } return n } @@ -15709,6 +16113,9 @@ func (m *ConfigMapVolumeSource) Size() (n int) { if m.Optional != nil { n += 2 } + if m.DefaultUser != nil { + n += 1 + sovGenerated(uint64(*m.DefaultUser)) + } return n } @@ -16090,6 +16497,9 @@ func (m *DownwardAPIVolumeFile) Size() (n int) { if m.Mode != nil { n += 1 + sovGenerated(uint64(*m.Mode)) } + if m.User != nil { + n += 1 + sovGenerated(uint64(*m.User)) + } return n } @@ -16108,6 +16518,9 @@ func (m *DownwardAPIVolumeSource) Size() (n int) { if m.DefaultMode != nil { n += 1 + sovGenerated(uint64(*m.DefaultMode)) } + if m.DefaultUser != nil { + n += 1 + sovGenerated(uint64(*m.DefaultUser)) + } return n } @@ -16123,6 +16536,9 @@ func (m *EmptyDirVolumeSource) Size() (n int) { l = m.SizeLimit.Size() n += 1 + l + sovGenerated(uint64(l)) } + if m.Mode != nil { + n += 1 + sovGenerated(uint64(*m.Mode)) + } return n } @@ -16505,6 +16921,20 @@ func (m *EventSource) Size() (n int) { return n } +func (m *EvictionResponder) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if m.Priority != nil { + n += 1 + sovGenerated(uint64(*m.Priority)) + } + return n +} + func (m *ExecAction) Size() (n int) { if m == nil { return 0 @@ -16656,6 +17086,10 @@ func (m *GRPCAction) Size() (n int) { l = len(*m.Service) n += 1 + l + sovGenerated(uint64(l)) } + if m.Mode != nil { + l = len(*m.Mode) + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -16726,6 +17160,10 @@ func (m *HTTPGetAction) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) } } + if m.Protocol != nil { + l = len(*m.Protocol) + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -16892,6 +17330,9 @@ func (m *KeyToPath) Size() (n int) { if m.Mode != nil { n += 1 + sovGenerated(uint64(*m.Mode)) } + if m.User != nil { + n += 1 + sovGenerated(uint64(*m.User)) + } return n } @@ -17296,6 +17737,40 @@ func (m *NodeAffinity) Size() (n int) { return n } +func (m *NodeAllocatableMappedResources) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if m.Quantity != nil { + l = m.Quantity.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *NodeAllocatableOverheadResources) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if m.PerPod != nil { + l = m.PerPod.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.PerContainer != nil { + l = m.PerContainer.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + func (m *NodeAllocatableResourceClaimStatus) Size() (n int) { if m == nil { return 0 @@ -17310,13 +17785,16 @@ func (m *NodeAllocatableResourceClaimStatus) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) } } - if len(m.Resources) > 0 { - for k, v := range m.Resources { - _ = k - _ = v - l = v.Size() - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) - n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + if len(m.Mapping) > 0 { + for _, e := range m.Mapping { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.Overhead) > 0 { + for _, e := range m.Overhead { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) } } return n @@ -17419,6 +17897,21 @@ func (m *NodeList) Size() (n int) { return n } +func (m *NodePodPreemptionPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.DisableResizePreemption) > 0 { + for _, s := range m.DisableResizePreemption { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + func (m *NodeProxyOptions) Size() (n int) { if m == nil { return 0 @@ -17544,6 +18037,10 @@ func (m *NodeSpec) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) } } + if m.PodPreemptionPolicy != nil { + l = m.PodPreemptionPolicy.Size() + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -17672,6 +18169,9 @@ func (m *NodeSystemInfo) Size() (n int) { l = m.Swap.Size() n += 1 + l + sovGenerated(uint64(l)) } + if m.RunningInUserNamespace != nil { + n += 2 + } return n } @@ -17876,6 +18376,10 @@ func (m *PersistentVolumeClaimStatus) Size() (n int) { l = m.ModifyVolumeStatus.Size() n += 1 + l + sovGenerated(uint64(l)) } + if m.HealthStatus != nil { + l = m.HealthStatus.Size() + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -18238,6 +18742,9 @@ func (m *PodCertificateProjection) Size() (n int) { n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) } } + if m.User != nil { + n += 1 + sovGenerated(uint64(*m.User)) + } return n } @@ -18751,6 +19258,12 @@ func (m *PodSpec) Size() (n int) { l = m.SchedulingGroup.Size() n += 2 + l + sovGenerated(uint64(l)) } + if len(m.EvictionResponders) > 0 { + for _, e := range m.EvictionResponders { + l = e.Size() + n += 2 + l + sovGenerated(uint64(l)) + } + } return n } @@ -18846,19 +19359,12 @@ func (m *PodStatus) Size() (n int) { n += 2 + l + sovGenerated(uint64(l)) } } - return n -} - -func (m *PodStatusResult) Size() (n int) { - if m == nil { - return 0 + if len(m.VolumeHealth) > 0 { + for _, e := range m.VolumeHealth { + l = e.Size() + n += 2 + l + sovGenerated(uint64(l)) + } } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) return n } @@ -18905,6 +19411,25 @@ func (m *PodTemplateSpec) Size() (n int) { return n } +func (m *PodVolumeHealth) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if len(m.HealthConditions) > 0 { + for _, e := range m.HealthConditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + l = m.LastTransitionTime.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + func (m *PortStatus) Size() (n int) { if m == nil { return 0 @@ -19036,6 +19561,9 @@ func (m *ProjectedVolumeSource) Size() (n int) { if m.DefaultMode != nil { n += 1 + sovGenerated(uint64(*m.DefaultMode)) } + if m.DefaultUser != nil { + n += 1 + sovGenerated(uint64(*m.DefaultUser)) + } return n } @@ -19674,6 +20202,9 @@ func (m *SecretVolumeSource) Size() (n int) { if m.Optional != nil { n += 2 } + if m.DefaultUser != nil { + n += 1 + sovGenerated(uint64(*m.DefaultUser)) + } return n } @@ -19810,6 +20341,9 @@ func (m *ServiceAccountTokenProjection) Size() (n int) { } l = len(m.Path) n += 1 + l + sovGenerated(uint64(l)) + if m.User != nil { + n += 1 + sovGenerated(uint64(*m.User)) + } return n } @@ -20222,6 +20756,38 @@ func (m *VolumeDevice) Size() (n int) { return n } +func (m *VolumeHealthCondition) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Status) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Reason) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Message) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *VolumeHealthStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.HealthConditions) > 0 { + for _, e := range m.HealthConditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + l = m.LastTransitionTime.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + func (m *VolumeMount) Size() (n int) { if m == nil { return 0 @@ -20245,6 +20811,12 @@ func (m *VolumeMount) Size() (n int) { l = len(*m.RecursiveReadOnly) n += 1 + l + sovGenerated(uint64(l)) } + if len(m.BindMountOptions) > 0 { + for _, s := range m.BindMountOptions { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } return n } @@ -20797,6 +21369,7 @@ func (this *ClusterTrustBundleProjection) String() string { `LabelSelector:` + strings.Replace(fmt.Sprintf("%v", this.LabelSelector), "LabelSelector", "v1.LabelSelector", 1) + `,`, `Path:` + fmt.Sprintf("%v", this.Path) + `,`, `Optional:` + valueToStringGenerated(this.Optional) + `,`, + `User:` + valueToStringGenerated(this.User) + `,`, `}`, }, "") return s @@ -20963,6 +21536,7 @@ func (this *ConfigMapVolumeSource) String() string { `Items:` + repeatedStringForItems + `,`, `DefaultMode:` + valueToStringGenerated(this.DefaultMode) + `,`, `Optional:` + valueToStringGenerated(this.Optional) + `,`, + `DefaultUser:` + valueToStringGenerated(this.DefaultUser) + `,`, `}`, }, "") return s @@ -21243,6 +21817,7 @@ func (this *DownwardAPIVolumeFile) String() string { `FieldRef:` + strings.Replace(this.FieldRef.String(), "ObjectFieldSelector", "ObjectFieldSelector", 1) + `,`, `ResourceFieldRef:` + strings.Replace(this.ResourceFieldRef.String(), "ResourceFieldSelector", "ResourceFieldSelector", 1) + `,`, `Mode:` + valueToStringGenerated(this.Mode) + `,`, + `User:` + valueToStringGenerated(this.User) + `,`, `}`, }, "") return s @@ -21259,6 +21834,7 @@ func (this *DownwardAPIVolumeSource) String() string { s := strings.Join([]string{`&DownwardAPIVolumeSource{`, `Items:` + repeatedStringForItems + `,`, `DefaultMode:` + valueToStringGenerated(this.DefaultMode) + `,`, + `DefaultUser:` + valueToStringGenerated(this.DefaultUser) + `,`, `}`, }, "") return s @@ -21270,6 +21846,7 @@ func (this *EmptyDirVolumeSource) String() string { s := strings.Join([]string{`&EmptyDirVolumeSource{`, `Medium:` + fmt.Sprintf("%v", this.Medium) + `,`, `SizeLimit:` + strings.Replace(fmt.Sprintf("%v", this.SizeLimit), "Quantity", "resource.Quantity", 1) + `,`, + `Mode:` + valueToStringGenerated(this.Mode) + `,`, `}`, }, "") return s @@ -21549,6 +22126,17 @@ func (this *EventSource) String() string { }, "") return s } +func (this *EvictionResponder) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&EvictionResponder{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Priority:` + valueToStringGenerated(this.Priority) + `,`, + `}`, + }, "") + return s +} func (this *ExecAction) String() string { if this == nil { return "nil" @@ -21665,6 +22253,7 @@ func (this *GRPCAction) String() string { s := strings.Join([]string{`&GRPCAction{`, `Port:` + fmt.Sprintf("%v", this.Port) + `,`, `Service:` + valueToStringGenerated(this.Service) + `,`, + `Mode:` + valueToStringGenerated(this.Mode) + `,`, `}`, }, "") return s @@ -21721,6 +22310,7 @@ func (this *HTTPGetAction) String() string { `Host:` + fmt.Sprintf("%v", this.Host) + `,`, `Scheme:` + fmt.Sprintf("%v", this.Scheme) + `,`, `HTTPHeaders:` + repeatedStringForHTTPHeaders + `,`, + `Protocol:` + valueToStringGenerated(this.Protocol) + `,`, `}`, }, "") return s @@ -21837,6 +22427,7 @@ func (this *KeyToPath) String() string { `Key:` + fmt.Sprintf("%v", this.Key) + `,`, `Path:` + fmt.Sprintf("%v", this.Path) + `,`, `Mode:` + valueToStringGenerated(this.Mode) + `,`, + `User:` + valueToStringGenerated(this.User) + `,`, `}`, }, "") return s @@ -22185,24 +22776,48 @@ func (this *NodeAffinity) String() string { }, "") return s } +func (this *NodeAllocatableMappedResources) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NodeAllocatableMappedResources{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Quantity:` + strings.Replace(fmt.Sprintf("%v", this.Quantity), "Quantity", "resource.Quantity", 1) + `,`, + `}`, + }, "") + return s +} +func (this *NodeAllocatableOverheadResources) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NodeAllocatableOverheadResources{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `PerPod:` + strings.Replace(fmt.Sprintf("%v", this.PerPod), "Quantity", "resource.Quantity", 1) + `,`, + `PerContainer:` + strings.Replace(fmt.Sprintf("%v", this.PerContainer), "Quantity", "resource.Quantity", 1) + `,`, + `}`, + }, "") + return s +} func (this *NodeAllocatableResourceClaimStatus) String() string { if this == nil { return "nil" } - keysForResources := make([]string, 0, len(this.Resources)) - for k := range this.Resources { - keysForResources = append(keysForResources, string(k)) + repeatedStringForMapping := "[]NodeAllocatableMappedResources{" + for _, f := range this.Mapping { + repeatedStringForMapping += strings.Replace(strings.Replace(f.String(), "NodeAllocatableMappedResources", "NodeAllocatableMappedResources", 1), `&`, ``, 1) + "," } - sort.Strings(keysForResources) - mapStringForResources := "map[ResourceName]resource.Quantity{" - for _, k := range keysForResources { - mapStringForResources += fmt.Sprintf("%v: %v,", k, this.Resources[ResourceName(k)]) + repeatedStringForMapping += "}" + repeatedStringForOverhead := "[]NodeAllocatableOverheadResources{" + for _, f := range this.Overhead { + repeatedStringForOverhead += strings.Replace(strings.Replace(f.String(), "NodeAllocatableOverheadResources", "NodeAllocatableOverheadResources", 1), `&`, ``, 1) + "," } - mapStringForResources += "}" + repeatedStringForOverhead += "}" s := strings.Join([]string{`&NodeAllocatableResourceClaimStatus{`, `ResourceClaimName:` + fmt.Sprintf("%v", this.ResourceClaimName) + `,`, `Containers:` + fmt.Sprintf("%v", this.Containers) + `,`, - `Resources:` + mapStringForResources + `,`, + `Mapping:` + repeatedStringForMapping + `,`, + `Overhead:` + repeatedStringForOverhead + `,`, `}`, }, "") return s @@ -22281,6 +22896,16 @@ func (this *NodeList) String() string { }, "") return s } +func (this *NodePodPreemptionPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NodePodPreemptionPolicy{`, + `DisableResizePreemption:` + fmt.Sprintf("%v", this.DisableResizePreemption) + `,`, + `}`, + }, "") + return s +} func (this *NodeProxyOptions) String() string { if this == nil { return "nil" @@ -22378,6 +23003,7 @@ func (this *NodeSpec) String() string { `Taints:` + repeatedStringForTaints + `,`, `ConfigSource:` + strings.Replace(this.ConfigSource.String(), "NodeConfigSource", "NodeConfigSource", 1) + `,`, `PodCIDRs:` + fmt.Sprintf("%v", this.PodCIDRs) + `,`, + `PodPreemptionPolicy:` + strings.Replace(this.PodPreemptionPolicy.String(), "NodePodPreemptionPolicy", "NodePodPreemptionPolicy", 1) + `,`, `}`, }, "") return s @@ -22476,6 +23102,7 @@ func (this *NodeSystemInfo) String() string { `OperatingSystem:` + fmt.Sprintf("%v", this.OperatingSystem) + `,`, `Architecture:` + fmt.Sprintf("%v", this.Architecture) + `,`, `Swap:` + strings.Replace(this.Swap.String(), "NodeSwapStatus", "NodeSwapStatus", 1) + `,`, + `RunningInUserNamespace:` + valueToStringGenerated(this.RunningInUserNamespace) + `,`, `}`, }, "") return s @@ -22628,6 +23255,7 @@ func (this *PersistentVolumeClaimStatus) String() string { `AllocatedResourceStatuses:` + mapStringForAllocatedResourceStatuses + `,`, `CurrentVolumeAttributesClassName:` + valueToStringGenerated(this.CurrentVolumeAttributesClassName) + `,`, `ModifyVolumeStatus:` + strings.Replace(this.ModifyVolumeStatus.String(), "ModifyVolumeStatus", "ModifyVolumeStatus", 1) + `,`, + `HealthStatus:` + strings.Replace(this.HealthStatus.String(), "VolumeHealthStatus", "VolumeHealthStatus", 1) + `,`, `}`, }, "") return s @@ -22859,6 +23487,7 @@ func (this *PodCertificateProjection) String() string { `KeyPath:` + fmt.Sprintf("%v", this.KeyPath) + `,`, `CertificateChainPath:` + fmt.Sprintf("%v", this.CertificateChainPath) + `,`, `UserAnnotations:` + mapStringForUserAnnotations + `,`, + `User:` + valueToStringGenerated(this.User) + `,`, `}`, }, "") return s @@ -23162,6 +23791,11 @@ func (this *PodSpec) String() string { repeatedStringForResourceClaims += strings.Replace(strings.Replace(f.String(), "PodResourceClaim", "PodResourceClaim", 1), `&`, ``, 1) + "," } repeatedStringForResourceClaims += "}" + repeatedStringForEvictionResponders := "[]EvictionResponder{" + for _, f := range this.EvictionResponders { + repeatedStringForEvictionResponders += strings.Replace(strings.Replace(f.String(), "EvictionResponder", "EvictionResponder", 1), `&`, ``, 1) + "," + } + repeatedStringForEvictionResponders += "}" keysForNodeSelector := make([]string, 0, len(this.NodeSelector)) for k := range this.NodeSelector { keysForNodeSelector = append(keysForNodeSelector, k) @@ -23225,6 +23859,7 @@ func (this *PodSpec) String() string { `Resources:` + strings.Replace(this.Resources.String(), "ResourceRequirements", "ResourceRequirements", 1) + `,`, `HostnameOverride:` + valueToStringGenerated(this.HostnameOverride) + `,`, `SchedulingGroup:` + strings.Replace(this.SchedulingGroup.String(), "PodSchedulingGroup", "PodSchedulingGroup", 1) + `,`, + `EvictionResponders:` + repeatedStringForEvictionResponders + `,`, `}`, }, "") return s @@ -23273,6 +23908,11 @@ func (this *PodStatus) String() string { repeatedStringForNodeAllocatableResourceClaimStatuses += strings.Replace(strings.Replace(f.String(), "NodeAllocatableResourceClaimStatus", "NodeAllocatableResourceClaimStatus", 1), `&`, ``, 1) + "," } repeatedStringForNodeAllocatableResourceClaimStatuses += "}" + repeatedStringForVolumeHealth := "[]PodVolumeHealth{" + for _, f := range this.VolumeHealth { + repeatedStringForVolumeHealth += strings.Replace(strings.Replace(f.String(), "PodVolumeHealth", "PodVolumeHealth", 1), `&`, ``, 1) + "," + } + repeatedStringForVolumeHealth += "}" keysForAllocatedResources := make([]string, 0, len(this.AllocatedResources)) for k := range this.AllocatedResources { keysForAllocatedResources = append(keysForAllocatedResources, string(k)) @@ -23305,17 +23945,7 @@ func (this *PodStatus) String() string { `AllocatedResources:` + mapStringForAllocatedResources + `,`, `Resources:` + strings.Replace(this.Resources.String(), "ResourceRequirements", "ResourceRequirements", 1) + `,`, `NodeAllocatableResourceClaimStatuses:` + repeatedStringForNodeAllocatableResourceClaimStatuses + `,`, - `}`, - }, "") - return s -} -func (this *PodStatusResult) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PodStatusResult{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "PodStatus", "PodStatus", 1), `&`, ``, 1) + `,`, + `VolumeHealth:` + repeatedStringForVolumeHealth + `,`, `}`, }, "") return s @@ -23358,6 +23988,23 @@ func (this *PodTemplateSpec) String() string { }, "") return s } +func (this *PodVolumeHealth) String() string { + if this == nil { + return "nil" + } + repeatedStringForHealthConditions := "[]VolumeHealthCondition{" + for _, f := range this.HealthConditions { + repeatedStringForHealthConditions += strings.Replace(strings.Replace(f.String(), "VolumeHealthCondition", "VolumeHealthCondition", 1), `&`, ``, 1) + "," + } + repeatedStringForHealthConditions += "}" + s := strings.Join([]string{`&PodVolumeHealth{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `HealthConditions:` + repeatedStringForHealthConditions + `,`, + `LastTransitionTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastTransitionTime), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} func (this *PortStatus) String() string { if this == nil { return "nil" @@ -23457,6 +24104,7 @@ func (this *ProjectedVolumeSource) String() string { s := strings.Join([]string{`&ProjectedVolumeSource{`, `Sources:` + repeatedStringForSources + `,`, `DefaultMode:` + valueToStringGenerated(this.DefaultMode) + `,`, + `DefaultUser:` + valueToStringGenerated(this.DefaultUser) + `,`, `}`, }, "") return s @@ -23980,6 +24628,7 @@ func (this *SecretVolumeSource) String() string { `Items:` + repeatedStringForItems + `,`, `DefaultMode:` + valueToStringGenerated(this.DefaultMode) + `,`, `Optional:` + valueToStringGenerated(this.Optional) + `,`, + `DefaultUser:` + valueToStringGenerated(this.DefaultUser) + `,`, `}`, }, "") return s @@ -24074,6 +24723,7 @@ func (this *ServiceAccountTokenProjection) String() string { `Audience:` + fmt.Sprintf("%v", this.Audience) + `,`, `ExpirationSeconds:` + valueToStringGenerated(this.ExpirationSeconds) + `,`, `Path:` + fmt.Sprintf("%v", this.Path) + `,`, + `User:` + valueToStringGenerated(this.User) + `,`, `}`, }, "") return s @@ -24366,6 +25016,34 @@ func (this *VolumeDevice) String() string { }, "") return s } +func (this *VolumeHealthCondition) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&VolumeHealthCondition{`, + `Status:` + fmt.Sprintf("%v", this.Status) + `,`, + `Reason:` + fmt.Sprintf("%v", this.Reason) + `,`, + `Message:` + fmt.Sprintf("%v", this.Message) + `,`, + `}`, + }, "") + return s +} +func (this *VolumeHealthStatus) String() string { + if this == nil { + return "nil" + } + repeatedStringForHealthConditions := "[]VolumeHealthCondition{" + for _, f := range this.HealthConditions { + repeatedStringForHealthConditions += strings.Replace(strings.Replace(f.String(), "VolumeHealthCondition", "VolumeHealthCondition", 1), `&`, ``, 1) + "," + } + repeatedStringForHealthConditions += "}" + s := strings.Join([]string{`&VolumeHealthStatus{`, + `HealthConditions:` + repeatedStringForHealthConditions + `,`, + `LastTransitionTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastTransitionTime), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} func (this *VolumeMount) String() string { if this == nil { return "nil" @@ -24378,6 +25056,7 @@ func (this *VolumeMount) String() string { `MountPropagation:` + valueToStringGenerated(this.MountPropagation) + `,`, `SubPathExpr:` + fmt.Sprintf("%v", this.SubPathExpr) + `,`, `RecursiveReadOnly:` + valueToStringGenerated(this.RecursiveReadOnly) + `,`, + `BindMountOptions:` + fmt.Sprintf("%v", this.BindMountOptions) + `,`, `}`, }, "") return s @@ -27769,6 +28448,26 @@ func (m *ClusterTrustBundleProjection) Unmarshal(dAtA []byte) error { } b := bool(v != 0) m.Optional = &b + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.User = &v default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -29403,6 +30102,26 @@ func (m *ConfigMapVolumeSource) Unmarshal(dAtA []byte) error { } b := bool(v != 0) m.Optional = &b + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultUser", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DefaultUser = &v default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -32698,6 +33417,26 @@ func (m *DownwardAPIVolumeFile) Unmarshal(dAtA []byte) error { } } m.Mode = &v + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.User = &v default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -32802,6 +33541,26 @@ func (m *DownwardAPIVolumeSource) Unmarshal(dAtA []byte) error { } } m.DefaultMode = &v + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultUser", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DefaultUser = &v default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -32920,6 +33679,26 @@ func (m *EmptyDirVolumeSource) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Mode = &v default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -36125,6 +36904,108 @@ func (m *EventSource) Unmarshal(dAtA []byte) error { } return nil } +func (m *EvictionResponder) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EvictionResponder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EvictionResponder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Priority = &v + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *ExecAction) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -37502,6 +38383,39 @@ func (m *GRPCAction) Unmarshal(dAtA []byte) error { s := string(dAtA[iNdEx:postIndex]) m.Service = &s iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := GRPCProbeMode(dAtA[iNdEx:postIndex]) + m.Mode = &s + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -38162,6 +39076,39 @@ func (m *HTTPGetAction) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Protocol", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := HTTPProtocol(dAtA[iNdEx:postIndex]) + m.Protocol = &s + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -39633,6 +40580,26 @@ func (m *KeyToPath) Unmarshal(dAtA []byte) error { } } m.Mode = &v + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.User = &v default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -42489,8 +43456,206 @@ func (m *NamespaceList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Items = append(m.Items, Namespace{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Items = append(m.Items, Namespace{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NamespaceSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NamespaceSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NamespaceSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Finalizers", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Finalizers = append(m.Finalizers, FinalizerName(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NamespaceStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NamespaceStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NamespaceStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Phase", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Phase = NamespacePhase(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Conditions = append(m.Conditions, NamespaceCondition{}) + if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -42515,7 +43680,7 @@ func (m *NamespaceList) Unmarshal(dAtA []byte) error { } return nil } -func (m *NamespaceSpec) Unmarshal(dAtA []byte) error { +func (m *Node) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -42538,17 +43703,17 @@ func (m *NamespaceSpec) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: NamespaceSpec: wiretype end group for non-group") + return fmt.Errorf("proto: Node: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: NamespaceSpec: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Node: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Finalizers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -42558,23 +43723,90 @@ func (m *NamespaceSpec) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Finalizers = append(m.Finalizers, FinalizerName(dAtA[iNdEx:postIndex])) + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -42597,7 +43829,7 @@ func (m *NamespaceSpec) Unmarshal(dAtA []byte) error { } return nil } -func (m *NamespaceStatus) Unmarshal(dAtA []byte) error { +func (m *NodeAddress) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -42620,15 +43852,15 @@ func (m *NamespaceStatus) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: NamespaceStatus: wiretype end group for non-group") + return fmt.Errorf("proto: NodeAddress: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: NamespaceStatus: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NodeAddress: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Phase", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -42656,13 +43888,13 @@ func (m *NamespaceStatus) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Phase = NamespacePhase(dAtA[iNdEx:postIndex]) + m.Type = NodeAddressType(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -42672,25 +43904,23 @@ func (m *NamespaceStatus) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Conditions = append(m.Conditions, NamespaceCondition{}) - if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -42713,7 +43943,7 @@ func (m *NamespaceStatus) Unmarshal(dAtA []byte) error { } return nil } -func (m *Node) Unmarshal(dAtA []byte) error { +func (m *NodeAffinity) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -42736,15 +43966,15 @@ func (m *Node) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Node: wiretype end group for non-group") + return fmt.Errorf("proto: NodeAffinity: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Node: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NodeAffinity: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RequiredDuringSchedulingIgnoredDuringExecution", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -42771,46 +44001,16 @@ func (m *Node) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF + if m.RequiredDuringSchedulingIgnoredDuringExecution == nil { + m.RequiredDuringSchedulingIgnoredDuringExecution = &NodeSelector{} } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RequiredDuringSchedulingIgnoredDuringExecution.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PreferredDuringSchedulingIgnoredDuringExecution", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -42837,7 +44037,8 @@ func (m *Node) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.PreferredDuringSchedulingIgnoredDuringExecution = append(m.PreferredDuringSchedulingIgnoredDuringExecution, PreferredSchedulingTerm{}) + if err := m.PreferredDuringSchedulingIgnoredDuringExecution[len(m.PreferredDuringSchedulingIgnoredDuringExecution)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -42862,7 +44063,7 @@ func (m *Node) Unmarshal(dAtA []byte) error { } return nil } -func (m *NodeAddress) Unmarshal(dAtA []byte) error { +func (m *NodeAllocatableMappedResources) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -42885,15 +44086,15 @@ func (m *NodeAddress) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: NodeAddress: wiretype end group for non-group") + return fmt.Errorf("proto: NodeAllocatableMappedResources: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: NodeAddress: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NodeAllocatableMappedResources: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -42921,13 +44122,13 @@ func (m *NodeAddress) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Type = NodeAddressType(dAtA[iNdEx:postIndex]) + m.Name = ResourceName(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Quantity", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -42937,23 +44138,27 @@ func (m *NodeAddress) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Address = string(dAtA[iNdEx:postIndex]) + if m.Quantity == nil { + m.Quantity = &resource.Quantity{} + } + if err := m.Quantity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -42976,7 +44181,7 @@ func (m *NodeAddress) Unmarshal(dAtA []byte) error { } return nil } -func (m *NodeAffinity) Unmarshal(dAtA []byte) error { +func (m *NodeAllocatableOverheadResources) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -42999,15 +44204,83 @@ func (m *NodeAffinity) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: NodeAffinity: wiretype end group for non-group") + return fmt.Errorf("proto: NodeAllocatableOverheadResources: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: NodeAffinity: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NodeAllocatableOverheadResources: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequiredDuringSchedulingIgnoredDuringExecution", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = ResourceName(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PerPod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PerPod == nil { + m.PerPod = &resource.Quantity{} + } + if err := m.PerPod.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PerContainer", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -43034,44 +44307,10 @@ func (m *NodeAffinity) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.RequiredDuringSchedulingIgnoredDuringExecution == nil { - m.RequiredDuringSchedulingIgnoredDuringExecution = &NodeSelector{} - } - if err := m.RequiredDuringSchedulingIgnoredDuringExecution.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PreferredDuringSchedulingIgnoredDuringExecution", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF + if m.PerContainer == nil { + m.PerContainer = &resource.Quantity{} } - m.PreferredDuringSchedulingIgnoredDuringExecution = append(m.PreferredDuringSchedulingIgnoredDuringExecution, PreferredSchedulingTerm{}) - if err := m.PreferredDuringSchedulingIgnoredDuringExecution[len(m.PreferredDuringSchedulingIgnoredDuringExecution)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.PerContainer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -43189,9 +44428,9 @@ func (m *NodeAllocatableResourceClaimStatus) Unmarshal(dAtA []byte) error { } m.Containers = append(m.Containers, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 3: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Mapping", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -43218,105 +44457,44 @@ func (m *NodeAllocatableResourceClaimStatus) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Resources == nil { - m.Resources = make(map[ResourceName]resource.Quantity) + m.Mapping = append(m.Mapping, NodeAllocatableMappedResources{}) + if err := m.Mapping[len(m.Mapping)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - var mapkey ResourceName - mapvalue := &resource.Quantity{} - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Overhead", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = ResourceName(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return ErrInvalidLengthGenerated - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return ErrInvalidLengthGenerated - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &resource.Quantity{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy + if iNdEx >= l { + return io.ErrUnexpectedEOF } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Overhead = append(m.Overhead, NodeAllocatableOverheadResources{}) + if err := m.Overhead[len(m.Overhead)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.Resources[ResourceName(mapkey)] = *mapvalue iNdEx = postIndex default: iNdEx = preIndex @@ -44130,6 +45308,88 @@ func (m *NodeList) Unmarshal(dAtA []byte) error { } return nil } +func (m *NodePodPreemptionPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NodePodPreemptionPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodePodPreemptionPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisableResizePreemption", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DisableResizePreemption = append(m.DisableResizePreemption, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *NodeProxyOptions) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -45017,6 +46277,42 @@ func (m *NodeSpec) Unmarshal(dAtA []byte) error { } m.PodCIDRs = append(m.PodCIDRs, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PodPreemptionPolicy", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PodPreemptionPolicy == nil { + m.PodPreemptionPolicy = &NodePodPreemptionPolicy{} + } + if err := m.PodPreemptionPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -46205,6 +47501,27 @@ func (m *NodeSystemInfo) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RunningInUserNamespace", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.RunningInUserNamespace = &b default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -48208,6 +49525,42 @@ func (m *PersistentVolumeClaimStatus) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HealthStatus", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.HealthStatus == nil { + m.HealthStatus = &VolumeHealthStatus{} + } + if err := m.HealthStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -51313,6 +52666,26 @@ func (m *PodCertificateProjection) Unmarshal(dAtA []byte) error { } m.UserAnnotations[mapkey] = mapvalue iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.User = &v default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -55517,6 +56890,40 @@ func (m *PodSpec) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 44: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EvictionResponders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EvictionResponders = append(m.EvictionResponders, EvictionResponder{}) + if err := m.EvictionResponders[len(m.EvictionResponders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -56351,6 +57758,40 @@ func (m *PodStatus) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 22: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VolumeHealth", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VolumeHealth = append(m.VolumeHealth, PodVolumeHealth{}) + if err := m.VolumeHealth[len(m.VolumeHealth)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -56372,7 +57813,7 @@ func (m *PodStatus) Unmarshal(dAtA []byte) error { } return nil } -func (m *PodStatusResult) Unmarshal(dAtA []byte) error { +func (m *PodTemplate) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -56395,10 +57836,10 @@ func (m *PodStatusResult) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PodStatusResult: wiretype end group for non-group") + return fmt.Errorf("proto: PodTemplate: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PodStatusResult: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PodTemplate: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -56436,7 +57877,7 @@ func (m *PodStatusResult) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Template", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -56463,7 +57904,7 @@ func (m *PodStatusResult) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Template.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -56488,7 +57929,7 @@ func (m *PodStatusResult) Unmarshal(dAtA []byte) error { } return nil } -func (m *PodTemplate) Unmarshal(dAtA []byte) error { +func (m *PodTemplateList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -56511,10 +57952,127 @@ func (m *PodTemplate) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PodTemplate: wiretype end group for non-group") + return fmt.Errorf("proto: PodTemplateList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PodTemplate: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PodTemplateList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, PodTemplate{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodTemplateSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodTemplateSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodTemplateSpec: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -56552,7 +58110,7 @@ func (m *PodTemplate) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Template", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -56579,7 +58137,7 @@ func (m *PodTemplate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Template.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -56604,7 +58162,7 @@ func (m *PodTemplate) Unmarshal(dAtA []byte) error { } return nil } -func (m *PodTemplateList) Unmarshal(dAtA []byte) error { +func (m *PodVolumeHealth) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -56627,17 +58185,17 @@ func (m *PodTemplateList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PodTemplateList: wiretype end group for non-group") + return fmt.Errorf("proto: PodVolumeHealth: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PodTemplateList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PodVolumeHealth: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -56647,28 +58205,27 @@ func (m *PodTemplateList) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field HealthConditions", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -56695,97 +58252,14 @@ func (m *PodTemplateList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Items = append(m.Items, PodTemplate{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.HealthConditions = append(m.HealthConditions, VolumeHealthCondition{}) + if err := m.HealthConditions[len(m.HealthConditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PodTemplateSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PodTemplateSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PodTemplateSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LastTransitionTime", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -56812,7 +58286,7 @@ func (m *PodTemplateSpec) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.LastTransitionTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -57945,6 +59419,26 @@ func (m *ProjectedVolumeSource) Unmarshal(dAtA []byte) error { } } m.DefaultMode = &v + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultUser", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DefaultUser = &v default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -63895,6 +65389,26 @@ func (m *SecretVolumeSource) Unmarshal(dAtA []byte) error { } b := bool(v != 0) m.Optional = &b + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultUser", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DefaultUser = &v default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -64937,6 +66451,26 @@ func (m *ServiceAccountTokenProjection) Unmarshal(dAtA []byte) error { } m.Path = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.User = &v default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -68111,11 +69645,158 @@ func (m *TypedObjectReference) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } s := string(dAtA[iNdEx:postIndex]) - m.APIGroup = &s + m.APIGroup = &s + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Kind = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Namespace = &s iNdEx = postIndex - case 2: + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Volume) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Volume: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Volume: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -68143,9 +69824,92 @@ func (m *TypedObjectReference) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Kind = string(dAtA[iNdEx:postIndex]) + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VolumeSource", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.VolumeSource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VolumeDevice) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VolumeDevice: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VolumeDevice: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } @@ -68177,9 +69941,9 @@ func (m *TypedObjectReference) Unmarshal(dAtA []byte) error { } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DevicePath", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -68207,8 +69971,7 @@ func (m *TypedObjectReference) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := string(dAtA[iNdEx:postIndex]) - m.Namespace = &s + m.DevicePath = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -68231,7 +69994,7 @@ func (m *TypedObjectReference) Unmarshal(dAtA []byte) error { } return nil } -func (m *Volume) Unmarshal(dAtA []byte) error { +func (m *VolumeHealthCondition) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -68254,15 +70017,15 @@ func (m *Volume) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Volume: wiretype end group for non-group") + return fmt.Errorf("proto: VolumeHealthCondition: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Volume: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: VolumeHealthCondition: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -68290,13 +70053,13 @@ func (m *Volume) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) + m.Status = VolumeHealthStatusType(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VolumeSource", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -68306,24 +70069,55 @@ func (m *Volume) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.VolumeSource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.Reason = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Message = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -68346,7 +70140,7 @@ func (m *Volume) Unmarshal(dAtA []byte) error { } return nil } -func (m *VolumeDevice) Unmarshal(dAtA []byte) error { +func (m *VolumeHealthStatus) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -68369,17 +70163,17 @@ func (m *VolumeDevice) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: VolumeDevice: wiretype end group for non-group") + return fmt.Errorf("proto: VolumeHealthStatus: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: VolumeDevice: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: VolumeHealthStatus: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field HealthConditions", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -68389,29 +70183,31 @@ func (m *VolumeDevice) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) + m.HealthConditions = append(m.HealthConditions, VolumeHealthCondition{}) + if err := m.HealthConditions[len(m.HealthConditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DevicePath", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LastTransitionTime", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -68421,23 +70217,24 @@ func (m *VolumeDevice) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.DevicePath = string(dAtA[iNdEx:postIndex]) + if err := m.LastTransitionTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -68703,6 +70500,38 @@ func (m *VolumeMount) Unmarshal(dAtA []byte) error { s := RecursiveReadOnlyMode(dAtA[iNdEx:postIndex]) m.RecursiveReadOnly = &s iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BindMountOptions", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BindMountOptions = append(m.BindMountOptions, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/vendor/k8s.io/api/core/v1/generated.proto b/vendor/k8s.io/api/core/v1/generated.proto index ba4f80e5ec..878555a6ec 100644 --- a/vendor/k8s.io/api/core/v1/generated.proto +++ b/vendor/k8s.io/api/core/v1/generated.proto @@ -185,6 +185,7 @@ message Binding { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // The target object that you want to bind to the standard object. @@ -466,6 +467,13 @@ message ClusterTrustBundleProjection { // Relative path from the volume root to write the bundle. optional string path = 4; + + // user is Optional: The owner UID of the created file. + // If specified, the item-level user field takes precedence over defaultUser. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + // +featureGate=AtomicWriteVolumeUserFields + // +optional + optional int64 user = 6; } // Information about the condition of a component. @@ -495,6 +503,7 @@ message ComponentStatus { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // List of component conditions observed @@ -547,6 +556,8 @@ message ConfigMap { // the Data field, this is enforced during validation process. // Using this field will require 1.10+ apiserver and // kubelet. + // Note: BinaryData keys are not currently propagated to container env vars + // via ConfigMapKeyRef or ConfigMapRef env sources; only Data keys are used. // +optional map binaryData = 3; } @@ -556,6 +567,7 @@ message ConfigMap { // // The contents of the target ConfigMap's Data field will represent the // key-value pairs as environment variables. +// Keys in the BinaryData field are not currently propagated to container env vars. message ConfigMapEnvSource { // The ConfigMap to select from. optional LocalObjectReference localObjectReference = 1; @@ -571,7 +583,8 @@ message ConfigMapKeySelector { // The ConfigMap to select from. optional LocalObjectReference localObjectReference = 1; - // The key to select. + // The key to select from the ConfigMap's Data field. + // Keys in the BinaryData field are not currently propagated to container env vars. optional string key = 2; // Specify whether the ConfigMap or its key must be defined @@ -674,6 +687,13 @@ message ConfigMapVolumeSource { // optional specify whether the ConfigMap or its keys must be defined // +optional optional bool optional = 4; + + // defaultUser is Optional: The owner UID of the created files by default. + // The defaultUser field is only used as a fallback when the item-level user field is unset. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + // +featureGate=AtomicWriteVolumeUserFields + // +optional + optional int64 defaultUser = 5; } // A single application container that you want to run within a pod. @@ -1216,6 +1236,13 @@ message DownwardAPIVolumeFile { // mode, like fsGroup, and the result can be other mode bits set. // +optional optional int32 mode = 4; + + // user is Optional: The owner UID of the created file. + // If specified, the item-level user field takes precedence over defaultUser. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + // +featureGate=AtomicWriteVolumeUserFields + // +optional + optional int64 user = 5; } // DownwardAPIVolumeSource represents a volume containing downward API info. @@ -1236,6 +1263,13 @@ message DownwardAPIVolumeSource { // mode, like fsGroup, and the result can be other mode bits set. // +optional optional int32 defaultMode = 2; + + // defaultUser is Optional: The owner UID of the created files by default. + // The defaultUser field is only used as a fallback when the item-level user field is unset. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + // +featureGate=AtomicWriteVolumeUserFields + // +optional + optional int64 defaultUser = 3; } // Represents an empty directory for a pod. @@ -1256,6 +1290,18 @@ message EmptyDirVolumeSource { // More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir // +optional optional .k8s.io.apimachinery.pkg.api.resource.Quantity sizeLimit = 2; + + // mode specifies the permission bits for the emptyDir directory, in numeric + // notation (e.g., 0755, 01777). Must be a value between 0000 and 01777. + // If not specified, defaults to 0777. + // This might be in conflict with other options that affect the file + // mode, like fsGroup. If fsGroup is specified, the fsGroup permissions + // will override the mode specified here. + // This field has no effect on Windows. + // This field is alpha and requires EmptyDirVolumeMode featuregate to be enabled. + // +featureGate=EmptyDirVolumeMode + // +optional + optional int32 mode = 3; } // EndpointAddress is a tuple that describes single IP address. @@ -1807,6 +1853,43 @@ message EventSource { optional string host = 2; } +// EvictionResponder allows you to specify the responder reacting to an Eviction. +// Responders should observe and communicate through the Eviction Resource API to help with +// the graceful eviction of a target (e.g. termination of a pod). +// +structType=atomic +message EvictionResponder { + // name allows you to identify the responder responding to the Eviction. + // + // It must be a valid domain-prefixed key (such as "acme.io/foo"). + // Domain names *.k8s.io and *.kubernetes.io are reserved. + // This field must be unique for each responder. + // This field is required. + // +required + // +k8s:required + // +k8s:format=k8s-prefixed-label-key + // +k8s:customValidation + optional string name = 1; + + // priority for this responder. Higher priorities are selected first by the evictionrequest-controller. + // If there are responders with the same priority, the responder whose domain name comes first in the + // alphabetical higher domain order, will be picked. This means that the top domain labels are compared + // alphabetically first, followed by the lower domain labels. The key is compared last. + // + // The responder that is the managing controller of the pod should set the value of + // this field to 10000 to allow both for preemption or fallback registration by other + // responders. + // + // The minimum value is 0 and the maximum value is 100000. + // The interval 0-999 is reserved for responders with *.k8s.io suffix. + // This field is required. + // +required + // +k8s:required + // +k8s:minimum=0 + // +k8s:maximum=100000 + // +k8s:customValidation + optional int32 priority = 2; +} + // ExecAction describes a "run in container" action. message ExecAction { // Command is the command line to execute inside the container, the working directory for the @@ -2001,6 +2084,14 @@ message GRPCAction { // +optional // +default="" optional string service = 2; + + // mode specifies the connection mode for the gRPC health probe. + // Set to "TLS" to use TLS without certificate verification. + // Set to "Plaintext" to use a plaintext (insecure) connection explicitly. + // If not specified, the probe uses a plaintext (insecure) connection. + // +featureGate=GRPCContainerProbeTLS + // +optional + optional string mode = 3; } // Represents a volume that is populated with the contents of a git repository. @@ -2092,6 +2183,12 @@ message HTTPGetAction { // +optional // +listType=atomic repeated HTTPHeader httpHeaders = 5; + + // Protocol selects the wire protocol for the probe connection. + // Nil defaults to HTTP/1.1. + // +optional + // +featureGate=H2CContainerProbe + optional string protocol = 6; } // HTTPHeader describes a custom header to be used in HTTP probes @@ -2303,6 +2400,13 @@ message KeyToPath { // mode, like fsGroup, and the result can be other mode bits set. // +optional optional int32 mode = 3; + + // user is Optional: The owner UID of the created file. + // If specified, the item-level user field takes precedence over defaultUser. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + // +featureGate=AtomicWriteVolumeUserFields + // +optional + optional int64 user = 4; } // Lifecycle describes actions that the management system should take in response to container lifecycle @@ -2557,6 +2661,8 @@ message NFSVolumeSource { // Namespace provides a scope for Names. // Use of multiple namespaces is optional. +// +k8s:supportsSubresource="/status" +// +k8s:supportsSubresource="/finalize" message Namespace { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -2634,6 +2740,8 @@ message NamespaceStatus { // Node is a worker node in Kubernetes. // Each node will have a unique identifier in the cache (i.e. in etcd). +// +k8s:supportsSubresource="/status" +// +k8s:supportsSubresource="/proxy" message Node { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -2686,20 +2794,86 @@ message NodeAffinity { repeated PreferredSchedulingTerm preferredDuringSchedulingIgnoredDuringExecution = 2; } +// NodeAllocatableMappedResources describes mapped node allocatable resource allocations. +message NodeAllocatableMappedResources { + // Name is the name of the resource (e.g., cpu, memory). + // +required + // +k8s:required + optional string name = 1; + + // Quantity is the total node allocatable resource capacity allocated for the claim. + // This claim's allocated devices is shared by all the containers referencing the claim. + // Kubelet adds this value to both requests and limits at the pod-level cgroup, and to limits at the container-level cgroup for each container referencing the claim. + // +required + // +k8s:required + optional .k8s.io.apimachinery.pkg.api.resource.Quantity quantity = 2; +} + +// NodeAllocatableOverheadResources describes auxiliary overhead resource allocations. +message NodeAllocatableOverheadResources { + // Name is the name of the resource (e.g., cpu, memory). + // +required + // +k8s:required + optional string name = 1; + + // PerPod is the flat overhead quantity allocated per pod. + // Adding to each container limit allows individual containers to utilize the overhead, while the parent pod-level cgroup limit caps the total usage at the pod boundary where the overhead is accounted for exactly once. + // At least one of PerPod or PerContainer must be specified. Specifying neither is an invalid configuration. + // +optional + // +k8s:optional + optional .k8s.io.apimachinery.pkg.api.resource.Quantity perPod = 2; + + // PerContainer is the variable overhead quantity applied for each container referencing the claim. + // The container references are recorded in `nodeAllocatableResourceClaimStatuses.containers`. + // The total overhead quantity allocated for the claim is computed as: + // Quantity = PerPod + (PerContainer * NumReferences) + // Kubelet accounts for this overhead in cgroups: + // - Pod-level cgroup (requests and limits): Kubelet adds PerPod + (PerContainer * NumReferences). + // - Container-level cgroup (limits only): Kubelet adds PerPod + PerContainer for each referencing container. + // This allows any single container to access the pod-level overhead, while the parent cgroup caps the total usage to account for PerPod exactly once. + // At least one of PerPod or PerContainer must be specified. Specifying neither is an invalid configuration. + // +optional + // +k8s:optional + optional .k8s.io.apimachinery.pkg.api.resource.Quantity perContainer = 3; +} + // NodeAllocatableResourceClaimStatus describes the status of node allocatable resources allocated via DRA. message NodeAllocatableResourceClaimStatus { // ResourceClaimName is the resource claim referenced by the pod that resulted in this node allocatable resource allocation. // +required + // +k8s:required optional string resourceClaimName = 1; // Containers lists the names of all containers in this pod that reference the claim. // +optional // +listType=set + // +k8s:optional + // +k8s:listType=set repeated string containers = 2; - // Resources is a map of the node-allocatable resource name to the aggregate quantity allocated to the claim. - // +required - map resources = 3; + // Mapping contains allocations through devices mapped in the device spec's `nodeAllocatableResources[...].mapping` field. + // This is used by kubelet for pod level and container-level cgroup enforcement. + // +optional + // +patchStrategy=merge + // +patchMergeKey=name + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + repeated NodeAllocatableMappedResources mapping = 4; + + // Overhead contains allocations through devices mapped in the device spec's `nodeAllocatableResources[...].overhead` field. + // This is used by kubelet for pod level and container-level cgroup enforcement. + // +optional + // +patchStrategy=merge + // +patchMergeKey=name + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + repeated NodeAllocatableOverheadResources overhead = 5; } // NodeCondition contains condition information for a node. @@ -2811,6 +2985,21 @@ message NodeList { repeated Node items = 2; } +// NodePodPreemptionPolicy defines the node-level policies governing preemption for pods on this node. +message NodePodPreemptionPolicy { + // DisableResizePreemption lists the owners (e.g., autoscalers, operators, administrators) + // that have requested to disable scheduler and Kubelet preemption for in-place pod resize on this node. + // If this list is non-empty, resize-induced preemption is disabled on this node. + // This is an alpha field and requires enabling the InPlacePodVerticalScalingSchedulerPreemption feature gate. + // +listType=set + // +k8s:listType=set + // +optional + // +k8s:maxItems=20 + // +k8s:optional + // +k8s:eachVal=+k8s:format=k8s-label-key + repeated string disableResizePreemption = 1; +} + // NodeProxyOptions is the query options to a Node's proxy call. message NodeProxyOptions { // Path is the URL path to use for the current proxy request to node. @@ -2903,6 +3092,9 @@ message NodeSpec { // ID of the node assigned by the cloud provider in the format: :// // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:update=NoModify + // +k8s:alpha(since: "1.36")=+k8s:update=NoUnset optional string providerID = 3; // Unschedulable controls node schedulability of new pods. By default, node is schedulable. @@ -2923,6 +3115,14 @@ message NodeSpec { // see: https://issues.k8s.io/61966 // +optional optional string externalID = 2; + + // PodPreemptionPolicy controls the node-level preemption behaviors for pods on this node. + // This is an alpha field and requires enabling the InPlacePodVerticalScalingSchedulerPreemption feature gate. + // +featureGate=InPlacePodVerticalScalingSchedulerPreemption + // +optional + // +k8s:optional + // +k8s:ifDisabled(InPlacePodVerticalScalingSchedulerPreemption)=+k8s:forbidden + optional NodePodPreemptionPolicy podPreemptionPolicy = 8; } // NodeStatus is information about the current status of a node. @@ -3059,6 +3259,11 @@ message NodeSystemInfo { // Swap Info reported by the node. optional NodeSwapStatus swap = 11; + + // Whether the node is running in a user namespace. + // +featureGate=KubeletInUserNamespace + // +optional + optional bool runningInUserNamespace = 12; } // ObjectFieldSelector selects an APIVersioned field of an object. @@ -3135,6 +3340,7 @@ message ObjectReference { // PersistentVolume (PV) is a storage resource provisioned by an administrator. // It is analogous to a node. // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes +// +k8s:supportsSubresource="/status" message PersistentVolume { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -3156,6 +3362,7 @@ message PersistentVolume { } // PersistentVolumeClaim is a user's request for and claim to a persistent volume +// +k8s:supportsSubresource="/status" message PersistentVolumeClaim { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -3256,8 +3463,8 @@ message PersistentVolumeClaimSpec { // * An existing PVC (PersistentVolumeClaim) // If the provisioner or an external controller can support the specified data source, // it will create a new volume based on the contents of the specified data source. - // When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, - // and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. + // dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be + // copied to dataSource when dataSourceRef.namespace is not specified. // If the namespace is specified, then dataSourceRef will not be copied to dataSource. // +optional optional TypedLocalObjectReference dataSource = 7; @@ -3283,7 +3490,6 @@ message PersistentVolumeClaimSpec { // specified. // * While dataSource only allows local objects, dataSourceRef allows objects // in any namespaces. - // (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. // (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. // +optional optional TypedObjectReference dataSourceRef = 8; @@ -3399,6 +3605,13 @@ message PersistentVolumeClaimStatus { // +featureGate=VolumeAttributesClass // +optional optional ModifyVolumeStatus modifyVolumeStatus = 9; + + // healthStatus contains the latest controller-reported health information + // for the volume bound to this claim. + // +featureGate=CSIVolumeHealth + // +optional + // +k8s:optional + optional VolumeHealthStatus healthStatus = 10; } // PersistentVolumeClaimTemplate is used to produce @@ -3409,6 +3622,7 @@ message PersistentVolumeClaimTemplate { // validation. // // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // The specification for the PersistentVolumeClaim. The entire content is @@ -3676,6 +3890,10 @@ message PhotonPersistentDiskVolumeSource { // Pod is a collection of containers that can run on a host. This resource is created // by clients and scheduled onto hosts. +// +k8s:supportsSubresource="/status" +// +k8s:supportsSubresource="/ephemeralcontainers" +// +k8s:supportsSubresource="/resize" +// +k8s:supportsSubresource="/eviction" message Pod { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -3931,6 +4149,13 @@ message PodCertificateProjection { // Signers should document the keys and values they support. Signers should // deny requests that contain keys they do not recognize. map userAnnotations = 7; + + // user is Optional: The owner UID of the created file. + // If specified, the item-level user field takes precedence over defaultUser. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + // +featureGate=AtomicWriteVolumeUserFields + // +optional + optional int64 user = 8; } // PodCondition contains details for the current condition of this pod. @@ -4390,11 +4615,8 @@ message PodSecurityContext { // Eligible volumes are in-tree FibreChannel and iSCSI volumes, and all CSI volumes // whose CSI driver announces SELinux support by setting spec.seLinuxMount: true in their // CSIDriver instance. Other volumes are always re-labelled recursively. - // "MountOption" value is allowed only when SELinuxMount feature gate is enabled. // - // If not specified and SELinuxMount feature gate is enabled, "MountOption" is used. - // If not specified and SELinuxMount feature gate is disabled, "MountOption" is used for ReadWriteOncePod volumes - // and "Recursive" for all other volumes. + // If not specified, "MountOption" is used. // // This field affects only Pods that have SELinux label set, either in PodSecurityContext or in SecurityContext of all containers. // @@ -4511,7 +4733,6 @@ message PodSpec { // DeprecatedServiceAccount is a deprecated alias for ServiceAccountName. // Deprecated: Use serviceAccountName instead. - // +k8s:conversion-gen=false // +optional optional string serviceAccount = 9; @@ -4532,19 +4753,16 @@ message PodSpec { // When `hostNetwork` is true, specified `hostPort` fields in port definitions must match `containerPort`, // and unspecified `hostPort` fields in port definitions are defaulted to match `containerPort`. // Default to false. - // +k8s:conversion-gen=false // +optional optional bool hostNetwork = 11; // Use the host's pid namespace. // Optional: Default to false. - // +k8s:conversion-gen=false // +optional optional bool hostPID = 12; // Use the host's ipc namespace. // Optional: Default to false. - // +k8s:conversion-gen=false // +optional optional bool hostIPC = 13; @@ -4553,7 +4771,6 @@ message PodSpec { // in the same pod, and the first process in each container will not be assigned PID 1. // HostPID and ShareProcessNamespace cannot both be set. // Optional: Default to false. - // +k8s:conversion-gen=false // +optional optional bool shareProcessNamespace = 27; @@ -4594,6 +4811,7 @@ message PodSpec { // If specified, the pod's tolerations. // +optional // +listType=atomic + // +k8s:alpha(since: "1.37")=+k8s:optional repeated Toleration tolerations = 22; // HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts @@ -4652,6 +4870,8 @@ message PodSpec { // PreemptionPolicy is the Policy for preempting pods with lower priority. // One of Never, PreemptLowerPriority. + // When Priority Admission Controller is enabled, it prevents users from setting + // this field. The admission controller populates this field from PriorityClassName. // Defaults to PreemptLowerPriority if unset. // +optional optional string preemptionPolicy = 31; @@ -4728,7 +4948,6 @@ message PodSpec { // When set to false, a new userns is created for the pod. Setting false is useful for // mitigating container breakout vulnerabilities even allowing users to run their // containers as root without actually having root privileges on the host. - // +k8s:conversion-gen=false // +optional optional bool hostUsers = 37; @@ -4787,7 +5006,6 @@ message PodSpec { // - `hostNetwork` must be set to false. // // This field must be a valid DNS subdomain as defined in RFC 1123 and contain at most 64 characters. - // Requires the HostnameOverride feature gate to be enabled. // // +featureGate=HostnameOverride // +optional @@ -4809,6 +5027,34 @@ message PodSpec { // +featureGate=GenericWorkload // +optional optional PodSchedulingGroup schedulingGroup = 43; + + // evictionResponders reference responders that react to Evictions based on EvictionRequests. + // Responders should observe and communicate through the Eviction Resource API to help with + // the graceful termination of a pod. The responders are selected sequentially, according to + // their specified priority. + // + // Responders should periodically report on an eviction progress by updating the + // .status.responders[].heartbeatTime field of the Eviction object. If this field is not updated + // within the heartbeat deadline defined by the Eviction API (currently 20 minutes), the eviction + // is passed over to the next responder with a lower priority. If there is no other responder, + // the last default imperative-eviction.k8s.io/evictor responder with a priority of 100 will + // evict the pod using the imperative Eviction API (pods//eviction subresource). + // + // The maximum length of the responders list is 10. + // Responders are not supported when the pod is part of a PodGroup (.spec.schedulingGroup is set). + // This field can only be set on creation and is immutable afterwards. + // +featureGate=EvictionRequestAPI + // +optional + // +patchMergeKey=name + // +patchStrategy=merge + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=10 + // +k8s:alpha(since: "1.37")=+k8s:dependentForbidden("schedulingGroup") + repeated EvictionResponder evictionResponders = 44; } // PodStatus represents information about the status of a pod. Status may trail the actual @@ -4993,24 +5239,25 @@ message PodStatus { // Examples include "cpu", "memory", "ephemeral-storage", and hugepages. // +featureGate=DRANodeAllocatableResources // +optional - // +listType=atomic + // +patchStrategy=merge + // +patchMergeKey=resourceClaimName + // +listType=map + // +listMapKey=resourceClaimName + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=resourceClaimName repeated NodeAllocatableResourceClaimStatus nodeAllocatableResourceClaimStatuses = 21; -} -// PodStatusResult is a wrapper for PodStatus returned by kubelet that can be encode/decoded -message PodStatusResult { - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // volumeHealth contains node-reported health for each volume the pod is using. + // Populated by the kubelet on the pod's node. + // +featureGate=CSIVolumeHealth // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - // Most recently observed status of the pod. - // This data may not be up to date. - // Populated by the system. - // Read-only. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional - optional PodStatus status = 2; + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + repeated PodVolumeHealth volumeHealth = 22; } // PodTemplate describes a template for creating copies of a predefined pod. @@ -5042,6 +5289,7 @@ message PodTemplateSpec { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Specification of the desired behavior of the pod. @@ -5050,6 +5298,35 @@ message PodTemplateSpec { optional PodSpec spec = 2; } +// PodVolumeHealth contains health information for a volume used by a pod, +// reported by the CSI node plugin via the kubelet. +message PodVolumeHealth { + // name matches an entry in pod.spec.volumes. + // +required + // +k8s:required + optional string name = 1; + + // conditions is the set of adverse conditions reported by + // the CSI node plugin for this volume on this node. + // At most 16 conditions may be reported. + // +optional + // +listType=map + // +listMapKey=status + // +patchMergeKey=status + // +patchStrategy=merge + // +listMapKey=reason + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=status + // +k8s:listMapKey=reason + // +k8s:maxItems=16 + repeated VolumeHealthCondition healthConditions = 2; + + // lastTransitionTime is when the current set of conditions first appeared. + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3; +} + // PortStatus represents the error condition of a service port message PortStatus { // Port is the port number of the service port of which status is recorded here @@ -5208,6 +5485,13 @@ message ProjectedVolumeSource { // mode, like fsGroup, and the result can be other mode bits set. // +optional optional int32 defaultMode = 2; + + // defaultUser is Optional: The owner UID of the created files by default. + // The defaultUser field is only used as a fallback when the item-level user field is unset. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + // +featureGate=AtomicWriteVolumeUserFields + // +optional + optional int64 defaultUser = 3; } // Represents a Quobyte mount that lasts the lifetime of a pod. @@ -5357,6 +5641,7 @@ message RangeAllocation { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Range is string that identifies the range represented by 'data'. @@ -5372,8 +5657,8 @@ message ReplicationController { // be the same as the Pod(s) that the replication controller manages. // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional - // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:format=k8s-long-name + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:format=k8s-long-name optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Spec defines the specification of the desired behavior of the replication controller. @@ -5430,18 +5715,18 @@ message ReplicationControllerSpec { // Defaults to 1. // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +default=1 - // +k8s:alpha(since: "1.36")=+k8s:minimum=0 + // +k8s:beta(since: "1.37")=+k8s:minimum=0 optional int32 replicas = 1; // Minimum number of seconds for which a newly created pod should be ready // without any of its container crashing, for it to be considered available. // Defaults to 0 (pod will be considered available as soon as it is ready) // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +default=0 - // +k8s:alpha(since: "1.36")=+k8s:minimum=0 + // +k8s:beta(since: "1.37")=+k8s:minimum=0 optional int32 minReadySeconds = 4; // Selector is a label query over pods that should match the Replicas count. @@ -5458,6 +5743,7 @@ message ReplicationControllerSpec { // The only allowed template.spec.restartPolicy value is "Always". // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional optional PodTemplateSpec template = 3; } @@ -5549,6 +5835,7 @@ message ResourceHealth { } // ResourceQuota sets aggregate quota restrictions enforced per namespace +// +k8s:supportsSubresource="/status" message ResourceQuota { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -5642,8 +5929,13 @@ message ResourceRequirements { // ResourceStatus represents the status of a single resource allocated to a Pod. message ResourceStatus { // Name of the resource. Must be unique within the pod and in case of non-DRA resource, match one of the resources from the pod spec. - // For DRA resources, the value must be "claim:/". - // When this status is reported about a container, the "claim_name" and "request" must match one of the claims of this container. + // For DRA resources, the value must be "claim:/" when + // container.resources.claims[*].request is set or "claim:" when + // container.resources.claims[*].request is empty. + // For DRA-backed extended resources, "claim:/" is used + // when the claim name and request name are recorded in pod.status.extendedResourceClaimStatus. + // When this status is reported about a container, the "claim_name" and "request" + // must match one of the claims of this container. // +required optional string name = 1; @@ -5854,6 +6146,8 @@ message Secret { // Used to facilitate programmatic handling of secret data. // More info: https://kubernetes.io/docs/concepts/configuration/secret/#secret-types // +optional + // +k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:immutable optional string type = 3; } @@ -5970,6 +6264,13 @@ message SecretVolumeSource { // optional field specify whether the Secret or its keys must be defined // +optional optional bool optional = 4; + + // defaultUser is Optional: The owner UID of the created files by default. + // The defaultUser field is only used as a fallback when the item-level user field is unset. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + // +featureGate=AtomicWriteVolumeUserFields + // +optional + optional int64 defaultUser = 5; } // SecurityContext holds security configuration that will be applied to a container. @@ -6076,6 +6377,8 @@ message SerializedReference { // Service is a named abstraction of software service (for example, mysql) consisting of local port // (for example 3306) that the proxy listens on, and the selector that determines which pods // will answer requests sent through the proxy. +// +k8s:supportsSubresource="/status" +// +k8s:supportsSubresource="/proxy" message Service { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -6169,6 +6472,13 @@ message ServiceAccountTokenProjection { // path is the path relative to the mount point of the file to project the // token into. optional string path = 3; + + // user is Optional: The owner UID of the created file. + // If specified, the item-level user field takes precedence over defaultUser. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + // +featureGate=AtomicWriteVolumeUserFields + // +optional + optional int64 user = 4; } // ServiceList holds a list of services. @@ -6511,6 +6821,7 @@ message ServiceStatus { // +patchStrategy=merge // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:opaqueType repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 2; } @@ -6638,6 +6949,8 @@ message Toleration { // Key is the taint key that the toleration applies to. Empty means match all taint keys. // If the key is empty, operator must be Exists; this combination means to match all values and all keys. // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:format=k8s-label-key optional string key = 1; // Operator represents a key's relationship to the value. @@ -6890,6 +7203,57 @@ message VolumeDevice { optional string devicePath = 2; } +// VolumeHealthCondition represents an adverse health condition reported for a volume. +message VolumeHealthCondition { + // status is the machine-parseable health category. + // Possible values: + // - "Inaccessible": the volume cannot be accessed. + // - "DataLoss": data loss has been detected on the volume. + // - "Degraded": the volume is functioning with reduced capability. + // +required + // +k8s:required + optional string status = 1; + + // reason is a brief CamelCase machine-parseable reason. + // Together with status it forms the unique identity of a condition entry. + // Maximum permitted length of a reason is 256 bytes. + // +required + // +k8s:required + // +k8s:maxBytes=256 + optional string reason = 2; + + // message is a human-readable description. + // Maximum permitted length of a message is 1024 bytes. + // +optional + // +k8s:optional + // +k8s:maxBytes=1024 + optional string message = 3; +} + +// VolumeHealthStatus contains health information for a volume reported +// by the CSI controller plugin. +message VolumeHealthStatus { + // conditions is the set of adverse conditions reported by + // the CSI controller plugin. An empty list means no adverse condition. + // At most 16 conditions may be reported. + // +optional + // +listType=map + // +listMapKey=status + // +patchMergeKey=status + // +patchStrategy=merge + // +listMapKey=reason + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=status + // +k8s:listMapKey=reason + // +k8s:maxItems=16 + repeated VolumeHealthCondition healthConditions = 1; + + // lastTransitionTime is when the current set of conditions first appeared. + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 2; +} + // VolumeMount describes a mounting of a Volume within a container. message VolumeMount { // This must match the Name of a Volume. @@ -6919,8 +7283,7 @@ message VolumeMount { // +optional optional string recursiveReadOnly = 7; - // Path within the container at which the volume should be mounted. Must - // not contain ':'. + // Path within the container at which the volume should be mounted. optional string mountPath = 3; // Path within the volume from which the container's volume should be mounted. @@ -6943,6 +7306,17 @@ message VolumeMount { // SubPathExpr and SubPath are mutually exclusive. // +optional optional string subPathExpr = 6; + + // bindMountOptions is the list of additional bind mount options to apply when + // mounting this volume into the container. Allowed values are noexec, + // nodev, and nosuid. These are Linux mount options and have no effect on + // Windows nodes. + // This field is not supported with image volumes. + // This is an alpha field and requires enabling the VolumeBindMountOptions feature gate. + // +featureGate=VolumeBindMountOptions + // +optional + // +listType=set + repeated string bindMountOptions = 8; } // VolumeMountStatus shows status of volume mounts. diff --git a/vendor/k8s.io/api/core/v1/register.go b/vendor/k8s.io/api/core/v1/register.go index 1aac0cb41e..0a42d182f4 100644 --- a/vendor/k8s.io/api/core/v1/register.go +++ b/vendor/k8s.io/api/core/v1/register.go @@ -46,7 +46,6 @@ func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &Pod{}, &PodList{}, - &PodStatusResult{}, &PodTemplate{}, &PodTemplateList{}, &ReplicationController{}, diff --git a/vendor/k8s.io/api/core/v1/types.go b/vendor/k8s.io/api/core/v1/types.go index ac0494f3c5..90b09fb9b2 100644 --- a/vendor/k8s.io/api/core/v1/types.go +++ b/vendor/k8s.io/api/core/v1/types.go @@ -41,7 +41,7 @@ type Volume struct { // volumeSource represents the location and type of the mounted volume. // If not specified, the Volume is implied to be an EmptyDir. // This implied behavior is deprecated and will be removed in a future version. - VolumeSource `json:",inline" protobuf:"bytes,2,opt,name=volumeSource"` + VolumeSource `json:"" protobuf:"bytes,2,opt,name=volumeSource"` } // Represents the source of a volume to mount. @@ -360,8 +360,9 @@ const ( // PersistentVolume (PV) is a storage resource provisioned by an administrator. // It is analogous to a node. // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes +// +k8s:supportsSubresource="/status" type PersistentVolume struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -388,7 +389,7 @@ type PersistentVolumeSpec struct { // +optional Capacity ResourceList `json:"capacity,omitempty" protobuf:"bytes,1,rep,name=capacity,casttype=ResourceList,castkey=ResourceName"` // persistentVolumeSource is the actual volume backing the persistent volume. - PersistentVolumeSource `json:",inline" protobuf:"bytes,2,opt,name=persistentVolumeSource"` + PersistentVolumeSource `json:"" protobuf:"bytes,2,opt,name=persistentVolumeSource"` // accessModes contains all ways the volume can be mounted. // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes // +optional @@ -495,7 +496,7 @@ type PersistentVolumeStatus struct { // PersistentVolumeList is a list of PersistentVolume items. type PersistentVolumeList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -510,8 +511,9 @@ type PersistentVolumeList struct { // +k8s:prerelease-lifecycle-gen:introduced=1.0 // PersistentVolumeClaim is a user's request for and claim to a persistent volume +// +k8s:supportsSubresource="/status" type PersistentVolumeClaim struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -534,7 +536,7 @@ type PersistentVolumeClaim struct { // PersistentVolumeClaimList is a list of PersistentVolumeClaim items. type PersistentVolumeClaimList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -578,8 +580,8 @@ type PersistentVolumeClaimSpec struct { // * An existing PVC (PersistentVolumeClaim) // If the provisioner or an external controller can support the specified data source, // it will create a new volume based on the contents of the specified data source. - // When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, - // and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. + // dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be + // copied to dataSource when dataSourceRef.namespace is not specified. // If the namespace is specified, then dataSourceRef will not be copied to dataSource. // +optional DataSource *TypedLocalObjectReference `json:"dataSource,omitempty" protobuf:"bytes,7,opt,name=dataSource"` @@ -604,7 +606,6 @@ type PersistentVolumeClaimSpec struct { // specified. // * While dataSource only allows local objects, dataSourceRef allows objects // in any namespaces. - // (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. // (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. // +optional DataSourceRef *TypedObjectReference `json:"dataSourceRef,omitempty" protobuf:"bytes,8,opt,name=dataSourceRef"` @@ -678,7 +679,7 @@ const ( // slightly longer than actual in-use time or unused time because of processing delays or // when this feature was enabled in the cluster. // - // Requires PersistentVolumeClaimUnusedSinceTime alpha featuregate + // Requires PersistentVolumeClaimUnusedSinceTime beta featuregate PersistentVolumeClaimUnused PersistentVolumeClaimConditionType = "Unused" ) @@ -764,6 +765,95 @@ type PersistentVolumeClaimCondition struct { Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"` } +// VolumeHealthStatusType describes the health status category of a volume. +// +enum +// +k8s:enum +type VolumeHealthStatusType string + +const ( + // VolumeHealthInaccessible indicates the volume cannot be accessed. + VolumeHealthInaccessible VolumeHealthStatusType = "Inaccessible" + // VolumeHealthDataLoss indicates data loss has been detected on the volume. + VolumeHealthDataLoss VolumeHealthStatusType = "DataLoss" + // VolumeHealthDegraded indicates the volume is functioning but with reduced capability. + VolumeHealthDegraded VolumeHealthStatusType = "Degraded" +) + +// VolumeHealthCondition represents an adverse health condition reported for a volume. +type VolumeHealthCondition struct { + // status is the machine-parseable health category. + // Possible values: + // - "Inaccessible": the volume cannot be accessed. + // - "DataLoss": data loss has been detected on the volume. + // - "Degraded": the volume is functioning with reduced capability. + // +required + // +k8s:required + Status VolumeHealthStatusType `json:"status" protobuf:"bytes,1,opt,name=status,casttype=VolumeHealthStatusType"` + // reason is a brief CamelCase machine-parseable reason. + // Together with status it forms the unique identity of a condition entry. + // Maximum permitted length of a reason is 256 bytes. + // +required + // +k8s:required + // +k8s:maxBytes=256 + Reason string `json:"reason" protobuf:"bytes,2,opt,name=reason"` + // message is a human-readable description. + // Maximum permitted length of a message is 1024 bytes. + // +optional + // +k8s:optional + // +k8s:maxBytes=1024 + Message string `json:"message,omitempty" protobuf:"bytes,3,opt,name=message"` +} + +// VolumeHealthStatus contains health information for a volume reported +// by the CSI controller plugin. +type VolumeHealthStatus struct { + // conditions is the set of adverse conditions reported by + // the CSI controller plugin. An empty list means no adverse condition. + // At most 16 conditions may be reported. + // +optional + // +listType=map + // +listMapKey=status + // +patchMergeKey=status + // +patchStrategy=merge + // +listMapKey=reason + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=status + // +k8s:listMapKey=reason + // +k8s:maxItems=16 + HealthConditions []VolumeHealthCondition `json:"healthConditions,omitempty" patchStrategy:"merge" patchMergeKey:"status" protobuf:"bytes,1,rep,name=healthConditions"` + // lastTransitionTime is when the current set of conditions first appeared. + // +optional + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,2,opt,name=lastTransitionTime"` +} + +// PodVolumeHealth contains health information for a volume used by a pod, +// reported by the CSI node plugin via the kubelet. +type PodVolumeHealth struct { + // name matches an entry in pod.spec.volumes. + // +required + // +k8s:required + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + // conditions is the set of adverse conditions reported by + // the CSI node plugin for this volume on this node. + // At most 16 conditions may be reported. + // +optional + // +listType=map + // +listMapKey=status + // +patchMergeKey=status + // +patchStrategy=merge + // +listMapKey=reason + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=status + // +k8s:listMapKey=reason + // +k8s:maxItems=16 + HealthConditions []VolumeHealthCondition `json:"healthConditions,omitempty" patchStrategy:"merge" patchMergeKey:"status" protobuf:"bytes,2,rep,name=healthConditions"` + // lastTransitionTime is when the current set of conditions first appeared. + // +optional + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"` +} + // PersistentVolumeClaimStatus is the current status of a persistent volume claim. type PersistentVolumeClaimStatus struct { // phase represents the current phase of PersistentVolumeClaim. @@ -857,6 +947,12 @@ type PersistentVolumeClaimStatus struct { // +featureGate=VolumeAttributesClass // +optional ModifyVolumeStatus *ModifyVolumeStatus `json:"modifyVolumeStatus,omitempty" protobuf:"bytes,9,opt,name=modifyVolumeStatus"` + // healthStatus contains the latest controller-reported health information + // for the volume bound to this claim. + // +featureGate=CSIVolumeHealth + // +optional + // +k8s:optional + HealthStatus *VolumeHealthStatus `json:"healthStatus,omitempty" protobuf:"bytes,10,opt,name=healthStatus"` } // +enum @@ -962,6 +1058,17 @@ type EmptyDirVolumeSource struct { // More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir // +optional SizeLimit *resource.Quantity `json:"sizeLimit,omitempty" protobuf:"bytes,2,opt,name=sizeLimit"` + // mode specifies the permission bits for the emptyDir directory, in numeric + // notation (e.g., 0755, 01777). Must be a value between 0000 and 01777. + // If not specified, defaults to 0777. + // This might be in conflict with other options that affect the file + // mode, like fsGroup. If fsGroup is specified, the fsGroup permissions + // will override the mode specified here. + // This field has no effect on Windows. + // This field is alpha and requires EmptyDirVolumeMode featuregate to be enabled. + // +featureGate=EmptyDirVolumeMode + // +optional + Mode *int32 `json:"mode,omitempty" protobuf:"varint,3,opt,name=mode"` } // Represents a Glusterfs mount that lasts the lifetime of a pod. @@ -1454,6 +1561,12 @@ type SecretVolumeSource struct { // optional field specify whether the Secret or its keys must be defined // +optional Optional *bool `json:"optional,omitempty" protobuf:"varint,4,opt,name=optional"` + // defaultUser is Optional: The owner UID of the created files by default. + // The defaultUser field is only used as a fallback when the item-level user field is unset. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + // +featureGate=AtomicWriteVolumeUserFields + // +optional + DefaultUser *int64 `json:"defaultUser,omitempty" protobuf:"varint,5,opt,name=defaultUser"` } const ( @@ -1467,7 +1580,7 @@ const ( // Note that this is identical to a secret volume source without the default // mode. type SecretProjection struct { - LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"` + LocalObjectReference `json:"" protobuf:"bytes,1,opt,name=localObjectReference"` // items if unspecified, each key-value pair in the Data field of the referenced // Secret will be projected into the volume as a file whose name is the // key and content is the value. If specified, the listed keys will be @@ -1877,7 +1990,7 @@ type StorageOSPersistentVolumeSource struct { // the items element is populated with specific mappings of keys to paths. // ConfigMap volumes support ownership management and SELinux relabeling. type ConfigMapVolumeSource struct { - LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"` + LocalObjectReference `json:"" protobuf:"bytes,1,opt,name=localObjectReference"` // items if unspecified, each key-value pair in the Data field of the referenced // ConfigMap will be projected into the volume as a file whose name is the // key and content is the value. If specified, the listed keys will be @@ -1900,6 +2013,12 @@ type ConfigMapVolumeSource struct { // optional specify whether the ConfigMap or its keys must be defined // +optional Optional *bool `json:"optional,omitempty" protobuf:"varint,4,opt,name=optional"` + // defaultUser is Optional: The owner UID of the created files by default. + // The defaultUser field is only used as a fallback when the item-level user field is unset. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + // +featureGate=AtomicWriteVolumeUserFields + // +optional + DefaultUser *int64 `json:"defaultUser,omitempty" protobuf:"varint,5,opt,name=defaultUser"` } const ( @@ -1914,7 +2033,7 @@ const ( // Note that this is identical to a configmap volume source without the default // mode. type ConfigMapProjection struct { - LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"` + LocalObjectReference `json:"" protobuf:"bytes,1,opt,name=localObjectReference"` // items if unspecified, each key-value pair in the Data field of the referenced // ConfigMap will be projected into the volume as a file whose name is the // key and content is the value. If specified, the listed keys will be @@ -1952,6 +2071,12 @@ type ServiceAccountTokenProjection struct { // path is the path relative to the mount point of the file to project the // token into. Path string `json:"path" protobuf:"bytes,3,opt,name=path"` + // user is Optional: The owner UID of the created file. + // If specified, the item-level user field takes precedence over defaultUser. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + // +featureGate=AtomicWriteVolumeUserFields + // +optional + User *int64 `json:"user,omitempty" protobuf:"varint,4,opt,name=user"` } // ClusterTrustBundleProjection describes how to select a set of @@ -1986,6 +2111,13 @@ type ClusterTrustBundleProjection struct { // Relative path from the volume root to write the bundle. Path string `json:"path" protobuf:"bytes,4,rep,name=path"` + + // user is Optional: The owner UID of the created file. + // If specified, the item-level user field takes precedence over defaultUser. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + // +featureGate=AtomicWriteVolumeUserFields + // +optional + User *int64 `json:"user,omitempty" protobuf:"varint,6,opt,name=user"` } // PodCertificateProjection provides a private key and X.509 certificate in the @@ -2074,6 +2206,13 @@ type PodCertificateProjection struct { // Signers should document the keys and values they support. Signers should // deny requests that contain keys they do not recognize. UserAnnotations map[string]string `json:"userAnnotations,omitempty" protobuf:"bytes,7,rep,name=userAnnotations"` + + // user is Optional: The owner UID of the created file. + // If specified, the item-level user field takes precedence over defaultUser. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + // +featureGate=AtomicWriteVolumeUserFields + // +optional + User *int64 `json:"user,omitempty" protobuf:"varint,8,opt,name=user"` } // Represents a projected volume source @@ -2091,6 +2230,12 @@ type ProjectedVolumeSource struct { // mode, like fsGroup, and the result can be other mode bits set. // +optional DefaultMode *int32 `json:"defaultMode,omitempty" protobuf:"varint,2,opt,name=defaultMode"` + // defaultUser is Optional: The owner UID of the created files by default. + // The defaultUser field is only used as a fallback when the item-level user field is unset. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + // +featureGate=AtomicWriteVolumeUserFields + // +optional + DefaultUser *int64 `json:"defaultUser,omitempty" protobuf:"varint,3,opt,name=defaultUser"` } // Projection that may be projected along with other supported volume types. @@ -2189,6 +2334,12 @@ type KeyToPath struct { // mode, like fsGroup, and the result can be other mode bits set. // +optional Mode *int32 `json:"mode,omitempty" protobuf:"varint,3,opt,name=mode"` + // user is Optional: The owner UID of the created file. + // If specified, the item-level user field takes precedence over defaultUser. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + // +featureGate=AtomicWriteVolumeUserFields + // +optional + User *int64 `json:"user,omitempty" protobuf:"varint,4,opt,name=user"` } // Local represents directly-attached storage with node affinity @@ -2339,6 +2490,7 @@ type PersistentVolumeClaimTemplate struct { // validation. // // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // The specification for the PersistentVolumeClaim. The entire content is @@ -2400,8 +2552,7 @@ type VolumeMount struct { // If this field is not specified, it is treated as an equivalent of Disabled. // +optional RecursiveReadOnly *RecursiveReadOnlyMode `json:"recursiveReadOnly,omitempty" protobuf:"bytes,7,opt,name=recursiveReadOnly,casttype=RecursiveReadOnlyMode"` - // Path within the container at which the volume should be mounted. Must - // not contain ':'. + // Path within the container at which the volume should be mounted. MountPath string `json:"mountPath" protobuf:"bytes,3,opt,name=mountPath"` // Path within the volume from which the container's volume should be mounted. // Defaults to "" (volume's root). @@ -2421,8 +2572,30 @@ type VolumeMount struct { // SubPathExpr and SubPath are mutually exclusive. // +optional SubPathExpr string `json:"subPathExpr,omitempty" protobuf:"bytes,6,opt,name=subPathExpr"` + // bindMountOptions is the list of additional bind mount options to apply when + // mounting this volume into the container. Allowed values are noexec, + // nodev, and nosuid. These are Linux mount options and have no effect on + // Windows nodes. + // This field is not supported with image volumes. + // This is an alpha field and requires enabling the VolumeBindMountOptions feature gate. + // +featureGate=VolumeBindMountOptions + // +optional + // +listType=set + BindMountOptions []string `json:"bindMountOptions,omitempty" protobuf:"bytes,8,rep,name=bindMountOptions"` } +// BindMountOption defines the supported bind mount options. +type BindMountOption string + +const ( + // BindMountOptionNoExec prevents execution of binaries on the mounted volume. + BindMountOptionNoExec BindMountOption = "noexec" + // BindMountOptionNoDev ignores device special files on the mounted volume. + BindMountOptionNoDev BindMountOption = "nodev" + // BindMountOptionNoSUID ignores set-user-identifier or set-group-identifier bits on the mounted volume. + BindMountOptionNoSUID BindMountOption = "nosuid" +) + // MountPropagationMode describes mount propagation. // +enum type MountPropagationMode string @@ -2571,8 +2744,9 @@ type ResourceFieldSelector struct { // +structType=atomic type ConfigMapKeySelector struct { // The ConfigMap to select from. - LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"` - // The key to select. + LocalObjectReference `json:"" protobuf:"bytes,1,opt,name=localObjectReference"` + // The key to select from the ConfigMap's Data field. + // Keys in the BinaryData field are not currently propagated to container env vars. Key string `json:"key" protobuf:"bytes,2,opt,name=key"` // Specify whether the ConfigMap or its key must be defined // +optional @@ -2583,7 +2757,7 @@ type ConfigMapKeySelector struct { // +structType=atomic type SecretKeySelector struct { // The name of the secret in the pod's namespace to select from. - LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"` + LocalObjectReference `json:"" protobuf:"bytes,1,opt,name=localObjectReference"` // The key of the secret to select from. Must be a valid secret key. Key string `json:"key" protobuf:"bytes,2,opt,name=key"` // Specify whether the Secret or its key must be defined @@ -2610,9 +2784,10 @@ type EnvFromSource struct { // // The contents of the target ConfigMap's Data field will represent the // key-value pairs as environment variables. +// Keys in the BinaryData field are not currently propagated to container env vars. type ConfigMapEnvSource struct { // The ConfigMap to select from. - LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"` + LocalObjectReference `json:"" protobuf:"bytes,1,opt,name=localObjectReference"` // Specify whether the ConfigMap must be defined // +optional Optional *bool `json:"optional,omitempty" protobuf:"varint,2,opt,name=optional"` @@ -2625,7 +2800,7 @@ type ConfigMapEnvSource struct { // key-value pairs as environment variables. type SecretEnvSource struct { // The Secret to select from. - LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"` + LocalObjectReference `json:"" protobuf:"bytes,1,opt,name=localObjectReference"` // Specify whether the Secret must be defined // +optional Optional *bool `json:"optional,omitempty" protobuf:"varint,2,opt,name=optional"` @@ -2640,6 +2815,19 @@ type HTTPHeader struct { Value string `json:"value" protobuf:"bytes,2,opt,name=value"` } +// HTTPProtocol selects the wire protocol for the HTTP probe, +// independently of the URI scheme. +// +enum +type HTTPProtocol string + +const ( + // HTTPProtocolHTTP1 uses HTTP/1.1 (the existing default). + HTTPProtocolHTTP1 HTTPProtocol = "HTTP1" + // HTTPProtocolHTTP2 uses HTTP/2. + // Currently, only cleartext with prior knowledge (h2c) is supported, and must be used with scheme HTTP. + HTTPProtocolHTTP2 HTTPProtocol = "HTTP2" +) + // HTTPGetAction describes an action based on HTTP Get requests. type HTTPGetAction struct { // Path to access on the HTTP server. @@ -2661,6 +2849,11 @@ type HTTPGetAction struct { // +optional // +listType=atomic HTTPHeaders []HTTPHeader `json:"httpHeaders,omitempty" protobuf:"bytes,5,rep,name=httpHeaders"` + // Protocol selects the wire protocol for the probe connection. + // Nil defaults to HTTP/1.1. + // +optional + // +featureGate=H2CContainerProbe + Protocol *HTTPProtocol `json:"protocol,omitempty" protobuf:"bytes,6,opt,name=protocol,casttype=HTTPProtocol"` } // URIScheme identifies the scheme used for connection to a host for Get actions @@ -2697,8 +2890,29 @@ type GRPCAction struct { // +optional // +default="" Service *string `json:"service" protobuf:"bytes,2,opt,name=service"` + + // mode specifies the connection mode for the gRPC health probe. + // Set to "TLS" to use TLS without certificate verification. + // Set to "Plaintext" to use a plaintext (insecure) connection explicitly. + // If not specified, the probe uses a plaintext (insecure) connection. + // +featureGate=GRPCContainerProbeTLS + // +optional + Mode *GRPCProbeMode `json:"mode,omitempty" protobuf:"bytes,3,opt,name=mode,casttype=GRPCProbeMode"` } +// GRPCProbeMode describes the connection mode for a gRPC probe. +// +enum +type GRPCProbeMode string + +const ( + // GRPCProbeModePlaintext indicates that the probe should use a plaintext + // (insecure) gRPC connection. + GRPCProbeModePlaintext GRPCProbeMode = "Plaintext" + // GRPCProbeModeTLS indicates that the probe should connect using TLS + // without certificate verification. + GRPCProbeModeTLS GRPCProbeMode = "TLS" +) + // ExecAction describes a "run in container" action. type ExecAction struct { // Command is the command line to execute inside the container, the working directory for the @@ -2721,7 +2935,7 @@ type SleepAction struct { // alive or ready to receive traffic. type Probe struct { // The action taken to determine the health of a container - ProbeHandler `json:",inline" protobuf:"bytes,1,opt,name=handler"` + ProbeHandler `json:"" protobuf:"bytes,1,opt,name=handler"` // Number of seconds after the container has started before liveness probes are initiated. // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes // +optional @@ -3407,8 +3621,13 @@ type ContainerStatus struct { // ResourceStatus represents the status of a single resource allocated to a Pod. type ResourceStatus struct { // Name of the resource. Must be unique within the pod and in case of non-DRA resource, match one of the resources from the pod spec. - // For DRA resources, the value must be "claim:/". - // When this status is reported about a container, the "claim_name" and "request" must match one of the claims of this container. + // For DRA resources, the value must be "claim:/" when + // container.resources.claims[*].request is set or "claim:" when + // container.resources.claims[*].request is empty. + // For DRA-backed extended resources, "claim:/" is used + // when the claim name and request name are recorded in pod.status.extendedResourceClaimStatus. + // When this status is reported about a container, the "claim_name" and "request" + // must match one of the claims of this container. // +required Name ResourceName `json:"name" protobuf:"bytes,1,opt,name=name"` // List of unique resources health. Each element in the list contains an unique resource ID and its health. @@ -4092,6 +4311,8 @@ type Toleration struct { // Key is the taint key that the toleration applies to. Empty means match all taint keys. // If the key is empty, operator must be Exists; this combination means to match all values and all keys. // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:format=k8s-label-key Key string `json:"key,omitempty" protobuf:"bytes,1,opt,name=key"` // Operator represents a key's relationship to the value. // Valid operators are Exists, Equal, Lt, and Gt. Defaults to Equal. @@ -4222,7 +4443,6 @@ type PodSpec struct { ServiceAccountName string `json:"serviceAccountName,omitempty" protobuf:"bytes,8,opt,name=serviceAccountName"` // DeprecatedServiceAccount is a deprecated alias for ServiceAccountName. // Deprecated: Use serviceAccountName instead. - // +k8s:conversion-gen=false // +optional DeprecatedServiceAccount string `json:"serviceAccount,omitempty" protobuf:"bytes,9,opt,name=serviceAccount"` // AutomountServiceAccountToken indicates whether a service account token should be automatically mounted. @@ -4241,17 +4461,14 @@ type PodSpec struct { // When `hostNetwork` is true, specified `hostPort` fields in port definitions must match `containerPort`, // and unspecified `hostPort` fields in port definitions are defaulted to match `containerPort`. // Default to false. - // +k8s:conversion-gen=false // +optional HostNetwork bool `json:"hostNetwork,omitempty" protobuf:"varint,11,opt,name=hostNetwork"` // Use the host's pid namespace. // Optional: Default to false. - // +k8s:conversion-gen=false // +optional HostPID bool `json:"hostPID,omitempty" protobuf:"varint,12,opt,name=hostPID"` // Use the host's ipc namespace. // Optional: Default to false. - // +k8s:conversion-gen=false // +optional HostIPC bool `json:"hostIPC,omitempty" protobuf:"varint,13,opt,name=hostIPC"` // Share a single process namespace between all of the containers in a pod. @@ -4259,7 +4476,6 @@ type PodSpec struct { // in the same pod, and the first process in each container will not be assigned PID 1. // HostPID and ShareProcessNamespace cannot both be set. // Optional: Default to false. - // +k8s:conversion-gen=false // +optional ShareProcessNamespace *bool `json:"shareProcessNamespace,omitempty" protobuf:"varint,27,opt,name=shareProcessNamespace"` // SecurityContext holds pod-level security attributes and common container settings. @@ -4293,6 +4509,7 @@ type PodSpec struct { // If specified, the pod's tolerations. // +optional // +listType=atomic + // +k8s:alpha(since: "1.37")=+k8s:optional Tolerations []Toleration `json:"tolerations,omitempty" protobuf:"bytes,22,opt,name=tolerations"` // HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts // file if specified. @@ -4343,6 +4560,8 @@ type PodSpec struct { EnableServiceLinks *bool `json:"enableServiceLinks,omitempty" protobuf:"varint,30,opt,name=enableServiceLinks"` // PreemptionPolicy is the Policy for preempting pods with lower priority. // One of Never, PreemptLowerPriority. + // When Priority Admission Controller is enabled, it prevents users from setting + // this field. The admission controller populates this field from PriorityClassName. // Defaults to PreemptLowerPriority if unset. // +optional PreemptionPolicy *PreemptionPolicy `json:"preemptionPolicy,omitempty" protobuf:"bytes,31,opt,name=preemptionPolicy"` @@ -4415,7 +4634,6 @@ type PodSpec struct { // When set to false, a new userns is created for the pod. Setting false is useful for // mitigating container breakout vulnerabilities even allowing users to run their // containers as root without actually having root privileges on the host. - // +k8s:conversion-gen=false // +optional HostUsers *bool `json:"hostUsers,omitempty" protobuf:"bytes,37,opt,name=hostUsers"` @@ -4471,7 +4689,6 @@ type PodSpec struct { // - `hostNetwork` must be set to false. // // This field must be a valid DNS subdomain as defined in RFC 1123 and contain at most 64 characters. - // Requires the HostnameOverride feature gate to be enabled. // // +featureGate=HostnameOverride // +optional @@ -4497,6 +4714,34 @@ type PodSpec struct { // +featureGate=GenericWorkload // +optional SchedulingGroup *PodSchedulingGroup `json:"schedulingGroup,omitempty" protobuf:"bytes,43,opt,name=schedulingGroup"` + + // evictionResponders reference responders that react to Evictions based on EvictionRequests. + // Responders should observe and communicate through the Eviction Resource API to help with + // the graceful termination of a pod. The responders are selected sequentially, according to + // their specified priority. + // + // Responders should periodically report on an eviction progress by updating the + // .status.responders[].heartbeatTime field of the Eviction object. If this field is not updated + // within the heartbeat deadline defined by the Eviction API (currently 20 minutes), the eviction + // is passed over to the next responder with a lower priority. If there is no other responder, + // the last default imperative-eviction.k8s.io/evictor responder with a priority of 100 will + // evict the pod using the imperative Eviction API (pods//eviction subresource). + // + // The maximum length of the responders list is 10. + // Responders are not supported when the pod is part of a PodGroup (.spec.schedulingGroup is set). + // This field can only be set on creation and is immutable afterwards. + // +featureGate=EvictionRequestAPI + // +optional + // +patchMergeKey=name + // +patchStrategy=merge + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=10 + // +k8s:alpha(since: "1.37")=+k8s:dependentForbidden("schedulingGroup") + EvictionResponders []EvictionResponder `json:"evictionResponders,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,44,rep,name=evictionResponders"` } // PodResourceClaim references exactly one ResourceClaim, either directly @@ -4964,11 +5209,8 @@ type PodSecurityContext struct { // Eligible volumes are in-tree FibreChannel and iSCSI volumes, and all CSI volumes // whose CSI driver announces SELinux support by setting spec.seLinuxMount: true in their // CSIDriver instance. Other volumes are always re-labelled recursively. - // "MountOption" value is allowed only when SELinuxMount feature gate is enabled. // - // If not specified and SELinuxMount feature gate is enabled, "MountOption" is used. - // If not specified and SELinuxMount feature gate is disabled, "MountOption" is used for ReadWriteOncePod volumes - // and "Recursive" for all other volumes. + // If not specified, "MountOption" is used. // // This field affects only Pods that have SELinux label set, either in PodSecurityContext or in SecurityContext of all containers. // @@ -5288,7 +5530,7 @@ type EphemeralContainer struct { // specific to ephemeral containers. Fields in common with Container are in the // following inlined struct so than an EphemeralContainer may easily be converted // to a Container. - EphemeralContainerCommon `json:",inline" protobuf:"bytes,1,req"` + EphemeralContainerCommon `json:"" protobuf:"bytes,1,req"` // If set, the name of the container from PodSpec that this ephemeral container targets. // The ephemeral container will be run in the namespaces (IPC, PID, etc) of this container. @@ -5300,6 +5542,43 @@ type EphemeralContainer struct { TargetContainerName string `json:"targetContainerName,omitempty" protobuf:"bytes,2,opt,name=targetContainerName"` } +// EvictionResponder allows you to specify the responder reacting to an Eviction. +// Responders should observe and communicate through the Eviction Resource API to help with +// the graceful eviction of a target (e.g. termination of a pod). +// +structType=atomic +type EvictionResponder struct { + // name allows you to identify the responder responding to the Eviction. + // + // It must be a valid domain-prefixed key (such as "acme.io/foo"). + // Domain names *.k8s.io and *.kubernetes.io are reserved. + // This field must be unique for each responder. + // This field is required. + // +required + // +k8s:required + // +k8s:format=k8s-prefixed-label-key + // +k8s:customValidation + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + + // priority for this responder. Higher priorities are selected first by the evictionrequest-controller. + // If there are responders with the same priority, the responder whose domain name comes first in the + // alphabetical higher domain order, will be picked. This means that the top domain labels are compared + // alphabetically first, followed by the lower domain labels. The key is compared last. + // + // The responder that is the managing controller of the pod should set the value of + // this field to 10000 to allow both for preemption or fallback registration by other + // responders. + // + // The minimum value is 0 and the maximum value is 100000. + // The interval 0-999 is reserved for responders with *.k8s.io suffix. + // This field is required. + // +required + // +k8s:required + // +k8s:minimum=0 + // +k8s:maximum=100000 + // +k8s:customValidation + Priority *int32 `json:"priority" protobuf:"varint,2,opt,name=priority"` +} + // PodStatus represents information about the status of a pod. Status may trail the actual // state of a system, especially if the node that hosts the pod cannot contact the control // plane. @@ -5476,27 +5755,25 @@ type PodStatus struct { // Examples include "cpu", "memory", "ephemeral-storage", and hugepages. // +featureGate=DRANodeAllocatableResources // +optional - // +listType=atomic - NodeAllocatableResourceClaimStatuses []NodeAllocatableResourceClaimStatus `json:"nodeAllocatableResourceClaimStatuses,omitempty" protobuf:"bytes,21,rep,name=nodeAllocatableResourceClaimStatuses"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:prerelease-lifecycle-gen:introduced=1.0 + // +patchStrategy=merge + // +patchMergeKey=resourceClaimName + // +listType=map + // +listMapKey=resourceClaimName + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=resourceClaimName + NodeAllocatableResourceClaimStatuses []NodeAllocatableResourceClaimStatus `json:"nodeAllocatableResourceClaimStatuses,omitempty" patchStrategy:"merge" patchMergeKey:"resourceClaimName" protobuf:"bytes,21,rep,name=nodeAllocatableResourceClaimStatuses"` -// PodStatusResult is a wrapper for PodStatus returned by kubelet that can be encode/decoded -type PodStatusResult struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Most recently observed status of the pod. - // This data may not be up to date. - // Populated by the system. - // Read-only. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + // volumeHealth contains node-reported health for each volume the pod is using. + // Populated by the kubelet on the pod's node. + // +featureGate=CSIVolumeHealth // +optional - Status PodStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"` + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + VolumeHealth []PodVolumeHealth `json:"volumeHealth,omitempty" protobuf:"bytes,22,rep,name=volumeHealth"` } // +genclient @@ -5507,8 +5784,12 @@ type PodStatusResult struct { // Pod is a collection of containers that can run on a host. This resource is created // by clients and scheduled onto hosts. +// +k8s:supportsSubresource="/status" +// +k8s:supportsSubresource="/ephemeralcontainers" +// +k8s:supportsSubresource="/resize" +// +k8s:supportsSubresource="/eviction" type Pod struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -5533,7 +5814,7 @@ type Pod struct { // PodList is a list of Pods. type PodList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -5549,6 +5830,7 @@ type PodTemplateSpec struct { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Specification of the desired behavior of the pod. @@ -5563,7 +5845,7 @@ type PodTemplateSpec struct { // PodTemplate describes a template for creating copies of a predefined pod. type PodTemplate struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -5580,7 +5862,7 @@ type PodTemplate struct { // PodTemplateList is a list of PodTemplates. type PodTemplateList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -5597,18 +5879,18 @@ type ReplicationControllerSpec struct { // Defaults to 1. // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +default=1 - // +k8s:alpha(since: "1.36")=+k8s:minimum=0 + // +k8s:beta(since: "1.37")=+k8s:minimum=0 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` // Minimum number of seconds for which a newly created pod should be ready // without any of its container crashing, for it to be considered available. // Defaults to 0 (pod will be considered available as soon as it is ready) // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +default=0 - // +k8s:alpha(since: "1.36")=+k8s:minimum=0 + // +k8s:beta(since: "1.37")=+k8s:minimum=0 MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,4,opt,name=minReadySeconds"` // Selector is a label query over pods that should match the Replicas count. @@ -5631,6 +5913,7 @@ type ReplicationControllerSpec struct { // The only allowed template.spec.restartPolicy value is "Always". // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional Template *PodTemplateSpec `json:"template,omitempty" protobuf:"bytes,3,opt,name=template"` } @@ -5699,17 +5982,18 @@ type ReplicationControllerCondition struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.0 // +k8s:supportsSubresource="/scale" +// +k8s:supportsSubresource="/status" // ReplicationController represents the configuration of a replication controller. type ReplicationController struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // If the Labels of a ReplicationController are empty, they are defaulted to // be the same as the Pod(s) that the replication controller manages. // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional - // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:format=k8s-long-name + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:format=k8s-long-name metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec defines the specification of the desired behavior of the replication controller. @@ -5731,7 +6015,7 @@ type ReplicationController struct { // ReplicationControllerList is a collection of replication controllers. type ReplicationControllerList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -5891,6 +6175,7 @@ type ServiceStatus struct { // +patchStrategy=merge // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:opaqueType Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"` } @@ -6295,8 +6580,10 @@ type ServicePort struct { // Service is a named abstraction of software service (for example, mysql) consisting of local port // (for example 3306) that the proxy listens on, and the selector that determines which pods // will answer requests sent through the proxy. +// +k8s:supportsSubresource="/status" +// +k8s:supportsSubresource="/proxy" type Service struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -6326,7 +6613,7 @@ const ( // ServiceList holds a list of services. type ServiceList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -6346,7 +6633,7 @@ type ServiceList struct { // * a principal that can be authenticated and authorized // * a set of secrets type ServiceAccount struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -6385,7 +6672,7 @@ type ServiceAccount struct { // ServiceAccountList is a list of ServiceAccount objects type ServiceAccountList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -6419,7 +6706,7 @@ type ServiceAccountList struct { // // Deprecated: This API is deprecated in v1.33+. Use discoveryv1.EndpointSlice. type Endpoints struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -6534,7 +6821,7 @@ type EndpointPort struct { // EndpointsList is a list of endpoints. // Deprecated: This API is deprecated in v1.33+. type EndpointsList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -6560,6 +6847,9 @@ type NodeSpec struct { // ID of the node assigned by the cloud provider in the format: :// // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:update=NoModify + // +k8s:alpha(since: "1.36")=+k8s:update=NoUnset ProviderID string `json:"providerID,omitempty" protobuf:"bytes,3,opt,name=providerID"` // Unschedulable controls node schedulability of new pods. By default, node is schedulable. // More info: https://kubernetes.io/docs/concepts/nodes/node/#manual-node-administration @@ -6578,6 +6868,29 @@ type NodeSpec struct { // see: https://issues.k8s.io/61966 // +optional DoNotUseExternalID string `json:"externalID,omitempty" protobuf:"bytes,2,opt,name=externalID"` + + // PodPreemptionPolicy controls the node-level preemption behaviors for pods on this node. + // This is an alpha field and requires enabling the InPlacePodVerticalScalingSchedulerPreemption feature gate. + // +featureGate=InPlacePodVerticalScalingSchedulerPreemption + // +optional + // +k8s:optional + // +k8s:ifDisabled(InPlacePodVerticalScalingSchedulerPreemption)=+k8s:forbidden + PodPreemptionPolicy *NodePodPreemptionPolicy `json:"podPreemptionPolicy,omitempty" protobuf:"bytes,8,opt,name=podPreemptionPolicy"` +} + +// NodePodPreemptionPolicy defines the node-level policies governing preemption for pods on this node. +type NodePodPreemptionPolicy struct { + // DisableResizePreemption lists the owners (e.g., autoscalers, operators, administrators) + // that have requested to disable scheduler and Kubelet preemption for in-place pod resize on this node. + // If this list is non-empty, resize-induced preemption is disabled on this node. + // This is an alpha field and requires enabling the InPlacePodVerticalScalingSchedulerPreemption feature gate. + // +listType=set + // +k8s:listType=set + // +optional + // +k8s:maxItems=20 + // +k8s:optional + // +k8s:eachVal=+k8s:format=k8s-label-key + DisableResizePreemption []string `json:"disableResizePreemption,omitempty" protobuf:"bytes,1,rep,name=disableResizePreemption"` } // NodeConfigSource specifies a source of node configuration. Exactly one subfield (excluding metadata) must be non-nil. @@ -6701,6 +7014,10 @@ type NodeSystemInfo struct { Architecture string `json:"architecture" protobuf:"bytes,10,opt,name=architecture"` // Swap Info reported by the node. Swap *NodeSwapStatus `json:"swap,omitempty" protobuf:"bytes,11,opt,name=swap"` + // Whether the node is running in a user namespace. + // +featureGate=KubeletInUserNamespace + // +optional + RunningInUserNamespace *bool `json:"runningInUserNamespace,omitempty" protobuf:"varint,12,opt,name=runningInUserNamespace"` } // NodeSwapStatus represents swap memory information. @@ -6918,6 +7235,37 @@ const ( NodePIDPressure NodeConditionType = "PIDPressure" // NodeNetworkUnavailable means that network for the node is not correctly configured. NodeNetworkUnavailable NodeConditionType = "NetworkUnavailable" + // NodeGracefulNodeShutdownInProgress reports whether Graceful Node Shutdown is determined to be in progress on this Node. + // + // The admin is responsible for setting and clearing this condition. + NodeGracefulNodeShutdownInProgress NodeConditionType = "GracefulNodeShutdownInProgress" + // NodeDrainInProgress reports that this Node is actively being drained, + // according to the admin's definition of drain. + // Commonly, this involves removing some amount of Pods, volumes, and networks. + // + // The admin is responsible for setting and clearing this condition. + NodeDrainInProgress NodeConditionType = "DrainInProgress" + // NodeDrained reports that this Node has reached the drain criteria selected by the admin. + // + // The admin is responsible for setting and clearing this condition. + NodeDrained NodeConditionType = "Drained" + // NodeMaintenancePlanned reports that this Node is expected to undergo a change in the future. + // If this change impacts Node users, the admin should drain the Node first. + // + // Admins can use the Node maintenance condition for cases like hardware or software rollout, + // remediation, decommissioning, or debugging. + // + // The admin is responsible for setting and clearing this condition. + NodeMaintenancePlanned NodeConditionType = "MaintenancePlanned" + // NodeMaintenanceInProgress reports that this Node is actively undergoing maintenance. + // + // The admin decides whether the change will impact Node users and require a Node drain. + // For example, it is recommended to drain a Node before a Kubernetes upgrade. + // In contrast, a kernel live patch may not require a Node drain, but it can still be useful + // to communicate that maintenance is in progress. + // + // The admin is responsible for setting and clearing this condition. + NodeMaintenanceInProgress NodeConditionType = "MaintenanceInProgress" ) // NodeCondition contains condition information for a node. @@ -7030,8 +7378,10 @@ type ResourceList map[ResourceName]resource.Quantity // Node is a worker node in Kubernetes. // Each node will have a unique identifier in the cache (i.e. in etcd). +// +k8s:supportsSubresource="/status" +// +k8s:supportsSubresource="/proxy" type Node struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -7055,7 +7405,7 @@ type Node struct { // NodeList is the whole list of all Nodes which have been registered with master. type NodeList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -7157,8 +7507,10 @@ type NamespaceCondition struct { // Namespace provides a scope for Names. // Use of multiple namespaces is optional. +// +k8s:supportsSubresource="/status" +// +k8s:supportsSubresource="/finalize" type Namespace struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -7180,7 +7532,7 @@ type Namespace struct { // NamespaceList is a list of Namespaces. type NamespaceList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -7196,10 +7548,11 @@ type NamespaceList struct { // Binding ties one object to another; for example, a pod is bound to a node by a scheduler. type Binding struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // The target object that you want to bind to the standard object. @@ -7229,7 +7582,7 @@ const ( // PodLogOptions is the query options for a Pod's logs REST call. type PodLogOptions struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // The container for which to stream logs. Defaults to only container if there is one container in the pod. // +optional @@ -7294,7 +7647,7 @@ type PodLogOptions struct { // TODO: merge w/ PodExecOptions below for stdin, stdout, etc // and also when we cut V2, we should export a "StreamOptions" or somesuch that contains Stdin, Stdout, Stder and TTY type PodAttachOptions struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Stdin if true, redirects the standard input stream of the pod for this call. // Defaults to false. @@ -7333,7 +7686,7 @@ type PodAttachOptions struct { // TODO: This is largely identical to PodAttachOptions above, make sure they stay in sync and see about merging // and also when we cut V2, we should export a "StreamOptions" or somesuch that contains Stdin, Stdout, Stder and TTY type PodExecOptions struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Redirect the standard input stream of the pod for this call. // Defaults to false. @@ -7374,7 +7727,7 @@ type PodExecOptions struct { // Port forwarding over SPDY does not use these options. It requires the port // to be passed in the `port` header as part of request. type PodPortForwardOptions struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // List of ports to forward // Required when using WebSockets @@ -7389,7 +7742,7 @@ type PodPortForwardOptions struct { // PodProxyOptions is the query options to a Pod's proxy call. type PodProxyOptions struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Path is the URL path to use for the current proxy request to pod. // +optional @@ -7402,7 +7755,7 @@ type PodProxyOptions struct { // NodeProxyOptions is the query options to a Node's proxy call. type NodeProxyOptions struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Path is the URL path to use for the current proxy request to node. // +optional @@ -7415,7 +7768,7 @@ type NodeProxyOptions struct { // ServiceProxyOptions is the query options to a Service's proxy call. type ServiceProxyOptions struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Path is the part of URLs that include service endpoints, suffixes, // and parameters to use for the current proxy request to service. @@ -7542,7 +7895,7 @@ type TypedLocalObjectReference struct { // SerializedReference is a reference to serialized object. type SerializedReference struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // The reference to an object in the system. // +optional Reference ObjectReference `json:"reference,omitempty" protobuf:"bytes,1,opt,name=reference"` @@ -7577,7 +7930,7 @@ const ( // continued existence of events with that Reason. Events should be // treated as informative, best-effort, supplemental data. type Event struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"` @@ -7657,7 +8010,7 @@ type EventSeries struct { // EventList is a list of events. type EventList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -7720,7 +8073,7 @@ type LimitRangeSpec struct { // LimitRange sets resource usage limits for each kind of resource in a Namespace. type LimitRange struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -7737,7 +8090,7 @@ type LimitRange struct { // LimitRangeList is a list of LimitRange items. type LimitRangeList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -7892,8 +8245,9 @@ type ResourceQuotaStatus struct { // +k8s:prerelease-lifecycle-gen:introduced=1.0 // ResourceQuota sets aggregate quota restrictions enforced per namespace +// +k8s:supportsSubresource="/status" type ResourceQuota struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -7915,7 +8269,7 @@ type ResourceQuota struct { // ResourceQuotaList is a list of ResourceQuota items. type ResourceQuotaList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -7933,7 +8287,7 @@ type ResourceQuotaList struct { // Secret holds secret data of a certain type. The total bytes of the values in // the Data field must be less than MaxSecretSize bytes. type Secret struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -7964,6 +8318,8 @@ type Secret struct { // Used to facilitate programmatic handling of secret data. // More info: https://kubernetes.io/docs/concepts/configuration/secret/#secret-types // +optional + // +k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:immutable Type SecretType `json:"type,omitempty" protobuf:"bytes,3,opt,name=type,casttype=SecretType"` } @@ -8059,7 +8415,7 @@ const ( // SecretList is a list of Secret. type SecretList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -8076,7 +8432,7 @@ type SecretList struct { // ConfigMap holds configuration data for pods to consume. type ConfigMap struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -8104,6 +8460,8 @@ type ConfigMap struct { // the Data field, this is enforced during validation process. // Using this field will require 1.10+ apiserver and // kubelet. + // Note: BinaryData keys are not currently propagated to container env vars + // via ConfigMapKeyRef or ConfigMapRef env sources; only Data keys are used. // +optional BinaryData map[string][]byte `json:"binaryData,omitempty" protobuf:"bytes,3,rep,name=binaryData"` } @@ -8113,7 +8471,7 @@ type ConfigMap struct { // ConfigMapList is a resource containing a list of ConfigMap objects. type ConfigMapList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -8157,10 +8515,11 @@ type ComponentCondition struct { // ComponentStatus (and ComponentStatusList) holds the cluster validation info. // Deprecated: This API is deprecated in v1.19+ type ComponentStatus struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // List of component conditions observed @@ -8178,7 +8537,7 @@ type ComponentStatus struct { // Status of all the conditions for the component as a list of ComponentStatus objects. // Deprecated: This API is deprecated in v1.19+ type ComponentStatusList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -8205,6 +8564,12 @@ type DownwardAPIVolumeSource struct { // mode, like fsGroup, and the result can be other mode bits set. // +optional DefaultMode *int32 `json:"defaultMode,omitempty" protobuf:"varint,2,opt,name=defaultMode"` + // defaultUser is Optional: The owner UID of the created files by default. + // The defaultUser field is only used as a fallback when the item-level user field is unset. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + // +featureGate=AtomicWriteVolumeUserFields + // +optional + DefaultUser *int64 `json:"defaultUser,omitempty" protobuf:"varint,3,opt,name=defaultUser"` } const ( @@ -8230,6 +8595,12 @@ type DownwardAPIVolumeFile struct { // mode, like fsGroup, and the result can be other mode bits set. // +optional Mode *int32 `json:"mode,omitempty" protobuf:"varint,4,opt,name=mode"` + // user is Optional: The owner UID of the created file. + // If specified, the item-level user field takes precedence over defaultUser. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + // +featureGate=AtomicWriteVolumeUserFields + // +optional + User *int64 `json:"user,omitempty" protobuf:"varint,5,opt,name=user"` } // Represents downward API info for projecting into a projected volume. @@ -8388,10 +8759,11 @@ type WindowsSecurityContextOptions struct { // RangeAllocation is not a public type. type RangeAllocation struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Range is string that identifies the range represented by 'data'. @@ -8518,12 +8890,78 @@ type ImageVolumeSource struct { type NodeAllocatableResourceClaimStatus struct { // ResourceClaimName is the resource claim referenced by the pod that resulted in this node allocatable resource allocation. // +required + // +k8s:required ResourceClaimName string `json:"resourceClaimName" protobuf:"bytes,1,opt,name=resourceClaimName"` // Containers lists the names of all containers in this pod that reference the claim. // +optional // +listType=set + // +k8s:optional + // +k8s:listType=set Containers []string `json:"containers,omitempty" protobuf:"bytes,2,rep,name=containers"` - // Resources is a map of the node-allocatable resource name to the aggregate quantity allocated to the claim. + + // Resources is tombstoned since it got replaced with more granular Mapping and Overhead fields. + // Resources map[ResourceName]resource.Quantity `json:"resources,omitempty" protobuf:"bytes,3,rep,name=resources"` + + // Mapping contains allocations through devices mapped in the device spec's `nodeAllocatableResources[...].mapping` field. + // This is used by kubelet for pod level and container-level cgroup enforcement. + // +optional + // +patchStrategy=merge + // +patchMergeKey=name + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + Mapping []NodeAllocatableMappedResources `json:"mapping,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,4,rep,name=mapping"` + // Overhead contains allocations through devices mapped in the device spec's `nodeAllocatableResources[...].overhead` field. + // This is used by kubelet for pod level and container-level cgroup enforcement. + // +optional + // +patchStrategy=merge + // +patchMergeKey=name + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + Overhead []NodeAllocatableOverheadResources `json:"overhead,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,5,rep,name=overhead"` +} + +// NodeAllocatableMappedResources describes mapped node allocatable resource allocations. +type NodeAllocatableMappedResources struct { + // Name is the name of the resource (e.g., cpu, memory). + // +required + // +k8s:required + Name ResourceName `json:"name" protobuf:"bytes,1,opt,name=name,casttype=ResourceName"` + // Quantity is the total node allocatable resource capacity allocated for the claim. + // This claim's allocated devices is shared by all the containers referencing the claim. + // Kubelet adds this value to both requests and limits at the pod-level cgroup, and to limits at the container-level cgroup for each container referencing the claim. + // +required + // +k8s:required + Quantity *resource.Quantity `json:"quantity" protobuf:"bytes,2,opt,name=quantity"` +} + +// NodeAllocatableOverheadResources describes auxiliary overhead resource allocations. +type NodeAllocatableOverheadResources struct { + // Name is the name of the resource (e.g., cpu, memory). // +required - Resources map[ResourceName]resource.Quantity `json:"resources" protobuf:"bytes,3,rep,name=resources"` + // +k8s:required + Name ResourceName `json:"name" protobuf:"bytes,1,opt,name=name,casttype=ResourceName"` + // PerPod is the flat overhead quantity allocated per pod. + // Adding to each container limit allows individual containers to utilize the overhead, while the parent pod-level cgroup limit caps the total usage at the pod boundary where the overhead is accounted for exactly once. + // At least one of PerPod or PerContainer must be specified. Specifying neither is an invalid configuration. + // +optional + // +k8s:optional + PerPod *resource.Quantity `json:"perPod,omitempty" protobuf:"bytes,2,opt,name=perPod"` + // PerContainer is the variable overhead quantity applied for each container referencing the claim. + // The container references are recorded in `nodeAllocatableResourceClaimStatuses.containers`. + // The total overhead quantity allocated for the claim is computed as: + // Quantity = PerPod + (PerContainer * NumReferences) + // Kubelet accounts for this overhead in cgroups: + // - Pod-level cgroup (requests and limits): Kubelet adds PerPod + (PerContainer * NumReferences). + // - Container-level cgroup (limits only): Kubelet adds PerPod + PerContainer for each referencing container. + // This allows any single container to access the pod-level overhead, while the parent cgroup caps the total usage to account for PerPod exactly once. + // At least one of PerPod or PerContainer must be specified. Specifying neither is an invalid configuration. + // +optional + // +k8s:optional + PerContainer *resource.Quantity `json:"perContainer,omitempty" protobuf:"bytes,3,opt,name=perContainer"` } diff --git a/vendor/k8s.io/api/core/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/core/v1/types_swagger_doc_generated.go index 97eb5ceec3..4b68c56852 100644 --- a/vendor/k8s.io/api/core/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/core/v1/types_swagger_doc_generated.go @@ -235,6 +235,7 @@ var map_ClusterTrustBundleProjection = map[string]string{ "labelSelector": "Select all ClusterTrustBundles that match this label selector. Only has effect if signerName is set. Mutually-exclusive with name. If unset, interpreted as \"match nothing\". If set but empty, interpreted as \"match everything\".", "optional": "If true, don't block pod startup if the referenced ClusterTrustBundle(s) aren't available. If using name, then the named ClusterTrustBundle is allowed not to exist. If using signerName, then the combination of signerName and labelSelector is allowed to match zero ClusterTrustBundles.", "path": "Relative path from the volume root to write the bundle.", + "user": "user is Optional: The owner UID of the created file. If specified, the item-level user field takes precedence over defaultUser. (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled.", } func (ClusterTrustBundleProjection) SwaggerDoc() map[string]string { @@ -278,7 +279,7 @@ var map_ConfigMap = map[string]string{ "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "immutable": "Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil.", "data": "Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process.", - "binaryData": "BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet.", + "binaryData": "BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet. Note: BinaryData keys are not currently propagated to container env vars via ConfigMapKeyRef or ConfigMapRef env sources; only Data keys are used.", } func (ConfigMap) SwaggerDoc() map[string]string { @@ -286,7 +287,7 @@ func (ConfigMap) SwaggerDoc() map[string]string { } var map_ConfigMapEnvSource = map[string]string{ - "": "ConfigMapEnvSource selects a ConfigMap to populate the environment variables with.\n\nThe contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables.", + "": "ConfigMapEnvSource selects a ConfigMap to populate the environment variables with.\n\nThe contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables. Keys in the BinaryData field are not currently propagated to container env vars.", "optional": "Specify whether the ConfigMap must be defined", } @@ -296,7 +297,7 @@ func (ConfigMapEnvSource) SwaggerDoc() map[string]string { var map_ConfigMapKeySelector = map[string]string{ "": "Selects a key from a ConfigMap.", - "key": "The key to select.", + "key": "The key to select from the ConfigMap's Data field. Keys in the BinaryData field are not currently propagated to container env vars.", "optional": "Specify whether the ConfigMap or its key must be defined", } @@ -342,6 +343,7 @@ var map_ConfigMapVolumeSource = map[string]string{ "items": "items if unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.", "defaultMode": "defaultMode is optional: mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", "optional": "optional specify whether the ConfigMap or its keys must be defined", + "defaultUser": "defaultUser is Optional: The owner UID of the created files by default. The defaultUser field is only used as a fallback when the item-level user field is unset. (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled.", } func (ConfigMapVolumeSource) SwaggerDoc() map[string]string { @@ -546,6 +548,7 @@ var map_DownwardAPIVolumeFile = map[string]string{ "fieldRef": "Required: Selects a field of the pod: only annotations, labels, name, namespace and uid are supported.", "resourceFieldRef": "Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported.", "mode": "Optional: mode bits used to set permissions on this file, must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "user": "user is Optional: The owner UID of the created file. If specified, the item-level user field takes precedence over defaultUser. (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled.", } func (DownwardAPIVolumeFile) SwaggerDoc() map[string]string { @@ -556,6 +559,7 @@ var map_DownwardAPIVolumeSource = map[string]string{ "": "DownwardAPIVolumeSource represents a volume containing downward API info. Downward API volumes support ownership management and SELinux relabeling.", "items": "Items is a list of downward API volume file", "defaultMode": "Optional: mode bits to use on created files by default. Must be a Optional: mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "defaultUser": "defaultUser is Optional: The owner UID of the created files by default. The defaultUser field is only used as a fallback when the item-level user field is unset. (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled.", } func (DownwardAPIVolumeSource) SwaggerDoc() map[string]string { @@ -566,6 +570,7 @@ var map_EmptyDirVolumeSource = map[string]string{ "": "Represents an empty directory for a pod. Empty directory volumes support ownership management and SELinux relabeling.", "medium": "medium represents what type of storage medium should back this directory. The default is \"\" which means to use the node's default medium. Must be an empty string (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir", "sizeLimit": "sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir", + "mode": "mode specifies the permission bits for the emptyDir directory, in numeric notation (e.g., 0755, 01777). Must be a value between 0000 and 01777. If not specified, defaults to 0777. This might be in conflict with other options that affect the file mode, like fsGroup. If fsGroup is specified, the fsGroup permissions will override the mode specified here. This field has no effect on Windows. This field is alpha and requires EmptyDirVolumeMode featuregate to be enabled.", } func (EmptyDirVolumeSource) SwaggerDoc() map[string]string { @@ -766,6 +771,16 @@ func (EventSource) SwaggerDoc() map[string]string { return map_EventSource } +var map_EvictionResponder = map[string]string{ + "": "EvictionResponder allows you to specify the responder reacting to an Eviction. Responders should observe and communicate through the Eviction Resource API to help with the graceful eviction of a target (e.g. termination of a pod).", + "name": "name allows you to identify the responder responding to the Eviction.\n\nIt must be a valid domain-prefixed key (such as \"acme.io/foo\"). Domain names *.k8s.io and *.kubernetes.io are reserved. This field must be unique for each responder. This field is required.", + "priority": "priority for this responder. Higher priorities are selected first by the evictionrequest-controller. If there are responders with the same priority, the responder whose domain name comes first in the alphabetical higher domain order, will be picked. This means that the top domain labels are compared alphabetically first, followed by the lower domain labels. The key is compared last.\n\nThe responder that is the managing controller of the pod should set the value of this field to 10000 to allow both for preemption or fallback registration by other responders.\n\nThe minimum value is 0 and the maximum value is 100000. The interval 0-999 is reserved for responders with *.k8s.io suffix. This field is required.", +} + +func (EvictionResponder) SwaggerDoc() map[string]string { + return map_EvictionResponder +} + var map_ExecAction = map[string]string{ "": "ExecAction describes a \"run in container\" action.", "command": "Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.", @@ -852,6 +867,7 @@ var map_GRPCAction = map[string]string{ "": "GRPCAction specifies an action involving a GRPC service.", "port": "Port number of the gRPC service. Number must be in the range 1 to 65535.", "service": "Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md).\n\nIf this is not specified, the default behavior is defined by gRPC.", + "mode": "mode specifies the connection mode for the gRPC health probe. Set to \"TLS\" to use TLS without certificate verification. Set to \"Plaintext\" to use a plaintext (insecure) connection explicitly. If not specified, the probe uses a plaintext (insecure) connection.", } func (GRPCAction) SwaggerDoc() map[string]string { @@ -899,6 +915,7 @@ var map_HTTPGetAction = map[string]string{ "host": "Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.", "scheme": "Scheme to use for connecting to the host. Defaults to HTTP.", "httpHeaders": "Custom headers to set in the request. HTTP allows repeated headers.", + "protocol": "Protocol selects the wire protocol for the probe connection. Nil defaults to HTTP/1.1.", } func (HTTPGetAction) SwaggerDoc() map[string]string { @@ -1006,6 +1023,7 @@ var map_KeyToPath = map[string]string{ "key": "key is the key to project.", "path": "path is the relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'.", "mode": "mode is Optional: mode bits used to set permissions on this file. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "user": "user is Optional: The owner UID of the created file. If specified, the item-level user field takes precedence over defaultUser. (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled.", } func (KeyToPath) SwaggerDoc() map[string]string { @@ -1234,11 +1252,33 @@ func (NodeAffinity) SwaggerDoc() map[string]string { return map_NodeAffinity } +var map_NodeAllocatableMappedResources = map[string]string{ + "": "NodeAllocatableMappedResources describes mapped node allocatable resource allocations.", + "name": "Name is the name of the resource (e.g., cpu, memory).", + "quantity": "Quantity is the total node allocatable resource capacity allocated for the claim. This claim's allocated devices is shared by all the containers referencing the claim. Kubelet adds this value to both requests and limits at the pod-level cgroup, and to limits at the container-level cgroup for each container referencing the claim.", +} + +func (NodeAllocatableMappedResources) SwaggerDoc() map[string]string { + return map_NodeAllocatableMappedResources +} + +var map_NodeAllocatableOverheadResources = map[string]string{ + "": "NodeAllocatableOverheadResources describes auxiliary overhead resource allocations.", + "name": "Name is the name of the resource (e.g., cpu, memory).", + "perPod": "PerPod is the flat overhead quantity allocated per pod. Adding to each container limit allows individual containers to utilize the overhead, while the parent pod-level cgroup limit caps the total usage at the pod boundary where the overhead is accounted for exactly once. At least one of PerPod or PerContainer must be specified. Specifying neither is an invalid configuration.", + "perContainer": "PerContainer is the variable overhead quantity applied for each container referencing the claim. The container references are recorded in `nodeAllocatableResourceClaimStatuses.containers`. The total overhead quantity allocated for the claim is computed as: Quantity = PerPod + (PerContainer * NumReferences) Kubelet accounts for this overhead in cgroups: - Pod-level cgroup (requests and limits): Kubelet adds PerPod + (PerContainer * NumReferences). - Container-level cgroup (limits only): Kubelet adds PerPod + PerContainer for each referencing container. This allows any single container to access the pod-level overhead, while the parent cgroup caps the total usage to account for PerPod exactly once. At least one of PerPod or PerContainer must be specified. Specifying neither is an invalid configuration.", +} + +func (NodeAllocatableOverheadResources) SwaggerDoc() map[string]string { + return map_NodeAllocatableOverheadResources +} + var map_NodeAllocatableResourceClaimStatus = map[string]string{ "": "NodeAllocatableResourceClaimStatus describes the status of node allocatable resources allocated via DRA.", "resourceClaimName": "ResourceClaimName is the resource claim referenced by the pod that resulted in this node allocatable resource allocation.", "containers": "Containers lists the names of all containers in this pod that reference the claim.", - "resources": "Resources is a map of the node-allocatable resource name to the aggregate quantity allocated to the claim.", + "mapping": "Mapping contains allocations through devices mapped in the device spec's `nodeAllocatableResources[...].mapping` field. This is used by kubelet for pod level and container-level cgroup enforcement.", + "overhead": "Overhead contains allocations through devices mapped in the device spec's `nodeAllocatableResources[...].overhead` field. This is used by kubelet for pod level and container-level cgroup enforcement.", } func (NodeAllocatableResourceClaimStatus) SwaggerDoc() map[string]string { @@ -1308,6 +1348,15 @@ func (NodeList) SwaggerDoc() map[string]string { return map_NodeList } +var map_NodePodPreemptionPolicy = map[string]string{ + "": "NodePodPreemptionPolicy defines the node-level policies governing preemption for pods on this node.", + "disableResizePreemption": "DisableResizePreemption lists the owners (e.g., autoscalers, operators, administrators) that have requested to disable scheduler and Kubelet preemption for in-place pod resize on this node. If this list is non-empty, resize-induced preemption is disabled on this node. This is an alpha field and requires enabling the InPlacePodVerticalScalingSchedulerPreemption feature gate.", +} + +func (NodePodPreemptionPolicy) SwaggerDoc() map[string]string { + return map_NodePodPreemptionPolicy +} + var map_NodeProxyOptions = map[string]string{ "": "NodeProxyOptions is the query options to a Node's proxy call.", "path": "Path is the URL path to use for the current proxy request to node.", @@ -1368,14 +1417,15 @@ func (NodeSelectorTerm) SwaggerDoc() map[string]string { } var map_NodeSpec = map[string]string{ - "": "NodeSpec describes the attributes that a node is created with.", - "podCIDR": "PodCIDR represents the pod IP range assigned to the node.", - "podCIDRs": "podCIDRs represents the IP ranges assigned to the node for usage by Pods on that node. If this field is specified, the 0th entry must match the podCIDR field. It may contain at most 1 value for each of IPv4 and IPv6.", - "providerID": "ID of the node assigned by the cloud provider in the format: ://", - "unschedulable": "Unschedulable controls node schedulability of new pods. By default, node is schedulable. More info: https://kubernetes.io/docs/concepts/nodes/node/#manual-node-administration", - "taints": "If specified, the node's taints.", - "configSource": "Deprecated: Previously used to specify the source of the node's configuration for the DynamicKubeletConfig feature. This feature is removed.", - "externalID": "Deprecated. Not all kubelets will set this field. Remove field after 1.13. see: https://issues.k8s.io/61966", + "": "NodeSpec describes the attributes that a node is created with.", + "podCIDR": "PodCIDR represents the pod IP range assigned to the node.", + "podCIDRs": "podCIDRs represents the IP ranges assigned to the node for usage by Pods on that node. If this field is specified, the 0th entry must match the podCIDR field. It may contain at most 1 value for each of IPv4 and IPv6.", + "providerID": "ID of the node assigned by the cloud provider in the format: ://", + "unschedulable": "Unschedulable controls node schedulability of new pods. By default, node is schedulable. More info: https://kubernetes.io/docs/concepts/nodes/node/#manual-node-administration", + "taints": "If specified, the node's taints.", + "configSource": "Deprecated: Previously used to specify the source of the node's configuration for the DynamicKubeletConfig feature. This feature is removed.", + "externalID": "Deprecated. Not all kubelets will set this field. Remove field after 1.13. see: https://issues.k8s.io/61966", + "podPreemptionPolicy": "PodPreemptionPolicy controls the node-level preemption behaviors for pods on this node. This is an alpha field and requires enabling the InPlacePodVerticalScalingSchedulerPreemption feature gate.", } func (NodeSpec) SwaggerDoc() map[string]string { @@ -1426,6 +1476,7 @@ var map_NodeSystemInfo = map[string]string{ "operatingSystem": "The Operating System reported by the node", "architecture": "The Architecture reported by the node", "swap": "Swap Info reported by the node.", + "runningInUserNamespace": "Whether the node is running in a user namespace.", } func (NodeSystemInfo) SwaggerDoc() map[string]string { @@ -1511,8 +1562,8 @@ var map_PersistentVolumeClaimSpec = map[string]string{ "volumeName": "volumeName is the binding reference to the PersistentVolume backing this claim.", "storageClassName": "storageClassName is the name of the StorageClass required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1", "volumeMode": "volumeMode defines what type of volume is required by the claim. Value of Filesystem is implied when not included in claim spec.", - "dataSource": "dataSource field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) * An existing PVC (PersistentVolumeClaim) If the provisioner or an external controller can support the specified data source, it will create a new volume based on the contents of the specified data source. When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. If the namespace is specified, then dataSourceRef will not be copied to dataSource.", - "dataSourceRef": "dataSourceRef specifies the object from which to populate the volume with data, if a non-empty volume is desired. This may be any object from a non-empty API group (non core object) or a PersistentVolumeClaim object. When this field is specified, volume binding will only succeed if the type of the specified object matches some installed volume populator or dynamic provisioner. This field will replace the functionality of the dataSource field and as such if both fields are non-empty, they must have the same value. For backwards compatibility, when namespace isn't specified in dataSourceRef, both fields (dataSource and dataSourceRef) will be set to the same value automatically if one of them is empty and the other is non-empty. When namespace is specified in dataSourceRef, dataSource isn't set to the same value and must be empty. There are three important differences between dataSource and dataSourceRef: * While dataSource only allows two specific types of objects, dataSourceRef\n allows any non-core object, as well as PersistentVolumeClaim objects.\n* While dataSource ignores disallowed values (dropping them), dataSourceRef\n preserves all values, and generates an error if a disallowed value is\n specified.\n* While dataSource only allows local objects, dataSourceRef allows objects\n in any namespaces.\n(Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled.", + "dataSource": "dataSource field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) * An existing PVC (PersistentVolumeClaim) If the provisioner or an external controller can support the specified data source, it will create a new volume based on the contents of the specified data source. dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. If the namespace is specified, then dataSourceRef will not be copied to dataSource.", + "dataSourceRef": "dataSourceRef specifies the object from which to populate the volume with data, if a non-empty volume is desired. This may be any object from a non-empty API group (non core object) or a PersistentVolumeClaim object. When this field is specified, volume binding will only succeed if the type of the specified object matches some installed volume populator or dynamic provisioner. This field will replace the functionality of the dataSource field and as such if both fields are non-empty, they must have the same value. For backwards compatibility, when namespace isn't specified in dataSourceRef, both fields (dataSource and dataSourceRef) will be set to the same value automatically if one of them is empty and the other is non-empty. When namespace is specified in dataSourceRef, dataSource isn't set to the same value and must be empty. There are three important differences between dataSource and dataSourceRef: * While dataSource only allows two specific types of objects, dataSourceRef\n allows any non-core object, as well as PersistentVolumeClaim objects.\n* While dataSource ignores disallowed values (dropping them), dataSourceRef\n preserves all values, and generates an error if a disallowed value is\n specified.\n* While dataSource only allows local objects, dataSourceRef allows objects\n in any namespaces.\n(Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled.", "volumeAttributesClassName": "volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. If specified, the CSI driver will create or update the volume with the attributes defined in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName, it can be changed after the claim is created. An empty string or nil value indicates that no VolumeAttributesClass will be applied to the claim. If the claim enters an Infeasible error state, this field can be reset to its previous value (including nil) to cancel the modification. If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource exists. More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/", } @@ -1530,6 +1581,7 @@ var map_PersistentVolumeClaimStatus = map[string]string{ "allocatedResourceStatuses": "allocatedResourceStatuses stores status of resource being resized for the given PVC. Key names follow standard Kubernetes label syntax. Valid values are either:\n\t* Un-prefixed keys:\n\t\t- storage - the capacity of the volume.\n\t* Custom resources must use implementation-defined prefixed names such as \"example.com/my-custom-resource\"\nApart from above values - keys that are unprefixed or have kubernetes.io prefix are considered reserved and hence may not be used.\n\nClaimResourceStatus can be in any of following states:\n\t- ControllerResizeInProgress:\n\t\tState set when resize controller starts resizing the volume in control-plane.\n\t- ControllerResizeFailed:\n\t\tState set when resize has failed in resize controller with a terminal error.\n\t- NodeResizePending:\n\t\tState set when resize controller has finished resizing the volume but further resizing of\n\t\tvolume is needed on the node.\n\t- NodeResizeInProgress:\n\t\tState set when kubelet starts resizing the volume.\n\t- NodeResizeFailed:\n\t\tState set when resizing has failed in kubelet with a terminal error. Transient errors don't set\n\t\tNodeResizeFailed.\nFor example: if expanding a PVC for more capacity - this field can be one of the following states:\n\t- pvc.status.allocatedResourceStatus['storage'] = \"ControllerResizeInProgress\"\n - pvc.status.allocatedResourceStatus['storage'] = \"ControllerResizeFailed\"\n - pvc.status.allocatedResourceStatus['storage'] = \"NodeResizePending\"\n - pvc.status.allocatedResourceStatus['storage'] = \"NodeResizeInProgress\"\n - pvc.status.allocatedResourceStatus['storage'] = \"NodeResizeFailed\"\nWhen this field is not set, it means that no resize operation is in progress for the given PVC.\n\nA controller that receives PVC update with previously unknown resourceName or ClaimResourceStatus should ignore the update for the purpose it was designed. For example - a controller that only is responsible for resizing capacity of the volume, should ignore PVC updates that change other valid resources associated with PVC.", "currentVolumeAttributesClassName": "currentVolumeAttributesClassName is the current name of the VolumeAttributesClass the PVC is using. When unset, there is no VolumeAttributeClass applied to this PersistentVolumeClaim", "modifyVolumeStatus": "ModifyVolumeStatus represents the status object of ControllerModifyVolume operation. When this is unset, there is no ModifyVolume operation being attempted.", + "healthStatus": "healthStatus contains the latest controller-reported health information for the volume bound to this claim.", } func (PersistentVolumeClaimStatus) SwaggerDoc() map[string]string { @@ -1702,6 +1754,7 @@ var map_PodCertificateProjection = map[string]string{ "keyPath": "Write the key at this path in the projected volume.\n\nMost applications should use credentialBundlePath. When using keyPath and certificateChainPath, your application needs to check that the key and leaf certificate are consistent, because it is possible to read the files mid-rotation.", "certificateChainPath": "Write the certificate chain at this path in the projected volume.\n\nMost applications should use credentialBundlePath. When using keyPath and certificateChainPath, your application needs to check that the key and leaf certificate are consistent, because it is possible to read the files mid-rotation.", "userAnnotations": "userAnnotations allow pod authors to pass additional information to the signer implementation. Kubernetes does not restrict or validate this metadata in any way.\n\nThese values are copied verbatim into the `spec.unverifiedUserAnnotations` field of the PodCertificateRequest objects that Kubelet creates.\n\nEntries are subject to the same validation as object metadata annotations, with the addition that all keys must be domain-prefixed. No restrictions are placed on values, except an overall size limitation on the entire field.\n\nSigners should document the keys and values they support. Signers should deny requests that contain keys they do not recognize.", + "user": "user is Optional: The owner UID of the created file. If specified, the item-level user field takes precedence over defaultUser. (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled.", } func (PodCertificateProjection) SwaggerDoc() map[string]string { @@ -1894,7 +1947,7 @@ var map_PodSecurityContext = map[string]string{ "fsGroupChangePolicy": "fsGroupChangePolicy defines behavior of changing ownership and permission of the volume before being exposed inside Pod. This field will only apply to volume types which support fsGroup based ownership(and permissions). It will have no effect on ephemeral volume types such as: secret, configmaps and emptydir. Valid values are \"OnRootMismatch\" and \"Always\". If not specified, \"Always\" is used. Note that this field cannot be set when spec.os.name is windows.", "seccompProfile": "The seccomp options to use by the containers in this pod. Note that this field cannot be set when spec.os.name is windows.", "appArmorProfile": "appArmorProfile is the AppArmor options to use by the containers in this pod. Note that this field cannot be set when spec.os.name is windows.", - "seLinuxChangePolicy": "seLinuxChangePolicy defines how the container's SELinux label is applied to all volumes used by the Pod. It has no effect on nodes that do not support SELinux or to volumes does not support SELinux. Valid values are \"MountOption\" and \"Recursive\".\n\n\"Recursive\" means relabeling of all files on all Pod volumes by the container runtime. This may be slow for large volumes, but allows mixing privileged and unprivileged Pods sharing the same volume on the same node.\n\n\"MountOption\" mounts all eligible Pod volumes with `-o context` mount option. This requires all Pods that share the same volume to use the same SELinux label. It is not possible to share the same volume among privileged and unprivileged Pods. Eligible volumes are in-tree FibreChannel and iSCSI volumes, and all CSI volumes whose CSI driver announces SELinux support by setting spec.seLinuxMount: true in their CSIDriver instance. Other volumes are always re-labelled recursively. \"MountOption\" value is allowed only when SELinuxMount feature gate is enabled.\n\nIf not specified and SELinuxMount feature gate is enabled, \"MountOption\" is used. If not specified and SELinuxMount feature gate is disabled, \"MountOption\" is used for ReadWriteOncePod volumes and \"Recursive\" for all other volumes.\n\nThis field affects only Pods that have SELinux label set, either in PodSecurityContext or in SecurityContext of all containers.\n\nAll Pods that use the same volume should use the same seLinuxChangePolicy, otherwise some pods can get stuck in ContainerCreating state. Note that this field cannot be set when spec.os.name is windows.", + "seLinuxChangePolicy": "seLinuxChangePolicy defines how the container's SELinux label is applied to all volumes used by the Pod. It has no effect on nodes that do not support SELinux or to volumes does not support SELinux. Valid values are \"MountOption\" and \"Recursive\".\n\n\"Recursive\" means relabeling of all files on all Pod volumes by the container runtime. This may be slow for large volumes, but allows mixing privileged and unprivileged Pods sharing the same volume on the same node.\n\n\"MountOption\" mounts all eligible Pod volumes with `-o context` mount option. This requires all Pods that share the same volume to use the same SELinux label. It is not possible to share the same volume among privileged and unprivileged Pods. Eligible volumes are in-tree FibreChannel and iSCSI volumes, and all CSI volumes whose CSI driver announces SELinux support by setting spec.seLinuxMount: true in their CSIDriver instance. Other volumes are always re-labelled recursively.\n\nIf not specified, \"MountOption\" is used.\n\nThis field affects only Pods that have SELinux label set, either in PodSecurityContext or in SecurityContext of all containers.\n\nAll Pods that use the same volume should use the same seLinuxChangePolicy, otherwise some pods can get stuck in ContainerCreating state. Note that this field cannot be set when spec.os.name is windows.", } func (PodSecurityContext) SwaggerDoc() map[string]string { @@ -1943,7 +1996,7 @@ var map_PodSpec = map[string]string{ "readinessGates": "If specified, all readiness gates will be evaluated for pod readiness. A pod is ready when all its containers are ready AND all conditions specified in the readiness gates have status equal to \"True\" More info: https://git.k8s.io/enhancements/keps/sig-network/580-pod-readiness-gates", "runtimeClassName": "RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used to run this pod. If no RuntimeClass resource matches the named class, the pod will not be run. If unset or empty, the \"legacy\" RuntimeClass will be used, which is an implicit class with an empty definition that uses the default runtime handler. More info: https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class", "enableServiceLinks": "EnableServiceLinks indicates whether information about services should be injected into pod's environment variables, matching the syntax of Docker links. Optional: Defaults to true.", - "preemptionPolicy": "PreemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset.", + "preemptionPolicy": "PreemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. Defaults to PreemptLowerPriority if unset.", "overhead": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md", "topologySpreadConstraints": "TopologySpreadConstraints describes how a group of pods ought to spread across topology domains. Scheduler will schedule pods in a way which abides by the constraints. All topologySpreadConstraints are ANDed.", "setHostnameAsFQDN": "If true the pod's hostname will be configured as the pod's FQDN, rather than the leaf name (the default). In Linux containers, this means setting the FQDN in the hostname field of the kernel (the nodename field of struct utsname). In Windows containers, this means setting the registry value of hostname for the registry key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters to FQDN. If a pod does not have FQDN, this has no effect. Default to false.", @@ -1952,8 +2005,9 @@ var map_PodSpec = map[string]string{ "schedulingGates": "SchedulingGates is an opaque list of values that if specified will block scheduling the pod. If schedulingGates is not empty, the pod will stay in the SchedulingGated state and the scheduler will not attempt to schedule the pod.\n\nSchedulingGates can only be set at pod creation time, and be removed only afterwards.", "resourceClaims": "ResourceClaims defines which ResourceClaims must be allocated and reserved before the Pod is allowed to start. The resources will be made available to those containers which consume them by name.\n\nThis is a stable field but requires that the DynamicResourceAllocation feature gate is enabled.\n\nThis field is immutable.", "resources": "Resources is the total amount of CPU and Memory resources required by all containers in the pod. It supports specifying Requests and Limits for \"cpu\", \"memory\" and \"hugepages-\" resource names only. ResourceClaims are not supported.\n\nThis field enables fine-grained control over resource allocation for the entire pod, allowing resource sharing among containers in a pod.\n\nThis is an alpha field and requires enabling the PodLevelResources feature gate.", - "hostnameOverride": "HostnameOverride specifies an explicit override for the pod's hostname as perceived by the pod. This field only specifies the pod's hostname and does not affect its DNS records. When this field is set to a non-empty string: - It takes precedence over the values set in `hostname` and `subdomain`. - The Pod's hostname will be set to this value. - `setHostnameAsFQDN` must be nil or set to false. - `hostNetwork` must be set to false.\n\nThis field must be a valid DNS subdomain as defined in RFC 1123 and contain at most 64 characters. Requires the HostnameOverride feature gate to be enabled.", + "hostnameOverride": "HostnameOverride specifies an explicit override for the pod's hostname as perceived by the pod. This field only specifies the pod's hostname and does not affect its DNS records. When this field is set to a non-empty string: - It takes precedence over the values set in `hostname` and `subdomain`. - The Pod's hostname will be set to this value. - `setHostnameAsFQDN` must be nil or set to false. - `hostNetwork` must be set to false.\n\nThis field must be a valid DNS subdomain as defined in RFC 1123 and contain at most 64 characters.", "schedulingGroup": "SchedulingGroup provides a reference to the immediate scheduling runtime grouping object that this Pod belongs to. This field is used by the scheduler to identify the group and apply the correct group scheduling policies. The association with a group also impacts other lifecycle aspects of a Pod that are relevant in a wider context of scheduling like preemption, resource attachment, etc. If not specified, the Pod is treated as a single unit in all of these aspects. The group object referenced by this field may not exist at the time the Pod is created. This field is immutable, but a group object with the same name may be recreated with different policies. Doing this during pod scheduling may result in the placement not conforming to the expected policies.", + "evictionResponders": "evictionResponders reference responders that react to Evictions based on EvictionRequests. Responders should observe and communicate through the Eviction Resource API to help with the graceful termination of a pod. The responders are selected sequentially, according to their specified priority.\n\nResponders should periodically report on an eviction progress by updating the .status.responders[].heartbeatTime field of the Eviction object. If this field is not updated within the heartbeat deadline defined by the Eviction API (currently 20 minutes), the eviction is passed over to the next responder with a lower priority. If there is no other responder, the last default imperative-eviction.k8s.io/evictor responder with a priority of 100 will evict the pod using the imperative Eviction API (pods//eviction subresource).\n\nThe maximum length of the responders list is 10. Responders are not supported when the pod is part of a PodGroup (.spec.schedulingGroup is set). This field can only be set on creation and is immutable afterwards.", } func (PodSpec) SwaggerDoc() map[string]string { @@ -1983,22 +2037,13 @@ var map_PodStatus = map[string]string{ "allocatedResources": "AllocatedResources is the total requests allocated for this pod by the node. If pod-level requests are not set, this will be the total requests aggregated across containers in the pod.", "resources": "Resources represents the compute resource requests and limits that have been applied at the pod level if pod-level requests or limits are set in PodSpec.Resources", "nodeAllocatableResourceClaimStatuses": "NodeAllocatableResourceClaimStatuses contains the status of node-allocatable resources that were allocated for this pod through DRA claims. This includes resources currently reported in v1.Node `status.allocatable` that are not extended resources (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). Examples include \"cpu\", \"memory\", \"ephemeral-storage\", and hugepages.", + "volumeHealth": "volumeHealth contains node-reported health for each volume the pod is using. Populated by the kubelet on the pod's node.", } func (PodStatus) SwaggerDoc() map[string]string { return map_PodStatus } -var map_PodStatusResult = map[string]string{ - "": "PodStatusResult is a wrapper for PodStatus returned by kubelet that can be encode/decoded", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "status": "Most recently observed status of the pod. This data may not be up to date. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", -} - -func (PodStatusResult) SwaggerDoc() map[string]string { - return map_PodStatusResult -} - var map_PodTemplate = map[string]string{ "": "PodTemplate describes a template for creating copies of a predefined pod.", "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", @@ -2029,6 +2074,17 @@ func (PodTemplateSpec) SwaggerDoc() map[string]string { return map_PodTemplateSpec } +var map_PodVolumeHealth = map[string]string{ + "": "PodVolumeHealth contains health information for a volume used by a pod, reported by the CSI node plugin via the kubelet.", + "name": "name matches an entry in pod.spec.volumes.", + "healthConditions": "conditions is the set of adverse conditions reported by the CSI node plugin for this volume on this node. At most 16 conditions may be reported.", + "lastTransitionTime": "lastTransitionTime is when the current set of conditions first appeared.", +} + +func (PodVolumeHealth) SwaggerDoc() map[string]string { + return map_PodVolumeHealth +} + var map_PortStatus = map[string]string{ "": "PortStatus represents the error condition of a service port", "port": "Port is the port number of the service port of which status is recorded here", @@ -2112,6 +2168,7 @@ var map_ProjectedVolumeSource = map[string]string{ "": "Represents a projected volume source", "sources": "sources is the list of volume projections. Each entry in this list handles one source.", "defaultMode": "defaultMode are the mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "defaultUser": "defaultUser is Optional: The owner UID of the created files by default. The defaultUser field is only used as a fallback when the item-level user field is unset. (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled.", } func (ProjectedVolumeSource) SwaggerDoc() map[string]string { @@ -2322,7 +2379,7 @@ func (ResourceRequirements) SwaggerDoc() map[string]string { var map_ResourceStatus = map[string]string{ "": "ResourceStatus represents the status of a single resource allocated to a Pod.", - "name": "Name of the resource. Must be unique within the pod and in case of non-DRA resource, match one of the resources from the pod spec. For DRA resources, the value must be \"claim:/\". When this status is reported about a container, the \"claim_name\" and \"request\" must match one of the claims of this container.", + "name": "Name of the resource. Must be unique within the pod and in case of non-DRA resource, match one of the resources from the pod spec. For DRA resources, the value must be \"claim:/\" when container.resources.claims[*].request is set or \"claim:\" when container.resources.claims[*].request is empty. For DRA-backed extended resources, \"claim:/\" is used when the claim name and request name are recorded in pod.status.extendedResourceClaimStatus. When this status is reported about a container, the \"claim_name\" and \"request\" must match one of the claims of this container.", "resources": "List of unique resources health. Each element in the list contains an unique resource ID and its health. At a minimum, for the lifetime of a Pod, resource ID must uniquely identify the resource allocated to the Pod on the Node. If other Pod on the same Node reports the status with the same resource ID, it must be the same resource they share. See ResourceID type definition for a specific format it has in various use cases.", } @@ -2476,6 +2533,7 @@ var map_SecretVolumeSource = map[string]string{ "items": "items If unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.", "defaultMode": "defaultMode is Optional: mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", "optional": "optional field specify whether the Secret or its keys must be defined", + "defaultUser": "defaultUser is Optional: The owner UID of the created files by default. The defaultUser field is only used as a fallback when the item-level user field is unset. (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled.", } func (SecretVolumeSource) SwaggerDoc() map[string]string { @@ -2549,6 +2607,7 @@ var map_ServiceAccountTokenProjection = map[string]string{ "audience": "audience is the intended audience of the token. A recipient of a token must identify itself with an identifier specified in the audience of the token, and otherwise should reject the token. The audience defaults to the identifier of the apiserver.", "expirationSeconds": "expirationSeconds is the requested duration of validity of the service account token. As the token approaches expiration, the kubelet volume plugin will proactively rotate the service account token. The kubelet will start trying to rotate the token if the token is older than 80 percent of its time to live or if the token is older than 24 hours.Defaults to 1 hour and must be at least 10 minutes.", "path": "path is the path relative to the mount point of the file to project the token into.", + "user": "user is Optional: The owner UID of the created file. If specified, the item-level user field takes precedence over defaultUser. (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled.", } func (ServiceAccountTokenProjection) SwaggerDoc() map[string]string { @@ -2792,15 +2851,37 @@ func (VolumeDevice) SwaggerDoc() map[string]string { return map_VolumeDevice } +var map_VolumeHealthCondition = map[string]string{ + "": "VolumeHealthCondition represents an adverse health condition reported for a volume.", + "status": "status is the machine-parseable health category. Possible values: - \"Inaccessible\": the volume cannot be accessed. - \"DataLoss\": data loss has been detected on the volume. - \"Degraded\": the volume is functioning with reduced capability.", + "reason": "reason is a brief CamelCase machine-parseable reason. Together with status it forms the unique identity of a condition entry. Maximum permitted length of a reason is 256 bytes.", + "message": "message is a human-readable description. Maximum permitted length of a message is 1024 bytes.", +} + +func (VolumeHealthCondition) SwaggerDoc() map[string]string { + return map_VolumeHealthCondition +} + +var map_VolumeHealthStatus = map[string]string{ + "": "VolumeHealthStatus contains health information for a volume reported by the CSI controller plugin.", + "healthConditions": "conditions is the set of adverse conditions reported by the CSI controller plugin. An empty list means no adverse condition. At most 16 conditions may be reported.", + "lastTransitionTime": "lastTransitionTime is when the current set of conditions first appeared.", +} + +func (VolumeHealthStatus) SwaggerDoc() map[string]string { + return map_VolumeHealthStatus +} + var map_VolumeMount = map[string]string{ "": "VolumeMount describes a mounting of a Volume within a container.", "name": "This must match the Name of a Volume.", "readOnly": "Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.", "recursiveReadOnly": "RecursiveReadOnly specifies whether read-only mounts should be handled recursively.\n\nIf ReadOnly is false, this field has no meaning and must be unspecified.\n\nIf ReadOnly is true, and this field is set to Disabled, the mount is not made recursively read-only. If this field is set to IfPossible, the mount is made recursively read-only, if it is supported by the container runtime. If this field is set to Enabled, the mount is made recursively read-only if it is supported by the container runtime, otherwise the pod will not be started and an error will be generated to indicate the reason.\n\nIf this field is set to IfPossible or Enabled, MountPropagation must be set to None (or be unspecified, which defaults to None).\n\nIf this field is not specified, it is treated as an equivalent of Disabled.", - "mountPath": "Path within the container at which the volume should be mounted. Must not contain ':'.", + "mountPath": "Path within the container at which the volume should be mounted.", "subPath": "Path within the volume from which the container's volume should be mounted. Defaults to \"\" (volume's root).", "mountPropagation": "mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationNone is used. This field is beta in 1.10. When RecursiveReadOnly is set to IfPossible or to Enabled, MountPropagation must be None or unspecified (which defaults to None).", "subPathExpr": "Expanded path within the volume from which the container's volume should be mounted. Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. Defaults to \"\" (volume's root). SubPathExpr and SubPath are mutually exclusive.", + "bindMountOptions": "bindMountOptions is the list of additional bind mount options to apply when mounting this volume into the container. Allowed values are noexec, nodev, and nosuid. These are Linux mount options and have no effect on Windows nodes. This field is not supported with image volumes. This is an alpha field and requires enabling the VolumeBindMountOptions feature gate.", } func (VolumeMount) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go b/vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go index 10af6c17d2..4a0b717f30 100644 --- a/vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go @@ -22,7 +22,6 @@ limitations under the License. package v1 import ( - resource "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" types "k8s.io/apimachinery/pkg/types" @@ -485,6 +484,11 @@ func (in *ClusterTrustBundleProjection) DeepCopyInto(out *ClusterTrustBundleProj *out = new(bool) **out = **in } + if in.User != nil { + in, out := &in.User, &out.User + *out = new(int64) + **out = **in + } return } @@ -774,6 +778,11 @@ func (in *ConfigMapVolumeSource) DeepCopyInto(out *ConfigMapVolumeSource) { *out = new(bool) **out = **in } + if in.DefaultUser != nil { + in, out := &in.DefaultUser, &out.DefaultUser + *out = new(int64) + **out = **in + } return } @@ -1217,6 +1226,11 @@ func (in *DownwardAPIVolumeFile) DeepCopyInto(out *DownwardAPIVolumeFile) { *out = new(int32) **out = **in } + if in.User != nil { + in, out := &in.User, &out.User + *out = new(int64) + **out = **in + } return } @@ -1245,6 +1259,11 @@ func (in *DownwardAPIVolumeSource) DeepCopyInto(out *DownwardAPIVolumeSource) { *out = new(int32) **out = **in } + if in.DefaultUser != nil { + in, out := &in.DefaultUser, &out.DefaultUser + *out = new(int64) + **out = **in + } return } @@ -1266,6 +1285,11 @@ func (in *EmptyDirVolumeSource) DeepCopyInto(out *EmptyDirVolumeSource) { x := (*in).DeepCopy() *out = &x } + if in.Mode != nil { + in, out := &in.Mode, &out.Mode + *out = new(int32) + **out = **in + } return } @@ -1762,6 +1786,27 @@ func (in *EventSource) DeepCopy() *EventSource { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EvictionResponder) DeepCopyInto(out *EvictionResponder) { + *out = *in + if in.Priority != nil { + in, out := &in.Priority, &out.Priority + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EvictionResponder. +func (in *EvictionResponder) DeepCopy() *EvictionResponder { + if in == nil { + return nil + } + out := new(EvictionResponder) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExecAction) DeepCopyInto(out *ExecAction) { *out = *in @@ -1931,6 +1976,11 @@ func (in *GRPCAction) DeepCopyInto(out *GRPCAction) { *out = new(string) **out = **in } + if in.Mode != nil { + in, out := &in.Mode, &out.Mode + *out = new(GRPCProbeMode) + **out = **in + } return } @@ -2006,6 +2056,11 @@ func (in *HTTPGetAction) DeepCopyInto(out *HTTPGetAction) { *out = make([]HTTPHeader, len(*in)) copy(*out, *in) } + if in.Protocol != nil { + in, out := &in.Protocol, &out.Protocol + *out = new(HTTPProtocol) + **out = **in + } return } @@ -2195,6 +2250,11 @@ func (in *KeyToPath) DeepCopyInto(out *KeyToPath) { *out = new(int32) **out = **in } + if in.User != nil { + in, out := &in.User, &out.User + *out = new(int64) + **out = **in + } return } @@ -2777,6 +2837,53 @@ func (in *NodeAffinity) DeepCopy() *NodeAffinity { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeAllocatableMappedResources) DeepCopyInto(out *NodeAllocatableMappedResources) { + *out = *in + if in.Quantity != nil { + in, out := &in.Quantity, &out.Quantity + x := (*in).DeepCopy() + *out = &x + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableMappedResources. +func (in *NodeAllocatableMappedResources) DeepCopy() *NodeAllocatableMappedResources { + if in == nil { + return nil + } + out := new(NodeAllocatableMappedResources) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeAllocatableOverheadResources) DeepCopyInto(out *NodeAllocatableOverheadResources) { + *out = *in + if in.PerPod != nil { + in, out := &in.PerPod, &out.PerPod + x := (*in).DeepCopy() + *out = &x + } + if in.PerContainer != nil { + in, out := &in.PerContainer, &out.PerContainer + x := (*in).DeepCopy() + *out = &x + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableOverheadResources. +func (in *NodeAllocatableOverheadResources) DeepCopy() *NodeAllocatableOverheadResources { + if in == nil { + return nil + } + out := new(NodeAllocatableOverheadResources) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeAllocatableResourceClaimStatus) DeepCopyInto(out *NodeAllocatableResourceClaimStatus) { *out = *in @@ -2785,11 +2892,18 @@ func (in *NodeAllocatableResourceClaimStatus) DeepCopyInto(out *NodeAllocatableR *out = make([]string, len(*in)) copy(*out, *in) } - if in.Resources != nil { - in, out := &in.Resources, &out.Resources - *out = make(map[ResourceName]resource.Quantity, len(*in)) - for key, val := range *in { - (*out)[key] = val.DeepCopy() + if in.Mapping != nil { + in, out := &in.Mapping, &out.Mapping + *out = make([]NodeAllocatableMappedResources, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Overhead != nil { + in, out := &in.Overhead, &out.Overhead + *out = make([]NodeAllocatableOverheadResources, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) } } return @@ -2946,6 +3060,27 @@ func (in *NodeList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodePodPreemptionPolicy) DeepCopyInto(out *NodePodPreemptionPolicy) { + *out = *in + if in.DisableResizePreemption != nil { + in, out := &in.DisableResizePreemption, &out.DisableResizePreemption + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePodPreemptionPolicy. +func (in *NodePodPreemptionPolicy) DeepCopy() *NodePodPreemptionPolicy { + if in == nil { + return nil + } + out := new(NodePodPreemptionPolicy) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeProxyOptions) DeepCopyInto(out *NodeProxyOptions) { *out = *in @@ -3112,6 +3247,11 @@ func (in *NodeSpec) DeepCopyInto(out *NodeSpec) { *out = new(NodeConfigSource) (*in).DeepCopyInto(*out) } + if in.PodPreemptionPolicy != nil { + in, out := &in.PodPreemptionPolicy, &out.PodPreemptionPolicy + *out = new(NodePodPreemptionPolicy) + (*in).DeepCopyInto(*out) + } return } @@ -3237,6 +3377,11 @@ func (in *NodeSystemInfo) DeepCopyInto(out *NodeSystemInfo) { *out = new(NodeSwapStatus) (*in).DeepCopyInto(*out) } + if in.RunningInUserNamespace != nil { + in, out := &in.RunningInUserNamespace, &out.RunningInUserNamespace + *out = new(bool) + **out = **in + } return } @@ -3495,6 +3640,11 @@ func (in *PersistentVolumeClaimStatus) DeepCopyInto(out *PersistentVolumeClaimSt *out = new(ModifyVolumeStatus) **out = **in } + if in.HealthStatus != nil { + in, out := &in.HealthStatus, &out.HealthStatus + *out = new(VolumeHealthStatus) + (*in).DeepCopyInto(*out) + } return } @@ -3960,6 +4110,11 @@ func (in *PodCertificateProjection) DeepCopyInto(out *PodCertificateProjection) (*out)[key] = val } } + if in.User != nil { + in, out := &in.User, &out.User + *out = new(int64) + **out = **in + } return } @@ -4640,6 +4795,13 @@ func (in *PodSpec) DeepCopyInto(out *PodSpec) { *out = new(PodSchedulingGroup) (*in).DeepCopyInto(*out) } + if in.EvictionResponders != nil { + in, out := &in.EvictionResponders, &out.EvictionResponders + *out = make([]EvictionResponder, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -4729,6 +4891,13 @@ func (in *PodStatus) DeepCopyInto(out *PodStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.VolumeHealth != nil { + in, out := &in.VolumeHealth, &out.VolumeHealth + *out = make([]PodVolumeHealth, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -4742,33 +4911,6 @@ func (in *PodStatus) DeepCopy() *PodStatus { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodStatusResult) DeepCopyInto(out *PodStatusResult) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodStatusResult. -func (in *PodStatusResult) DeepCopy() *PodStatusResult { - if in == nil { - return nil - } - out := new(PodStatusResult) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PodStatusResult) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PodTemplate) DeepCopyInto(out *PodTemplate) { *out = *in @@ -4847,6 +4989,28 @@ func (in *PodTemplateSpec) DeepCopy() *PodTemplateSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodVolumeHealth) DeepCopyInto(out *PodVolumeHealth) { + *out = *in + if in.HealthConditions != nil { + in, out := &in.HealthConditions, &out.HealthConditions + *out = make([]VolumeHealthCondition, len(*in)) + copy(*out, *in) + } + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodVolumeHealth. +func (in *PodVolumeHealth) DeepCopy() *PodVolumeHealth { + if in == nil { + return nil + } + out := new(PodVolumeHealth) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PortStatus) DeepCopyInto(out *PortStatus) { *out = *in @@ -5013,6 +5177,11 @@ func (in *ProjectedVolumeSource) DeepCopyInto(out *ProjectedVolumeSource) { *out = new(int32) **out = **in } + if in.DefaultUser != nil { + in, out := &in.DefaultUser, &out.DefaultUser + *out = new(int64) + **out = **in + } return } @@ -5835,6 +6004,11 @@ func (in *SecretVolumeSource) DeepCopyInto(out *SecretVolumeSource) { *out = new(bool) **out = **in } + if in.DefaultUser != nil { + in, out := &in.DefaultUser, &out.DefaultUser + *out = new(int64) + **out = **in + } return } @@ -6060,6 +6234,11 @@ func (in *ServiceAccountTokenProjection) DeepCopyInto(out *ServiceAccountTokenPr *out = new(int64) **out = **in } + if in.User != nil { + in, out := &in.User, &out.User + *out = new(int64) + **out = **in + } return } @@ -6575,6 +6754,44 @@ func (in *VolumeDevice) DeepCopy() *VolumeDevice { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeHealthCondition) DeepCopyInto(out *VolumeHealthCondition) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeHealthCondition. +func (in *VolumeHealthCondition) DeepCopy() *VolumeHealthCondition { + if in == nil { + return nil + } + out := new(VolumeHealthCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeHealthStatus) DeepCopyInto(out *VolumeHealthStatus) { + *out = *in + if in.HealthConditions != nil { + in, out := &in.HealthConditions, &out.HealthConditions + *out = make([]VolumeHealthCondition, len(*in)) + copy(*out, *in) + } + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeHealthStatus. +func (in *VolumeHealthStatus) DeepCopy() *VolumeHealthStatus { + if in == nil { + return nil + } + out := new(VolumeHealthStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VolumeMount) DeepCopyInto(out *VolumeMount) { *out = *in @@ -6588,6 +6805,11 @@ func (in *VolumeMount) DeepCopyInto(out *VolumeMount) { *out = new(MountPropagationMode) **out = **in } + if in.BindMountOptions != nil { + in, out := &in.BindMountOptions, &out.BindMountOptions + *out = make([]string, len(*in)) + copy(*out, *in) + } return } diff --git a/vendor/k8s.io/api/core/v1/zz_generated.model_name.go b/vendor/k8s.io/api/core/v1/zz_generated.model_name.go index 8e79ad909e..65cfb59c13 100644 --- a/vendor/k8s.io/api/core/v1/zz_generated.model_name.go +++ b/vendor/k8s.io/api/core/v1/zz_generated.model_name.go @@ -326,6 +326,11 @@ func (in EventSource) OpenAPIModelName() string { return "io.k8s.api.core.v1.EventSource" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EvictionResponder) OpenAPIModelName() string { + return "io.k8s.api.core.v1.EvictionResponder" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in ExecAction) OpenAPIModelName() string { return "io.k8s.api.core.v1.ExecAction" @@ -541,6 +546,16 @@ func (in NodeAffinity) OpenAPIModelName() string { return "io.k8s.api.core.v1.NodeAffinity" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in NodeAllocatableMappedResources) OpenAPIModelName() string { + return "io.k8s.api.core.v1.NodeAllocatableMappedResources" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in NodeAllocatableOverheadResources) OpenAPIModelName() string { + return "io.k8s.api.core.v1.NodeAllocatableOverheadResources" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in NodeAllocatableResourceClaimStatus) OpenAPIModelName() string { return "io.k8s.api.core.v1.NodeAllocatableResourceClaimStatus" @@ -576,6 +591,11 @@ func (in NodeList) OpenAPIModelName() string { return "io.k8s.api.core.v1.NodeList" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in NodePodPreemptionPolicy) OpenAPIModelName() string { + return "io.k8s.api.core.v1.NodePodPreemptionPolicy" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in NodeProxyOptions) OpenAPIModelName() string { return "io.k8s.api.core.v1.NodeProxyOptions" @@ -831,11 +851,6 @@ func (in PodStatus) OpenAPIModelName() string { return "io.k8s.api.core.v1.PodStatus" } -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PodStatusResult) OpenAPIModelName() string { - return "io.k8s.api.core.v1.PodStatusResult" -} - // OpenAPIModelName returns the OpenAPI model name for this type. func (in PodTemplate) OpenAPIModelName() string { return "io.k8s.api.core.v1.PodTemplate" @@ -851,6 +866,11 @@ func (in PodTemplateSpec) OpenAPIModelName() string { return "io.k8s.api.core.v1.PodTemplateSpec" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodVolumeHealth) OpenAPIModelName() string { + return "io.k8s.api.core.v1.PodVolumeHealth" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in PortStatus) OpenAPIModelName() string { return "io.k8s.api.core.v1.PortStatus" @@ -1176,6 +1196,16 @@ func (in VolumeDevice) OpenAPIModelName() string { return "io.k8s.api.core.v1.VolumeDevice" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in VolumeHealthCondition) OpenAPIModelName() string { + return "io.k8s.api.core.v1.VolumeHealthCondition" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in VolumeHealthStatus) OpenAPIModelName() string { + return "io.k8s.api.core.v1.VolumeHealthStatus" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in VolumeMount) OpenAPIModelName() string { return "io.k8s.api.core.v1.VolumeMount" diff --git a/vendor/k8s.io/api/core/v1/zz_generated.prerelease-lifecycle.go b/vendor/k8s.io/api/core/v1/zz_generated.prerelease-lifecycle.go index 6710a96d1c..d473e30999 100644 --- a/vendor/k8s.io/api/core/v1/zz_generated.prerelease-lifecycle.go +++ b/vendor/k8s.io/api/core/v1/zz_generated.prerelease-lifecycle.go @@ -177,12 +177,6 @@ func (in *PodProxyOptions) APILifecycleIntroduced() (major, minor int) { return 1, 0 } -// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. -// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. -func (in *PodStatusResult) APILifecycleIntroduced() (major, minor int) { - return 1, 0 -} - // APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. func (in *PodTemplate) APILifecycleIntroduced() (major, minor int) { diff --git a/vendor/k8s.io/api/discovery/v1/generated.proto b/vendor/k8s.io/api/discovery/v1/generated.proto index edbc4304b1..a1713290dd 100644 --- a/vendor/k8s.io/api/discovery/v1/generated.proto +++ b/vendor/k8s.io/api/discovery/v1/generated.proto @@ -39,8 +39,8 @@ message Endpoint { // additional addresses beyond the first, and kube-proxy does not look at them. // +listType=set // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:maxItems=100 + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:maxItems=100 repeated string addresses = 1; // conditions contains information about the current status of the endpoint. @@ -185,15 +185,15 @@ message EndpointSlice { // slices of addressType "IPv4" and "IPv6". No semantics are defined for // the "FQDN" type. // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:immutable optional string addressType = 4; // endpoints is a list of unique endpoints in this slice. Each slice may // include a maximum of 1000 endpoints. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated Endpoint endpoints = 2; // ports specifies the list of network ports exposed by each endpoint in diff --git a/vendor/k8s.io/api/discovery/v1/types.go b/vendor/k8s.io/api/discovery/v1/types.go index c291ed85dd..a5b5f827b6 100644 --- a/vendor/k8s.io/api/discovery/v1/types.go +++ b/vendor/k8s.io/api/discovery/v1/types.go @@ -32,7 +32,7 @@ import ( // by listing EndpointSlices in the service's namespace whose `kubernetes.io/service-name` // label contains the service's name. type EndpointSlice struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // +optional @@ -49,15 +49,15 @@ type EndpointSlice struct { // slices of addressType "IPv4" and "IPv6". No semantics are defined for // the "FQDN" type. // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:immutable AddressType AddressType `json:"addressType" protobuf:"bytes,4,rep,name=addressType"` // endpoints is a list of unique endpoints in this slice. Each slice may // include a maximum of 1000 endpoints. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Endpoints []Endpoint `json:"endpoints" protobuf:"bytes,2,rep,name=endpoints"` // ports specifies the list of network ports exposed by each endpoint in @@ -73,7 +73,7 @@ type EndpointSlice struct { // AddressType represents the type of address referred to by an endpoint. // +enum -// +k8s:alpha(since: "1.36")=+k8s:enum +// +k8s:beta(since: "1.37")=+k8s:enum type AddressType string const ( @@ -97,8 +97,8 @@ type Endpoint struct { // additional addresses beyond the first, and kube-proxy does not look at them. // +listType=set // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:maxItems=100 + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:maxItems=100 Addresses []string `json:"addresses" protobuf:"bytes,1,rep,name=addresses"` // conditions contains information about the current status of the endpoint. @@ -238,7 +238,7 @@ type EndpointPort struct { // EndpointSliceList represents a list of endpoint slices type EndpointSliceList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // +optional diff --git a/vendor/k8s.io/api/discovery/v1beta1/generated.proto b/vendor/k8s.io/api/discovery/v1beta1/generated.proto index 9b6edb1479..fa45b0ed92 100644 --- a/vendor/k8s.io/api/discovery/v1beta1/generated.proto +++ b/vendor/k8s.io/api/discovery/v1beta1/generated.proto @@ -39,8 +39,8 @@ message Endpoint { // use the first element. Refer to: https://issue.k8s.io/106267 // +listType=set // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:maxItems=100 + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:maxItems=100 repeated string addresses = 1; // conditions contains information about the current status of the endpoint. @@ -171,14 +171,14 @@ message EndpointSlice { // * IPv6: Represents an IPv6 Address. // * FQDN: Represents a Fully Qualified Domain Name. // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:immutable optional string addressType = 4; // endpoints is a list of unique endpoints in this slice. Each slice may // include a maximum of 1000 endpoints. // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated Endpoint endpoints = 2; // ports specifies the list of network ports exposed by each endpoint in diff --git a/vendor/k8s.io/api/discovery/v1beta1/types.go b/vendor/k8s.io/api/discovery/v1beta1/types.go index 1334194d2a..ef7cf4ab34 100644 --- a/vendor/k8s.io/api/discovery/v1beta1/types.go +++ b/vendor/k8s.io/api/discovery/v1beta1/types.go @@ -32,7 +32,7 @@ import ( // For a given service there may be multiple EndpointSlice objects, selected by // labels, which must be joined to produce the full set of endpoints. type EndpointSlice struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // +optional @@ -46,14 +46,14 @@ type EndpointSlice struct { // * IPv6: Represents an IPv6 Address. // * FQDN: Represents a Fully Qualified Domain Name. // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:immutable AddressType AddressType `json:"addressType" protobuf:"bytes,4,rep,name=addressType"` // endpoints is a list of unique endpoints in this slice. Each slice may // include a maximum of 1000 endpoints. // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Endpoints []Endpoint `json:"endpoints" protobuf:"bytes,2,rep,name=endpoints"` // ports specifies the list of network ports exposed by each endpoint in @@ -68,7 +68,7 @@ type EndpointSlice struct { // AddressType represents the type of address referred to by an endpoint. // +enum -// +k8s:alpha(since: "1.36")=+k8s:enum +// +k8s:beta(since: "1.37")=+k8s:enum type AddressType string const ( @@ -92,8 +92,8 @@ type Endpoint struct { // use the first element. Refer to: https://issue.k8s.io/106267 // +listType=set // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:maxItems=100 + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:maxItems=100 Addresses []string `json:"addresses" protobuf:"bytes,1,rep,name=addresses"` // conditions contains information about the current status of the endpoint. @@ -228,7 +228,7 @@ type EndpointPort struct { // EndpointSliceList represents a list of endpoint slices type EndpointSliceList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // +optional diff --git a/vendor/k8s.io/api/events/v1/generated.proto b/vendor/k8s.io/api/events/v1/generated.proto index 6c7e4cca19..f1e63a33a2 100644 --- a/vendor/k8s.io/api/events/v1/generated.proto +++ b/vendor/k8s.io/api/events/v1/generated.proto @@ -36,7 +36,7 @@ option go_package = "k8s.io/api/events/v1"; // continued existence of events with that Reason. Events should be // treated as informative, best-effort, supplemental data. message Event { - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -105,7 +105,7 @@ message Event { // EventList is a list of Event objects. message EventList { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; diff --git a/vendor/k8s.io/api/events/v1/types.go b/vendor/k8s.io/api/events/v1/types.go index 86b12eee15..c545284100 100644 --- a/vendor/k8s.io/api/events/v1/types.go +++ b/vendor/k8s.io/api/events/v1/types.go @@ -32,9 +32,9 @@ import ( // continued existence of events with that Reason. Events should be // treated as informative, best-effort, supplemental data. type Event struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"` @@ -114,8 +114,8 @@ type EventSeries struct { // EventList is a list of Event objects. type EventList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata. + metav1.TypeMeta `json:""` + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/vendor/k8s.io/api/events/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/events/v1/types_swagger_doc_generated.go index 44ac0c3bb6..f5b83f049a 100644 --- a/vendor/k8s.io/api/events/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/events/v1/types_swagger_doc_generated.go @@ -29,7 +29,7 @@ package v1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_Event = map[string]string{ "": "Event is a report of an event somewhere in the cluster. It generally denotes some state change in the system. Events have a limited retention time and triggers and messages may evolve with time. Event consumers should not rely on the timing of an event with a given Reason reflecting a consistent underlying trigger, or the continued existence of events with that Reason. Events should be treated as informative, best-effort, supplemental data.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "eventTime": "eventTime is the time when this Event was first observed. It is required.", "series": "series is data about the Event series this event represents or nil if it's a singleton Event.", "reportingController": "reportingController is the name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`. This field cannot be empty for new Events.", @@ -52,7 +52,7 @@ func (Event) SwaggerDoc() map[string]string { var map_EventList = map[string]string{ "": "EventList is a list of Event objects.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "items": "items is a list of schema objects.", } diff --git a/vendor/k8s.io/api/events/v1beta1/generated.proto b/vendor/k8s.io/api/events/v1beta1/generated.proto index fbdb309701..6e39c03bc3 100644 --- a/vendor/k8s.io/api/events/v1beta1/generated.proto +++ b/vendor/k8s.io/api/events/v1beta1/generated.proto @@ -36,7 +36,7 @@ option go_package = "k8s.io/api/events/v1beta1"; // continued existence of events with that Reason. Events should be // treated as informative, best-effort, supplemental data. message Event { - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -109,7 +109,7 @@ message Event { // EventList is a list of Event objects. message EventList { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; diff --git a/vendor/k8s.io/api/events/v1beta1/types.go b/vendor/k8s.io/api/events/v1beta1/types.go index 5bb6f92b22..dfe1e4cc10 100644 --- a/vendor/k8s.io/api/events/v1beta1/types.go +++ b/vendor/k8s.io/api/events/v1beta1/types.go @@ -33,9 +33,9 @@ import ( // continued existence of events with that Reason. Events should be // treated as informative, best-effort, supplemental data. type Event struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"` @@ -120,8 +120,8 @@ type EventSeries struct { // EventList is a list of Event objects. type EventList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata. + metav1.TypeMeta `json:""` + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/vendor/k8s.io/api/events/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/events/v1beta1/types_swagger_doc_generated.go index e6c28a4f8c..4f188b2abb 100644 --- a/vendor/k8s.io/api/events/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/events/v1beta1/types_swagger_doc_generated.go @@ -29,7 +29,7 @@ package v1beta1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_Event = map[string]string{ "": "Event is a report of an event somewhere in the cluster. It generally denotes some state change in the system. Events have a limited retention time and triggers and messages may evolve with time. Event consumers should not rely on the timing of an event with a given Reason reflecting a consistent underlying trigger, or the continued existence of events with that Reason. Events should be treated as informative, best-effort, supplemental data.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "eventTime": "eventTime is the time when this Event was first observed. It is required.", "series": "series is data about the Event series this event represents or nil if it's a singleton Event.", "reportingController": "reportingController is the name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`. This field cannot be empty for new Events.", @@ -52,7 +52,7 @@ func (Event) SwaggerDoc() map[string]string { var map_EventList = map[string]string{ "": "EventList is a list of Event objects.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "items": "items is a list of schema objects.", } diff --git a/vendor/k8s.io/api/extensions/v1beta1/doc.go b/vendor/k8s.io/api/extensions/v1beta1/doc.go index bf39ca3e1e..98ccb7685f 100644 --- a/vendor/k8s.io/api/extensions/v1beta1/doc.go +++ b/vendor/k8s.io/api/extensions/v1beta1/doc.go @@ -19,7 +19,8 @@ limitations under the License. // +k8s:openapi-gen=true // +k8s:prerelease-lifecycle-gen=true // +k8s:openapi-model-package=io.k8s.api.extensions.v1beta1 -// +k8s:validation-gen=TypeMeta -// +k8s:validation-gen-input=k8s.io/api/extensions/v1beta1 +// extensions/v1beta1 is permanently unserved, so version-specific declarative +// validation here is unreachable. +// +k8s:validation-gen=false package v1beta1 diff --git a/vendor/k8s.io/api/extensions/v1beta1/generated.proto b/vendor/k8s.io/api/extensions/v1beta1/generated.proto index f090306686..9d45061d5a 100644 --- a/vendor/k8s.io/api/extensions/v1beta1/generated.proto +++ b/vendor/k8s.io/api/extensions/v1beta1/generated.proto @@ -33,6 +33,7 @@ option go_package = "k8s.io/api/extensions/v1beta1"; // DEPRECATED - This group version of DaemonSet is deprecated by apps/v1beta2/DaemonSet. See the release notes for // more information. // DaemonSet represents the configuration of a daemon set. +// +k8s:supportsSubresource="/status" message DaemonSet { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -202,6 +203,7 @@ message DaemonSetUpdateStrategy { // DEPRECATED - This group version of Deployment is deprecated by apps/v1beta2/Deployment. See the release notes for // more information. // Deployment enables declarative updates for Pods and ReplicaSets. +// +k8s:supportsSubresource="/status" message Deployment { // Standard object metadata. // +optional @@ -429,7 +431,7 @@ message IPBlock { // CIDR is a string representing the IP Block // Valid examples are "192.168.1.0/24" or "2001:db8::/64" // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string cidr = 1; // Except is a slice of CIDRs that should not be included within an IP Block @@ -445,6 +447,7 @@ message IPBlock { // externally-reachable urls, load balance traffic, terminate SSL, offer name // based virtual hosting etc. // DEPRECATED - This group version of Ingress is deprecated by networking.k8s.io/v1beta1 Ingress. See the release notes for more information. +// +k8s:supportsSubresource="/status" message Ingress { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -688,7 +691,7 @@ message NetworkPolicyEgressRule { // allows traffic only if the traffic matches at least one item in the to list. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated NetworkPolicyPeer to = 2; } @@ -711,7 +714,7 @@ message NetworkPolicyIngressRule { // traffic matches at least one item in the from list. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated NetworkPolicyPeer from = 2; } @@ -750,7 +753,7 @@ message NetworkPolicyPeer { // IPBlock defines policy on a particular IPBlock. If this field is set then // neither of the other fields can be. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional IPBlock ipBlock = 3; } @@ -794,7 +797,7 @@ message NetworkPolicySpec { // (and serves solely to ensure that the pods it selects are isolated by default). // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated NetworkPolicyIngressRule ingress = 2; // List of egress rules to be applied to the selected pods. Outgoing traffic is @@ -806,7 +809,7 @@ message NetworkPolicySpec { // This field is beta-level in 1.8 // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated NetworkPolicyEgressRule egress = 3; // List of rule types that the NetworkPolicy relates to. @@ -827,6 +830,7 @@ message NetworkPolicySpec { // DEPRECATED - This group version of ReplicaSet is deprecated by apps/v1beta2/ReplicaSet. See the release notes for // more information. // ReplicaSet ensures that a specified number of pod replicas are running at any given time. +// +k8s:supportsSubresource="/status" message ReplicaSet { // If the Labels of a ReplicaSet are empty, they are defaulted to // be the same as the Pod(s) that the ReplicaSet manages. @@ -1046,9 +1050,9 @@ message Scale { message ScaleSpec { // desired number of instances for the scaled object. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +default=0 - // +k8s:alpha(since: "1.36")=+k8s:minimum=0 + // +k8s:beta(since: "1.37")=+k8s:minimum=0 optional int32 replicas = 1; } diff --git a/vendor/k8s.io/api/extensions/v1beta1/types.go b/vendor/k8s.io/api/extensions/v1beta1/types.go index 09d143ea60..e0caf19823 100644 --- a/vendor/k8s.io/api/extensions/v1beta1/types.go +++ b/vendor/k8s.io/api/extensions/v1beta1/types.go @@ -27,9 +27,9 @@ import ( type ScaleSpec struct { // desired number of instances for the scaled object. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +default=0 - // +k8s:alpha(since: "1.36")=+k8s:minimum=0 + // +k8s:beta(since: "1.37")=+k8s:minimum=0 Replicas int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` } @@ -61,7 +61,7 @@ type ScaleStatus struct { // represents a scaling request for a resource. type Scale struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -88,8 +88,9 @@ type Scale struct { // DEPRECATED - This group version of Deployment is deprecated by apps/v1beta2/Deployment. See the release notes for // more information. // Deployment enables declarative updates for Pods and ReplicaSets. +// +k8s:supportsSubresource="/status" type Deployment struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -164,7 +165,7 @@ type DeploymentSpec struct { // DEPRECATED. // DeploymentRollback stores the information required to rollback a deployment. type DeploymentRollback struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Required: This must match the Name of a deployment. Name string `json:"name" protobuf:"bytes,1,opt,name=name"` // The annotations to be updated to a deployment @@ -333,7 +334,7 @@ type DeploymentCondition struct { // DeploymentList is a list of Deployments. type DeploymentList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -539,8 +540,9 @@ type DaemonSetCondition struct { // DEPRECATED - This group version of DaemonSet is deprecated by apps/v1beta2/DaemonSet. See the release notes for // more information. // DaemonSet represents the configuration of a daemon set. +// +k8s:supportsSubresource="/status" type DaemonSet struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -581,7 +583,7 @@ const ( // DaemonSetList is a collection of daemon sets. type DaemonSetList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -603,8 +605,9 @@ type DaemonSetList struct { // externally-reachable urls, load balance traffic, terminate SSL, offer name // based virtual hosting etc. // DEPRECATED - This group version of Ingress is deprecated by networking.k8s.io/v1beta1 Ingress. See the release notes for more information. +// +k8s:supportsSubresource="/status" type Ingress struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -629,7 +632,7 @@ type Ingress struct { // IngressList is a collection of Ingress. type IngressList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -786,7 +789,7 @@ type IngressRule struct { // default backend, is left to the controller fulfilling the Ingress. Http is // currently the only supported IngressRuleValue. // +optional - IngressRuleValue `json:",inline" protobuf:"bytes,2,opt,name=ingressRuleValue"` + IngressRuleValue `json:"" protobuf:"bytes,2,opt,name=ingressRuleValue"` } // IngressRuleValue represents a rule to apply against incoming requests. If the @@ -914,8 +917,9 @@ type IngressBackend struct { // DEPRECATED - This group version of ReplicaSet is deprecated by apps/v1beta2/ReplicaSet. See the release notes for // more information. // ReplicaSet ensures that a specified number of pod replicas are running at any given time. +// +k8s:supportsSubresource="/status" type ReplicaSet struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // If the Labels of a ReplicaSet are empty, they are defaulted to // be the same as the Pod(s) that the ReplicaSet manages. @@ -945,7 +949,7 @@ type ReplicaSet struct { // ReplicaSetList is a collection of ReplicaSets. type ReplicaSetList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -1060,7 +1064,7 @@ type ReplicaSetCondition struct { // DEPRECATED 1.9 - This group version of NetworkPolicy is deprecated by networking/v1/NetworkPolicy. // NetworkPolicy describes what network traffic is allowed for a set of Pods type NetworkPolicy struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -1106,7 +1110,7 @@ type NetworkPolicySpec struct { // (and serves solely to ensure that the pods it selects are isolated by default). // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Ingress []NetworkPolicyIngressRule `json:"ingress,omitempty" protobuf:"bytes,2,rep,name=ingress"` // List of egress rules to be applied to the selected pods. Outgoing traffic is @@ -1118,7 +1122,7 @@ type NetworkPolicySpec struct { // This field is beta-level in 1.8 // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Egress []NetworkPolicyEgressRule `json:"egress,omitempty" protobuf:"bytes,3,rep,name=egress"` // List of rule types that the NetworkPolicy relates to. @@ -1155,7 +1159,7 @@ type NetworkPolicyIngressRule struct { // traffic matches at least one item in the from list. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional From []NetworkPolicyPeer `json:"from,omitempty" protobuf:"bytes,2,rep,name=from"` } @@ -1180,7 +1184,7 @@ type NetworkPolicyEgressRule struct { // allows traffic only if the traffic matches at least one item in the to list. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional To []NetworkPolicyPeer `json:"to,omitempty" protobuf:"bytes,2,rep,name=to"` } @@ -1214,7 +1218,7 @@ type IPBlock struct { // CIDR is a string representing the IP Block // Valid examples are "192.168.1.0/24" or "2001:db8::/64" // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required CIDR string `json:"cidr" protobuf:"bytes,1,name=cidr"` // Except is a slice of CIDRs that should not be included within an IP Block // Valid examples are "192.168.1.0/24" or "2001:db8::/64" @@ -1247,7 +1251,7 @@ type NetworkPolicyPeer struct { // IPBlock defines policy on a particular IPBlock. If this field is set then // neither of the other fields can be. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional IPBlock *IPBlock `json:"ipBlock,omitempty" protobuf:"bytes,3,rep,name=ipBlock"` } @@ -1260,7 +1264,7 @@ type NetworkPolicyPeer struct { // DEPRECATED 1.9 - This group version of NetworkPolicyList is deprecated by networking/v1/NetworkPolicyList. // Network Policy List is a list of NetworkPolicy objects. type NetworkPolicyList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional diff --git a/vendor/k8s.io/api/extensions/v1beta1/zz_generated.validations.go b/vendor/k8s.io/api/extensions/v1beta1/zz_generated.validations.go deleted file mode 100644 index d504d5452e..0000000000 --- a/vendor/k8s.io/api/extensions/v1beta1/zz_generated.validations.go +++ /dev/null @@ -1,279 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by validation-gen. DO NOT EDIT. - -package v1beta1 - -import ( - context "context" - fmt "fmt" - - equality "k8s.io/apimachinery/pkg/api/equality" - operation "k8s.io/apimachinery/pkg/api/operation" - safe "k8s.io/apimachinery/pkg/api/safe" - validate "k8s.io/apimachinery/pkg/api/validate" - runtime "k8s.io/apimachinery/pkg/runtime" - field "k8s.io/apimachinery/pkg/util/validation/field" -) - -func init() { localSchemeBuilder.Register(RegisterValidations) } - -// RegisterValidations adds validation functions to the given scheme. -// Public to allow building arbitrary schemes. -func RegisterValidations(scheme *runtime.Scheme) error { - // type NetworkPolicy - scheme.AddValidationFunc((*NetworkPolicy)(nil), func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList { - switch op.Request.SubresourcePath() { - case "/": - return Validate_NetworkPolicy(ctx, op, nil /* fldPath */, obj.(*NetworkPolicy), safe.Cast[*NetworkPolicy](oldObj)) - } - return field.ErrorList{field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath()))} - }) - // type Scale - scheme.AddValidationFunc((*Scale)(nil), func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList { - switch op.Request.SubresourcePath() { - case "/scale": - return Validate_Scale(ctx, op, nil /* fldPath */, obj.(*Scale), safe.Cast[*Scale](oldObj)) - } - return field.ErrorList{field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath()))} - }) - return nil -} - -// Validate_IPBlock validates an instance of IPBlock according -// to declarative validation rules in the API schema. -func Validate_IPBlock(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *IPBlock) (errs field.ErrorList) { - // field IPBlock.CIDR - errs = append(errs, - func(fldPath *field.Path, obj, oldObj *string, oldValueCorrelated bool) (errs field.ErrorList) { - // don't revalidate unchanged data - if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { - return nil - } - // call field-attached validations - earlyReturn := false - if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 { - errs = append(errs, e...) - earlyReturn = true - } - if earlyReturn { - return // do not proceed - } - return - }(fldPath.Child("cidr"), &obj.CIDR, safe.Field(oldObj, func(oldObj *IPBlock) *string { return &oldObj.CIDR }), oldObj != nil)...) - - // field IPBlock.Except has no validation - return errs -} - -// Validate_NetworkPolicy validates an instance of NetworkPolicy according -// to declarative validation rules in the API schema. -func Validate_NetworkPolicy(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *NetworkPolicy) (errs field.ErrorList) { - // field NetworkPolicy.TypeMeta has no validation - // field NetworkPolicy.ObjectMeta has no validation - - // field NetworkPolicy.Spec - errs = append(errs, - func(fldPath *field.Path, obj, oldObj *NetworkPolicySpec, oldValueCorrelated bool) (errs field.ErrorList) { - // don't revalidate unchanged data - if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { - return nil - } - // call the type's validation function - errs = append(errs, Validate_NetworkPolicySpec(ctx, op, fldPath, obj, oldObj)...) - return - }(fldPath.Child("spec"), &obj.Spec, safe.Field(oldObj, func(oldObj *NetworkPolicy) *NetworkPolicySpec { return &oldObj.Spec }), oldObj != nil)...) - - return errs -} - -// Validate_NetworkPolicyEgressRule validates an instance of NetworkPolicyEgressRule according -// to declarative validation rules in the API schema. -func Validate_NetworkPolicyEgressRule(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *NetworkPolicyEgressRule) (errs field.ErrorList) { - // field NetworkPolicyEgressRule.Ports has no validation - - // field NetworkPolicyEgressRule.To - errs = append(errs, - func(fldPath *field.Path, obj, oldObj []NetworkPolicyPeer, oldValueCorrelated bool) (errs field.ErrorList) { - // don't revalidate unchanged data - if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { - return nil - } - // call field-attached validations - earlyReturn := false - if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 { - earlyReturn = true - } - if earlyReturn { - return // do not proceed - } - // iterate the list and call the type's validation function - errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_NetworkPolicyPeer)...) - return - }(fldPath.Child("to"), obj.To, safe.Field(oldObj, func(oldObj *NetworkPolicyEgressRule) []NetworkPolicyPeer { return oldObj.To }), oldObj != nil)...) - - return errs -} - -// Validate_NetworkPolicyIngressRule validates an instance of NetworkPolicyIngressRule according -// to declarative validation rules in the API schema. -func Validate_NetworkPolicyIngressRule(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *NetworkPolicyIngressRule) (errs field.ErrorList) { - // field NetworkPolicyIngressRule.Ports has no validation - - // field NetworkPolicyIngressRule.From - errs = append(errs, - func(fldPath *field.Path, obj, oldObj []NetworkPolicyPeer, oldValueCorrelated bool) (errs field.ErrorList) { - // don't revalidate unchanged data - if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { - return nil - } - // call field-attached validations - earlyReturn := false - if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 { - earlyReturn = true - } - if earlyReturn { - return // do not proceed - } - // iterate the list and call the type's validation function - errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_NetworkPolicyPeer)...) - return - }(fldPath.Child("from"), obj.From, safe.Field(oldObj, func(oldObj *NetworkPolicyIngressRule) []NetworkPolicyPeer { return oldObj.From }), oldObj != nil)...) - - return errs -} - -// Validate_NetworkPolicyPeer validates an instance of NetworkPolicyPeer according -// to declarative validation rules in the API schema. -func Validate_NetworkPolicyPeer(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *NetworkPolicyPeer) (errs field.ErrorList) { - // field NetworkPolicyPeer.PodSelector has no validation - // field NetworkPolicyPeer.NamespaceSelector has no validation - - // field NetworkPolicyPeer.IPBlock - errs = append(errs, - func(fldPath *field.Path, obj, oldObj *IPBlock, oldValueCorrelated bool) (errs field.ErrorList) { - // don't revalidate unchanged data - if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { - return nil - } - // call field-attached validations - earlyReturn := false - if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 { - earlyReturn = true - } - if earlyReturn { - return // do not proceed - } - // call the type's validation function - errs = append(errs, Validate_IPBlock(ctx, op, fldPath, obj, oldObj)...) - return - }(fldPath.Child("ipBlock"), obj.IPBlock, safe.Field(oldObj, func(oldObj *NetworkPolicyPeer) *IPBlock { return oldObj.IPBlock }), oldObj != nil)...) - - return errs -} - -// Validate_NetworkPolicySpec validates an instance of NetworkPolicySpec according -// to declarative validation rules in the API schema. -func Validate_NetworkPolicySpec(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *NetworkPolicySpec) (errs field.ErrorList) { - // field NetworkPolicySpec.PodSelector has no validation - - // field NetworkPolicySpec.Ingress - errs = append(errs, - func(fldPath *field.Path, obj, oldObj []NetworkPolicyIngressRule, oldValueCorrelated bool) (errs field.ErrorList) { - // don't revalidate unchanged data - if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { - return nil - } - // call field-attached validations - earlyReturn := false - if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 { - earlyReturn = true - } - if earlyReturn { - return // do not proceed - } - // iterate the list and call the type's validation function - errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_NetworkPolicyIngressRule)...) - return - }(fldPath.Child("ingress"), obj.Ingress, safe.Field(oldObj, func(oldObj *NetworkPolicySpec) []NetworkPolicyIngressRule { return oldObj.Ingress }), oldObj != nil)...) - - // field NetworkPolicySpec.Egress - errs = append(errs, - func(fldPath *field.Path, obj, oldObj []NetworkPolicyEgressRule, oldValueCorrelated bool) (errs field.ErrorList) { - // don't revalidate unchanged data - if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { - return nil - } - // call field-attached validations - earlyReturn := false - if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 { - earlyReturn = true - } - if earlyReturn { - return // do not proceed - } - // iterate the list and call the type's validation function - errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_NetworkPolicyEgressRule)...) - return - }(fldPath.Child("egress"), obj.Egress, safe.Field(oldObj, func(oldObj *NetworkPolicySpec) []NetworkPolicyEgressRule { return oldObj.Egress }), oldObj != nil)...) - - // field NetworkPolicySpec.PolicyTypes has no validation - return errs -} - -// Validate_Scale validates an instance of Scale according -// to declarative validation rules in the API schema. -func Validate_Scale(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *Scale) (errs field.ErrorList) { - // field Scale.TypeMeta has no validation - // field Scale.ObjectMeta has no validation - - // field Scale.Spec - errs = append(errs, - func(fldPath *field.Path, obj, oldObj *ScaleSpec, oldValueCorrelated bool) (errs field.ErrorList) { - // don't revalidate unchanged data - if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { - return nil - } - // call the type's validation function - errs = append(errs, Validate_ScaleSpec(ctx, op, fldPath, obj, oldObj)...) - return - }(fldPath.Child("spec"), &obj.Spec, safe.Field(oldObj, func(oldObj *Scale) *ScaleSpec { return &oldObj.Spec }), oldObj != nil)...) - - // field Scale.Status has no validation - return errs -} - -// Validate_ScaleSpec validates an instance of ScaleSpec according -// to declarative validation rules in the API schema. -func Validate_ScaleSpec(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *ScaleSpec) (errs field.ErrorList) { - // field ScaleSpec.Replicas - errs = append(errs, - func(fldPath *field.Path, obj, oldObj *int32, oldValueCorrelated bool) (errs field.ErrorList) { - // don't revalidate unchanged data - if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { - return nil - } - // call field-attached validations - errs = append(errs, validate.Minimum(ctx, op, fldPath, obj, oldObj, 0).MarkAlpha()...) - return - }(fldPath.Child("replicas"), &obj.Replicas, safe.Field(oldObj, func(oldObj *ScaleSpec) *int32 { return &oldObj.Replicas }), oldObj != nil)...) - - return errs -} diff --git a/vendor/k8s.io/api/flowcontrol/v1/generated.proto b/vendor/k8s.io/api/flowcontrol/v1/generated.proto index eb9186d013..29e51ed05b 100644 --- a/vendor/k8s.io/api/flowcontrol/v1/generated.proto +++ b/vendor/k8s.io/api/flowcontrol/v1/generated.proto @@ -67,11 +67,13 @@ message FlowDistinguisherMethod { // `type` is the type of flow distinguisher method // The supported types are "ByUser" and "ByNamespace". // Required. + // +required optional string type = 1; } // FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with // similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". +// +k8s:supportsSubresource="/status" message FlowSchema { // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -80,7 +82,7 @@ message FlowSchema { // `spec` is the specification of the desired behavior of a FlowSchema. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required optional FlowSchemaSpec spec = 2; // `status` is the current status of a FlowSchema. @@ -93,20 +95,24 @@ message FlowSchema { message FlowSchemaCondition { // `type` is the type of the condition. // Required. + // +required optional string type = 1; // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. + // +optional optional string status = 2; // `lastTransitionTime` is the last time the condition transitioned from one status to another. + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3; // `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + // +optional optional string reason = 4; // `message` is a human-readable message indicating details about last transition. + // +optional optional string message = 5; } @@ -126,6 +132,7 @@ message FlowSchemaSpec { // `priorityLevelConfiguration` should reference a PriorityLevelConfiguration in the cluster. If the reference cannot // be resolved, the FlowSchema will be ignored and marked as invalid in its status. // Required. + // +required optional PriorityLevelConfigurationReference priorityLevelConfiguration = 1; // `matchingPrecedence` is used to choose among the FlowSchemas that match a given request. The chosen @@ -165,6 +172,7 @@ message GroupSubject { // See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some // well-known group names. // Required. + // +required optional string name = 1; } @@ -178,17 +186,17 @@ message LimitResponse { // "Reject" means that requests that can not be executed upon arrival // are rejected. // Required. + // +required // +unionDiscriminator - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:discriminator + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:modeDiscriminator optional string type = 1; // `queuing` holds the configuration parameters for queuing. // This field may be non-empty only if `type` is `"Queue"`. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Queue")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:member("Reject")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Queue")=+k8s:required optional QueuingConfiguration queuing = 2; } @@ -221,6 +229,7 @@ message LimitedPriorityLevelConfiguration { optional int32 nominalConcurrencyShares = 1; // `limitResponse` indicates what to do with requests that can not be executed right now + // +required optional LimitResponse limitResponse = 2; // `lendablePercent` prescribes the fraction of the level's NominalCL that @@ -261,6 +270,7 @@ message NonResourcePolicyRule { // "*" matches all verbs. If it is present, it must be the only entry. // +listType=set // Required. + // +required repeated string verbs = 1; // `nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty. @@ -273,6 +283,7 @@ message NonResourcePolicyRule { // "*" matches all non-resource urls. if it is present, it must be the only entry. // +listType=set // Required. + // +required repeated string nonResourceURLs = 6; } @@ -286,6 +297,7 @@ message PolicyRulesWithSubjects { // A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request. // +listType=atomic // Required. + // +required repeated Subject subjects = 1; // `resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the @@ -303,6 +315,7 @@ message PolicyRulesWithSubjects { } // PriorityLevelConfiguration represents the configuration of a priority level. +// +k8s:supportsSubresource="/status" message PriorityLevelConfiguration { // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -311,7 +324,7 @@ message PriorityLevelConfiguration { // `spec` is the specification of the desired behavior of a "request-priority". // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required optional PriorityLevelConfigurationSpec spec = 2; // `status` is the current status of a "request-priority". @@ -324,20 +337,24 @@ message PriorityLevelConfiguration { message PriorityLevelConfigurationCondition { // `type` is the type of the condition. // Required. + // +required optional string type = 1; // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. + // +optional optional string status = 2; // `lastTransitionTime` is the last time the condition transitioned from one status to another. + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3; // `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + // +optional optional string reason = 4; // `message` is a human-readable message indicating details about last transition. + // +optional optional string message = 5; } @@ -356,6 +373,7 @@ message PriorityLevelConfigurationList { message PriorityLevelConfigurationReference { // `name` is the name of the priority level configuration being referenced // Required. + // +required optional string name = 1; } @@ -371,17 +389,17 @@ message PriorityLevelConfigurationSpec { // _are_ subject to limits and (b) some of the server's limited // capacity is made available exclusively to this priority level. // Required. + // +required // +unionDiscriminator - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:discriminator + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:modeDiscriminator optional string type = 1; // `limited` specifies how requests are handled for a Limited priority level. // This field must be non-empty if and only if `type` is `"Limited"`. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Limited")=+k8s:required optional LimitedPriorityLevelConfiguration limited = 2; // `exempt` specifies how requests are handled for an exempt priority level. @@ -390,9 +408,8 @@ message PriorityLevelConfigurationSpec { // If empty and `type` is `"Exempt"` then the default values // for `ExemptPriorityLevelConfiguration` apply. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Exempt")=+k8s:optional optional ExemptPriorityLevelConfiguration exempt = 3; } @@ -454,12 +471,14 @@ message ResourcePolicyRule { // "*" matches all verbs and, if present, must be the only entry. // +listType=set // Required. + // +required repeated string verbs = 1; // `apiGroups` is a list of matching API groups and may not be empty. // "*" matches all API groups and, if present, must be the only entry. // +listType=set // Required. + // +required repeated string apiGroups = 2; // `resources` is a list of matching resources (i.e., lowercase @@ -468,6 +487,7 @@ message ResourcePolicyRule { // "*" matches all resources and, if present, must be the only entry. // Required. // +listType=set + // +required repeated string resources = 3; // `clusterScope` indicates whether to match requests that do not @@ -495,10 +515,12 @@ message ResourcePolicyRule { message ServiceAccountSubject { // `namespace` is the namespace of matching ServiceAccount objects. // Required. + // +required optional string namespace = 1; // `name` is the name of matching ServiceAccount objects, or "*" to match regardless of name. // Required. + // +required optional string name = 2; } @@ -508,6 +530,7 @@ message ServiceAccountSubject { message Subject { // `kind` indicates which one of the other fields is non-empty. // Required + // +required // +unionDiscriminator optional string kind = 1; @@ -528,6 +551,7 @@ message Subject { message UserSubject { // `name` is the username that matches, or "*" to match all usernames. // Required. + // +required optional string name = 1; } diff --git a/vendor/k8s.io/api/flowcontrol/v1/types.go b/vendor/k8s.io/api/flowcontrol/v1/types.go index 4a40bdca42..31e421f280 100644 --- a/vendor/k8s.io/api/flowcontrol/v1/types.go +++ b/vendor/k8s.io/api/flowcontrol/v1/types.go @@ -110,15 +110,16 @@ const ( // FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with // similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". +// +k8s:supportsSubresource="/status" type FlowSchema struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // `spec` is the specification of the desired behavior of a FlowSchema. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required Spec FlowSchemaSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // `status` is the current status of a FlowSchema. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status @@ -131,7 +132,7 @@ type FlowSchema struct { // FlowSchemaList is a list of FlowSchema objects. type FlowSchemaList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // `metadata` is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -146,6 +147,7 @@ type FlowSchemaSpec struct { // `priorityLevelConfiguration` should reference a PriorityLevelConfiguration in the cluster. If the reference cannot // be resolved, the FlowSchema will be ignored and marked as invalid in its status. // Required. + // +required PriorityLevelConfiguration PriorityLevelConfigurationReference `json:"priorityLevelConfiguration" protobuf:"bytes,1,opt,name=priorityLevelConfiguration"` // `matchingPrecedence` is used to choose among the FlowSchemas that match a given request. The chosen // FlowSchema is among those with the numerically lowest (which we take to be logically highest) @@ -187,6 +189,7 @@ type FlowDistinguisherMethod struct { // `type` is the type of flow distinguisher method // The supported types are "ByUser" and "ByNamespace". // Required. + // +required Type FlowDistinguisherMethodType `json:"type" protobuf:"bytes,1,opt,name=type"` } @@ -194,6 +197,7 @@ type FlowDistinguisherMethod struct { type PriorityLevelConfigurationReference struct { // `name` is the name of the priority level configuration being referenced // Required. + // +required Name string `json:"name" protobuf:"bytes,1,opt,name=name"` } @@ -207,6 +211,7 @@ type PolicyRulesWithSubjects struct { // A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request. // +listType=atomic // Required. + // +required Subjects []Subject `json:"subjects" protobuf:"bytes,1,rep,name=subjects"` // `resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the // target resource. @@ -227,6 +232,7 @@ type PolicyRulesWithSubjects struct { type Subject struct { // `kind` indicates which one of the other fields is non-empty. // Required + // +required // +unionDiscriminator Kind SubjectKind `json:"kind" protobuf:"bytes,1,opt,name=kind"` // `user` matches based on username. @@ -254,6 +260,7 @@ const ( type UserSubject struct { // `name` is the username that matches, or "*" to match all usernames. // Required. + // +required Name string `json:"name" protobuf:"bytes,1,opt,name=name"` } @@ -263,6 +270,7 @@ type GroupSubject struct { // See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some // well-known group names. // Required. + // +required Name string `json:"name" protobuf:"bytes,1,opt,name=name"` } @@ -270,9 +278,11 @@ type GroupSubject struct { type ServiceAccountSubject struct { // `namespace` is the namespace of matching ServiceAccount objects. // Required. + // +required Namespace string `json:"namespace" protobuf:"bytes,1,opt,name=namespace"` // `name` is the name of matching ServiceAccount objects, or "*" to match regardless of name. // Required. + // +required Name string `json:"name" protobuf:"bytes,2,opt,name=name"` } @@ -290,12 +300,14 @@ type ResourcePolicyRule struct { // "*" matches all verbs and, if present, must be the only entry. // +listType=set // Required. + // +required Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` // `apiGroups` is a list of matching API groups and may not be empty. // "*" matches all API groups and, if present, must be the only entry. // +listType=set // Required. + // +required APIGroups []string `json:"apiGroups" protobuf:"bytes,2,rep,name=apiGroups"` // `resources` is a list of matching resources (i.e., lowercase @@ -304,6 +316,7 @@ type ResourcePolicyRule struct { // "*" matches all resources and, if present, must be the only entry. // Required. // +listType=set + // +required Resources []string `json:"resources" protobuf:"bytes,3,rep,name=resources"` // `clusterScope` indicates whether to match requests that do not @@ -335,6 +348,7 @@ type NonResourcePolicyRule struct { // "*" matches all verbs. If it is present, it must be the only entry. // +listType=set // Required. + // +required Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` // `nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty. // For example: @@ -346,6 +360,7 @@ type NonResourcePolicyRule struct { // "*" matches all non-resource urls. if it is present, it must be the only entry. // +listType=set // Required. + // +required NonResourceURLs []string `json:"nonResourceURLs" protobuf:"bytes,6,rep,name=nonResourceURLs"` } @@ -364,16 +379,20 @@ type FlowSchemaStatus struct { type FlowSchemaCondition struct { // `type` is the type of the condition. // Required. + // +required Type FlowSchemaConditionType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"` // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. + // +optional Status ConditionStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"` // `lastTransitionTime` is the last time the condition transitioned from one status to another. + // +optional LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"` // `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + // +optional Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` // `message` is a human-readable message indicating details about last transition. + // +optional Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` } @@ -386,15 +405,16 @@ type FlowSchemaConditionType string // +k8s:prerelease-lifecycle-gen:introduced=1.29 // PriorityLevelConfiguration represents the configuration of a priority level. +// +k8s:supportsSubresource="/status" type PriorityLevelConfiguration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // `spec` is the specification of the desired behavior of a "request-priority". // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required Spec PriorityLevelConfigurationSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // `status` is the current status of a "request-priority". // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status @@ -407,7 +427,7 @@ type PriorityLevelConfiguration struct { // PriorityLevelConfigurationList is a list of PriorityLevelConfiguration objects. type PriorityLevelConfigurationList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -428,17 +448,17 @@ type PriorityLevelConfigurationSpec struct { // _are_ subject to limits and (b) some of the server's limited // capacity is made available exclusively to this priority level. // Required. + // +required // +unionDiscriminator - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:discriminator + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:modeDiscriminator Type PriorityLevelEnablement `json:"type" protobuf:"bytes,1,opt,name=type"` // `limited` specifies how requests are handled for a Limited priority level. // This field must be non-empty if and only if `type` is `"Limited"`. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Limited")=+k8s:required Limited *LimitedPriorityLevelConfiguration `json:"limited,omitempty" protobuf:"bytes,2,opt,name=limited"` // `exempt` specifies how requests are handled for an exempt priority level. @@ -447,9 +467,8 @@ type PriorityLevelConfigurationSpec struct { // If empty and `type` is `"Exempt"` then the default values // for `ExemptPriorityLevelConfiguration` apply. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Exempt")=+k8s:optional Exempt *ExemptPriorityLevelConfiguration `json:"exempt,omitempty" protobuf:"bytes,3,opt,name=exempt"` } @@ -494,6 +513,7 @@ type LimitedPriorityLevelConfiguration struct { NominalConcurrencyShares *int32 `json:"nominalConcurrencyShares" protobuf:"varint,1,opt,name=nominalConcurrencyShares"` // `limitResponse` indicates what to do with requests that can not be executed right now + // +required LimitResponse LimitResponse `json:"limitResponse,omitempty" protobuf:"bytes,2,opt,name=limitResponse"` // `lendablePercent` prescribes the fraction of the level's NominalCL that @@ -573,17 +593,17 @@ type LimitResponse struct { // "Reject" means that requests that can not be executed upon arrival // are rejected. // Required. + // +required // +unionDiscriminator - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:discriminator + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:modeDiscriminator Type LimitResponseType `json:"type" protobuf:"bytes,1,opt,name=type"` // `queuing` holds the configuration parameters for queuing. // This field may be non-empty only if `type` is `"Queue"`. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Queue")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:member("Reject")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Queue")=+k8s:required Queuing *QueuingConfiguration `json:"queuing,omitempty" protobuf:"bytes,2,opt,name=queuing"` } @@ -650,16 +670,20 @@ type PriorityLevelConfigurationStatus struct { type PriorityLevelConfigurationCondition struct { // `type` is the type of the condition. // Required. + // +required Type PriorityLevelConfigurationConditionType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"` // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. + // +optional Status ConditionStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"` // `lastTransitionTime` is the last time the condition transitioned from one status to another. + // +optional LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"` // `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + // +optional Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` // `message` is a human-readable message indicating details about last transition. + // +optional Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` } diff --git a/vendor/k8s.io/api/flowcontrol/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/flowcontrol/v1/types_swagger_doc_generated.go index b8cb436367..96b7a78e7d 100644 --- a/vendor/k8s.io/api/flowcontrol/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/flowcontrol/v1/types_swagger_doc_generated.go @@ -60,7 +60,7 @@ func (FlowSchema) SwaggerDoc() map[string]string { var map_FlowSchemaCondition = map[string]string{ "": "FlowSchemaCondition describes conditions for a FlowSchema.", "type": "`type` is the type of the condition. Required.", - "status": "`status` is the status of the condition. Can be True, False, Unknown. Required.", + "status": "`status` is the status of the condition. Should be specified and set to one of True, False, Unknown.", "lastTransitionTime": "`lastTransitionTime` is the last time the condition transitioned from one status to another.", "reason": "`reason` is a unique, one-word, CamelCase reason for the condition's last transition.", "message": "`message` is a human-readable message indicating details about last transition.", @@ -167,7 +167,7 @@ func (PriorityLevelConfiguration) SwaggerDoc() map[string]string { var map_PriorityLevelConfigurationCondition = map[string]string{ "": "PriorityLevelConfigurationCondition defines the condition of priority level.", "type": "`type` is the type of the condition. Required.", - "status": "`status` is the status of the condition. Can be True, False, Unknown. Required.", + "status": "`status` is the status of the condition. Should be specified and set to one of True, False, Unknown.", "lastTransitionTime": "`lastTransitionTime` is the last time the condition transitioned from one status to another.", "reason": "`reason` is a unique, one-word, CamelCase reason for the condition's last transition.", "message": "`message` is a human-readable message indicating details about last transition.", diff --git a/vendor/k8s.io/api/flowcontrol/v1beta1/generated.proto b/vendor/k8s.io/api/flowcontrol/v1beta1/generated.proto index 8a701a6100..c06ec1a2a6 100644 --- a/vendor/k8s.io/api/flowcontrol/v1beta1/generated.proto +++ b/vendor/k8s.io/api/flowcontrol/v1beta1/generated.proto @@ -67,11 +67,13 @@ message FlowDistinguisherMethod { // `type` is the type of flow distinguisher method // The supported types are "ByUser" and "ByNamespace". // Required. + // +required optional string type = 1; } // FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with // similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". +// +k8s:supportsSubresource="/status" message FlowSchema { // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -80,7 +82,7 @@ message FlowSchema { // `spec` is the specification of the desired behavior of a FlowSchema. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required optional FlowSchemaSpec spec = 2; // `status` is the current status of a FlowSchema. @@ -93,20 +95,24 @@ message FlowSchema { message FlowSchemaCondition { // `type` is the type of the condition. // Required. + // +required optional string type = 1; // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. + // +optional optional string status = 2; // `lastTransitionTime` is the last time the condition transitioned from one status to another. + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3; // `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + // +optional optional string reason = 4; // `message` is a human-readable message indicating details about last transition. + // +optional optional string message = 5; } @@ -126,6 +132,7 @@ message FlowSchemaSpec { // `priorityLevelConfiguration` should reference a PriorityLevelConfiguration in the cluster. If the reference cannot // be resolved, the FlowSchema will be ignored and marked as invalid in its status. // Required. + // +required optional PriorityLevelConfigurationReference priorityLevelConfiguration = 1; // `matchingPrecedence` is used to choose among the FlowSchemas that match a given request. The chosen @@ -163,6 +170,7 @@ message GroupSubject { // See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some // well-known group names. // Required. + // +required optional string name = 1; } @@ -176,17 +184,17 @@ message LimitResponse { // "Reject" means that requests that can not be executed upon arrival // are rejected. // Required. + // +required // +unionDiscriminator - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:discriminator + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:modeDiscriminator optional string type = 1; // `queuing` holds the configuration parameters for queuing. // This field may be non-empty only if `type` is `"Queue"`. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Queue")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:member("Reject")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Queue")=+k8s:required optional QueuingConfiguration queuing = 2; } @@ -214,6 +222,7 @@ message LimitedPriorityLevelConfiguration { optional int32 assuredConcurrencyShares = 1; // `limitResponse` indicates what to do with requests that can not be executed right now + // +required optional LimitResponse limitResponse = 2; // `lendablePercent` prescribes the fraction of the level's NominalCL that @@ -254,6 +263,7 @@ message NonResourcePolicyRule { // "*" matches all verbs. If it is present, it must be the only entry. // +listType=set // Required. + // +required repeated string verbs = 1; // `nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty. @@ -266,6 +276,7 @@ message NonResourcePolicyRule { // "*" matches all non-resource urls. if it is present, it must be the only entry. // +listType=set // Required. + // +required repeated string nonResourceURLs = 6; } @@ -279,6 +290,7 @@ message PolicyRulesWithSubjects { // A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request. // +listType=atomic // Required. + // +required repeated Subject subjects = 1; // `resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the @@ -296,6 +308,7 @@ message PolicyRulesWithSubjects { } // PriorityLevelConfiguration represents the configuration of a priority level. +// +k8s:supportsSubresource="/status" message PriorityLevelConfiguration { // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -304,7 +317,7 @@ message PriorityLevelConfiguration { // `spec` is the specification of the desired behavior of a "request-priority". // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required optional PriorityLevelConfigurationSpec spec = 2; // `status` is the current status of a "request-priority". @@ -317,20 +330,24 @@ message PriorityLevelConfiguration { message PriorityLevelConfigurationCondition { // `type` is the type of the condition. // Required. + // +required optional string type = 1; // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. + // +optional optional string status = 2; // `lastTransitionTime` is the last time the condition transitioned from one status to another. + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3; // `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + // +optional optional string reason = 4; // `message` is a human-readable message indicating details about last transition. + // +optional optional string message = 5; } @@ -349,6 +366,7 @@ message PriorityLevelConfigurationList { message PriorityLevelConfigurationReference { // `name` is the name of the priority level configuration being referenced // Required. + // +required optional string name = 1; } @@ -364,17 +382,17 @@ message PriorityLevelConfigurationSpec { // _are_ subject to limits and (b) some of the server's limited // capacity is made available exclusively to this priority level. // Required. + // +required // +unionDiscriminator - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:discriminator + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:modeDiscriminator optional string type = 1; // `limited` specifies how requests are handled for a Limited priority level. // This field must be non-empty if and only if `type` is `"Limited"`. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Limited")=+k8s:required optional LimitedPriorityLevelConfiguration limited = 2; // `exempt` specifies how requests are handled for an exempt priority level. @@ -383,9 +401,8 @@ message PriorityLevelConfigurationSpec { // If empty and `type` is `"Exempt"` then the default values // for `ExemptPriorityLevelConfiguration` apply. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Exempt")=+k8s:optional optional ExemptPriorityLevelConfiguration exempt = 3; } @@ -445,12 +462,14 @@ message ResourcePolicyRule { // "*" matches all verbs and, if present, must be the only entry. // +listType=set // Required. + // +required repeated string verbs = 1; // `apiGroups` is a list of matching API groups and may not be empty. // "*" matches all API groups and, if present, must be the only entry. // +listType=set // Required. + // +required repeated string apiGroups = 2; // `resources` is a list of matching resources (i.e., lowercase @@ -459,6 +478,7 @@ message ResourcePolicyRule { // "*" matches all resources and, if present, must be the only entry. // Required. // +listType=set + // +required repeated string resources = 3; // `clusterScope` indicates whether to match requests that do not @@ -486,10 +506,12 @@ message ResourcePolicyRule { message ServiceAccountSubject { // `namespace` is the namespace of matching ServiceAccount objects. // Required. + // +required optional string namespace = 1; // `name` is the name of matching ServiceAccount objects, or "*" to match regardless of name. // Required. + // +required optional string name = 2; } @@ -499,6 +521,7 @@ message ServiceAccountSubject { message Subject { // `kind` indicates which one of the other fields is non-empty. // Required + // +required // +unionDiscriminator optional string kind = 1; @@ -519,6 +542,7 @@ message Subject { message UserSubject { // `name` is the username that matches, or "*" to match all usernames. // Required. + // +required optional string name = 1; } diff --git a/vendor/k8s.io/api/flowcontrol/v1beta1/types.go b/vendor/k8s.io/api/flowcontrol/v1beta1/types.go index 0de6ea940e..39f869f6c6 100644 --- a/vendor/k8s.io/api/flowcontrol/v1beta1/types.go +++ b/vendor/k8s.io/api/flowcontrol/v1beta1/types.go @@ -111,15 +111,16 @@ const ( // FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with // similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". +// +k8s:supportsSubresource="/status" type FlowSchema struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // `spec` is the specification of the desired behavior of a FlowSchema. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required Spec FlowSchemaSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // `status` is the current status of a FlowSchema. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status @@ -133,7 +134,7 @@ type FlowSchema struct { // FlowSchemaList is a list of FlowSchema objects. type FlowSchemaList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // `metadata` is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -148,6 +149,7 @@ type FlowSchemaSpec struct { // `priorityLevelConfiguration` should reference a PriorityLevelConfiguration in the cluster. If the reference cannot // be resolved, the FlowSchema will be ignored and marked as invalid in its status. // Required. + // +required PriorityLevelConfiguration PriorityLevelConfigurationReference `json:"priorityLevelConfiguration" protobuf:"bytes,1,opt,name=priorityLevelConfiguration"` // `matchingPrecedence` is used to choose among the FlowSchemas that match a given request. The chosen // FlowSchema is among those with the numerically lowest (which we take to be logically highest) @@ -189,6 +191,7 @@ type FlowDistinguisherMethod struct { // `type` is the type of flow distinguisher method // The supported types are "ByUser" and "ByNamespace". // Required. + // +required Type FlowDistinguisherMethodType `json:"type" protobuf:"bytes,1,opt,name=type"` } @@ -196,6 +199,7 @@ type FlowDistinguisherMethod struct { type PriorityLevelConfigurationReference struct { // `name` is the name of the priority level configuration being referenced // Required. + // +required Name string `json:"name" protobuf:"bytes,1,opt,name=name"` } @@ -209,6 +213,7 @@ type PolicyRulesWithSubjects struct { // A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request. // +listType=atomic // Required. + // +required Subjects []Subject `json:"subjects" protobuf:"bytes,1,rep,name=subjects"` // `resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the // target resource. @@ -229,6 +234,7 @@ type PolicyRulesWithSubjects struct { type Subject struct { // `kind` indicates which one of the other fields is non-empty. // Required + // +required // +unionDiscriminator Kind SubjectKind `json:"kind" protobuf:"bytes,1,opt,name=kind"` // `user` matches based on username. @@ -256,6 +262,7 @@ const ( type UserSubject struct { // `name` is the username that matches, or "*" to match all usernames. // Required. + // +required Name string `json:"name" protobuf:"bytes,1,opt,name=name"` } @@ -265,6 +272,7 @@ type GroupSubject struct { // See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some // well-known group names. // Required. + // +required Name string `json:"name" protobuf:"bytes,1,opt,name=name"` } @@ -272,9 +280,11 @@ type GroupSubject struct { type ServiceAccountSubject struct { // `namespace` is the namespace of matching ServiceAccount objects. // Required. + // +required Namespace string `json:"namespace" protobuf:"bytes,1,opt,name=namespace"` // `name` is the name of matching ServiceAccount objects, or "*" to match regardless of name. // Required. + // +required Name string `json:"name" protobuf:"bytes,2,opt,name=name"` } @@ -292,12 +302,14 @@ type ResourcePolicyRule struct { // "*" matches all verbs and, if present, must be the only entry. // +listType=set // Required. + // +required Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` // `apiGroups` is a list of matching API groups and may not be empty. // "*" matches all API groups and, if present, must be the only entry. // +listType=set // Required. + // +required APIGroups []string `json:"apiGroups" protobuf:"bytes,2,rep,name=apiGroups"` // `resources` is a list of matching resources (i.e., lowercase @@ -306,6 +318,7 @@ type ResourcePolicyRule struct { // "*" matches all resources and, if present, must be the only entry. // Required. // +listType=set + // +required Resources []string `json:"resources" protobuf:"bytes,3,rep,name=resources"` // `clusterScope` indicates whether to match requests that do not @@ -337,6 +350,7 @@ type NonResourcePolicyRule struct { // "*" matches all verbs. If it is present, it must be the only entry. // +listType=set // Required. + // +required Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` // `nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty. // For example: @@ -348,6 +362,7 @@ type NonResourcePolicyRule struct { // "*" matches all non-resource urls. if it is present, it must be the only entry. // +listType=set // Required. + // +required NonResourceURLs []string `json:"nonResourceURLs" protobuf:"bytes,6,rep,name=nonResourceURLs"` } @@ -364,16 +379,20 @@ type FlowSchemaStatus struct { type FlowSchemaCondition struct { // `type` is the type of the condition. // Required. + // +required Type FlowSchemaConditionType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"` // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. + // +optional Status ConditionStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"` // `lastTransitionTime` is the last time the condition transitioned from one status to another. + // +optional LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"` // `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + // +optional Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` // `message` is a human-readable message indicating details about last transition. + // +optional Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` } @@ -387,15 +406,16 @@ type FlowSchemaConditionType string // +k8s:prerelease-lifecycle-gen:replacement=flowcontrol.apiserver.k8s.io,v1beta3,PriorityLevelConfiguration // PriorityLevelConfiguration represents the configuration of a priority level. +// +k8s:supportsSubresource="/status" type PriorityLevelConfiguration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // `spec` is the specification of the desired behavior of a "request-priority". // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required Spec PriorityLevelConfigurationSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // `status` is the current status of a "request-priority". // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status @@ -409,7 +429,7 @@ type PriorityLevelConfiguration struct { // PriorityLevelConfigurationList is a list of PriorityLevelConfiguration objects. type PriorityLevelConfigurationList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -430,17 +450,17 @@ type PriorityLevelConfigurationSpec struct { // _are_ subject to limits and (b) some of the server's limited // capacity is made available exclusively to this priority level. // Required. + // +required // +unionDiscriminator - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:discriminator + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:modeDiscriminator Type PriorityLevelEnablement `json:"type" protobuf:"bytes,1,opt,name=type"` // `limited` specifies how requests are handled for a Limited priority level. // This field must be non-empty if and only if `type` is `"Limited"`. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Limited")=+k8s:required Limited *LimitedPriorityLevelConfiguration `json:"limited,omitempty" protobuf:"bytes,2,opt,name=limited"` // `exempt` specifies how requests are handled for an exempt priority level. @@ -449,9 +469,8 @@ type PriorityLevelConfigurationSpec struct { // If empty and `type` is `"Exempt"` then the default values // for `ExemptPriorityLevelConfiguration` apply. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Exempt")=+k8s:optional Exempt *ExemptPriorityLevelConfiguration `json:"exempt,omitempty" protobuf:"bytes,3,opt,name=exempt"` } @@ -491,6 +510,7 @@ type LimitedPriorityLevelConfiguration struct { AssuredConcurrencyShares int32 `json:"assuredConcurrencyShares" protobuf:"varint,1,opt,name=assuredConcurrencyShares"` // `limitResponse` indicates what to do with requests that can not be executed right now + // +required LimitResponse LimitResponse `json:"limitResponse,omitempty" protobuf:"bytes,2,opt,name=limitResponse"` // `lendablePercent` prescribes the fraction of the level's NominalCL that @@ -570,17 +590,17 @@ type LimitResponse struct { // "Reject" means that requests that can not be executed upon arrival // are rejected. // Required. + // +required // +unionDiscriminator - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:discriminator + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:modeDiscriminator Type LimitResponseType `json:"type" protobuf:"bytes,1,opt,name=type"` // `queuing` holds the configuration parameters for queuing. // This field may be non-empty only if `type` is `"Queue"`. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Queue")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:member("Reject")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Queue")=+k8s:required Queuing *QueuingConfiguration `json:"queuing,omitempty" protobuf:"bytes,2,opt,name=queuing"` } @@ -645,16 +665,20 @@ type PriorityLevelConfigurationStatus struct { type PriorityLevelConfigurationCondition struct { // `type` is the type of the condition. // Required. + // +required Type PriorityLevelConfigurationConditionType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"` // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. + // +optional Status ConditionStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"` // `lastTransitionTime` is the last time the condition transitioned from one status to another. + // +optional LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"` // `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + // +optional Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` // `message` is a human-readable message indicating details about last transition. + // +optional Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` } diff --git a/vendor/k8s.io/api/flowcontrol/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/flowcontrol/v1beta1/types_swagger_doc_generated.go index d69bdac622..fee54a89bf 100644 --- a/vendor/k8s.io/api/flowcontrol/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/flowcontrol/v1beta1/types_swagger_doc_generated.go @@ -60,7 +60,7 @@ func (FlowSchema) SwaggerDoc() map[string]string { var map_FlowSchemaCondition = map[string]string{ "": "FlowSchemaCondition describes conditions for a FlowSchema.", "type": "`type` is the type of the condition. Required.", - "status": "`status` is the status of the condition. Can be True, False, Unknown. Required.", + "status": "`status` is the status of the condition. Should be specified and set to one of True, False, Unknown.", "lastTransitionTime": "`lastTransitionTime` is the last time the condition transitioned from one status to another.", "reason": "`reason` is a unique, one-word, CamelCase reason for the condition's last transition.", "message": "`message` is a human-readable message indicating details about last transition.", @@ -167,7 +167,7 @@ func (PriorityLevelConfiguration) SwaggerDoc() map[string]string { var map_PriorityLevelConfigurationCondition = map[string]string{ "": "PriorityLevelConfigurationCondition defines the condition of priority level.", "type": "`type` is the type of the condition. Required.", - "status": "`status` is the status of the condition. Can be True, False, Unknown. Required.", + "status": "`status` is the status of the condition. Should be specified and set to one of True, False, Unknown.", "lastTransitionTime": "`lastTransitionTime` is the last time the condition transitioned from one status to another.", "reason": "`reason` is a unique, one-word, CamelCase reason for the condition's last transition.", "message": "`message` is a human-readable message indicating details about last transition.", diff --git a/vendor/k8s.io/api/flowcontrol/v1beta2/generated.proto b/vendor/k8s.io/api/flowcontrol/v1beta2/generated.proto index 371b90a5cd..a80455d670 100644 --- a/vendor/k8s.io/api/flowcontrol/v1beta2/generated.proto +++ b/vendor/k8s.io/api/flowcontrol/v1beta2/generated.proto @@ -67,11 +67,13 @@ message FlowDistinguisherMethod { // `type` is the type of flow distinguisher method // The supported types are "ByUser" and "ByNamespace". // Required. + // +required optional string type = 1; } // FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with // similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". +// +k8s:supportsSubresource="/status" message FlowSchema { // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -80,7 +82,7 @@ message FlowSchema { // `spec` is the specification of the desired behavior of a FlowSchema. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required optional FlowSchemaSpec spec = 2; // `status` is the current status of a FlowSchema. @@ -93,20 +95,24 @@ message FlowSchema { message FlowSchemaCondition { // `type` is the type of the condition. // Required. + // +required optional string type = 1; // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. + // +optional optional string status = 2; // `lastTransitionTime` is the last time the condition transitioned from one status to another. + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3; // `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + // +optional optional string reason = 4; // `message` is a human-readable message indicating details about last transition. + // +optional optional string message = 5; } @@ -126,6 +132,7 @@ message FlowSchemaSpec { // `priorityLevelConfiguration` should reference a PriorityLevelConfiguration in the cluster. If the reference cannot // be resolved, the FlowSchema will be ignored and marked as invalid in its status. // Required. + // +required optional PriorityLevelConfigurationReference priorityLevelConfiguration = 1; // `matchingPrecedence` is used to choose among the FlowSchemas that match a given request. The chosen @@ -163,6 +170,7 @@ message GroupSubject { // See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some // well-known group names. // Required. + // +required optional string name = 1; } @@ -176,17 +184,17 @@ message LimitResponse { // "Reject" means that requests that can not be executed upon arrival // are rejected. // Required. + // +required // +unionDiscriminator - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:discriminator + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:modeDiscriminator optional string type = 1; // `queuing` holds the configuration parameters for queuing. // This field may be non-empty only if `type` is `"Queue"`. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Queue")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:member("Reject")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Queue")=+k8s:required optional QueuingConfiguration queuing = 2; } @@ -214,6 +222,7 @@ message LimitedPriorityLevelConfiguration { optional int32 assuredConcurrencyShares = 1; // `limitResponse` indicates what to do with requests that can not be executed right now + // +required optional LimitResponse limitResponse = 2; // `lendablePercent` prescribes the fraction of the level's NominalCL that @@ -254,6 +263,7 @@ message NonResourcePolicyRule { // "*" matches all verbs. If it is present, it must be the only entry. // +listType=set // Required. + // +required repeated string verbs = 1; // `nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty. @@ -266,6 +276,7 @@ message NonResourcePolicyRule { // "*" matches all non-resource urls. if it is present, it must be the only entry. // +listType=set // Required. + // +required repeated string nonResourceURLs = 6; } @@ -279,6 +290,7 @@ message PolicyRulesWithSubjects { // A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request. // +listType=atomic // Required. + // +required repeated Subject subjects = 1; // `resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the @@ -296,6 +308,7 @@ message PolicyRulesWithSubjects { } // PriorityLevelConfiguration represents the configuration of a priority level. +// +k8s:supportsSubresource="/status" message PriorityLevelConfiguration { // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -304,7 +317,7 @@ message PriorityLevelConfiguration { // `spec` is the specification of the desired behavior of a "request-priority". // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required optional PriorityLevelConfigurationSpec spec = 2; // `status` is the current status of a "request-priority". @@ -317,20 +330,24 @@ message PriorityLevelConfiguration { message PriorityLevelConfigurationCondition { // `type` is the type of the condition. // Required. + // +required optional string type = 1; // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. + // +optional optional string status = 2; // `lastTransitionTime` is the last time the condition transitioned from one status to another. + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3; // `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + // +optional optional string reason = 4; // `message` is a human-readable message indicating details about last transition. + // +optional optional string message = 5; } @@ -349,6 +366,7 @@ message PriorityLevelConfigurationList { message PriorityLevelConfigurationReference { // `name` is the name of the priority level configuration being referenced // Required. + // +required optional string name = 1; } @@ -364,17 +382,17 @@ message PriorityLevelConfigurationSpec { // _are_ subject to limits and (b) some of the server's limited // capacity is made available exclusively to this priority level. // Required. + // +required // +unionDiscriminator - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:discriminator + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:modeDiscriminator optional string type = 1; // `limited` specifies how requests are handled for a Limited priority level. // This field must be non-empty if and only if `type` is `"Limited"`. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Limited")=+k8s:required optional LimitedPriorityLevelConfiguration limited = 2; // `exempt` specifies how requests are handled for an exempt priority level. @@ -383,9 +401,8 @@ message PriorityLevelConfigurationSpec { // If empty and `type` is `"Exempt"` then the default values // for `ExemptPriorityLevelConfiguration` apply. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Exempt")=+k8s:optional optional ExemptPriorityLevelConfiguration exempt = 3; } @@ -445,12 +462,14 @@ message ResourcePolicyRule { // "*" matches all verbs and, if present, must be the only entry. // +listType=set // Required. + // +required repeated string verbs = 1; // `apiGroups` is a list of matching API groups and may not be empty. // "*" matches all API groups and, if present, must be the only entry. // +listType=set // Required. + // +required repeated string apiGroups = 2; // `resources` is a list of matching resources (i.e., lowercase @@ -459,6 +478,7 @@ message ResourcePolicyRule { // "*" matches all resources and, if present, must be the only entry. // Required. // +listType=set + // +required repeated string resources = 3; // `clusterScope` indicates whether to match requests that do not @@ -486,10 +506,12 @@ message ResourcePolicyRule { message ServiceAccountSubject { // `namespace` is the namespace of matching ServiceAccount objects. // Required. + // +required optional string namespace = 1; // `name` is the name of matching ServiceAccount objects, or "*" to match regardless of name. // Required. + // +required optional string name = 2; } @@ -499,6 +521,7 @@ message ServiceAccountSubject { message Subject { // `kind` indicates which one of the other fields is non-empty. // Required + // +required // +unionDiscriminator optional string kind = 1; @@ -519,6 +542,7 @@ message Subject { message UserSubject { // `name` is the username that matches, or "*" to match all usernames. // Required. + // +required optional string name = 1; } diff --git a/vendor/k8s.io/api/flowcontrol/v1beta2/types.go b/vendor/k8s.io/api/flowcontrol/v1beta2/types.go index 2f82a6823b..38ab2a2a7b 100644 --- a/vendor/k8s.io/api/flowcontrol/v1beta2/types.go +++ b/vendor/k8s.io/api/flowcontrol/v1beta2/types.go @@ -111,15 +111,16 @@ const ( // FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with // similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". +// +k8s:supportsSubresource="/status" type FlowSchema struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // `spec` is the specification of the desired behavior of a FlowSchema. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required Spec FlowSchemaSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // `status` is the current status of a FlowSchema. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status @@ -133,7 +134,7 @@ type FlowSchema struct { // FlowSchemaList is a list of FlowSchema objects. type FlowSchemaList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // `metadata` is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -148,6 +149,7 @@ type FlowSchemaSpec struct { // `priorityLevelConfiguration` should reference a PriorityLevelConfiguration in the cluster. If the reference cannot // be resolved, the FlowSchema will be ignored and marked as invalid in its status. // Required. + // +required PriorityLevelConfiguration PriorityLevelConfigurationReference `json:"priorityLevelConfiguration" protobuf:"bytes,1,opt,name=priorityLevelConfiguration"` // `matchingPrecedence` is used to choose among the FlowSchemas that match a given request. The chosen // FlowSchema is among those with the numerically lowest (which we take to be logically highest) @@ -189,6 +191,7 @@ type FlowDistinguisherMethod struct { // `type` is the type of flow distinguisher method // The supported types are "ByUser" and "ByNamespace". // Required. + // +required Type FlowDistinguisherMethodType `json:"type" protobuf:"bytes,1,opt,name=type"` } @@ -196,6 +199,7 @@ type FlowDistinguisherMethod struct { type PriorityLevelConfigurationReference struct { // `name` is the name of the priority level configuration being referenced // Required. + // +required Name string `json:"name" protobuf:"bytes,1,opt,name=name"` } @@ -209,6 +213,7 @@ type PolicyRulesWithSubjects struct { // A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request. // +listType=atomic // Required. + // +required Subjects []Subject `json:"subjects" protobuf:"bytes,1,rep,name=subjects"` // `resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the // target resource. @@ -229,6 +234,7 @@ type PolicyRulesWithSubjects struct { type Subject struct { // `kind` indicates which one of the other fields is non-empty. // Required + // +required // +unionDiscriminator Kind SubjectKind `json:"kind" protobuf:"bytes,1,opt,name=kind"` // `user` matches based on username. @@ -256,6 +262,7 @@ const ( type UserSubject struct { // `name` is the username that matches, or "*" to match all usernames. // Required. + // +required Name string `json:"name" protobuf:"bytes,1,opt,name=name"` } @@ -265,6 +272,7 @@ type GroupSubject struct { // See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some // well-known group names. // Required. + // +required Name string `json:"name" protobuf:"bytes,1,opt,name=name"` } @@ -272,9 +280,11 @@ type GroupSubject struct { type ServiceAccountSubject struct { // `namespace` is the namespace of matching ServiceAccount objects. // Required. + // +required Namespace string `json:"namespace" protobuf:"bytes,1,opt,name=namespace"` // `name` is the name of matching ServiceAccount objects, or "*" to match regardless of name. // Required. + // +required Name string `json:"name" protobuf:"bytes,2,opt,name=name"` } @@ -292,12 +302,14 @@ type ResourcePolicyRule struct { // "*" matches all verbs and, if present, must be the only entry. // +listType=set // Required. + // +required Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` // `apiGroups` is a list of matching API groups and may not be empty. // "*" matches all API groups and, if present, must be the only entry. // +listType=set // Required. + // +required APIGroups []string `json:"apiGroups" protobuf:"bytes,2,rep,name=apiGroups"` // `resources` is a list of matching resources (i.e., lowercase @@ -306,6 +318,7 @@ type ResourcePolicyRule struct { // "*" matches all resources and, if present, must be the only entry. // Required. // +listType=set + // +required Resources []string `json:"resources" protobuf:"bytes,3,rep,name=resources"` // `clusterScope` indicates whether to match requests that do not @@ -337,6 +350,7 @@ type NonResourcePolicyRule struct { // "*" matches all verbs. If it is present, it must be the only entry. // +listType=set // Required. + // +required Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` // `nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty. // For example: @@ -348,6 +362,7 @@ type NonResourcePolicyRule struct { // "*" matches all non-resource urls. if it is present, it must be the only entry. // +listType=set // Required. + // +required NonResourceURLs []string `json:"nonResourceURLs" protobuf:"bytes,6,rep,name=nonResourceURLs"` } @@ -364,16 +379,20 @@ type FlowSchemaStatus struct { type FlowSchemaCondition struct { // `type` is the type of the condition. // Required. + // +required Type FlowSchemaConditionType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"` // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. + // +optional Status ConditionStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"` // `lastTransitionTime` is the last time the condition transitioned from one status to another. + // +optional LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"` // `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + // +optional Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` // `message` is a human-readable message indicating details about last transition. + // +optional Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` } @@ -387,15 +406,16 @@ type FlowSchemaConditionType string // +k8s:prerelease-lifecycle-gen:replacement=flowcontrol.apiserver.k8s.io,v1beta3,PriorityLevelConfiguration // PriorityLevelConfiguration represents the configuration of a priority level. +// +k8s:supportsSubresource="/status" type PriorityLevelConfiguration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // `spec` is the specification of the desired behavior of a "request-priority". // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required Spec PriorityLevelConfigurationSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // `status` is the current status of a "request-priority". // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status @@ -409,7 +429,7 @@ type PriorityLevelConfiguration struct { // PriorityLevelConfigurationList is a list of PriorityLevelConfiguration objects. type PriorityLevelConfigurationList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -430,17 +450,17 @@ type PriorityLevelConfigurationSpec struct { // _are_ subject to limits and (b) some of the server's limited // capacity is made available exclusively to this priority level. // Required. + // +required // +unionDiscriminator - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:discriminator + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:modeDiscriminator Type PriorityLevelEnablement `json:"type" protobuf:"bytes,1,opt,name=type"` // `limited` specifies how requests are handled for a Limited priority level. // This field must be non-empty if and only if `type` is `"Limited"`. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Limited")=+k8s:required Limited *LimitedPriorityLevelConfiguration `json:"limited,omitempty" protobuf:"bytes,2,opt,name=limited"` // `exempt` specifies how requests are handled for an exempt priority level. @@ -449,9 +469,8 @@ type PriorityLevelConfigurationSpec struct { // If empty and `type` is `"Exempt"` then the default values // for `ExemptPriorityLevelConfiguration` apply. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Exempt")=+k8s:optional Exempt *ExemptPriorityLevelConfiguration `json:"exempt,omitempty" protobuf:"bytes,3,opt,name=exempt"` } @@ -491,6 +510,7 @@ type LimitedPriorityLevelConfiguration struct { AssuredConcurrencyShares int32 `json:"assuredConcurrencyShares" protobuf:"varint,1,opt,name=assuredConcurrencyShares"` // `limitResponse` indicates what to do with requests that can not be executed right now + // +required LimitResponse LimitResponse `json:"limitResponse,omitempty" protobuf:"bytes,2,opt,name=limitResponse"` // `lendablePercent` prescribes the fraction of the level's NominalCL that @@ -570,17 +590,17 @@ type LimitResponse struct { // "Reject" means that requests that can not be executed upon arrival // are rejected. // Required. + // +required // +unionDiscriminator - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:discriminator + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:modeDiscriminator Type LimitResponseType `json:"type" protobuf:"bytes,1,opt,name=type"` // `queuing` holds the configuration parameters for queuing. // This field may be non-empty only if `type` is `"Queue"`. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Queue")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:member("Reject")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Queue")=+k8s:required Queuing *QueuingConfiguration `json:"queuing,omitempty" protobuf:"bytes,2,opt,name=queuing"` } @@ -645,16 +665,20 @@ type PriorityLevelConfigurationStatus struct { type PriorityLevelConfigurationCondition struct { // `type` is the type of the condition. // Required. + // +required Type PriorityLevelConfigurationConditionType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"` // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. + // +optional Status ConditionStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"` // `lastTransitionTime` is the last time the condition transitioned from one status to another. + // +optional LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"` // `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + // +optional Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` // `message` is a human-readable message indicating details about last transition. + // +optional Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` } diff --git a/vendor/k8s.io/api/flowcontrol/v1beta2/types_swagger_doc_generated.go b/vendor/k8s.io/api/flowcontrol/v1beta2/types_swagger_doc_generated.go index 921122731a..bf12ce5e0b 100644 --- a/vendor/k8s.io/api/flowcontrol/v1beta2/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/flowcontrol/v1beta2/types_swagger_doc_generated.go @@ -60,7 +60,7 @@ func (FlowSchema) SwaggerDoc() map[string]string { var map_FlowSchemaCondition = map[string]string{ "": "FlowSchemaCondition describes conditions for a FlowSchema.", "type": "`type` is the type of the condition. Required.", - "status": "`status` is the status of the condition. Can be True, False, Unknown. Required.", + "status": "`status` is the status of the condition. Should be specified and set to one of True, False, Unknown.", "lastTransitionTime": "`lastTransitionTime` is the last time the condition transitioned from one status to another.", "reason": "`reason` is a unique, one-word, CamelCase reason for the condition's last transition.", "message": "`message` is a human-readable message indicating details about last transition.", @@ -167,7 +167,7 @@ func (PriorityLevelConfiguration) SwaggerDoc() map[string]string { var map_PriorityLevelConfigurationCondition = map[string]string{ "": "PriorityLevelConfigurationCondition defines the condition of priority level.", "type": "`type` is the type of the condition. Required.", - "status": "`status` is the status of the condition. Can be True, False, Unknown. Required.", + "status": "`status` is the status of the condition. Should be specified and set to one of True, False, Unknown.", "lastTransitionTime": "`lastTransitionTime` is the last time the condition transitioned from one status to another.", "reason": "`reason` is a unique, one-word, CamelCase reason for the condition's last transition.", "message": "`message` is a human-readable message indicating details about last transition.", diff --git a/vendor/k8s.io/api/flowcontrol/v1beta3/generated.proto b/vendor/k8s.io/api/flowcontrol/v1beta3/generated.proto index 7e11de2a28..68344b79b6 100644 --- a/vendor/k8s.io/api/flowcontrol/v1beta3/generated.proto +++ b/vendor/k8s.io/api/flowcontrol/v1beta3/generated.proto @@ -67,11 +67,13 @@ message FlowDistinguisherMethod { // `type` is the type of flow distinguisher method // The supported types are "ByUser" and "ByNamespace". // Required. + // +required optional string type = 1; } // FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with // similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". +// +k8s:supportsSubresource="/status" message FlowSchema { // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -80,7 +82,7 @@ message FlowSchema { // `spec` is the specification of the desired behavior of a FlowSchema. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required optional FlowSchemaSpec spec = 2; // `status` is the current status of a FlowSchema. @@ -93,20 +95,24 @@ message FlowSchema { message FlowSchemaCondition { // `type` is the type of the condition. // Required. + // +required optional string type = 1; // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. + // +optional optional string status = 2; // `lastTransitionTime` is the last time the condition transitioned from one status to another. + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3; // `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + // +optional optional string reason = 4; // `message` is a human-readable message indicating details about last transition. + // +optional optional string message = 5; } @@ -126,6 +132,7 @@ message FlowSchemaSpec { // `priorityLevelConfiguration` should reference a PriorityLevelConfiguration in the cluster. If the reference cannot // be resolved, the FlowSchema will be ignored and marked as invalid in its status. // Required. + // +required optional PriorityLevelConfigurationReference priorityLevelConfiguration = 1; // `matchingPrecedence` is used to choose among the FlowSchemas that match a given request. The chosen @@ -165,6 +172,7 @@ message GroupSubject { // See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some // well-known group names. // Required. + // +required optional string name = 1; } @@ -178,17 +186,17 @@ message LimitResponse { // "Reject" means that requests that can not be executed upon arrival // are rejected. // Required. + // +required // +unionDiscriminator - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:discriminator + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:modeDiscriminator optional string type = 1; // `queuing` holds the configuration parameters for queuing. // This field may be non-empty only if `type` is `"Queue"`. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Queue")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:member("Reject")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Queue")=+k8s:required optional QueuingConfiguration queuing = 2; } @@ -216,6 +224,7 @@ message LimitedPriorityLevelConfiguration { optional int32 nominalConcurrencyShares = 1; // `limitResponse` indicates what to do with requests that can not be executed right now + // +required optional LimitResponse limitResponse = 2; // `lendablePercent` prescribes the fraction of the level's NominalCL that @@ -256,6 +265,7 @@ message NonResourcePolicyRule { // "*" matches all verbs. If it is present, it must be the only entry. // +listType=set // Required. + // +required repeated string verbs = 1; // `nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty. @@ -268,6 +278,7 @@ message NonResourcePolicyRule { // "*" matches all non-resource urls. if it is present, it must be the only entry. // +listType=set // Required. + // +required repeated string nonResourceURLs = 6; } @@ -281,6 +292,7 @@ message PolicyRulesWithSubjects { // A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request. // +listType=atomic // Required. + // +required repeated Subject subjects = 1; // `resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the @@ -298,6 +310,7 @@ message PolicyRulesWithSubjects { } // PriorityLevelConfiguration represents the configuration of a priority level. +// +k8s:supportsSubresource="/status" message PriorityLevelConfiguration { // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -306,7 +319,7 @@ message PriorityLevelConfiguration { // `spec` is the specification of the desired behavior of a "request-priority". // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required optional PriorityLevelConfigurationSpec spec = 2; // `status` is the current status of a "request-priority". @@ -319,20 +332,24 @@ message PriorityLevelConfiguration { message PriorityLevelConfigurationCondition { // `type` is the type of the condition. // Required. + // +required optional string type = 1; // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. + // +optional optional string status = 2; // `lastTransitionTime` is the last time the condition transitioned from one status to another. + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3; // `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + // +optional optional string reason = 4; // `message` is a human-readable message indicating details about last transition. + // +optional optional string message = 5; } @@ -351,6 +368,7 @@ message PriorityLevelConfigurationList { message PriorityLevelConfigurationReference { // `name` is the name of the priority level configuration being referenced // Required. + // +required optional string name = 1; } @@ -366,17 +384,17 @@ message PriorityLevelConfigurationSpec { // _are_ subject to limits and (b) some of the server's limited // capacity is made available exclusively to this priority level. // Required. + // +required // +unionDiscriminator - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:discriminator + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:modeDiscriminator optional string type = 1; // `limited` specifies how requests are handled for a Limited priority level. // This field must be non-empty if and only if `type` is `"Limited"`. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Limited")=+k8s:required optional LimitedPriorityLevelConfiguration limited = 2; // `exempt` specifies how requests are handled for an exempt priority level. @@ -385,9 +403,8 @@ message PriorityLevelConfigurationSpec { // If empty and `type` is `"Exempt"` then the default values // for `ExemptPriorityLevelConfiguration` apply. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Exempt")=+k8s:optional optional ExemptPriorityLevelConfiguration exempt = 3; } @@ -449,12 +466,14 @@ message ResourcePolicyRule { // "*" matches all verbs and, if present, must be the only entry. // +listType=set // Required. + // +required repeated string verbs = 1; // `apiGroups` is a list of matching API groups and may not be empty. // "*" matches all API groups and, if present, must be the only entry. // +listType=set // Required. + // +required repeated string apiGroups = 2; // `resources` is a list of matching resources (i.e., lowercase @@ -463,6 +482,7 @@ message ResourcePolicyRule { // "*" matches all resources and, if present, must be the only entry. // Required. // +listType=set + // +required repeated string resources = 3; // `clusterScope` indicates whether to match requests that do not @@ -490,10 +510,12 @@ message ResourcePolicyRule { message ServiceAccountSubject { // `namespace` is the namespace of matching ServiceAccount objects. // Required. + // +required optional string namespace = 1; // `name` is the name of matching ServiceAccount objects, or "*" to match regardless of name. // Required. + // +required optional string name = 2; } @@ -503,6 +525,7 @@ message ServiceAccountSubject { message Subject { // `kind` indicates which one of the other fields is non-empty. // Required + // +required // +unionDiscriminator optional string kind = 1; @@ -523,6 +546,7 @@ message Subject { message UserSubject { // `name` is the username that matches, or "*" to match all usernames. // Required. + // +required optional string name = 1; } diff --git a/vendor/k8s.io/api/flowcontrol/v1beta3/types.go b/vendor/k8s.io/api/flowcontrol/v1beta3/types.go index 26b67629ce..cbebca3574 100644 --- a/vendor/k8s.io/api/flowcontrol/v1beta3/types.go +++ b/vendor/k8s.io/api/flowcontrol/v1beta3/types.go @@ -125,15 +125,16 @@ const ( // FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with // similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". +// +k8s:supportsSubresource="/status" type FlowSchema struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // `spec` is the specification of the desired behavior of a FlowSchema. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required Spec FlowSchemaSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // `status` is the current status of a FlowSchema. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status @@ -147,7 +148,7 @@ type FlowSchema struct { // FlowSchemaList is a list of FlowSchema objects. type FlowSchemaList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // `metadata` is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -162,6 +163,7 @@ type FlowSchemaSpec struct { // `priorityLevelConfiguration` should reference a PriorityLevelConfiguration in the cluster. If the reference cannot // be resolved, the FlowSchema will be ignored and marked as invalid in its status. // Required. + // +required PriorityLevelConfiguration PriorityLevelConfigurationReference `json:"priorityLevelConfiguration" protobuf:"bytes,1,opt,name=priorityLevelConfiguration"` // `matchingPrecedence` is used to choose among the FlowSchemas that match a given request. The chosen // FlowSchema is among those with the numerically lowest (which we take to be logically highest) @@ -203,6 +205,7 @@ type FlowDistinguisherMethod struct { // `type` is the type of flow distinguisher method // The supported types are "ByUser" and "ByNamespace". // Required. + // +required Type FlowDistinguisherMethodType `json:"type" protobuf:"bytes,1,opt,name=type"` } @@ -210,6 +213,7 @@ type FlowDistinguisherMethod struct { type PriorityLevelConfigurationReference struct { // `name` is the name of the priority level configuration being referenced // Required. + // +required Name string `json:"name" protobuf:"bytes,1,opt,name=name"` } @@ -223,6 +227,7 @@ type PolicyRulesWithSubjects struct { // A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request. // +listType=atomic // Required. + // +required Subjects []Subject `json:"subjects" protobuf:"bytes,1,rep,name=subjects"` // `resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the // target resource. @@ -243,6 +248,7 @@ type PolicyRulesWithSubjects struct { type Subject struct { // `kind` indicates which one of the other fields is non-empty. // Required + // +required // +unionDiscriminator Kind SubjectKind `json:"kind" protobuf:"bytes,1,opt,name=kind"` // `user` matches based on username. @@ -270,6 +276,7 @@ const ( type UserSubject struct { // `name` is the username that matches, or "*" to match all usernames. // Required. + // +required Name string `json:"name" protobuf:"bytes,1,opt,name=name"` } @@ -279,6 +286,7 @@ type GroupSubject struct { // See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some // well-known group names. // Required. + // +required Name string `json:"name" protobuf:"bytes,1,opt,name=name"` } @@ -286,9 +294,11 @@ type GroupSubject struct { type ServiceAccountSubject struct { // `namespace` is the namespace of matching ServiceAccount objects. // Required. + // +required Namespace string `json:"namespace" protobuf:"bytes,1,opt,name=namespace"` // `name` is the name of matching ServiceAccount objects, or "*" to match regardless of name. // Required. + // +required Name string `json:"name" protobuf:"bytes,2,opt,name=name"` } @@ -306,12 +316,14 @@ type ResourcePolicyRule struct { // "*" matches all verbs and, if present, must be the only entry. // +listType=set // Required. + // +required Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` // `apiGroups` is a list of matching API groups and may not be empty. // "*" matches all API groups and, if present, must be the only entry. // +listType=set // Required. + // +required APIGroups []string `json:"apiGroups" protobuf:"bytes,2,rep,name=apiGroups"` // `resources` is a list of matching resources (i.e., lowercase @@ -320,6 +332,7 @@ type ResourcePolicyRule struct { // "*" matches all resources and, if present, must be the only entry. // Required. // +listType=set + // +required Resources []string `json:"resources" protobuf:"bytes,3,rep,name=resources"` // `clusterScope` indicates whether to match requests that do not @@ -351,6 +364,7 @@ type NonResourcePolicyRule struct { // "*" matches all verbs. If it is present, it must be the only entry. // +listType=set // Required. + // +required Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` // `nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty. // For example: @@ -362,6 +376,7 @@ type NonResourcePolicyRule struct { // "*" matches all non-resource urls. if it is present, it must be the only entry. // +listType=set // Required. + // +required NonResourceURLs []string `json:"nonResourceURLs" protobuf:"bytes,6,rep,name=nonResourceURLs"` } @@ -380,16 +395,20 @@ type FlowSchemaStatus struct { type FlowSchemaCondition struct { // `type` is the type of the condition. // Required. + // +required Type FlowSchemaConditionType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"` // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. + // +optional Status ConditionStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"` // `lastTransitionTime` is the last time the condition transitioned from one status to another. + // +optional LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"` // `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + // +optional Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` // `message` is a human-readable message indicating details about last transition. + // +optional Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` } @@ -403,15 +422,16 @@ type FlowSchemaConditionType string // +k8s:prerelease-lifecycle-gen:replacement=flowcontrol.apiserver.k8s.io,v1,PriorityLevelConfiguration // PriorityLevelConfiguration represents the configuration of a priority level. +// +k8s:supportsSubresource="/status" type PriorityLevelConfiguration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // `spec` is the specification of the desired behavior of a "request-priority". // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required Spec PriorityLevelConfigurationSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // `status` is the current status of a "request-priority". // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status @@ -425,7 +445,7 @@ type PriorityLevelConfiguration struct { // PriorityLevelConfigurationList is a list of PriorityLevelConfiguration objects. type PriorityLevelConfigurationList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -446,17 +466,17 @@ type PriorityLevelConfigurationSpec struct { // _are_ subject to limits and (b) some of the server's limited // capacity is made available exclusively to this priority level. // Required. + // +required // +unionDiscriminator - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:discriminator + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:modeDiscriminator Type PriorityLevelEnablement `json:"type" protobuf:"bytes,1,opt,name=type"` // `limited` specifies how requests are handled for a Limited priority level. // This field must be non-empty if and only if `type` is `"Limited"`. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Limited")=+k8s:required Limited *LimitedPriorityLevelConfiguration `json:"limited,omitempty" protobuf:"bytes,2,opt,name=limited"` // `exempt` specifies how requests are handled for an exempt priority level. @@ -465,9 +485,8 @@ type PriorityLevelConfigurationSpec struct { // If empty and `type` is `"Exempt"` then the default values // for `ExemptPriorityLevelConfiguration` apply. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Exempt")=+k8s:optional Exempt *ExemptPriorityLevelConfiguration `json:"exempt,omitempty" protobuf:"bytes,3,opt,name=exempt"` } @@ -507,6 +526,7 @@ type LimitedPriorityLevelConfiguration struct { NominalConcurrencyShares int32 `json:"nominalConcurrencyShares" protobuf:"varint,1,opt,name=nominalConcurrencyShares"` // `limitResponse` indicates what to do with requests that can not be executed right now + // +required LimitResponse LimitResponse `json:"limitResponse,omitempty" protobuf:"bytes,2,opt,name=limitResponse"` // `lendablePercent` prescribes the fraction of the level's NominalCL that @@ -586,17 +606,17 @@ type LimitResponse struct { // "Reject" means that requests that can not be executed upon arrival // are rejected. // Required. + // +required // +unionDiscriminator - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:discriminator + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:modeDiscriminator Type LimitResponseType `json:"type" protobuf:"bytes,1,opt,name=type"` // `queuing` holds the configuration parameters for queuing. // This field may be non-empty only if `type` is `"Queue"`. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:member("Queue")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:member("Reject")=+k8s:forbidden + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:ifMode("Queue")=+k8s:required Queuing *QueuingConfiguration `json:"queuing,omitempty" protobuf:"bytes,2,opt,name=queuing"` } @@ -663,16 +683,20 @@ type PriorityLevelConfigurationStatus struct { type PriorityLevelConfigurationCondition struct { // `type` is the type of the condition. // Required. + // +required Type PriorityLevelConfigurationConditionType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"` // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. + // +optional Status ConditionStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"` // `lastTransitionTime` is the last time the condition transitioned from one status to another. + // +optional LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"` // `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + // +optional Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` // `message` is a human-readable message indicating details about last transition. + // +optional Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` } diff --git a/vendor/k8s.io/api/flowcontrol/v1beta3/types_swagger_doc_generated.go b/vendor/k8s.io/api/flowcontrol/v1beta3/types_swagger_doc_generated.go index fa76112a72..c799e5d8d7 100644 --- a/vendor/k8s.io/api/flowcontrol/v1beta3/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/flowcontrol/v1beta3/types_swagger_doc_generated.go @@ -60,7 +60,7 @@ func (FlowSchema) SwaggerDoc() map[string]string { var map_FlowSchemaCondition = map[string]string{ "": "FlowSchemaCondition describes conditions for a FlowSchema.", "type": "`type` is the type of the condition. Required.", - "status": "`status` is the status of the condition. Can be True, False, Unknown. Required.", + "status": "`status` is the status of the condition. Should be specified and set to one of True, False, Unknown.", "lastTransitionTime": "`lastTransitionTime` is the last time the condition transitioned from one status to another.", "reason": "`reason` is a unique, one-word, CamelCase reason for the condition's last transition.", "message": "`message` is a human-readable message indicating details about last transition.", @@ -167,7 +167,7 @@ func (PriorityLevelConfiguration) SwaggerDoc() map[string]string { var map_PriorityLevelConfigurationCondition = map[string]string{ "": "PriorityLevelConfigurationCondition defines the condition of priority level.", "type": "`type` is the type of the condition. Required.", - "status": "`status` is the status of the condition. Can be True, False, Unknown. Required.", + "status": "`status` is the status of the condition. Should be specified and set to one of True, False, Unknown.", "lastTransitionTime": "`lastTransitionTime` is the last time the condition transitioned from one status to another.", "reason": "`reason` is a unique, one-word, CamelCase reason for the condition's last transition.", "message": "`message` is a human-readable message indicating details about last transition.", diff --git a/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.proto b/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.proto index 03b1ac45c0..b9cd53b108 100644 --- a/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.proto +++ b/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.proto @@ -29,59 +29,61 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; option go_package = "k8s.io/api/imagepolicy/v1alpha1"; // ImageReview checks if the set of images in a pod are allowed. +// +k8s:supportsSubresource="/status" message ImageReview { - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Spec holds information about the pod being evaluated + // spec holds information about the pod being evaluated // +optional optional ImageReviewSpec spec = 2; - // Status is filled in by the backend and indicates whether the pod should be allowed. + // status is filled in by the backend and indicates whether the pod should be allowed. // +optional optional ImageReviewStatus status = 3; } // ImageReviewContainerSpec is a description of a container within the pod creation request. message ImageReviewContainerSpec { - // This can be in the form image:tag or image@SHA:012345679abcdef. + // image can be in the form image:tag or image@SHA:012345679abcdef. // +optional optional string image = 1; } // ImageReviewSpec is a description of the pod creation request. message ImageReviewSpec { - // Containers is a list of a subset of the information in each container of the Pod being created. + // containers is a list of a subset of the information in each container of the Pod being created. // +optional // +listType=atomic repeated ImageReviewContainerSpec containers = 1; - // Annotations is a list of key-value pairs extracted from the Pod's annotations. + // annotations is a list of key-value pairs extracted from the Pod's annotations. // It only includes keys which match the pattern `*.image-policy.k8s.io/*`. // It is up to each webhook backend to determine how to interpret these annotations, if at all. // +optional map annotations = 2; - // Namespace is the namespace the pod is being created in. + // namespace is the namespace the pod is being created in. // +optional optional string namespace = 3; } // ImageReviewStatus is the result of the review for the pod creation request. message ImageReviewStatus { - // Allowed indicates that all images were allowed to be run. + // allowed indicates that all images were allowed to be run. // +optional optional bool allowed = 1; - // Reason should be empty unless Allowed is false in which case it + // reason should be empty unless Allowed is false in which case it // may contain a short description of what is wrong. Kubernetes // may truncate excessively long errors when displaying to the user. // +optional optional string reason = 2; - // AuditAnnotations will be added to the attributes object of the + // auditAnnotations will be added to the attributes object of the // admission controller request using 'AddAnnotation'. The keys should // be prefix-less (i.e., the admission controller will add an // appropriate prefix). diff --git a/vendor/k8s.io/api/imagepolicy/v1alpha1/types.go b/vendor/k8s.io/api/imagepolicy/v1alpha1/types.go index cc8f4cf89f..9807c17534 100644 --- a/vendor/k8s.io/api/imagepolicy/v1alpha1/types.go +++ b/vendor/k8s.io/api/imagepolicy/v1alpha1/types.go @@ -26,41 +26,43 @@ import ( // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // ImageReview checks if the set of images in a pod are allowed. +// +k8s:supportsSubresource="/status" type ImageReview struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Spec holds information about the pod being evaluated + // spec holds information about the pod being evaluated // +optional Spec ImageReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - // Status is filled in by the backend and indicates whether the pod should be allowed. + // status is filled in by the backend and indicates whether the pod should be allowed. // +optional Status ImageReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } // ImageReviewSpec is a description of the pod creation request. type ImageReviewSpec struct { - // Containers is a list of a subset of the information in each container of the Pod being created. + // containers is a list of a subset of the information in each container of the Pod being created. // +optional // +listType=atomic Containers []ImageReviewContainerSpec `json:"containers,omitempty" protobuf:"bytes,1,rep,name=containers"` - // Annotations is a list of key-value pairs extracted from the Pod's annotations. + // annotations is a list of key-value pairs extracted from the Pod's annotations. // It only includes keys which match the pattern `*.image-policy.k8s.io/*`. // It is up to each webhook backend to determine how to interpret these annotations, if at all. // +optional Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,2,rep,name=annotations"` - // Namespace is the namespace the pod is being created in. + // namespace is the namespace the pod is being created in. // +optional Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"` } // ImageReviewContainerSpec is a description of a container within the pod creation request. type ImageReviewContainerSpec struct { - // This can be in the form image:tag or image@SHA:012345679abcdef. + // image can be in the form image:tag or image@SHA:012345679abcdef. // +optional Image string `json:"image,omitempty" protobuf:"bytes,1,opt,name=image"` // In future, we may add command line overrides, exec health check command lines, and so on. @@ -68,15 +70,15 @@ type ImageReviewContainerSpec struct { // ImageReviewStatus is the result of the review for the pod creation request. type ImageReviewStatus struct { - // Allowed indicates that all images were allowed to be run. + // allowed indicates that all images were allowed to be run. // +optional Allowed bool `json:"allowed" protobuf:"varint,1,opt,name=allowed"` - // Reason should be empty unless Allowed is false in which case it + // reason should be empty unless Allowed is false in which case it // may contain a short description of what is wrong. Kubernetes // may truncate excessively long errors when displaying to the user. // +optional Reason string `json:"reason,omitempty" protobuf:"bytes,2,opt,name=reason"` - // AuditAnnotations will be added to the attributes object of the + // auditAnnotations will be added to the attributes object of the // admission controller request using 'AddAnnotation'. The keys should // be prefix-less (i.e., the admission controller will add an // appropriate prefix). diff --git a/vendor/k8s.io/api/imagepolicy/v1alpha1/types_swagger_doc_generated.go b/vendor/k8s.io/api/imagepolicy/v1alpha1/types_swagger_doc_generated.go index dadf95e1d5..802b79ba7a 100644 --- a/vendor/k8s.io/api/imagepolicy/v1alpha1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/imagepolicy/v1alpha1/types_swagger_doc_generated.go @@ -29,9 +29,9 @@ package v1alpha1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_ImageReview = map[string]string{ "": "ImageReview checks if the set of images in a pod are allowed.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "Spec holds information about the pod being evaluated", - "status": "Status is filled in by the backend and indicates whether the pod should be allowed.", + "metadata": "metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec holds information about the pod being evaluated", + "status": "status is filled in by the backend and indicates whether the pod should be allowed.", } func (ImageReview) SwaggerDoc() map[string]string { @@ -40,7 +40,7 @@ func (ImageReview) SwaggerDoc() map[string]string { var map_ImageReviewContainerSpec = map[string]string{ "": "ImageReviewContainerSpec is a description of a container within the pod creation request.", - "image": "This can be in the form image:tag or image@SHA:012345679abcdef.", + "image": "image can be in the form image:tag or image@SHA:012345679abcdef.", } func (ImageReviewContainerSpec) SwaggerDoc() map[string]string { @@ -49,9 +49,9 @@ func (ImageReviewContainerSpec) SwaggerDoc() map[string]string { var map_ImageReviewSpec = map[string]string{ "": "ImageReviewSpec is a description of the pod creation request.", - "containers": "Containers is a list of a subset of the information in each container of the Pod being created.", - "annotations": "Annotations is a list of key-value pairs extracted from the Pod's annotations. It only includes keys which match the pattern `*.image-policy.k8s.io/*`. It is up to each webhook backend to determine how to interpret these annotations, if at all.", - "namespace": "Namespace is the namespace the pod is being created in.", + "containers": "containers is a list of a subset of the information in each container of the Pod being created.", + "annotations": "annotations is a list of key-value pairs extracted from the Pod's annotations. It only includes keys which match the pattern `*.image-policy.k8s.io/*`. It is up to each webhook backend to determine how to interpret these annotations, if at all.", + "namespace": "namespace is the namespace the pod is being created in.", } func (ImageReviewSpec) SwaggerDoc() map[string]string { @@ -60,9 +60,9 @@ func (ImageReviewSpec) SwaggerDoc() map[string]string { var map_ImageReviewStatus = map[string]string{ "": "ImageReviewStatus is the result of the review for the pod creation request.", - "allowed": "Allowed indicates that all images were allowed to be run.", - "reason": "Reason should be empty unless Allowed is false in which case it may contain a short description of what is wrong. Kubernetes may truncate excessively long errors when displaying to the user.", - "auditAnnotations": "AuditAnnotations will be added to the attributes object of the admission controller request using 'AddAnnotation'. The keys should be prefix-less (i.e., the admission controller will add an appropriate prefix).", + "allowed": "allowed indicates that all images were allowed to be run.", + "reason": "reason should be empty unless Allowed is false in which case it may contain a short description of what is wrong. Kubernetes may truncate excessively long errors when displaying to the user.", + "auditAnnotations": "auditAnnotations will be added to the attributes object of the admission controller request using 'AddAnnotation'. The keys should be prefix-less (i.e., the admission controller will add an appropriate prefix).", } func (ImageReviewStatus) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/scheduling/v1alpha2/doc.go b/vendor/k8s.io/api/lifecycle/v1alpha1/doc.go similarity index 81% rename from vendor/k8s.io/api/scheduling/v1alpha2/doc.go rename to vendor/k8s.io/api/lifecycle/v1alpha1/doc.go index 24ba23e72c..b8ccba674d 100644 --- a/vendor/k8s.io/api/scheduling/v1alpha2/doc.go +++ b/vendor/k8s.io/api/lifecycle/v1alpha1/doc.go @@ -17,8 +17,9 @@ limitations under the License. // +k8s:deepcopy-gen=package // +k8s:protobuf-gen=package // +k8s:openapi-gen=true -// +k8s:openapi-model-package=io.k8s.api.scheduling.v1alpha2 +// +k8s:prerelease-lifecycle-gen=true +// +k8s:openapi-model-package=io.k8s.api.lifecycle.v1alpha1 -// +groupName=scheduling.k8s.io +// +groupName=lifecycle.k8s.io -package v1alpha2 +package v1alpha1 diff --git a/vendor/k8s.io/api/scheduling/v1alpha2/generated.pb.go b/vendor/k8s.io/api/lifecycle/v1alpha1/generated.pb.go similarity index 61% rename from vendor/k8s.io/api/scheduling/v1alpha2/generated.pb.go rename to vendor/k8s.io/api/lifecycle/v1alpha1/generated.pb.go index 12402df3d2..f8835cc6a7 100644 --- a/vendor/k8s.io/api/scheduling/v1alpha2/generated.pb.go +++ b/vendor/k8s.io/api/lifecycle/v1alpha1/generated.pb.go @@ -15,9 +15,9 @@ limitations under the License. */ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: k8s.io/api/scheduling/v1alpha2/generated.proto +// source: k8s.io/api/lifecycle/v1alpha1/generated.proto -package v1alpha2 +package v1alpha1 import ( fmt "fmt" @@ -29,45 +29,94 @@ import ( math_bits "math/bits" reflect "reflect" strings "strings" + + k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" ) -func (m *BasicSchedulingPolicy) Reset() { *m = BasicSchedulingPolicy{} } +func (m *Eviction) Reset() { *m = Eviction{} } -func (m *GangSchedulingPolicy) Reset() { *m = GangSchedulingPolicy{} } +func (m *EvictionList) Reset() { *m = EvictionList{} } -func (m *PodGroup) Reset() { *m = PodGroup{} } +func (m *EvictionPodReference) Reset() { *m = EvictionPodReference{} } -func (m *PodGroupList) Reset() { *m = PodGroupList{} } +func (m *EvictionRequest) Reset() { *m = EvictionRequest{} } -func (m *PodGroupResourceClaim) Reset() { *m = PodGroupResourceClaim{} } +func (m *EvictionRequestList) Reset() { *m = EvictionRequestList{} } -func (m *PodGroupResourceClaimStatus) Reset() { *m = PodGroupResourceClaimStatus{} } +func (m *EvictionRequestPodReference) Reset() { *m = EvictionRequestPodReference{} } -func (m *PodGroupSchedulingConstraints) Reset() { *m = PodGroupSchedulingConstraints{} } +func (m *EvictionRequestSpec) Reset() { *m = EvictionRequestSpec{} } -func (m *PodGroupSchedulingPolicy) Reset() { *m = PodGroupSchedulingPolicy{} } +func (m *EvictionRequestStatus) Reset() { *m = EvictionRequestStatus{} } -func (m *PodGroupSpec) Reset() { *m = PodGroupSpec{} } +func (m *EvictionRequestTarget) Reset() { *m = EvictionRequestTarget{} } -func (m *PodGroupStatus) Reset() { *m = PodGroupStatus{} } +func (m *EvictionSpec) Reset() { *m = EvictionSpec{} } -func (m *PodGroupTemplate) Reset() { *m = PodGroupTemplate{} } +func (m *EvictionStatus) Reset() { *m = EvictionStatus{} } -func (m *PodGroupTemplateReference) Reset() { *m = PodGroupTemplateReference{} } +func (m *EvictionTarget) Reset() { *m = EvictionTarget{} } -func (m *TopologyConstraint) Reset() { *m = TopologyConstraint{} } +func (m *Requester) Reset() { *m = Requester{} } -func (m *TypedLocalObjectReference) Reset() { *m = TypedLocalObjectReference{} } +func (m *ResponderStatus) Reset() { *m = ResponderStatus{} } -func (m *Workload) Reset() { *m = Workload{} } +func (m *TargetResponder) Reset() { *m = TargetResponder{} } -func (m *WorkloadList) Reset() { *m = WorkloadList{} } +func (m *Eviction) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} -func (m *WorkloadPodGroupTemplateReference) Reset() { *m = WorkloadPodGroupTemplateReference{} } +func (m *Eviction) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} -func (m *WorkloadSpec) Reset() { *m = WorkloadSpec{} } +func (m *Eviction) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} -func (m *BasicSchedulingPolicy) Marshal() (dAtA []byte, err error) { +func (m *EvictionList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -77,20 +126,44 @@ func (m *BasicSchedulingPolicy) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *BasicSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { +func (m *EvictionList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *BasicSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EvictionList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *GangSchedulingPolicy) Marshal() (dAtA []byte, err error) { +func (m *EvictionPodReference) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -100,23 +173,30 @@ func (m *GangSchedulingPolicy) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GangSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { +func (m *EvictionPodReference) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *GangSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EvictionPodReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - i = encodeVarintGenerated(dAtA, i, uint64(m.MinCount)) + i -= len(m.UID) + copy(dAtA[i:], m.UID) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.UID))) i-- - dAtA[i] = 0x8 + dAtA[i] = 0x12 + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *PodGroup) Marshal() (dAtA []byte, err error) { +func (m *EvictionRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -126,12 +206,12 @@ func (m *PodGroup) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PodGroup) MarshalTo(dAtA []byte) (int, error) { +func (m *EvictionRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PodGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EvictionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -169,7 +249,7 @@ func (m *PodGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *PodGroupList) Marshal() (dAtA []byte, err error) { +func (m *EvictionRequestList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -179,12 +259,12 @@ func (m *PodGroupList) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PodGroupList) MarshalTo(dAtA []byte) (int, error) { +func (m *EvictionRequestList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PodGroupList) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EvictionRequestList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -216,7 +296,7 @@ func (m *PodGroupList) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *PodGroupResourceClaim) Marshal() (dAtA []byte, err error) { +func (m *EvictionRequestPodReference) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -226,30 +306,21 @@ func (m *PodGroupResourceClaim) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PodGroupResourceClaim) MarshalTo(dAtA []byte) (int, error) { +func (m *EvictionRequestPodReference) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PodGroupResourceClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EvictionRequestPodReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.ResourceClaimTemplateName != nil { - i -= len(*m.ResourceClaimTemplateName) - copy(dAtA[i:], *m.ResourceClaimTemplateName) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ResourceClaimTemplateName))) - i-- - dAtA[i] = 0x1a - } - if m.ResourceClaimName != nil { - i -= len(*m.ResourceClaimName) - copy(dAtA[i:], *m.ResourceClaimName) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ResourceClaimName))) - i-- - dAtA[i] = 0x12 - } + i -= len(m.UID) + copy(dAtA[i:], m.UID) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.UID))) + i-- + dAtA[i] = 0x12 i -= len(m.Name) copy(dAtA[i:], m.Name) i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) @@ -258,7 +329,7 @@ func (m *PodGroupResourceClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *PodGroupResourceClaimStatus) Marshal() (dAtA []byte, err error) { +func (m *EvictionRequestSpec) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -268,32 +339,40 @@ func (m *PodGroupResourceClaimStatus) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PodGroupResourceClaimStatus) MarshalTo(dAtA []byte) (int, error) { +func (m *EvictionRequestSpec) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PodGroupResourceClaimStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EvictionRequestSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.ResourceClaimName != nil { - i -= len(*m.ResourceClaimName) - copy(dAtA[i:], *m.ResourceClaimName) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ResourceClaimName))) - i-- - dAtA[i] = 0x12 + i -= len(m.Intent) + copy(dAtA[i:], m.Intent) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Intent))) + i-- + dAtA[i] = 0x1a + i -= len(m.Requester) + copy(dAtA[i:], m.Requester) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Requester))) + i-- + dAtA[i] = 0x12 + { + size, err := m.Target.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *PodGroupSchedulingConstraints) Marshal() (dAtA []byte, err error) { +func (m *EvictionRequestStatus) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -303,20 +382,25 @@ func (m *PodGroupSchedulingConstraints) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PodGroupSchedulingConstraints) MarshalTo(dAtA []byte) (int, error) { +func (m *EvictionRequestStatus) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PodGroupSchedulingConstraints) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EvictionRequestStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Topology) > 0 { - for iNdEx := len(m.Topology) - 1; iNdEx >= 0; iNdEx-- { + if m.ObservedGeneration != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.ObservedGeneration)) + i-- + dAtA[i] = 0x10 + } + if len(m.Conditions) > 0 { + for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Topology[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -330,7 +414,7 @@ func (m *PodGroupSchedulingConstraints) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *PodGroupSchedulingPolicy) Marshal() (dAtA []byte, err error) { +func (m *EvictionRequestTarget) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -340,31 +424,19 @@ func (m *PodGroupSchedulingPolicy) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PodGroupSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { +func (m *EvictionRequestTarget) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PodGroupSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EvictionRequestTarget) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Gang != nil { - { - size, err := m.Gang.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Basic != nil { + if m.Pod != nil { { - size, err := m.Basic.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Pod.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -377,7 +449,7 @@ func (m *PodGroupSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *PodGroupSpec) Marshal() (dAtA []byte, err error) { +func (m *EvictionSpec) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -387,61 +459,18 @@ func (m *PodGroupSpec) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PodGroupSpec) MarshalTo(dAtA []byte) (int, error) { +func (m *EvictionSpec) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PodGroupSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EvictionSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Priority != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.Priority)) - i-- - dAtA[i] = 0x38 - } - i -= len(m.PriorityClassName) - copy(dAtA[i:], m.PriorityClassName) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.PriorityClassName))) - i-- - dAtA[i] = 0x32 - if m.DisruptionMode != nil { - i -= len(*m.DisruptionMode) - copy(dAtA[i:], *m.DisruptionMode) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.DisruptionMode))) - i-- - dAtA[i] = 0x2a - } - if len(m.ResourceClaims) > 0 { - for iNdEx := len(m.ResourceClaims) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ResourceClaims[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if m.SchedulingConstraints != nil { - { - size, err := m.SchedulingConstraints.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } { - size, err := m.SchedulingPolicy.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Target.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -449,23 +478,11 @@ func (m *PodGroupSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - if m.PodGroupTemplateRef != nil { - { - size, err := m.PodGroupTemplateRef.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *PodGroupStatus) Marshal() (dAtA []byte, err error) { +func (m *EvictionStatus) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -475,20 +492,20 @@ func (m *PodGroupStatus) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PodGroupStatus) MarshalTo(dAtA []byte) (int, error) { +func (m *EvictionStatus) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PodGroupStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EvictionStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ResourceClaimStatuses) > 0 { - for iNdEx := len(m.ResourceClaimStatuses) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Responders) > 0 { + for iNdEx := len(m.Responders) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.ResourceClaimStatuses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Responders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -496,13 +513,13 @@ func (m *PodGroupStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 + dAtA[i] = 0x2a } } - if len(m.Conditions) > 0 { - for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { + if len(m.TargetResponders) > 0 { + for iNdEx := len(m.TargetResponders) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.TargetResponders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -510,53 +527,13 @@ func (m *PodGroupStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0xa + dAtA[i] = 0x22 } } - return len(dAtA) - i, nil -} - -func (m *PodGroupTemplate) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PodGroupTemplate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PodGroupTemplate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Priority != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.Priority)) - i-- - dAtA[i] = 0x38 - } - i -= len(m.PriorityClassName) - copy(dAtA[i:], m.PriorityClassName) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.PriorityClassName))) - i-- - dAtA[i] = 0x32 - if m.DisruptionMode != nil { - i -= len(*m.DisruptionMode) - copy(dAtA[i:], *m.DisruptionMode) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.DisruptionMode))) - i-- - dAtA[i] = 0x2a - } - if len(m.ResourceClaims) > 0 { - for iNdEx := len(m.ResourceClaims) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Requesters) > 0 { + for iNdEx := len(m.Requesters) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.ResourceClaims[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Requesters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -564,40 +541,32 @@ func (m *PodGroupTemplate) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } } - if m.SchedulingConstraints != nil { - { - size, err := m.SchedulingConstraints.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } + if m.ObservedGeneration != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.ObservedGeneration)) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x10 } - { - size, err := m.SchedulingPolicy.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.Conditions) > 0 { + for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *PodGroupTemplateReference) Marshal() (dAtA []byte, err error) { +func (m *EvictionTarget) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -607,19 +576,19 @@ func (m *PodGroupTemplateReference) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PodGroupTemplateReference) MarshalTo(dAtA []byte) (int, error) { +func (m *EvictionTarget) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PodGroupTemplateReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EvictionTarget) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Workload != nil { + if m.Pod != nil { { - size, err := m.Workload.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Pod.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -632,7 +601,7 @@ func (m *PodGroupTemplateReference) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *TopologyConstraint) Marshal() (dAtA []byte, err error) { +func (m *Requester) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -642,63 +611,30 @@ func (m *TopologyConstraint) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *TopologyConstraint) MarshalTo(dAtA []byte) (int, error) { +func (m *Requester) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *TopologyConstraint) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Requester) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Key))) + i -= len(m.Intent) + copy(dAtA[i:], m.Intent) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Intent))) i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *TypedLocalObjectReference) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TypedLocalObjectReference) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TypedLocalObjectReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l + dAtA[i] = 0x12 i -= len(m.Name) copy(dAtA[i:], m.Name) i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) i-- - dAtA[i] = 0x1a - i -= len(m.Kind) - copy(dAtA[i:], m.Kind) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Kind))) - i-- - dAtA[i] = 0x12 - i -= len(m.APIGroup) - copy(dAtA[i:], m.APIGroup) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIGroup))) - i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *Workload) Marshal() (dAtA []byte, err error) { +func (m *ResponderStatus) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -708,87 +644,80 @@ func (m *Workload) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Workload) MarshalTo(dAtA []byte) (int, error) { +func (m *ResponderStatus) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Workload) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ResponderStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) + if m.Message != nil { + i -= len(*m.Message) + copy(dAtA[i:], *m.Message) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Message))) + i-- + dAtA[i] = 0x32 } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.CompletionTime != nil { + { + size, err := m.CompletionTime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x2a } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *WorkloadList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if m.ExpectedCompletionTime != nil { + { + size, err := m.ExpectedCompletionTime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 } - return dAtA[:n], nil -} - -func (m *WorkloadList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WorkloadList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) + if m.HeartbeatTime != nil { + { + size, err := m.HeartbeatTime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0x12 + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x1a } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.StartTime != nil { + { + size, err := m.StartTime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 } + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *WorkloadPodGroupTemplateReference) Marshal() (dAtA []byte, err error) { +func (m *TargetResponder) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -798,75 +727,31 @@ func (m *WorkloadPodGroupTemplateReference) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *WorkloadPodGroupTemplateReference) MarshalTo(dAtA []byte) (int, error) { +func (m *TargetResponder) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *WorkloadPodGroupTemplateReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *TargetResponder) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - i -= len(m.PodGroupTemplateName) - copy(dAtA[i:], m.PodGroupTemplateName) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.PodGroupTemplateName))) - i-- - dAtA[i] = 0x12 - i -= len(m.WorkloadName) - copy(dAtA[i:], m.WorkloadName) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.WorkloadName))) + i -= len(m.State) + copy(dAtA[i:], m.State) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.State))) i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *WorkloadSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WorkloadSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WorkloadSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.PodGroupTemplates) > 0 { - for iNdEx := len(m.PodGroupTemplates) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PodGroupTemplates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.ControllerRef != nil { - { - size, err := m.ControllerRef.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } + dAtA[i] = 0x1a + if m.Priority != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.Priority)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x10 } + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -881,26 +766,52 @@ func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *BasicSchedulingPolicy) Size() (n int) { +func (m *Eviction) Size() (n int) { if m == nil { return 0 } var l int _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) return n } -func (m *GangSchedulingPolicy) Size() (n int) { +func (m *EvictionList) Size() (n int) { if m == nil { return 0 } var l int _ = l - n += 1 + sovGenerated(uint64(m.MinCount)) + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *EvictionPodReference) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.UID) + n += 1 + l + sovGenerated(uint64(l)) return n } -func (m *PodGroup) Size() (n int) { +func (m *EvictionRequest) Size() (n int) { if m == nil { return 0 } @@ -915,7 +826,7 @@ func (m *PodGroup) Size() (n int) { return n } -func (m *PodGroupList) Size() (n int) { +func (m *EvictionRequestList) Size() (n int) { if m == nil { return 0 } @@ -932,7 +843,7 @@ func (m *PodGroupList) Size() (n int) { return n } -func (m *PodGroupResourceClaim) Size() (n int) { +func (m *EvictionRequestPodReference) Size() (n int) { if m == nil { return 0 } @@ -940,99 +851,69 @@ func (m *PodGroupResourceClaim) Size() (n int) { _ = l l = len(m.Name) n += 1 + l + sovGenerated(uint64(l)) - if m.ResourceClaimName != nil { - l = len(*m.ResourceClaimName) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.ResourceClaimTemplateName != nil { - l = len(*m.ResourceClaimTemplateName) - n += 1 + l + sovGenerated(uint64(l)) - } + l = len(m.UID) + n += 1 + l + sovGenerated(uint64(l)) return n } -func (m *PodGroupResourceClaimStatus) Size() (n int) { +func (m *EvictionRequestSpec) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Name) + l = m.Target.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Requester) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Intent) n += 1 + l + sovGenerated(uint64(l)) - if m.ResourceClaimName != nil { - l = len(*m.ResourceClaimName) - n += 1 + l + sovGenerated(uint64(l)) - } return n } -func (m *PodGroupSchedulingConstraints) Size() (n int) { +func (m *EvictionRequestStatus) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Topology) > 0 { - for _, e := range m.Topology { + if len(m.Conditions) > 0 { + for _, e := range m.Conditions { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } + if m.ObservedGeneration != nil { + n += 1 + sovGenerated(uint64(*m.ObservedGeneration)) + } return n } -func (m *PodGroupSchedulingPolicy) Size() (n int) { +func (m *EvictionRequestTarget) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Basic != nil { - l = m.Basic.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Gang != nil { - l = m.Gang.Size() + if m.Pod != nil { + l = m.Pod.Size() n += 1 + l + sovGenerated(uint64(l)) } return n } -func (m *PodGroupSpec) Size() (n int) { +func (m *EvictionSpec) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.PodGroupTemplateRef != nil { - l = m.PodGroupTemplateRef.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - l = m.SchedulingPolicy.Size() + l = m.Target.Size() n += 1 + l + sovGenerated(uint64(l)) - if m.SchedulingConstraints != nil { - l = m.SchedulingConstraints.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if len(m.ResourceClaims) > 0 { - for _, e := range m.ResourceClaims { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if m.DisruptionMode != nil { - l = len(*m.DisruptionMode) - n += 1 + l + sovGenerated(uint64(l)) - } - l = len(m.PriorityClassName) - n += 1 + l + sovGenerated(uint64(l)) - if m.Priority != nil { - n += 1 + sovGenerated(uint64(*m.Priority)) - } return n } -func (m *PodGroupStatus) Size() (n int) { +func (m *EvictionStatus) Size() (n int) { if m == nil { return 0 } @@ -1044,145 +925,100 @@ func (m *PodGroupStatus) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) } } - if len(m.ResourceClaimStatuses) > 0 { - for _, e := range m.ResourceClaimStatuses { + if m.ObservedGeneration != nil { + n += 1 + sovGenerated(uint64(*m.ObservedGeneration)) + } + if len(m.Requesters) > 0 { + for _, e := range m.Requesters { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } - return n -} - -func (m *PodGroupTemplate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = m.SchedulingPolicy.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.SchedulingConstraints != nil { - l = m.SchedulingConstraints.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if len(m.ResourceClaims) > 0 { - for _, e := range m.ResourceClaims { + if len(m.TargetResponders) > 0 { + for _, e := range m.TargetResponders { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } - if m.DisruptionMode != nil { - l = len(*m.DisruptionMode) - n += 1 + l + sovGenerated(uint64(l)) - } - l = len(m.PriorityClassName) - n += 1 + l + sovGenerated(uint64(l)) - if m.Priority != nil { - n += 1 + sovGenerated(uint64(*m.Priority)) + if len(m.Responders) > 0 { + for _, e := range m.Responders { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } } return n } -func (m *PodGroupTemplateReference) Size() (n int) { +func (m *EvictionTarget) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Workload != nil { - l = m.Workload.Size() + if m.Pod != nil { + l = m.Pod.Size() n += 1 + l + sovGenerated(uint64(l)) } return n } -func (m *TopologyConstraint) Size() (n int) { +func (m *Requester) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Key) + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Intent) n += 1 + l + sovGenerated(uint64(l)) return n } -func (m *TypedLocalObjectReference) Size() (n int) { +func (m *ResponderStatus) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.APIGroup) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Kind) - n += 1 + l + sovGenerated(uint64(l)) l = len(m.Name) n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *Workload) Size() (n int) { - if m == nil { - return 0 + if m.StartTime != nil { + l = m.StartTime.Size() + n += 1 + l + sovGenerated(uint64(l)) } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *WorkloadList) Size() (n int) { - if m == nil { - return 0 + if m.HeartbeatTime != nil { + l = m.HeartbeatTime.Size() + n += 1 + l + sovGenerated(uint64(l)) } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } + if m.ExpectedCompletionTime != nil { + l = m.ExpectedCompletionTime.Size() + n += 1 + l + sovGenerated(uint64(l)) } - return n -} - -func (m *WorkloadPodGroupTemplateReference) Size() (n int) { - if m == nil { - return 0 + if m.CompletionTime != nil { + l = m.CompletionTime.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Message != nil { + l = len(*m.Message) + n += 1 + l + sovGenerated(uint64(l)) } - var l int - _ = l - l = len(m.WorkloadName) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.PodGroupTemplateName) - n += 1 + l + sovGenerated(uint64(l)) return n } -func (m *WorkloadSpec) Size() (n int) { +func (m *TargetResponder) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.ControllerRef != nil { - l = m.ControllerRef.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if len(m.PodGroupTemplates) > 0 { - for _, e := range m.PodGroupTemplates { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if m.Priority != nil { + n += 1 + sovGenerated(uint64(*m.Priority)) } + l = len(m.State) + n += 1 + l + sovGenerated(uint64(l)) return n } @@ -1192,124 +1028,97 @@ func sovGenerated(x uint64) (n int) { func sozGenerated(x uint64) (n int) { return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (this *BasicSchedulingPolicy) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&BasicSchedulingPolicy{`, - `}`, - }, "") - return s -} -func (this *GangSchedulingPolicy) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GangSchedulingPolicy{`, - `MinCount:` + fmt.Sprintf("%v", this.MinCount) + `,`, - `}`, - }, "") - return s -} -func (this *PodGroup) String() string { +func (this *Eviction) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&PodGroup{`, + s := strings.Join([]string{`&Eviction{`, `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "PodGroupSpec", "PodGroupSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "PodGroupStatus", "PodGroupStatus", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "EvictionSpec", "EvictionSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "EvictionStatus", "EvictionStatus", 1), `&`, ``, 1) + `,`, `}`, }, "") return s } -func (this *PodGroupList) String() string { +func (this *EvictionList) String() string { if this == nil { return "nil" } - repeatedStringForItems := "[]PodGroup{" + repeatedStringForItems := "[]Eviction{" for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "PodGroup", "PodGroup", 1), `&`, ``, 1) + "," + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Eviction", "Eviction", 1), `&`, ``, 1) + "," } repeatedStringForItems += "}" - s := strings.Join([]string{`&PodGroupList{`, + s := strings.Join([]string{`&EvictionList{`, `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, `Items:` + repeatedStringForItems + `,`, `}`, }, "") return s } -func (this *PodGroupResourceClaim) String() string { +func (this *EvictionPodReference) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&PodGroupResourceClaim{`, + s := strings.Join([]string{`&EvictionPodReference{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `ResourceClaimName:` + valueToStringGenerated(this.ResourceClaimName) + `,`, - `ResourceClaimTemplateName:` + valueToStringGenerated(this.ResourceClaimTemplateName) + `,`, + `UID:` + fmt.Sprintf("%v", this.UID) + `,`, `}`, }, "") return s } -func (this *PodGroupResourceClaimStatus) String() string { +func (this *EvictionRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&PodGroupResourceClaimStatus{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `ResourceClaimName:` + valueToStringGenerated(this.ResourceClaimName) + `,`, + s := strings.Join([]string{`&EvictionRequest{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "EvictionRequestSpec", "EvictionRequestSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "EvictionRequestStatus", "EvictionRequestStatus", 1), `&`, ``, 1) + `,`, `}`, }, "") return s } -func (this *PodGroupSchedulingConstraints) String() string { +func (this *EvictionRequestList) String() string { if this == nil { return "nil" } - repeatedStringForTopology := "[]TopologyConstraint{" - for _, f := range this.Topology { - repeatedStringForTopology += strings.Replace(strings.Replace(f.String(), "TopologyConstraint", "TopologyConstraint", 1), `&`, ``, 1) + "," + repeatedStringForItems := "[]EvictionRequest{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "EvictionRequest", "EvictionRequest", 1), `&`, ``, 1) + "," } - repeatedStringForTopology += "}" - s := strings.Join([]string{`&PodGroupSchedulingConstraints{`, - `Topology:` + repeatedStringForTopology + `,`, + repeatedStringForItems += "}" + s := strings.Join([]string{`&EvictionRequestList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, `}`, }, "") return s } -func (this *PodGroupSchedulingPolicy) String() string { +func (this *EvictionRequestPodReference) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&PodGroupSchedulingPolicy{`, - `Basic:` + strings.Replace(this.Basic.String(), "BasicSchedulingPolicy", "BasicSchedulingPolicy", 1) + `,`, - `Gang:` + strings.Replace(this.Gang.String(), "GangSchedulingPolicy", "GangSchedulingPolicy", 1) + `,`, + s := strings.Join([]string{`&EvictionRequestPodReference{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `UID:` + fmt.Sprintf("%v", this.UID) + `,`, `}`, }, "") return s } -func (this *PodGroupSpec) String() string { +func (this *EvictionRequestSpec) String() string { if this == nil { return "nil" } - repeatedStringForResourceClaims := "[]PodGroupResourceClaim{" - for _, f := range this.ResourceClaims { - repeatedStringForResourceClaims += strings.Replace(strings.Replace(f.String(), "PodGroupResourceClaim", "PodGroupResourceClaim", 1), `&`, ``, 1) + "," - } - repeatedStringForResourceClaims += "}" - s := strings.Join([]string{`&PodGroupSpec{`, - `PodGroupTemplateRef:` + strings.Replace(this.PodGroupTemplateRef.String(), "PodGroupTemplateReference", "PodGroupTemplateReference", 1) + `,`, - `SchedulingPolicy:` + strings.Replace(strings.Replace(this.SchedulingPolicy.String(), "PodGroupSchedulingPolicy", "PodGroupSchedulingPolicy", 1), `&`, ``, 1) + `,`, - `SchedulingConstraints:` + strings.Replace(this.SchedulingConstraints.String(), "PodGroupSchedulingConstraints", "PodGroupSchedulingConstraints", 1) + `,`, - `ResourceClaims:` + repeatedStringForResourceClaims + `,`, - `DisruptionMode:` + valueToStringGenerated(this.DisruptionMode) + `,`, - `PriorityClassName:` + fmt.Sprintf("%v", this.PriorityClassName) + `,`, - `Priority:` + valueToStringGenerated(this.Priority) + `,`, + s := strings.Join([]string{`&EvictionRequestSpec{`, + `Target:` + strings.Replace(strings.Replace(this.Target.String(), "EvictionRequestTarget", "EvictionRequestTarget", 1), `&`, ``, 1) + `,`, + `Requester:` + fmt.Sprintf("%v", this.Requester) + `,`, + `Intent:` + fmt.Sprintf("%v", this.Intent) + `,`, `}`, }, "") return s } -func (this *PodGroupStatus) String() string { +func (this *EvictionRequestStatus) String() string { if this == nil { return "nil" } @@ -1318,253 +1127,124 @@ func (this *PodGroupStatus) String() string { repeatedStringForConditions += fmt.Sprintf("%v", f) + "," } repeatedStringForConditions += "}" - repeatedStringForResourceClaimStatuses := "[]PodGroupResourceClaimStatus{" - for _, f := range this.ResourceClaimStatuses { - repeatedStringForResourceClaimStatuses += strings.Replace(strings.Replace(f.String(), "PodGroupResourceClaimStatus", "PodGroupResourceClaimStatus", 1), `&`, ``, 1) + "," - } - repeatedStringForResourceClaimStatuses += "}" - s := strings.Join([]string{`&PodGroupStatus{`, + s := strings.Join([]string{`&EvictionRequestStatus{`, `Conditions:` + repeatedStringForConditions + `,`, - `ResourceClaimStatuses:` + repeatedStringForResourceClaimStatuses + `,`, - `}`, - }, "") - return s -} -func (this *PodGroupTemplate) String() string { - if this == nil { - return "nil" - } - repeatedStringForResourceClaims := "[]PodGroupResourceClaim{" - for _, f := range this.ResourceClaims { - repeatedStringForResourceClaims += strings.Replace(strings.Replace(f.String(), "PodGroupResourceClaim", "PodGroupResourceClaim", 1), `&`, ``, 1) + "," - } - repeatedStringForResourceClaims += "}" - s := strings.Join([]string{`&PodGroupTemplate{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `SchedulingPolicy:` + strings.Replace(strings.Replace(this.SchedulingPolicy.String(), "PodGroupSchedulingPolicy", "PodGroupSchedulingPolicy", 1), `&`, ``, 1) + `,`, - `SchedulingConstraints:` + strings.Replace(this.SchedulingConstraints.String(), "PodGroupSchedulingConstraints", "PodGroupSchedulingConstraints", 1) + `,`, - `ResourceClaims:` + repeatedStringForResourceClaims + `,`, - `DisruptionMode:` + valueToStringGenerated(this.DisruptionMode) + `,`, - `PriorityClassName:` + fmt.Sprintf("%v", this.PriorityClassName) + `,`, - `Priority:` + valueToStringGenerated(this.Priority) + `,`, - `}`, - }, "") - return s -} -func (this *PodGroupTemplateReference) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PodGroupTemplateReference{`, - `Workload:` + strings.Replace(this.Workload.String(), "WorkloadPodGroupTemplateReference", "WorkloadPodGroupTemplateReference", 1) + `,`, - `}`, - }, "") - return s -} -func (this *TopologyConstraint) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&TopologyConstraint{`, - `Key:` + fmt.Sprintf("%v", this.Key) + `,`, - `}`, - }, "") - return s -} -func (this *TypedLocalObjectReference) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&TypedLocalObjectReference{`, - `APIGroup:` + fmt.Sprintf("%v", this.APIGroup) + `,`, - `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `}`, - }, "") - return s -} -func (this *Workload) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Workload{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "WorkloadSpec", "WorkloadSpec", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *WorkloadList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]Workload{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Workload", "Workload", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&WorkloadList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *WorkloadPodGroupTemplateReference) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&WorkloadPodGroupTemplateReference{`, - `WorkloadName:` + fmt.Sprintf("%v", this.WorkloadName) + `,`, - `PodGroupTemplateName:` + fmt.Sprintf("%v", this.PodGroupTemplateName) + `,`, + `ObservedGeneration:` + valueToStringGenerated(this.ObservedGeneration) + `,`, `}`, }, "") return s } -func (this *WorkloadSpec) String() string { +func (this *EvictionRequestTarget) String() string { if this == nil { return "nil" } - repeatedStringForPodGroupTemplates := "[]PodGroupTemplate{" - for _, f := range this.PodGroupTemplates { - repeatedStringForPodGroupTemplates += strings.Replace(strings.Replace(f.String(), "PodGroupTemplate", "PodGroupTemplate", 1), `&`, ``, 1) + "," - } - repeatedStringForPodGroupTemplates += "}" - s := strings.Join([]string{`&WorkloadSpec{`, - `ControllerRef:` + strings.Replace(this.ControllerRef.String(), "TypedLocalObjectReference", "TypedLocalObjectReference", 1) + `,`, - `PodGroupTemplates:` + repeatedStringForPodGroupTemplates + `,`, + s := strings.Join([]string{`&EvictionRequestTarget{`, + `Pod:` + strings.Replace(this.Pod.String(), "EvictionRequestPodReference", "EvictionRequestPodReference", 1) + `,`, `}`, }, "") return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *BasicSchedulingPolicy) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BasicSchedulingPolicy: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BasicSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GangSchedulingPolicy) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GangSchedulingPolicy: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GangSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinCount", wireType) - } - m.MinCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinCount |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } +} +func (this *EvictionSpec) String() string { + if this == nil { + return "nil" } - - if iNdEx > l { - return io.ErrUnexpectedEOF + s := strings.Join([]string{`&EvictionSpec{`, + `Target:` + strings.Replace(strings.Replace(this.Target.String(), "EvictionTarget", "EvictionTarget", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *EvictionStatus) String() string { + if this == nil { + return "nil" } - return nil + repeatedStringForConditions := "[]Condition{" + for _, f := range this.Conditions { + repeatedStringForConditions += fmt.Sprintf("%v", f) + "," + } + repeatedStringForConditions += "}" + repeatedStringForRequesters := "[]Requester{" + for _, f := range this.Requesters { + repeatedStringForRequesters += strings.Replace(strings.Replace(f.String(), "Requester", "Requester", 1), `&`, ``, 1) + "," + } + repeatedStringForRequesters += "}" + repeatedStringForTargetResponders := "[]TargetResponder{" + for _, f := range this.TargetResponders { + repeatedStringForTargetResponders += strings.Replace(strings.Replace(f.String(), "TargetResponder", "TargetResponder", 1), `&`, ``, 1) + "," + } + repeatedStringForTargetResponders += "}" + repeatedStringForResponders := "[]ResponderStatus{" + for _, f := range this.Responders { + repeatedStringForResponders += strings.Replace(strings.Replace(f.String(), "ResponderStatus", "ResponderStatus", 1), `&`, ``, 1) + "," + } + repeatedStringForResponders += "}" + s := strings.Join([]string{`&EvictionStatus{`, + `Conditions:` + repeatedStringForConditions + `,`, + `ObservedGeneration:` + valueToStringGenerated(this.ObservedGeneration) + `,`, + `Requesters:` + repeatedStringForRequesters + `,`, + `TargetResponders:` + repeatedStringForTargetResponders + `,`, + `Responders:` + repeatedStringForResponders + `,`, + `}`, + }, "") + return s +} +func (this *EvictionTarget) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&EvictionTarget{`, + `Pod:` + strings.Replace(this.Pod.String(), "EvictionPodReference", "EvictionPodReference", 1) + `,`, + `}`, + }, "") + return s +} +func (this *Requester) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Requester{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Intent:` + fmt.Sprintf("%v", this.Intent) + `,`, + `}`, + }, "") + return s +} +func (this *ResponderStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResponderStatus{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `StartTime:` + strings.Replace(fmt.Sprintf("%v", this.StartTime), "Time", "v1.Time", 1) + `,`, + `HeartbeatTime:` + strings.Replace(fmt.Sprintf("%v", this.HeartbeatTime), "Time", "v1.Time", 1) + `,`, + `ExpectedCompletionTime:` + strings.Replace(fmt.Sprintf("%v", this.ExpectedCompletionTime), "Time", "v1.Time", 1) + `,`, + `CompletionTime:` + strings.Replace(fmt.Sprintf("%v", this.CompletionTime), "Time", "v1.Time", 1) + `,`, + `Message:` + valueToStringGenerated(this.Message) + `,`, + `}`, + }, "") + return s +} +func (this *TargetResponder) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TargetResponder{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Priority:` + valueToStringGenerated(this.Priority) + `,`, + `State:` + fmt.Sprintf("%v", this.State) + `,`, + `}`, + }, "") + return s +} +func valueToStringGenerated(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) } -func (m *PodGroup) Unmarshal(dAtA []byte) error { +func (m *Eviction) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1587,10 +1267,10 @@ func (m *PodGroup) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PodGroup: wiretype end group for non-group") + return fmt.Errorf("proto: Eviction: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PodGroup: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Eviction: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1713,7 +1393,7 @@ func (m *PodGroup) Unmarshal(dAtA []byte) error { } return nil } -func (m *PodGroupList) Unmarshal(dAtA []byte) error { +func (m *EvictionList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1736,10 +1416,10 @@ func (m *PodGroupList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PodGroupList: wiretype end group for non-group") + return fmt.Errorf("proto: EvictionList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PodGroupList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EvictionList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1804,7 +1484,7 @@ func (m *PodGroupList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Items = append(m.Items, PodGroup{}) + m.Items = append(m.Items, Eviction{}) if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1830,7 +1510,7 @@ func (m *PodGroupList) Unmarshal(dAtA []byte) error { } return nil } -func (m *PodGroupResourceClaim) Unmarshal(dAtA []byte) error { +func (m *EvictionPodReference) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1853,10 +1533,10 @@ func (m *PodGroupResourceClaim) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PodGroupResourceClaim: wiretype end group for non-group") + return fmt.Errorf("proto: EvictionPodReference: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PodGroupResourceClaim: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EvictionPodReference: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1893,40 +1573,7 @@ func (m *PodGroupResourceClaim) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.ResourceClaimName = &s - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimTemplateName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1954,8 +1601,7 @@ func (m *PodGroupResourceClaim) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := string(dAtA[iNdEx:postIndex]) - m.ResourceClaimTemplateName = &s + m.UID = k8s_io_apimachinery_pkg_types.UID(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1978,7 +1624,7 @@ func (m *PodGroupResourceClaim) Unmarshal(dAtA []byte) error { } return nil } -func (m *PodGroupResourceClaimStatus) Unmarshal(dAtA []byte) error { +func (m *EvictionRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2001,17 +1647,17 @@ func (m *PodGroupResourceClaimStatus) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PodGroupResourceClaimStatus: wiretype end group for non-group") + return fmt.Errorf("proto: EvictionRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PodGroupResourceClaimStatus: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EvictionRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2021,29 +1667,30 @@ func (m *PodGroupResourceClaimStatus) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2053,78 +1700,28 @@ func (m *PodGroupResourceClaimStatus) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - s := string(dAtA[iNdEx:postIndex]) - m.ResourceClaimName = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PodGroupSchedulingConstraints) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PodGroupSchedulingConstraints: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PodGroupSchedulingConstraints: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + iNdEx = postIndex + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Topology", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2151,8 +1748,7 @@ func (m *PodGroupSchedulingConstraints) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Topology = append(m.Topology, TopologyConstraint{}) - if err := m.Topology[len(m.Topology)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2177,7 +1773,7 @@ func (m *PodGroupSchedulingConstraints) Unmarshal(dAtA []byte) error { } return nil } -func (m *PodGroupSchedulingPolicy) Unmarshal(dAtA []byte) error { +func (m *EvictionRequestList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2200,15 +1796,15 @@ func (m *PodGroupSchedulingPolicy) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PodGroupSchedulingPolicy: wiretype end group for non-group") + return fmt.Errorf("proto: EvictionRequestList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PodGroupSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EvictionRequestList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Basic", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2235,16 +1831,13 @@ func (m *PodGroupSchedulingPolicy) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Basic == nil { - m.Basic = &BasicSchedulingPolicy{} - } - if err := m.Basic.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Gang", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2271,10 +1864,8 @@ func (m *PodGroupSchedulingPolicy) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Gang == nil { - m.Gang = &GangSchedulingPolicy{} - } - if err := m.Gang.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Items = append(m.Items, EvictionRequest{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2299,7 +1890,7 @@ func (m *PodGroupSchedulingPolicy) Unmarshal(dAtA []byte) error { } return nil } -func (m *PodGroupSpec) Unmarshal(dAtA []byte) error { +func (m *EvictionRequestPodReference) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2322,17 +1913,17 @@ func (m *PodGroupSpec) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PodGroupSpec: wiretype end group for non-group") + return fmt.Errorf("proto: EvictionRequestPodReference: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PodGroupSpec: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EvictionRequestPodReference: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PodGroupTemplateRef", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2342,33 +1933,29 @@ func (m *PodGroupSpec) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if m.PodGroupTemplateRef == nil { - m.PodGroupTemplateRef = &PodGroupTemplateReference{} - } - if err := m.PodGroupTemplateRef.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SchedulingPolicy", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UID", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2378,64 +1965,77 @@ func (m *PodGroupSpec) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.SchedulingPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.UID = k8s_io_apimachinery_pkg_types.UID(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SchedulingConstraints", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + msglen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - if m.SchedulingConstraints == nil { - m.SchedulingConstraints = &PodGroupSchedulingConstraints{} + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EvictionRequestSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF } - if err := m.SchedulingConstraints.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - iNdEx = postIndex - case 4: + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EvictionRequestSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EvictionRequestSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaims", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2462,14 +2062,13 @@ func (m *PodGroupSpec) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ResourceClaims = append(m.ResourceClaims, PodGroupResourceClaim{}) - if err := m.ResourceClaims[len(m.ResourceClaims)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Target.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 5: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DisruptionMode", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Requester", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2497,12 +2096,11 @@ func (m *PodGroupSpec) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := DisruptionMode(dAtA[iNdEx:postIndex]) - m.DisruptionMode = &s + m.Requester = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PriorityClassName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Intent", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2530,28 +2128,8 @@ func (m *PodGroupSpec) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.PriorityClassName = string(dAtA[iNdEx:postIndex]) + m.Intent = EvictionRequestIntent(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Priority = &v default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -2573,7 +2151,7 @@ func (m *PodGroupSpec) Unmarshal(dAtA []byte) error { } return nil } -func (m *PodGroupStatus) Unmarshal(dAtA []byte) error { +func (m *EvictionRequestStatus) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2596,10 +2174,10 @@ func (m *PodGroupStatus) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PodGroupStatus: wiretype end group for non-group") + return fmt.Errorf("proto: EvictionRequestStatus: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PodGroupStatus: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EvictionRequestStatus: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2637,10 +2215,10 @@ func (m *PodGroupStatus) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimStatuses", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ObservedGeneration", wireType) } - var msglen int + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2650,26 +2228,12 @@ func (m *PodGroupStatus) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ResourceClaimStatuses = append(m.ResourceClaimStatuses, PodGroupResourceClaimStatus{}) - if err := m.ResourceClaimStatuses[len(m.ResourceClaimStatuses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex + m.ObservedGeneration = &v default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -2691,7 +2255,7 @@ func (m *PodGroupStatus) Unmarshal(dAtA []byte) error { } return nil } -func (m *PodGroupTemplate) Unmarshal(dAtA []byte) error { +func (m *EvictionRequestTarget) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2714,17 +2278,17 @@ func (m *PodGroupTemplate) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PodGroupTemplate: wiretype end group for non-group") + return fmt.Errorf("proto: EvictionRequestTarget: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PodGroupTemplate: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EvictionRequestTarget: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pod", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2734,60 +2298,81 @@ func (m *PodGroupTemplate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SchedulingPolicy", wireType) + if m.Pod == nil { + m.Pod = &EvictionRequestPodReference{} } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } + if err := m.Pod.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - if msglen < 0 { - return ErrInvalidLengthGenerated + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + msglen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - if err := m.SchedulingPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EvictionSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated } - iNdEx = postIndex - case 3: + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EvictionSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EvictionSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SchedulingConstraints", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2814,16 +2399,63 @@ func (m *PodGroupTemplate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.SchedulingConstraints == nil { - m.SchedulingConstraints = &PodGroupSchedulingConstraints{} - } - if err := m.SchedulingConstraints.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Target.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 4: + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EvictionStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EvictionStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EvictionStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaims", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2850,16 +2482,16 @@ func (m *PodGroupTemplate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ResourceClaims = append(m.ResourceClaims, PodGroupResourceClaim{}) - if err := m.ResourceClaims[len(m.ResourceClaims)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Conditions = append(m.Conditions, v1.Condition{}) + if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DisruptionMode", wireType) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ObservedGeneration", wireType) } - var stringLen uint64 + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2869,30 +2501,17 @@ func (m *PodGroupTemplate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := DisruptionMode(dAtA[iNdEx:postIndex]) - m.DisruptionMode = &s - iNdEx = postIndex - case 6: + m.ObservedGeneration = &v + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PriorityClassName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Requesters", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2902,29 +2521,31 @@ func (m *PodGroupTemplate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.PriorityClassName = string(dAtA[iNdEx:postIndex]) + m.Requesters = append(m.Requesters, Requester{}) + if err := m.Requesters[len(m.Requesters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetResponders", wireType) } - var v int32 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2934,65 +2555,29 @@ func (m *PodGroupTemplate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - m.Priority = &v - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PodGroupTemplateReference) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated + if msglen < 0 { + return ErrInvalidLengthGenerated } - if iNdEx >= l { + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + m.TargetResponders = append(m.TargetResponders, TargetResponder{}) + if err := m.TargetResponders[len(m.TargetResponders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PodGroupTemplateReference: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PodGroupTemplateReference: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + iNdEx = postIndex + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Workload", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Responders", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3019,10 +2604,8 @@ func (m *PodGroupTemplateReference) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Workload == nil { - m.Workload = &WorkloadPodGroupTemplateReference{} - } - if err := m.Workload.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Responders = append(m.Responders, ResponderStatus{}) + if err := m.Responders[len(m.Responders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3047,7 +2630,7 @@ func (m *PodGroupTemplateReference) Unmarshal(dAtA []byte) error { } return nil } -func (m *TopologyConstraint) Unmarshal(dAtA []byte) error { +func (m *EvictionTarget) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3070,17 +2653,17 @@ func (m *TopologyConstraint) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TopologyConstraint: wiretype end group for non-group") + return fmt.Errorf("proto: EvictionTarget: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TopologyConstraint: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EvictionTarget: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pod", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -3090,23 +2673,27 @@ func (m *TopologyConstraint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Key = string(dAtA[iNdEx:postIndex]) + if m.Pod == nil { + m.Pod = &EvictionPodReference{} + } + if err := m.Pod.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -3129,7 +2716,7 @@ func (m *TopologyConstraint) Unmarshal(dAtA []byte) error { } return nil } -func (m *TypedLocalObjectReference) Unmarshal(dAtA []byte) error { +func (m *Requester) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3152,15 +2739,15 @@ func (m *TypedLocalObjectReference) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TypedLocalObjectReference: wiretype end group for non-group") + return fmt.Errorf("proto: Requester: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TypedLocalObjectReference: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Requester: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field APIGroup", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3188,43 +2775,11 @@ func (m *TypedLocalObjectReference) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.APIGroup = string(dAtA[iNdEx:postIndex]) + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Kind = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Intent", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3252,7 +2807,7 @@ func (m *TypedLocalObjectReference) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) + m.Intent = RequesterIntent(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3275,7 +2830,7 @@ func (m *TypedLocalObjectReference) Unmarshal(dAtA []byte) error { } return nil } -func (m *Workload) Unmarshal(dAtA []byte) error { +func (m *ResponderStatus) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3298,17 +2853,17 @@ func (m *Workload) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Workload: wiretype end group for non-group") + return fmt.Errorf("proto: ResponderStatus: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Workload: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ResponderStatus: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -3318,28 +2873,27 @@ func (m *Workload) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3366,63 +2920,16 @@ func (m *Workload) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + if m.StartTime == nil { + m.StartTime = &v1.Time{} } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { + if err := m.StartTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WorkloadList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WorkloadList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WorkloadList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + iNdEx = postIndex + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field HeartbeatTime", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3449,13 +2956,16 @@ func (m *WorkloadList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.HeartbeatTime == nil { + m.HeartbeatTime = &v1.Time{} + } + if err := m.HeartbeatTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 2: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ExpectedCompletionTime", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3482,66 +2992,18 @@ func (m *WorkloadList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Items = append(m.Items, Workload{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + if m.ExpectedCompletionTime == nil { + m.ExpectedCompletionTime = &v1.Time{} } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { + if err := m.ExpectedCompletionTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WorkloadPodGroupTemplateReference) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WorkloadPodGroupTemplateReference: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WorkloadPodGroupTemplateReference: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + iNdEx = postIndex + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WorkloadName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CompletionTime", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -3551,27 +3013,31 @@ func (m *WorkloadPodGroupTemplateReference) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.WorkloadName = string(dAtA[iNdEx:postIndex]) + if m.CompletionTime == nil { + m.CompletionTime = &v1.Time{} + } + if err := m.CompletionTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 2: + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PodGroupTemplateName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3599,7 +3065,8 @@ func (m *WorkloadPodGroupTemplateReference) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.PodGroupTemplateName = string(dAtA[iNdEx:postIndex]) + s := string(dAtA[iNdEx:postIndex]) + m.Message = &s iNdEx = postIndex default: iNdEx = preIndex @@ -3622,7 +3089,7 @@ func (m *WorkloadPodGroupTemplateReference) Unmarshal(dAtA []byte) error { } return nil } -func (m *WorkloadSpec) Unmarshal(dAtA []byte) error { +func (m *TargetResponder) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3645,17 +3112,17 @@ func (m *WorkloadSpec) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: WorkloadSpec: wiretype end group for non-group") + return fmt.Errorf("proto: TargetResponder: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: WorkloadSpec: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TargetResponder: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ControllerRef", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -3665,33 +3132,49 @@ func (m *WorkloadSpec) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if m.ControllerRef == nil { - m.ControllerRef = &TypedLocalObjectReference{} - } - if err := m.ControllerRef.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Priority = &v + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PodGroupTemplates", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -3701,25 +3184,23 @@ func (m *WorkloadSpec) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.PodGroupTemplates = append(m.PodGroupTemplates, PodGroupTemplate{}) - if err := m.PodGroupTemplates[len(m.PodGroupTemplates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.State = ResponderStateType(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/vendor/k8s.io/api/lifecycle/v1alpha1/generated.proto b/vendor/k8s.io/api/lifecycle/v1alpha1/generated.proto new file mode 100644 index 0000000000..cef2c730dc --- /dev/null +++ b/vendor/k8s.io/api/lifecycle/v1alpha1/generated.proto @@ -0,0 +1,529 @@ +/* +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. +*/ + + +// This file was autogenerated by go-to-protobuf. Do not edit it manually! + +syntax = "proto2"; + +package k8s.io.api.lifecycle.v1alpha1; + +import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; + +// Package-wide variables from generator "generated". +option go_package = "k8s.io/api/lifecycle/v1alpha1"; + +// Eviction initiates an eviction process, which should ideally result in a graceful eviction of a +// .spec.target (e.g. termination of a pod). +// +// The evictionrequest-controller observes intents of all EvictionRequests and transforms them into +// Evictions. It manages the Eviction lifecycle. +// Requesters are preserved in .status.requesters even after they have withdrawn their request. +// If all requesters withdraw their eviction intent for a common target, the eviction will be +// canceled. Once all EvictionRequest corresponding to this Eviction .spec.target have been +// removed, this Eviction object will eventually be garbage collected. +// +// If the target is a pod, the .status.targetResponders is populated from Pod's +// .spec.evictionResponders. +// +// Responders should observe and communicate through the .status to help with the eviction +// of the target when they see their state == Active in .status.targetResponders. ResponderStatus +// struct should then be periodically updated to indicate the progress or completion of the eviction +// process by each responder in .status.responders. If .status.responders[].heartbeatTime is not +// updated within the heartbeat deadline defined by the Eviction API (currently 20 minutes), the +// eviction is passed over to the next responder with a lower priority. +// +// If there are no other responders and the target is a pod, the last default +// imperative-eviction.k8s.io/evictor responder with a priority of 100 will evict the pod using the +// imperative Eviction API (pods//eviction subresource). +// +k8s:validation-gen-nolint // Note: remove this when the API got GA +message Eviction { + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // .metadata.name set by the evictionrequest-controller is purely informative and subject to change. + // .spec.target field should be used to identify the target precisesly. + // + // The requester and responder names will be used as label keys and added to the labels of the + // eviction in one of the following formats: + // 1. acme.io/foo: "requester" + // 2. acme.io/foo: "responder" + // 3. acme.io/foo: "requester-responder" + // + // Please see EvictionParticipantRole for available role label values. + // +optional + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:format=k8s-long-name + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // spec defines the eviction specification. + // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + // +required + optional EvictionSpec spec = 2; + + // status represents the most recently observed status of the eviction. + // Populated by responders and evictionrequest-controller. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + // +optional + optional EvictionStatus status = 3; +} + +// EvictionList contains a list of Eviction resources. +message EvictionList { + // metadata is the standard list metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // items is the list of Evictions. + repeated Eviction items = 2; +} + +// EvictionPodReference contains enough information to locate the referenced pod inside the same +// namespace. +message EvictionPodReference { + // name of the target. + // This field is required. + // +required + // +k8s:required + // +k8s:format=k8s-long-name + optional string name = 1; + + // uid of the target. + // It can be found in .metadata.uid of the target and is a lowercase UUID in 8-4-4-4-12 format. + // This field is required. + // +required + // +k8s:required + // +k8s:format=k8s-uuid + optional string uid = 2; +} + +// EvictionRequest defines a request that should ideally result in a graceful eviction of a +// .spec.target (e.g. termination of a pod). +// +// The evictionrequest-controller observes intents of all EvictionRequests and transforms them into +// Evictions. +// - .spec.requester is set as a label on the Eviction for easier lookup. +// - Each target can have a set of responders assigned to it. Eviction objects are observed by +// these responders, who implement the eviction logic and update the Eviction's status with +// progress. +// +// There is many-to-many relationship between EvictionRequests and Evictions in general. +// And many-to-one if the target is a pod. +// +// If all requesters withdraw their eviction intent for a common target, the eviction will be +// canceled. Deleting an EvictionRequest also counts as a withdrawal. +// Once all EvictionRequest of a target are removed, the corresponding Evictions are eventually +// garbage collected. +// +// +k8s:validation-gen-nolint // Note: remove this when the API got GA +message EvictionRequest { + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // +optional + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:format=k8s-long-name + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // spec defines the eviction request specification. + // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + // +required + optional EvictionRequestSpec spec = 2; + + // status represents the most recently observed status of the eviction request. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + // +optional + optional EvictionRequestStatus status = 3; +} + +// EvictionRequestList contains a list of EvictionRequests resources. +message EvictionRequestList { + // metadata is the standard list metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // items is the list of EvictionRequests. + repeated EvictionRequest items = 2; +} + +// EvictionRequestPodReference contains enough information to locate the referenced pod inside the +// same namespace. +message EvictionRequestPodReference { + // name of the target. + // This field is required. + // +required + // +k8s:required + // +k8s:format=k8s-long-name + optional string name = 1; + + // uid of the target. + // It can be found in .metadata.uid of the target and is a lowercase UUID in 8-4-4-4-12 format. + // This field is required. + // +required + // +k8s:required + // +k8s:format=k8s-uuid + optional string uid = 2; +} + +// EvictionRequestSpec is a specification of an EvictionRequest. +message EvictionRequestSpec { + // target contains a reference to an object (e.g. a pod) that should be evicted. + // This field is required and immutable. + // +required + // +k8s:immutable + optional EvictionRequestTarget target = 1; + + // requester allows you to identify the entity, that requested the eviction of the target. + // + // It must be a valid domain-prefixed key (such as "acme.io/foo"). + // Domain names *.k8s.io and *.kubernetes.io are reserved. + // This field is required and immutable. + // +required + // +k8s:required + // +k8s:immutable + // +k8s:format=k8s-prefixed-label-key + // +k8s:customValidation + optional string requester = 2; + + // intent specifies the action that should be taken for the specified target. + // + // - Eviction means that the requester is interested in the eviction of the target. + // - Withdrawn means that the requester is no longer interested in the eviction of the target. + // If all requesters' intents are withdrawn for a common target, the eviction will be canceled. + // Cancellation consequences: + // - Inactive responders will never run. + // - Active responders are expected to cancel the eviction. + // - Completed or Interrupted responders should not take any action. + // +required + // +k8s:required + optional string intent = 3; +} + +// EvictionRequestStatus represents the last observed status of the eviction request. +message EvictionRequestStatus { + // conditions contain information about the eviction request. + // + // EvictionRequest specific conditions are: TargetEvicted or Failed (managed by evictionrequest-controller). + // - Failed means that the eviction request is no longer being processed + // by any eviction responder. This can happen if the request is canceled or if no responder + // managed to evict the target (e.g. terminate or delete a pod). + // - TargetEvicted means that the target has been evicted (e.g. a pod has been terminated or deleted). + // + // These conditions can be reset if the eviction was unsuccessful and a new Eviction intent has + // been submitted. + // + // The maximum length of the conditions list is 100. + // +optional + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // +k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + // +k8s:maxItems=100 + repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1; + + // observedGeneration is EvictionRequest's .metadata.generation observed by the evictionrequest-controller. + // The observed generation value cannot be negative and can only be incremented. + // The minimum value is 1. + // This field is managed by evictionrequest-controller. + // +optional + // +k8s:optional + // +k8s:minimum=1 + // +k8s:update=NoUnset + // +k8s:monotonic + optional int64 observedGeneration = 2; +} + +// EvictionRequestTarget contains a reference to an object that should be evicted. +// +union +message EvictionRequestTarget { + // pod references a pod that is subject to eviction/termination. + // Pods that are part of a PodGroup (.spec.schedulingGroup is set) are not supported. + // +optional + // +k8s:optional + // +k8s:unionMember + optional EvictionRequestPodReference pod = 1; +} + +// EvictionSpec is a specification of an Eviction. +message EvictionSpec { + // target contains a reference to an object (e.g. a pod) that should be evicted. + // This field is required and immutable. + // +required + // +k8s:immutable + optional EvictionTarget target = 1; +} + +// EvictionStatus represents the last observed status of the eviction request. +message EvictionStatus { + // conditions contain information about the eviction request. + // + // Eviction specific conditions are: TargetEvicted or Failed (managed by evictionrequest-controller). + // - Failed means that the eviction request is no longer being processed + // by any eviction responder. This can happen if the request is canceled or if no responder + // managed to evict the target (e.g. terminate or delete a pod). + // - TargetEvicted means that the target has been evicted (e.g. a pod has been terminated or deleted). + // + // The maximum length of the conditions list is 100. + // +optional + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // +k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + // +k8s:maxItems=100 + repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1; + + // observedGeneration is Eviction's .metadata.generation observed by the evictionrequest-controller. + // The observed generation value cannot be negative and can only be incremented. + // The minimum value is 1. + // This field is managed by evictionrequest-controller. + // +optional + // +k8s:optional + // +k8s:minimum=1 + // +k8s:monotonic + // +k8s:update=NoUnset + optional int64 observedGeneration = 2; + + // requesters allow you to identify the entities, that requested the eviction of the target. + // If all the requesters withdraw their eviction intent, the eviction will be canceled. + // + // The maximum length of the requesters list is 100. + // If this limit is exceeded, requesters with Withdrawn intent should be dropped first. + // +optional + // +patchMergeKey=name + // +patchStrategy=merge + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=100 + repeated Requester requesters = 3; + + // targetResponders reference responders that should eventually respond to this eviction + // to help with the graceful eviction of a target. These responders are selected sequentially, + // according to their specified priority by setting the Active state to the TargetResponder + // .state field. The maximum number of active responders allowed is 1. + // Eventually each responder can end up in an Interrupted, Canceled or, Completed state. + // Responders should observe these states in order to navigate their lifecycle. + // + // If the target is a pod, the field is populated from Pod's .spec.evictionResponders. Default + // responders may be added to the list according to the target. + // + // Default responders: + // - imperative-eviction.k8s.io/evictor responder with a priority of 100 is added to the list if the + // target is a pod. It will call the imperative Eviction API (pods//eviction subresource). + // This call may not succeed due to PodDisruptionBudgets, which may block the pod termination. + // It will update the responder message and try again with a backoff. + // + // The maximum length of the responders list is 11. + // The length and keys of the list cannot change once set. + // This field is managed by evictionrequest-controller. + // +optional + // +patchMergeKey=name + // +patchStrategy=merge + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=11 + repeated TargetResponder targetResponders = 4; + + // responders represents the eviction process status of each declared responder. + // + // The responder list should be the same length and have the same .name fields as + // .status.targetResponders. Only responders with .name that have Active state in + // .targetResponders[].state should be updated and can be mutated. First initialization + // of the list is allowed. + // + // Each ResponderStatus is initialized by evictionrequest-controller and then managed by + // the designated responder. + // +optional + // +patchMergeKey=name + // +patchStrategy=merge + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=11 + repeated ResponderStatus responders = 5; +} + +// EvictionTarget contains a reference to an object that should be evicted. +// +union +message EvictionTarget { + // pod references a pod that is subject to eviction/termination. + // Pods that are part of a PodGroup (.spec.schedulingGroup is set) are not supported. + // +optional + // +k8s:optional + // +k8s:unionMember + optional EvictionPodReference pod = 1; +} + +// Requester allows you to identify the entity, that requested the eviction of the target. +// +structType=atomic +message Requester { + // name allows you to identify the entity, that requested the eviction of the target. + // + // It must be a valid domain-prefixed key (such as "acme.io/foo"). + // This field must be unique for each requester. + // This field is required. + // +required + // +k8s:required + // +k8s:format=k8s-prefixed-label-key + optional string name = 1; + + // intent specifies the action that should be taken for the specified target. + // + // - Eviction means that the requester is interested in the eviction of the target. + // - Withdrawn means that the requester is no longer interested in the eviction of the target. + // If all requesters' intents are withdrawn, the eviction will be canceled. + // Cancellation consequences: + // - Inactive responders will never run. + // - Active responders are expected to cancel the eviction. + // - Completed or Interrupted responders should not take any action. + // +required + // +k8s:required + optional string intent = 2; +} + +// ResponderStatus represents the last observed status of the eviction process of the responder. +// It should be only updated by the designated responder whose name is .name field. +// +structType=granular +message ResponderStatus { + // name allows you to identify the responder reacting to the Eviction. + // + // It must be a valid domain-prefixed key (such as "acme.io/foo"). + // This field is initialized by Kubernetes and must be unique for each responder. + // This field is required. + // +required + // +k8s:required + // +k8s:format=k8s-prefixed-label-key + optional string name = 1; + + // startTime tracks the time at which this responder was designated as active and should start + // processing the eviction request. + // It should reflect the present time when set. + // This field is initialized by Kubernetes when this responder becomes active. + // This field becomes immutable once set. + // +optional + // +k8s:optional + // +k8s:update=NoModify + // +k8s:update=NoUnset + optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time startTime = 2; + + // heartbeatTime is the last time at which the eviction process was reported to be in progress + // by the responder. + // It should reflect the present time when set. + // Responders should avoid heartbeats more frequent than 20 seconds to avoid overloading the + // control-plane. + // +optional + // +k8s:optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time heartbeatTime = 3; + + // expectedCompletionTime is the time at which the eviction process step is expected to end for the + // responder. + // The time cannot be set to the past. + // May be omitted if no estimate can be made. + // +optional + // +k8s:optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time expectedCompletionTime = 4; + + // completionTime tracks the time at which the Responder stopped processing the eviction request. + // Completion means that the responders has either fully or partially completed the + // eviction process, which may have resulted in target eviction (e.g. pod termination). + // It should reflect the present time when set. + // This field becomes immutable once set. + // +optional + // +k8s:optional + // +k8s:update=NoModify + // +k8s:update=NoUnset + optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time completionTime = 5; + + // message provides human-readable details about the state of the responder and the eviction + // process. + // Maximum length is 4000 characters. + // +optional + // +k8s:optional + // +k8s:maxLength=4000 + optional string message = 6; +} + +// TargetResponder allows you to specify the responder reacting to the Eviction. +// Responders should observe and communicate through the Eviction API (see .state) to help +// with the graceful eviction of a target (e.g. termination of a pod). +// +structType=atomic +message TargetResponder { + // name allows you to identify the responder reacting to the Eviction. + // + // It must be a valid domain-prefixed key (such as "acme.io/foo"). + // This field must be unique for each responder. + // This field is required. + // +required + // +k8s:required + // +k8s:format=k8s-prefixed-label-key + optional string name = 1; + + // priority for this responder. Higher priorities are selected first by the evictionrequest-controller. + // If there are responders with the same priority, the responder whose domain name comes first in the + // alphabetical higher domain order, will be picked. This means that the top domain labels are compared + // alphabetically first, followed by the lower domain labels. The key is compared last. + // + // The responder that is the managing controller of the pod should set the value of + // this field to 10000 to allow both for preemption or fallback registration by other + // responders. + // + // The minimum value is 0 and the maximum value is 100000. + // The interval 0-999 is reserved for responders with *.k8s.io suffix. + // This field is required and immutable. + // +required + // +k8s:required + // +k8s:minimum=0 + // +k8s:maximum=100000 + // +k8s:update=NoModify + // +k8s:update=NoUnset + optional int32 priority = 2; + + // state specifies a state that is assigned by the evictionrequest-controller. Responders should observe + // this state in order to navigate their lifecycle. + // - Inactive means that the responder should not yet process this eviction request. + // - Active means that the responder is either running or expected to start soon. + // Also, startTime has been set in the ResponderStatus by the evictionrequest-controller. + // + // An active responder should currently interact with the eviction process by updating + // .status.responders, where .name is the active responder name. ResponderStatus fields + // should be periodically updated to indicate the progress or completion of the eviction process. + // If .status.responders[].heartbeatTime field is not updated within the heartbeat deadline defined + // by the Eviction API (currently 20 minutes), the eviction is passed over to the next responder + // with a lower priority. Only one responder can be active at a time. + // - Interrupted means that the responder has failed to start or failed to update + // heartbeatTime in ResponderStatus in a timely manner. + // - Canceled means that the responder has been canceled. In other words, there is no + // EvictionRequest with the same target and Eviction intent in .spec.intent. + // - Completed means that the responder has successfully completed and set completionTime + // in ResponderStatus. + // + // Please refer to the ResponderStatus in .status.responders for more details on each responder. + // +required + // +k8s:required + optional string state = 3; +} + diff --git a/vendor/k8s.io/api/lifecycle/v1alpha1/register.go b/vendor/k8s.io/api/lifecycle/v1alpha1/register.go new file mode 100644 index 0000000000..1efd341724 --- /dev/null +++ b/vendor/k8s.io/api/lifecycle/v1alpha1/register.go @@ -0,0 +1,55 @@ +/* +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. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the group name use in this package +const GroupName = "lifecycle.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api. + // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Eviction{}, + &EvictionList{}, + &EvictionRequest{}, + &EvictionRequestList{}, + ) + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/k8s.io/api/lifecycle/v1alpha1/types.go b/vendor/k8s.io/api/lifecycle/v1alpha1/types.go new file mode 100644 index 0000000000..42bbb44cf3 --- /dev/null +++ b/vendor/k8s.io/api/lifecycle/v1alpha1/types.go @@ -0,0 +1,680 @@ +/* +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. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + apimachinerytypes "k8s.io/apimachinery/pkg/types" +) + +const ( + // EvictionResponderImperativeEviction is a default responder that will evict pods using the imperative + // Eviction API (pods//eviction subresource) with a backoff. + EvictionResponderImperativeEviction string = "imperative-eviction.k8s.io/evictor" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.37 +// +k8s:supportsSubresource="/status" + +// EvictionRequest defines a request that should ideally result in a graceful eviction of a +// .spec.target (e.g. termination of a pod). +// +// The evictionrequest-controller observes intents of all EvictionRequests and transforms them into +// Evictions. +// - .spec.requester is set as a label on the Eviction for easier lookup. +// - Each target can have a set of responders assigned to it. Eviction objects are observed by +// these responders, who implement the eviction logic and update the Eviction's status with +// progress. +// +// There is many-to-many relationship between EvictionRequests and Evictions in general. +// And many-to-one if the target is a pod. +// +// If all requesters withdraw their eviction intent for a common target, the eviction will be +// canceled. Deleting an EvictionRequest also counts as a withdrawal. +// Once all EvictionRequest of a target are removed, the corresponding Evictions are eventually +// garbage collected. +// +// +k8s:validation-gen-nolint // Note: remove this when the API got GA +type EvictionRequest struct { + metav1.TypeMeta `json:",inline"` + + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // +optional + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:format=k8s-long-name + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // spec defines the eviction request specification. + // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + // +required + Spec EvictionRequestSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` + + // status represents the most recently observed status of the eviction request. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + // +optional + Status EvictionRequestStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// EvictionRequestSpec is a specification of an EvictionRequest. +type EvictionRequestSpec struct { + // target contains a reference to an object (e.g. a pod) that should be evicted. + // This field is required and immutable. + // +required + // +k8s:immutable + Target EvictionRequestTarget `json:"target" protobuf:"bytes,1,opt,name=target"` + + // requester allows you to identify the entity, that requested the eviction of the target. + // + // It must be a valid domain-prefixed key (such as "acme.io/foo"). + // Domain names *.k8s.io and *.kubernetes.io are reserved. + // This field is required and immutable. + // +required + // +k8s:required + // +k8s:immutable + // +k8s:format=k8s-prefixed-label-key + // +k8s:customValidation + Requester string `json:"requester" protobuf:"bytes,2,opt,name=requester"` + + // intent specifies the action that should be taken for the specified target. + // + // - Eviction means that the requester is interested in the eviction of the target. + // - Withdrawn means that the requester is no longer interested in the eviction of the target. + // If all requesters' intents are withdrawn for a common target, the eviction will be canceled. + // Cancellation consequences: + // - Inactive responders will never run. + // - Active responders are expected to cancel the eviction. + // - Completed or Interrupted responders should not take any action. + // +required + // +k8s:required + Intent EvictionRequestIntent `json:"intent" protobuf:"bytes,3,opt,name=intent,casttype=EvictionRequestIntent"` +} + +// EvictionRequestTarget contains a reference to an object that should be evicted. +// +union +type EvictionRequestTarget struct { + // pod references a pod that is subject to eviction/termination. + // Pods that are part of a PodGroup (.spec.schedulingGroup is set) are not supported. + // +optional + // +k8s:optional + // +k8s:unionMember + Pod *EvictionRequestPodReference `json:"pod,omitempty" protobuf:"bytes,1,opt,name=pod"` +} + +// EvictionRequestPodReference contains enough information to locate the referenced pod inside the +// same namespace. +type EvictionRequestPodReference struct { + // name of the target. + // This field is required. + // +required + // +k8s:required + // +k8s:format=k8s-long-name + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + // uid of the target. + // It can be found in .metadata.uid of the target and is a lowercase UUID in 8-4-4-4-12 format. + // This field is required. + // +required + // +k8s:required + // +k8s:format=k8s-uuid + UID apimachinerytypes.UID `json:"uid" protobuf:"bytes,2,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"` +} + +// EvictionRequestIntent specifies a requester intent. +// +enum +// +k8s:enum +type EvictionRequestIntent string + +// These are intents that can be set by each requester. +const ( + // EvictionRequestIntentEviction means that the requester is interested in the eviction of the target. + EvictionRequestIntentEviction EvictionRequestIntent = "Eviction" + + // EvictionRequestIntentWithdrawn means that the requester is no longer interested in the eviction of the target. + // If all requesters' intents are withdrawn for a common target, the eviction will be canceled. + // Cancellation consequences: + // - Inactive responders will never run. + // - Active responders are expected to cancel the eviction. + // - Completed or Interrupted responders should not take any action. + EvictionRequestIntentWithdrawn EvictionRequestIntent = "Withdrawn" +) + +// EvictionRequestStatus represents the last observed status of the eviction request. +type EvictionRequestStatus struct { + // conditions contain information about the eviction request. + // + // EvictionRequest specific conditions are: TargetEvicted or Failed (managed by evictionrequest-controller). + // - Failed means that the eviction request is no longer being processed + // by any eviction responder. This can happen if the request is canceled or if no responder + // managed to evict the target (e.g. terminate or delete a pod). + // - TargetEvicted means that the target has been evicted (e.g. a pod has been terminated or deleted). + // + // These conditions can be reset if the eviction was unsuccessful and a new Eviction intent has + // been submitted. + // + // The maximum length of the conditions list is 100. + // +optional + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // +k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + // +k8s:maxItems=100 + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + + // observedGeneration is EvictionRequest's .metadata.generation observed by the evictionrequest-controller. + // The observed generation value cannot be negative and can only be incremented. + // The minimum value is 1. + // This field is managed by evictionrequest-controller. + // +optional + // +k8s:optional + // +k8s:minimum=1 + // +k8s:update=NoUnset + // +k8s:monotonic + ObservedGeneration *int64 `json:"observedGeneration,omitempty" protobuf:"varint,2,opt,name=observedGeneration"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.37 + +// EvictionRequestList contains a list of EvictionRequests resources. +type EvictionRequestList struct { + metav1.TypeMeta `json:",inline"` + // metadata is the standard list metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // items is the list of EvictionRequests. + Items []EvictionRequest `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.37 +// +k8s:supportsSubresource="/status" + +// Eviction initiates an eviction process, which should ideally result in a graceful eviction of a +// .spec.target (e.g. termination of a pod). +// +// The evictionrequest-controller observes intents of all EvictionRequests and transforms them into +// Evictions. It manages the Eviction lifecycle. +// Requesters are preserved in .status.requesters even after they have withdrawn their request. +// If all requesters withdraw their eviction intent for a common target, the eviction will be +// canceled. Once all EvictionRequest corresponding to this Eviction .spec.target have been +// removed, this Eviction object will eventually be garbage collected. +// +// If the target is a pod, the .status.targetResponders is populated from Pod's +// .spec.evictionResponders. +// +// Responders should observe and communicate through the .status to help with the eviction +// of the target when they see their state == Active in .status.targetResponders. ResponderStatus +// struct should then be periodically updated to indicate the progress or completion of the eviction +// process by each responder in .status.responders. If .status.responders[].heartbeatTime is not +// updated within the heartbeat deadline defined by the Eviction API (currently 20 minutes), the +// eviction is passed over to the next responder with a lower priority. +// +// If there are no other responders and the target is a pod, the last default +// imperative-eviction.k8s.io/evictor responder with a priority of 100 will evict the pod using the +// imperative Eviction API (pods//eviction subresource). +// +k8s:validation-gen-nolint // Note: remove this when the API got GA +type Eviction struct { + metav1.TypeMeta `json:",inline"` + + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // .metadata.name set by the evictionrequest-controller is purely informative and subject to change. + // .spec.target field should be used to identify the target precisesly. + // + // The requester and responder names will be used as label keys and added to the labels of the + // eviction in one of the following formats: + // 1. acme.io/foo: "requester" + // 2. acme.io/foo: "responder" + // 3. acme.io/foo: "requester-responder" + // + // Please see EvictionParticipantRole for available role label values. + // +optional + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:format=k8s-long-name + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // spec defines the eviction specification. + // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + // +required + Spec EvictionSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` + + // status represents the most recently observed status of the eviction. + // Populated by responders and evictionrequest-controller. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + // +optional + Status EvictionStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// EvictionParticipantRole specifies a role of an eviction participant intent. +type EvictionParticipantRole string + +const ( + // EvictionParticipantRoleRequester identifies a requester which creates EvictionRequests. + EvictionParticipantRoleRequester EvictionParticipantRole = "requester" + + // EvictionParticipantRoleResponder identifies a responder which responds to an Eviction. + EvictionParticipantRoleResponder EvictionParticipantRole = "responder" + + // EvictionParticipantRoleRequesterResponder is both a "requester" and a "responder" at the same time. + EvictionParticipantRoleRequesterResponder EvictionParticipantRole = "requester-responder" +) + +// EvictionSpec is a specification of an Eviction. +type EvictionSpec struct { + // target contains a reference to an object (e.g. a pod) that should be evicted. + // This field is required and immutable. + // +required + // +k8s:immutable + Target EvictionTarget `json:"target" protobuf:"bytes,1,opt,name=target"` +} + +// EvictionTarget contains a reference to an object that should be evicted. +// +union +type EvictionTarget struct { + // pod references a pod that is subject to eviction/termination. + // Pods that are part of a PodGroup (.spec.schedulingGroup is set) are not supported. + // +optional + // +k8s:optional + // +k8s:unionMember + Pod *EvictionPodReference `json:"pod,omitempty" protobuf:"bytes,1,opt,name=pod"` +} + +// EvictionPodReference contains enough information to locate the referenced pod inside the same +// namespace. +type EvictionPodReference struct { + // name of the target. + // This field is required. + // +required + // +k8s:required + // +k8s:format=k8s-long-name + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + // uid of the target. + // It can be found in .metadata.uid of the target and is a lowercase UUID in 8-4-4-4-12 format. + // This field is required. + // +required + // +k8s:required + // +k8s:format=k8s-uuid + UID apimachinerytypes.UID `json:"uid" protobuf:"bytes,2,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"` +} + +// EvictionStatus represents the last observed status of the eviction request. +type EvictionStatus struct { + // conditions contain information about the eviction request. + // + // Eviction specific conditions are: TargetEvicted or Failed (managed by evictionrequest-controller). + // - Failed means that the eviction request is no longer being processed + // by any eviction responder. This can happen if the request is canceled or if no responder + // managed to evict the target (e.g. terminate or delete a pod). + // - TargetEvicted means that the target has been evicted (e.g. a pod has been terminated or deleted). + // + // The maximum length of the conditions list is 100. + // +optional + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // +k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + // +k8s:maxItems=100 + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + + // observedGeneration is Eviction's .metadata.generation observed by the evictionrequest-controller. + // The observed generation value cannot be negative and can only be incremented. + // The minimum value is 1. + // This field is managed by evictionrequest-controller. + // +optional + // +k8s:optional + // +k8s:minimum=1 + // +k8s:monotonic + // +k8s:update=NoUnset + ObservedGeneration *int64 `json:"observedGeneration,omitempty" protobuf:"varint,2,opt,name=observedGeneration"` + + // requesters allow you to identify the entities, that requested the eviction of the target. + // If all the requesters withdraw their eviction intent, the eviction will be canceled. + // + // The maximum length of the requesters list is 100. + // If this limit is exceeded, requesters with Withdrawn intent should be dropped first. + // +optional + // +patchMergeKey=name + // +patchStrategy=merge + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=100 + Requesters []Requester `json:"requesters,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,3,rep,name=requesters"` + + // targetResponders reference responders that should eventually respond to this eviction + // to help with the graceful eviction of a target. These responders are selected sequentially, + // according to their specified priority by setting the Active state to the TargetResponder + // .state field. The maximum number of active responders allowed is 1. + // Eventually each responder can end up in an Interrupted, Canceled or, Completed state. + // Responders should observe these states in order to navigate their lifecycle. + // + // If the target is a pod, the field is populated from Pod's .spec.evictionResponders. Default + // responders may be added to the list according to the target. + // + // Default responders: + // - imperative-eviction.k8s.io/evictor responder with a priority of 100 is added to the list if the + // target is a pod. It will call the imperative Eviction API (pods//eviction subresource). + // This call may not succeed due to PodDisruptionBudgets, which may block the pod termination. + // It will update the responder message and try again with a backoff. + // + // The maximum length of the responders list is 11. + // The length and keys of the list cannot change once set. + // This field is managed by evictionrequest-controller. + // +optional + // +patchMergeKey=name + // +patchStrategy=merge + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=11 + TargetResponders []TargetResponder `json:"targetResponders,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,4,rep,name=targetResponders"` + + // responders represents the eviction process status of each declared responder. + // + // The responder list should be the same length and have the same .name fields as + // .status.targetResponders. Only responders with .name that have Active state in + // .targetResponders[].state should be updated and can be mutated. First initialization + // of the list is allowed. + // + // Each ResponderStatus is initialized by evictionrequest-controller and then managed by + // the designated responder. + // +optional + // +patchMergeKey=name + // +patchStrategy=merge + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=11 + Responders []ResponderStatus `json:"responders,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,5,rep,name=responders"` +} + +type EvictionConditionType string + +// These are built-in conditions of an eviction request. +const ( + // EvictionConditionFailed means that the eviction request is no longer being processed + // by any eviction responder. This can happen if the request is canceled or if no responder + // managed to evict the target (e.g. terminate or delete a pod). + EvictionConditionFailed EvictionConditionType = "Failed" + + // EvictionConditionTargetEvicted means that the target has been evicted (e.g. a pod has been + // terminated or deleted). + EvictionConditionTargetEvicted EvictionConditionType = "TargetEvicted" +) + +type EvictionConditionReason string + +// These are built-in condition reasons of an eviction request. +const ( + // EvictionConditionReasonAwaitingEviction means that this Eviction works as expected and the target + // is scheduled for an eviction. + // This reason is set for the Failed and TargetEvicted condition. + EvictionConditionReasonAwaitingEviction EvictionConditionReason = "AwaitingEviction" + // EvictionConditionReasonEvictionInvalid means that the Eviction is not accepted because the + // initial configuration is not valid. + // This reason is set for the Failed condition. + EvictionConditionReasonEvictionInvalid EvictionConditionReason = "EvictionInvalid" + // EvictionConditionReasonCanceledDueToNoRequesters means that the Eviction is canceled because there is no + // EvictionRequest with the same target and Eviction intent in .spec.intent. + // This reason is set for the Failed condition. + EvictionConditionReasonCanceledDueToNoRequesters EvictionConditionReason = "CanceledDueToNoRequesters" + // EvictionConditionReasonSucceeded means that the Eviction has successfully evicted the target. + // This reason is set for the Failed condition. + EvictionConditionReasonSucceeded EvictionConditionReason = "Succeeded" + // EvictionConditionReasonNoFurtherResponder means that the Eviction responders failed to evict + // the target and that no further responder is available. + // This reason is set for the Failed condition. + EvictionConditionReasonNoFurtherResponder EvictionConditionReason = "NoFurtherResponder" + // EvictionConditionReasonPodDeleted means that the target pod has been deleted. + // This reason is set for the TargetEvicted condition. + EvictionConditionReasonPodDeleted EvictionConditionReason = "PodDeleted" + // EvictionConditionReasonPodTerminal means that the target pod has reached a terminal state. + // This reason is set for the TargetEvicted condition. + EvictionConditionReasonPodTerminal EvictionConditionReason = "PodTerminal" + // EvictionConditionReasonEvictionFailed means that the eviction of the target was unsuccessful. + // This reason is set for the TargetEvicted condition. + EvictionConditionReasonEvictionFailed EvictionConditionReason = "EvictionFailed" +) + +// Requester allows you to identify the entity, that requested the eviction of the target. +// +structType=atomic +type Requester struct { + // name allows you to identify the entity, that requested the eviction of the target. + // + // It must be a valid domain-prefixed key (such as "acme.io/foo"). + // This field must be unique for each requester. + // This field is required. + // +required + // +k8s:required + // +k8s:format=k8s-prefixed-label-key + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + + // intent specifies the action that should be taken for the specified target. + // + // - Eviction means that the requester is interested in the eviction of the target. + // - Withdrawn means that the requester is no longer interested in the eviction of the target. + // If all requesters' intents are withdrawn, the eviction will be canceled. + // Cancellation consequences: + // - Inactive responders will never run. + // - Active responders are expected to cancel the eviction. + // - Completed or Interrupted responders should not take any action. + // +required + // +k8s:required + Intent RequesterIntent `json:"intent" protobuf:"bytes,2,opt,name=intent,casttype=RequesterIntent"` +} + +// RequesterIntent specifies a requester intent. +// +enum +// +k8s:enum +type RequesterIntent string + +// These are intents that can be set by each requester. +const ( + // RequesterIntentEviction means that the requester is interested in the eviction of the target. + RequesterIntentEviction RequesterIntent = "Eviction" + + // RequesterIntentWithdrawn means that the requester is no longer interested in the eviction of the target. + // If all requesters' intents are withdrawn, the eviction will be canceled. + // Cancellation consequences: + // - Inactive responders will never run. + // - Active responders are expected to cancel the eviction. + // - Completed or Interrupted responders should not take any action. + RequesterIntentWithdrawn RequesterIntent = "Withdrawn" +) + +// TargetResponder allows you to specify the responder reacting to the Eviction. +// Responders should observe and communicate through the Eviction API (see .state) to help +// with the graceful eviction of a target (e.g. termination of a pod). +// +structType=atomic +type TargetResponder struct { + // name allows you to identify the responder reacting to the Eviction. + // + // It must be a valid domain-prefixed key (such as "acme.io/foo"). + // This field must be unique for each responder. + // This field is required. + // +required + // +k8s:required + // +k8s:format=k8s-prefixed-label-key + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + + // priority for this responder. Higher priorities are selected first by the evictionrequest-controller. + // If there are responders with the same priority, the responder whose domain name comes first in the + // alphabetical higher domain order, will be picked. This means that the top domain labels are compared + // alphabetically first, followed by the lower domain labels. The key is compared last. + // + // The responder that is the managing controller of the pod should set the value of + // this field to 10000 to allow both for preemption or fallback registration by other + // responders. + // + // The minimum value is 0 and the maximum value is 100000. + // The interval 0-999 is reserved for responders with *.k8s.io suffix. + // This field is required and immutable. + // +required + // +k8s:required + // +k8s:minimum=0 + // +k8s:maximum=100000 + // +k8s:update=NoModify + // +k8s:update=NoUnset + Priority *int32 `json:"priority" protobuf:"varint,2,opt,name=priority"` + + // state specifies a state that is assigned by the evictionrequest-controller. Responders should observe + // this state in order to navigate their lifecycle. + // - Inactive means that the responder should not yet process this eviction request. + // - Active means that the responder is either running or expected to start soon. + // Also, startTime has been set in the ResponderStatus by the evictionrequest-controller. + // + // An active responder should currently interact with the eviction process by updating + // .status.responders, where .name is the active responder name. ResponderStatus fields + // should be periodically updated to indicate the progress or completion of the eviction process. + // If .status.responders[].heartbeatTime field is not updated within the heartbeat deadline defined + // by the Eviction API (currently 20 minutes), the eviction is passed over to the next responder + // with a lower priority. Only one responder can be active at a time. + // - Interrupted means that the responder has failed to start or failed to update + // heartbeatTime in ResponderStatus in a timely manner. + // - Canceled means that the responder has been canceled. In other words, there is no + // EvictionRequest with the same target and Eviction intent in .spec.intent. + // - Completed means that the responder has successfully completed and set completionTime + // in ResponderStatus. + // + // Please refer to the ResponderStatus in .status.responders for more details on each responder. + // +required + // +k8s:required + State ResponderStateType `json:"state" protobuf:"bytes,3,opt,name=state,casttype=ResponderStateType"` +} + +// ResponderStateType specifies a state that is assigned by the evictionrequest-controller. +// +enum +// +k8s:enum +type ResponderStateType string + +const ( + // ResponderStateInactive means that the responder should not yet process this eviction request. + ResponderStateInactive ResponderStateType = "Inactive" + + // ResponderStateActive means that the responder is either running or expected to start soon. + // Also, startTime has been set in the ResponderStatus by the evictionrequest-controller. + // + // An active responder should currently interact with the eviction process by updating + // .status.responders, where .name is the active responder name. ResponderStatus fields + // should be periodically updated to indicate the progress or completion of the eviction process. + // If .status.responders[].heartbeatTime field is not updated within the heartbeat deadline defined + // by the Eviction API (currently 20 minutes), the eviction is passed over to the next responder + // with a lower priority. Only one responder can be active at a time. + ResponderStateActive ResponderStateType = "Active" + + // ResponderStateInterrupted means that the responder has failed to start or failed to update + // heartbeatTime in ResponderStatus in a timely manner. + ResponderStateInterrupted ResponderStateType = "Interrupted" + + // ResponderStateCanceled means that the responder has been canceled. In other words, there + // is no EvictionRequest with the same target and Eviction intent in .spec.intent. + ResponderStateCanceled ResponderStateType = "Canceled" + + // ResponderStateCompleted means that the responder has successfully completed and set completionTime + // in ResponderStatus. + ResponderStateCompleted ResponderStateType = "Completed" +) + +// ResponderStatus represents the last observed status of the eviction process of the responder. +// It should be only updated by the designated responder whose name is .name field. +// +structType=granular +type ResponderStatus struct { + // name allows you to identify the responder reacting to the Eviction. + // + // It must be a valid domain-prefixed key (such as "acme.io/foo"). + // This field is initialized by Kubernetes and must be unique for each responder. + // This field is required. + // +required + // +k8s:required + // +k8s:format=k8s-prefixed-label-key + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + + // startTime tracks the time at which this responder was designated as active and should start + // processing the eviction request. + // It should reflect the present time when set. + // This field is initialized by Kubernetes when this responder becomes active. + // This field becomes immutable once set. + // +optional + // +k8s:optional + // +k8s:update=NoModify + // +k8s:update=NoUnset + StartTime *metav1.Time `json:"startTime,omitempty" protobuf:"bytes,2,opt,name=startTime"` + + // heartbeatTime is the last time at which the eviction process was reported to be in progress + // by the responder. + // It should reflect the present time when set. + // Responders should avoid heartbeats more frequent than 20 seconds to avoid overloading the + // control-plane. + // +optional + // +k8s:optional + HeartbeatTime *metav1.Time `json:"heartbeatTime,omitempty" protobuf:"bytes,3,opt,name=heartbeatTime"` + + // expectedCompletionTime is the time at which the eviction process step is expected to end for the + // responder. + // The time cannot be set to the past. + // May be omitted if no estimate can be made. + // +optional + // +k8s:optional + ExpectedCompletionTime *metav1.Time `json:"expectedCompletionTime,omitempty" protobuf:"bytes,4,opt,name=expectedCompletionTime"` + + // completionTime tracks the time at which the Responder stopped processing the eviction request. + // Completion means that the responders has either fully or partially completed the + // eviction process, which may have resulted in target eviction (e.g. pod termination). + // It should reflect the present time when set. + // This field becomes immutable once set. + // +optional + // +k8s:optional + // +k8s:update=NoModify + // +k8s:update=NoUnset + CompletionTime *metav1.Time `json:"completionTime,omitempty" protobuf:"bytes,5,opt,name=completionTime"` + + // message provides human-readable details about the state of the responder and the eviction + // process. + // Maximum length is 4000 characters. + // +optional + // +k8s:optional + // +k8s:maxLength=4000 + Message *string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.37 + +// EvictionList contains a list of Eviction resources. +type EvictionList struct { + metav1.TypeMeta `json:",inline"` + // metadata is the standard list metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // items is the list of Evictions. + Items []Eviction `json:"items" protobuf:"bytes,2,rep,name=items"` +} diff --git a/vendor/k8s.io/api/lifecycle/v1alpha1/types_swagger_doc_generated.go b/vendor/k8s.io/api/lifecycle/v1alpha1/types_swagger_doc_generated.go new file mode 100644 index 0000000000..3646f84345 --- /dev/null +++ b/vendor/k8s.io/api/lifecycle/v1alpha1/types_swagger_doc_generated.go @@ -0,0 +1,188 @@ +/* +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. +*/ + +package v1alpha1 + +// This file contains a collection of methods that can be used from go-restful to +// generate Swagger API documentation for its models. Please read this PR for more +// information on the implementation: https://github.com/emicklei/go-restful/pull/215 +// +// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if +// they are on one line! For multiple line or blocks that you want to ignore use ---. +// Any context after a --- is ignored. +// +// Those methods can be generated by using hack/update-codegen.sh + +// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. +var map_Eviction = map[string]string{ + "": "Eviction initiates an eviction process, which should ideally result in a graceful eviction of a .spec.target (e.g. termination of a pod).\n\nThe evictionrequest-controller observes intents of all EvictionRequests and transforms them into Evictions. It manages the Eviction lifecycle. Requesters are preserved in .status.requesters even after they have withdrawn their request. If all requesters withdraw their eviction intent for a common target, the eviction will be canceled. Once all EvictionRequest corresponding to this Eviction .spec.target have been removed, this Eviction object will eventually be garbage collected.\n\nIf the target is a pod, the .status.targetResponders is populated from Pod's .spec.evictionResponders.\n\nResponders should observe and communicate through the .status to help with the eviction of the target when they see their state == Active in .status.targetResponders. ResponderStatus struct should then be periodically updated to indicate the progress or completion of the eviction process by each responder in .status.responders. If .status.responders[].heartbeatTime is not updated within the heartbeat deadline defined by the Eviction API (currently 20 minutes), the eviction is passed over to the next responder with a lower priority.\n\nIf there are no other responders and the target is a pod, the last default imperative-eviction.k8s.io/evictor responder with a priority of 100 will evict the pod using the imperative Eviction API (pods//eviction subresource).", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. .metadata.name set by the evictionrequest-controller is purely informative and subject to change. .spec.target field should be used to identify the target precisesly.\n\nThe requester and responder names will be used as label keys and added to the labels of the eviction in one of the following formats: 1. acme.io/foo: \"requester\" 2. acme.io/foo: \"responder\" 3. acme.io/foo: \"requester-responder\"\n\nPlease see EvictionParticipantRole for available role label values.", + "spec": "spec defines the eviction specification. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", + "status": "status represents the most recently observed status of the eviction. Populated by responders and evictionrequest-controller. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", +} + +func (Eviction) SwaggerDoc() map[string]string { + return map_Eviction +} + +var map_EvictionList = map[string]string{ + "": "EvictionList contains a list of Eviction resources.", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "items": "items is the list of Evictions.", +} + +func (EvictionList) SwaggerDoc() map[string]string { + return map_EvictionList +} + +var map_EvictionPodReference = map[string]string{ + "": "EvictionPodReference contains enough information to locate the referenced pod inside the same namespace.", + "name": "name of the target. This field is required.", + "uid": "uid of the target. It can be found in .metadata.uid of the target and is a lowercase UUID in 8-4-4-4-12 format. This field is required.", +} + +func (EvictionPodReference) SwaggerDoc() map[string]string { + return map_EvictionPodReference +} + +var map_EvictionRequest = map[string]string{ + "": "EvictionRequest defines a request that should ideally result in a graceful eviction of a .spec.target (e.g. termination of a pod).\n\nThe evictionrequest-controller observes intents of all EvictionRequests and transforms them into Evictions.\n - .spec.requester is set as a label on the Eviction for easier lookup.\n - Each target can have a set of responders assigned to it. Eviction objects are observed by\n these responders, who implement the eviction logic and update the Eviction's status with\n progress.\n\nThere is many-to-many relationship between EvictionRequests and Evictions in general. And many-to-one if the target is a pod.\n\nIf all requesters withdraw their eviction intent for a common target, the eviction will be canceled. Deleting an EvictionRequest also counts as a withdrawal. Once all EvictionRequest of a target are removed, the corresponding Evictions are eventually garbage collected.", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", + "spec": "spec defines the eviction request specification. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", + "status": "status represents the most recently observed status of the eviction request. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", +} + +func (EvictionRequest) SwaggerDoc() map[string]string { + return map_EvictionRequest +} + +var map_EvictionRequestList = map[string]string{ + "": "EvictionRequestList contains a list of EvictionRequests resources.", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "items": "items is the list of EvictionRequests.", +} + +func (EvictionRequestList) SwaggerDoc() map[string]string { + return map_EvictionRequestList +} + +var map_EvictionRequestPodReference = map[string]string{ + "": "EvictionRequestPodReference contains enough information to locate the referenced pod inside the same namespace.", + "name": "name of the target. This field is required.", + "uid": "uid of the target. It can be found in .metadata.uid of the target and is a lowercase UUID in 8-4-4-4-12 format. This field is required.", +} + +func (EvictionRequestPodReference) SwaggerDoc() map[string]string { + return map_EvictionRequestPodReference +} + +var map_EvictionRequestSpec = map[string]string{ + "": "EvictionRequestSpec is a specification of an EvictionRequest.", + "target": "target contains a reference to an object (e.g. a pod) that should be evicted. This field is required and immutable.", + "requester": "requester allows you to identify the entity, that requested the eviction of the target.\n\nIt must be a valid domain-prefixed key (such as \"acme.io/foo\"). Domain names *.k8s.io and *.kubernetes.io are reserved. This field is required and immutable.", + "intent": "intent specifies the action that should be taken for the specified target.\n\n- Eviction means that the requester is interested in the eviction of the target. - Withdrawn means that the requester is no longer interested in the eviction of the target.\n If all requesters' intents are withdrawn for a common target, the eviction will be canceled.\n Cancellation consequences:\n - Inactive responders will never run.\n - Active responders are expected to cancel the eviction.\n - Completed or Interrupted responders should not take any action.", +} + +func (EvictionRequestSpec) SwaggerDoc() map[string]string { + return map_EvictionRequestSpec +} + +var map_EvictionRequestStatus = map[string]string{ + "": "EvictionRequestStatus represents the last observed status of the eviction request.", + "conditions": "conditions contain information about the eviction request.\n\nEvictionRequest specific conditions are: TargetEvicted or Failed (managed by evictionrequest-controller). - Failed means that the eviction request is no longer being processed\n by any eviction responder. This can happen if the request is canceled or if no responder\n managed to evict the target (e.g. terminate or delete a pod).\n- TargetEvicted means that the target has been evicted (e.g. a pod has been terminated or deleted).\n\nThese conditions can be reset if the eviction was unsuccessful and a new Eviction intent has been submitted.\n\nThe maximum length of the conditions list is 100.", + "observedGeneration": "observedGeneration is EvictionRequest's .metadata.generation observed by the evictionrequest-controller. The observed generation value cannot be negative and can only be incremented. The minimum value is 1. This field is managed by evictionrequest-controller.", +} + +func (EvictionRequestStatus) SwaggerDoc() map[string]string { + return map_EvictionRequestStatus +} + +var map_EvictionRequestTarget = map[string]string{ + "": "EvictionRequestTarget contains a reference to an object that should be evicted.", + "pod": "pod references a pod that is subject to eviction/termination. Pods that are part of a PodGroup (.spec.schedulingGroup is set) are not supported.", +} + +func (EvictionRequestTarget) SwaggerDoc() map[string]string { + return map_EvictionRequestTarget +} + +var map_EvictionSpec = map[string]string{ + "": "EvictionSpec is a specification of an Eviction.", + "target": "target contains a reference to an object (e.g. a pod) that should be evicted. This field is required and immutable.", +} + +func (EvictionSpec) SwaggerDoc() map[string]string { + return map_EvictionSpec +} + +var map_EvictionStatus = map[string]string{ + "": "EvictionStatus represents the last observed status of the eviction request.", + "conditions": "conditions contain information about the eviction request.\n\nEviction specific conditions are: TargetEvicted or Failed (managed by evictionrequest-controller). - Failed means that the eviction request is no longer being processed\n by any eviction responder. This can happen if the request is canceled or if no responder\n managed to evict the target (e.g. terminate or delete a pod).\n- TargetEvicted means that the target has been evicted (e.g. a pod has been terminated or deleted).\n\n\tThe maximum length of the conditions list is 100.", + "observedGeneration": "observedGeneration is Eviction's .metadata.generation observed by the evictionrequest-controller. The observed generation value cannot be negative and can only be incremented. The minimum value is 1. This field is managed by evictionrequest-controller.", + "requesters": "requesters allow you to identify the entities, that requested the eviction of the target. If all the requesters withdraw their eviction intent, the eviction will be canceled.\n\nThe maximum length of the requesters list is 100. If this limit is exceeded, requesters with Withdrawn intent should be dropped first.", + "targetResponders": "targetResponders reference responders that should eventually respond to this eviction to help with the graceful eviction of a target. These responders are selected sequentially, according to their specified priority by setting the Active state to the TargetResponder .state field. The maximum number of active responders allowed is 1. Eventually each responder can end up in an Interrupted, Canceled or, Completed state. Responders should observe these states in order to navigate their lifecycle.\n\nIf the target is a pod, the field is populated from Pod's .spec.evictionResponders. Default responders may be added to the list according to the target.\n\nDefault responders: - imperative-eviction.k8s.io/evictor responder with a priority of 100 is added to the list if the\n target is a pod. It will call the imperative Eviction API (pods//eviction subresource).\n This call may not succeed due to PodDisruptionBudgets, which may block the pod termination.\n It will update the responder message and try again with a backoff.\n\nThe maximum length of the responders list is 11. The length and keys of the list cannot change once set. This field is managed by evictionrequest-controller.", + "responders": "responders represents the eviction process status of each declared responder.\n\nThe responder list should be the same length and have the same .name fields as .status.targetResponders. Only responders with .name that have Active state in .targetResponders[].state should be updated and can be mutated. First initialization of the list is allowed.\n\nEach ResponderStatus is initialized by evictionrequest-controller and then managed by the designated responder.", +} + +func (EvictionStatus) SwaggerDoc() map[string]string { + return map_EvictionStatus +} + +var map_EvictionTarget = map[string]string{ + "": "EvictionTarget contains a reference to an object that should be evicted.", + "pod": "pod references a pod that is subject to eviction/termination. Pods that are part of a PodGroup (.spec.schedulingGroup is set) are not supported.", +} + +func (EvictionTarget) SwaggerDoc() map[string]string { + return map_EvictionTarget +} + +var map_Requester = map[string]string{ + "": "Requester allows you to identify the entity, that requested the eviction of the target.", + "name": "name allows you to identify the entity, that requested the eviction of the target.\n\nIt must be a valid domain-prefixed key (such as \"acme.io/foo\"). This field must be unique for each requester. This field is required.", + "intent": "intent specifies the action that should be taken for the specified target.\n\n- Eviction means that the requester is interested in the eviction of the target. - Withdrawn means that the requester is no longer interested in the eviction of the target.\n If all requesters' intents are withdrawn, the eviction will be canceled.\n Cancellation consequences:\n - Inactive responders will never run.\n - Active responders are expected to cancel the eviction.\n - Completed or Interrupted responders should not take any action.", +} + +func (Requester) SwaggerDoc() map[string]string { + return map_Requester +} + +var map_ResponderStatus = map[string]string{ + "": "ResponderStatus represents the last observed status of the eviction process of the responder. It should be only updated by the designated responder whose name is .name field.", + "name": "name allows you to identify the responder reacting to the Eviction.\n\nIt must be a valid domain-prefixed key (such as \"acme.io/foo\"). This field is initialized by Kubernetes and must be unique for each responder. This field is required.", + "startTime": "startTime tracks the time at which this responder was designated as active and should start processing the eviction request. It should reflect the present time when set. This field is initialized by Kubernetes when this responder becomes active. This field becomes immutable once set.", + "heartbeatTime": "heartbeatTime is the last time at which the eviction process was reported to be in progress by the responder. It should reflect the present time when set. Responders should avoid heartbeats more frequent than 20 seconds to avoid overloading the control-plane.", + "expectedCompletionTime": "expectedCompletionTime is the time at which the eviction process step is expected to end for the responder. The time cannot be set to the past. May be omitted if no estimate can be made.", + "completionTime": "completionTime tracks the time at which the Responder stopped processing the eviction request. Completion means that the responders has either fully or partially completed the eviction process, which may have resulted in target eviction (e.g. pod termination). It should reflect the present time when set. This field becomes immutable once set.", + "message": "message provides human-readable details about the state of the responder and the eviction process. Maximum length is 4000 characters.", +} + +func (ResponderStatus) SwaggerDoc() map[string]string { + return map_ResponderStatus +} + +var map_TargetResponder = map[string]string{ + "": "TargetResponder allows you to specify the responder reacting to the Eviction. Responders should observe and communicate through the Eviction API (see .state) to help with the graceful eviction of a target (e.g. termination of a pod).", + "name": "name allows you to identify the responder reacting to the Eviction.\n\nIt must be a valid domain-prefixed key (such as \"acme.io/foo\"). This field must be unique for each responder. This field is required.", + "priority": "priority for this responder. Higher priorities are selected first by the evictionrequest-controller. If there are responders with the same priority, the responder whose domain name comes first in the alphabetical higher domain order, will be picked. This means that the top domain labels are compared alphabetically first, followed by the lower domain labels. The key is compared last.\n\nThe responder that is the managing controller of the pod should set the value of this field to 10000 to allow both for preemption or fallback registration by other responders.\n\nThe minimum value is 0 and the maximum value is 100000. The interval 0-999 is reserved for responders with *.k8s.io suffix. This field is required and immutable.", + "state": "state specifies a state that is assigned by the evictionrequest-controller. Responders should observe this state in order to navigate their lifecycle. - Inactive means that the responder should not yet process this eviction request. - Active means that the responder is either running or expected to start soon.\n Also, startTime has been set in the ResponderStatus by the evictionrequest-controller.\n\n An active responder should currently interact with the eviction process by updating\n .status.responders, where .name is the active responder name. ResponderStatus fields\n should be periodically updated to indicate the progress or completion of the eviction process.\n If .status.responders[].heartbeatTime field is not updated within the heartbeat deadline defined\n by the Eviction API (currently 20 minutes), the eviction is passed over to the next responder\n\t with a lower priority. Only one responder can be active at a time.\n- Interrupted means that the responder has failed to start or failed to update\n heartbeatTime in ResponderStatus in a timely manner.\n- Canceled means that the responder has been canceled. In other words, there\tis no\n EvictionRequest with the same target and Eviction intent in .spec.intent.\n- Completed means that the responder has successfully completed and set completionTime\n in ResponderStatus.\n\nPlease refer to the ResponderStatus in .status.responders for more details on each responder.", +} + +func (TargetResponder) SwaggerDoc() map[string]string { + return map_TargetResponder +} + +// AUTO-GENERATED FUNCTIONS END HERE diff --git a/vendor/k8s.io/api/lifecycle/v1alpha1/zz_generated.deepcopy.go b/vendor/k8s.io/api/lifecycle/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..1b71bb99fe --- /dev/null +++ b/vendor/k8s.io/api/lifecycle/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,406 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Eviction) DeepCopyInto(out *Eviction) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Eviction. +func (in *Eviction) DeepCopy() *Eviction { + if in == nil { + return nil + } + out := new(Eviction) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Eviction) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EvictionList) DeepCopyInto(out *EvictionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Eviction, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EvictionList. +func (in *EvictionList) DeepCopy() *EvictionList { + if in == nil { + return nil + } + out := new(EvictionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EvictionList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EvictionPodReference) DeepCopyInto(out *EvictionPodReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EvictionPodReference. +func (in *EvictionPodReference) DeepCopy() *EvictionPodReference { + if in == nil { + return nil + } + out := new(EvictionPodReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EvictionRequest) DeepCopyInto(out *EvictionRequest) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EvictionRequest. +func (in *EvictionRequest) DeepCopy() *EvictionRequest { + if in == nil { + return nil + } + out := new(EvictionRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EvictionRequest) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EvictionRequestList) DeepCopyInto(out *EvictionRequestList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EvictionRequest, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EvictionRequestList. +func (in *EvictionRequestList) DeepCopy() *EvictionRequestList { + if in == nil { + return nil + } + out := new(EvictionRequestList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EvictionRequestList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EvictionRequestPodReference) DeepCopyInto(out *EvictionRequestPodReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EvictionRequestPodReference. +func (in *EvictionRequestPodReference) DeepCopy() *EvictionRequestPodReference { + if in == nil { + return nil + } + out := new(EvictionRequestPodReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EvictionRequestSpec) DeepCopyInto(out *EvictionRequestSpec) { + *out = *in + in.Target.DeepCopyInto(&out.Target) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EvictionRequestSpec. +func (in *EvictionRequestSpec) DeepCopy() *EvictionRequestSpec { + if in == nil { + return nil + } + out := new(EvictionRequestSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EvictionRequestStatus) DeepCopyInto(out *EvictionRequestStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ObservedGeneration != nil { + in, out := &in.ObservedGeneration, &out.ObservedGeneration + *out = new(int64) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EvictionRequestStatus. +func (in *EvictionRequestStatus) DeepCopy() *EvictionRequestStatus { + if in == nil { + return nil + } + out := new(EvictionRequestStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EvictionRequestTarget) DeepCopyInto(out *EvictionRequestTarget) { + *out = *in + if in.Pod != nil { + in, out := &in.Pod, &out.Pod + *out = new(EvictionRequestPodReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EvictionRequestTarget. +func (in *EvictionRequestTarget) DeepCopy() *EvictionRequestTarget { + if in == nil { + return nil + } + out := new(EvictionRequestTarget) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EvictionSpec) DeepCopyInto(out *EvictionSpec) { + *out = *in + in.Target.DeepCopyInto(&out.Target) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EvictionSpec. +func (in *EvictionSpec) DeepCopy() *EvictionSpec { + if in == nil { + return nil + } + out := new(EvictionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EvictionStatus) DeepCopyInto(out *EvictionStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ObservedGeneration != nil { + in, out := &in.ObservedGeneration, &out.ObservedGeneration + *out = new(int64) + **out = **in + } + if in.Requesters != nil { + in, out := &in.Requesters, &out.Requesters + *out = make([]Requester, len(*in)) + copy(*out, *in) + } + if in.TargetResponders != nil { + in, out := &in.TargetResponders, &out.TargetResponders + *out = make([]TargetResponder, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Responders != nil { + in, out := &in.Responders, &out.Responders + *out = make([]ResponderStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EvictionStatus. +func (in *EvictionStatus) DeepCopy() *EvictionStatus { + if in == nil { + return nil + } + out := new(EvictionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EvictionTarget) DeepCopyInto(out *EvictionTarget) { + *out = *in + if in.Pod != nil { + in, out := &in.Pod, &out.Pod + *out = new(EvictionPodReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EvictionTarget. +func (in *EvictionTarget) DeepCopy() *EvictionTarget { + if in == nil { + return nil + } + out := new(EvictionTarget) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Requester) DeepCopyInto(out *Requester) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Requester. +func (in *Requester) DeepCopy() *Requester { + if in == nil { + return nil + } + out := new(Requester) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResponderStatus) DeepCopyInto(out *ResponderStatus) { + *out = *in + if in.StartTime != nil { + in, out := &in.StartTime, &out.StartTime + *out = (*in).DeepCopy() + } + if in.HeartbeatTime != nil { + in, out := &in.HeartbeatTime, &out.HeartbeatTime + *out = (*in).DeepCopy() + } + if in.ExpectedCompletionTime != nil { + in, out := &in.ExpectedCompletionTime, &out.ExpectedCompletionTime + *out = (*in).DeepCopy() + } + if in.CompletionTime != nil { + in, out := &in.CompletionTime, &out.CompletionTime + *out = (*in).DeepCopy() + } + if in.Message != nil { + in, out := &in.Message, &out.Message + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResponderStatus. +func (in *ResponderStatus) DeepCopy() *ResponderStatus { + if in == nil { + return nil + } + out := new(ResponderStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetResponder) DeepCopyInto(out *TargetResponder) { + *out = *in + if in.Priority != nil { + in, out := &in.Priority, &out.Priority + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetResponder. +func (in *TargetResponder) DeepCopy() *TargetResponder { + if in == nil { + return nil + } + out := new(TargetResponder) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/k8s.io/api/lifecycle/v1alpha1/zz_generated.model_name.go b/vendor/k8s.io/api/lifecycle/v1alpha1/zz_generated.model_name.go new file mode 100644 index 0000000000..69d36f25fa --- /dev/null +++ b/vendor/k8s.io/api/lifecycle/v1alpha1/zz_generated.model_name.go @@ -0,0 +1,97 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by openapi-gen. DO NOT EDIT. + +package v1alpha1 + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in Eviction) OpenAPIModelName() string { + return "io.k8s.api.lifecycle.v1alpha1.Eviction" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EvictionList) OpenAPIModelName() string { + return "io.k8s.api.lifecycle.v1alpha1.EvictionList" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EvictionPodReference) OpenAPIModelName() string { + return "io.k8s.api.lifecycle.v1alpha1.EvictionPodReference" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EvictionRequest) OpenAPIModelName() string { + return "io.k8s.api.lifecycle.v1alpha1.EvictionRequest" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EvictionRequestList) OpenAPIModelName() string { + return "io.k8s.api.lifecycle.v1alpha1.EvictionRequestList" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EvictionRequestPodReference) OpenAPIModelName() string { + return "io.k8s.api.lifecycle.v1alpha1.EvictionRequestPodReference" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EvictionRequestSpec) OpenAPIModelName() string { + return "io.k8s.api.lifecycle.v1alpha1.EvictionRequestSpec" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EvictionRequestStatus) OpenAPIModelName() string { + return "io.k8s.api.lifecycle.v1alpha1.EvictionRequestStatus" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EvictionRequestTarget) OpenAPIModelName() string { + return "io.k8s.api.lifecycle.v1alpha1.EvictionRequestTarget" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EvictionSpec) OpenAPIModelName() string { + return "io.k8s.api.lifecycle.v1alpha1.EvictionSpec" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EvictionStatus) OpenAPIModelName() string { + return "io.k8s.api.lifecycle.v1alpha1.EvictionStatus" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EvictionTarget) OpenAPIModelName() string { + return "io.k8s.api.lifecycle.v1alpha1.EvictionTarget" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in Requester) OpenAPIModelName() string { + return "io.k8s.api.lifecycle.v1alpha1.Requester" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in ResponderStatus) OpenAPIModelName() string { + return "io.k8s.api.lifecycle.v1alpha1.ResponderStatus" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in TargetResponder) OpenAPIModelName() string { + return "io.k8s.api.lifecycle.v1alpha1.TargetResponder" +} diff --git a/vendor/k8s.io/api/lifecycle/v1alpha1/zz_generated.prerelease-lifecycle.go b/vendor/k8s.io/api/lifecycle/v1alpha1/zz_generated.prerelease-lifecycle.go new file mode 100644 index 0000000000..b4fbbf6951 --- /dev/null +++ b/vendor/k8s.io/api/lifecycle/v1alpha1/zz_generated.prerelease-lifecycle.go @@ -0,0 +1,94 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by prerelease-lifecycle-gen. DO NOT EDIT. + +package v1alpha1 + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *Eviction) APILifecycleIntroduced() (major, minor int) { + return 1, 37 +} + +// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. +func (in *Eviction) APILifecycleDeprecated() (major, minor int) { + return 1, 40 +} + +// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. +func (in *Eviction) APILifecycleRemoved() (major, minor int) { + return 1, 43 +} + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *EvictionList) APILifecycleIntroduced() (major, minor int) { + return 1, 37 +} + +// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. +func (in *EvictionList) APILifecycleDeprecated() (major, minor int) { + return 1, 40 +} + +// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. +func (in *EvictionList) APILifecycleRemoved() (major, minor int) { + return 1, 43 +} + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *EvictionRequest) APILifecycleIntroduced() (major, minor int) { + return 1, 37 +} + +// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. +func (in *EvictionRequest) APILifecycleDeprecated() (major, minor int) { + return 1, 40 +} + +// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. +func (in *EvictionRequest) APILifecycleRemoved() (major, minor int) { + return 1, 43 +} + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *EvictionRequestList) APILifecycleIntroduced() (major, minor int) { + return 1, 37 +} + +// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. +func (in *EvictionRequestList) APILifecycleDeprecated() (major, minor int) { + return 1, 40 +} + +// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. +func (in *EvictionRequestList) APILifecycleRemoved() (major, minor int) { + return 1, 43 +} diff --git a/vendor/k8s.io/api/networking/v1/generated.proto b/vendor/k8s.io/api/networking/v1/generated.proto index 26dcfdfcc3..8394f2dc08 100644 --- a/vendor/k8s.io/api/networking/v1/generated.proto +++ b/vendor/k8s.io/api/networking/v1/generated.proto @@ -80,7 +80,7 @@ message HTTPIngressRuleValue { // Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1 // Invalid: 10.01.2.3 or 2001:db8:0:0:0::1 message IPAddress { - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -104,11 +104,11 @@ message IPAddressList { // IPAddressSpec describe the attributes in an IP Address. message IPAddressSpec { - // ParentRef references the resource that an IPAddress is attached to. + // parentRef references the resource that an IPAddress is attached to. // An IPAddress must reference a parent object. // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:immutable optional ParentReference parentRef = 1; } @@ -119,7 +119,7 @@ message IPBlock { // cidr is a string representing the IPBlock // Valid examples are "192.168.1.0/24" or "2001:db8::/64" // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string cidr = 1; // except is a slice of CIDRs that should not be included within an IPBlock @@ -134,8 +134,9 @@ message IPBlock { // endpoints defined by a backend. An Ingress can be configured to give services // externally-reachable urls, load balance traffic, terminate SSL, offer name // based virtual hosting etc. +// +k8s:supportsSubresource="/status" message Ingress { - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -172,7 +173,7 @@ message IngressBackend { // single IngressClass resource has this annotation set to true, new Ingress // resources without a class specified will be assigned this default class. message IngressClass { - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -204,12 +205,12 @@ message IngressClassParametersReference { // kind is the type of resource being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string kind = 2; // name is the name of resource being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string name = 3; // scope represents if this refers to a cluster or namespace scoped resource. @@ -238,7 +239,7 @@ message IngressClassSpec { // configuration for the controller. This is optional if the controller does // not require extra parameters. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional IngressClassParametersReference parameters = 2; } @@ -344,6 +345,7 @@ message IngressRule { // mixing different types of rules in a single Ingress is disallowed, so exactly // one of the following must be set. message IngressRuleValue { + // http is a HTTP IngressRuleValue, which contains a list of http selectors // +optional optional HTTPIngressRuleValue http = 1; } @@ -425,7 +427,7 @@ message IngressTLS { // NetworkPolicy describes what network traffic is allowed for a set of Pods message NetworkPolicy { - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -455,7 +457,7 @@ message NetworkPolicyEgressRule { // allows traffic only if the traffic matches at least one item in the to list. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated NetworkPolicyPeer to = 2; } @@ -478,7 +480,7 @@ message NetworkPolicyIngressRule { // allows traffic only if the traffic matches at least one item in the from list. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated NetworkPolicyPeer from = 2; } @@ -517,7 +519,7 @@ message NetworkPolicyPeer { // ipBlock defines policy on a particular IPBlock. If this field is set then // neither of the other fields can be. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional IPBlock ipBlock = 3; } @@ -563,7 +565,7 @@ message NetworkPolicySpec { // solely to ensure that the pods it selects are isolated by default) // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated NetworkPolicyIngressRule ingress = 2; // egress is a list of egress rules to be applied to the selected pods. Outgoing traffic @@ -575,7 +577,7 @@ message NetworkPolicySpec { // This field is beta-level in 1.8 // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated NetworkPolicyEgressRule egress = 3; // policyTypes is a list of rule types that the NetworkPolicy relates to. @@ -595,22 +597,22 @@ message NetworkPolicySpec { // ParentReference describes a reference to a parent object. message ParentReference { - // Group is the group of the object being referenced. + // group is the group of the object being referenced. // +optional optional string group = 1; - // Resource is the resource of the object being referenced. + // resource is the resource of the object being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string resource = 2; - // Namespace is the namespace of the object being referenced. + // namespace is the namespace of the object being referenced. // +optional optional string namespace = 3; - // Name is the name of the object being referenced. + // name is the name of the object being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string name = 4; } @@ -630,8 +632,9 @@ message ServiceBackendPort { // ServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64). // This range is used to allocate ClusterIPs to Service objects. +// +k8s:supportsSubresource="/status" message ServiceCIDR { - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -660,7 +663,7 @@ message ServiceCIDRList { // ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services. message ServiceCIDRSpec { - // CIDRs defines the IP blocks in CIDR notation (e.g. "192.168.0.0/24" or "2001:db8::/64") + // cidrs defines the IP blocks in CIDR notation (e.g. "192.168.0.0/24" or "2001:db8::/64") // from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family. // This field is immutable. // +optional @@ -677,6 +680,7 @@ message ServiceCIDRStatus { // +patchStrategy=merge // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:opaqueType repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1; } diff --git a/vendor/k8s.io/api/networking/v1/types.go b/vendor/k8s.io/api/networking/v1/types.go index a0e737ee15..b455b46c37 100644 --- a/vendor/k8s.io/api/networking/v1/types.go +++ b/vendor/k8s.io/api/networking/v1/types.go @@ -28,9 +28,9 @@ import ( // NetworkPolicy describes what network traffic is allowed for a set of Pods type NetworkPolicy struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -77,7 +77,7 @@ type NetworkPolicySpec struct { // solely to ensure that the pods it selects are isolated by default) // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Ingress []NetworkPolicyIngressRule `json:"ingress,omitempty" protobuf:"bytes,2,rep,name=ingress"` // egress is a list of egress rules to be applied to the selected pods. Outgoing traffic @@ -89,7 +89,7 @@ type NetworkPolicySpec struct { // This field is beta-level in 1.8 // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Egress []NetworkPolicyEgressRule `json:"egress,omitempty" protobuf:"bytes,3,rep,name=egress"` // policyTypes is a list of rule types that the NetworkPolicy relates to. @@ -126,7 +126,7 @@ type NetworkPolicyIngressRule struct { // allows traffic only if the traffic matches at least one item in the from list. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional From []NetworkPolicyPeer `json:"from,omitempty" protobuf:"bytes,2,rep,name=from"` } @@ -150,7 +150,7 @@ type NetworkPolicyEgressRule struct { // allows traffic only if the traffic matches at least one item in the to list. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional To []NetworkPolicyPeer `json:"to,omitempty" protobuf:"bytes,2,rep,name=to"` } @@ -183,7 +183,7 @@ type IPBlock struct { // cidr is a string representing the IPBlock // Valid examples are "192.168.1.0/24" or "2001:db8::/64" // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required CIDR string `json:"cidr" protobuf:"bytes,1,name=cidr"` // except is a slice of CIDRs that should not be included within an IPBlock @@ -218,7 +218,7 @@ type NetworkPolicyPeer struct { // ipBlock defines policy on a particular IPBlock. If this field is set then // neither of the other fields can be. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional IPBlock *IPBlock `json:"ipBlock,omitempty" protobuf:"bytes,3,rep,name=ipBlock"` } @@ -227,7 +227,7 @@ type NetworkPolicyPeer struct { // NetworkPolicyList is a list of NetworkPolicy objects. type NetworkPolicyList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -246,10 +246,11 @@ type NetworkPolicyList struct { // endpoints defined by a backend. An Ingress can be configured to give services // externally-reachable urls, load balance traffic, terminate SSL, offer name // based virtual hosting etc. +// +k8s:supportsSubresource="/status" type Ingress struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -270,7 +271,7 @@ type Ingress struct { // IngressList is a collection of Ingress. type IngressList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -427,7 +428,7 @@ type IngressRule struct { // default backend, is left to the controller fulfilling the Ingress. Http is // currently the only supported IngressRuleValue. // +optional - IngressRuleValue `json:",inline" protobuf:"bytes,2,opt,name=ingressRuleValue"` + IngressRuleValue `json:"" protobuf:"bytes,2,opt,name=ingressRuleValue"` } // IngressRuleValue represents a rule to apply against incoming requests. If the @@ -435,6 +436,7 @@ type IngressRule struct { // mixing different types of rules in a single Ingress is disallowed, so exactly // one of the following must be set. type IngressRuleValue struct { + // http is a HTTP IngressRuleValue, which contains a list of http selectors // +optional HTTP *HTTPIngressRuleValue `json:"http,omitempty" protobuf:"bytes,1,opt,name=http"` } @@ -563,9 +565,9 @@ type ServiceBackendPort struct { // single IngressClass resource has this annotation set to true, new Ingress // resources without a class specified will be assigned this default class. type IngressClass struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -590,7 +592,7 @@ type IngressClassSpec struct { // configuration for the controller. This is optional if the controller does // not require extra parameters. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Parameters *IngressClassParametersReference `json:"parameters,omitempty" protobuf:"bytes,2,opt,name=parameters"` } @@ -614,12 +616,12 @@ type IngressClassParametersReference struct { // kind is the type of resource being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` // name is the name of resource being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Name string `json:"name" protobuf:"bytes,3,opt,name=name"` // scope represents if this refers to a cluster or namespace scoped resource. @@ -639,7 +641,7 @@ type IngressClassParametersReference struct { // IngressClassList is a collection of IngressClasses. type IngressClassList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // +optional @@ -662,8 +664,8 @@ type IngressClassList struct { // Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1 // Invalid: 10.01.2.3 or 2001:db8:0:0:0::1 type IPAddress struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -675,29 +677,29 @@ type IPAddress struct { // IPAddressSpec describe the attributes in an IP Address. type IPAddressSpec struct { - // ParentRef references the resource that an IPAddress is attached to. + // parentRef references the resource that an IPAddress is attached to. // An IPAddress must reference a parent object. // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:immutable ParentRef *ParentReference `json:"parentRef,omitempty" protobuf:"bytes,1,opt,name=parentRef"` } // ParentReference describes a reference to a parent object. type ParentReference struct { - // Group is the group of the object being referenced. + // group is the group of the object being referenced. // +optional Group string `json:"group,omitempty" protobuf:"bytes,1,opt,name=group"` - // Resource is the resource of the object being referenced. + // resource is the resource of the object being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Resource string `json:"resource,omitempty" protobuf:"bytes,2,opt,name=resource"` - // Namespace is the namespace of the object being referenced. + // namespace is the namespace of the object being referenced. // +optional Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"` - // Name is the name of the object being referenced. + // name is the name of the object being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Name string `json:"name,omitempty" protobuf:"bytes,4,opt,name=name"` } @@ -706,7 +708,7 @@ type ParentReference struct { // IPAddressList contains a list of IPAddress. type IPAddressList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -722,9 +724,10 @@ type IPAddressList struct { // ServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64). // This range is used to allocate ClusterIPs to Service objects. +// +k8s:supportsSubresource="/status" type ServiceCIDR struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -740,7 +743,7 @@ type ServiceCIDR struct { // ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services. type ServiceCIDRSpec struct { - // CIDRs defines the IP blocks in CIDR notation (e.g. "192.168.0.0/24" or "2001:db8::/64") + // cidrs defines the IP blocks in CIDR notation (e.g. "192.168.0.0/24" or "2001:db8::/64") // from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family. // This field is immutable. // +optional @@ -766,6 +769,7 @@ type ServiceCIDRStatus struct { // +patchStrategy=merge // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:opaqueType Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` } @@ -774,7 +778,7 @@ type ServiceCIDRStatus struct { // ServiceCIDRList contains a list of ServiceCIDR objects. type ServiceCIDRList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional diff --git a/vendor/k8s.io/api/networking/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/networking/v1/types_swagger_doc_generated.go index 6210bb7a5a..cb5816b2fd 100644 --- a/vendor/k8s.io/api/networking/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/networking/v1/types_swagger_doc_generated.go @@ -49,7 +49,7 @@ func (HTTPIngressRuleValue) SwaggerDoc() map[string]string { var map_IPAddress = map[string]string{ "": "IPAddress represents a single IP of a single IP Family. The object is designed to be used by APIs that operate on IP addresses. The object is used by the Service core API for allocation of IP addresses. An IP address can be represented in different formats, to guarantee the uniqueness of the IP, the name of the object is the IP address in canonical format, four decimal digits separated by dots suppressing leading zeros for IPv4 and the representation defined by RFC 5952 for IPv6. Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1 Invalid: 10.01.2.3 or 2001:db8:0:0:0::1", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec is the desired state of the IPAddress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", } @@ -69,7 +69,7 @@ func (IPAddressList) SwaggerDoc() map[string]string { var map_IPAddressSpec = map[string]string{ "": "IPAddressSpec describe the attributes in an IP Address.", - "parentRef": "ParentRef references the resource that an IPAddress is attached to. An IPAddress must reference a parent object.", + "parentRef": "parentRef references the resource that an IPAddress is attached to. An IPAddress must reference a parent object.", } func (IPAddressSpec) SwaggerDoc() map[string]string { @@ -88,7 +88,7 @@ func (IPBlock) SwaggerDoc() map[string]string { var map_Ingress = map[string]string{ "": "Ingress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec is the desired state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", "status": "status is the current state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", } @@ -109,7 +109,7 @@ func (IngressBackend) SwaggerDoc() map[string]string { var map_IngressClass = map[string]string{ "": "IngressClass represents the class of the Ingress, referenced by the Ingress Spec. The `ingressclass.kubernetes.io/is-default-class` annotation can be used to indicate that an IngressClass should be considered default. When a single IngressClass resource has this annotation set to true, new Ingress resources without a class specified will be assigned this default class.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec is the desired state of the IngressClass. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", } @@ -201,7 +201,8 @@ func (IngressRule) SwaggerDoc() map[string]string { } var map_IngressRuleValue = map[string]string{ - "": "IngressRuleValue represents a rule to apply against incoming requests. If the rule is satisfied, the request is routed to the specified backend. Currently mixing different types of rules in a single Ingress is disallowed, so exactly one of the following must be set.", + "": "IngressRuleValue represents a rule to apply against incoming requests. If the rule is satisfied, the request is routed to the specified backend. Currently mixing different types of rules in a single Ingress is disallowed, so exactly one of the following must be set.", + "http": "http is a HTTP IngressRuleValue, which contains a list of http selectors", } func (IngressRuleValue) SwaggerDoc() map[string]string { @@ -251,7 +252,7 @@ func (IngressTLS) SwaggerDoc() map[string]string { var map_NetworkPolicy = map[string]string{ "": "NetworkPolicy describes what network traffic is allowed for a set of Pods", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec represents the specification of the desired behavior for this NetworkPolicy.", } @@ -325,10 +326,10 @@ func (NetworkPolicySpec) SwaggerDoc() map[string]string { var map_ParentReference = map[string]string{ "": "ParentReference describes a reference to a parent object.", - "group": "Group is the group of the object being referenced.", - "resource": "Resource is the resource of the object being referenced.", - "namespace": "Namespace is the namespace of the object being referenced.", - "name": "Name is the name of the object being referenced.", + "group": "group is the group of the object being referenced.", + "resource": "resource is the resource of the object being referenced.", + "namespace": "namespace is the namespace of the object being referenced.", + "name": "name is the name of the object being referenced.", } func (ParentReference) SwaggerDoc() map[string]string { @@ -347,7 +348,7 @@ func (ServiceBackendPort) SwaggerDoc() map[string]string { var map_ServiceCIDR = map[string]string{ "": "ServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64). This range is used to allocate ClusterIPs to Service objects.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec is the desired state of the ServiceCIDR. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", "status": "status represents the current state of the ServiceCIDR. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", } @@ -368,7 +369,7 @@ func (ServiceCIDRList) SwaggerDoc() map[string]string { var map_ServiceCIDRSpec = map[string]string{ "": "ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services.", - "cidrs": "CIDRs defines the IP blocks in CIDR notation (e.g. \"192.168.0.0/24\" or \"2001:db8::/64\") from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family. This field is immutable.", + "cidrs": "cidrs defines the IP blocks in CIDR notation (e.g. \"192.168.0.0/24\" or \"2001:db8::/64\") from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family. This field is immutable.", } func (ServiceCIDRSpec) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/networking/v1beta1/generated.proto b/vendor/k8s.io/api/networking/v1beta1/generated.proto index a6944d6034..11e2a0123b 100644 --- a/vendor/k8s.io/api/networking/v1beta1/generated.proto +++ b/vendor/k8s.io/api/networking/v1beta1/generated.proto @@ -81,7 +81,7 @@ message HTTPIngressRuleValue { // Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1 // Invalid: 10.01.2.3 or 2001:db8:0:0:0::1 message IPAddress { - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -105,11 +105,11 @@ message IPAddressList { // IPAddressSpec describe the attributes in an IP Address. message IPAddressSpec { - // ParentRef references the resource that an IPAddress is attached to. + // parentRef references the resource that an IPAddress is attached to. // An IPAddress must reference a parent object. // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:immutable optional ParentReference parentRef = 1; } @@ -117,8 +117,9 @@ message IPAddressSpec { // endpoints defined by a backend. An Ingress can be configured to give services // externally-reachable urls, load balance traffic, terminate SSL, offer name // based virtual hosting etc. +// +k8s:supportsSubresource="/status" message Ingress { - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -157,7 +158,7 @@ message IngressBackend { // single IngressClass resource has this annotation set to true, new Ingress // resources without a class specified will be assigned this default class. message IngressClass { - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -189,12 +190,12 @@ message IngressClassParametersReference { // kind is the type of resource being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string kind = 2; // name is the name of resource being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string name = 3; // scope represents if this refers to a cluster or namespace scoped resource. @@ -222,7 +223,7 @@ message IngressClassSpec { // configuration for the controller. This is optional if the controller does // not require extra parameters. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional IngressClassParametersReference parameters = 2; } @@ -328,6 +329,7 @@ message IngressRule { // mixing different types of rules in a single Ingress is disallowed, so exactly // one of the following must be set. message IngressRuleValue { + // http is a HTTP IngressRuleValue, which contains a list of http selectors // +optional optional HTTPIngressRuleValue http = 1; } @@ -398,29 +400,30 @@ message IngressTLS { // ParentReference describes a reference to a parent object. message ParentReference { - // Group is the group of the object being referenced. + // group is the group of the object being referenced. // +optional optional string group = 1; - // Resource is the resource of the object being referenced. + // resource is the resource of the object being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string resource = 2; - // Namespace is the namespace of the object being referenced. + // namespace is the namespace of the object being referenced. // +optional optional string namespace = 3; - // Name is the name of the object being referenced. + // name is the name of the object being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string name = 4; } // ServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64). // This range is used to allocate ClusterIPs to Service objects. +// +k8s:supportsSubresource="/status" message ServiceCIDR { - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -449,7 +452,7 @@ message ServiceCIDRList { // ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services. message ServiceCIDRSpec { - // CIDRs defines the IP blocks in CIDR notation (e.g. "192.168.0.0/24" or "2001:db8::/64") + // cidrs defines the IP blocks in CIDR notation (e.g. "192.168.0.0/24" or "2001:db8::/64") // from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family. // This field is immutable. // +optional @@ -466,6 +469,7 @@ message ServiceCIDRStatus { // +patchStrategy=merge // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:opaqueType repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1; } diff --git a/vendor/k8s.io/api/networking/v1beta1/types.go b/vendor/k8s.io/api/networking/v1beta1/types.go index 7cd9b2b58b..73cddf6a7f 100644 --- a/vendor/k8s.io/api/networking/v1beta1/types.go +++ b/vendor/k8s.io/api/networking/v1beta1/types.go @@ -32,10 +32,11 @@ import ( // endpoints defined by a backend. An Ingress can be configured to give services // externally-reachable urls, load balance traffic, terminate SSL, offer name // based virtual hosting etc. +// +k8s:supportsSubresource="/status" type Ingress struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -58,7 +59,7 @@ type Ingress struct { // IngressList is a collection of Ingress. type IngressList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -218,7 +219,7 @@ type IngressRule struct { // default backend, is left to the controller fulfilling the Ingress. Http is // currently the only supported IngressRuleValue. // +optional - IngressRuleValue `json:",inline" protobuf:"bytes,2,opt,name=ingressRuleValue"` + IngressRuleValue `json:"" protobuf:"bytes,2,opt,name=ingressRuleValue"` } // IngressRuleValue represents a rule to apply against incoming requests. If the @@ -232,6 +233,7 @@ type IngressRuleValue struct { // 2. Consider adding fields for ingress-type specific global options // usable by a loadbalancer, like http keep-alive. + // http is a HTTP IngressRuleValue, which contains a list of http selectors // +optional HTTP *HTTPIngressRuleValue `json:"http,omitempty" protobuf:"bytes,1,opt,name=http"` } @@ -341,9 +343,9 @@ type IngressBackend struct { // single IngressClass resource has this annotation set to true, new Ingress // resources without a class specified will be assigned this default class. type IngressClass struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -368,7 +370,7 @@ type IngressClassSpec struct { // configuration for the controller. This is optional if the controller does // not require extra parameters. // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Parameters *IngressClassParametersReference `json:"parameters,omitempty" protobuf:"bytes,2,opt,name=parameters"` } @@ -392,12 +394,12 @@ type IngressClassParametersReference struct { // kind is the type of resource being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` // name is the name of resource being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Name string `json:"name" protobuf:"bytes,3,opt,name=name"` // scope represents if this refers to a cluster or namespace scoped resource. @@ -418,7 +420,7 @@ type IngressClassParametersReference struct { // IngressClassList is a collection of IngressClasses. type IngressClassList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -440,8 +442,8 @@ type IngressClassList struct { // Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1 // Invalid: 10.01.2.3 or 2001:db8:0:0:0::1 type IPAddress struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -453,29 +455,29 @@ type IPAddress struct { // IPAddressSpec describe the attributes in an IP Address. type IPAddressSpec struct { - // ParentRef references the resource that an IPAddress is attached to. + // parentRef references the resource that an IPAddress is attached to. // An IPAddress must reference a parent object. // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:immutable ParentRef *ParentReference `json:"parentRef,omitempty" protobuf:"bytes,1,opt,name=parentRef"` } // ParentReference describes a reference to a parent object. type ParentReference struct { - // Group is the group of the object being referenced. + // group is the group of the object being referenced. // +optional Group string `json:"group,omitempty" protobuf:"bytes,1,opt,name=group"` - // Resource is the resource of the object being referenced. + // resource is the resource of the object being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Resource string `json:"resource,omitempty" protobuf:"bytes,2,opt,name=resource"` - // Namespace is the namespace of the object being referenced. + // namespace is the namespace of the object being referenced. // +optional Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"` - // Name is the name of the object being referenced. + // name is the name of the object being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Name string `json:"name,omitempty" protobuf:"bytes,4,opt,name=name"` } @@ -484,7 +486,7 @@ type ParentReference struct { // IPAddressList contains a list of IPAddress. type IPAddressList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -500,9 +502,10 @@ type IPAddressList struct { // ServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64). // This range is used to allocate ClusterIPs to Service objects. +// +k8s:supportsSubresource="/status" type ServiceCIDR struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -518,7 +521,7 @@ type ServiceCIDR struct { // ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services. type ServiceCIDRSpec struct { - // CIDRs defines the IP blocks in CIDR notation (e.g. "192.168.0.0/24" or "2001:db8::/64") + // cidrs defines the IP blocks in CIDR notation (e.g. "192.168.0.0/24" or "2001:db8::/64") // from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family. // This field is immutable. // +optional @@ -544,6 +547,7 @@ type ServiceCIDRStatus struct { // +patchStrategy=merge // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:opaqueType Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` } @@ -552,7 +556,7 @@ type ServiceCIDRStatus struct { // ServiceCIDRList contains a list of ServiceCIDR objects. type ServiceCIDRList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional diff --git a/vendor/k8s.io/api/networking/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/networking/v1beta1/types_swagger_doc_generated.go index 9d27517f3b..03d33b5d48 100644 --- a/vendor/k8s.io/api/networking/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/networking/v1beta1/types_swagger_doc_generated.go @@ -49,7 +49,7 @@ func (HTTPIngressRuleValue) SwaggerDoc() map[string]string { var map_IPAddress = map[string]string{ "": "IPAddress represents a single IP of a single IP Family. The object is designed to be used by APIs that operate on IP addresses. The object is used by the Service core API for allocation of IP addresses. An IP address can be represented in different formats, to guarantee the uniqueness of the IP, the name of the object is the IP address in canonical format, four decimal digits separated by dots suppressing leading zeros for IPv4 and the representation defined by RFC 5952 for IPv6. Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1 Invalid: 10.01.2.3 or 2001:db8:0:0:0::1", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec is the desired state of the IPAddress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", } @@ -69,7 +69,7 @@ func (IPAddressList) SwaggerDoc() map[string]string { var map_IPAddressSpec = map[string]string{ "": "IPAddressSpec describe the attributes in an IP Address.", - "parentRef": "ParentRef references the resource that an IPAddress is attached to. An IPAddress must reference a parent object.", + "parentRef": "parentRef references the resource that an IPAddress is attached to. An IPAddress must reference a parent object.", } func (IPAddressSpec) SwaggerDoc() map[string]string { @@ -78,7 +78,7 @@ func (IPAddressSpec) SwaggerDoc() map[string]string { var map_Ingress = map[string]string{ "": "Ingress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec is the desired state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", "status": "status is the current state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", } @@ -100,7 +100,7 @@ func (IngressBackend) SwaggerDoc() map[string]string { var map_IngressClass = map[string]string{ "": "IngressClass represents the class of the Ingress, referenced by the Ingress Spec. The `ingressclass.kubernetes.io/is-default-class` annotation can be used to indicate that an IngressClass should be considered default. When a single IngressClass resource has this annotation set to true, new Ingress resources without a class specified will be assigned this default class.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec is the desired state of the IngressClass. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", } @@ -192,7 +192,8 @@ func (IngressRule) SwaggerDoc() map[string]string { } var map_IngressRuleValue = map[string]string{ - "": "IngressRuleValue represents a rule to apply against incoming requests. If the rule is satisfied, the request is routed to the specified backend. Currently mixing different types of rules in a single Ingress is disallowed, so exactly one of the following must be set.", + "": "IngressRuleValue represents a rule to apply against incoming requests. If the rule is satisfied, the request is routed to the specified backend. Currently mixing different types of rules in a single Ingress is disallowed, so exactly one of the following must be set.", + "http": "http is a HTTP IngressRuleValue, which contains a list of http selectors", } func (IngressRuleValue) SwaggerDoc() map[string]string { @@ -232,10 +233,10 @@ func (IngressTLS) SwaggerDoc() map[string]string { var map_ParentReference = map[string]string{ "": "ParentReference describes a reference to a parent object.", - "group": "Group is the group of the object being referenced.", - "resource": "Resource is the resource of the object being referenced.", - "namespace": "Namespace is the namespace of the object being referenced.", - "name": "Name is the name of the object being referenced.", + "group": "group is the group of the object being referenced.", + "resource": "resource is the resource of the object being referenced.", + "namespace": "namespace is the namespace of the object being referenced.", + "name": "name is the name of the object being referenced.", } func (ParentReference) SwaggerDoc() map[string]string { @@ -244,7 +245,7 @@ func (ParentReference) SwaggerDoc() map[string]string { var map_ServiceCIDR = map[string]string{ "": "ServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64). This range is used to allocate ClusterIPs to Service objects.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec is the desired state of the ServiceCIDR. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", "status": "status represents the current state of the ServiceCIDR. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", } @@ -265,7 +266,7 @@ func (ServiceCIDRList) SwaggerDoc() map[string]string { var map_ServiceCIDRSpec = map[string]string{ "": "ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services.", - "cidrs": "CIDRs defines the IP blocks in CIDR notation (e.g. \"192.168.0.0/24\" or \"2001:db8::/64\") from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family. This field is immutable.", + "cidrs": "cidrs defines the IP blocks in CIDR notation (e.g. \"192.168.0.0/24\" or \"2001:db8::/64\") from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family. This field is immutable.", } func (ServiceCIDRSpec) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/node/v1/generated.proto b/vendor/k8s.io/api/node/v1/generated.proto index 4d77c9b781..f368bd85e6 100644 --- a/vendor/k8s.io/api/node/v1/generated.proto +++ b/vendor/k8s.io/api/node/v1/generated.proto @@ -45,6 +45,7 @@ message Overhead { // pod. For more details, see // https://kubernetes.io/docs/concepts/containers/runtime-class/ message RuntimeClass { + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -60,9 +61,9 @@ message RuntimeClass { // The Handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, // and is immutable. // +required - // +k8s:alpha(since: "1.36")=+k8s:format="k8s-short-name" - // +k8s:alpha(since: "1.36")=+k8s:immutable - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format="k8s-short-name" + // +k8s:beta(since: "1.37")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:required optional string handler = 2; // overhead represents the resource overhead associated with running a pod for a @@ -76,6 +77,7 @@ message RuntimeClass { // If scheduling is nil, this RuntimeClass is assumed to be supported by all // nodes. // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional optional Scheduling scheduling = 4; } @@ -107,6 +109,7 @@ message Scheduling { // tolerated by the pod and the RuntimeClass. // +optional // +listType=atomic + // +k8s:alpha(since: "1.37")=+k8s:optional repeated .k8s.io.api.core.v1.Toleration tolerations = 2; } diff --git a/vendor/k8s.io/api/node/v1/types.go b/vendor/k8s.io/api/node/v1/types.go index c2ea739dc8..4d781af2a0 100644 --- a/vendor/k8s.io/api/node/v1/types.go +++ b/vendor/k8s.io/api/node/v1/types.go @@ -34,8 +34,9 @@ import ( // pod. For more details, see // https://kubernetes.io/docs/concepts/containers/runtime-class/ type RuntimeClass struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -51,9 +52,9 @@ type RuntimeClass struct { // The Handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, // and is immutable. // +required - // +k8s:alpha(since: "1.36")=+k8s:format="k8s-short-name" - // +k8s:alpha(since: "1.36")=+k8s:immutable - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format="k8s-short-name" + // +k8s:beta(since: "1.37")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:required Handler string `json:"handler" protobuf:"bytes,2,opt,name=handler"` // overhead represents the resource overhead associated with running a pod for a @@ -67,6 +68,7 @@ type RuntimeClass struct { // If scheduling is nil, this RuntimeClass is assumed to be supported by all // nodes. // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional Scheduling *Scheduling `json:"scheduling,omitempty" protobuf:"bytes,4,opt,name=scheduling"` } @@ -94,6 +96,7 @@ type Scheduling struct { // tolerated by the pod and the RuntimeClass. // +optional // +listType=atomic + // +k8s:alpha(since: "1.37")=+k8s:optional Tolerations []corev1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,2,rep,name=tolerations"` } @@ -102,7 +105,7 @@ type Scheduling struct { // RuntimeClassList is a list of RuntimeClass objects. type RuntimeClassList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata diff --git a/vendor/k8s.io/api/node/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/node/v1/types_swagger_doc_generated.go index f5e6b32779..168f48a58e 100644 --- a/vendor/k8s.io/api/node/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/node/v1/types_swagger_doc_generated.go @@ -38,7 +38,7 @@ func (Overhead) SwaggerDoc() map[string]string { var map_RuntimeClass = map[string]string{ "": "RuntimeClass defines a class of container runtime supported in the cluster. The RuntimeClass is used to determine which container runtime is used to run all containers in a pod. RuntimeClasses are manually defined by a user or cluster provisioner, and referenced in the PodSpec. The Kubelet is responsible for resolving the RuntimeClassName reference before running the pod. For more details, see https://kubernetes.io/docs/concepts/containers/runtime-class/", - "metadata": "More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "handler": "handler specifies the underlying runtime and configuration that the CRI implementation will use to handle pods of this class. The possible values are specific to the node & CRI configuration. It is assumed that all handlers are available on every node, and handlers of the same name are equivalent on every node. For example, a handler called \"runc\" might specify that the runc OCI runtime (using native Linux containers) will be used to run the containers in a pod. The Handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, and is immutable.", "overhead": "overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see\n https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "scheduling": "scheduling holds the scheduling constraints to ensure that pods running with this RuntimeClass are scheduled to nodes that support it. If scheduling is nil, this RuntimeClass is assumed to be supported by all nodes.", diff --git a/vendor/k8s.io/api/node/v1alpha1/generated.proto b/vendor/k8s.io/api/node/v1alpha1/generated.proto index c50b639065..faf8b8c89e 100644 --- a/vendor/k8s.io/api/node/v1alpha1/generated.proto +++ b/vendor/k8s.io/api/node/v1alpha1/generated.proto @@ -45,6 +45,7 @@ message Overhead { // pod. For more details, see // https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class message RuntimeClass { + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -82,9 +83,9 @@ message RuntimeClassSpec { // The runtimeHandler must be lowercase, conform to the DNS Label (RFC 1123) // requirements, and is immutable. // +required - // +k8s:alpha(since: "1.36")=+k8s:format="k8s-short-name" - // +k8s:alpha(since: "1.36")=+k8s:immutable - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format="k8s-short-name" + // +k8s:beta(since: "1.37")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:required optional string runtimeHandler = 1; // overhead represents the resource overhead associated with running a pod for a @@ -98,6 +99,7 @@ message RuntimeClassSpec { // If scheduling is nil, this RuntimeClass is assumed to be supported by all // nodes. // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional optional Scheduling scheduling = 3; } @@ -118,6 +120,7 @@ message Scheduling { // tolerated by the pod and the RuntimeClass. // +optional // +listType=atomic + // +k8s:alpha(since: "1.37")=+k8s:optional repeated .k8s.io.api.core.v1.Toleration tolerations = 2; } diff --git a/vendor/k8s.io/api/node/v1alpha1/types.go b/vendor/k8s.io/api/node/v1alpha1/types.go index 3521335b07..16d2794d44 100644 --- a/vendor/k8s.io/api/node/v1alpha1/types.go +++ b/vendor/k8s.io/api/node/v1alpha1/types.go @@ -33,8 +33,9 @@ import ( // pod. For more details, see // https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class type RuntimeClass struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -61,9 +62,9 @@ type RuntimeClassSpec struct { // The runtimeHandler must be lowercase, conform to the DNS Label (RFC 1123) // requirements, and is immutable. // +required - // +k8s:alpha(since: "1.36")=+k8s:format="k8s-short-name" - // +k8s:alpha(since: "1.36")=+k8s:immutable - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format="k8s-short-name" + // +k8s:beta(since: "1.37")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:required RuntimeHandler string `json:"runtimeHandler" protobuf:"bytes,1,opt,name=runtimeHandler"` // overhead represents the resource overhead associated with running a pod for a @@ -77,6 +78,7 @@ type RuntimeClassSpec struct { // If scheduling is nil, this RuntimeClass is assumed to be supported by all // nodes. // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional Scheduling *Scheduling `json:"scheduling,omitempty" protobuf:"bytes,3,opt,name=scheduling"` } @@ -104,6 +106,7 @@ type Scheduling struct { // tolerated by the pod and the RuntimeClass. // +optional // +listType=atomic + // +k8s:alpha(since: "1.37")=+k8s:optional Tolerations []corev1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,2,rep,name=tolerations"` } @@ -111,7 +114,7 @@ type Scheduling struct { // RuntimeClassList is a list of RuntimeClass objects. type RuntimeClassList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata diff --git a/vendor/k8s.io/api/node/v1alpha1/types_swagger_doc_generated.go b/vendor/k8s.io/api/node/v1alpha1/types_swagger_doc_generated.go index ccc1b70853..5c54384789 100644 --- a/vendor/k8s.io/api/node/v1alpha1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/node/v1alpha1/types_swagger_doc_generated.go @@ -38,7 +38,7 @@ func (Overhead) SwaggerDoc() map[string]string { var map_RuntimeClass = map[string]string{ "": "RuntimeClass defines a class of container runtime supported in the cluster. The RuntimeClass is used to determine which container runtime is used to run all containers in a pod. RuntimeClasses are (currently) manually defined by a user or cluster provisioner, and referenced in the PodSpec. The Kubelet is responsible for resolving the RuntimeClassName reference before running the pod. For more details, see https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class", - "metadata": "More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec represents specification of the RuntimeClass More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", } diff --git a/vendor/k8s.io/api/node/v1beta1/generated.proto b/vendor/k8s.io/api/node/v1beta1/generated.proto index 073a185e2c..51fbfd5e8b 100644 --- a/vendor/k8s.io/api/node/v1beta1/generated.proto +++ b/vendor/k8s.io/api/node/v1beta1/generated.proto @@ -45,6 +45,7 @@ message Overhead { // pod. For more details, see // https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class message RuntimeClass { + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -60,9 +61,9 @@ message RuntimeClass { // The handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, // and is immutable. // +required - // +k8s:alpha(since: "1.36")=+k8s:format="k8s-short-name" - // +k8s:alpha(since: "1.36")=+k8s:immutable - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format="k8s-short-name" + // +k8s:beta(since: "1.37")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:required optional string handler = 2; // overhead represents the resource overhead associated with running a pod for a @@ -76,6 +77,7 @@ message RuntimeClass { // If scheduling is nil, this RuntimeClass is assumed to be supported by all // nodes. // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional optional Scheduling scheduling = 4; } @@ -107,6 +109,7 @@ message Scheduling { // tolerated by the pod and the RuntimeClass. // +optional // +listType=atomic + // +k8s:alpha(since: "1.37")=+k8s:optional repeated .k8s.io.api.core.v1.Toleration tolerations = 2; } diff --git a/vendor/k8s.io/api/node/v1beta1/types.go b/vendor/k8s.io/api/node/v1beta1/types.go index 145e138663..3af85a9ee4 100644 --- a/vendor/k8s.io/api/node/v1beta1/types.go +++ b/vendor/k8s.io/api/node/v1beta1/types.go @@ -35,8 +35,9 @@ import ( // pod. For more details, see // https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class type RuntimeClass struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -52,9 +53,9 @@ type RuntimeClass struct { // The handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, // and is immutable. // +required - // +k8s:alpha(since: "1.36")=+k8s:format="k8s-short-name" - // +k8s:alpha(since: "1.36")=+k8s:immutable - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format="k8s-short-name" + // +k8s:beta(since: "1.37")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:required Handler string `json:"handler" protobuf:"bytes,2,opt,name=handler"` // overhead represents the resource overhead associated with running a pod for a @@ -68,6 +69,7 @@ type RuntimeClass struct { // If scheduling is nil, this RuntimeClass is assumed to be supported by all // nodes. // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional Scheduling *Scheduling `json:"scheduling,omitempty" protobuf:"bytes,4,opt,name=scheduling"` } @@ -95,6 +97,7 @@ type Scheduling struct { // tolerated by the pod and the RuntimeClass. // +optional // +listType=atomic + // +k8s:alpha(since: "1.37")=+k8s:optional Tolerations []corev1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,2,rep,name=tolerations"` } @@ -104,7 +107,7 @@ type Scheduling struct { // RuntimeClassList is a list of RuntimeClass objects. type RuntimeClassList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata diff --git a/vendor/k8s.io/api/node/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/node/v1beta1/types_swagger_doc_generated.go index 086105ecc5..74991a89f0 100644 --- a/vendor/k8s.io/api/node/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/node/v1beta1/types_swagger_doc_generated.go @@ -38,7 +38,7 @@ func (Overhead) SwaggerDoc() map[string]string { var map_RuntimeClass = map[string]string{ "": "RuntimeClass defines a class of container runtime supported in the cluster. The RuntimeClass is used to determine which container runtime is used to run all containers in a pod. RuntimeClasses are (currently) manually defined by a user or cluster provisioner, and referenced in the PodSpec. The Kubelet is responsible for resolving the RuntimeClassName reference before running the pod. For more details, see https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class", - "metadata": "More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "handler": "handler specifies the underlying runtime and configuration that the CRI implementation will use to handle pods of this class. The possible values are specific to the node & CRI configuration. It is assumed that all handlers are available on every node, and handlers of the same name are equivalent on every node. For example, a handler called \"runc\" might specify that the runc OCI runtime (using native Linux containers) will be used to run the containers in a pod. The handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, and is immutable.", "overhead": "overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md", "scheduling": "scheduling holds the scheduling constraints to ensure that pods running with this RuntimeClass are scheduled to nodes that support it. If scheduling is nil, this RuntimeClass is assumed to be supported by all nodes.", diff --git a/vendor/k8s.io/api/policy/v1/generated.proto b/vendor/k8s.io/api/policy/v1/generated.proto index 704cc10b7d..ceec53a11f 100644 --- a/vendor/k8s.io/api/policy/v1/generated.proto +++ b/vendor/k8s.io/api/policy/v1/generated.proto @@ -33,27 +33,29 @@ option go_package = "k8s.io/api/policy/v1"; // This is a subresource of Pod. A request to cause such an eviction is // created by POSTing to .../pods//evictions. message Eviction { - // ObjectMeta describes the pod that is being evicted. + // metadata describes the pod that is being evicted. // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // DeleteOptions may be provided + // deleteOptions may be provided // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.DeleteOptions deleteOptions = 2; } // PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods +// +k8s:supportsSubresource="/status" message PodDisruptionBudget { - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Specification of the desired behavior of the PodDisruptionBudget. + // spec is the specification of the desired behavior of the PodDisruptionBudget. // +optional optional PodDisruptionBudgetSpec spec = 2; - // Most recently observed status of the PodDisruptionBudget. + // status is the most recently observed status of the PodDisruptionBudget. // +optional optional PodDisruptionBudgetStatus status = 3; } @@ -71,14 +73,14 @@ message PodDisruptionBudgetList { // PodDisruptionBudgetSpec is a description of a PodDisruptionBudget. message PodDisruptionBudgetSpec { - // An eviction is allowed if at least "minAvailable" pods selected by + // minAvailable indicates that an eviction is allowed if at least "minAvailable" pods selected by // "selector" will still be available after the eviction, i.e. even in the // absence of the evicted pod. So for example you can prevent all voluntary // evictions by specifying "100%". // +optional optional .k8s.io.apimachinery.pkg.util.intstr.IntOrString minAvailable = 1; - // Label query over pods whose evictions are managed by the disruption + // selector is a label query over pods whose evictions are managed by the disruption // budget. // A null selector will match no pods, while an empty ({}) selector will select // all pods within the namespace. @@ -86,14 +88,14 @@ message PodDisruptionBudgetSpec { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2; - // An eviction is allowed if at most "maxUnavailable" pods selected by + // maxUnavailable indicates that an eviction is allowed if at most "maxUnavailable" pods selected by // "selector" are unavailable after the eviction, i.e. even in absence of // the evicted pod. For example, one can prevent all voluntary evictions // by specifying 0. This is a mutually exclusive setting with "minAvailable". // +optional optional .k8s.io.apimachinery.pkg.util.intstr.IntOrString maxUnavailable = 3; - // UnhealthyPodEvictionPolicy defines the criteria for when unhealthy pods + // unhealthyPodEvictionPolicy defines the criteria for when unhealthy pods // should be considered for eviction. Current implementation considers healthy pods, // as pods that have status.conditions item with type="Ready",status="True". // @@ -175,6 +177,9 @@ message PodDisruptionBudgetStatus { // +patchStrategy=merge // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 7; } diff --git a/vendor/k8s.io/api/policy/v1/types.go b/vendor/k8s.io/api/policy/v1/types.go index ebf349e317..1d49f92d1f 100644 --- a/vendor/k8s.io/api/policy/v1/types.go +++ b/vendor/k8s.io/api/policy/v1/types.go @@ -26,14 +26,14 @@ const DisruptionBudgetCause metav1.CauseType = "DisruptionBudget" // PodDisruptionBudgetSpec is a description of a PodDisruptionBudget. type PodDisruptionBudgetSpec struct { - // An eviction is allowed if at least "minAvailable" pods selected by + // minAvailable indicates that an eviction is allowed if at least "minAvailable" pods selected by // "selector" will still be available after the eviction, i.e. even in the // absence of the evicted pod. So for example you can prevent all voluntary // evictions by specifying "100%". // +optional MinAvailable *intstr.IntOrString `json:"minAvailable,omitempty" protobuf:"bytes,1,opt,name=minAvailable"` - // Label query over pods whose evictions are managed by the disruption + // selector is a label query over pods whose evictions are managed by the disruption // budget. // A null selector will match no pods, while an empty ({}) selector will select // all pods within the namespace. @@ -41,14 +41,14 @@ type PodDisruptionBudgetSpec struct { // +optional Selector *metav1.LabelSelector `json:"selector,omitempty" patchStrategy:"replace" protobuf:"bytes,2,opt,name=selector"` - // An eviction is allowed if at most "maxUnavailable" pods selected by + // maxUnavailable indicates that an eviction is allowed if at most "maxUnavailable" pods selected by // "selector" are unavailable after the eviction, i.e. even in absence of // the evicted pod. For example, one can prevent all voluntary evictions // by specifying 0. This is a mutually exclusive setting with "minAvailable". // +optional MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,3,opt,name=maxUnavailable"` - // UnhealthyPodEvictionPolicy defines the criteria for when unhealthy pods + // unhealthyPodEvictionPolicy defines the criteria for when unhealthy pods // should be considered for eviction. Current implementation considers healthy pods, // as pods that have status.conditions item with type="Ready",status="True". // @@ -150,6 +150,9 @@ type PodDisruptionBudgetStatus struct { // +patchStrategy=merge // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,7,rep,name=conditions"` } @@ -174,17 +177,18 @@ const ( // +k8s:prerelease-lifecycle-gen:introduced=1.21 // PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods +// +k8s:supportsSubresource="/status" type PodDisruptionBudget struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Specification of the desired behavior of the PodDisruptionBudget. + // spec is the specification of the desired behavior of the PodDisruptionBudget. // +optional Spec PodDisruptionBudgetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - // Most recently observed status of the PodDisruptionBudget. + // status is the most recently observed status of the PodDisruptionBudget. // +optional Status PodDisruptionBudgetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } @@ -194,7 +198,7 @@ type PodDisruptionBudget struct { // PodDisruptionBudgetList is a collection of PodDisruptionBudgets. type PodDisruptionBudgetList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -212,13 +216,14 @@ type PodDisruptionBudgetList struct { // This is a subresource of Pod. A request to cause such an eviction is // created by POSTing to .../pods//evictions. type Eviction struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // ObjectMeta describes the pod that is being evicted. + // metadata describes the pod that is being evicted. // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // DeleteOptions may be provided + // deleteOptions may be provided // +optional DeleteOptions *metav1.DeleteOptions `json:"deleteOptions,omitempty" protobuf:"bytes,2,opt,name=deleteOptions"` } diff --git a/vendor/k8s.io/api/policy/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/policy/v1/types_swagger_doc_generated.go index 9b2f5b9450..cf67a76df6 100644 --- a/vendor/k8s.io/api/policy/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/policy/v1/types_swagger_doc_generated.go @@ -29,8 +29,8 @@ package v1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_Eviction = map[string]string{ "": "Eviction evicts a pod from its node subject to certain policies and safety constraints. This is a subresource of Pod. A request to cause such an eviction is created by POSTing to .../pods//evictions.", - "metadata": "ObjectMeta describes the pod that is being evicted.", - "deleteOptions": "DeleteOptions may be provided", + "metadata": "metadata describes the pod that is being evicted.", + "deleteOptions": "deleteOptions may be provided", } func (Eviction) SwaggerDoc() map[string]string { @@ -39,9 +39,9 @@ func (Eviction) SwaggerDoc() map[string]string { var map_PodDisruptionBudget = map[string]string{ "": "PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "Specification of the desired behavior of the PodDisruptionBudget.", - "status": "Most recently observed status of the PodDisruptionBudget.", + "metadata": "metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec is the specification of the desired behavior of the PodDisruptionBudget.", + "status": "status is the most recently observed status of the PodDisruptionBudget.", } func (PodDisruptionBudget) SwaggerDoc() map[string]string { @@ -60,10 +60,10 @@ func (PodDisruptionBudgetList) SwaggerDoc() map[string]string { var map_PodDisruptionBudgetSpec = map[string]string{ "": "PodDisruptionBudgetSpec is a description of a PodDisruptionBudget.", - "minAvailable": "An eviction is allowed if at least \"minAvailable\" pods selected by \"selector\" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying \"100%\".", - "selector": "Label query over pods whose evictions are managed by the disruption budget. A null selector will match no pods, while an empty ({}) selector will select all pods within the namespace.", - "maxUnavailable": "An eviction is allowed if at most \"maxUnavailable\" pods selected by \"selector\" are unavailable after the eviction, i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions by specifying 0. This is a mutually exclusive setting with \"minAvailable\".", - "unhealthyPodEvictionPolicy": "UnhealthyPodEvictionPolicy defines the criteria for when unhealthy pods should be considered for eviction. Current implementation considers healthy pods, as pods that have status.conditions item with type=\"Ready\",status=\"True\".\n\nValid policies are IfHealthyBudget and AlwaysAllow. If no policy is specified, the default behavior will be used, which corresponds to the IfHealthyBudget policy.\n\nIfHealthyBudget policy means that running pods (status.phase=\"Running\"), but not yet healthy can be evicted only if the guarded application is not disrupted (status.currentHealthy is at least equal to status.desiredHealthy). Healthy pods will be subject to the PDB for eviction.\n\nAlwaysAllow policy means that all running pods (status.phase=\"Running\"), but not yet healthy are considered disrupted and can be evicted regardless of whether the criteria in a PDB is met. This means perspective running pods of a disrupted application might not get a chance to become healthy. Healthy pods will be subject to the PDB for eviction.\n\nAdditional policies may be added in the future. Clients making eviction decisions should disallow eviction of unhealthy pods if they encounter an unrecognized policy in this field.", + "minAvailable": "minAvailable indicates that an eviction is allowed if at least \"minAvailable\" pods selected by \"selector\" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying \"100%\".", + "selector": "selector is a label query over pods whose evictions are managed by the disruption budget. A null selector will match no pods, while an empty ({}) selector will select all pods within the namespace.", + "maxUnavailable": "maxUnavailable indicates that an eviction is allowed if at most \"maxUnavailable\" pods selected by \"selector\" are unavailable after the eviction, i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions by specifying 0. This is a mutually exclusive setting with \"minAvailable\".", + "unhealthyPodEvictionPolicy": "unhealthyPodEvictionPolicy defines the criteria for when unhealthy pods should be considered for eviction. Current implementation considers healthy pods, as pods that have status.conditions item with type=\"Ready\",status=\"True\".\n\nValid policies are IfHealthyBudget and AlwaysAllow. If no policy is specified, the default behavior will be used, which corresponds to the IfHealthyBudget policy.\n\nIfHealthyBudget policy means that running pods (status.phase=\"Running\"), but not yet healthy can be evicted only if the guarded application is not disrupted (status.currentHealthy is at least equal to status.desiredHealthy). Healthy pods will be subject to the PDB for eviction.\n\nAlwaysAllow policy means that all running pods (status.phase=\"Running\"), but not yet healthy are considered disrupted and can be evicted regardless of whether the criteria in a PDB is met. This means perspective running pods of a disrupted application might not get a chance to become healthy. Healthy pods will be subject to the PDB for eviction.\n\nAdditional policies may be added in the future. Clients making eviction decisions should disallow eviction of unhealthy pods if they encounter an unrecognized policy in this field.", } func (PodDisruptionBudgetSpec) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/policy/v1beta1/generated.proto b/vendor/k8s.io/api/policy/v1beta1/generated.proto index a8200a2d78..be469ba611 100644 --- a/vendor/k8s.io/api/policy/v1beta1/generated.proto +++ b/vendor/k8s.io/api/policy/v1beta1/generated.proto @@ -33,27 +33,29 @@ option go_package = "k8s.io/api/policy/v1beta1"; // This is a subresource of Pod. A request to cause such an eviction is // created by POSTing to .../pods//evictions. message Eviction { - // ObjectMeta describes the pod that is being evicted. + // metadata describes the pod that is being evicted. // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // DeleteOptions may be provided + // deleteOptions may be provided // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.DeleteOptions deleteOptions = 2; } // PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods +// +k8s:supportsSubresource="/status" message PodDisruptionBudget { - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Specification of the desired behavior of the PodDisruptionBudget. + // spec is the specification of the desired behavior of the PodDisruptionBudget. // +optional optional PodDisruptionBudgetSpec spec = 2; - // Most recently observed status of the PodDisruptionBudget. + // status is the most recently observed status of the PodDisruptionBudget. // +optional optional PodDisruptionBudgetStatus status = 3; } @@ -71,14 +73,14 @@ message PodDisruptionBudgetList { // PodDisruptionBudgetSpec is a description of a PodDisruptionBudget. message PodDisruptionBudgetSpec { - // An eviction is allowed if at least "minAvailable" pods selected by + // minAvailable indicates that an eviction is allowed if at least "minAvailable" pods selected by // "selector" will still be available after the eviction, i.e. even in the // absence of the evicted pod. So for example you can prevent all voluntary // evictions by specifying "100%". // +optional optional .k8s.io.apimachinery.pkg.util.intstr.IntOrString minAvailable = 1; - // Label query over pods whose evictions are managed by the disruption + // selector is a label query over pods whose evictions are managed by the disruption // budget. // A null selector selects no pods. // An empty selector ({}) also selects no pods, which differs from standard behavior of selecting all pods. @@ -86,14 +88,14 @@ message PodDisruptionBudgetSpec { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2; - // An eviction is allowed if at most "maxUnavailable" pods selected by + // maxUnavailable indicates that an eviction is allowed if at most "maxUnavailable" pods selected by // "selector" are unavailable after the eviction, i.e. even in absence of // the evicted pod. For example, one can prevent all voluntary evictions // by specifying 0. This is a mutually exclusive setting with "minAvailable". // +optional optional .k8s.io.apimachinery.pkg.util.intstr.IntOrString maxUnavailable = 3; - // UnhealthyPodEvictionPolicy defines the criteria for when unhealthy pods + // unhealthyPodEvictionPolicy defines the criteria for when unhealthy pods // should be considered for eviction. Current implementation considers healthy pods, // as pods that have status.conditions item with type="Ready",status="True". // @@ -175,6 +177,9 @@ message PodDisruptionBudgetStatus { // +patchStrategy=merge // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 7; } diff --git a/vendor/k8s.io/api/policy/v1beta1/types.go b/vendor/k8s.io/api/policy/v1beta1/types.go index 354c22a3d0..6017d4179d 100644 --- a/vendor/k8s.io/api/policy/v1beta1/types.go +++ b/vendor/k8s.io/api/policy/v1beta1/types.go @@ -23,14 +23,14 @@ import ( // PodDisruptionBudgetSpec is a description of a PodDisruptionBudget. type PodDisruptionBudgetSpec struct { - // An eviction is allowed if at least "minAvailable" pods selected by + // minAvailable indicates that an eviction is allowed if at least "minAvailable" pods selected by // "selector" will still be available after the eviction, i.e. even in the // absence of the evicted pod. So for example you can prevent all voluntary // evictions by specifying "100%". // +optional MinAvailable *intstr.IntOrString `json:"minAvailable,omitempty" protobuf:"bytes,1,opt,name=minAvailable"` - // Label query over pods whose evictions are managed by the disruption + // selector is a label query over pods whose evictions are managed by the disruption // budget. // A null selector selects no pods. // An empty selector ({}) also selects no pods, which differs from standard behavior of selecting all pods. @@ -38,14 +38,14 @@ type PodDisruptionBudgetSpec struct { // +optional Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"` - // An eviction is allowed if at most "maxUnavailable" pods selected by + // maxUnavailable indicates that an eviction is allowed if at most "maxUnavailable" pods selected by // "selector" are unavailable after the eviction, i.e. even in absence of // the evicted pod. For example, one can prevent all voluntary evictions // by specifying 0. This is a mutually exclusive setting with "minAvailable". // +optional MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,3,opt,name=maxUnavailable"` - // UnhealthyPodEvictionPolicy defines the criteria for when unhealthy pods + // unhealthyPodEvictionPolicy defines the criteria for when unhealthy pods // should be considered for eviction. Current implementation considers healthy pods, // as pods that have status.conditions item with type="Ready",status="True". // @@ -147,6 +147,9 @@ type PodDisruptionBudgetStatus struct { // +patchStrategy=merge // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,7,rep,name=conditions"` } @@ -174,18 +177,19 @@ const ( // +k8s:prerelease-lifecycle-gen:replacement=policy,v1,PodDisruptionBudget // PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods +// +k8s:supportsSubresource="/status" type PodDisruptionBudget struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Specification of the desired behavior of the PodDisruptionBudget. + // spec is the specification of the desired behavior of the PodDisruptionBudget. // +optional Spec PodDisruptionBudgetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - // Most recently observed status of the PodDisruptionBudget. + // status is the most recently observed status of the PodDisruptionBudget. // +optional Status PodDisruptionBudgetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } @@ -198,7 +202,7 @@ type PodDisruptionBudget struct { // PodDisruptionBudgetList is a collection of PodDisruptionBudgets. type PodDisruptionBudgetList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -218,13 +222,14 @@ type PodDisruptionBudgetList struct { // This is a subresource of Pod. A request to cause such an eviction is // created by POSTing to .../pods//evictions. type Eviction struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // ObjectMeta describes the pod that is being evicted. + // metadata describes the pod that is being evicted. // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // DeleteOptions may be provided + // deleteOptions may be provided // +optional DeleteOptions *metav1.DeleteOptions `json:"deleteOptions,omitempty" protobuf:"bytes,2,opt,name=deleteOptions"` } diff --git a/vendor/k8s.io/api/policy/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/policy/v1beta1/types_swagger_doc_generated.go index cffc9a548c..cffdcdd42b 100644 --- a/vendor/k8s.io/api/policy/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/policy/v1beta1/types_swagger_doc_generated.go @@ -29,8 +29,8 @@ package v1beta1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_Eviction = map[string]string{ "": "Eviction evicts a pod from its node subject to certain policies and safety constraints. This is a subresource of Pod. A request to cause such an eviction is created by POSTing to .../pods//evictions.", - "metadata": "ObjectMeta describes the pod that is being evicted.", - "deleteOptions": "DeleteOptions may be provided", + "metadata": "metadata describes the pod that is being evicted.", + "deleteOptions": "deleteOptions may be provided", } func (Eviction) SwaggerDoc() map[string]string { @@ -39,9 +39,9 @@ func (Eviction) SwaggerDoc() map[string]string { var map_PodDisruptionBudget = map[string]string{ "": "PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "Specification of the desired behavior of the PodDisruptionBudget.", - "status": "Most recently observed status of the PodDisruptionBudget.", + "metadata": "metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec is the specification of the desired behavior of the PodDisruptionBudget.", + "status": "status is the most recently observed status of the PodDisruptionBudget.", } func (PodDisruptionBudget) SwaggerDoc() map[string]string { @@ -60,10 +60,10 @@ func (PodDisruptionBudgetList) SwaggerDoc() map[string]string { var map_PodDisruptionBudgetSpec = map[string]string{ "": "PodDisruptionBudgetSpec is a description of a PodDisruptionBudget.", - "minAvailable": "An eviction is allowed if at least \"minAvailable\" pods selected by \"selector\" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying \"100%\".", - "selector": "Label query over pods whose evictions are managed by the disruption budget. A null selector selects no pods. An empty selector ({}) also selects no pods, which differs from standard behavior of selecting all pods. In policy/v1, an empty selector will select all pods in the namespace.", - "maxUnavailable": "An eviction is allowed if at most \"maxUnavailable\" pods selected by \"selector\" are unavailable after the eviction, i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions by specifying 0. This is a mutually exclusive setting with \"minAvailable\".", - "unhealthyPodEvictionPolicy": "UnhealthyPodEvictionPolicy defines the criteria for when unhealthy pods should be considered for eviction. Current implementation considers healthy pods, as pods that have status.conditions item with type=\"Ready\",status=\"True\".\n\nValid policies are IfHealthyBudget and AlwaysAllow. If no policy is specified, the default behavior will be used, which corresponds to the IfHealthyBudget policy.\n\nIfHealthyBudget policy means that running pods (status.phase=\"Running\"), but not yet healthy can be evicted only if the guarded application is not disrupted (status.currentHealthy is at least equal to status.desiredHealthy). Healthy pods will be subject to the PDB for eviction.\n\nAlwaysAllow policy means that all running pods (status.phase=\"Running\"), but not yet healthy are considered disrupted and can be evicted regardless of whether the criteria in a PDB is met. This means perspective running pods of a disrupted application might not get a chance to become healthy. Healthy pods will be subject to the PDB for eviction.\n\nAdditional policies may be added in the future. Clients making eviction decisions should disallow eviction of unhealthy pods if they encounter an unrecognized policy in this field.", + "minAvailable": "minAvailable indicates that an eviction is allowed if at least \"minAvailable\" pods selected by \"selector\" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying \"100%\".", + "selector": "selector is a label query over pods whose evictions are managed by the disruption budget. A null selector selects no pods. An empty selector ({}) also selects no pods, which differs from standard behavior of selecting all pods. In policy/v1, an empty selector will select all pods in the namespace.", + "maxUnavailable": "maxUnavailable indicates that an eviction is allowed if at most \"maxUnavailable\" pods selected by \"selector\" are unavailable after the eviction, i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions by specifying 0. This is a mutually exclusive setting with \"minAvailable\".", + "unhealthyPodEvictionPolicy": "unhealthyPodEvictionPolicy defines the criteria for when unhealthy pods should be considered for eviction. Current implementation considers healthy pods, as pods that have status.conditions item with type=\"Ready\",status=\"True\".\n\nValid policies are IfHealthyBudget and AlwaysAllow. If no policy is specified, the default behavior will be used, which corresponds to the IfHealthyBudget policy.\n\nIfHealthyBudget policy means that running pods (status.phase=\"Running\"), but not yet healthy can be evicted only if the guarded application is not disrupted (status.currentHealthy is at least equal to status.desiredHealthy). Healthy pods will be subject to the PDB for eviction.\n\nAlwaysAllow policy means that all running pods (status.phase=\"Running\"), but not yet healthy are considered disrupted and can be evicted regardless of whether the criteria in a PDB is met. This means perspective running pods of a disrupted application might not get a chance to become healthy. Healthy pods will be subject to the PDB for eviction.\n\nAdditional policies may be added in the future. Clients making eviction decisions should disallow eviction of unhealthy pods if they encounter an unrecognized policy in this field.", } func (PodDisruptionBudgetSpec) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/rbac/v1/generated.proto b/vendor/k8s.io/api/rbac/v1/generated.proto index 7b4ec2afc1..9a2489b7a8 100644 --- a/vendor/k8s.io/api/rbac/v1/generated.proto +++ b/vendor/k8s.io/api/rbac/v1/generated.proto @@ -30,7 +30,7 @@ option go_package = "k8s.io/api/rbac/v1"; // AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole message AggregationRule { - // ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. + // clusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. // If any of the selectors match, then the ClusterRole's permissions will be added // +optional // +listType=atomic @@ -39,17 +39,17 @@ message AggregationRule { // ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. message ClusterRole { - // Standard object's metadata. + // metadata is the standard object's metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Rules holds all the PolicyRules for this ClusterRole + // rules holds all the PolicyRules for this ClusterRole // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated PolicyRule rules = 2; - // AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. + // aggregationRule is an optional field that describes how to build the Rules for this ClusterRole. // If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be // stomped by the controller. // +optional @@ -59,20 +59,21 @@ message ClusterRole { // ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace, // and adds who information via Subject. message ClusterRoleBinding { - // Standard object's metadata. + // metadata is the standard object's metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Subjects holds references to the objects the role applies to. + // subjects holds references to the objects the role applies to. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated Subject subjects = 2; - // RoleRef can only reference a ClusterRole in the global namespace. + // roleRef can only reference a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. // This field is immutable. // +required + // +k8s:alpha(since:"1.37")=+k8s:immutable optional RoleRef roleRef = 3; } @@ -99,29 +100,29 @@ message ClusterRoleList { // PolicyRule holds information that describes a policy rule, but does not contain information // about who the rule applies to or which namespace the rule applies to. message PolicyRule { - // Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. + // verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. // +listType=atomic // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required repeated string verbs = 1; - // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of + // apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of // the enumerated resources in any API group will be allowed. "" represents the core API group and "*" represents all API groups. // +optional // +listType=atomic repeated string apiGroups = 2; - // Resources is a list of resources this rule applies to. '*' represents all resources. + // resources is a list of resources this rule applies to. '*' represents all resources. // +optional // +listType=atomic repeated string resources = 3; - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. // +optional // +listType=atomic repeated string resourceNames = 4; - // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path + // nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path // Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. // Rules can either apply to API resources (such as "pods" or "secrets") or non-resource URL paths (such as "/api"), but not both. // +optional @@ -131,14 +132,14 @@ message PolicyRule { // Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. message Role { - // Standard object's metadata. + // metadata is the standard object's metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Rules holds all the PolicyRules for this Role + // rules holds all the PolicyRules for this Role // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated PolicyRule rules = 2; } @@ -146,20 +147,21 @@ message Role { // It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given // namespace only have effect in that namespace. message RoleBinding { - // Standard object's metadata. + // metadata is the standard object's metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Subjects holds references to the objects the role applies to. + // subjects holds references to the objects the role applies to. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated Subject subjects = 2; - // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. + // roleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. // This field is immutable. // +required + // +k8s:alpha(since:"1.37")=+k8s:immutable optional RoleRef roleRef = 3; } @@ -186,17 +188,17 @@ message RoleList { // RoleRef contains information that points to the role being used // +structType=atomic message RoleRef { - // APIGroup is the group for the resource being referenced + // apiGroup is the group for the resource being referenced // +optional optional string apiGroup = 1; - // Kind is the type of resource being referenced + // kind is the type of resource being referenced // +required optional string kind = 2; - // Name is the name of resource being referenced + // name is the name of resource being referenced // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string name = 3; } @@ -204,23 +206,23 @@ message RoleRef { // or a value for non-objects such as user and group names. // +structType=atomic message Subject { - // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". + // kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". // If the Authorizer does not recognized the kind value, the Authorizer should report an error. // +required optional string kind = 1; - // APIGroup holds the API group of the referenced subject. + // apiGroup holds the API group of the referenced subject. // Defaults to "" for ServiceAccount subjects. // Defaults to "rbac.authorization.k8s.io" for User and Group subjects. // +optional optional string apiGroup = 2; - // Name of the object being referenced. + // name of the object being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string name = 3; - // Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty + // namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty // the Authorizer should report an error. // +optional optional string namespace = 4; diff --git a/vendor/k8s.io/api/rbac/v1/types.go b/vendor/k8s.io/api/rbac/v1/types.go index d3bb6d1a9c..a1e96067e2 100644 --- a/vendor/k8s.io/api/rbac/v1/types.go +++ b/vendor/k8s.io/api/rbac/v1/types.go @@ -47,27 +47,27 @@ const ( // PolicyRule holds information that describes a policy rule, but does not contain information // about who the rule applies to or which namespace the rule applies to. type PolicyRule struct { - // Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. + // verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. // +listType=atomic // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` - // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of + // apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of // the enumerated resources in any API group will be allowed. "" represents the core API group and "*" represents all API groups. // +optional // +listType=atomic APIGroups []string `json:"apiGroups,omitempty" protobuf:"bytes,2,rep,name=apiGroups"` - // Resources is a list of resources this rule applies to. '*' represents all resources. + // resources is a list of resources this rule applies to. '*' represents all resources. // +optional // +listType=atomic Resources []string `json:"resources,omitempty" protobuf:"bytes,3,rep,name=resources"` - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. // +optional // +listType=atomic ResourceNames []string `json:"resourceNames,omitempty" protobuf:"bytes,4,rep,name=resourceNames"` - // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path + // nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path // Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. // Rules can either apply to API resources (such as "pods" or "secrets") or non-resource URL paths (such as "/api"), but not both. // +optional @@ -79,20 +79,20 @@ type PolicyRule struct { // or a value for non-objects such as user and group names. // +structType=atomic type Subject struct { - // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". + // kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". // If the Authorizer does not recognized the kind value, the Authorizer should report an error. // +required Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"` - // APIGroup holds the API group of the referenced subject. + // apiGroup holds the API group of the referenced subject. // Defaults to "" for ServiceAccount subjects. // Defaults to "rbac.authorization.k8s.io" for User and Group subjects. // +optional APIGroup string `json:"apiGroup,omitempty" protobuf:"bytes,2,opt,name=apiGroup"` - // Name of the object being referenced. + // name of the object being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Name string `json:"name" protobuf:"bytes,3,opt,name=name"` - // Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty + // namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty // the Authorizer should report an error. // +optional Namespace string `json:"namespace,omitempty" protobuf:"bytes,4,opt,name=namespace"` @@ -101,15 +101,15 @@ type Subject struct { // RoleRef contains information that points to the role being used // +structType=atomic type RoleRef struct { - // APIGroup is the group for the resource being referenced + // apiGroup is the group for the resource being referenced // +optional APIGroup string `json:"apiGroup" protobuf:"bytes,1,opt,name=apiGroup"` - // Kind is the type of resource being referenced + // kind is the type of resource being referenced // +required Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` - // Name is the name of resource being referenced + // name is the name of resource being referenced // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Name string `json:"name" protobuf:"bytes,3,opt,name=name"` } @@ -119,15 +119,15 @@ type RoleRef struct { // Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. type Role struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object's metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Rules holds all the PolicyRules for this Role + // rules holds all the PolicyRules for this Role // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"` } @@ -139,21 +139,22 @@ type Role struct { // It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given // namespace only have effect in that namespace. type RoleBinding struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object's metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Subjects holds references to the objects the role applies to. + // subjects holds references to the objects the role applies to. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Subjects []Subject `json:"subjects,omitempty" protobuf:"bytes,2,rep,name=subjects"` - // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. + // roleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. // This field is immutable. // +required + // +k8s:alpha(since:"1.37")=+k8s:immutable RoleRef RoleRef `json:"roleRef" protobuf:"bytes,3,opt,name=roleRef"` } @@ -162,7 +163,7 @@ type RoleBinding struct { // RoleBindingList is a collection of RoleBindings type RoleBindingList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -176,7 +177,7 @@ type RoleBindingList struct { // RoleList is a collection of Roles type RoleList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -192,18 +193,18 @@ type RoleList struct { // ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. type ClusterRole struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object's metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Rules holds all the PolicyRules for this ClusterRole + // rules holds all the PolicyRules for this ClusterRole // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"` - // AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. + // aggregationRule is an optional field that describes how to build the Rules for this ClusterRole. // If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be // stomped by the controller. // +optional @@ -212,7 +213,7 @@ type ClusterRole struct { // AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole type AggregationRule struct { - // ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. + // clusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. // If any of the selectors match, then the ClusterRole's permissions will be added // +optional // +listType=atomic @@ -227,21 +228,22 @@ type AggregationRule struct { // ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace, // and adds who information via Subject. type ClusterRoleBinding struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object's metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Subjects holds references to the objects the role applies to. + // subjects holds references to the objects the role applies to. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Subjects []Subject `json:"subjects,omitempty" protobuf:"bytes,2,rep,name=subjects"` - // RoleRef can only reference a ClusterRole in the global namespace. + // roleRef can only reference a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. // This field is immutable. // +required + // +k8s:alpha(since:"1.37")=+k8s:immutable RoleRef RoleRef `json:"roleRef" protobuf:"bytes,3,opt,name=roleRef"` } @@ -250,7 +252,7 @@ type ClusterRoleBinding struct { // ClusterRoleBindingList is a collection of ClusterRoleBindings type ClusterRoleBindingList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -264,7 +266,7 @@ type ClusterRoleBindingList struct { // ClusterRoleList is a collection of ClusterRoles type ClusterRoleList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/vendor/k8s.io/api/rbac/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/rbac/v1/types_swagger_doc_generated.go index 0471a55944..7cc6a0e3fc 100644 --- a/vendor/k8s.io/api/rbac/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/rbac/v1/types_swagger_doc_generated.go @@ -29,7 +29,7 @@ package v1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_AggregationRule = map[string]string{ "": "AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole", - "clusterRoleSelectors": "ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. If any of the selectors match, then the ClusterRole's permissions will be added", + "clusterRoleSelectors": "clusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. If any of the selectors match, then the ClusterRole's permissions will be added", } func (AggregationRule) SwaggerDoc() map[string]string { @@ -38,9 +38,9 @@ func (AggregationRule) SwaggerDoc() map[string]string { var map_ClusterRole = map[string]string{ "": "ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding.", - "metadata": "Standard object's metadata.", - "rules": "Rules holds all the PolicyRules for this ClusterRole", - "aggregationRule": "AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be stomped by the controller.", + "metadata": "metadata is the standard object's metadata.", + "rules": "rules holds all the PolicyRules for this ClusterRole", + "aggregationRule": "aggregationRule is an optional field that describes how to build the Rules for this ClusterRole. If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be stomped by the controller.", } func (ClusterRole) SwaggerDoc() map[string]string { @@ -49,9 +49,9 @@ func (ClusterRole) SwaggerDoc() map[string]string { var map_ClusterRoleBinding = map[string]string{ "": "ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace, and adds who information via Subject.", - "metadata": "Standard object's metadata.", - "subjects": "Subjects holds references to the objects the role applies to.", - "roleRef": "RoleRef can only reference a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error. This field is immutable.", + "metadata": "metadata is the standard object's metadata.", + "subjects": "subjects holds references to the objects the role applies to.", + "roleRef": "roleRef can only reference a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error. This field is immutable.", } func (ClusterRoleBinding) SwaggerDoc() map[string]string { @@ -80,11 +80,11 @@ func (ClusterRoleList) SwaggerDoc() map[string]string { var map_PolicyRule = map[string]string{ "": "PolicyRule holds information that describes a policy rule, but does not contain information about who the rule applies to or which namespace the rule applies to.", - "verbs": "Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs.", - "apiGroups": "APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"\" represents the core API group and \"*\" represents all API groups.", - "resources": "Resources is a list of resources this rule applies to. '*' represents all resources.", - "resourceNames": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.", - "nonResourceURLs": "NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. Rules can either apply to API resources (such as \"pods\" or \"secrets\") or non-resource URL paths (such as \"/api\"), but not both.", + "verbs": "verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs.", + "apiGroups": "apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"\" represents the core API group and \"*\" represents all API groups.", + "resources": "resources is a list of resources this rule applies to. '*' represents all resources.", + "resourceNames": "resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.", + "nonResourceURLs": "nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. Rules can either apply to API resources (such as \"pods\" or \"secrets\") or non-resource URL paths (such as \"/api\"), but not both.", } func (PolicyRule) SwaggerDoc() map[string]string { @@ -93,8 +93,8 @@ func (PolicyRule) SwaggerDoc() map[string]string { var map_Role = map[string]string{ "": "Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding.", - "metadata": "Standard object's metadata.", - "rules": "Rules holds all the PolicyRules for this Role", + "metadata": "metadata is the standard object's metadata.", + "rules": "rules holds all the PolicyRules for this Role", } func (Role) SwaggerDoc() map[string]string { @@ -103,9 +103,9 @@ func (Role) SwaggerDoc() map[string]string { var map_RoleBinding = map[string]string{ "": "RoleBinding references a role, but does not contain it. It can reference a Role in the same namespace or a ClusterRole in the global namespace. It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given namespace only have effect in that namespace.", - "metadata": "Standard object's metadata.", - "subjects": "Subjects holds references to the objects the role applies to.", - "roleRef": "RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error. This field is immutable.", + "metadata": "metadata is the standard object's metadata.", + "subjects": "subjects holds references to the objects the role applies to.", + "roleRef": "roleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error. This field is immutable.", } func (RoleBinding) SwaggerDoc() map[string]string { @@ -134,9 +134,9 @@ func (RoleList) SwaggerDoc() map[string]string { var map_RoleRef = map[string]string{ "": "RoleRef contains information that points to the role being used", - "apiGroup": "APIGroup is the group for the resource being referenced", - "kind": "Kind is the type of resource being referenced", - "name": "Name is the name of resource being referenced", + "apiGroup": "apiGroup is the group for the resource being referenced", + "kind": "kind is the type of resource being referenced", + "name": "name is the name of resource being referenced", } func (RoleRef) SwaggerDoc() map[string]string { @@ -145,10 +145,10 @@ func (RoleRef) SwaggerDoc() map[string]string { var map_Subject = map[string]string{ "": "Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, or a value for non-objects such as user and group names.", - "kind": "Kind of object being referenced. Values defined by this API group are \"User\", \"Group\", and \"ServiceAccount\". If the Authorizer does not recognized the kind value, the Authorizer should report an error.", - "apiGroup": "APIGroup holds the API group of the referenced subject. Defaults to \"\" for ServiceAccount subjects. Defaults to \"rbac.authorization.k8s.io\" for User and Group subjects.", - "name": "Name of the object being referenced.", - "namespace": "Namespace of the referenced object. If the object kind is non-namespace, such as \"User\" or \"Group\", and this value is not empty the Authorizer should report an error.", + "kind": "kind of object being referenced. Values defined by this API group are \"User\", \"Group\", and \"ServiceAccount\". If the Authorizer does not recognized the kind value, the Authorizer should report an error.", + "apiGroup": "apiGroup holds the API group of the referenced subject. Defaults to \"\" for ServiceAccount subjects. Defaults to \"rbac.authorization.k8s.io\" for User and Group subjects.", + "name": "name of the object being referenced.", + "namespace": "namespace of the referenced object. If the object kind is non-namespace, such as \"User\" or \"Group\", and this value is not empty the Authorizer should report an error.", } func (Subject) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/rbac/v1alpha1/generated.proto b/vendor/k8s.io/api/rbac/v1alpha1/generated.proto index 9551d11921..2046778ae8 100644 --- a/vendor/k8s.io/api/rbac/v1alpha1/generated.proto +++ b/vendor/k8s.io/api/rbac/v1alpha1/generated.proto @@ -30,7 +30,7 @@ option go_package = "k8s.io/api/rbac/v1alpha1"; // AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole message AggregationRule { - // ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. + // clusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. // If any of the selectors match, then the ClusterRole's permissions will be added // +optional // +listType=atomic @@ -40,17 +40,17 @@ message AggregationRule { // ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRole, and will no longer be served in v1.22. message ClusterRole { - // Standard object's metadata. + // metadata is the standard object's metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Rules holds all the PolicyRules for this ClusterRole + // rules holds all the PolicyRules for this ClusterRole // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated PolicyRule rules = 2; - // AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. + // aggregationRule is an optional field that describes how to build the Rules for this ClusterRole. // If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be // stomped by the controller. // +optional @@ -61,19 +61,20 @@ message ClusterRole { // and adds who information via Subject. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRoleBinding, and will no longer be served in v1.22. message ClusterRoleBinding { - // Standard object's metadata. + // metadata is the standard object's metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Subjects holds references to the objects the role applies to. + // subjects holds references to the objects the role applies to. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated Subject subjects = 2; - // RoleRef can only reference a ClusterRole in the global namespace. + // roleRef can only reference a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. // +required + // +k8s:alpha(since:"1.37")=+k8s:immutable optional RoleRef roleRef = 3; } @@ -102,29 +103,29 @@ message ClusterRoleList { // PolicyRule holds information that describes a policy rule, but does not contain information // about who the rule applies to or which namespace the rule applies to. message PolicyRule { - // Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. + // verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. // +listType=atomic // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required repeated string verbs = 1; - // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of + // apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of // the enumerated resources in any API group will be allowed. "" represents the core API group and "*" represents all API groups. // +optional // +listType=atomic repeated string apiGroups = 3; - // Resources is a list of resources this rule applies to. '*' represents all resources. + // resources is a list of resources this rule applies to. '*' represents all resources. // +optional // +listType=atomic repeated string resources = 4; - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. // +optional // +listType=atomic repeated string resourceNames = 5; - // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path + // nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path // Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. // Rules can either apply to API resources (such as "pods" or "secrets") or non-resource URL paths (such as "/api"), but not both. // +optional @@ -135,14 +136,14 @@ message PolicyRule { // Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 Role, and will no longer be served in v1.22. message Role { - // Standard object's metadata. + // metadata is the standard object's metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Rules holds all the PolicyRules for this Role + // rules holds all the PolicyRules for this Role // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated PolicyRule rules = 2; } @@ -151,19 +152,20 @@ message Role { // namespace only have effect in that namespace. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 RoleBinding, and will no longer be served in v1.22. message RoleBinding { - // Standard object's metadata. + // metadata is the standard object's metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Subjects holds references to the objects the role applies to. + // subjects holds references to the objects the role applies to. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated Subject subjects = 2; - // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. + // roleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. // +required + // +k8s:alpha(since:"1.37")=+k8s:immutable optional RoleRef roleRef = 3; } @@ -191,41 +193,41 @@ message RoleList { // RoleRef contains information that points to the role being used message RoleRef { - // APIGroup is the group for the resource being referenced + // apiGroup is the group for the resource being referenced // +optional optional string apiGroup = 1; - // Kind is the type of resource being referenced + // kind is the type of resource being referenced // +required optional string kind = 2; - // Name is the name of resource being referenced + // name is the name of resource being referenced // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string name = 3; } // Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, // or a value for non-objects such as user and group names. message Subject { - // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". + // kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". // If the Authorizer does not recognized the kind value, the Authorizer should report an error. // +required optional string kind = 1; - // APIVersion holds the API group and version of the referenced subject. + // apiVersion holds the API group and version of the referenced subject. // Defaults to "v1" for ServiceAccount subjects. // Defaults to "rbac.authorization.k8s.io/v1alpha1" for User and Group subjects. // +k8s:conversion-gen=false // +optional optional string apiVersion = 2; - // Name of the object being referenced. + // name of the object being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string name = 3; - // Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty + // namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty // the Authorizer should report an error. // +optional optional string namespace = 4; diff --git a/vendor/k8s.io/api/rbac/v1alpha1/types.go b/vendor/k8s.io/api/rbac/v1alpha1/types.go index 4ff4c06015..2f560efb4c 100644 --- a/vendor/k8s.io/api/rbac/v1alpha1/types.go +++ b/vendor/k8s.io/api/rbac/v1alpha1/types.go @@ -47,27 +47,27 @@ const ( // PolicyRule holds information that describes a policy rule, but does not contain information // about who the rule applies to or which namespace the rule applies to. type PolicyRule struct { - // Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. + // verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. // +listType=atomic // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` - // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of + // apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of // the enumerated resources in any API group will be allowed. "" represents the core API group and "*" represents all API groups. // +optional // +listType=atomic APIGroups []string `json:"apiGroups,omitempty" protobuf:"bytes,3,rep,name=apiGroups"` - // Resources is a list of resources this rule applies to. '*' represents all resources. + // resources is a list of resources this rule applies to. '*' represents all resources. // +optional // +listType=atomic Resources []string `json:"resources,omitempty" protobuf:"bytes,4,rep,name=resources"` - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. // +optional // +listType=atomic ResourceNames []string `json:"resourceNames,omitempty" protobuf:"bytes,5,rep,name=resourceNames"` - // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path + // nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path // Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. // Rules can either apply to API resources (such as "pods" or "secrets") or non-resource URL paths (such as "/api"), but not both. // +optional @@ -78,21 +78,21 @@ type PolicyRule struct { // Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, // or a value for non-objects such as user and group names. type Subject struct { - // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". + // kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". // If the Authorizer does not recognized the kind value, the Authorizer should report an error. // +required Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"` - // APIVersion holds the API group and version of the referenced subject. + // apiVersion holds the API group and version of the referenced subject. // Defaults to "v1" for ServiceAccount subjects. // Defaults to "rbac.authorization.k8s.io/v1alpha1" for User and Group subjects. // +k8s:conversion-gen=false // +optional APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,2,opt,name=apiVersion"` - // Name of the object being referenced. + // name of the object being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Name string `json:"name" protobuf:"bytes,3,opt,name=name"` - // Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty + // namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty // the Authorizer should report an error. // +optional Namespace string `json:"namespace,omitempty" protobuf:"bytes,4,opt,name=namespace"` @@ -100,15 +100,15 @@ type Subject struct { // RoleRef contains information that points to the role being used type RoleRef struct { - // APIGroup is the group for the resource being referenced + // apiGroup is the group for the resource being referenced // +optional APIGroup string `json:"apiGroup" protobuf:"bytes,1,opt,name=apiGroup"` - // Kind is the type of resource being referenced + // kind is the type of resource being referenced // +required Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` - // Name is the name of resource being referenced + // name is the name of resource being referenced // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Name string `json:"name" protobuf:"bytes,3,opt,name=name"` } @@ -118,15 +118,15 @@ type RoleRef struct { // Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 Role, and will no longer be served in v1.22. type Role struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object's metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Rules holds all the PolicyRules for this Role + // rules holds all the PolicyRules for this Role // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"` } @@ -138,20 +138,21 @@ type Role struct { // namespace only have effect in that namespace. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 RoleBinding, and will no longer be served in v1.22. type RoleBinding struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object's metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Subjects holds references to the objects the role applies to. + // subjects holds references to the objects the role applies to. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Subjects []Subject `json:"subjects,omitempty" protobuf:"bytes,2,rep,name=subjects"` - // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. + // roleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. // +required + // +k8s:alpha(since:"1.37")=+k8s:immutable RoleRef RoleRef `json:"roleRef" protobuf:"bytes,3,opt,name=roleRef"` } @@ -160,7 +161,7 @@ type RoleBinding struct { // RoleBindingList is a collection of RoleBindings // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 RoleBindingList, and will no longer be served in v1.22. type RoleBindingList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -174,7 +175,7 @@ type RoleBindingList struct { // RoleList is a collection of Roles. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 RoleList, and will no longer be served in v1.22. type RoleList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -190,18 +191,18 @@ type RoleList struct { // ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRole, and will no longer be served in v1.22. type ClusterRole struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object's metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Rules holds all the PolicyRules for this ClusterRole + // rules holds all the PolicyRules for this ClusterRole // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"` - // AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. + // aggregationRule is an optional field that describes how to build the Rules for this ClusterRole. // If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be // stomped by the controller. // +optional @@ -210,7 +211,7 @@ type ClusterRole struct { // AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole type AggregationRule struct { - // ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. + // clusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. // If any of the selectors match, then the ClusterRole's permissions will be added // +optional // +listType=atomic @@ -225,20 +226,21 @@ type AggregationRule struct { // and adds who information via Subject. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRoleBinding, and will no longer be served in v1.22. type ClusterRoleBinding struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object's metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Subjects holds references to the objects the role applies to. + // subjects holds references to the objects the role applies to. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Subjects []Subject `json:"subjects,omitempty" protobuf:"bytes,2,rep,name=subjects"` - // RoleRef can only reference a ClusterRole in the global namespace. + // roleRef can only reference a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. // +required + // +k8s:alpha(since:"1.37")=+k8s:immutable RoleRef RoleRef `json:"roleRef" protobuf:"bytes,3,opt,name=roleRef"` } @@ -247,7 +249,7 @@ type ClusterRoleBinding struct { // ClusterRoleBindingList is a collection of ClusterRoleBindings. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRoleBindings, and will no longer be served in v1.22. type ClusterRoleBindingList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -261,7 +263,7 @@ type ClusterRoleBindingList struct { // ClusterRoleList is a collection of ClusterRoles. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRoles, and will no longer be served in v1.22. type ClusterRoleList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/vendor/k8s.io/api/rbac/v1alpha1/types_swagger_doc_generated.go b/vendor/k8s.io/api/rbac/v1alpha1/types_swagger_doc_generated.go index 6708f3e58e..03d69326d6 100644 --- a/vendor/k8s.io/api/rbac/v1alpha1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/rbac/v1alpha1/types_swagger_doc_generated.go @@ -29,7 +29,7 @@ package v1alpha1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_AggregationRule = map[string]string{ "": "AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole", - "clusterRoleSelectors": "ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. If any of the selectors match, then the ClusterRole's permissions will be added", + "clusterRoleSelectors": "clusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. If any of the selectors match, then the ClusterRole's permissions will be added", } func (AggregationRule) SwaggerDoc() map[string]string { @@ -38,9 +38,9 @@ func (AggregationRule) SwaggerDoc() map[string]string { var map_ClusterRole = map[string]string{ "": "ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRole, and will no longer be served in v1.22.", - "metadata": "Standard object's metadata.", - "rules": "Rules holds all the PolicyRules for this ClusterRole", - "aggregationRule": "AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be stomped by the controller.", + "metadata": "metadata is the standard object's metadata.", + "rules": "rules holds all the PolicyRules for this ClusterRole", + "aggregationRule": "aggregationRule is an optional field that describes how to build the Rules for this ClusterRole. If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be stomped by the controller.", } func (ClusterRole) SwaggerDoc() map[string]string { @@ -49,9 +49,9 @@ func (ClusterRole) SwaggerDoc() map[string]string { var map_ClusterRoleBinding = map[string]string{ "": "ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace, and adds who information via Subject. Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRoleBinding, and will no longer be served in v1.22.", - "metadata": "Standard object's metadata.", - "subjects": "Subjects holds references to the objects the role applies to.", - "roleRef": "RoleRef can only reference a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error.", + "metadata": "metadata is the standard object's metadata.", + "subjects": "subjects holds references to the objects the role applies to.", + "roleRef": "roleRef can only reference a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error.", } func (ClusterRoleBinding) SwaggerDoc() map[string]string { @@ -80,11 +80,11 @@ func (ClusterRoleList) SwaggerDoc() map[string]string { var map_PolicyRule = map[string]string{ "": "PolicyRule holds information that describes a policy rule, but does not contain information about who the rule applies to or which namespace the rule applies to.", - "verbs": "Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs.", - "apiGroups": "APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"\" represents the core API group and \"*\" represents all API groups.", - "resources": "Resources is a list of resources this rule applies to. '*' represents all resources.", - "resourceNames": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.", - "nonResourceURLs": "NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. Rules can either apply to API resources (such as \"pods\" or \"secrets\") or non-resource URL paths (such as \"/api\"), but not both.", + "verbs": "verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs.", + "apiGroups": "apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"\" represents the core API group and \"*\" represents all API groups.", + "resources": "resources is a list of resources this rule applies to. '*' represents all resources.", + "resourceNames": "resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.", + "nonResourceURLs": "nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. Rules can either apply to API resources (such as \"pods\" or \"secrets\") or non-resource URL paths (such as \"/api\"), but not both.", } func (PolicyRule) SwaggerDoc() map[string]string { @@ -93,8 +93,8 @@ func (PolicyRule) SwaggerDoc() map[string]string { var map_Role = map[string]string{ "": "Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 Role, and will no longer be served in v1.22.", - "metadata": "Standard object's metadata.", - "rules": "Rules holds all the PolicyRules for this Role", + "metadata": "metadata is the standard object's metadata.", + "rules": "rules holds all the PolicyRules for this Role", } func (Role) SwaggerDoc() map[string]string { @@ -103,9 +103,9 @@ func (Role) SwaggerDoc() map[string]string { var map_RoleBinding = map[string]string{ "": "RoleBinding references a role, but does not contain it. It can reference a Role in the same namespace or a ClusterRole in the global namespace. It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given namespace only have effect in that namespace. Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 RoleBinding, and will no longer be served in v1.22.", - "metadata": "Standard object's metadata.", - "subjects": "Subjects holds references to the objects the role applies to.", - "roleRef": "RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error.", + "metadata": "metadata is the standard object's metadata.", + "subjects": "subjects holds references to the objects the role applies to.", + "roleRef": "roleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error.", } func (RoleBinding) SwaggerDoc() map[string]string { @@ -134,9 +134,9 @@ func (RoleList) SwaggerDoc() map[string]string { var map_RoleRef = map[string]string{ "": "RoleRef contains information that points to the role being used", - "apiGroup": "APIGroup is the group for the resource being referenced", - "kind": "Kind is the type of resource being referenced", - "name": "Name is the name of resource being referenced", + "apiGroup": "apiGroup is the group for the resource being referenced", + "kind": "kind is the type of resource being referenced", + "name": "name is the name of resource being referenced", } func (RoleRef) SwaggerDoc() map[string]string { @@ -145,10 +145,10 @@ func (RoleRef) SwaggerDoc() map[string]string { var map_Subject = map[string]string{ "": "Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, or a value for non-objects such as user and group names.", - "kind": "Kind of object being referenced. Values defined by this API group are \"User\", \"Group\", and \"ServiceAccount\". If the Authorizer does not recognized the kind value, the Authorizer should report an error.", - "apiVersion": "APIVersion holds the API group and version of the referenced subject. Defaults to \"v1\" for ServiceAccount subjects. Defaults to \"rbac.authorization.k8s.io/v1alpha1\" for User and Group subjects.", - "name": "Name of the object being referenced.", - "namespace": "Namespace of the referenced object. If the object kind is non-namespace, such as \"User\" or \"Group\", and this value is not empty the Authorizer should report an error.", + "kind": "kind of object being referenced. Values defined by this API group are \"User\", \"Group\", and \"ServiceAccount\". If the Authorizer does not recognized the kind value, the Authorizer should report an error.", + "apiVersion": "apiVersion holds the API group and version of the referenced subject. Defaults to \"v1\" for ServiceAccount subjects. Defaults to \"rbac.authorization.k8s.io/v1alpha1\" for User and Group subjects.", + "name": "name of the object being referenced.", + "namespace": "namespace of the referenced object. If the object kind is non-namespace, such as \"User\" or \"Group\", and this value is not empty the Authorizer should report an error.", } func (Subject) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/rbac/v1beta1/generated.proto b/vendor/k8s.io/api/rbac/v1beta1/generated.proto index 326f312ec4..d459646be8 100644 --- a/vendor/k8s.io/api/rbac/v1beta1/generated.proto +++ b/vendor/k8s.io/api/rbac/v1beta1/generated.proto @@ -30,7 +30,7 @@ option go_package = "k8s.io/api/rbac/v1beta1"; // AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole message AggregationRule { - // ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. + // clusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. // If any of the selectors match, then the ClusterRole's permissions will be added // +optional // +listType=atomic @@ -40,17 +40,17 @@ message AggregationRule { // ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRole, and will no longer be served in v1.22. message ClusterRole { - // Standard object's metadata. + // metadata is the standard object's metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Rules holds all the PolicyRules for this ClusterRole + // rules holds all the PolicyRules for this ClusterRole // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated PolicyRule rules = 2; - // AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. + // aggregationRule is an optional field that describes how to build the Rules for this ClusterRole. // If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be // stomped by the controller. // +optional @@ -61,19 +61,20 @@ message ClusterRole { // and adds who information via Subject. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRoleBinding, and will no longer be served in v1.22. message ClusterRoleBinding { - // Standard object's metadata. + // metadata is the standard object's metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Subjects holds references to the objects the role applies to. + // subjects holds references to the objects the role applies to. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated Subject subjects = 2; - // RoleRef can only reference a ClusterRole in the global namespace. + // roleRef can only reference a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. // +required + // +k8s:alpha(since:"1.37")=+k8s:immutable optional RoleRef roleRef = 3; } @@ -102,30 +103,30 @@ message ClusterRoleList { // PolicyRule holds information that describes a policy rule, but does not contain information // about who the rule applies to or which namespace the rule applies to. message PolicyRule { - // Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. + // verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. // +listType=atomic // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required repeated string verbs = 1; - // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of + // apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of // the enumerated resources in any API group will be allowed. "" represents the core API group and "*" represents all API groups. // +optional // +listType=atomic repeated string apiGroups = 2; - // Resources is a list of resources this rule applies to. '*' represents all resources in the specified apiGroups. + // resources is a list of resources this rule applies to. '*' represents all resources in the specified apiGroups. // '*/foo' represents the subresource 'foo' for all resources in the specified apiGroups. // +optional // +listType=atomic repeated string resources = 3; - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. // +optional // +listType=atomic repeated string resourceNames = 4; - // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path + // nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path // Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. // Rules can either apply to API resources (such as "pods" or "secrets") or non-resource URL paths (such as "/api"), but not both. // +optional @@ -136,14 +137,14 @@ message PolicyRule { // Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 Role, and will no longer be served in v1.22. message Role { - // Standard object's metadata. + // metadata is the standard object's metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Rules holds all the PolicyRules for this Role + // rules holds all the PolicyRules for this Role // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated PolicyRule rules = 2; } @@ -152,19 +153,20 @@ message Role { // namespace only have effect in that namespace. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 RoleBinding, and will no longer be served in v1.22. message RoleBinding { - // Standard object's metadata. + // metadata is the standard object's metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Subjects holds references to the objects the role applies to. + // subjects holds references to the objects the role applies to. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated Subject subjects = 2; - // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. + // roleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. // +required + // +k8s:alpha(since:"1.37")=+k8s:immutable optional RoleRef roleRef = 3; } @@ -192,40 +194,40 @@ message RoleList { // RoleRef contains information that points to the role being used message RoleRef { - // APIGroup is the group for the resource being referenced + // apiGroup is the group for the resource being referenced // +optional optional string apiGroup = 1; - // Kind is the type of resource being referenced + // kind is the type of resource being referenced // +required optional string kind = 2; - // Name is the name of resource being referenced + // name is the name of resource being referenced // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string name = 3; } // Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, // or a value for non-objects such as user and group names. message Subject { - // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". + // kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". // If the Authorizer does not recognized the kind value, the Authorizer should report an error. // +required optional string kind = 1; - // APIGroup holds the API group of the referenced subject. + // apiGroup holds the API group of the referenced subject. // Defaults to "" for ServiceAccount subjects. // Defaults to "rbac.authorization.k8s.io" for User and Group subjects. // +optional optional string apiGroup = 2; - // Name of the object being referenced. + // name of the object being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string name = 3; - // Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty + // namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty // the Authorizer should report an error. // +optional optional string namespace = 4; diff --git a/vendor/k8s.io/api/rbac/v1beta1/types.go b/vendor/k8s.io/api/rbac/v1beta1/types.go index c653d071fe..a635661a8d 100644 --- a/vendor/k8s.io/api/rbac/v1beta1/types.go +++ b/vendor/k8s.io/api/rbac/v1beta1/types.go @@ -47,28 +47,28 @@ const ( // PolicyRule holds information that describes a policy rule, but does not contain information // about who the rule applies to or which namespace the rule applies to. type PolicyRule struct { - // Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. + // verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. // +listType=atomic // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` - // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of + // apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of // the enumerated resources in any API group will be allowed. "" represents the core API group and "*" represents all API groups. // +optional // +listType=atomic APIGroups []string `json:"apiGroups,omitempty" protobuf:"bytes,2,rep,name=apiGroups"` - // Resources is a list of resources this rule applies to. '*' represents all resources in the specified apiGroups. + // resources is a list of resources this rule applies to. '*' represents all resources in the specified apiGroups. // '*/foo' represents the subresource 'foo' for all resources in the specified apiGroups. // +optional // +listType=atomic Resources []string `json:"resources,omitempty" protobuf:"bytes,3,rep,name=resources"` - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. // +optional // +listType=atomic ResourceNames []string `json:"resourceNames,omitempty" protobuf:"bytes,4,rep,name=resourceNames"` - // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path + // nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path // Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. // Rules can either apply to API resources (such as "pods" or "secrets") or non-resource URL paths (such as "/api"), but not both. // +optional @@ -79,20 +79,20 @@ type PolicyRule struct { // Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, // or a value for non-objects such as user and group names. type Subject struct { - // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". + // kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". // If the Authorizer does not recognized the kind value, the Authorizer should report an error. // +required Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"` - // APIGroup holds the API group of the referenced subject. + // apiGroup holds the API group of the referenced subject. // Defaults to "" for ServiceAccount subjects. // Defaults to "rbac.authorization.k8s.io" for User and Group subjects. // +optional APIGroup string `json:"apiGroup,omitempty" protobuf:"bytes,2,opt,name=apiGroup"` - // Name of the object being referenced. + // name of the object being referenced. // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Name string `json:"name" protobuf:"bytes,3,opt,name=name"` - // Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty + // namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty // the Authorizer should report an error. // +optional Namespace string `json:"namespace,omitempty" protobuf:"bytes,4,opt,name=namespace"` @@ -100,15 +100,15 @@ type Subject struct { // RoleRef contains information that points to the role being used type RoleRef struct { - // APIGroup is the group for the resource being referenced + // apiGroup is the group for the resource being referenced // +optional APIGroup string `json:"apiGroup" protobuf:"bytes,1,opt,name=apiGroup"` - // Kind is the type of resource being referenced + // kind is the type of resource being referenced // +required Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` - // Name is the name of resource being referenced + // name is the name of resource being referenced // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Name string `json:"name" protobuf:"bytes,3,opt,name=name"` } @@ -122,15 +122,15 @@ type RoleRef struct { // Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 Role, and will no longer be served in v1.22. type Role struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object's metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Rules holds all the PolicyRules for this Role + // rules holds all the PolicyRules for this Role // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"` } @@ -146,20 +146,21 @@ type Role struct { // namespace only have effect in that namespace. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 RoleBinding, and will no longer be served in v1.22. type RoleBinding struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object's metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Subjects holds references to the objects the role applies to. + // subjects holds references to the objects the role applies to. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Subjects []Subject `json:"subjects,omitempty" protobuf:"bytes,2,rep,name=subjects"` - // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. + // roleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. // +required + // +k8s:alpha(since:"1.37")=+k8s:immutable RoleRef RoleRef `json:"roleRef" protobuf:"bytes,3,opt,name=roleRef"` } @@ -172,7 +173,7 @@ type RoleBinding struct { // RoleBindingList is a collection of RoleBindings // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 RoleBindingList, and will no longer be served in v1.22. type RoleBindingList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -190,7 +191,7 @@ type RoleBindingList struct { // RoleList is a collection of Roles // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 RoleList, and will no longer be served in v1.22. type RoleList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -210,17 +211,17 @@ type RoleList struct { // ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRole, and will no longer be served in v1.22. type ClusterRole struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object's metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Rules holds all the PolicyRules for this ClusterRole + // rules holds all the PolicyRules for this ClusterRole // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"` - // AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. + // aggregationRule is an optional field that describes how to build the Rules for this ClusterRole. // If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be // stomped by the controller. // +optional @@ -229,7 +230,7 @@ type ClusterRole struct { // AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole type AggregationRule struct { - // ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. + // clusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. // If any of the selectors match, then the ClusterRole's permissions will be added // +optional // +listType=atomic @@ -248,20 +249,21 @@ type AggregationRule struct { // and adds who information via Subject. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRoleBinding, and will no longer be served in v1.22. type ClusterRoleBinding struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object's metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Subjects holds references to the objects the role applies to. + // subjects holds references to the objects the role applies to. // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Subjects []Subject `json:"subjects,omitempty" protobuf:"bytes,2,rep,name=subjects"` - // RoleRef can only reference a ClusterRole in the global namespace. + // roleRef can only reference a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. // +required + // +k8s:alpha(since:"1.37")=+k8s:immutable RoleRef RoleRef `json:"roleRef" protobuf:"bytes,3,opt,name=roleRef"` } @@ -274,7 +276,7 @@ type ClusterRoleBinding struct { // ClusterRoleBindingList is a collection of ClusterRoleBindings. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRoleBindingList, and will no longer be served in v1.22. type ClusterRoleBindingList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -292,7 +294,7 @@ type ClusterRoleBindingList struct { // ClusterRoleList is a collection of ClusterRoles. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRoles, and will no longer be served in v1.22. type ClusterRoleList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/vendor/k8s.io/api/rbac/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/rbac/v1beta1/types_swagger_doc_generated.go index fff1fe40fa..0b03d85e62 100644 --- a/vendor/k8s.io/api/rbac/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/rbac/v1beta1/types_swagger_doc_generated.go @@ -29,7 +29,7 @@ package v1beta1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_AggregationRule = map[string]string{ "": "AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole", - "clusterRoleSelectors": "ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. If any of the selectors match, then the ClusterRole's permissions will be added", + "clusterRoleSelectors": "clusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. If any of the selectors match, then the ClusterRole's permissions will be added", } func (AggregationRule) SwaggerDoc() map[string]string { @@ -38,9 +38,9 @@ func (AggregationRule) SwaggerDoc() map[string]string { var map_ClusterRole = map[string]string{ "": "ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRole, and will no longer be served in v1.22.", - "metadata": "Standard object's metadata.", - "rules": "Rules holds all the PolicyRules for this ClusterRole", - "aggregationRule": "AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be stomped by the controller.", + "metadata": "metadata is the standard object's metadata.", + "rules": "rules holds all the PolicyRules for this ClusterRole", + "aggregationRule": "aggregationRule is an optional field that describes how to build the Rules for this ClusterRole. If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be stomped by the controller.", } func (ClusterRole) SwaggerDoc() map[string]string { @@ -49,9 +49,9 @@ func (ClusterRole) SwaggerDoc() map[string]string { var map_ClusterRoleBinding = map[string]string{ "": "ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace, and adds who information via Subject. Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRoleBinding, and will no longer be served in v1.22.", - "metadata": "Standard object's metadata.", - "subjects": "Subjects holds references to the objects the role applies to.", - "roleRef": "RoleRef can only reference a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error.", + "metadata": "metadata is the standard object's metadata.", + "subjects": "subjects holds references to the objects the role applies to.", + "roleRef": "roleRef can only reference a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error.", } func (ClusterRoleBinding) SwaggerDoc() map[string]string { @@ -80,11 +80,11 @@ func (ClusterRoleList) SwaggerDoc() map[string]string { var map_PolicyRule = map[string]string{ "": "PolicyRule holds information that describes a policy rule, but does not contain information about who the rule applies to or which namespace the rule applies to.", - "verbs": "Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs.", - "apiGroups": "APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"\" represents the core API group and \"*\" represents all API groups.", - "resources": "Resources is a list of resources this rule applies to. '*' represents all resources in the specified apiGroups. '*/foo' represents the subresource 'foo' for all resources in the specified apiGroups.", - "resourceNames": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.", - "nonResourceURLs": "NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. Rules can either apply to API resources (such as \"pods\" or \"secrets\") or non-resource URL paths (such as \"/api\"), but not both.", + "verbs": "verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs.", + "apiGroups": "apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"\" represents the core API group and \"*\" represents all API groups.", + "resources": "resources is a list of resources this rule applies to. '*' represents all resources in the specified apiGroups. '*/foo' represents the subresource 'foo' for all resources in the specified apiGroups.", + "resourceNames": "resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.", + "nonResourceURLs": "nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. Rules can either apply to API resources (such as \"pods\" or \"secrets\") or non-resource URL paths (such as \"/api\"), but not both.", } func (PolicyRule) SwaggerDoc() map[string]string { @@ -93,8 +93,8 @@ func (PolicyRule) SwaggerDoc() map[string]string { var map_Role = map[string]string{ "": "Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 Role, and will no longer be served in v1.22.", - "metadata": "Standard object's metadata.", - "rules": "Rules holds all the PolicyRules for this Role", + "metadata": "metadata is the standard object's metadata.", + "rules": "rules holds all the PolicyRules for this Role", } func (Role) SwaggerDoc() map[string]string { @@ -103,9 +103,9 @@ func (Role) SwaggerDoc() map[string]string { var map_RoleBinding = map[string]string{ "": "RoleBinding references a role, but does not contain it. It can reference a Role in the same namespace or a ClusterRole in the global namespace. It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given namespace only have effect in that namespace. Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 RoleBinding, and will no longer be served in v1.22.", - "metadata": "Standard object's metadata.", - "subjects": "Subjects holds references to the objects the role applies to.", - "roleRef": "RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error.", + "metadata": "metadata is the standard object's metadata.", + "subjects": "subjects holds references to the objects the role applies to.", + "roleRef": "roleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error.", } func (RoleBinding) SwaggerDoc() map[string]string { @@ -134,9 +134,9 @@ func (RoleList) SwaggerDoc() map[string]string { var map_RoleRef = map[string]string{ "": "RoleRef contains information that points to the role being used", - "apiGroup": "APIGroup is the group for the resource being referenced", - "kind": "Kind is the type of resource being referenced", - "name": "Name is the name of resource being referenced", + "apiGroup": "apiGroup is the group for the resource being referenced", + "kind": "kind is the type of resource being referenced", + "name": "name is the name of resource being referenced", } func (RoleRef) SwaggerDoc() map[string]string { @@ -145,10 +145,10 @@ func (RoleRef) SwaggerDoc() map[string]string { var map_Subject = map[string]string{ "": "Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, or a value for non-objects such as user and group names.", - "kind": "Kind of object being referenced. Values defined by this API group are \"User\", \"Group\", and \"ServiceAccount\". If the Authorizer does not recognized the kind value, the Authorizer should report an error.", - "apiGroup": "APIGroup holds the API group of the referenced subject. Defaults to \"\" for ServiceAccount subjects. Defaults to \"rbac.authorization.k8s.io\" for User and Group subjects.", - "name": "Name of the object being referenced.", - "namespace": "Namespace of the referenced object. If the object kind is non-namespace, such as \"User\" or \"Group\", and this value is not empty the Authorizer should report an error.", + "kind": "kind of object being referenced. Values defined by this API group are \"User\", \"Group\", and \"ServiceAccount\". If the Authorizer does not recognized the kind value, the Authorizer should report an error.", + "apiGroup": "apiGroup holds the API group of the referenced subject. Defaults to \"\" for ServiceAccount subjects. Defaults to \"rbac.authorization.k8s.io\" for User and Group subjects.", + "name": "name of the object being referenced.", + "namespace": "namespace of the referenced object. If the object kind is non-namespace, such as \"User\" or \"Group\", and this value is not empty the Authorizer should report an error.", } func (Subject) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/resource/v1/doc.go b/vendor/k8s.io/api/resource/v1/doc.go index 645c1cb53f..b3a5d93d13 100644 --- a/vendor/k8s.io/api/resource/v1/doc.go +++ b/vendor/k8s.io/api/resource/v1/doc.go @@ -20,6 +20,10 @@ limitations under the License. // +k8s:prerelease-lifecycle-gen=true // +k8s:openapi-model-package=io.k8s.api.resource.v1 // +groupName=resource.k8s.io +// +k8s:validation-gen=TypesWithSuffix=DeviceAttribute +// +k8s:validation-gen=TypesWithSuffix=NetworkDeviceData +// +k8s:validation-gen-input=k8s.io/api/resource/v1 +// +k8s:validation-gen-scheme-registry=nil // Package v1 is the v1 version of the resource API. package v1 diff --git a/vendor/k8s.io/api/resource/v1/generated.pb.go b/vendor/k8s.io/api/resource/v1/generated.pb.go index f59e829057..c0099e888d 100644 --- a/vendor/k8s.io/api/resource/v1/generated.pb.go +++ b/vendor/k8s.io/api/resource/v1/generated.pb.go @@ -82,6 +82,8 @@ func (m *DeviceConstraint) Reset() { *m = DeviceConstraint{} } func (m *DeviceCounterConsumption) Reset() { *m = DeviceCounterConsumption{} } +func (m *DeviceDerivedAttribute) Reset() { *m = DeviceDerivedAttribute{} } + func (m *DeviceRequest) Reset() { *m = DeviceRequest{} } func (m *DeviceRequestAllocationResult) Reset() { *m = DeviceRequestAllocationResult{} } @@ -92,13 +94,27 @@ func (m *DeviceSubRequest) Reset() { *m = DeviceSubRequest{} } func (m *DeviceTaint) Reset() { *m = DeviceTaint{} } +func (m *DeviceTaintRule) Reset() { *m = DeviceTaintRule{} } + +func (m *DeviceTaintRuleList) Reset() { *m = DeviceTaintRuleList{} } + +func (m *DeviceTaintRuleSpec) Reset() { *m = DeviceTaintRuleSpec{} } + +func (m *DeviceTaintRuleStatus) Reset() { *m = DeviceTaintRuleStatus{} } + +func (m *DeviceTaintSelector) Reset() { *m = DeviceTaintSelector{} } + func (m *DeviceToleration) Reset() { *m = DeviceToleration{} } func (m *ExactDeviceRequest) Reset() { *m = ExactDeviceRequest{} } func (m *NetworkDeviceData) Reset() { *m = NetworkDeviceData{} } -func (m *NodeAllocatableResourceMapping) Reset() { *m = NodeAllocatableResourceMapping{} } +func (m *NodeAllocatableMapping) Reset() { *m = NodeAllocatableMapping{} } + +func (m *NodeAllocatableOverhead) Reset() { *m = NodeAllocatableOverhead{} } + +func (m *NodeAllocatableResource) Reset() { *m = NodeAllocatableResource{} } func (m *OpaqueDeviceConfiguration) Reset() { *m = OpaqueDeviceConfiguration{} } @@ -576,14 +592,14 @@ func (m *Device) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.NodeAllocatableResourceMappings) > 0 { - keysForNodeAllocatableResourceMappings := make([]string, 0, len(m.NodeAllocatableResourceMappings)) - for k := range m.NodeAllocatableResourceMappings { - keysForNodeAllocatableResourceMappings = append(keysForNodeAllocatableResourceMappings, string(k)) - } - sort.Strings(keysForNodeAllocatableResourceMappings) - for iNdEx := len(keysForNodeAllocatableResourceMappings) - 1; iNdEx >= 0; iNdEx-- { - v := m.NodeAllocatableResourceMappings[k8s_io_api_core_v1.ResourceName(keysForNodeAllocatableResourceMappings[iNdEx])] + if len(m.NodeAllocatableResources) > 0 { + keysForNodeAllocatableResources := make([]string, 0, len(m.NodeAllocatableResources)) + for k := range m.NodeAllocatableResources { + keysForNodeAllocatableResources = append(keysForNodeAllocatableResources, string(k)) + } + sort.Strings(keysForNodeAllocatableResources) + for iNdEx := len(keysForNodeAllocatableResources) - 1; iNdEx >= 0; iNdEx-- { + v := m.NodeAllocatableResources[k8s_io_api_core_v1.ResourceName(keysForNodeAllocatableResources[iNdEx])] baseI := i { size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) @@ -595,14 +611,14 @@ func (m *Device) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x12 - i -= len(keysForNodeAllocatableResourceMappings[iNdEx]) - copy(dAtA[i:], keysForNodeAllocatableResourceMappings[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(keysForNodeAllocatableResourceMappings[iNdEx]))) + i -= len(keysForNodeAllocatableResources[iNdEx]) + copy(dAtA[i:], keysForNodeAllocatableResources[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(keysForNodeAllocatableResources[iNdEx]))) i-- dAtA[i] = 0xa i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) i-- - dAtA[i] = 0x6a + dAtA[i] = 0x72 } } if m.AllowMultipleAllocations != nil { @@ -1387,6 +1403,15 @@ func (m *DeviceCounterConsumption) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l + if len(m.CompatibilityGroups) > 0 { + for iNdEx := len(m.CompatibilityGroups) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.CompatibilityGroups[iNdEx]) + copy(dAtA[i:], m.CompatibilityGroups[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.CompatibilityGroups[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } if len(m.Counters) > 0 { keysForCounters := make([]string, 0, len(m.Counters)) for k := range m.Counters { @@ -1424,6 +1449,39 @@ func (m *DeviceCounterConsumption) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *DeviceDerivedAttribute) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeviceDerivedAttribute) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeviceDerivedAttribute) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Expression) + copy(dAtA[i:], m.Expression) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Expression))) + i-- + dAtA[i] = 0x12 + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *DeviceRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1498,6 +1556,15 @@ func (m *DeviceRequestAllocationResult) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if len(m.SkipNodeOperations) > 0 { + for iNdEx := len(m.SkipNodeOperations) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.SkipNodeOperations[iNdEx]) + copy(dAtA[i:], m.SkipNodeOperations[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.SkipNodeOperations[iNdEx]))) + i-- + dAtA[i] = 0x5a + } + } if len(m.ConsumedCapacity) > 0 { keysForConsumedCapacity := make([]string, 0, len(m.ConsumedCapacity)) for k := range m.ConsumedCapacity { @@ -1654,6 +1721,20 @@ func (m *DeviceSubRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.DerivedAttributes) > 0 { + for iNdEx := len(m.DerivedAttributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DerivedAttributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } if m.Capacity != nil { { size, err := m.Capacity.MarshalToSizedBuffer(dAtA[:i]) @@ -1765,7 +1846,7 @@ func (m *DeviceTaint) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *DeviceToleration) Marshal() (dAtA []byte, err error) { +func (m *DeviceTaintRule) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1775,45 +1856,50 @@ func (m *DeviceToleration) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *DeviceToleration) MarshalTo(dAtA []byte) (int, error) { +func (m *DeviceTaintRule) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *DeviceToleration) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *DeviceTaintRule) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.TolerationSeconds != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.TolerationSeconds)) - i-- - dAtA[i] = 0x28 + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i -= len(m.Effect) - copy(dAtA[i:], m.Effect) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Effect))) - i-- - dAtA[i] = 0x22 - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Value))) i-- dAtA[i] = 0x1a - i -= len(m.Operator) - copy(dAtA[i:], m.Operator) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Operator))) + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x12 - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Key))) + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *ExactDeviceRequest) Marshal() (dAtA []byte, err error) { +func (m *DeviceTaintRuleList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1823,32 +1909,20 @@ func (m *ExactDeviceRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ExactDeviceRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *DeviceTaintRuleList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ExactDeviceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *DeviceTaintRuleList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Capacity != nil { - { - size, err := m.Capacity.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - if len(m.Tolerations) > 0 { - for iNdEx := len(m.Tolerations) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Tolerations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1856,50 +1930,23 @@ func (m *ExactDeviceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 - } - } - if m.AdminAccess != nil { - i-- - if *m.AdminAccess { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x28 } - i = encodeVarintGenerated(dAtA, i, uint64(m.Count)) - i-- - dAtA[i] = 0x20 - i -= len(m.AllocationMode) - copy(dAtA[i:], m.AllocationMode) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.AllocationMode))) - i-- - dAtA[i] = 0x1a - if len(m.Selectors) > 0 { - for iNdEx := len(m.Selectors) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Selectors[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i -= len(m.DeviceClassName) - copy(dAtA[i:], m.DeviceClassName) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.DeviceClassName))) i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *NetworkDeviceData) Marshal() (dAtA []byte, err error) { +func (m *DeviceTaintRuleSpec) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1909,39 +1956,42 @@ func (m *NetworkDeviceData) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *NetworkDeviceData) MarshalTo(dAtA []byte) (int, error) { +func (m *DeviceTaintRuleSpec) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *NetworkDeviceData) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *DeviceTaintRuleSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - i -= len(m.HardwareAddress) - copy(dAtA[i:], m.HardwareAddress) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.HardwareAddress))) - i-- - dAtA[i] = 0x1a - if len(m.IPs) > 0 { - for iNdEx := len(m.IPs) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.IPs[iNdEx]) - copy(dAtA[i:], m.IPs[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.IPs[iNdEx]))) - i-- - dAtA[i] = 0x12 + { + size, err := m.Taint.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i -= len(m.InterfaceName) - copy(dAtA[i:], m.InterfaceName) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.InterfaceName))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + if m.DeviceSelector != nil { + { + size, err := m.DeviceSelector.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } -func (m *NodeAllocatableResourceMapping) Marshal() (dAtA []byte, err error) { +func (m *DeviceTaintRuleStatus) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1951,39 +2001,34 @@ func (m *NodeAllocatableResourceMapping) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *NodeAllocatableResourceMapping) MarshalTo(dAtA []byte) (int, error) { +func (m *DeviceTaintRuleStatus) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *NodeAllocatableResourceMapping) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *DeviceTaintRuleStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.AllocationMultiplier != nil { - { - size, err := m.AllocationMultiplier.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.Conditions) > 0 { + for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0x12 - } - if m.CapacityKey != nil { - i -= len(*m.CapacityKey) - copy(dAtA[i:], *m.CapacityKey) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.CapacityKey))) - i-- - dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *OpaqueDeviceConfiguration) Marshal() (dAtA []byte, err error) { +func (m *DeviceTaintSelector) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1993,35 +2038,41 @@ func (m *OpaqueDeviceConfiguration) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *OpaqueDeviceConfiguration) MarshalTo(dAtA []byte) (int, error) { +func (m *DeviceTaintSelector) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *OpaqueDeviceConfiguration) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *DeviceTaintSelector) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size, err := m.Parameters.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) + if m.Device != nil { + i -= len(*m.Device) + copy(dAtA[i:], *m.Device) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Device))) + i-- + dAtA[i] = 0x22 + } + if m.Pool != nil { + i -= len(*m.Pool) + copy(dAtA[i:], *m.Pool) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Pool))) + i-- + dAtA[i] = 0x1a + } + if m.Driver != nil { + i -= len(*m.Driver) + copy(dAtA[i:], *m.Driver) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Driver))) + i-- + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x12 - i -= len(m.Driver) - copy(dAtA[i:], m.Driver) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Driver))) - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *ResourceClaim) Marshal() (dAtA []byte, err error) { +func (m *DeviceToleration) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2031,50 +2082,45 @@ func (m *ResourceClaim) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ResourceClaim) MarshalTo(dAtA []byte) (int, error) { +func (m *DeviceToleration) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ResourceClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *DeviceToleration) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) + if m.TolerationSeconds != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.TolerationSeconds)) + i-- + dAtA[i] = 0x28 } + i -= len(m.Effect) + copy(dAtA[i:], m.Effect) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Effect))) + i-- + dAtA[i] = 0x22 + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Value))) i-- dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } + i -= len(m.Operator) + copy(dAtA[i:], m.Operator) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Operator))) i-- dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Key))) i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *ResourceClaimConsumerReference) Marshal() (dAtA []byte, err error) { +func (m *ExactDeviceRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2084,40 +2130,97 @@ func (m *ResourceClaimConsumerReference) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ResourceClaimConsumerReference) MarshalTo(dAtA []byte) (int, error) { +func (m *ExactDeviceRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ResourceClaimConsumerReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ExactDeviceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - i -= len(m.UID) - copy(dAtA[i:], m.UID) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.UID))) - i-- - dAtA[i] = 0x2a - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + if len(m.DerivedAttributes) > 0 { + for iNdEx := len(m.DerivedAttributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DerivedAttributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } + if m.Capacity != nil { + { + size, err := m.Capacity.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + if len(m.Tolerations) > 0 { + for iNdEx := len(m.Tolerations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Tolerations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if m.AdminAccess != nil { + i-- + if *m.AdminAccess { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + i = encodeVarintGenerated(dAtA, i, uint64(m.Count)) i-- - dAtA[i] = 0x22 - i -= len(m.Resource) - copy(dAtA[i:], m.Resource) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Resource))) + dAtA[i] = 0x20 + i -= len(m.AllocationMode) + copy(dAtA[i:], m.AllocationMode) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.AllocationMode))) i-- dAtA[i] = 0x1a - i -= len(m.APIGroup) - copy(dAtA[i:], m.APIGroup) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIGroup))) + if len(m.Selectors) > 0 { + for iNdEx := len(m.Selectors) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Selectors[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + i -= len(m.DeviceClassName) + copy(dAtA[i:], m.DeviceClassName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.DeviceClassName))) i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *ResourceClaimList) Marshal() (dAtA []byte, err error) { +func (m *NetworkDeviceData) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2127,44 +2230,39 @@ func (m *ResourceClaimList) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ResourceClaimList) MarshalTo(dAtA []byte) (int, error) { +func (m *NetworkDeviceData) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ResourceClaimList) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *NetworkDeviceData) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } + i -= len(m.HardwareAddress) + copy(dAtA[i:], m.HardwareAddress) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.HardwareAddress))) + i-- + dAtA[i] = 0x1a + if len(m.IPs) > 0 { + for iNdEx := len(m.IPs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.IPs[iNdEx]) + copy(dAtA[i:], m.IPs[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.IPs[iNdEx]))) i-- dAtA[i] = 0x12 } } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } + i -= len(m.InterfaceName) + copy(dAtA[i:], m.InterfaceName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.InterfaceName))) i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *ResourceClaimSpec) Marshal() (dAtA []byte, err error) { +func (m *NodeAllocatableMapping) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2174,30 +2272,51 @@ func (m *ResourceClaimSpec) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ResourceClaimSpec) MarshalTo(dAtA []byte) (int, error) { +func (m *NodeAllocatableMapping) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ResourceClaimSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *NodeAllocatableMapping) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size, err := m.Devices.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.DeviceMultiplier != nil { + { + size, err := m.DeviceMultiplier.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + if m.CapacityMultiplier != nil { + { + size, err := m.CapacityMultiplier.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.CapacityKey != nil { + i -= len(*m.CapacityKey) + copy(dAtA[i:], *m.CapacityKey) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.CapacityKey))) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *ResourceClaimStatus) Marshal() (dAtA []byte, err error) { +func (m *NodeAllocatableOverhead) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2207,47 +2326,31 @@ func (m *ResourceClaimStatus) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ResourceClaimStatus) MarshalTo(dAtA []byte) (int, error) { +func (m *NodeAllocatableOverhead) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ResourceClaimStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *NodeAllocatableOverhead) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Devices) > 0 { - for iNdEx := len(m.Devices) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Devices[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.ReservedFor) > 0 { - for iNdEx := len(m.ReservedFor) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ReservedFor[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) + if m.PerContainer != nil { + { + size, err := m.PerContainer.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0x12 + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 } - if m.Allocation != nil { + if m.PerPod != nil { { - size, err := m.Allocation.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.PerPod.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2260,7 +2363,7 @@ func (m *ResourceClaimStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ResourceClaimTemplate) Marshal() (dAtA []byte, err error) { +func (m *NodeAllocatableResource) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2270,40 +2373,44 @@ func (m *ResourceClaimTemplate) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ResourceClaimTemplate) MarshalTo(dAtA []byte) (int, error) { +func (m *NodeAllocatableResource) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ResourceClaimTemplate) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *NodeAllocatableResource) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.Overhead != nil { + { + size, err := m.Overhead.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.Mapping != nil { + { + size, err := m.Mapping.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *ResourceClaimTemplateList) Marshal() (dAtA []byte, err error) { +func (m *OpaqueDeviceConfiguration) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2313,32 +2420,18 @@ func (m *ResourceClaimTemplateList) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ResourceClaimTemplateList) MarshalTo(dAtA []byte) (int, error) { +func (m *OpaqueDeviceConfiguration) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ResourceClaimTemplateList) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *OpaqueDeviceConfiguration) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Parameters.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2346,11 +2439,16 @@ func (m *ResourceClaimTemplateList) MarshalToSizedBuffer(dAtA []byte) (int, erro i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x12 + i -= len(m.Driver) + copy(dAtA[i:], m.Driver) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Driver))) + i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *ResourceClaimTemplateSpec) Marshal() (dAtA []byte, err error) { +func (m *ResourceClaim) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2360,16 +2458,26 @@ func (m *ResourceClaimTemplateSpec) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ResourceClaimTemplateSpec) MarshalTo(dAtA []byte) (int, error) { +func (m *ResourceClaim) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ResourceClaimTemplateSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ResourceClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a { size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -2393,7 +2501,7 @@ func (m *ResourceClaimTemplateSpec) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *ResourcePool) Marshal() (dAtA []byte, err error) { +func (m *ResourceClaimConsumerReference) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2403,31 +2511,40 @@ func (m *ResourcePool) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ResourcePool) MarshalTo(dAtA []byte) (int, error) { +func (m *ResourceClaimConsumerReference) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ResourcePool) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ResourceClaimConsumerReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - i = encodeVarintGenerated(dAtA, i, uint64(m.ResourceSliceCount)) - i-- - dAtA[i] = 0x18 - i = encodeVarintGenerated(dAtA, i, uint64(m.Generation)) + i -= len(m.UID) + copy(dAtA[i:], m.UID) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.UID))) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x2a i -= len(m.Name) copy(dAtA[i:], m.Name) i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) i-- + dAtA[i] = 0x22 + i -= len(m.Resource) + copy(dAtA[i:], m.Resource) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Resource))) + i-- + dAtA[i] = 0x1a + i -= len(m.APIGroup) + copy(dAtA[i:], m.APIGroup) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIGroup))) + i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *ResourceSlice) Marshal() (dAtA []byte, err error) { +func (m *ResourceClaimList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2437,28 +2554,32 @@ func (m *ResourceSlice) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ResourceSlice) MarshalTo(dAtA []byte) (int, error) { +func (m *ResourceClaimList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ResourceSlice) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ResourceClaimList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0x12 { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2470,7 +2591,7 @@ func (m *ResourceSlice) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ResourceSliceList) Marshal() (dAtA []byte, err error) { +func (m *ResourceClaimSpec) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2480,32 +2601,18 @@ func (m *ResourceSliceList) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ResourceSliceList) MarshalTo(dAtA []byte) (int, error) { +func (m *ResourceClaimSpec) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ResourceSliceList) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ResourceClaimSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Devices.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2517,7 +2624,7 @@ func (m *ResourceSliceList) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ResourceSliceSpec) Marshal() (dAtA []byte, err error) { +func (m *ResourceClaimStatus) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2527,20 +2634,20 @@ func (m *ResourceSliceSpec) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ResourceSliceSpec) MarshalTo(dAtA []byte) (int, error) { +func (m *ResourceClaimStatus) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ResourceSliceSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ResourceClaimStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.SharedCounters) > 0 { - for iNdEx := len(m.SharedCounters) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Devices) > 0 { + for iNdEx := len(m.Devices) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.SharedCounters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Devices[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2548,23 +2655,13 @@ func (m *ResourceSliceSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x42 - } - } - if m.PerDeviceNodeSelection != nil { - i-- - if *m.PerDeviceNodeSelection { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + dAtA[i] = 0x22 } - i-- - dAtA[i] = 0x38 } - if len(m.Devices) > 0 { - for iNdEx := len(m.Devices) - 1; iNdEx >= 0; iNdEx-- { + if len(m.ReservedFor) > 0 { + for iNdEx := len(m.ReservedFor) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Devices[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ReservedFor[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2572,22 +2669,12 @@ func (m *ResourceSliceSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 - } - } - if m.AllNodes != nil { - i-- - if *m.AllNodes { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x28 } - if m.NodeSelector != nil { + if m.Allocation != nil { { - size, err := m.NodeSelector.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Allocation.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2595,17 +2682,33 @@ func (m *ResourceSliceSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0xa } - if m.NodeName != nil { - i -= len(*m.NodeName) - copy(dAtA[i:], *m.NodeName) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.NodeName))) - i-- - dAtA[i] = 0x1a + return len(dAtA) - i, nil +} + +func (m *ResourceClaimTemplate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *ResourceClaimTemplate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceClaimTemplate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l { - size, err := m.Pool.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2614,311 +2717,651 @@ func (m *ResourceSliceSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x12 - i -= len(m.Driver) - copy(dAtA[i:], m.Driver) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Driver))) + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *ResourceClaimTemplateList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *AllocatedDeviceStatus) Size() (n int) { - if m == nil { - return 0 - } + +func (m *ResourceClaimTemplateList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceClaimTemplateList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Driver) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Pool) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Device) - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Conditions) > 0 { - for _, e := range m.Conditions { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } } - if m.Data != nil { - l = m.Data.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.NetworkData != nil { - l = m.NetworkData.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.ShareID != nil { - l = len(*m.ShareID) - n += 1 + l + sovGenerated(uint64(l)) + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - return n + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *AllocationResult) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Devices.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.NodeSelector != nil { - l = m.NodeSelector.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.AllocationTimestamp != nil { - l = m.AllocationTimestamp.Size() - n += 1 + l + sovGenerated(uint64(l)) +func (m *ResourceClaimTemplateSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *CELDeviceSelector) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Expression) - n += 1 + l + sovGenerated(uint64(l)) - return n +func (m *ResourceClaimTemplateSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *CapacityRequestPolicy) Size() (n int) { - if m == nil { - return 0 - } +func (m *ResourceClaimTemplateSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.Default != nil { - l = m.Default.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if len(m.ValidValues) > 0 { - for _, e := range m.ValidValues { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - if m.ValidRange != nil { - l = m.ValidRange.Size() - n += 1 + l + sovGenerated(uint64(l)) + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - return n + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *CapacityRequestPolicyRange) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Min != nil { - l = m.Min.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Max != nil { - l = m.Max.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Step != nil { - l = m.Step.Size() - n += 1 + l + sovGenerated(uint64(l)) +func (m *ResourcePool) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *CapacityRequirements) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Requests) > 0 { - for k, v := range m.Requests { - _ = k - _ = v - l = v.Size() - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) - n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) - } - } - return n +func (m *ResourcePool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Counter) Size() (n int) { - if m == nil { - return 0 - } +func (m *ResourcePool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = m.Value.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n + i = encodeVarintGenerated(dAtA, i, uint64(m.ResourceSliceCount)) + i-- + dAtA[i] = 0x18 + i = encodeVarintGenerated(dAtA, i, uint64(m.Generation)) + i-- + dAtA[i] = 0x10 + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *CounterSet) Size() (n int) { - if m == nil { - return 0 +func (m *ResourceSlice) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *ResourceSlice) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceSlice) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Counters) > 0 { - for k, v := range m.Counters { - _ = k - _ = v - l = v.Size() - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) - n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - return n + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *Device) Size() (n int) { - if m == nil { - return 0 +func (m *ResourceSliceList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *ResourceSliceList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceSliceList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Attributes) > 0 { - for k, v := range m.Attributes { - _ = k - _ = v - l = v.Size() - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) - n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } } - if len(m.Capacity) > 0 { - for k, v := range m.Capacity { - _ = k - _ = v - l = v.Size() - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) - n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - if len(m.ConsumesCounters) > 0 { - for _, e := range m.ConsumesCounters { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ResourceSliceSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceSliceSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceSliceSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SkipNodeOperations) > 0 { + for iNdEx := len(m.SkipNodeOperations) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.SkipNodeOperations[iNdEx]) + copy(dAtA[i:], m.SkipNodeOperations[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.SkipNodeOperations[iNdEx]))) + i-- + dAtA[i] = 0x52 } } - if m.NodeName != nil { - l = len(*m.NodeName) - n += 1 + l + sovGenerated(uint64(l)) + if m.PartitionTypeAttribute != nil { + i -= len(*m.PartitionTypeAttribute) + copy(dAtA[i:], *m.PartitionTypeAttribute) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PartitionTypeAttribute))) + i-- + dAtA[i] = 0x4a } - if m.NodeSelector != nil { - l = m.NodeSelector.Size() - n += 1 + l + sovGenerated(uint64(l)) + if len(m.SharedCounters) > 0 { + for iNdEx := len(m.SharedCounters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.SharedCounters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } + if m.PerDeviceNodeSelection != nil { + i-- + if *m.PerDeviceNodeSelection { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if len(m.Devices) > 0 { + for iNdEx := len(m.Devices) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Devices[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } } if m.AllNodes != nil { - n += 2 + i-- + if *m.AllNodes { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 } - if len(m.Taints) > 0 { - for _, e := range m.Taints { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) + if m.NodeSelector != nil { + { + size, err := m.NodeSelector.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x22 } - if m.BindsToNode != nil { - n += 2 + if m.NodeName != nil { + i -= len(*m.NodeName) + copy(dAtA[i:], *m.NodeName) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.NodeName))) + i-- + dAtA[i] = 0x1a } - if len(m.BindingConditions) > 0 { - for _, s := range m.BindingConditions { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) + { + size, err := m.Pool.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - if len(m.BindingFailureConditions) > 0 { - for _, s := range m.BindingFailureConditions { - l = len(s) + i-- + dAtA[i] = 0x12 + i -= len(m.Driver) + copy(dAtA[i:], m.Driver) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Driver))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { + offset -= sovGenerated(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *AllocatedDeviceStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Driver) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Pool) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Device) + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Conditions) > 0 { + for _, e := range m.Conditions { + l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } - if m.AllowMultipleAllocations != nil { - n += 2 + if m.Data != nil { + l = m.Data.Size() + n += 1 + l + sovGenerated(uint64(l)) } - if len(m.NodeAllocatableResourceMappings) > 0 { - for k, v := range m.NodeAllocatableResourceMappings { - _ = k - _ = v - l = v.Size() - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) - n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) - } + if m.NetworkData != nil { + l = m.NetworkData.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.ShareID != nil { + l = len(*m.ShareID) + n += 1 + l + sovGenerated(uint64(l)) } return n } -func (m *DeviceAllocationConfiguration) Size() (n int) { +func (m *AllocationResult) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Source) + l = m.Devices.Size() n += 1 + l + sovGenerated(uint64(l)) - if len(m.Requests) > 0 { - for _, s := range m.Requests { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) - } + if m.NodeSelector != nil { + l = m.NodeSelector.Size() + n += 1 + l + sovGenerated(uint64(l)) } - l = m.DeviceConfiguration.Size() + if m.AllocationTimestamp != nil { + l = m.AllocationTimestamp.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *CELDeviceSelector) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Expression) n += 1 + l + sovGenerated(uint64(l)) return n } -func (m *DeviceAllocationResult) Size() (n int) { +func (m *CapacityRequestPolicy) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Results) > 0 { - for _, e := range m.Results { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } + if m.Default != nil { + l = m.Default.Size() + n += 1 + l + sovGenerated(uint64(l)) } - if len(m.Config) > 0 { - for _, e := range m.Config { + if len(m.ValidValues) > 0 { + for _, e := range m.ValidValues { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } + if m.ValidRange != nil { + l = m.ValidRange.Size() + n += 1 + l + sovGenerated(uint64(l)) + } return n } -func (m *DeviceAttribute) Size() (n int) { +func (m *CapacityRequestPolicyRange) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.IntValue != nil { - n += 1 + sovGenerated(uint64(*m.IntValue)) - } - if m.BoolValue != nil { - n += 2 + if m.Min != nil { + l = m.Min.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Max != nil { + l = m.Max.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Step != nil { + l = m.Step.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *CapacityRequirements) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Requests) > 0 { + for k, v := range m.Requests { + _ = k + _ = v + l = v.Size() + mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) + n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + } + } + return n +} + +func (m *Counter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Value.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *CounterSet) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Counters) > 0 { + for k, v := range m.Counters { + _ = k + _ = v + l = v.Size() + mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) + n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + } + } + return n +} + +func (m *Device) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Attributes) > 0 { + for k, v := range m.Attributes { + _ = k + _ = v + l = v.Size() + mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) + n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + } + } + if len(m.Capacity) > 0 { + for k, v := range m.Capacity { + _ = k + _ = v + l = v.Size() + mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) + n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + } + } + if len(m.ConsumesCounters) > 0 { + for _, e := range m.ConsumesCounters { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if m.NodeName != nil { + l = len(*m.NodeName) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.NodeSelector != nil { + l = m.NodeSelector.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.AllNodes != nil { + n += 2 + } + if len(m.Taints) > 0 { + for _, e := range m.Taints { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if m.BindsToNode != nil { + n += 2 + } + if len(m.BindingConditions) > 0 { + for _, s := range m.BindingConditions { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.BindingFailureConditions) > 0 { + for _, s := range m.BindingFailureConditions { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + if m.AllowMultipleAllocations != nil { + n += 2 + } + if len(m.NodeAllocatableResources) > 0 { + for k, v := range m.NodeAllocatableResources { + _ = k + _ = v + l = v.Size() + mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) + n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + } + } + return n +} + +func (m *DeviceAllocationConfiguration) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Source) + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Requests) > 0 { + for _, s := range m.Requests { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + l = m.DeviceConfiguration.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *DeviceAllocationResult) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Results) > 0 { + for _, e := range m.Results { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.Config) > 0 { + for _, e := range m.Config { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *DeviceAttribute) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.IntValue != nil { + n += 1 + sovGenerated(uint64(*m.IntValue)) + } + if m.BoolValue != nil { + n += 2 } if m.StringValue != nil { l = len(*m.StringValue) @@ -3129,6 +3572,25 @@ func (m *DeviceCounterConsumption) Size() (n int) { n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) } } + if len(m.CompatibilityGroups) > 0 { + for _, s := range m.CompatibilityGroups { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *DeviceDerivedAttribute) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Expression) + n += 1 + l + sovGenerated(uint64(l)) return n } @@ -3201,6 +3663,12 @@ func (m *DeviceRequestAllocationResult) Size() (n int) { n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) } } + if len(m.SkipNodeOperations) > 0 { + for _, s := range m.SkipNodeOperations { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } return n } @@ -3246,6 +3714,12 @@ func (m *DeviceSubRequest) Size() (n int) { l = m.Capacity.Size() n += 1 + l + sovGenerated(uint64(l)) } + if len(m.DerivedAttributes) > 0 { + for _, e := range m.DerivedAttributes { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } return n } @@ -3268,67 +3742,156 @@ func (m *DeviceTaint) Size() (n int) { return n } -func (m *DeviceToleration) Size() (n int) { +func (m *DeviceTaintRule) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Key) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Operator) + l = m.ObjectMeta.Size() n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Value) + l = m.Spec.Size() n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Effect) + l = m.Status.Size() n += 1 + l + sovGenerated(uint64(l)) - if m.TolerationSeconds != nil { - n += 1 + sovGenerated(uint64(*m.TolerationSeconds)) - } return n } -func (m *ExactDeviceRequest) Size() (n int) { +func (m *DeviceTaintRuleList) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.DeviceClassName) + l = m.ListMeta.Size() n += 1 + l + sovGenerated(uint64(l)) - if len(m.Selectors) > 0 { - for _, e := range m.Selectors { + if len(m.Items) > 0 { + for _, e := range m.Items { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } - l = len(m.AllocationMode) - n += 1 + l + sovGenerated(uint64(l)) - n += 1 + sovGenerated(uint64(m.Count)) - if m.AdminAccess != nil { - n += 2 - } - if len(m.Tolerations) > 0 { - for _, e := range m.Tolerations { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } + return n +} + +func (m *DeviceTaintRuleSpec) Size() (n int) { + if m == nil { + return 0 } - if m.Capacity != nil { - l = m.Capacity.Size() + var l int + _ = l + if m.DeviceSelector != nil { + l = m.DeviceSelector.Size() n += 1 + l + sovGenerated(uint64(l)) } + l = m.Taint.Size() + n += 1 + l + sovGenerated(uint64(l)) return n } -func (m *NetworkDeviceData) Size() (n int) { +func (m *DeviceTaintRuleStatus) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.InterfaceName) - n += 1 + l + sovGenerated(uint64(l)) + if len(m.Conditions) > 0 { + for _, e := range m.Conditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *DeviceTaintSelector) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Driver != nil { + l = len(*m.Driver) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Pool != nil { + l = len(*m.Pool) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Device != nil { + l = len(*m.Device) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *DeviceToleration) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Operator) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Value) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Effect) + n += 1 + l + sovGenerated(uint64(l)) + if m.TolerationSeconds != nil { + n += 1 + sovGenerated(uint64(*m.TolerationSeconds)) + } + return n +} + +func (m *ExactDeviceRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DeviceClassName) + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Selectors) > 0 { + for _, e := range m.Selectors { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + l = len(m.AllocationMode) + n += 1 + l + sovGenerated(uint64(l)) + n += 1 + sovGenerated(uint64(m.Count)) + if m.AdminAccess != nil { + n += 2 + } + if len(m.Tolerations) > 0 { + for _, e := range m.Tolerations { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if m.Capacity != nil { + l = m.Capacity.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.DerivedAttributes) > 0 { + for _, e := range m.DerivedAttributes { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *NetworkDeviceData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.InterfaceName) + n += 1 + l + sovGenerated(uint64(l)) if len(m.IPs) > 0 { for _, s := range m.IPs { l = len(s) @@ -3340,7 +3903,7 @@ func (m *NetworkDeviceData) Size() (n int) { return n } -func (m *NodeAllocatableResourceMapping) Size() (n int) { +func (m *NodeAllocatableMapping) Size() (n int) { if m == nil { return 0 } @@ -3350,8 +3913,46 @@ func (m *NodeAllocatableResourceMapping) Size() (n int) { l = len(*m.CapacityKey) n += 1 + l + sovGenerated(uint64(l)) } - if m.AllocationMultiplier != nil { - l = m.AllocationMultiplier.Size() + if m.CapacityMultiplier != nil { + l = m.CapacityMultiplier.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.DeviceMultiplier != nil { + l = m.DeviceMultiplier.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *NodeAllocatableOverhead) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PerPod != nil { + l = m.PerPod.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.PerContainer != nil { + l = m.PerContainer.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *NodeAllocatableResource) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Mapping != nil { + l = m.Mapping.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Overhead != nil { + l = m.Overhead.Size() n += 1 + l + sovGenerated(uint64(l)) } return n @@ -3577,6 +4178,16 @@ func (m *ResourceSliceSpec) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) } } + if m.PartitionTypeAttribute != nil { + l = len(*m.PartitionTypeAttribute) + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.SkipNodeOperations) > 0 { + for _, s := range m.SkipNodeOperations { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } return n } @@ -3743,16 +4354,16 @@ func (this *Device) String() string { mapStringForCapacity += fmt.Sprintf("%v: %v,", k, this.Capacity[QualifiedName(k)]) } mapStringForCapacity += "}" - keysForNodeAllocatableResourceMappings := make([]string, 0, len(this.NodeAllocatableResourceMappings)) - for k := range this.NodeAllocatableResourceMappings { - keysForNodeAllocatableResourceMappings = append(keysForNodeAllocatableResourceMappings, string(k)) + keysForNodeAllocatableResources := make([]string, 0, len(this.NodeAllocatableResources)) + for k := range this.NodeAllocatableResources { + keysForNodeAllocatableResources = append(keysForNodeAllocatableResources, string(k)) } - sort.Strings(keysForNodeAllocatableResourceMappings) - mapStringForNodeAllocatableResourceMappings := "map[k8s_io_api_core_v1.ResourceName]NodeAllocatableResourceMapping{" - for _, k := range keysForNodeAllocatableResourceMappings { - mapStringForNodeAllocatableResourceMappings += fmt.Sprintf("%v: %v,", k, this.NodeAllocatableResourceMappings[k8s_io_api_core_v1.ResourceName(k)]) + sort.Strings(keysForNodeAllocatableResources) + mapStringForNodeAllocatableResources := "map[k8s_io_api_core_v1.ResourceName]NodeAllocatableResource{" + for _, k := range keysForNodeAllocatableResources { + mapStringForNodeAllocatableResources += fmt.Sprintf("%v: %v,", k, this.NodeAllocatableResources[k8s_io_api_core_v1.ResourceName(k)]) } - mapStringForNodeAllocatableResourceMappings += "}" + mapStringForNodeAllocatableResources += "}" s := strings.Join([]string{`&Device{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `Attributes:` + mapStringForAttributes + `,`, @@ -3766,7 +4377,7 @@ func (this *Device) String() string { `BindingConditions:` + fmt.Sprintf("%v", this.BindingConditions) + `,`, `BindingFailureConditions:` + fmt.Sprintf("%v", this.BindingFailureConditions) + `,`, `AllowMultipleAllocations:` + valueToStringGenerated(this.AllowMultipleAllocations) + `,`, - `NodeAllocatableResourceMappings:` + mapStringForNodeAllocatableResourceMappings + `,`, + `NodeAllocatableResources:` + mapStringForNodeAllocatableResources + `,`, `}`, }, "") return s @@ -3968,6 +4579,18 @@ func (this *DeviceCounterConsumption) String() string { s := strings.Join([]string{`&DeviceCounterConsumption{`, `CounterSet:` + fmt.Sprintf("%v", this.CounterSet) + `,`, `Counters:` + mapStringForCounters + `,`, + `CompatibilityGroups:` + fmt.Sprintf("%v", this.CompatibilityGroups) + `,`, + `}`, + }, "") + return s +} +func (this *DeviceDerivedAttribute) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeviceDerivedAttribute{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Expression:` + fmt.Sprintf("%v", this.Expression) + `,`, `}`, }, "") return s @@ -4019,6 +4642,7 @@ func (this *DeviceRequestAllocationResult) String() string { `BindingFailureConditions:` + fmt.Sprintf("%v", this.BindingFailureConditions) + `,`, `ShareID:` + valueToStringGenerated(this.ShareID) + `,`, `ConsumedCapacity:` + mapStringForConsumedCapacity + `,`, + `SkipNodeOperations:` + fmt.Sprintf("%v", this.SkipNodeOperations) + `,`, `}`, }, "") return s @@ -4047,6 +4671,11 @@ func (this *DeviceSubRequest) String() string { repeatedStringForTolerations += strings.Replace(strings.Replace(f.String(), "DeviceToleration", "DeviceToleration", 1), `&`, ``, 1) + "," } repeatedStringForTolerations += "}" + repeatedStringForDerivedAttributes := "[]DeviceDerivedAttribute{" + for _, f := range this.DerivedAttributes { + repeatedStringForDerivedAttributes += strings.Replace(strings.Replace(f.String(), "DeviceDerivedAttribute", "DeviceDerivedAttribute", 1), `&`, ``, 1) + "," + } + repeatedStringForDerivedAttributes += "}" s := strings.Join([]string{`&DeviceSubRequest{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `DeviceClassName:` + fmt.Sprintf("%v", this.DeviceClassName) + `,`, @@ -4055,6 +4684,73 @@ func (this *DeviceSubRequest) String() string { `Count:` + fmt.Sprintf("%v", this.Count) + `,`, `Tolerations:` + repeatedStringForTolerations + `,`, `Capacity:` + strings.Replace(this.Capacity.String(), "CapacityRequirements", "CapacityRequirements", 1) + `,`, + `DerivedAttributes:` + repeatedStringForDerivedAttributes + `,`, + `}`, + }, "") + return s +} +func (this *DeviceTaintRule) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeviceTaintRule{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "DeviceTaintRuleSpec", "DeviceTaintRuleSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "DeviceTaintRuleStatus", "DeviceTaintRuleStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *DeviceTaintRuleList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]DeviceTaintRule{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "DeviceTaintRule", "DeviceTaintRule", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&DeviceTaintRuleList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *DeviceTaintRuleSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeviceTaintRuleSpec{`, + `DeviceSelector:` + strings.Replace(this.DeviceSelector.String(), "DeviceTaintSelector", "DeviceTaintSelector", 1) + `,`, + `Taint:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Taint), "DeviceTaint", "DeviceTaint", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *DeviceTaintRuleStatus) String() string { + if this == nil { + return "nil" + } + repeatedStringForConditions := "[]Condition{" + for _, f := range this.Conditions { + repeatedStringForConditions += fmt.Sprintf("%v", f) + "," + } + repeatedStringForConditions += "}" + s := strings.Join([]string{`&DeviceTaintRuleStatus{`, + `Conditions:` + repeatedStringForConditions + `,`, + `}`, + }, "") + return s +} +func (this *DeviceTaintSelector) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeviceTaintSelector{`, + `Driver:` + valueToStringGenerated(this.Driver) + `,`, + `Pool:` + valueToStringGenerated(this.Pool) + `,`, + `Device:` + valueToStringGenerated(this.Device) + `,`, `}`, }, "") return s @@ -4087,6 +4783,11 @@ func (this *ExactDeviceRequest) String() string { repeatedStringForTolerations += strings.Replace(strings.Replace(f.String(), "DeviceToleration", "DeviceToleration", 1), `&`, ``, 1) + "," } repeatedStringForTolerations += "}" + repeatedStringForDerivedAttributes := "[]DeviceDerivedAttribute{" + for _, f := range this.DerivedAttributes { + repeatedStringForDerivedAttributes += strings.Replace(strings.Replace(f.String(), "DeviceDerivedAttribute", "DeviceDerivedAttribute", 1), `&`, ``, 1) + "," + } + repeatedStringForDerivedAttributes += "}" s := strings.Join([]string{`&ExactDeviceRequest{`, `DeviceClassName:` + fmt.Sprintf("%v", this.DeviceClassName) + `,`, `Selectors:` + repeatedStringForSelectors + `,`, @@ -4095,6 +4796,7 @@ func (this *ExactDeviceRequest) String() string { `AdminAccess:` + valueToStringGenerated(this.AdminAccess) + `,`, `Tolerations:` + repeatedStringForTolerations + `,`, `Capacity:` + strings.Replace(this.Capacity.String(), "CapacityRequirements", "CapacityRequirements", 1) + `,`, + `DerivedAttributes:` + repeatedStringForDerivedAttributes + `,`, `}`, }, "") return s @@ -4111,13 +4813,36 @@ func (this *NetworkDeviceData) String() string { }, "") return s } -func (this *NodeAllocatableResourceMapping) String() string { +func (this *NodeAllocatableMapping) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&NodeAllocatableResourceMapping{`, + s := strings.Join([]string{`&NodeAllocatableMapping{`, `CapacityKey:` + valueToStringGenerated(this.CapacityKey) + `,`, - `AllocationMultiplier:` + strings.Replace(fmt.Sprintf("%v", this.AllocationMultiplier), "Quantity", "resource.Quantity", 1) + `,`, + `CapacityMultiplier:` + strings.Replace(fmt.Sprintf("%v", this.CapacityMultiplier), "Quantity", "resource.Quantity", 1) + `,`, + `DeviceMultiplier:` + strings.Replace(fmt.Sprintf("%v", this.DeviceMultiplier), "Quantity", "resource.Quantity", 1) + `,`, + `}`, + }, "") + return s +} +func (this *NodeAllocatableOverhead) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NodeAllocatableOverhead{`, + `PerPod:` + strings.Replace(fmt.Sprintf("%v", this.PerPod), "Quantity", "resource.Quantity", 1) + `,`, + `PerContainer:` + strings.Replace(fmt.Sprintf("%v", this.PerContainer), "Quantity", "resource.Quantity", 1) + `,`, + `}`, + }, "") + return s +} +func (this *NodeAllocatableResource) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NodeAllocatableResource{`, + `Mapping:` + strings.Replace(this.Mapping.String(), "NodeAllocatableMapping", "NodeAllocatableMapping", 1) + `,`, + `Overhead:` + strings.Replace(this.Overhead.String(), "NodeAllocatableOverhead", "NodeAllocatableOverhead", 1) + `,`, `}`, }, "") return s @@ -4296,29 +5021,867 @@ func (this *ResourceSliceSpec) String() string { for _, f := range this.SharedCounters { repeatedStringForSharedCounters += strings.Replace(strings.Replace(f.String(), "CounterSet", "CounterSet", 1), `&`, ``, 1) + "," } - repeatedStringForSharedCounters += "}" - s := strings.Join([]string{`&ResourceSliceSpec{`, - `Driver:` + fmt.Sprintf("%v", this.Driver) + `,`, - `Pool:` + strings.Replace(strings.Replace(this.Pool.String(), "ResourcePool", "ResourcePool", 1), `&`, ``, 1) + `,`, - `NodeName:` + valueToStringGenerated(this.NodeName) + `,`, - `NodeSelector:` + strings.Replace(fmt.Sprintf("%v", this.NodeSelector), "NodeSelector", "v11.NodeSelector", 1) + `,`, - `AllNodes:` + valueToStringGenerated(this.AllNodes) + `,`, - `Devices:` + repeatedStringForDevices + `,`, - `PerDeviceNodeSelection:` + valueToStringGenerated(this.PerDeviceNodeSelection) + `,`, - `SharedCounters:` + repeatedStringForSharedCounters + `,`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" + repeatedStringForSharedCounters += "}" + s := strings.Join([]string{`&ResourceSliceSpec{`, + `Driver:` + fmt.Sprintf("%v", this.Driver) + `,`, + `Pool:` + strings.Replace(strings.Replace(this.Pool.String(), "ResourcePool", "ResourcePool", 1), `&`, ``, 1) + `,`, + `NodeName:` + valueToStringGenerated(this.NodeName) + `,`, + `NodeSelector:` + strings.Replace(fmt.Sprintf("%v", this.NodeSelector), "NodeSelector", "v11.NodeSelector", 1) + `,`, + `AllNodes:` + valueToStringGenerated(this.AllNodes) + `,`, + `Devices:` + repeatedStringForDevices + `,`, + `PerDeviceNodeSelection:` + valueToStringGenerated(this.PerDeviceNodeSelection) + `,`, + `SharedCounters:` + repeatedStringForSharedCounters + `,`, + `PartitionTypeAttribute:` + valueToStringGenerated(this.PartitionTypeAttribute) + `,`, + `SkipNodeOperations:` + fmt.Sprintf("%v", this.SkipNodeOperations) + `,`, + `}`, + }, "") + return s +} +func valueToStringGenerated(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *AllocatedDeviceStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AllocatedDeviceStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AllocatedDeviceStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Driver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Driver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pool", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Pool = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Device", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Device = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Conditions = append(m.Conditions, v1.Condition{}) + if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Data == nil { + m.Data = &runtime.RawExtension{} + } + if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkData", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NetworkData == nil { + m.NetworkData = &NetworkDeviceData{} + } + if err := m.NetworkData.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ShareID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ShareID = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AllocationResult) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AllocationResult: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AllocationResult: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Devices", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Devices.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeSelector", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NodeSelector == nil { + m.NodeSelector = &v11.NodeSelector{} + } + if err := m.NodeSelector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllocationTimestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AllocationTimestamp == nil { + m.AllocationTimestamp = &v1.Time{} + } + if err := m.AllocationTimestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CELDeviceSelector) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CELDeviceSelector: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CELDeviceSelector: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Expression", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Expression = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CapacityRequestPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CapacityRequestPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CapacityRequestPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Default", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Default == nil { + m.Default = &resource.Quantity{} + } + if err := m.Default.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidValues", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidValues = append(m.ValidValues, resource.Quantity{}) + if err := m.ValidValues[len(m.ValidValues)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidRange", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ValidRange == nil { + m.ValidRange = &CapacityRequestPolicyRange{} + } + if err := m.ValidRange.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CapacityRequestPolicyRange) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CapacityRequestPolicyRange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CapacityRequestPolicyRange: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Min", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Min == nil { + m.Min = &resource.Quantity{} + } + if err := m.Min.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Max", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Max == nil { + m.Max = &resource.Quantity{} + } + if err := m.Max.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Step", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Step == nil { + m.Step = &resource.Quantity{} + } + if err := m.Step.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) + return nil } -func (m *AllocatedDeviceStatus) Unmarshal(dAtA []byte) error { +func (m *CapacityRequirements) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4341,17 +5904,17 @@ func (m *AllocatedDeviceStatus) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: AllocatedDeviceStatus: wiretype end group for non-group") + return fmt.Errorf("proto: CapacityRequirements: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: AllocatedDeviceStatus: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CapacityRequirements: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Driver", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Requests", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -4361,91 +5924,174 @@ func (m *AllocatedDeviceStatus) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Driver = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pool", wireType) + if m.Requests == nil { + m.Requests = make(map[QualifiedName]resource.Quantity) } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF + var mapkey QualifiedName + mapvalue := &resource.Quantity{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthGenerated + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = QualifiedName(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthGenerated + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthGenerated + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &resource.Quantity{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated + m.Requests[QualifiedName(mapkey)] = *mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + intStringLen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.Pool = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Device", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Counter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated } - if postIndex > l { + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.Device = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Counter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Counter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4472,16 +6118,65 @@ func (m *AllocatedDeviceStatus) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Conditions = append(m.Conditions, v1.Condition{}) - if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 5: + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CounterSet) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CounterSet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CounterSet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -4491,31 +6186,27 @@ func (m *AllocatedDeviceStatus) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Data == nil { - m.Data = &runtime.RawExtension{} - } - if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NetworkData", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Counters", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4542,45 +6233,105 @@ func (m *AllocatedDeviceStatus) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.NetworkData == nil { - m.NetworkData = &NetworkDeviceData{} - } - if err := m.NetworkData.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ShareID", wireType) + if m.Counters == nil { + m.Counters = make(map[string]Counter) } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF + var mapkey string + mapvalue := &Counter{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthGenerated + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthGenerated + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthGenerated + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &Counter{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.ShareID = &s + m.Counters[mapkey] = *mapvalue iNdEx = postIndex default: iNdEx = preIndex @@ -4603,7 +6354,7 @@ func (m *AllocatedDeviceStatus) Unmarshal(dAtA []byte) error { } return nil } -func (m *AllocationResult) Unmarshal(dAtA []byte) error { +func (m *Device) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4626,50 +6377,17 @@ func (m *AllocationResult) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: AllocationResult: wiretype end group for non-group") + return fmt.Errorf("proto: Device: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: AllocationResult: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Device: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Devices", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Devices.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeSelector", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -4679,31 +6397,27 @@ func (m *AllocationResult) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if m.NodeSelector == nil { - m.NodeSelector = &v11.NodeSelector{} - } - if err := m.NodeSelector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AllocationTimestamp", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4730,148 +6444,109 @@ func (m *AllocationResult) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.AllocationTimestamp == nil { - m.AllocationTimestamp = &v1.Time{} - } - if err := m.AllocationTimestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CELDeviceSelector) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CELDeviceSelector: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CELDeviceSelector: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Expression", wireType) + if m.Attributes == nil { + m.Attributes = make(map[QualifiedName]DeviceAttribute) } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF + var mapkey QualifiedName + mapvalue := &DeviceAttribute{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthGenerated + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = QualifiedName(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthGenerated + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthGenerated + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &DeviceAttribute{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Expression = string(dAtA[iNdEx:postIndex]) + m.Attributes[QualifiedName(mapkey)] = *mapvalue iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CapacityRequestPolicy) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CapacityRequestPolicy: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CapacityRequestPolicy: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Default", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Capacity", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4898,16 +6573,109 @@ func (m *CapacityRequestPolicy) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Default == nil { - m.Default = &resource.Quantity{} + if m.Capacity == nil { + m.Capacity = make(map[QualifiedName]DeviceCapacity) } - if err := m.Default.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + var mapkey QualifiedName + mapvalue := &DeviceCapacity{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthGenerated + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = QualifiedName(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthGenerated + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthGenerated + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &DeviceCapacity{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } } + m.Capacity[QualifiedName(mapkey)] = *mapvalue iNdEx = postIndex - case 3: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidValues", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConsumesCounters", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4934,16 +6702,16 @@ func (m *CapacityRequestPolicy) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ValidValues = append(m.ValidValues, resource.Quantity{}) - if err := m.ValidValues[len(m.ValidValues)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ConsumesCounters = append(m.ConsumesCounters, DeviceCounterConsumption{}) + if err := m.ConsumesCounters[len(m.ConsumesCounters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 4: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidRange", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NodeName", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -4953,81 +6721,28 @@ func (m *CapacityRequestPolicy) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if m.ValidRange == nil { - m.ValidRange = &CapacityRequestPolicyRange{} - } - if err := m.ValidRange.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + s := string(dAtA[iNdEx:postIndex]) + m.NodeName = &s iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CapacityRequestPolicyRange) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CapacityRequestPolicyRange: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CapacityRequestPolicyRange: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Min", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NodeSelector", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5054,16 +6769,37 @@ func (m *CapacityRequestPolicyRange) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Min == nil { - m.Min = &resource.Quantity{} + if m.NodeSelector == nil { + m.NodeSelector = &v11.NodeSelector{} } - if err := m.Min.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.NodeSelector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 2: + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllNodes", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.AllNodes = &b + case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Max", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Taints", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5090,18 +6826,37 @@ func (m *CapacityRequestPolicyRange) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Max == nil { - m.Max = &resource.Quantity{} - } - if err := m.Max.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Taints = append(m.Taints, DeviceTaint{}) + if err := m.Taints[len(m.Taints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 3: + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BindsToNode", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.BindsToNode = &b + case 10: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Step", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BindingConditions", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -5111,81 +6866,80 @@ func (m *CapacityRequestPolicyRange) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Step == nil { - m.Step = &resource.Quantity{} + m.BindingConditions = append(m.BindingConditions, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BindingFailureConditions", wireType) } - if err := m.Step.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated } - if (skippy < 0) || (iNdEx+skippy) < 0 { + postIndex := iNdEx + intStringLen + if postIndex < 0 { return ErrInvalidLengthGenerated } - if (iNdEx + skippy) > l { + if postIndex > l { return io.ErrUnexpectedEOF } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CapacityRequirements) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF + m.BindingFailureConditions = append(m.BindingFailureConditions, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowMultipleAllocations", wireType) } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CapacityRequirements: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CapacityRequirements: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + b := bool(v != 0) + m.AllowMultipleAllocations = &b + case 14: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Requests", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NodeAllocatableResources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5212,11 +6966,11 @@ func (m *CapacityRequirements) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Requests == nil { - m.Requests = make(map[QualifiedName]resource.Quantity) + if m.NodeAllocatableResources == nil { + m.NodeAllocatableResources = make(map[k8s_io_api_core_v1.ResourceName]NodeAllocatableResource) } - var mapkey QualifiedName - mapvalue := &resource.Quantity{} + var mapkey k8s_io_api_core_v1.ResourceName + mapvalue := &NodeAllocatableResource{} for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 @@ -5262,7 +7016,7 @@ func (m *CapacityRequirements) Unmarshal(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = QualifiedName(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = k8s_io_api_core_v1.ResourceName(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapmsglen int @@ -5290,7 +7044,7 @@ func (m *CapacityRequirements) Unmarshal(dAtA []byte) error { if postmsgIndex > l { return io.ErrUnexpectedEOF } - mapvalue = &resource.Quantity{} + mapvalue = &NodeAllocatableResource{} if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { return err } @@ -5310,7 +7064,7 @@ func (m *CapacityRequirements) Unmarshal(dAtA []byte) error { iNdEx += skippy } } - m.Requests[QualifiedName(mapkey)] = *mapvalue + m.NodeAllocatableResources[k8s_io_api_core_v1.ResourceName(mapkey)] = *mapvalue iNdEx = postIndex default: iNdEx = preIndex @@ -5333,7 +7087,7 @@ func (m *CapacityRequirements) Unmarshal(dAtA []byte) error { } return nil } -func (m *Counter) Unmarshal(dAtA []byte) error { +func (m *DeviceAllocationConfiguration) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5356,17 +7110,17 @@ func (m *Counter) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Counter: wiretype end group for non-group") + return fmt.Errorf("proto: DeviceAllocationConfiguration: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Counter: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeviceAllocationConfiguration: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -5376,78 +7130,27 @@ func (m *Counter) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Source = AllocationConfigSource(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CounterSet) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CounterSet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CounterSet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Requests", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5475,11 +7178,11 @@ func (m *CounterSet) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) + m.Requests = append(m.Requests, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 2: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Counters", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DeviceConfiguration", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5506,105 +7209,9 @@ func (m *CounterSet) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Counters == nil { - m.Counters = make(map[string]Counter) - } - var mapkey string - mapvalue := &Counter{} - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return ErrInvalidLengthGenerated - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return ErrInvalidLengthGenerated - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &Counter{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } + if err := m.DeviceConfiguration.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.Counters[mapkey] = *mapvalue iNdEx = postIndex default: iNdEx = preIndex @@ -5627,7 +7234,7 @@ func (m *CounterSet) Unmarshal(dAtA []byte) error { } return nil } -func (m *Device) Unmarshal(dAtA []byte) error { +func (m *DeviceAllocationResult) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5650,17 +7257,17 @@ func (m *Device) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Device: wiretype end group for non-group") + return fmt.Errorf("proto: DeviceAllocationResult: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Device: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeviceAllocationResult: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Results", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -5670,27 +7277,29 @@ func (m *Device) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) + m.Results = append(m.Results, DeviceRequestAllocationResult{}) + if err := m.Results[len(m.Results)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5717,111 +7326,107 @@ func (m *Device) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Attributes == nil { - m.Attributes = make(map[QualifiedName]DeviceAttribute) + m.Config = append(m.Config, DeviceAllocationConfiguration{}) + if err := m.Config[len(m.Config)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - var mapkey QualifiedName - mapvalue := &DeviceAttribute{} - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = QualifiedName(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return ErrInvalidLengthGenerated - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return ErrInvalidLengthGenerated - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &DeviceAttribute{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceAttribute) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceAttribute: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceAttribute: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IntValue", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break } } - m.Attributes[QualifiedName(mapkey)] = *mapvalue - iNdEx = postIndex + m.IntValue = &v case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BoolValue", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.BoolValue = &b + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Capacity", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StringValue", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -5831,29 +7436,61 @@ func (m *Device) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Capacity == nil { - m.Capacity = make(map[QualifiedName]DeviceCapacity) + s := string(dAtA[iNdEx:postIndex]) + m.StringValue = &s + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VersionValue", wireType) } - var mapkey QualifiedName - mapvalue := &DeviceCapacity{} - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.VersionValue = &s + iNdEx = postIndex + case 6: + if wireType == 0 { + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -5863,43 +7500,51 @@ func (m *Device) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= uint64(b&0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + m.IntValues = append(m.IntValues, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated + if iNdEx >= l { + return io.ErrUnexpectedEOF } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF + } + if packedLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ } - mapkey = QualifiedName(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int + } + elementCount = count + if elementCount != 0 && len(m.IntValues) == 0 { + m.IntValues = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -5909,48 +7554,91 @@ func (m *Device) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - mapmsglen |= int(b&0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } } - if mapmsglen < 0 { - return ErrInvalidLengthGenerated - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return ErrInvalidLengthGenerated + m.IntValues = append(m.IntValues, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field IntValues", wireType) + } + case 7: + if wireType == 0 { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated } - if postmsgIndex > l { + if iNdEx >= l { return io.ErrUnexpectedEOF } - mapvalue = &DeviceCapacity{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated + } + m.BoolValues = append(m.BoolValues, bool(v != 0)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated } - if (iNdEx + skippy) > postIndex { + if iNdEx >= l { return io.ErrUnexpectedEOF } - iNdEx += skippy + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen + if elementCount != 0 && len(m.BoolValues) == 0 { + m.BoolValues = make([]bool, 0, elementCount) + } + for iNdEx < postIndex { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BoolValues = append(m.BoolValues, bool(v != 0)) } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field BoolValues", wireType) } - m.Capacity[QualifiedName(mapkey)] = *mapvalue - iNdEx = postIndex - case 4: + case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumesCounters", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StringValues", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -5960,29 +7648,27 @@ func (m *Device) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.ConsumesCounters = append(m.ConsumesCounters, DeviceCounterConsumption{}) - if err := m.ConsumesCounters[len(m.ConsumesCounters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.StringValues = append(m.StringValues, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 5: + case 9: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field VersionValues", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6010,12 +7696,61 @@ func (m *Device) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := string(dAtA[iNdEx:postIndex]) - m.NodeName = &s + m.VersionValues = append(m.VersionValues, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 6: + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceCapacity) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceCapacity: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceCapacity: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeSelector", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6042,18 +7777,15 @@ func (m *Device) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.NodeSelector == nil { - m.NodeSelector = &v11.NodeSelector{} - } - if err := m.NodeSelector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AllNodes", wireType) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestPolicy", wireType) } - var v int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -6063,16 +7795,81 @@ func (m *Device) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - b := bool(v != 0) - m.AllNodes = &b - case 8: + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RequestPolicy == nil { + m.RequestPolicy = &CapacityRequestPolicy{} + } + if err := m.RequestPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceClaim) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceClaim: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceClaim: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Taints", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Requests", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6099,16 +7896,16 @@ func (m *Device) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Taints = append(m.Taints, DeviceTaint{}) - if err := m.Taints[len(m.Taints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Requests = append(m.Requests, DeviceRequest{}) + if err := m.Requests[len(m.Requests)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BindsToNode", wireType) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Constraints", wireType) } - var v int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -6118,18 +7915,31 @@ func (m *Device) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - b := bool(v != 0) - m.BindsToNode = &b - case 10: + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Constraints = append(m.Constraints, DeviceConstraint{}) + if err := m.Constraints[len(m.Constraints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BindingConditions", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -6139,27 +7949,79 @@ func (m *Device) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } - if postIndex > l { + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Config = append(m.Config, DeviceClaimConfiguration{}) + if err := m.Config[len(m.Config)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceClaimConfiguration) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.BindingConditions = append(m.BindingConditions, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 11: + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceClaimConfiguration: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceClaimConfiguration: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BindingFailureConditions", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Requests", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6187,32 +8049,11 @@ func (m *Device) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.BindingFailureConditions = append(m.BindingFailureConditions, string(dAtA[iNdEx:postIndex])) + m.Requests = append(m.Requests, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AllowMultipleAllocations", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.AllowMultipleAllocations = &b - case 13: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeAllocatableResourceMappings", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DeviceConfiguration", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6239,105 +8080,9 @@ func (m *Device) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.NodeAllocatableResourceMappings == nil { - m.NodeAllocatableResourceMappings = make(map[k8s_io_api_core_v1.ResourceName]NodeAllocatableResourceMapping) - } - var mapkey k8s_io_api_core_v1.ResourceName - mapvalue := &NodeAllocatableResourceMapping{} - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = k8s_io_api_core_v1.ResourceName(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return ErrInvalidLengthGenerated - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return ErrInvalidLengthGenerated - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &NodeAllocatableResourceMapping{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } + if err := m.DeviceConfiguration.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.NodeAllocatableResourceMappings[k8s_io_api_core_v1.ResourceName(mapkey)] = *mapvalue iNdEx = postIndex default: iNdEx = preIndex @@ -6360,7 +8105,7 @@ func (m *Device) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceAllocationConfiguration) Unmarshal(dAtA []byte) error { +func (m *DeviceClass) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6383,17 +8128,17 @@ func (m *DeviceAllocationConfiguration) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceAllocationConfiguration: wiretype end group for non-group") + return fmt.Errorf("proto: DeviceClass: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceAllocationConfiguration: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeviceClass: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -6403,29 +8148,30 @@ func (m *DeviceAllocationConfiguration) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Source = AllocationConfigSource(dAtA[iNdEx:postIndex]) + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Requests", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -6435,25 +8181,76 @@ func (m *DeviceAllocationConfiguration) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Requests = append(m.Requests, string(dAtA[iNdEx:postIndex])) + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 3: + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceClassConfiguration) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceClassConfiguration: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceClassConfiguration: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DeviceConfiguration", wireType) } @@ -6507,7 +8304,7 @@ func (m *DeviceAllocationConfiguration) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceAllocationResult) Unmarshal(dAtA []byte) error { +func (m *DeviceClassList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6530,15 +8327,15 @@ func (m *DeviceAllocationResult) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceAllocationResult: wiretype end group for non-group") + return fmt.Errorf("proto: DeviceClassList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceAllocationResult: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeviceClassList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Results", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6565,14 +8362,13 @@ func (m *DeviceAllocationResult) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Results = append(m.Results, DeviceRequestAllocationResult{}) - if err := m.Results[len(m.Results)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6599,8 +8395,8 @@ func (m *DeviceAllocationResult) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Config = append(m.Config, DeviceAllocationConfiguration{}) - if err := m.Config[len(m.Config)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Items = append(m.Items, DeviceClass{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -6625,7 +8421,7 @@ func (m *DeviceAllocationResult) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceAttribute) Unmarshal(dAtA []byte) error { +func (m *DeviceClassSpec) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6648,58 +8444,17 @@ func (m *DeviceAttribute) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceAttribute: wiretype end group for non-group") + return fmt.Errorf("proto: DeviceClassSpec: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceAttribute: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeviceClassSpec: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IntValue", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IntValue = &v - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BoolValue", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.BoolValue = &b - case 4: + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StringValue", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Selectors", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -6709,209 +8464,31 @@ func (m *DeviceAttribute) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - s := string(dAtA[iNdEx:postIndex]) - m.StringValue = &s - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VersionValue", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF + m.Selectors = append(m.Selectors, DeviceSelector{}) + if err := m.Selectors[len(m.Selectors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - s := string(dAtA[iNdEx:postIndex]) - m.VersionValue = &s iNdEx = postIndex - case 6: - if wireType == 0 { - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IntValues = append(m.IntValues, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.IntValues) == 0 { - m.IntValues = make([]int64, 0, elementCount) - } - for iNdEx < postIndex { - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IntValues = append(m.IntValues, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field IntValues", wireType) - } - case 7: - if wireType == 0 { - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.BoolValues = append(m.BoolValues, bool(v != 0)) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - elementCount = packedLen - if elementCount != 0 && len(m.BoolValues) == 0 { - m.BoolValues = make([]bool, 0, elementCount) - } - for iNdEx < postIndex { - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.BoolValues = append(m.BoolValues, bool(v != 0)) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field BoolValues", wireType) - } - case 8: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StringValues", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -6921,27 +8498,29 @@ func (m *DeviceAttribute) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.StringValues = append(m.StringValues, string(dAtA[iNdEx:postIndex])) + m.Config = append(m.Config, DeviceClassConfiguration{}) + if err := m.Config[len(m.Config)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 9: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VersionValues", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ExtendedResourceName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6969,7 +8548,8 @@ func (m *DeviceAttribute) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.VersionValues = append(m.VersionValues, string(dAtA[iNdEx:postIndex])) + s := string(dAtA[iNdEx:postIndex]) + m.ExtendedResourceName = &s iNdEx = postIndex default: iNdEx = preIndex @@ -6992,7 +8572,7 @@ func (m *DeviceAttribute) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceCapacity) Unmarshal(dAtA []byte) error { +func (m *DeviceConfiguration) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7015,48 +8595,15 @@ func (m *DeviceCapacity) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceCapacity: wiretype end group for non-group") + return fmt.Errorf("proto: DeviceConfiguration: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceCapacity: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeviceConfiguration: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestPolicy", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Opaque", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7083,10 +8630,10 @@ func (m *DeviceCapacity) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.RequestPolicy == nil { - m.RequestPolicy = &CapacityRequestPolicy{} + if m.Opaque == nil { + m.Opaque = &OpaqueDeviceConfiguration{} } - if err := m.RequestPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Opaque.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -7111,7 +8658,7 @@ func (m *DeviceCapacity) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceClaim) Unmarshal(dAtA []byte) error { +func (m *DeviceConstraint) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7134,17 +8681,17 @@ func (m *DeviceClaim) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceClaim: wiretype end group for non-group") + return fmt.Errorf("proto: DeviceConstraint: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceClaim: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeviceConstraint: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Requests", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -7154,31 +8701,29 @@ func (m *DeviceClaim) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Requests = append(m.Requests, DeviceRequest{}) - if err := m.Requests[len(m.Requests)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Requests = append(m.Requests, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Constraints", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MatchAttribute", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -7188,31 +8733,30 @@ func (m *DeviceClaim) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Constraints = append(m.Constraints, DeviceConstraint{}) - if err := m.Constraints[len(m.Constraints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + s := FullyQualifiedName(dAtA[iNdEx:postIndex]) + m.MatchAttribute = &s iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DistinctAttribute", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -7222,25 +8766,24 @@ func (m *DeviceClaim) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Config = append(m.Config, DeviceClaimConfiguration{}) - if err := m.Config[len(m.Config)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + s := FullyQualifiedName(dAtA[iNdEx:postIndex]) + m.DistinctAttribute = &s iNdEx = postIndex default: iNdEx = preIndex @@ -7263,7 +8806,7 @@ func (m *DeviceClaim) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceClaimConfiguration) Unmarshal(dAtA []byte) error { +func (m *DeviceCounterConsumption) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7286,15 +8829,15 @@ func (m *DeviceClaimConfiguration) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceClaimConfiguration: wiretype end group for non-group") + return fmt.Errorf("proto: DeviceCounterConsumption: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceClaimConfiguration: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeviceCounterConsumption: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Requests", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CounterSet", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -7322,13 +8865,142 @@ func (m *DeviceClaimConfiguration) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Requests = append(m.Requests, string(dAtA[iNdEx:postIndex])) + m.CounterSet = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Counters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Counters == nil { + m.Counters = make(map[string]Counter) + } + var mapkey string + mapvalue := &Counter{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthGenerated + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthGenerated + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthGenerated + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &Counter{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Counters[mapkey] = *mapvalue iNdEx = postIndex - case 2: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DeviceConfiguration", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CompatibilityGroups", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -7338,24 +9010,23 @@ func (m *DeviceClaimConfiguration) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.DeviceConfiguration.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.CompatibilityGroups = append(m.CompatibilityGroups, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -7378,7 +9049,7 @@ func (m *DeviceClaimConfiguration) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceClass) Unmarshal(dAtA []byte) error { +func (m *DeviceDerivedAttribute) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7401,17 +9072,17 @@ func (m *DeviceClass) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceClass: wiretype end group for non-group") + return fmt.Errorf("proto: DeviceDerivedAttribute: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceClass: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeviceDerivedAttribute: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -7421,30 +9092,29 @@ func (m *DeviceClass) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Name = FullyQualifiedName(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Expression", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -7454,24 +9124,23 @@ func (m *DeviceClass) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Expression = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -7494,7 +9163,7 @@ func (m *DeviceClass) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceClassConfiguration) Unmarshal(dAtA []byte) error { +func (m *DeviceRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7517,17 +9186,17 @@ func (m *DeviceClassConfiguration) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceClassConfiguration: wiretype end group for non-group") + return fmt.Errorf("proto: DeviceRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceClassConfiguration: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeviceRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DeviceConfiguration", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -7537,78 +9206,27 @@ func (m *DeviceClassConfiguration) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.DeviceConfiguration.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeviceClassList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeviceClassList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceClassList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Exactly", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7635,13 +9253,16 @@ func (m *DeviceClassList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.Exactly == nil { + m.Exactly = &ExactDeviceRequest{} + } + if err := m.Exactly.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 2: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FirstAvailable", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7668,8 +9289,8 @@ func (m *DeviceClassList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Items = append(m.Items, DeviceClass{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.FirstAvailable = append(m.FirstAvailable, DeviceSubRequest{}) + if err := m.FirstAvailable[len(m.FirstAvailable)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -7694,7 +9315,7 @@ func (m *DeviceClassList) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceClassSpec) Unmarshal(dAtA []byte) error { +func (m *DeviceRequestAllocationResult) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7717,17 +9338,17 @@ func (m *DeviceClassSpec) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceClassSpec: wiretype end group for non-group") + return fmt.Errorf("proto: DeviceRequestAllocationResult: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceClassSpec: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeviceRequestAllocationResult: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Selectors", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Request", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -7737,31 +9358,29 @@ func (m *DeviceClassSpec) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Selectors = append(m.Selectors, DeviceSelector{}) - if err := m.Selectors[len(m.Selectors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Request = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Driver", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -7771,29 +9390,27 @@ func (m *DeviceClassSpec) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Config = append(m.Config, DeviceClassConfiguration{}) - if err := m.Config[len(m.Config)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Driver = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExtendedResourceName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pool", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -7821,64 +9438,45 @@ func (m *DeviceClassSpec) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := string(dAtA[iNdEx:postIndex]) - m.ExtendedResourceName = &s + m.Pool = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Device", wireType) } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeviceConfiguration) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated } - if iNdEx >= l { + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeviceConfiguration: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceConfiguration: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Opaque", wireType) + m.Device = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AdminAccess", wireType) } - var msglen int + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -7888,83 +9486,18 @@ func (m *DeviceConfiguration) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Opaque == nil { - m.Opaque = &OpaqueDeviceConfiguration{} - } - if err := m.Opaque.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeviceConstraint) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeviceConstraint: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceConstraint: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + b := bool(v != 0) + m.AdminAccess = &b + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Requests", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Tolerations", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -7974,27 +9507,29 @@ func (m *DeviceConstraint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Requests = append(m.Requests, string(dAtA[iNdEx:postIndex])) + m.Tolerations = append(m.Tolerations, DeviceToleration{}) + if err := m.Tolerations[len(m.Tolerations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 2: + case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MatchAttribute", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BindingConditions", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -8022,12 +9557,11 @@ func (m *DeviceConstraint) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := FullyQualifiedName(dAtA[iNdEx:postIndex]) - m.MatchAttribute = &s + m.BindingConditions = append(m.BindingConditions, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 3: + case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DistinctAttribute", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BindingFailureConditions", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -8055,62 +9589,11 @@ func (m *DeviceConstraint) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := FullyQualifiedName(dAtA[iNdEx:postIndex]) - m.DistinctAttribute = &s + m.BindingFailureConditions = append(m.BindingFailureConditions, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeviceCounterConsumption) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeviceCounterConsumption: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceCounterConsumption: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 9: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CounterSet", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ShareID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -8138,11 +9621,12 @@ func (m *DeviceCounterConsumption) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.CounterSet = string(dAtA[iNdEx:postIndex]) + s := k8s_io_apimachinery_pkg_types.UID(dAtA[iNdEx:postIndex]) + m.ShareID = &s iNdEx = postIndex - case 2: + case 10: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Counters", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConsumedCapacity", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -8169,11 +9653,11 @@ func (m *DeviceCounterConsumption) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Counters == nil { - m.Counters = make(map[string]Counter) + if m.ConsumedCapacity == nil { + m.ConsumedCapacity = make(map[QualifiedName]resource.Quantity) } - var mapkey string - mapvalue := &Counter{} + var mapkey QualifiedName + mapvalue := &resource.Quantity{} for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 @@ -8219,7 +9703,7 @@ func (m *DeviceCounterConsumption) Unmarshal(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = QualifiedName(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapmsglen int @@ -8247,7 +9731,7 @@ func (m *DeviceCounterConsumption) Unmarshal(dAtA []byte) error { if postmsgIndex > l { return io.ErrUnexpectedEOF } - mapvalue = &Counter{} + mapvalue = &resource.Quantity{} if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { return err } @@ -8267,7 +9751,125 @@ func (m *DeviceCounterConsumption) Unmarshal(dAtA []byte) error { iNdEx += skippy } } - m.Counters[mapkey] = *mapvalue + m.ConsumedCapacity[QualifiedName(mapkey)] = *mapvalue + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SkipNodeOperations", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SkipNodeOperations = append(m.SkipNodeOperations, SkipNodeOperation(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceSelector) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceSelector: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceSelector: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CEL", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CEL == nil { + m.CEL = &CELDeviceSelector{} + } + if err := m.CEL.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -8290,7 +9892,7 @@ func (m *DeviceCounterConsumption) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceRequest) Unmarshal(dAtA []byte) error { +func (m *DeviceSubRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -8313,10 +9915,10 @@ func (m *DeviceRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceRequest: wiretype end group for non-group") + return fmt.Errorf("proto: DeviceSubRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeviceSubRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -8353,9 +9955,9 @@ func (m *DeviceRequest) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Exactly", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DeviceClassName", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -8365,31 +9967,27 @@ func (m *DeviceRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Exactly == nil { - m.Exactly = &ExactDeviceRequest{} - } - if err := m.Exactly.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.DeviceClassName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FirstAvailable", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Selectors", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -8416,66 +10014,67 @@ func (m *DeviceRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.FirstAvailable = append(m.FirstAvailable, DeviceSubRequest{}) - if err := m.FirstAvailable[len(m.FirstAvailable)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Selectors = append(m.Selectors, DeviceSelector{}) + if err := m.Selectors[len(m.Selectors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllocationMode", wireType) } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeviceRequestAllocationResult) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated } - if iNdEx >= l { + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + m.AllocationMode = DeviceAllocationMode(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeviceRequestAllocationResult: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceRequestAllocationResult: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + m.Count = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Count |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Request", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Tolerations", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -8485,29 +10084,31 @@ func (m *DeviceRequestAllocationResult) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Request = string(dAtA[iNdEx:postIndex]) + m.Tolerations = append(m.Tolerations, DeviceToleration{}) + if err := m.Tolerations[len(m.Tolerations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 2: + case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Driver", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Capacity", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -8517,29 +10118,33 @@ func (m *DeviceRequestAllocationResult) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Driver = string(dAtA[iNdEx:postIndex]) + if m.Capacity == nil { + m.Capacity = &CapacityRequirements{} + } + if err := m.Capacity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 3: + case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pool", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DerivedAttributes", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -8549,27 +10154,79 @@ func (m *DeviceRequestAllocationResult) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Pool = string(dAtA[iNdEx:postIndex]) + m.DerivedAttributes = append(m.DerivedAttributes, DeviceDerivedAttribute{}) + if err := m.DerivedAttributes[len(m.DerivedAttributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 4: + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceTaint) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceTaint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceTaint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Device", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -8597,34 +10254,13 @@ func (m *DeviceRequestAllocationResult) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Device = string(dAtA[iNdEx:postIndex]) + m.Key = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AdminAccess", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.AdminAccess = &b - case 6: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tolerations", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -8634,29 +10270,27 @@ func (m *DeviceRequestAllocationResult) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Tolerations = append(m.Tolerations, DeviceToleration{}) - if err := m.Tolerations[len(m.Tolerations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Value = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BindingConditions", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Effect", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -8684,13 +10318,13 @@ func (m *DeviceRequestAllocationResult) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.BindingConditions = append(m.BindingConditions, string(dAtA[iNdEx:postIndex])) + m.Effect = DeviceTaintEffect(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BindingFailureConditions", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TimeAdded", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -8700,29 +10334,83 @@ func (m *DeviceRequestAllocationResult) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.BindingFailureConditions = append(m.BindingFailureConditions, string(dAtA[iNdEx:postIndex])) + if m.TimeAdded == nil { + m.TimeAdded = &v1.Time{} + } + if err := m.TimeAdded.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 9: + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceTaintRule) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceTaintRule: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceTaintRule: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ShareID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -8732,28 +10420,28 @@ func (m *DeviceRequestAllocationResult) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - s := k8s_io_apimachinery_pkg_types.UID(dAtA[iNdEx:postIndex]) - m.ShareID = &s + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 10: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumedCapacity", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -8765,120 +10453,57 @@ func (m *DeviceRequestAllocationResult) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ConsumedCapacity == nil { - m.ConsumedCapacity = make(map[QualifiedName]resource.Quantity) - } - var mapkey QualifiedName - mapvalue := &resource.Quantity{} - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = QualifiedName(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return ErrInvalidLengthGenerated - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return ErrInvalidLengthGenerated - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &resource.Quantity{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break } } - m.ConsumedCapacity[QualifiedName(mapkey)] = *mapvalue + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -8901,7 +10526,7 @@ func (m *DeviceRequestAllocationResult) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceSelector) Unmarshal(dAtA []byte) error { +func (m *DeviceTaintRuleList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -8924,15 +10549,15 @@ func (m *DeviceSelector) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceSelector: wiretype end group for non-group") + return fmt.Errorf("proto: DeviceTaintRuleList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceSelector: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeviceTaintRuleList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CEL", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -8959,10 +10584,41 @@ func (m *DeviceSelector) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.CEL == nil { - m.CEL = &CELDeviceSelector{} + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - if err := m.CEL.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, DeviceTaintRule{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -8987,7 +10643,7 @@ func (m *DeviceSelector) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceSubRequest) Unmarshal(dAtA []byte) error { +func (m *DeviceTaintRuleSpec) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9010,17 +10666,17 @@ func (m *DeviceSubRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceSubRequest: wiretype end group for non-group") + return fmt.Errorf("proto: DeviceTaintRuleSpec: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceSubRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeviceTaintRuleSpec: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DeviceSelector", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -9030,29 +10686,33 @@ func (m *DeviceSubRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) + if m.DeviceSelector == nil { + m.DeviceSelector = &DeviceTaintSelector{} + } + if err := m.DeviceSelector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DeviceClassName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Taint", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -9062,27 +10722,78 @@ func (m *DeviceSubRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.DeviceClassName = string(dAtA[iNdEx:postIndex]) + if err := m.Taint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 3: + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceTaintRuleStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceTaintRuleStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceTaintRuleStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Selectors", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -9109,48 +10820,66 @@ func (m *DeviceSubRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Selectors = append(m.Selectors, DeviceSelector{}) - if err := m.Selectors[len(m.Selectors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Conditions = append(m.Conditions, v1.Condition{}) + if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AllocationMode", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - if postIndex > l { + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceTaintSelector) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.AllocationMode = DeviceAllocationMode(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - m.Count = 0 + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceTaintSelector: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceTaintSelector: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Driver", wireType) + } + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -9160,16 +10889,30 @@ func (m *DeviceSubRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Count |= int64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 6: + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Driver = &s + iNdEx = postIndex + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tolerations", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pool", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -9179,31 +10922,30 @@ func (m *DeviceSubRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Tolerations = append(m.Tolerations, DeviceToleration{}) - if err := m.Tolerations[len(m.Tolerations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + s := string(dAtA[iNdEx:postIndex]) + m.Pool = &s iNdEx = postIndex - case 7: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Capacity", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Device", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -9213,27 +10955,24 @@ func (m *DeviceSubRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Capacity == nil { - m.Capacity = &CapacityRequirements{} - } - if err := m.Capacity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + s := string(dAtA[iNdEx:postIndex]) + m.Device = &s iNdEx = postIndex default: iNdEx = preIndex @@ -9256,7 +10995,7 @@ func (m *DeviceSubRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceTaint) Unmarshal(dAtA []byte) error { +func (m *DeviceToleration) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9279,10 +11018,10 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceTaint: wiretype end group for non-group") + return fmt.Errorf("proto: DeviceToleration: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceTaint: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeviceToleration: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -9319,7 +11058,7 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -9347,11 +11086,11 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Value = string(dAtA[iNdEx:postIndex]) + m.Operator = DeviceTolerationOperator(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Effect", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -9379,13 +11118,13 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Effect = DeviceTaintEffect(dAtA[iNdEx:postIndex]) + m.Value = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeAdded", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Effect", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -9395,28 +11134,44 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if m.TimeAdded == nil { - m.TimeAdded = &v1.Time{} + m.Effect = DeviceTaintEffect(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TolerationSeconds", wireType) } - if err := m.TimeAdded.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - iNdEx = postIndex + m.TolerationSeconds = &v default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -9438,7 +11193,7 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceToleration) Unmarshal(dAtA []byte) error { +func (m *ExactDeviceRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9461,15 +11216,15 @@ func (m *DeviceToleration) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceToleration: wiretype end group for non-group") + return fmt.Errorf("proto: ExactDeviceRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceToleration: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ExactDeviceRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DeviceClassName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -9497,13 +11252,13 @@ func (m *DeviceToleration) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Key = string(dAtA[iNdEx:postIndex]) + m.DeviceClassName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Selectors", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -9513,27 +11268,29 @@ func (m *DeviceToleration) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Operator = DeviceTolerationOperator(dAtA[iNdEx:postIndex]) + m.Selectors = append(m.Selectors, DeviceSelector{}) + if err := m.Selectors[len(m.Selectors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AllocationMode", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -9561,13 +11318,53 @@ func (m *DeviceToleration) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Value = string(dAtA[iNdEx:postIndex]) + m.AllocationMode = DeviceAllocationMode(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) + } + m.Count = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Count |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AdminAccess", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.AdminAccess = &b + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Effect", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Tolerations", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -9577,29 +11374,31 @@ func (m *DeviceToleration) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Effect = DeviceTaintEffect(dAtA[iNdEx:postIndex]) + m.Tolerations = append(m.Tolerations, DeviceToleration{}) + if err := m.Tolerations[len(m.Tolerations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TolerationSeconds", wireType) + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Capacity", wireType) } - var v int64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -9609,12 +11408,62 @@ func (m *DeviceToleration) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - m.TolerationSeconds = &v + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Capacity == nil { + m.Capacity = &CapacityRequirements{} + } + if err := m.Capacity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DerivedAttributes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DerivedAttributes = append(m.DerivedAttributes, DeviceDerivedAttribute{}) + if err := m.DerivedAttributes[len(m.DerivedAttributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -9636,7 +11485,7 @@ func (m *DeviceToleration) Unmarshal(dAtA []byte) error { } return nil } -func (m *ExactDeviceRequest) Unmarshal(dAtA []byte) error { +func (m *NetworkDeviceData) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9659,15 +11508,15 @@ func (m *ExactDeviceRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ExactDeviceRequest: wiretype end group for non-group") + return fmt.Errorf("proto: NetworkDeviceData: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ExactDeviceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NetworkDeviceData: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DeviceClassName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InterfaceName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -9695,13 +11544,13 @@ func (m *ExactDeviceRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DeviceClassName = string(dAtA[iNdEx:postIndex]) + m.InterfaceName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Selectors", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field IPs", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -9711,29 +11560,27 @@ func (m *ExactDeviceRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Selectors = append(m.Selectors, DeviceSelector{}) - if err := m.Selectors[len(m.Selectors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.IPs = append(m.IPs, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AllocationMode", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field HardwareAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -9761,32 +11608,63 @@ func (m *ExactDeviceRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.AllocationMode = DeviceAllocationMode(dAtA[iNdEx:postIndex]) + m.HardwareAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err } - m.Count = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Count |= int64(b&0x7F) << shift - if b < 0x80 { - break - } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AdminAccess", wireType) + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - var v int + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NodeAllocatableMapping) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NodeAllocatableMapping: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeAllocatableMapping: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CapacityKey", wireType) + } + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -9796,16 +11674,28 @@ func (m *ExactDeviceRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - b := bool(v != 0) - m.AdminAccess = &b - case 6: + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := QualifiedName(dAtA[iNdEx:postIndex]) + m.CapacityKey = &s + iNdEx = postIndex + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tolerations", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CapacityMultiplier", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -9832,14 +11722,16 @@ func (m *ExactDeviceRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Tolerations = append(m.Tolerations, DeviceToleration{}) - if err := m.Tolerations[len(m.Tolerations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.CapacityMultiplier == nil { + m.CapacityMultiplier = &resource.Quantity{} + } + if err := m.CapacityMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 7: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Capacity", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DeviceMultiplier", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -9866,10 +11758,10 @@ func (m *ExactDeviceRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Capacity == nil { - m.Capacity = &CapacityRequirements{} + if m.DeviceMultiplier == nil { + m.DeviceMultiplier = &resource.Quantity{} } - if err := m.Capacity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.DeviceMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -9894,7 +11786,7 @@ func (m *ExactDeviceRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *NetworkDeviceData) Unmarshal(dAtA []byte) error { +func (m *NodeAllocatableOverhead) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9917,17 +11809,17 @@ func (m *NetworkDeviceData) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: NetworkDeviceData: wiretype end group for non-group") + return fmt.Errorf("proto: NodeAllocatableOverhead: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: NetworkDeviceData: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NodeAllocatableOverhead: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InterfaceName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PerPod", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -9937,29 +11829,33 @@ func (m *NetworkDeviceData) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.InterfaceName = string(dAtA[iNdEx:postIndex]) + if m.PerPod == nil { + m.PerPod = &resource.Quantity{} + } + if err := m.PerPod.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IPs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PerContainer", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -9969,55 +11865,27 @@ func (m *NetworkDeviceData) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.IPs = append(m.IPs, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HardwareAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated + if m.PerContainer == nil { + m.PerContainer = &resource.Quantity{} } - if postIndex > l { - return io.ErrUnexpectedEOF + if err := m.PerContainer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.HardwareAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -10040,7 +11908,7 @@ func (m *NetworkDeviceData) Unmarshal(dAtA []byte) error { } return nil } -func (m *NodeAllocatableResourceMapping) Unmarshal(dAtA []byte) error { +func (m *NodeAllocatableResource) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -10063,17 +11931,17 @@ func (m *NodeAllocatableResourceMapping) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: NodeAllocatableResourceMapping: wiretype end group for non-group") + return fmt.Errorf("proto: NodeAllocatableResource: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: NodeAllocatableResourceMapping: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NodeAllocatableResource: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CapacityKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Mapping", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -10083,28 +11951,31 @@ func (m *NodeAllocatableResourceMapping) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - s := QualifiedName(dAtA[iNdEx:postIndex]) - m.CapacityKey = &s + if m.Mapping == nil { + m.Mapping = &NodeAllocatableMapping{} + } + if err := m.Mapping.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 2: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AllocationMultiplier", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Overhead", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -10131,10 +12002,10 @@ func (m *NodeAllocatableResourceMapping) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.AllocationMultiplier == nil { - m.AllocationMultiplier = &resource.Quantity{} + if m.Overhead == nil { + m.Overhead = &NodeAllocatableOverhead{} } - if err := m.AllocationMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Overhead.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -11930,6 +13801,71 @@ func (m *ResourceSliceSpec) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PartitionTypeAttribute", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := FullyQualifiedName(dAtA[iNdEx:postIndex]) + m.PartitionTypeAttribute = &s + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SkipNodeOperations", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SkipNodeOperations = append(m.SkipNodeOperations, SkipNodeOperation(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/vendor/k8s.io/api/resource/v1/generated.proto b/vendor/k8s.io/api/resource/v1/generated.proto index 8bacfd846f..76559dc94b 100644 --- a/vendor/k8s.io/api/resource/v1/generated.proto +++ b/vendor/k8s.io/api/resource/v1/generated.proto @@ -65,8 +65,8 @@ message AllocatedDeviceStatus { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-uuid optional string shareID = 7; // Conditions contains the latest observation of the device's state. @@ -78,6 +78,9 @@ message AllocatedDeviceStatus { // +optional // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 4; // Data contains arbitrary driver-specific data. @@ -90,7 +93,7 @@ message AllocatedDeviceStatus { // NetworkData contains network-related information specific to the device. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional NetworkDeviceData networkData = 6; } @@ -130,7 +133,7 @@ message CELDeviceSelector { // - driver (string): the name of the driver which defines this device. // - attributes (map[string]object): the device's attributes, grouped by prefix // (e.g. device.attributes["dra.example.com"] evaluates to an object with all - // of the attributes which were prefixed by "dra.example.com". + // of the attributes which were prefixed by "dra.example.com"). // - capacity (map[string]object): the device's capacities, grouped by prefix. // - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device // (v1.34+ with the DRAConsumableCapacity feature enabled). @@ -163,6 +166,15 @@ message CELDeviceSelector { // A robust expression should check for the existence of attributes // before referencing them. // + // Common errors: + // - "no such key": Use optional chaining (.? followed by orValue()) + // or guarding the check with has() for optional fields. + // See CEL Optional Types for details: + // https://pkg.go.dev/github.com/google/cel-go@v0.17.4/cel#OptionalTypes + // + // For more CEL expression syntax and examples, see: + // https://kubernetes.io/docs/reference/using-api/cel/ + // // For ease of use, the cel.bind() function is enabled, and can be used // to simplify expressions that access multiple attributes with the // same domain. For example: @@ -232,6 +244,13 @@ message CapacityRequestPolicy { // CapacityRequestPolicyRange defines a valid range for consumable capacity values. // +// If the DRAFractionalCapacityRange feature gate is +// enabled and at least one of Min, Max, or Step is a fractional quantity (i.e. +// its value is not an integer), milli-unit arithmetic is used instead, +// supporting values with up to 3 decimal places (e.g. 100m = 0.1). +// The largest supported value then is 1000 times smaller compared to using 64-bit integers. +// Otherwise, all comparisons use 64-bit integer arithmetic via resource.Quantity.Value(). +// // - If the requested amount is less than Min, it is rounded up to the Min value. // - If Step is set and the requested amount is between Min and Max but not aligned with Step, // it will be rounded up to the next value equal to Min + (n * Step). @@ -315,8 +334,8 @@ message CounterSet { // It must be a DNS label. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-short-name optional string name = 1; // Counters defines the set of counters for this CounterSet @@ -325,8 +344,8 @@ message CounterSet { // The maximum number of counters is 32. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:eachKey=+k8s:format=k8s-short-name map counters = 2; } @@ -345,7 +364,7 @@ message Device { // The maximum number of attributes and capacities combined is 32. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional map attributes = 2; // Capacity defines the set of capacities for this device. @@ -366,13 +385,13 @@ message Device { // device is 2. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=counterSet + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=counterSet // +featureGate=DRAPartitionableDevices - // +k8s:alpha(since: "1.36")=+k8s:maxItems=2 + // +k8s:beta(since: "1.37")=+k8s:maxItems=2 repeated DeviceCounterConsumption consumesCounters = 4; // NodeName identifies the node where the device is available. @@ -419,7 +438,7 @@ message Device { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated DeviceTaint taints = 8; // BindsToNode indicates if the usage of an allocation involving this device @@ -449,8 +468,8 @@ message Device { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 repeated string bindingConditions = 10; // BindingFailureConditions defines the conditions for binding failure. @@ -467,8 +486,8 @@ message Device { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 repeated string bindingFailureConditions = 11; // AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests. @@ -480,7 +499,7 @@ message Device { // +featureGate=DRAConsumableCapacity optional bool allowMultipleAllocations = 12; - // NodeAllocatableResourceMappings defines the mapping of node resources + // NodeAllocatableResources defines the mapping of node resources // that are managed by the DRA driver exposing this device. This includes resources currently // reported in v1.Node `status.allocatable` that are not extended resources // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). @@ -492,8 +511,9 @@ message Device { // The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). // Extended resource names are not permitted as keys. // +optional + // +k8s:optional // +featureGate=DRANodeAllocatableResources - map nodeAllocatableResourceMappings = 13; + map nodeAllocatableResources = 14; } // DeviceAllocationConfiguration gets embedded in an AllocationResult. @@ -503,7 +523,7 @@ message DeviceAllocationConfiguration { // or from a claim. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string source = 1; // Requests lists the names of requests where the configuration applies. @@ -515,10 +535,10 @@ message DeviceAllocationConfiguration { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated string requests = 2; optional DeviceConfiguration deviceConfiguration = 3; @@ -530,8 +550,8 @@ message DeviceAllocationResult { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceRequestAllocationResult results = 1; // This field is a combination of all the claim and class configuration parameters. @@ -544,8 +564,8 @@ message DeviceAllocationResult { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=64 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=64 repeated DeviceAllocationConfiguration config = 2; } @@ -554,30 +574,30 @@ message DeviceAttribute { // IntValue is a number. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember optional int64 int = 2; // BoolValue is a true/false value. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember optional bool bool = 3; // StringValue is a string. Must not be longer than 64 characters. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember optional string string = 4; // VersionValue is a semantic version according to semver.org spec 2.0.0. // Must not be longer than 64 characters. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember optional string version = 5; // IntValues is a non-empty list of numbers. @@ -587,8 +607,8 @@ message DeviceAttribute { // +optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember // +featureGate=DRAListTypeAttributes repeated int64 ints = 6; @@ -597,8 +617,8 @@ message DeviceAttribute { // +optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember // +featureGate=DRAListTypeAttributes repeated bool bools = 7; @@ -610,8 +630,9 @@ message DeviceAttribute { // +optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember + // +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:maxBytes=64 // +featureGate=DRAListTypeAttributes repeated string strings = 8; @@ -623,8 +644,8 @@ message DeviceAttribute { // +optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember // +featureGate=DRAListTypeAttributes repeated string versions = 9; } @@ -662,11 +683,11 @@ message DeviceClaim { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=name + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceRequest requests = 1; // These constraints must be satisfied by the set of devices that get @@ -674,8 +695,8 @@ message DeviceClaim { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceConstraint constraints = 2; // This field holds configuration for multiple potential drivers which @@ -684,8 +705,8 @@ message DeviceClaim { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceClaimConfiguration config = 3; } @@ -700,10 +721,10 @@ message DeviceClaimConfiguration { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated string requests = 1; optional DeviceConfiguration deviceConfiguration = 2; @@ -716,8 +737,8 @@ message DeviceClaimConfiguration { message DeviceClass { // Standard object metadata // +optional - // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:format=k8s-long-name + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:format=k8s-long-name optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Spec defines what can be allocated and how to configure it. @@ -728,6 +749,7 @@ message DeviceClass { // the time of allocation. // // Changing the spec automatically increments the metadata.generation number. + // +optional optional DeviceClassSpec spec = 2; } @@ -753,8 +775,8 @@ message DeviceClassSpec { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceSelector selectors = 1; // Config defines configuration parameters that apply to each device that is claimed via this class. @@ -765,8 +787,8 @@ message DeviceClassSpec { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceClassConfiguration config = 2; // ExtendedResourceName is the extended resource name for the devices of this class. @@ -778,11 +800,10 @@ message DeviceClassSpec { // If two classes are created at the same time, then the name of the class // lexicographically sorted first is picked. // - // This is a beta field. // +optional // +featureGate=DRAExtendedResource - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-extended-resource-name + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-extended-resource-name optional string extendedResourceName = 4; } @@ -794,7 +815,7 @@ message DeviceConfiguration { // // +optional // +oneOf=ConfigurationType - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional OpaqueDeviceConfiguration opaque = 1; } @@ -812,10 +833,10 @@ message DeviceConstraint { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated string requests = 1; // MatchAttribute requires that all devices in question have this @@ -838,8 +859,8 @@ message DeviceConstraint { // // +optional // +oneOf=ConstraintType - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-fully-qualified-name + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-fully-qualified-name optional string matchAttribute = 2; // DistinctAttribute requires that all devices in question have this @@ -861,6 +882,8 @@ message DeviceConstraint { // +optional // +oneOf=ConstraintType // +featureGate=DRAConsumableCapacity + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-fully-qualified-name optional string distinctAttribute = 3; } @@ -871,8 +894,8 @@ message DeviceCounterConsumption { // counters defined will be consumed. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-short-name optional string counterSet = 1; // Counters defines the counters that will be consumed by the device. @@ -880,9 +903,94 @@ message DeviceCounterConsumption { // The maximum number of counters is 32. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:eachKey=+k8s:format=k8s-short-name map counters = 2; + + // CompatibilityGroups is a list of opaque group names for + // this counter set consumption. + // + // Devices that consume counters from the same counter set may only be + // allocated at the same time ("co-allocated") if they all share at least + // one common group: the intersection of the CompatibilityGroups of all + // co-allocated devices on that counter set must be non-empty. Devices + // that consume from different counter sets are never compared via this + // field. + // + // An unset field, an explicit nil, and an empty list are equivalent and + // mean "no groups": such a device is only co-allocatable with sibling + // devices on the same counter set that also have no groups, and is never + // co-allocatable with a device that declares one or more groups. + // + // Group names are opaque and meaningful only within the + // publishing driver's pool. + // + // The maximum number of groups is 2, and the names must be unique. + // + // +optional + // +listType=atomic + // +featureGate=DRADeviceCompatibilityGroups + // +k8s:listType=atomic + // +k8s:optional + // +k8s:maxItems=2 + // +k8s:unique=set + // +k8s:eachVal=+k8s:format=k8s-short-name + repeated string compatibilityGroups = 3; +} + +// DeviceDerivedAttribute defines a derived attribute computed via CEL. +message DeviceDerivedAttribute { + // Name is the identifier for this derived attribute, used in constraints. + // + // It must be a DNS subdomain followed by a slash ("/") followed by a C identifier + // (e.g. "example.com/numaNode" or "derived/numaNode"). + // + // If the chosen name matches an existing physical attribute from a driver, + // the derived attribute's expression will shadow the physical attribute, + // and its evaluated value will be used in constraints instead. When the goal + // is to define a derived attribute that is only used within the ResourceClaim + // and not meant to shadow an existing attribute, use a domain prefix that + // no DRA driver should be using (e.g. "derived/myAttribute"). + // + // It is not valid to define a derived attribute that isn't used in at least + // one constraint. + // + // +required + // +k8s:required + // +k8s:format=k8s-resource-fully-qualified-name + optional string name = 1; + + // Expression is a CEL expression evaluated against each candidate device. + // The expression must evaluate to a primitive scalar (string, integer, + // boolean, or semver) or a list of these scalars ([]string, []int64, + // []bool, []semver) to act as a virtual grouping key. Any other return type + // is an error and causes CEL evaluation for the device to fail. + // + // The expression's input is an object named "device", which carries the + // same properties as in a CELDeviceSelector. + // + // When pod scheduling encounters CEL runtime errors (such as looking + // up an attribute that isn't defined) for some devices, it will abort + // allocation and fail scheduling for the Pod. Surfacing evaluation + // errors immediately prevents silent topology matching failures that are + // extremely hard to detect. A robust expression should, for example, check + // for the existence of attributes before referencing them to avoid + // runtime evaluation errors. + // + // The expression gets evaluated after a device has passed the other + // selector expressions for the request in which this expression is used. + // This allows writing expressions that are tailored towards the specific + // devices being requested (for example, by assuming the device is from a + // certain vendor and skipping those checks). + // + // The length of the expression must be smaller or equal to 10 Ki. The + // cost of evaluating it is also limited based on the estimated number + // of logical steps; the combined cost of all derived attributes in a + // claim is capped by a shared CEL cost budget. + // + // +required + // +k8s:required + optional string expression = 2; } // DeviceRequest is a request for devices required for a claim. @@ -911,7 +1019,7 @@ message DeviceRequest { // // +optional // +oneOf=deviceRequestType - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional ExactDeviceRequest exactly = 2; // FirstAvailable contains subrequests, of which exactly one will be @@ -932,11 +1040,11 @@ message DeviceRequest { // +oneOf=deviceRequestType // +listType=atomic // +featureGate=DRAPrioritizedList - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name - // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=name + // +k8s:beta(since: "1.37")=+k8s:maxItems=8 repeated DeviceSubRequest firstAvailable = 3; } @@ -961,9 +1069,9 @@ message DeviceRequestAllocationResult { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 + // +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name-caseless + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:maxLength=63 optional string driver = 2; // This name together with the driver name and the device name field @@ -973,8 +1081,8 @@ message DeviceRequestAllocationResult { // DNS sub-domains separated by slashes. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-pool-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-pool-name optional string pool = 3; // Device references one device instance via its name in the driver's @@ -1005,7 +1113,7 @@ message DeviceRequestAllocationResult { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated DeviceToleration tolerations = 6; // BindingConditions contains a copy of the BindingConditions @@ -1017,8 +1125,8 @@ message DeviceRequestAllocationResult { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 repeated string bindingConditions = 7; // BindingFailureConditions contains a copy of the BindingFailureConditions @@ -1030,8 +1138,8 @@ message DeviceRequestAllocationResult { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 repeated string bindingFailureConditions = 8; // ShareID uniquely identifies an individual allocation share of the device, @@ -1041,8 +1149,8 @@ message DeviceRequestAllocationResult { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-uuid optional string shareID = 9; // ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. @@ -1057,6 +1165,19 @@ message DeviceRequestAllocationResult { // +optional // +featureGate=DRAConsumableCapacity map consumedCapacity = 10; + + // SkipNodeOperations lists node-local resource operations (gRPC calls) + // that will be skipped for this allocated device when determining whether + // operations are necessary on the node. If all allocated devices for a driver in + // a claim skip an operation, that gRPC call will be skipped. It is a copy of + // the ResourceSlice.spec.skipNodeOperations value at the time when the device was allocated. + // + // +optional + // +listType=set + // +k8s:listType=set + // +featureGate=DRAOptionalNodeOperations + // +k8s:optional + repeated string skipNodeOperations = 11; } // DeviceSelector must have exactly one field set. @@ -1099,8 +1220,8 @@ message DeviceSubRequest { // to reference. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name optional string deviceClassName = 2; // Selectors define criteria which must be satisfied by a specific @@ -1110,8 +1231,8 @@ message DeviceSubRequest { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceSelector selectors = 3; // AllocationMode and its related fields define how devices are allocated @@ -1133,7 +1254,7 @@ message DeviceSubRequest { // requests with unknown modes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional string allocationMode = 4; // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1164,7 +1285,7 @@ message DeviceSubRequest { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated DeviceToleration tolerations = 6; // Capacity define resource requirements against each capacity. @@ -1183,6 +1304,34 @@ message DeviceSubRequest { // +optional // +featureGate=DRAConsumableCapacity optional CapacityRequirements capacity = 7; + + // DerivedAttributes defines a set of virtual attributes computed via CEL expressions + // for each candidate device. These virtual attributes can be referenced in + // `.devices.constraints` to align and match different devices (e.g., co-allocating + // a GPU and a NIC on the same NUMA node) even if their drivers publish different + // attributes. Derived attributes are not available via `device.attributes` + // in the CEL environment when evaluating selector expressions. + // + // Derived attributes allow you to extract, transform, or normalize topology + // information (such as extracting a NUMA index from a complex topology string or + // renaming a vendor-specific attribute) into a common virtual attribute name at + // scheduling time. The scheduler then evaluates these virtual attributes exactly + // like static attributes when matching constraints. + // + // Every derived attribute defined in this list must be referenced by at least one + // MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + // + // The maximum number of derived attributes is 32. + // + // This is an alpha field and requires enabling the DRADerivedAttributes + // feature gate. + // + // +optional + // +listType=atomic + // +featureGate=DRADerivedAttributes + // +k8s:optional + // +k8s:maxItems=32 + repeated DeviceDerivedAttribute derivedAttributes = 8; } // The device this taint is attached to has the "effect" on @@ -1211,7 +1360,7 @@ message DeviceTaint { // Consumers must treat unknown effects like None. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string effect = 3; // TimeAdded represents the time at which the taint was added or @@ -1230,6 +1379,119 @@ message DeviceTaint { optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time timeAdded = 4; } +// DeviceTaintRule adds one taint to all devices which match the selector. +// This has the same effect as if the taint was specified directly +// in the ResourceSlice by the DRA driver. +// +k8s:supportsSubresource="/status" +message DeviceTaintRule { + // Standard object metadata + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // Spec specifies the selector and one taint. + // + // Changing the spec automatically increments the metadata.generation number. + // +required + optional DeviceTaintRuleSpec spec = 2; + + // Status provides information about what was requested in the spec. + // + // +optional + optional DeviceTaintRuleStatus status = 3; +} + +// DeviceTaintRuleList is a collection of DeviceTaintRules. +message DeviceTaintRuleList { + // Standard list metadata + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // Items is the list of DeviceTaintRules. + repeated DeviceTaintRule items = 2; +} + +// DeviceTaintRuleSpec specifies the selector and one taint. +message DeviceTaintRuleSpec { + // DeviceSelector defines which device(s) the taint is applied to. + // All selector criteria must be satisfied for a device to + // match. The empty selector matches all devices. Without + // a selector, no devices are matches. + // + // +optional + optional DeviceTaintSelector deviceSelector = 1; + + // The taint that gets applied to matching devices. + // + // +required + optional DeviceTaint taint = 2; +} + +// DeviceTaintRuleStatus provides information about an on-going pod eviction. +message DeviceTaintRuleStatus { + // Conditions provide information about the state of the DeviceTaintRule + // and the cluster at some point in time, + // in a machine-readable and human-readable format. + // + // The following condition is currently defined as part of this API, more may + // get added: + // - Type: EvictionInProgress + // - Status: True if there are currently pods which need to be evicted, False otherwise + // (includes the effects which don't cause eviction). + // - Reason: not specified, may change + // - Message: includes information about number of pending pods and already evicted pods + // in a human-readable format, updated periodically, may change + // + // For `effect: None`, the condition above gets set once for each change to + // the spec, with the message containing information about what would happen + // if the effect was `NoExecute`. This feedback can be used to decide whether + // changing the effect to `NoExecute` will work as intended. It only gets + // set once to avoid having to constantly update the status. + // + // Must have 8 or fewer entries. + // + // +optional + // +listType=map + // +listMapKey=type + // +patchStrategy=merge + // +patchMergeKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1; +} + +// DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to. +// The empty selector matches all devices. Without a selector, no devices +// are matched. +message DeviceTaintSelector { + // If driver is set, only devices from that driver are selected. + // This fields corresponds to slice.spec.driver. + // + // +optional + optional string driver = 2; + + // If pool is set, only devices in that pool are selected. + // + // Also setting the driver name may be useful to avoid + // ambiguity when different drivers use the same pool name, + // but this is not required because selecting pools from + // different drivers may also be useful, for example when + // drivers with node-local devices use the node name as + // their pool name. + // + // +optional + optional string pool = 3; + + // If device is set, only devices with that name are selected. + // This field corresponds to slice.spec.devices[].name. + // + // Setting also driver and pool may be required to avoid ambiguity, + // but is not required. + // + // +optional + optional string device = 4; +} + // The ResourceClaim this DeviceToleration is attached to tolerates any taint that matches // the triple using the matching operator . message DeviceToleration { @@ -1238,8 +1500,8 @@ message DeviceToleration { // Must be a label name. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-label-key + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-label-key optional string key = 1; // Operator represents a key's relationship to the value. @@ -1249,7 +1511,7 @@ message DeviceToleration { // // +optional // +default="Equal" - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional string operator = 2; // Value is the taint value the toleration matches to. @@ -1263,7 +1525,7 @@ message DeviceToleration { // When specified, allowed values are NoSchedule and NoExecute. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional string effect = 4; // TolerationSeconds represents the period of time the toleration (which must be @@ -1301,8 +1563,8 @@ message ExactDeviceRequest { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceSelector selectors = 2; // AllocationMode and its related fields define how devices are allocated @@ -1325,7 +1587,7 @@ message ExactDeviceRequest { // requests with unknown modes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional string allocationMode = 3; // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1369,7 +1631,7 @@ message ExactDeviceRequest { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated DeviceToleration tolerations = 6; // Capacity define resource requirements against each capacity. @@ -1388,6 +1650,34 @@ message ExactDeviceRequest { // +optional // +featureGate=DRAConsumableCapacity optional CapacityRequirements capacity = 7; + + // DerivedAttributes defines a set of virtual attributes computed via CEL expressions + // for each candidate device. These virtual attributes can be referenced in + // `.devices.constraints` to align and match different devices (e.g., co-allocating + // a GPU and a NIC on the same NUMA node) even if their drivers publish different + // attributes. Derived attributes are not available via `device.attributes` + // in the CEL environment when evaluating selector expressions. + // + // Derived attributes allow you to extract, transform, or normalize topology + // information (such as extracting a NUMA index from a complex topology string or + // renaming a vendor-specific attribute) into a common virtual attribute name at + // scheduling time. The scheduler then evaluates these virtual attributes exactly + // like static attributes when matching constraints. + // + // Every derived attribute defined in this list must be referenced by at least one + // MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + // + // The maximum number of derived attributes is 32. + // + // This is an alpha field and requires enabling the DRADerivedAttributes + // feature gate. + // + // +optional + // +listType=atomic + // +featureGate=DRADerivedAttributes + // +k8s:optional + // +k8s:maxItems=32 + repeated DeviceDerivedAttribute derivedAttributes = 8; } // NetworkDeviceData provides network-related details for the allocated device. @@ -1401,8 +1691,8 @@ message NetworkDeviceData { // Must not be longer than 256 bytes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxBytes=256 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxBytes=256 optional string interfaceName = 1; // IPs lists the network addresses assigned to the device's network interface. @@ -1413,10 +1703,10 @@ message NetworkDeviceData { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=16 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=16 repeated string ips = 2; // HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface. @@ -1424,47 +1714,104 @@ message NetworkDeviceData { // Must not be longer than 128 bytes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxBytes=128 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxBytes=128 optional string hardwareAddress = 3; } -// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity -// units requested to the corresponding quantity of the node allocatable resource. -message NodeAllocatableResourceMapping { +// NodeAllocatableMapping defines how a DRA allocation directly translates into a node allocatable resource quantity. +// The mapping can be derived from either the count of allocated devices (via deviceMultiplier) or the specific capacity consumed (via capacityKey and capacityMultiplier). These options are mutually exclusive. +// Kubelet adds this mapped resource quantity from claim to both requests and limits at the pod-level cgroup, and to limits at the container-level cgroup for each container referencing the claim. +message NodeAllocatableMapping { // CapacityKey references a capacity name defined as a key in the // `spec.devices[*].capacity` map. When this field is set, the value associated with // this key in the `status.allocation.devices.results[*].consumedCapacity` map // (for a specific claim allocation) determines the base quantity for - // the node allocatable resource. If `allocationMultiplier` is also set, it is + // the node allocatable resource. `capacityMultiplier` must also be set and is // multiplied with the base quantity. // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", // and this field is set to "dra.example.com/memory", then for a claim allocation // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the - // node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should - // be omitted or set to "1". + // node allocatable resource mapping will be "4Gi". + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:alpha(since: "1.37")=+k8s:dependentRequired("capacityMultiplier") optional string capacityKey = 1; - // AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. - // It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. - // 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim. - // a. A DRA driver representing each CPU core as a device would have - // {ResourceName: "cpu", allocationMultiplier: "2"} in its - // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim, - // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. - // b. A GPU device that needs additional node memory per GPU allocation would - // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated - // GPU device instance of this type will account for 2Gi of memory. - // - // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed. - // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`. - // For example, if a Device's capacity "dra.example.com/cores" is consumed, - // and each "core" provides 2 "cpu"s, the mapping would be: - // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. - // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. - // +optional - optional .k8s.io.apimachinery.pkg.api.resource.Quantity allocationMultiplier = 2; + // CapacityMultiplier is used as a multiplier for the allocated capacity consumed. + // It is only valid if `capacityKey` is set. + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. + // For example, if a Device's capacity "dra.example.com/cores" is consumed, + // and each "core" provides 2 "cpu"s, the mapping would be: + // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", capacityMultiplier: "2"}. + // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. + // +optional + // +k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:dependentRequired("capacityKey") + optional .k8s.io.apimachinery.pkg.api.resource.Quantity capacityMultiplier = 2; + + // DeviceMultiplier is used as a multiplier for the allocated device count in the claim. + // The final node allocatable resource amount is `deviceCount` * `deviceMultiplier`. + // For example, a DRA driver representing each cache complex (CCX) as a device would have + // {ResourceName: "cpu", deviceMultiplier: "8"} in its `nodeAllocatableResources`. + // If 2 devices (CCX) are allocated to the claim, 2 * 8 = 16 CPUs would be considered as allocated. + // It is only valid when `capacityKey` and `capacityMultiplier` are not set. + // +optional + // +k8s:optional + // +k8s:unionMember + optional .k8s.io.apimachinery.pkg.api.resource.Quantity deviceMultiplier = 3; +} + +// NodeAllocatableOverhead defines auxiliary resource overheads incurred when allocating a device. +// Overheads can be specified as a fixed cost per pod referencing the claim, a variable cost per container reference, or both. +// Kubelet accounts for this overhead by adding it to both the pod-level and container-level cgroups of referencing containers. +message NodeAllocatableOverhead { + // PerPod is overhead applied once per pod referencing the claim on this node. + // This is a flat overhead incurred for every pod referencing the claim. + // +optional + // +k8s:optional + optional .k8s.io.apimachinery.pkg.api.resource.Quantity perPod = 1; + + // PerContainer is applied per container reference to the claim. + // This models overhead scaling linearly with the number of containers actively using the device. + // When both PerPod and PerContainer are specified, the total overhead allocated for each pod referencing + // the claim is computed as: + // Quantity = PerPod + (PerContainer * NumReferences) + // Kubelet accounts for this overhead in cgroups: + // - Pod-level cgroup (requests and limits): Kubelet adds PerPod + (PerContainer * NumReferences). + // - Container-level cgroup (limits only): Kubelet adds PerPod + PerContainer for each referencing container. + // This allows any single container to access the pod-level overhead, while the parent cgroup caps the total usage to account for PerPod exactly once. + // +optional + // +k8s:optional + optional .k8s.io.apimachinery.pkg.api.resource.Quantity perContainer = 2; +} + +// NodeAllocatableResource defines the translation between the DRA device/capacity +// units requested to the corresponding quantity of the node allocatable resource. +// At least one of Mapping or Overhead must be specified. Not specifying either is an invalid configuration. +message NodeAllocatableResource { + // Mapping is used when the device directly models a node allocatable resource like standard CPU or memory + // (e.g., with a CPU DRA driver). The calculated quantity is accounted for exactly once per claim instance + // on the node. To prevent node cgroup isolation friction, the scheduler explicitly + // blocks sharing mapped device claims across multiple pods. + // +optional + // +k8s:optional + optional NodeAllocatableMapping mapping = 3; + + // Overhead contains fields for modeling auxiliary overhead incurred on node allocatable resources + // when allocating devices that are not themselves modeling a node allocatable resource (e.g., host memory overhead for GPUs). + // Sharing overhead-mapped claims across multiple pods is allowed. The node allocatable overhead is accounted + // for individually for each pod referencing the claim. + // Overhead is always subtracted from the node's allocatable capacity for the resource, even when mapping + // is specified for the same resource. + // Eg: If a device models memory capacity per socket as a consumable capacity pool via Mapping (with CapacityKey), + // any overhead specified for the same resource will be subtracted from the node's general allocatable capacity + // and not from the per-socket capacity pool in Mapping. + // +optional + // +k8s:optional + optional NodeAllocatableOverhead overhead = 4; } // OpaqueDeviceConfiguration contains configuration parameters for a driver @@ -1480,9 +1827,9 @@ message OpaqueDeviceConfiguration { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless - // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name-caseless + // +k8s:beta(since: "1.37")=+k8s:maxLength=63 optional string driver = 1; // Parameters can contain arbitrary data. It is the responsibility of @@ -1508,7 +1855,8 @@ message ResourceClaim { // Spec describes what is being requested and how to configure it. // The spec is immutable. - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:immutable + // +optional optional ResourceClaimSpec spec = 2; // Status describes whether the claim is ready to use and what has been allocated. @@ -1563,8 +1911,8 @@ message ResourceClaimStatus { // Allocation is set once the claim has been allocated successfully. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:update=NoModify + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:update=NoModify optional AllocationResult allocation = 1; // ReservedFor indicates which entities are currently allowed to use @@ -1592,10 +1940,10 @@ message ResourceClaimStatus { // +listMapKey=uid // +patchStrategy=merge // +patchMergeKey=uid - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:listType=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=uid - // +k8s:alpha(since: "1.36")=+k8s:maxItems=256 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:listType=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=uid + // +k8s:beta(since: "1.37")=+k8s:maxItems=256 repeated ResourceClaimConsumerReference reservedFor = 2; // Devices contains the status of each device allocated for this @@ -1603,18 +1951,18 @@ message ResourceClaimStatus { // information. Entries are owned by their respective drivers. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +listType=map // +listMapKey=driver // +listMapKey=device // +listMapKey=pool // +listMapKey=shareID // +featureGate=DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:listType=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=driver - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=device - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=pool - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=shareID + // +k8s:beta(since: "1.37")=+k8s:listType=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=driver + // +k8s:beta(since: "1.37")=+k8s:listMapKey=device + // +k8s:beta(since: "1.37")=+k8s:listMapKey=pool + // +k8s:beta(since: "1.37")=+k8s:listMapKey=shareID repeated AllocatedDeviceStatus devices = 4; } @@ -1629,6 +1977,7 @@ message ResourceClaimTemplate { // This field is immutable. A ResourceClaim will get created by the // control plane for a Pod when needed and then not get updated // anymore. + // +optional optional ResourceClaimTemplateSpec spec = 2; } @@ -1648,11 +1997,13 @@ message ResourceClaimTemplateSpec { // when creating it. No other fields are allowed and will be rejected during // validation. // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Spec for the ResourceClaim. The entire content is copied unchanged // into the ResourceClaim that gets created from this template. The // same fields as in a ResourceClaim are also valid here. + // +optional optional ResourceClaimSpec spec = 2; } @@ -1660,6 +2011,8 @@ message ResourceClaimTemplateSpec { message ResourcePool { // Name is used to identify the pool. For node-local devices, this // is often the node name, but this is not required. + // A field selector can be used to list only ResourceSlice objects + // belonging to a certain pool. // // It must not be longer than 253 characters and must consist of one or more DNS sub-domains // separated by slashes. This field is immutable. @@ -1797,7 +2150,7 @@ message ResourceSliceSpec { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +zeroOrOneOf=ResourceSliceType repeated Device devices = 6; @@ -1823,14 +2176,50 @@ message ResourceSliceSpec { // The maximum number of counter sets is 8. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=name // +featureGate=DRAPartitionableDevices // +zeroOrOneOf=ResourceSliceType - // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 + // +k8s:beta(since: "1.37")=+k8s:maxItems=8 repeated CounterSet sharedCounters = 8; + + // PartitionTypeAttribute names a string device attribute (by fully + // qualified name, e.g. "gpu.example.com/profile") whose value labels + // each device with its partition type, such as "Full" or "Half" for a + // MIG-style GPU. + // + // When set, every partitionable device in the slice must carry the attribute + // and devices sharing a value must share the same ConsumesCounters cost. + // + // +optional + // +featureGate=DRAPartitionableDevicesType + // +k8s:ifDisabled(DRAPartitionableDevicesType)=+k8s:forbidden + // +k8s:ifEnabled(DRAPartitionableDevicesType)=+k8s:optional + // +k8s:ifEnabled(DRAPartitionableDevicesType)=+k8s:format=k8s-resource-fully-qualified-name + optional string partitionTypeAttribute = 9; + + // SkipNodeOperations lists node-local resource operations (gRPC calls) + // that will be skipped for the devices in this slice when determining whether + // operations are necessary on the node. If all allocated devices for a driver in + // a claim skip an operation, that gRPC call will be skipped. Valid values are: + // + // - "NodePrepareResources": NodePrepareResources gRPC calls are skipped. This + // value cannot be specified unless "NodeUnprepareResources" is also listed + // (or "*" is specified). + // - "NodeUnprepareResources": NodeUnprepareResources gRPC calls are skipped. + // - "*": All node-local resource operations are skipped. + // + // Other values may be added in the future. The kubelet must ignore unknown + // values. + // + // +optional + // +listType=set + // +k8s:listType=set + // +featureGate=DRAOptionalNodeOperations + // +k8s:optional + repeated string skipNodeOperations = 10; } diff --git a/vendor/k8s.io/api/resource/v1/register.go b/vendor/k8s.io/api/resource/v1/register.go index dca6492256..c634e4c9af 100644 --- a/vendor/k8s.io/api/resource/v1/register.go +++ b/vendor/k8s.io/api/resource/v1/register.go @@ -46,6 +46,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &DeviceClass{}, &DeviceClassList{}, + &DeviceTaintRule{}, + &DeviceTaintRuleList{}, &ResourceClaim{}, &ResourceClaimList{}, &ResourceClaimTemplate{}, diff --git a/vendor/k8s.io/api/resource/v1/types.go b/vendor/k8s.io/api/resource/v1/types.go index 27d5eff29c..580ffc3279 100644 --- a/vendor/k8s.io/api/resource/v1/types.go +++ b/vendor/k8s.io/api/resource/v1/types.go @@ -93,7 +93,7 @@ const ( // For resources that are not local to a node, the node name is not set. Instead, // the driver may use a node selector to specify where the devices are available. type ResourceSlice struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -112,6 +112,9 @@ const ( // ResourceSliceSelectorDriver can be used in a [metav1.ListOptions] // field selector to filter based on [ResourceSliceSpec.Driver]. ResourceSliceSelectorDriver = "spec.driver" + // ResourceSliceSelectorPoolName can be used in a [metav1.ListOptions] + // field selector to filter based on [ResourceSliceSpec.Pool.Name]. + ResourceSliceSelectorPoolName = "spec.pool.name" ) // ResourceSliceSpec contains the information published by the driver in one ResourceSlice. @@ -175,7 +178,7 @@ type ResourceSliceSpec struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +zeroOrOneOf=ResourceSliceType Devices []Device `json:"devices,omitempty" protobuf:"bytes,6,name=devices"` @@ -201,17 +204,68 @@ type ResourceSliceSpec struct { // The maximum number of counter sets is 8. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=name // +featureGate=DRAPartitionableDevices // +zeroOrOneOf=ResourceSliceType - // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 + // +k8s:beta(since: "1.37")=+k8s:maxItems=8 SharedCounters []CounterSet `json:"sharedCounters,omitempty" protobuf:"bytes,8,name=sharedCounters"` + + // PartitionTypeAttribute names a string device attribute (by fully + // qualified name, e.g. "gpu.example.com/profile") whose value labels + // each device with its partition type, such as "Full" or "Half" for a + // MIG-style GPU. + // + // When set, every partitionable device in the slice must carry the attribute + // and devices sharing a value must share the same ConsumesCounters cost. + // + // +optional + // +featureGate=DRAPartitionableDevicesType + // +k8s:ifDisabled(DRAPartitionableDevicesType)=+k8s:forbidden + // +k8s:ifEnabled(DRAPartitionableDevicesType)=+k8s:optional + // +k8s:ifEnabled(DRAPartitionableDevicesType)=+k8s:format=k8s-resource-fully-qualified-name + PartitionTypeAttribute *FullyQualifiedName `json:"partitionTypeAttribute,omitempty" protobuf:"bytes,9,opt,name=partitionTypeAttribute"` + + // SkipNodeOperations lists node-local resource operations (gRPC calls) + // that will be skipped for the devices in this slice when determining whether + // operations are necessary on the node. If all allocated devices for a driver in + // a claim skip an operation, that gRPC call will be skipped. Valid values are: + // + // - "NodePrepareResources": NodePrepareResources gRPC calls are skipped. This + // value cannot be specified unless "NodeUnprepareResources" is also listed + // (or "*" is specified). + // - "NodeUnprepareResources": NodeUnprepareResources gRPC calls are skipped. + // - "*": All node-local resource operations are skipped. + // + // Other values may be added in the future. The kubelet must ignore unknown + // values. + // + // +optional + // +listType=set + // +k8s:listType=set + // +featureGate=DRAOptionalNodeOperations + // +k8s:optional + SkipNodeOperations []SkipNodeOperation `json:"skipNodeOperations,omitempty" protobuf:"bytes,10,rep,name=skipNodeOperations,casttype=SkipNodeOperation"` } +// +enum +// +k8s:enum +type SkipNodeOperation string + +const ( + // SkipNodeOperationNodePrepareResources indicates that NodePrepareResources gRPC calls are skipped. + SkipNodeOperationNodePrepareResources SkipNodeOperation = "NodePrepareResources" + + // SkipNodeOperationNodeUnprepareResources indicates that NodeUnprepareResources gRPC calls are skipped. + SkipNodeOperationNodeUnprepareResources SkipNodeOperation = "NodeUnprepareResources" + + // SkipNodeOperationAll indicates that all node-local resource operations are skipped. + SkipNodeOperationAll SkipNodeOperation = "*" +) + // CounterSet defines a named set of counters // that are available to be used by devices defined in the // ResourcePool. @@ -225,8 +279,8 @@ type CounterSet struct { // It must be a DNS label. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-short-name Name string `json:"name" protobuf:"bytes,1,name=name"` // Counters defines the set of counters for this CounterSet @@ -235,8 +289,8 @@ type CounterSet struct { // The maximum number of counters is 32. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:eachKey=+k8s:format=k8s-short-name Counters map[string]Counter `json:"counters,omitempty" protobuf:"bytes,2,name=counters"` } @@ -248,6 +302,8 @@ const DriverNameMaxLength = 63 type ResourcePool struct { // Name is used to identify the pool. For node-local devices, this // is often the node name, but this is not required. + // A field selector can be used to list only ResourceSlice objects + // belonging to a certain pool. // // It must not be longer than 253 characters and must consist of one or more DNS sub-domains // separated by slashes. This field is immutable. @@ -312,6 +368,10 @@ const ResourceSliceMaxDeviceCounterConsumptionsPerDevice = 2 // per device counter consumption. const ResourceSliceMaxCountersPerDeviceCounterConsumption = 32 +// Defines the maximum number of compatibility groups that can be +// declared per device counter consumption. +const DeviceCompatibilityGroupsMaxSize = 2 + // Device represents one individual hardware instance that can be selected based // on its attributes. Besides the name, exactly one field must be set. type Device struct { @@ -327,7 +387,7 @@ type Device struct { // The maximum number of attributes and capacities combined is 32. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Attributes map[QualifiedName]DeviceAttribute `json:"attributes,omitempty" protobuf:"bytes,2,rep,name=attributes"` // Capacity defines the set of capacities for this device. @@ -348,13 +408,13 @@ type Device struct { // device is 2. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=counterSet + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=counterSet // +featureGate=DRAPartitionableDevices - // +k8s:alpha(since: "1.36")=+k8s:maxItems=2 + // +k8s:beta(since: "1.37")=+k8s:maxItems=2 ConsumesCounters []DeviceCounterConsumption `json:"consumesCounters,omitempty" protobuf:"bytes,4,rep,name=consumesCounters"` // NodeName identifies the node where the device is available. @@ -401,7 +461,7 @@ type Device struct { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Taints []DeviceTaint `json:"taints,omitempty" protobuf:"bytes,8,rep,name=taints"` // BindsToNode indicates if the usage of an allocation involving this device @@ -431,8 +491,8 @@ type Device struct { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 BindingConditions []string `json:"bindingConditions,omitempty" protobuf:"bytes,10,rep,name=bindingConditions"` // BindingFailureConditions defines the conditions for binding failure. @@ -449,8 +509,8 @@ type Device struct { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 BindingFailureConditions []string `json:"bindingFailureConditions,omitempty" protobuf:"bytes,11,rep,name=bindingFailureConditions"` // AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests. @@ -462,7 +522,10 @@ type Device struct { // +featureGate=DRAConsumableCapacity AllowMultipleAllocations *bool `json:"allowMultipleAllocations,omitempty" protobuf:"bytes,12,opt,name=allowMultipleAllocations"` - // NodeAllocatableResourceMappings defines the mapping of node resources + // NodeAllocatableResourceMappings is tombstoned as it got replaced with NodeAllocatableResources. + // NodeAllocatableResourceMappings map[v1.ResourceName]NodeAllocatableResourceMapping `json:"nodeAllocatableResourceMappings,omitempty" protobuf:"bytes,13,opt,name=nodeAllocatableResourceMappings"` + + // NodeAllocatableResources defines the mapping of node resources // that are managed by the DRA driver exposing this device. This includes resources currently // reported in v1.Node `status.allocatable` that are not extended resources // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). @@ -474,46 +537,104 @@ type Device struct { // The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). // Extended resource names are not permitted as keys. // +optional + // +k8s:optional // +featureGate=DRANodeAllocatableResources - NodeAllocatableResourceMappings map[v1.ResourceName]NodeAllocatableResourceMapping `json:"nodeAllocatableResourceMappings,omitempty" protobuf:"bytes,13,opt,name=nodeAllocatableResourceMappings"` + NodeAllocatableResources map[v1.ResourceName]NodeAllocatableResource `json:"nodeAllocatableResources,omitempty" protobuf:"bytes,14,opt,name=nodeAllocatableResources"` } -// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity +// NodeAllocatableResource defines the translation between the DRA device/capacity // units requested to the corresponding quantity of the node allocatable resource. -type NodeAllocatableResourceMapping struct { +// At least one of Mapping or Overhead must be specified. Not specifying either is an invalid configuration. +type NodeAllocatableResource struct { + // Mapping is used when the device directly models a node allocatable resource like standard CPU or memory + // (e.g., with a CPU DRA driver). The calculated quantity is accounted for exactly once per claim instance + // on the node. To prevent node cgroup isolation friction, the scheduler explicitly + // blocks sharing mapped device claims across multiple pods. + // +optional + // +k8s:optional + Mapping *NodeAllocatableMapping `json:"mapping,omitempty" protobuf:"bytes,3,opt,name=mapping"` + + // Overhead contains fields for modeling auxiliary overhead incurred on node allocatable resources + // when allocating devices that are not themselves modeling a node allocatable resource (e.g., host memory overhead for GPUs). + // Sharing overhead-mapped claims across multiple pods is allowed. The node allocatable overhead is accounted + // for individually for each pod referencing the claim. + // Overhead is always subtracted from the node's allocatable capacity for the resource, even when mapping + // is specified for the same resource. + // Eg: If a device models memory capacity per socket as a consumable capacity pool via Mapping (with CapacityKey), + // any overhead specified for the same resource will be subtracted from the node's general allocatable capacity + // and not from the per-socket capacity pool in Mapping. + // +optional + // +k8s:optional + Overhead *NodeAllocatableOverhead `json:"overhead,omitempty" protobuf:"bytes,4,opt,name=overhead"` +} + +// NodeAllocatableMapping defines how a DRA allocation directly translates into a node allocatable resource quantity. +// The mapping can be derived from either the count of allocated devices (via deviceMultiplier) or the specific capacity consumed (via capacityKey and capacityMultiplier). These options are mutually exclusive. +// Kubelet adds this mapped resource quantity from claim to both requests and limits at the pod-level cgroup, and to limits at the container-level cgroup for each container referencing the claim. +type NodeAllocatableMapping struct { // CapacityKey references a capacity name defined as a key in the // `spec.devices[*].capacity` map. When this field is set, the value associated with // this key in the `status.allocation.devices.results[*].consumedCapacity` map // (for a specific claim allocation) determines the base quantity for - // the node allocatable resource. If `allocationMultiplier` is also set, it is + // the node allocatable resource. `capacityMultiplier` must also be set and is // multiplied with the base quantity. // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", // and this field is set to "dra.example.com/memory", then for a claim allocation // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the - // node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should - // be omitted or set to "1". + // node allocatable resource mapping will be "4Gi". + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:alpha(since: "1.37")=+k8s:dependentRequired("capacityMultiplier") CapacityKey *QualifiedName `json:"capacityKey,omitempty" protobuf:"bytes,1,opt,name=capacityKey"` - // AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. - // It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. - // 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim. - // a. A DRA driver representing each CPU core as a device would have - // {ResourceName: "cpu", allocationMultiplier: "2"} in its - // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim, - // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. - // b. A GPU device that needs additional node memory per GPU allocation would - // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated - // GPU device instance of this type will account for 2Gi of memory. - // - // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed. - // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`. - // For example, if a Device's capacity "dra.example.com/cores" is consumed, - // and each "core" provides 2 "cpu"s, the mapping would be: - // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. - // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. - // +optional - AllocationMultiplier *resource.Quantity `json:"allocationMultiplier,omitempty" protobuf:"bytes,2,opt,name=allocationMultiplier"` + // CapacityMultiplier is used as a multiplier for the allocated capacity consumed. + // It is only valid if `capacityKey` is set. + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. + // For example, if a Device's capacity "dra.example.com/cores" is consumed, + // and each "core" provides 2 "cpu"s, the mapping would be: + // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", capacityMultiplier: "2"}. + // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. + // +optional + // +k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:dependentRequired("capacityKey") + CapacityMultiplier *resource.Quantity `json:"capacityMultiplier,omitempty" protobuf:"bytes,2,opt,name=capacityMultiplier"` + + // DeviceMultiplier is used as a multiplier for the allocated device count in the claim. + // The final node allocatable resource amount is `deviceCount` * `deviceMultiplier`. + // For example, a DRA driver representing each cache complex (CCX) as a device would have + // {ResourceName: "cpu", deviceMultiplier: "8"} in its `nodeAllocatableResources`. + // If 2 devices (CCX) are allocated to the claim, 2 * 8 = 16 CPUs would be considered as allocated. + // It is only valid when `capacityKey` and `capacityMultiplier` are not set. + // +optional + // +k8s:optional + // +k8s:unionMember + DeviceMultiplier *resource.Quantity `json:"deviceMultiplier,omitempty" protobuf:"bytes,3,opt,name=deviceMultiplier"` +} + +// NodeAllocatableOverhead defines auxiliary resource overheads incurred when allocating a device. +// Overheads can be specified as a fixed cost per pod referencing the claim, a variable cost per container reference, or both. +// Kubelet accounts for this overhead by adding it to both the pod-level and container-level cgroups of referencing containers. +type NodeAllocatableOverhead struct { + // PerPod is overhead applied once per pod referencing the claim on this node. + // This is a flat overhead incurred for every pod referencing the claim. + // +optional + // +k8s:optional + PerPod *resource.Quantity `json:"perPod,omitempty" protobuf:"bytes,1,opt,name=perPod"` + + // PerContainer is applied per container reference to the claim. + // This models overhead scaling linearly with the number of containers actively using the device. + // When both PerPod and PerContainer are specified, the total overhead allocated for each pod referencing + // the claim is computed as: + // Quantity = PerPod + (PerContainer * NumReferences) + // Kubelet accounts for this overhead in cgroups: + // - Pod-level cgroup (requests and limits): Kubelet adds PerPod + (PerContainer * NumReferences). + // - Container-level cgroup (limits only): Kubelet adds PerPod + PerContainer for each referencing container. + // This allows any single container to access the pod-level overhead, while the parent cgroup caps the total usage to account for PerPod exactly once. + // +optional + // +k8s:optional + PerContainer *resource.Quantity `json:"perContainer,omitempty" protobuf:"bytes,2,opt,name=perContainer"` } // DeviceCounterConsumption defines a set of counters that @@ -523,8 +644,8 @@ type DeviceCounterConsumption struct { // counters defined will be consumed. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-short-name CounterSet string `json:"counterSet" protobuf:"bytes,1,opt,name=counterSet"` // Counters defines the counters that will be consumed by the device. @@ -532,9 +653,39 @@ type DeviceCounterConsumption struct { // The maximum number of counters is 32. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:eachKey=+k8s:format=k8s-short-name Counters map[string]Counter `json:"counters,omitempty" protobuf:"bytes,2,opt,name=counters"` + + // CompatibilityGroups is a list of opaque group names for + // this counter set consumption. + // + // Devices that consume counters from the same counter set may only be + // allocated at the same time ("co-allocated") if they all share at least + // one common group: the intersection of the CompatibilityGroups of all + // co-allocated devices on that counter set must be non-empty. Devices + // that consume from different counter sets are never compared via this + // field. + // + // An unset field, an explicit nil, and an empty list are equivalent and + // mean "no groups": such a device is only co-allocatable with sibling + // devices on the same counter set that also have no groups, and is never + // co-allocatable with a device that declares one or more groups. + // + // Group names are opaque and meaningful only within the + // publishing driver's pool. + // + // The maximum number of groups is 2, and the names must be unique. + // + // +optional + // +listType=atomic + // +featureGate=DRADeviceCompatibilityGroups + // +k8s:listType=atomic + // +k8s:optional + // +k8s:maxItems=2 + // +k8s:unique=set + // +k8s:eachVal=+k8s:format=k8s-short-name + CompatibilityGroups []string `json:"compatibilityGroups,omitempty" protobuf:"bytes,3,rep,name=compatibilityGroups"` } // DeviceCapacity describes a quantity associated with a device. @@ -618,6 +769,13 @@ type CapacityRequestPolicy struct { // CapacityRequestPolicyRange defines a valid range for consumable capacity values. // +// If the DRAFractionalCapacityRange feature gate is +// enabled and at least one of Min, Max, or Step is a fractional quantity (i.e. +// its value is not an integer), milli-unit arithmetic is used instead, +// supporting values with up to 3 decimal places (e.g. 100m = 0.1). +// The largest supported value then is 1000 times smaller compared to using 64-bit integers. +// Otherwise, all comparisons use 64-bit integer arithmetic via resource.Quantity.Value(). +// // - If the requested amount is less than Min, it is rounded up to the Min value. // - If Step is set and the requested amount is between Min and Max but not aligned with Step, // it will be rounded up to the next value equal to Min + (n * Step). @@ -697,30 +855,30 @@ type DeviceAttribute struct { // IntValue is a number. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember IntValue *int64 `json:"int,omitempty" protobuf:"varint,2,opt,name=int"` // BoolValue is a true/false value. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember BoolValue *bool `json:"bool,omitempty" protobuf:"varint,3,opt,name=bool"` // StringValue is a string. Must not be longer than 64 characters. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember StringValue *string `json:"string,omitempty" protobuf:"bytes,4,opt,name=string"` // VersionValue is a semantic version according to semver.org spec 2.0.0. // Must not be longer than 64 characters. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember VersionValue *string `json:"version,omitempty" protobuf:"bytes,5,opt,name=version"` // IntValues is a non-empty list of numbers. @@ -730,8 +888,8 @@ type DeviceAttribute struct { // +optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember // +featureGate=DRAListTypeAttributes IntValues []int64 `json:"ints,omitempty" protobuf:"varint,6,opt,name=ints"` @@ -740,8 +898,8 @@ type DeviceAttribute struct { // +optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember // +featureGate=DRAListTypeAttributes BoolValues []bool `json:"bools,omitempty" protobuf:"varint,7,opt,name=bools"` @@ -753,8 +911,9 @@ type DeviceAttribute struct { // +optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember + // +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:maxBytes=64 // +featureGate=DRAListTypeAttributes StringValues []string `json:"strings,omitempty" protobuf:"bytes,8,opt,name=strings"` @@ -766,8 +925,8 @@ type DeviceAttribute struct { // +optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember // +featureGate=DRAListTypeAttributes VersionValues []string `json:"versions,omitempty" protobuf:"bytes,9,opt,name=versions"` } @@ -804,7 +963,7 @@ type DeviceTaint struct { // Consumers must treat unknown effects like None. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Effect DeviceTaintEffect `json:"effect" protobuf:"bytes,3,name=effect,casttype=DeviceTaintEffect"` // ^^^^ @@ -843,7 +1002,7 @@ type DeviceTaint struct { } // +enum -// +k8s:alpha(since: "1.36")=+k8s:enum +// +k8s:beta(since: "1.37")=+k8s:enum type DeviceTaintEffect string const ( @@ -859,12 +1018,166 @@ const ( DeviceTaintEffectNoExecute DeviceTaintEffect = "NoExecute" ) +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.37 + +// DeviceTaintRule adds one taint to all devices which match the selector. +// This has the same effect as if the taint was specified directly +// in the ResourceSlice by the DRA driver. +// +k8s:supportsSubresource="/status" +type DeviceTaintRule struct { + metav1.TypeMeta `json:""` + // Standard object metadata + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Spec specifies the selector and one taint. + // + // Changing the spec automatically increments the metadata.generation number. + // +required + Spec DeviceTaintRuleSpec `json:"spec" protobuf:"bytes,2,name=spec"` + + // Status provides information about what was requested in the spec. + // + // +optional + Status DeviceTaintRuleStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// DeviceTaintRuleSpec specifies the selector and one taint. +type DeviceTaintRuleSpec struct { + // DeviceSelector defines which device(s) the taint is applied to. + // All selector criteria must be satisfied for a device to + // match. The empty selector matches all devices. Without + // a selector, no devices are matches. + // + // +optional + DeviceSelector *DeviceTaintSelector `json:"deviceSelector,omitempty" protobuf:"bytes,1,opt,name=deviceSelector"` + + // The taint that gets applied to matching devices. + // + // +required + Taint DeviceTaint `json:"taint,omitempty" protobuf:"bytes,2,rep,name=taint"` +} + +// DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to. +// The empty selector matches all devices. Without a selector, no devices +// are matched. +type DeviceTaintSelector struct { + // If DeviceClassName is set, the selectors defined there must be + // satisfied by a device to be selected. This field corresponds + // to class.metadata.name. + // + // +optional + // + // Tombstoned since 1.35 because it turned out that supporting this in all cases + // would depend on copying the device attributes into the ResourceClaim allocation + // result. Without that the eviction controller cannot evaluate these CEL expressions. + // + // DeviceClassName *string `json:"deviceClassName,omitempty" protobuf:"bytes,1,opt,name=deviceClassName"` + + // If driver is set, only devices from that driver are selected. + // This fields corresponds to slice.spec.driver. + // + // +optional + Driver *string `json:"driver,omitempty" protobuf:"bytes,2,opt,name=driver"` + + // If pool is set, only devices in that pool are selected. + // + // Also setting the driver name may be useful to avoid + // ambiguity when different drivers use the same pool name, + // but this is not required because selecting pools from + // different drivers may also be useful, for example when + // drivers with node-local devices use the node name as + // their pool name. + // + // +optional + Pool *string `json:"pool,omitempty" protobuf:"bytes,3,opt,name=pool"` + + // If device is set, only devices with that name are selected. + // This field corresponds to slice.spec.devices[].name. + // + // Setting also driver and pool may be required to avoid ambiguity, + // but is not required. + // + // +optional + Device *string `json:"device,omitempty" protobuf:"bytes,4,opt,name=device"` + + // Selectors contains the same selection criteria as a ResourceClaim. + // Currently, CEL expressions are supported. All of these selectors + // must be satisfied. + // + // +optional + // +listType=atomic + // + // Tombstoned since 1.35 because it turned out that supporting this in all cases + // would depend on copying the device attributes into the ResourceClaim allocation + // result. Without that the eviction controller cannot evaluate these CEL expressions. + // + // Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,5,rep,name=selectors"` +} + +// DeviceTaintRuleStatus provides information about an on-going pod eviction. +type DeviceTaintRuleStatus struct { + // Conditions provide information about the state of the DeviceTaintRule + // and the cluster at some point in time, + // in a machine-readable and human-readable format. + // + // The following condition is currently defined as part of this API, more may + // get added: + // - Type: EvictionInProgress + // - Status: True if there are currently pods which need to be evicted, False otherwise + // (includes the effects which don't cause eviction). + // - Reason: not specified, may change + // - Message: includes information about number of pending pods and already evicted pods + // in a human-readable format, updated periodically, may change + // + // For `effect: None`, the condition above gets set once for each change to + // the spec, with the message containing information about what would happen + // if the effect was `NoExecute`. This feedback can be used to decide whether + // changing the effect to `NoExecute` will work as intended. It only gets + // set once to avoid having to constantly update the status. + // + // Must have 8 or fewer entries. + // + // +optional + // +listType=map + // +listMapKey=type + // +patchStrategy=merge + // +patchMergeKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` +} + +// DeviceTaintRuleStatusMaxConditions is the maximum number of conditions in DeviceTaintRuleStatus. +const DeviceTaintRuleStatusMaxConditions = 8 + +// DeviceTaintConditionEvictionInProgress is the publicly documented condition type for the DeviceTaintRuleStatus. +const DeviceTaintConditionEvictionInProgress = "EvictionInProgress" + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.37 + +// DeviceTaintRuleList is a collection of DeviceTaintRules. +type DeviceTaintRuleList struct { + metav1.TypeMeta `json:""` + // Standard list metadata + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Items is the list of DeviceTaintRules. + Items []DeviceTaintRule `json:"items" protobuf:"bytes,2,rep,name=items"` +} + // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.34 // ResourceSliceList is a collection of ResourceSlices. type ResourceSliceList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -884,14 +1197,15 @@ type ResourceSliceList struct { // stanza tracks whether this claim has been satisfied and what specific // resources have been allocated. type ResourceClaim struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec describes what is being requested and how to configure it. // The spec is immutable. - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:immutable + // +optional Spec ResourceClaimSpec `json:"spec" protobuf:"bytes,2,name=spec"` // Status describes whether the claim is ready to use and what has been allocated. @@ -919,11 +1233,11 @@ type DeviceClaim struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=name + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Requests []DeviceRequest `json:"requests" protobuf:"bytes,1,name=requests"` // These constraints must be satisfied by the set of devices that get @@ -931,8 +1245,8 @@ type DeviceClaim struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Constraints []DeviceConstraint `json:"constraints,omitempty" protobuf:"bytes,2,opt,name=constraints"` // This field holds configuration for multiple potential drivers which @@ -941,8 +1255,8 @@ type DeviceClaim struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Config []DeviceClaimConfiguration `json:"config,omitempty" protobuf:"bytes,3,opt,name=config"` // Potential future extension, ignored by older schedulers. This is @@ -993,7 +1307,7 @@ type DeviceRequest struct { // // +optional // +oneOf=deviceRequestType - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Exactly *ExactDeviceRequest `json:"exactly,omitempty" protobuf:"bytes,2,name=exactly"` // FirstAvailable contains subrequests, of which exactly one will be @@ -1014,11 +1328,11 @@ type DeviceRequest struct { // +oneOf=deviceRequestType // +listType=atomic // +featureGate=DRAPrioritizedList - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name - // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=name + // +k8s:beta(since: "1.37")=+k8s:maxItems=8 FirstAvailable []DeviceSubRequest `json:"firstAvailable,omitempty" protobuf:"bytes,3,name=firstAvailable"` } @@ -1046,8 +1360,8 @@ type ExactDeviceRequest struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,2,name=selectors"` // AllocationMode and its related fields define how devices are allocated @@ -1070,7 +1384,7 @@ type ExactDeviceRequest struct { // requests with unknown modes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional AllocationMode DeviceAllocationMode `json:"allocationMode,omitempty" protobuf:"bytes,3,opt,name=allocationMode"` // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1114,7 +1428,7 @@ type ExactDeviceRequest struct { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Tolerations []DeviceToleration `json:"tolerations,omitempty" protobuf:"bytes,6,opt,name=tolerations"` // Capacity define resource requirements against each capacity. @@ -1133,6 +1447,34 @@ type ExactDeviceRequest struct { // +optional // +featureGate=DRAConsumableCapacity Capacity *CapacityRequirements `json:"capacity,omitempty" protobuf:"bytes,7,opt,name=capacity"` + + // DerivedAttributes defines a set of virtual attributes computed via CEL expressions + // for each candidate device. These virtual attributes can be referenced in + // `.devices.constraints` to align and match different devices (e.g., co-allocating + // a GPU and a NIC on the same NUMA node) even if their drivers publish different + // attributes. Derived attributes are not available via `device.attributes` + // in the CEL environment when evaluating selector expressions. + // + // Derived attributes allow you to extract, transform, or normalize topology + // information (such as extracting a NUMA index from a complex topology string or + // renaming a vendor-specific attribute) into a common virtual attribute name at + // scheduling time. The scheduler then evaluates these virtual attributes exactly + // like static attributes when matching constraints. + // + // Every derived attribute defined in this list must be referenced by at least one + // MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + // + // The maximum number of derived attributes is 32. + // + // This is an alpha field and requires enabling the DRADerivedAttributes + // feature gate. + // + // +optional + // +listType=atomic + // +featureGate=DRADerivedAttributes + // +k8s:optional + // +k8s:maxItems=32 + DerivedAttributes []DeviceDerivedAttribute `json:"derivedAttributes,omitempty" protobuf:"bytes,8,rep,name=derivedAttributes"` } // DeviceSubRequest describes a request for device provided in the @@ -1166,8 +1508,8 @@ type DeviceSubRequest struct { // to reference. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name DeviceClassName string `json:"deviceClassName" protobuf:"bytes,2,name=deviceClassName"` // Selectors define criteria which must be satisfied by a specific @@ -1177,8 +1519,8 @@ type DeviceSubRequest struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,3,name=selectors"` // AllocationMode and its related fields define how devices are allocated @@ -1200,7 +1542,7 @@ type DeviceSubRequest struct { // requests with unknown modes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional AllocationMode DeviceAllocationMode `json:"allocationMode,omitempty" protobuf:"bytes,4,opt,name=allocationMode"` // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1231,7 +1573,7 @@ type DeviceSubRequest struct { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Tolerations []DeviceToleration `json:"tolerations,omitempty" protobuf:"bytes,6,opt,name=tolerations"` // Capacity define resource requirements against each capacity. @@ -1250,6 +1592,34 @@ type DeviceSubRequest struct { // +optional // +featureGate=DRAConsumableCapacity Capacity *CapacityRequirements `json:"capacity,omitempty" protobuf:"bytes,7,opt,name=capacity"` + + // DerivedAttributes defines a set of virtual attributes computed via CEL expressions + // for each candidate device. These virtual attributes can be referenced in + // `.devices.constraints` to align and match different devices (e.g., co-allocating + // a GPU and a NIC on the same NUMA node) even if their drivers publish different + // attributes. Derived attributes are not available via `device.attributes` + // in the CEL environment when evaluating selector expressions. + // + // Derived attributes allow you to extract, transform, or normalize topology + // information (such as extracting a NUMA index from a complex topology string or + // renaming a vendor-specific attribute) into a common virtual attribute name at + // scheduling time. The scheduler then evaluates these virtual attributes exactly + // like static attributes when matching constraints. + // + // Every derived attribute defined in this list must be referenced by at least one + // MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + // + // The maximum number of derived attributes is 32. + // + // This is an alpha field and requires enabling the DRADerivedAttributes + // feature gate. + // + // +optional + // +listType=atomic + // +featureGate=DRADerivedAttributes + // +k8s:optional + // +k8s:maxItems=32 + DerivedAttributes []DeviceDerivedAttribute `json:"derivedAttributes,omitempty" protobuf:"bytes,8,rep,name=derivedAttributes"` } // CapacityRequirements defines the capacity requirements for a specific device request. @@ -1285,10 +1655,11 @@ const ( DeviceSelectorsMaxSize = 32 FirstAvailableDeviceRequestMaxSize = 8 DeviceTolerationsMaxLength = 16 + DeviceDerivedAttributesMaxSize = 32 ) // +enum -// +k8s:alpha(since: "1.36")=+k8s:enum +// +k8s:beta(since: "1.37")=+k8s:enum type DeviceAllocationMode string // Valid [DeviceRequest.CountMode] values. @@ -1318,7 +1689,7 @@ type CELDeviceSelector struct { // - driver (string): the name of the driver which defines this device. // - attributes (map[string]object): the device's attributes, grouped by prefix // (e.g. device.attributes["dra.example.com"] evaluates to an object with all - // of the attributes which were prefixed by "dra.example.com". + // of the attributes which were prefixed by "dra.example.com"). // - capacity (map[string]object): the device's capacities, grouped by prefix. // - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device // (v1.34+ with the DRAConsumableCapacity feature enabled). @@ -1351,6 +1722,15 @@ type CELDeviceSelector struct { // A robust expression should check for the existence of attributes // before referencing them. // + // Common errors: + // - "no such key": Use optional chaining (.? followed by orValue()) + // or guarding the check with has() for optional fields. + // See CEL Optional Types for details: + // https://pkg.go.dev/github.com/google/cel-go@v0.17.4/cel#OptionalTypes + // + // For more CEL expression syntax and examples, see: + // https://kubernetes.io/docs/reference/using-api/cel/ + // // For ease of use, the cel.bind() function is enabled, and can be used // to simplify expressions that access multiple attributes with the // same domain. For example: @@ -1373,6 +1753,61 @@ type CELDeviceSelector struct { Expression string `json:"expression" protobuf:"bytes,1,name=expression"` } +// DeviceDerivedAttribute defines a derived attribute computed via CEL. +type DeviceDerivedAttribute struct { + // Name is the identifier for this derived attribute, used in constraints. + // + // It must be a DNS subdomain followed by a slash ("/") followed by a C identifier + // (e.g. "example.com/numaNode" or "derived/numaNode"). + // + // If the chosen name matches an existing physical attribute from a driver, + // the derived attribute's expression will shadow the physical attribute, + // and its evaluated value will be used in constraints instead. When the goal + // is to define a derived attribute that is only used within the ResourceClaim + // and not meant to shadow an existing attribute, use a domain prefix that + // no DRA driver should be using (e.g. "derived/myAttribute"). + // + // It is not valid to define a derived attribute that isn't used in at least + // one constraint. + // + // +required + // +k8s:required + // +k8s:format=k8s-resource-fully-qualified-name + Name FullyQualifiedName `json:"name" protobuf:"bytes,1,name=name"` + + // Expression is a CEL expression evaluated against each candidate device. + // The expression must evaluate to a primitive scalar (string, integer, + // boolean, or semver) or a list of these scalars ([]string, []int64, + // []bool, []semver) to act as a virtual grouping key. Any other return type + // is an error and causes CEL evaluation for the device to fail. + // + // The expression's input is an object named "device", which carries the + // same properties as in a CELDeviceSelector. + // + // When pod scheduling encounters CEL runtime errors (such as looking + // up an attribute that isn't defined) for some devices, it will abort + // allocation and fail scheduling for the Pod. Surfacing evaluation + // errors immediately prevents silent topology matching failures that are + // extremely hard to detect. A robust expression should, for example, check + // for the existence of attributes before referencing them to avoid + // runtime evaluation errors. + // + // The expression gets evaluated after a device has passed the other + // selector expressions for the request in which this expression is used. + // This allows writing expressions that are tailored towards the specific + // devices being requested (for example, by assuming the device is from a + // certain vendor and skipping those checks). + // + // The length of the expression must be smaller or equal to 10 Ki. The + // cost of evaluating it is also limited based on the estimated number + // of logical steps; the combined cost of all derived attributes in a + // claim is capped by a shared CEL cost budget. + // + // +required + // +k8s:required + Expression string `json:"expression" protobuf:"bytes,2,name=expression"` +} + // CELSelectorExpressionMaxCost specifies the cost limit for a single CEL selector // evaluation. // @@ -1398,6 +1833,25 @@ type CELDeviceSelector struct { // However, this depends on how fast the machine is. const CELSelectorExpressionMaxCost = 1000000 +// DeviceClaimDerivedAttributeCELMaxCost is the maximum combined execution cost +// allowed for all derived attribute CEL expressions within a single DeviceClaim. +// +// During validation, the API server computes the estimated execution cost of each +// derived attribute expression. The sum of these costs across all requests in the +// claim must not exceed this budget. If it does, the claim is rejected. +// +// To stay within the budget, consumers should simplify their CEL expressions, +// avoid computationally expensive operations like deep nesting or iterations +// (such as `.all()` or `.exists()`), and minimize the total number of derived +// attributes in a claim. +// +// This shared budget prevents excessively complex claims from degrading the +// performance of the kube-scheduler. The limit is set to 1,000,000 instruction +// executions (roughly 0.1 seconds of evaluation time), tying the collective +// cost of all derived attributes to the maximum cost allowed for a single +// CEL selector. +const DeviceClaimDerivedAttributeCELMaxCost = 1000000 + // CELSelectorExpressionMaxLength is the maximum length of a CEL selector expression string. const CELSelectorExpressionMaxLength = 10 * 1024 @@ -1415,10 +1869,10 @@ type DeviceConstraint struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Requests []string `json:"requests,omitempty" protobuf:"bytes,1,opt,name=requests"` // MatchAttribute requires that all devices in question have this @@ -1441,8 +1895,8 @@ type DeviceConstraint struct { // // +optional // +oneOf=ConstraintType - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-fully-qualified-name + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-fully-qualified-name MatchAttribute *FullyQualifiedName `json:"matchAttribute,omitempty" protobuf:"bytes,2,opt,name=matchAttribute"` // Potential future extension, not part of the current design: @@ -1474,6 +1928,8 @@ type DeviceConstraint struct { // +optional // +oneOf=ConstraintType // +featureGate=DRAConsumableCapacity + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-fully-qualified-name DistinctAttribute *FullyQualifiedName `json:"distinctAttribute,omitempty" protobuf:"bytes,3,opt,name=distinctAttribute"` } @@ -1488,13 +1944,13 @@ type DeviceClaimConfiguration struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Requests []string `json:"requests,omitempty" protobuf:"bytes,1,opt,name=requests"` - DeviceConfiguration `json:",inline" protobuf:"bytes,2,name=deviceConfiguration"` + DeviceConfiguration `json:"" protobuf:"bytes,2,name=deviceConfiguration"` } // DeviceConfiguration must have exactly one field set. It gets embedded @@ -1505,7 +1961,7 @@ type DeviceConfiguration struct { // // +optional // +oneOf=ConfigurationType - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Opaque *OpaqueDeviceConfiguration `json:"opaque,omitempty" protobuf:"bytes,1,opt,name=opaque"` } @@ -1522,9 +1978,9 @@ type OpaqueDeviceConfiguration struct { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless - // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name-caseless + // +k8s:beta(since: "1.37")=+k8s:maxLength=63 Driver string `json:"driver" protobuf:"bytes,1,name=driver"` // Parameters can contain arbitrary data. It is the responsibility of @@ -1550,8 +2006,8 @@ type DeviceToleration struct { // Must be a label name. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-label-key + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-label-key Key string `json:"key,omitempty" protobuf:"bytes,1,opt,name=key"` // Operator represents a key's relationship to the value. @@ -1561,7 +2017,7 @@ type DeviceToleration struct { // // +optional // +default="Equal" - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Operator DeviceTolerationOperator `json:"operator,omitempty" protobuf:"bytes,2,opt,name=operator,casttype=DeviceTolerationOperator"` // Value is the taint value the toleration matches to. @@ -1575,7 +2031,7 @@ type DeviceToleration struct { // When specified, allowed values are NoSchedule and NoExecute. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Effect DeviceTaintEffect `json:"effect,omitempty" protobuf:"bytes,4,opt,name=effect,casttype=DeviceTaintEffect"` // TolerationSeconds represents the period of time the toleration (which must be @@ -1592,7 +2048,7 @@ type DeviceToleration struct { // A toleration operator is the set of operators that can be used in a toleration. // // +enum -// +k8s:alpha(since: "1.36")=+k8s:enum +// +k8s:beta(since: "1.37")=+k8s:enum type DeviceTolerationOperator string const ( @@ -1606,8 +2062,8 @@ type ResourceClaimStatus struct { // Allocation is set once the claim has been allocated successfully. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:update=NoModify + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:update=NoModify Allocation *AllocationResult `json:"allocation,omitempty" protobuf:"bytes,1,opt,name=allocation"` // ReservedFor indicates which entities are currently allowed to use @@ -1635,10 +2091,10 @@ type ResourceClaimStatus struct { // +listMapKey=uid // +patchStrategy=merge // +patchMergeKey=uid - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:listType=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=uid - // +k8s:alpha(since: "1.36")=+k8s:maxItems=256 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:listType=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=uid + // +k8s:beta(since: "1.37")=+k8s:maxItems=256 ReservedFor []ResourceClaimConsumerReference `json:"reservedFor,omitempty" protobuf:"bytes,2,opt,name=reservedFor" patchStrategy:"merge" patchMergeKey:"uid"` // DeallocationRequested is tombstoned since Kubernetes 1.32 where @@ -1651,18 +2107,18 @@ type ResourceClaimStatus struct { // information. Entries are owned by their respective drivers. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +listType=map // +listMapKey=driver // +listMapKey=device // +listMapKey=pool // +listMapKey=shareID // +featureGate=DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:listType=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=driver - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=device - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=pool - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=shareID + // +k8s:beta(since: "1.37")=+k8s:listType=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=driver + // +k8s:beta(since: "1.37")=+k8s:listMapKey=device + // +k8s:beta(since: "1.37")=+k8s:listMapKey=pool + // +k8s:beta(since: "1.37")=+k8s:listMapKey=shareID Devices []AllocatedDeviceStatus `json:"devices,omitempty" protobuf:"bytes,4,opt,name=devices"` } @@ -1725,8 +2181,8 @@ type DeviceAllocationResult struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Results []DeviceRequestAllocationResult `json:"results,omitempty" protobuf:"bytes,1,opt,name=results"` // This field is a combination of all the claim and class configuration parameters. @@ -1739,8 +2195,8 @@ type DeviceAllocationResult struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=64 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=64 Config []DeviceAllocationConfiguration `json:"config,omitempty" protobuf:"bytes,2,opt,name=config"` } @@ -1769,9 +2225,9 @@ type DeviceRequestAllocationResult struct { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 + // +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name-caseless + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:maxLength=63 Driver string `json:"driver" protobuf:"bytes,2,name=driver"` // This name together with the driver name and the device name field @@ -1781,8 +2237,8 @@ type DeviceRequestAllocationResult struct { // DNS sub-domains separated by slashes. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-pool-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-pool-name Pool string `json:"pool" protobuf:"bytes,3,name=pool"` // Device references one device instance via its name in the driver's @@ -1813,7 +2269,7 @@ type DeviceRequestAllocationResult struct { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Tolerations []DeviceToleration `json:"tolerations,omitempty" protobuf:"bytes,6,opt,name=tolerations"` // BindingConditions contains a copy of the BindingConditions @@ -1825,8 +2281,8 @@ type DeviceRequestAllocationResult struct { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 BindingConditions []string `json:"bindingConditions,omitempty" protobuf:"bytes,7,rep,name=bindingConditions"` // BindingFailureConditions contains a copy of the BindingFailureConditions @@ -1838,8 +2294,8 @@ type DeviceRequestAllocationResult struct { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 BindingFailureConditions []string `json:"bindingFailureConditions,omitempty" protobuf:"bytes,8,rep,name=bindingFailureConditions"` // ShareID uniquely identifies an individual allocation share of the device, @@ -1849,8 +2305,8 @@ type DeviceRequestAllocationResult struct { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-uuid ShareID *types.UID `json:"shareID,omitempty" protobuf:"bytes,9,opt,name=shareID"` // ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. @@ -1865,6 +2321,19 @@ type DeviceRequestAllocationResult struct { // +optional // +featureGate=DRAConsumableCapacity ConsumedCapacity map[QualifiedName]resource.Quantity `json:"consumedCapacity,omitempty" protobuf:"bytes,10,rep,name=consumedCapacity"` + + // SkipNodeOperations lists node-local resource operations (gRPC calls) + // that will be skipped for this allocated device when determining whether + // operations are necessary on the node. If all allocated devices for a driver in + // a claim skip an operation, that gRPC call will be skipped. It is a copy of + // the ResourceSlice.spec.skipNodeOperations value at the time when the device was allocated. + // + // +optional + // +listType=set + // +k8s:listType=set + // +featureGate=DRAOptionalNodeOperations + // +k8s:optional + SkipNodeOperations []SkipNodeOperation `json:"skipNodeOperations,omitempty" protobuf:"bytes,11,rep,name=skipNodeOperations,casttype=SkipNodeOperation"` } // DeviceAllocationConfiguration gets embedded in an AllocationResult. @@ -1874,7 +2343,7 @@ type DeviceAllocationConfiguration struct { // or from a claim. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Source AllocationConfigSource `json:"source" protobuf:"bytes,1,name=source"` // Requests lists the names of requests where the configuration applies. @@ -1886,17 +2355,17 @@ type DeviceAllocationConfiguration struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Requests []string `json:"requests,omitempty" protobuf:"bytes,2,opt,name=requests"` - DeviceConfiguration `json:",inline" protobuf:"bytes,3,name=deviceConfiguration"` + DeviceConfiguration `json:"" protobuf:"bytes,3,name=deviceConfiguration"` } // +enum -// +k8s:alpha(since: "1.36")=+k8s:enum +// +k8s:beta(since: "1.37")=+k8s:enum type AllocationConfigSource string // Valid [DeviceAllocationConfiguration.Source] values. @@ -1910,7 +2379,7 @@ const ( // ResourceClaimList is a collection of claims. type ResourceClaimList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -1929,11 +2398,11 @@ type ResourceClaimList struct { // the device requests of a claim to apply these presets. // Cluster scoped. type DeviceClass struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata // +optional - // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:format=k8s-long-name + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:format=k8s-long-name metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec defines what can be allocated and how to configure it. @@ -1944,6 +2413,7 @@ type DeviceClass struct { // the time of allocation. // // Changing the spec automatically increments the metadata.generation number. + // +optional Spec DeviceClassSpec `json:"spec" protobuf:"bytes,2,name=spec"` } @@ -1954,8 +2424,8 @@ type DeviceClassSpec struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,1,opt,name=selectors"` // Config defines configuration parameters that apply to each device that is claimed via this class. @@ -1966,8 +2436,8 @@ type DeviceClassSpec struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Config []DeviceClassConfiguration `json:"config,omitempty" protobuf:"bytes,2,opt,name=config"` // SuitableNodes is tombstoned since Kubernetes 1.32 where @@ -1984,17 +2454,16 @@ type DeviceClassSpec struct { // If two classes are created at the same time, then the name of the class // lexicographically sorted first is picked. // - // This is a beta field. // +optional // +featureGate=DRAExtendedResource - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-extended-resource-name + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-extended-resource-name ExtendedResourceName *string `json:"extendedResourceName,omitempty" protobuf:"bytes,4,opt,name=extendedResourceName"` } // DeviceClassConfiguration is used in DeviceClass. type DeviceClassConfiguration struct { - DeviceConfiguration `json:",inline" protobuf:"bytes,1,opt,name=deviceConfiguration"` + DeviceConfiguration `json:"" protobuf:"bytes,1,opt,name=deviceConfiguration"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object @@ -2002,7 +2471,7 @@ type DeviceClassConfiguration struct { // DeviceClassList is a collection of classes. type DeviceClassList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -2017,7 +2486,7 @@ type DeviceClassList struct { // ResourceClaimTemplate is used to produce ResourceClaim objects. type ResourceClaimTemplate struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -2027,6 +2496,7 @@ type ResourceClaimTemplate struct { // This field is immutable. A ResourceClaim will get created by the // control plane for a Pod when needed and then not get updated // anymore. + // +optional Spec ResourceClaimTemplateSpec `json:"spec" protobuf:"bytes,2,name=spec"` } @@ -2036,11 +2506,13 @@ type ResourceClaimTemplateSpec struct { // when creating it. No other fields are allowed and will be rejected during // validation. // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec for the ResourceClaim. The entire content is copied unchanged // into the ResourceClaim that gets created from this template. The // same fields as in a ResourceClaim are also valid here. + // +optional Spec ResourceClaimSpec `json:"spec" protobuf:"bytes,2,name=spec"` } @@ -2049,7 +2521,7 @@ type ResourceClaimTemplateSpec struct { // ResourceClaimTemplateList is a collection of claim templates. type ResourceClaimTemplateList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -2111,8 +2583,8 @@ type AllocatedDeviceStatus struct { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-uuid ShareID *string `json:"shareID,omitempty" protobuf:"bytes,7,opt,name=shareID"` // Conditions contains the latest observation of the device's state. @@ -2124,6 +2596,9 @@ type AllocatedDeviceStatus struct { // +optional // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type Conditions []metav1.Condition `json:"conditions" protobuf:"bytes,4,opt,name=conditions"` // Data contains arbitrary driver-specific data. @@ -2136,7 +2611,7 @@ type AllocatedDeviceStatus struct { // NetworkData contains network-related information specific to the device. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional NetworkData *NetworkDeviceData `json:"networkData,omitempty" protobuf:"bytes,6,opt,name=networkData"` } @@ -2151,8 +2626,8 @@ type NetworkDeviceData struct { // Must not be longer than 256 bytes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxBytes=256 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxBytes=256 InterfaceName string `json:"interfaceName,omitempty" protobuf:"bytes,1,opt,name=interfaceName"` // IPs lists the network addresses assigned to the device's network interface. @@ -2163,10 +2638,10 @@ type NetworkDeviceData struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=16 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=16 IPs []string `json:"ips,omitempty" protobuf:"bytes,2,opt,name=ips"` // HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface. @@ -2174,7 +2649,7 @@ type NetworkDeviceData struct { // Must not be longer than 128 bytes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxBytes=128 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxBytes=128 HardwareAddress string `json:"hardwareAddress,omitempty" protobuf:"bytes,3,opt,name=hardwareAddress"` } diff --git a/vendor/k8s.io/api/resource/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/resource/v1/types_swagger_doc_generated.go index 51915d3e20..2f7c1864d1 100644 --- a/vendor/k8s.io/api/resource/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/resource/v1/types_swagger_doc_generated.go @@ -55,7 +55,7 @@ func (AllocationResult) SwaggerDoc() map[string]string { var map_CELDeviceSelector = map[string]string{ "": "CELDeviceSelector contains a CEL expression for selecting a device.", - "expression": "Expression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort.\n\nThe expression's input is an object named \"device\", which carries the following properties:\n - driver (string): the name of the driver which defines this device.\n - attributes (map[string]object): the device's attributes, grouped by prefix\n (e.g. device.attributes[\"dra.example.com\"] evaluates to an object with all\n of the attributes which were prefixed by \"dra.example.com\".\n - capacity (map[string]object): the device's capacities, grouped by prefix.\n - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device\n (v1.34+ with the DRAConsumableCapacity feature enabled).\n\nExample: Consider a device with driver=\"dra.example.com\", which exposes two attributes named \"model\" and \"ext.example.com/family\" and which exposes one capacity named \"modules\". This input to this expression would have the following fields:\n\n device.driver\n device.attributes[\"dra.example.com\"].model\n device.attributes[\"ext.example.com\"].family\n device.capacity[\"dra.example.com\"].modules\n\nThe device.driver field can be used to check for a specific driver, either as a high-level precondition (i.e. you only want to consider devices from this driver) or as part of a multi-clause expression that is meant to consider devices from different drivers.\n\nThe value type of each attribute is defined by the device definition, and users who write these expressions must consult the documentation for their specific drivers. The value type of each capacity is Quantity.\n\nIf an unknown prefix is used as a lookup in either device.attributes or device.capacity, an empty map will be returned. Any reference to an unknown field will cause an evaluation error and allocation to abort.\n\nA robust expression should check for the existence of attributes before referencing them.\n\nFor ease of use, the cel.bind() function is enabled, and can be used to simplify expressions that access multiple attributes with the same domain. For example:\n\n cel.bind(dra, device.attributes[\"dra.example.com\"], dra.someBool && dra.anotherBool)\n\nWhen the DRAListTypeAttributes feature gate is enabled, the includes() helper is available and it can work for both scalar and list-type attributes. It was introduced to support smooth migration from scalar attributes to list-type attributes while keeping CEL expressions simple. For example:\n\n device.attributes[\"dra.example.com\"].models.includes(\"some-model\")\n\nThe length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps.", + "expression": "Expression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort.\n\nThe expression's input is an object named \"device\", which carries the following properties:\n - driver (string): the name of the driver which defines this device.\n - attributes (map[string]object): the device's attributes, grouped by prefix\n (e.g. device.attributes[\"dra.example.com\"] evaluates to an object with all\n of the attributes which were prefixed by \"dra.example.com\").\n - capacity (map[string]object): the device's capacities, grouped by prefix.\n - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device\n (v1.34+ with the DRAConsumableCapacity feature enabled).\n\nExample: Consider a device with driver=\"dra.example.com\", which exposes two attributes named \"model\" and \"ext.example.com/family\" and which exposes one capacity named \"modules\". This input to this expression would have the following fields:\n\n device.driver\n device.attributes[\"dra.example.com\"].model\n device.attributes[\"ext.example.com\"].family\n device.capacity[\"dra.example.com\"].modules\n\nThe device.driver field can be used to check for a specific driver, either as a high-level precondition (i.e. you only want to consider devices from this driver) or as part of a multi-clause expression that is meant to consider devices from different drivers.\n\nThe value type of each attribute is defined by the device definition, and users who write these expressions must consult the documentation for their specific drivers. The value type of each capacity is Quantity.\n\nIf an unknown prefix is used as a lookup in either device.attributes or device.capacity, an empty map will be returned. Any reference to an unknown field will cause an evaluation error and allocation to abort.\n\nA robust expression should check for the existence of attributes before referencing them.\n\nCommon errors: - \"no such key\": Use optional chaining (.? followed by orValue())\n or guarding the check with has() for optional fields.\n See CEL Optional Types for details:\n https://pkg.go.dev/github.com/google/cel-go@v0.17.4/cel#OptionalTypes\n\nFor more CEL expression syntax and examples, see: https://kubernetes.io/docs/reference/using-api/cel/\n\nFor ease of use, the cel.bind() function is enabled, and can be used to simplify expressions that access multiple attributes with the same domain. For example:\n\n cel.bind(dra, device.attributes[\"dra.example.com\"], dra.someBool && dra.anotherBool)\n\nWhen the DRAListTypeAttributes feature gate is enabled, the includes() helper is available and it can work for both scalar and list-type attributes. It was introduced to support smooth migration from scalar attributes to list-type attributes while keeping CEL expressions simple. For example:\n\n device.attributes[\"dra.example.com\"].models.includes(\"some-model\")\n\nThe length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps.", } func (CELDeviceSelector) SwaggerDoc() map[string]string { @@ -74,7 +74,7 @@ func (CapacityRequestPolicy) SwaggerDoc() map[string]string { } var map_CapacityRequestPolicyRange = map[string]string{ - "": "CapacityRequestPolicyRange defines a valid range for consumable capacity values.\n\n - If the requested amount is less than Min, it is rounded up to the Min value.\n - If Step is set and the requested amount is between Min and Max but not aligned with Step,\n it will be rounded up to the next value equal to Min + (n * Step).\n - If Step is not set, the requested amount is used as-is if it falls within the range Min to Max (if set).\n - If the requested or rounded amount exceeds Max (if set), the request does not satisfy the policy,\n and the device cannot be allocated.", + "": "CapacityRequestPolicyRange defines a valid range for consumable capacity values.\n\nIf the DRAFractionalCapacityRange feature gate is enabled and at least one of Min, Max, or Step is a fractional quantity (i.e. its value is not an integer), milli-unit arithmetic is used instead, supporting values with up to 3 decimal places (e.g. 100m = 0.1). The largest supported value then is 1000 times smaller compared to using 64-bit integers. Otherwise, all comparisons use 64-bit integer arithmetic via resource.Quantity.Value().\n\n - If the requested amount is less than Min, it is rounded up to the Min value.\n - If Step is set and the requested amount is between Min and Max but not aligned with Step,\n it will be rounded up to the next value equal to Min + (n * Step).\n - If Step is not set, the requested amount is used as-is if it falls within the range Min to Max (if set).\n - If the requested or rounded amount exceeds Max (if set), the request does not satisfy the policy,\n and the device cannot be allocated.", "min": "Min specifies the minimum capacity allowed for a consumption request.\n\nMin must be greater than or equal to zero, and less than or equal to the capacity value. requestPolicy.default must be more than or equal to the minimum.", "max": "Max defines the upper limit for capacity that can be requested.\n\nMax must be less than or equal to the capacity value. Min and requestPolicy.default must be less than or equal to the maximum.", "step": "Step defines the step size between valid capacity amounts within the range.\n\nMax (if set) and requestPolicy.default must be a multiple of Step. Min + Step must be less than or equal to the capacity value.", @@ -113,20 +113,20 @@ func (CounterSet) SwaggerDoc() map[string]string { } var map_Device = map[string]string{ - "": "Device represents one individual hardware instance that can be selected based on its attributes. Besides the name, exactly one field must be set.", - "name": "Name is unique identifier among all devices managed by the driver in the pool. It must be a DNS label.", - "attributes": "Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", - "capacity": "Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", - "consumesCounters": "ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets.\n\nThere can only be a single entry per counterSet.\n\nThe maximum number of device counter consumptions per device is 2.", - "nodeName": "NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", - "nodeSelector": "NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", - "allNodes": "AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", - "taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", - "bindsToNode": "BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "bindingConditions": "BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod.\n\nThe maximum number of binding conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "bindingFailureConditions": "BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is set to \"True\", a binding failure occurred.\n\nThe maximum number of binding failure conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "allowMultipleAllocations": "AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.\n\nIf AllowMultipleAllocations is set to true, the device can be allocated more than once, and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.", - "nodeAllocatableResourceMappings": "NodeAllocatableResourceMappings defines the mapping of node resources that are managed by the DRA driver exposing this device. This includes resources currently reported in v1.Node `status.allocatable` that are not extended resources (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). Examples include \"cpu\", \"memory\", \"ephemeral-storage\", and hugepages. In addition to standard requests made through the Pod `spec`, these resources can also be requested through claims and allocated by the DRA driver. For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory dependencies of an accelerator device. The keys of this map are the node-allocatable resource names (e.g., \"cpu\", \"memory\"). Extended resource names are not permitted as keys.", + "": "Device represents one individual hardware instance that can be selected based on its attributes. Besides the name, exactly one field must be set.", + "name": "Name is unique identifier among all devices managed by the driver in the pool. It must be a DNS label.", + "attributes": "Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", + "capacity": "Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", + "consumesCounters": "ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets.\n\nThere can only be a single entry per counterSet.\n\nThe maximum number of device counter consumptions per device is 2.", + "nodeName": "NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", + "nodeSelector": "NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", + "allNodes": "AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", + "taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", + "bindsToNode": "BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "bindingConditions": "BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod.\n\nThe maximum number of binding conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "bindingFailureConditions": "BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is set to \"True\", a binding failure occurred.\n\nThe maximum number of binding failure conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "allowMultipleAllocations": "AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.\n\nIf AllowMultipleAllocations is set to true, the device can be allocated more than once, and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.", + "nodeAllocatableResources": "NodeAllocatableResources defines the mapping of node resources that are managed by the DRA driver exposing this device. This includes resources currently reported in v1.Node `status.allocatable` that are not extended resources (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). Examples include \"cpu\", \"memory\", \"ephemeral-storage\", and hugepages. In addition to standard requests made through the Pod `spec`, these resources can also be requested through claims and allocated by the DRA driver. For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory dependencies of an accelerator device. The keys of this map are the node-allocatable resource names (e.g., \"cpu\", \"memory\"). Extended resource names are not permitted as keys.", } func (Device) SwaggerDoc() map[string]string { @@ -231,7 +231,7 @@ var map_DeviceClassSpec = map[string]string{ "": "DeviceClassSpec is used in a [DeviceClass] to define what can be allocated and how to configure it.", "selectors": "Each selector must be satisfied by a device which is claimed via this class.", "config": "Config defines configuration parameters that apply to each device that is claimed via this class. Some classses may potentially be satisfied by multiple drivers, so each instance of a vendor configuration applies to exactly one driver.\n\nThey are passed to the driver, but are not considered while allocating the claim.", - "extendedResourceName": "ExtendedResourceName is the extended resource name for the devices of this class. The devices of this class can be used to satisfy a pod's extended resource requests. It has the same format as the name of a pod's extended resource. It should be unique among all the device classes in a cluster. If two device classes have the same name, then the class created later is picked to satisfy a pod's extended resource requests. If two classes are created at the same time, then the name of the class lexicographically sorted first is picked.\n\nThis is a beta field.", + "extendedResourceName": "ExtendedResourceName is the extended resource name for the devices of this class. The devices of this class can be used to satisfy a pod's extended resource requests. It has the same format as the name of a pod's extended resource. It should be unique among all the device classes in a cluster. If two device classes have the same name, then the class created later is picked to satisfy a pod's extended resource requests. If two classes are created at the same time, then the name of the class lexicographically sorted first is picked.", } func (DeviceClassSpec) SwaggerDoc() map[string]string { @@ -259,15 +259,26 @@ func (DeviceConstraint) SwaggerDoc() map[string]string { } var map_DeviceCounterConsumption = map[string]string{ - "": "DeviceCounterConsumption defines a set of counters that a device will consume from a CounterSet.", - "counterSet": "CounterSet is the name of the set from which the counters defined will be consumed.", - "counters": "Counters defines the counters that will be consumed by the device.\n\nThe maximum number of counters is 32.", + "": "DeviceCounterConsumption defines a set of counters that a device will consume from a CounterSet.", + "counterSet": "CounterSet is the name of the set from which the counters defined will be consumed.", + "counters": "Counters defines the counters that will be consumed by the device.\n\nThe maximum number of counters is 32.", + "compatibilityGroups": "CompatibilityGroups is a list of opaque group names for this counter set consumption.\n\nDevices that consume counters from the same counter set may only be allocated at the same time (\"co-allocated\") if they all share at least one common group: the intersection of the CompatibilityGroups of all co-allocated devices on that counter set must be non-empty. Devices that consume from different counter sets are never compared via this field.\n\nAn unset field, an explicit nil, and an empty list are equivalent and mean \"no groups\": such a device is only co-allocatable with sibling devices on the same counter set that also have no groups, and is never co-allocatable with a device that declares one or more groups.\n\nGroup names are opaque and meaningful only within the publishing driver's pool.\n\nThe maximum number of groups is 2, and the names must be unique.", } func (DeviceCounterConsumption) SwaggerDoc() map[string]string { return map_DeviceCounterConsumption } +var map_DeviceDerivedAttribute = map[string]string{ + "": "DeviceDerivedAttribute defines a derived attribute computed via CEL.", + "name": "Name is the identifier for this derived attribute, used in constraints.\n\nIt must be a DNS subdomain followed by a slash (\"/\") followed by a C identifier (e.g. \"example.com/numaNode\" or \"derived/numaNode\").\n\nIf the chosen name matches an existing physical attribute from a driver, the derived attribute's expression will shadow the physical attribute, and its evaluated value will be used in constraints instead. When the goal is to define a derived attribute that is only used within the ResourceClaim and not meant to shadow an existing attribute, use a domain prefix that no DRA driver should be using (e.g. \"derived/myAttribute\").\n\nIt is not valid to define a derived attribute that isn't used in at least one constraint.", + "expression": "Expression is a CEL expression evaluated against each candidate device. The expression must evaluate to a primitive scalar (string, integer, boolean, or semver) or a list of these scalars ([]string, []int64, []bool, []semver) to act as a virtual grouping key. Any other return type is an error and causes CEL evaluation for the device to fail.\n\nThe expression's input is an object named \"device\", which carries the same properties as in a CELDeviceSelector.\n\nWhen pod scheduling encounters CEL runtime errors (such as looking up an attribute that isn't defined) for some devices, it will abort allocation and fail scheduling for the Pod. Surfacing evaluation errors immediately prevents silent topology matching failures that are extremely hard to detect. A robust expression should, for example, check for the existence of attributes before referencing them to avoid runtime evaluation errors.\n\nThe expression gets evaluated after a device has passed the other selector expressions for the request in which this expression is used. This allows writing expressions that are tailored towards the specific devices being requested (for example, by assuming the device is from a certain vendor and skipping those checks).\n\nThe length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps; the combined cost of all derived attributes in a claim is capped by a shared CEL cost budget.", +} + +func (DeviceDerivedAttribute) SwaggerDoc() map[string]string { + return map_DeviceDerivedAttribute +} + var map_DeviceRequest = map[string]string{ "": "DeviceRequest is a request for devices required for a claim. This is typically a request for a single resource like a device, but can also ask for several identical devices. With FirstAvailable it is also possible to provide a prioritized list of requests.", "name": "Name can be used to reference this request in a pod.spec.containers[].resources.claims entry and in a constraint of the claim.\n\nReferences using the name in the DeviceRequest will uniquely identify a request when the Exactly field is set. When the FirstAvailable field is set, a reference to the name of the DeviceRequest will match whatever subrequest is chosen by the scheduler.\n\nMust be a DNS label.", @@ -291,6 +302,7 @@ var map_DeviceRequestAllocationResult = map[string]string{ "bindingFailureConditions": "BindingFailureConditions contains a copy of the BindingFailureConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", "shareID": "ShareID uniquely identifies an individual allocation share of the device, used when the device supports multiple simultaneous allocations. It serves as an additional map key to differentiate concurrent shares of the same device.", "consumedCapacity": "ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. The consumed amount may differ from the requested amount: it is rounded up to the nearest valid value based on the device’s requestPolicy if applicable (i.e., may not be less than the requested amount).\n\nThe total consumed capacity for each device must not exceed the DeviceCapacity's Value.\n\nThis field is populated only for devices that allow multiple allocations. All capacity entries are included, even if the consumed amount is zero.", + "skipNodeOperations": "SkipNodeOperations lists node-local resource operations (gRPC calls) that will be skipped for this allocated device when determining whether operations are necessary on the node. If all allocated devices for a driver in a claim skip an operation, that gRPC call will be skipped. It is a copy of the ResourceSlice.spec.skipNodeOperations value at the time when the device was allocated.", } func (DeviceRequestAllocationResult) SwaggerDoc() map[string]string { @@ -307,14 +319,15 @@ func (DeviceSelector) SwaggerDoc() map[string]string { } var map_DeviceSubRequest = map[string]string{ - "": "DeviceSubRequest describes a request for device provided in the claim.spec.devices.requests[].firstAvailable array. Each is typically a request for a single resource like a device, but can also ask for several identical devices.\n\nDeviceSubRequest is similar to ExactDeviceRequest, but doesn't expose the AdminAccess field as that one is only supported when requesting a specific device.", - "name": "Name can be used to reference this subrequest in the list of constraints or the list of configurations for the claim. References must use the format
/.\n\nMust be a DNS label.", - "deviceClassName": "DeviceClassName references a specific DeviceClass, which can define additional configuration and selectors to be inherited by this subrequest.\n\nA class is required. Which classes are available depends on the cluster.\n\nAdministrators may use this to restrict which devices may get requested by only installing classes with selectors for permitted devices. If users are free to request anything without restrictions, then administrators can create an empty DeviceClass for users to reference.", - "selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this subrequest. All selectors must be satisfied for a device to be considered.", - "allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this subrequest. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This subrequest is for all of the matching devices in a pool.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other subrequests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.", - "count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.", - "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", - "capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.", + "": "DeviceSubRequest describes a request for device provided in the claim.spec.devices.requests[].firstAvailable array. Each is typically a request for a single resource like a device, but can also ask for several identical devices.\n\nDeviceSubRequest is similar to ExactDeviceRequest, but doesn't expose the AdminAccess field as that one is only supported when requesting a specific device.", + "name": "Name can be used to reference this subrequest in the list of constraints or the list of configurations for the claim. References must use the format
/.\n\nMust be a DNS label.", + "deviceClassName": "DeviceClassName references a specific DeviceClass, which can define additional configuration and selectors to be inherited by this subrequest.\n\nA class is required. Which classes are available depends on the cluster.\n\nAdministrators may use this to restrict which devices may get requested by only installing classes with selectors for permitted devices. If users are free to request anything without restrictions, then administrators can create an empty DeviceClass for users to reference.", + "selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this subrequest. All selectors must be satisfied for a device to be considered.", + "allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this subrequest. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This subrequest is for all of the matching devices in a pool.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other subrequests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.", + "count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.", + "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", + "capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.", + "derivedAttributes": "DerivedAttributes defines a set of virtual attributes computed via CEL expressions for each candidate device. These virtual attributes can be referenced in `.devices.constraints` to align and match different devices (e.g., co-allocating a GPU and a NIC on the same NUMA node) even if their drivers publish different attributes. Derived attributes are not available via `device.attributes` in the CEL environment when evaluating selector expressions.\n\nDerived attributes allow you to extract, transform, or normalize topology information (such as extracting a NUMA index from a complex topology string or renaming a vendor-specific attribute) into a common virtual attribute name at scheduling time. The scheduler then evaluates these virtual attributes exactly like static attributes when matching constraints.\n\nEvery derived attribute defined in this list must be referenced by at least one MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list.\n\nThe maximum number of derived attributes is 32.\n\nThis is an alpha field and requires enabling the DRADerivedAttributes feature gate.", } func (DeviceSubRequest) SwaggerDoc() map[string]string { @@ -333,6 +346,57 @@ func (DeviceTaint) SwaggerDoc() map[string]string { return map_DeviceTaint } +var map_DeviceTaintRule = map[string]string{ + "": "DeviceTaintRule adds one taint to all devices which match the selector. This has the same effect as if the taint was specified directly in the ResourceSlice by the DRA driver.", + "metadata": "Standard object metadata", + "spec": "Spec specifies the selector and one taint.\n\nChanging the spec automatically increments the metadata.generation number.", + "status": "Status provides information about what was requested in the spec.", +} + +func (DeviceTaintRule) SwaggerDoc() map[string]string { + return map_DeviceTaintRule +} + +var map_DeviceTaintRuleList = map[string]string{ + "": "DeviceTaintRuleList is a collection of DeviceTaintRules.", + "metadata": "Standard list metadata", + "items": "Items is the list of DeviceTaintRules.", +} + +func (DeviceTaintRuleList) SwaggerDoc() map[string]string { + return map_DeviceTaintRuleList +} + +var map_DeviceTaintRuleSpec = map[string]string{ + "": "DeviceTaintRuleSpec specifies the selector and one taint.", + "deviceSelector": "DeviceSelector defines which device(s) the taint is applied to. All selector criteria must be satisfied for a device to match. The empty selector matches all devices. Without a selector, no devices are matches.", + "taint": "The taint that gets applied to matching devices.", +} + +func (DeviceTaintRuleSpec) SwaggerDoc() map[string]string { + return map_DeviceTaintRuleSpec +} + +var map_DeviceTaintRuleStatus = map[string]string{ + "": "DeviceTaintRuleStatus provides information about an on-going pod eviction.", + "conditions": "Conditions provide information about the state of the DeviceTaintRule and the cluster at some point in time, in a machine-readable and human-readable format.\n\nThe following condition is currently defined as part of this API, more may get added: - Type: EvictionInProgress - Status: True if there are currently pods which need to be evicted, False otherwise\n (includes the effects which don't cause eviction).\n- Reason: not specified, may change - Message: includes information about number of pending pods and already evicted pods\n in a human-readable format, updated periodically, may change\n\nFor `effect: None`, the condition above gets set once for each change to the spec, with the message containing information about what would happen if the effect was `NoExecute`. This feedback can be used to decide whether changing the effect to `NoExecute` will work as intended. It only gets set once to avoid having to constantly update the status.\n\nMust have 8 or fewer entries.", +} + +func (DeviceTaintRuleStatus) SwaggerDoc() map[string]string { + return map_DeviceTaintRuleStatus +} + +var map_DeviceTaintSelector = map[string]string{ + "": "DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to. The empty selector matches all devices. Without a selector, no devices are matched.", + "driver": "If driver is set, only devices from that driver are selected. This fields corresponds to slice.spec.driver.", + "pool": "If pool is set, only devices in that pool are selected.\n\nAlso setting the driver name may be useful to avoid ambiguity when different drivers use the same pool name, but this is not required because selecting pools from different drivers may also be useful, for example when drivers with node-local devices use the node name as their pool name.", + "device": "If device is set, only devices with that name are selected. This field corresponds to slice.spec.devices[].name.\n\nSetting also driver and pool may be required to avoid ambiguity, but is not required.", +} + +func (DeviceTaintSelector) SwaggerDoc() map[string]string { + return map_DeviceTaintSelector +} + var map_DeviceToleration = map[string]string{ "": "The ResourceClaim this DeviceToleration is attached to tolerates any taint that matches the triple using the matching operator .", "key": "Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys. Must be a label name.", @@ -347,14 +411,15 @@ func (DeviceToleration) SwaggerDoc() map[string]string { } var map_ExactDeviceRequest = map[string]string{ - "": "ExactDeviceRequest is a request for one or more identical devices.", - "deviceClassName": "DeviceClassName references a specific DeviceClass, which can define additional configuration and selectors to be inherited by this request.\n\nA DeviceClassName is required.\n\nAdministrators may use this to restrict which devices may get requested by only installing classes with selectors for permitted devices. If users are free to request anything without restrictions, then administrators can create an empty DeviceClass for users to reference.", - "selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this request. All selectors must be satisfied for a device to be considered.", - "allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this request. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This request is for all of the matching devices in a pool.\n At least one device must exist on the node for the allocation to succeed.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other requests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.", - "count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.", - "adminAccess": "AdminAccess indicates that this is a claim for administrative access to the device(s). Claims with AdminAccess are expected to be used for monitoring or other management services for a device. They ignore all ordinary claims to the device with respect to access modes and any resource allocations.\n\nAdmin access is disabled if this field is unset or set to false, otherwise it is enabled.", - "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", - "capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.", + "": "ExactDeviceRequest is a request for one or more identical devices.", + "deviceClassName": "DeviceClassName references a specific DeviceClass, which can define additional configuration and selectors to be inherited by this request.\n\nA DeviceClassName is required.\n\nAdministrators may use this to restrict which devices may get requested by only installing classes with selectors for permitted devices. If users are free to request anything without restrictions, then administrators can create an empty DeviceClass for users to reference.", + "selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this request. All selectors must be satisfied for a device to be considered.", + "allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this request. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This request is for all of the matching devices in a pool.\n At least one device must exist on the node for the allocation to succeed.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other requests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.", + "count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.", + "adminAccess": "AdminAccess indicates that this is a claim for administrative access to the device(s). Claims with AdminAccess are expected to be used for monitoring or other management services for a device. They ignore all ordinary claims to the device with respect to access modes and any resource allocations.\n\nAdmin access is disabled if this field is unset or set to false, otherwise it is enabled.", + "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", + "capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.", + "derivedAttributes": "DerivedAttributes defines a set of virtual attributes computed via CEL expressions for each candidate device. These virtual attributes can be referenced in `.devices.constraints` to align and match different devices (e.g., co-allocating a GPU and a NIC on the same NUMA node) even if their drivers publish different attributes. Derived attributes are not available via `device.attributes` in the CEL environment when evaluating selector expressions.\n\nDerived attributes allow you to extract, transform, or normalize topology information (such as extracting a NUMA index from a complex topology string or renaming a vendor-specific attribute) into a common virtual attribute name at scheduling time. The scheduler then evaluates these virtual attributes exactly like static attributes when matching constraints.\n\nEvery derived attribute defined in this list must be referenced by at least one MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list.\n\nThe maximum number of derived attributes is 32.\n\nThis is an alpha field and requires enabling the DRADerivedAttributes feature gate.", } func (ExactDeviceRequest) SwaggerDoc() map[string]string { @@ -372,14 +437,35 @@ func (NetworkDeviceData) SwaggerDoc() map[string]string { return map_NetworkDeviceData } -var map_NodeAllocatableResourceMapping = map[string]string{ - "": "NodeAllocatableResourceMapping defines the translation between the DRA device/capacity units requested to the corresponding quantity of the node allocatable resource.", - "capacityKey": "CapacityKey references a capacity name defined as a key in the `spec.devices[*].capacity` map. When this field is set, the value associated with this key in the `status.allocation.devices.results[*].consumedCapacity` map (for a specific claim allocation) determines the base quantity for the node allocatable resource. If `allocationMultiplier` is also set, it is multiplied with the base quantity. For example, if `spec.devices[*].capacity` has an entry \"dra.example.com/memory\": \"128Gi\", and this field is set to \"dra.example.com/memory\", then for a claim allocation that consumes { \"dra.example.com/memory\": \"4Gi\" } the base quantity for the node allocatable resource mapping will be \"4Gi\", and `allocationMultiplier` should be omitted or set to \"1\".", - "allocationMultiplier": "AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim.\n\t a. A DRA driver representing each CPU core as a device would have\n {ResourceName: \"cpu\", allocationMultiplier: \"2\"} in its\n `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim,\n\t\t 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity.\n b. A GPU device that needs additional node memory per GPU allocation would\n have {ResourceName: \"memory\", allocationMultiplier: \"2Gi\"}. Each allocated\n\t\t GPU device instance of this type will account for 2Gi of memory.\n\n2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed.\n\t The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`.\n For example, if a Device's capacity \"dra.example.com/cores\" is consumed,\n and each \"core\" provides 2 \"cpu\"s, the mapping would be:\n {ResourceName: \"cpu\", capacityKey: \"dra.example.com/cores\", allocationMultiplier: \"2\"}.\n If a claim consumes 8 \"dra.example.com/cores\", the CPU footprint is 8 * 2 = 16.", +var map_NodeAllocatableMapping = map[string]string{ + "": "NodeAllocatableMapping defines how a DRA allocation directly translates into a node allocatable resource quantity. The mapping can be derived from either the count of allocated devices (via deviceMultiplier) or the specific capacity consumed (via capacityKey and capacityMultiplier). These options are mutually exclusive. Kubelet adds this mapped resource quantity from claim to both requests and limits at the pod-level cgroup, and to limits at the container-level cgroup for each container referencing the claim.", + "capacityKey": "CapacityKey references a capacity name defined as a key in the `spec.devices[*].capacity` map. When this field is set, the value associated with this key in the `status.allocation.devices.results[*].consumedCapacity` map (for a specific claim allocation) determines the base quantity for the node allocatable resource. `capacityMultiplier` must also be set and is multiplied with the base quantity. For example, if `spec.devices[*].capacity` has an entry \"dra.example.com/memory\": \"128Gi\", and this field is set to \"dra.example.com/memory\", then for a claim allocation that consumes { \"dra.example.com/memory\": \"4Gi\" } the base quantity for the node allocatable resource mapping will be \"4Gi\". The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`.", + "capacityMultiplier": "CapacityMultiplier is used as a multiplier for the allocated capacity consumed. It is only valid if `capacityKey` is set. The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. For example, if a Device's capacity \"dra.example.com/cores\" is consumed, and each \"core\" provides 2 \"cpu\"s, the mapping would be: {ResourceName: \"cpu\", capacityKey: \"dra.example.com/cores\", capacityMultiplier: \"2\"}. If a claim consumes 8 \"dra.example.com/cores\", the CPU footprint is 8 * 2 = 16.", + "deviceMultiplier": "DeviceMultiplier is used as a multiplier for the allocated device count in the claim. The final node allocatable resource amount is `deviceCount` * `deviceMultiplier`. For example, a DRA driver representing each cache complex (CCX) as a device would have {ResourceName: \"cpu\", deviceMultiplier: \"8\"} in its `nodeAllocatableResources`. If 2 devices (CCX) are allocated to the claim, 2 * 8 = 16 CPUs would be considered as allocated. It is only valid when `capacityKey` and `capacityMultiplier` are not set.", +} + +func (NodeAllocatableMapping) SwaggerDoc() map[string]string { + return map_NodeAllocatableMapping +} + +var map_NodeAllocatableOverhead = map[string]string{ + "": "NodeAllocatableOverhead defines auxiliary resource overheads incurred when allocating a device. Overheads can be specified as a fixed cost per pod referencing the claim, a variable cost per container reference, or both. Kubelet accounts for this overhead by adding it to both the pod-level and container-level cgroups of referencing containers.", + "perPod": "PerPod is overhead applied once per pod referencing the claim on this node. This is a flat overhead incurred for every pod referencing the claim.", + "perContainer": "PerContainer is applied per container reference to the claim. This models overhead scaling linearly with the number of containers actively using the device. When both PerPod and PerContainer are specified, the total overhead allocated for each pod referencing the claim is computed as: Quantity = PerPod + (PerContainer * NumReferences) Kubelet accounts for this overhead in cgroups: - Pod-level cgroup (requests and limits): Kubelet adds PerPod + (PerContainer * NumReferences). - Container-level cgroup (limits only): Kubelet adds PerPod + PerContainer for each referencing container. This allows any single container to access the pod-level overhead, while the parent cgroup caps the total usage to account for PerPod exactly once.", +} + +func (NodeAllocatableOverhead) SwaggerDoc() map[string]string { + return map_NodeAllocatableOverhead +} + +var map_NodeAllocatableResource = map[string]string{ + "": "NodeAllocatableResource defines the translation between the DRA device/capacity units requested to the corresponding quantity of the node allocatable resource. At least one of Mapping or Overhead must be specified. Not specifying either is an invalid configuration.", + "mapping": "Mapping is used when the device directly models a node allocatable resource like standard CPU or memory (e.g., with a CPU DRA driver). The calculated quantity is accounted for exactly once per claim instance on the node. To prevent node cgroup isolation friction, the scheduler explicitly blocks sharing mapped device claims across multiple pods.", + "overhead": "Overhead contains fields for modeling auxiliary overhead incurred on node allocatable resources when allocating devices that are not themselves modeling a node allocatable resource (e.g., host memory overhead for GPUs). Sharing overhead-mapped claims across multiple pods is allowed. The node allocatable overhead is accounted for individually for each pod referencing the claim. Overhead is always subtracted from the node's allocatable capacity for the resource, even when mapping is specified for the same resource. Eg: If a device models memory capacity per socket as a consumable capacity pool via Mapping (with CapacityKey), any overhead specified for the same resource will be subtracted from the node's general allocatable capacity and not from the per-socket capacity pool in Mapping.", } -func (NodeAllocatableResourceMapping) SwaggerDoc() map[string]string { - return map_NodeAllocatableResourceMapping +func (NodeAllocatableResource) SwaggerDoc() map[string]string { + return map_NodeAllocatableResource } var map_OpaqueDeviceConfiguration = map[string]string{ @@ -477,7 +563,7 @@ func (ResourceClaimTemplateSpec) SwaggerDoc() map[string]string { var map_ResourcePool = map[string]string{ "": "ResourcePool describes the pool that ResourceSlices belong to.", - "name": "Name is used to identify the pool. For node-local devices, this is often the node name, but this is not required.\n\nIt must not be longer than 253 characters and must consist of one or more DNS sub-domains separated by slashes. This field is immutable.", + "name": "Name is used to identify the pool. For node-local devices, this is often the node name, but this is not required. A field selector can be used to list only ResourceSlice objects belonging to a certain pool.\n\nIt must not be longer than 253 characters and must consist of one or more DNS sub-domains separated by slashes. This field is immutable.", "generation": "Generation tracks the change in a pool over time. Whenever a driver changes something about one or more of the resources in a pool, it must change the generation in all ResourceSlices which are part of that pool. Consumers of ResourceSlices should only consider resources from the pool with the highest generation number. The generation may be reset by drivers, which should be fine for consumers, assuming that all ResourceSlices in a pool are updated to match or deleted.\n\nCombined with ResourceSliceCount, this mechanism enables consumers to detect pools which are comprised of multiple ResourceSlices and are in an incomplete state.", "resourceSliceCount": "ResourceSliceCount is the total number of ResourceSlices in the pool at this generation number. Must be greater than zero.\n\nConsumers can use this to check whether they have seen all ResourceSlices belonging to the same pool.", } @@ -516,6 +602,8 @@ var map_ResourceSliceSpec = map[string]string{ "devices": "Devices lists some or all of the devices in this pool.\n\nMust not have more than 128 entries. If any device uses taints or consumes counters the limit is 64.\n\nOnly one of Devices and SharedCounters can be set in a ResourceSlice.", "perDeviceNodeSelection": "PerDeviceNodeSelection defines whether the access from nodes to resources in the pool is set on the ResourceSlice level or on each device. If it is set to true, every device defined the ResourceSlice must specify this individually.\n\nExactly one of NodeName, NodeSelector, AllNodes, and PerDeviceNodeSelection must be set.", "sharedCounters": "SharedCounters defines a list of counter sets, each of which has a name and a list of counters available.\n\nThe names of the counter sets must be unique in the ResourcePool.\n\nOnly one of Devices and SharedCounters can be set in a ResourceSlice.\n\nThe maximum number of counter sets is 8.", + "partitionTypeAttribute": "PartitionTypeAttribute names a string device attribute (by fully qualified name, e.g. \"gpu.example.com/profile\") whose value labels each device with its partition type, such as \"Full\" or \"Half\" for a MIG-style GPU.\n\nWhen set, every partitionable device in the slice must carry the attribute and devices sharing a value must share the same ConsumesCounters cost.", + "skipNodeOperations": "SkipNodeOperations lists node-local resource operations (gRPC calls) that will be skipped for the devices in this slice when determining whether operations are necessary on the node. If all allocated devices for a driver in a claim skip an operation, that gRPC call will be skipped. Valid values are:\n\n- \"NodePrepareResources\": NodePrepareResources gRPC calls are skipped. This\n value cannot be specified unless \"NodeUnprepareResources\" is also listed\n (or \"*\" is specified).\n- \"NodeUnprepareResources\": NodeUnprepareResources gRPC calls are skipped. - \"*\": All node-local resource operations are skipped.\n\nOther values may be added in the future. The kubelet must ignore unknown values.", } func (ResourceSliceSpec) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/resource/v1/zz_generated.deepcopy.go b/vendor/k8s.io/api/resource/v1/zz_generated.deepcopy.go index 0c488a05ae..9231934844 100644 --- a/vendor/k8s.io/api/resource/v1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/resource/v1/zz_generated.deepcopy.go @@ -302,9 +302,9 @@ func (in *Device) DeepCopyInto(out *Device) { *out = new(bool) **out = **in } - if in.NodeAllocatableResourceMappings != nil { - in, out := &in.NodeAllocatableResourceMappings, &out.NodeAllocatableResourceMappings - *out = make(map[corev1.ResourceName]NodeAllocatableResourceMapping, len(*in)) + if in.NodeAllocatableResources != nil { + in, out := &in.NodeAllocatableResources, &out.NodeAllocatableResources + *out = make(map[corev1.ResourceName]NodeAllocatableResource, len(*in)) for key, val := range *in { (*out)[key] = *val.DeepCopy() } @@ -685,6 +685,11 @@ func (in *DeviceCounterConsumption) DeepCopyInto(out *DeviceCounterConsumption) (*out)[key] = *val.DeepCopy() } } + if in.CompatibilityGroups != nil { + in, out := &in.CompatibilityGroups, &out.CompatibilityGroups + *out = make([]string, len(*in)) + copy(*out, *in) + } return } @@ -698,6 +703,22 @@ func (in *DeviceCounterConsumption) DeepCopy() *DeviceCounterConsumption { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceDerivedAttribute) DeepCopyInto(out *DeviceDerivedAttribute) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceDerivedAttribute. +func (in *DeviceDerivedAttribute) DeepCopy() *DeviceDerivedAttribute { + if in == nil { + return nil + } + out := new(DeviceDerivedAttribute) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DeviceRequest) DeepCopyInto(out *DeviceRequest) { *out = *in @@ -763,6 +784,11 @@ func (in *DeviceRequestAllocationResult) DeepCopyInto(out *DeviceRequestAllocati (*out)[key] = val.DeepCopy() } } + if in.SkipNodeOperations != nil { + in, out := &in.SkipNodeOperations, &out.SkipNodeOperations + *out = make([]SkipNodeOperation, len(*in)) + copy(*out, *in) + } return } @@ -819,6 +845,11 @@ func (in *DeviceSubRequest) DeepCopyInto(out *DeviceSubRequest) { *out = new(CapacityRequirements) (*in).DeepCopyInto(*out) } + if in.DerivedAttributes != nil { + in, out := &in.DerivedAttributes, &out.DerivedAttributes + *out = make([]DeviceDerivedAttribute, len(*in)) + copy(*out, *in) + } return } @@ -852,6 +883,143 @@ func (in *DeviceTaint) DeepCopy() *DeviceTaint { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceTaintRule) DeepCopyInto(out *DeviceTaintRule) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceTaintRule. +func (in *DeviceTaintRule) DeepCopy() *DeviceTaintRule { + if in == nil { + return nil + } + out := new(DeviceTaintRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DeviceTaintRule) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceTaintRuleList) DeepCopyInto(out *DeviceTaintRuleList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DeviceTaintRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceTaintRuleList. +func (in *DeviceTaintRuleList) DeepCopy() *DeviceTaintRuleList { + if in == nil { + return nil + } + out := new(DeviceTaintRuleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DeviceTaintRuleList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceTaintRuleSpec) DeepCopyInto(out *DeviceTaintRuleSpec) { + *out = *in + if in.DeviceSelector != nil { + in, out := &in.DeviceSelector, &out.DeviceSelector + *out = new(DeviceTaintSelector) + (*in).DeepCopyInto(*out) + } + in.Taint.DeepCopyInto(&out.Taint) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceTaintRuleSpec. +func (in *DeviceTaintRuleSpec) DeepCopy() *DeviceTaintRuleSpec { + if in == nil { + return nil + } + out := new(DeviceTaintRuleSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceTaintRuleStatus) DeepCopyInto(out *DeviceTaintRuleStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceTaintRuleStatus. +func (in *DeviceTaintRuleStatus) DeepCopy() *DeviceTaintRuleStatus { + if in == nil { + return nil + } + out := new(DeviceTaintRuleStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceTaintSelector) DeepCopyInto(out *DeviceTaintSelector) { + *out = *in + if in.Driver != nil { + in, out := &in.Driver, &out.Driver + *out = new(string) + **out = **in + } + if in.Pool != nil { + in, out := &in.Pool, &out.Pool + *out = new(string) + **out = **in + } + if in.Device != nil { + in, out := &in.Device, &out.Device + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceTaintSelector. +func (in *DeviceTaintSelector) DeepCopy() *DeviceTaintSelector { + if in == nil { + return nil + } + out := new(DeviceTaintSelector) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DeviceToleration) DeepCopyInto(out *DeviceToleration) { *out = *in @@ -900,6 +1068,11 @@ func (in *ExactDeviceRequest) DeepCopyInto(out *ExactDeviceRequest) { *out = new(CapacityRequirements) (*in).DeepCopyInto(*out) } + if in.DerivedAttributes != nil { + in, out := &in.DerivedAttributes, &out.DerivedAttributes + *out = make([]DeviceDerivedAttribute, len(*in)) + copy(*out, *in) + } return } @@ -935,27 +1108,84 @@ func (in *NetworkDeviceData) DeepCopy() *NetworkDeviceData { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeAllocatableResourceMapping) DeepCopyInto(out *NodeAllocatableResourceMapping) { +func (in *NodeAllocatableMapping) DeepCopyInto(out *NodeAllocatableMapping) { *out = *in if in.CapacityKey != nil { in, out := &in.CapacityKey, &out.CapacityKey *out = new(QualifiedName) **out = **in } - if in.AllocationMultiplier != nil { - in, out := &in.AllocationMultiplier, &out.AllocationMultiplier + if in.CapacityMultiplier != nil { + in, out := &in.CapacityMultiplier, &out.CapacityMultiplier + x := (*in).DeepCopy() + *out = &x + } + if in.DeviceMultiplier != nil { + in, out := &in.DeviceMultiplier, &out.DeviceMultiplier x := (*in).DeepCopy() *out = &x } return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableResourceMapping. -func (in *NodeAllocatableResourceMapping) DeepCopy() *NodeAllocatableResourceMapping { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableMapping. +func (in *NodeAllocatableMapping) DeepCopy() *NodeAllocatableMapping { if in == nil { return nil } - out := new(NodeAllocatableResourceMapping) + out := new(NodeAllocatableMapping) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeAllocatableOverhead) DeepCopyInto(out *NodeAllocatableOverhead) { + *out = *in + if in.PerPod != nil { + in, out := &in.PerPod, &out.PerPod + x := (*in).DeepCopy() + *out = &x + } + if in.PerContainer != nil { + in, out := &in.PerContainer, &out.PerContainer + x := (*in).DeepCopy() + *out = &x + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableOverhead. +func (in *NodeAllocatableOverhead) DeepCopy() *NodeAllocatableOverhead { + if in == nil { + return nil + } + out := new(NodeAllocatableOverhead) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeAllocatableResource) DeepCopyInto(out *NodeAllocatableResource) { + *out = *in + if in.Mapping != nil { + in, out := &in.Mapping, &out.Mapping + *out = new(NodeAllocatableMapping) + (*in).DeepCopyInto(*out) + } + if in.Overhead != nil { + in, out := &in.Overhead, &out.Overhead + *out = new(NodeAllocatableOverhead) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableResource. +func (in *NodeAllocatableResource) DeepCopy() *NodeAllocatableResource { + if in == nil { + return nil + } + out := new(NodeAllocatableResource) in.DeepCopyInto(out) return out } @@ -1296,6 +1526,16 @@ func (in *ResourceSliceSpec) DeepCopyInto(out *ResourceSliceSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.PartitionTypeAttribute != nil { + in, out := &in.PartitionTypeAttribute, &out.PartitionTypeAttribute + *out = new(FullyQualifiedName) + **out = **in + } + if in.SkipNodeOperations != nil { + in, out := &in.SkipNodeOperations, &out.SkipNodeOperations + *out = make([]SkipNodeOperation, len(*in)) + copy(*out, *in) + } return } diff --git a/vendor/k8s.io/api/resource/v1/zz_generated.model_name.go b/vendor/k8s.io/api/resource/v1/zz_generated.model_name.go index f163c61ed1..aa13541c20 100644 --- a/vendor/k8s.io/api/resource/v1/zz_generated.model_name.go +++ b/vendor/k8s.io/api/resource/v1/zz_generated.model_name.go @@ -131,6 +131,11 @@ func (in DeviceCounterConsumption) OpenAPIModelName() string { return "io.k8s.api.resource.v1.DeviceCounterConsumption" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in DeviceDerivedAttribute) OpenAPIModelName() string { + return "io.k8s.api.resource.v1.DeviceDerivedAttribute" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in DeviceRequest) OpenAPIModelName() string { return "io.k8s.api.resource.v1.DeviceRequest" @@ -156,6 +161,31 @@ func (in DeviceTaint) OpenAPIModelName() string { return "io.k8s.api.resource.v1.DeviceTaint" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in DeviceTaintRule) OpenAPIModelName() string { + return "io.k8s.api.resource.v1.DeviceTaintRule" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in DeviceTaintRuleList) OpenAPIModelName() string { + return "io.k8s.api.resource.v1.DeviceTaintRuleList" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in DeviceTaintRuleSpec) OpenAPIModelName() string { + return "io.k8s.api.resource.v1.DeviceTaintRuleSpec" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in DeviceTaintRuleStatus) OpenAPIModelName() string { + return "io.k8s.api.resource.v1.DeviceTaintRuleStatus" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in DeviceTaintSelector) OpenAPIModelName() string { + return "io.k8s.api.resource.v1.DeviceTaintSelector" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in DeviceToleration) OpenAPIModelName() string { return "io.k8s.api.resource.v1.DeviceToleration" @@ -172,8 +202,18 @@ func (in NetworkDeviceData) OpenAPIModelName() string { } // OpenAPIModelName returns the OpenAPI model name for this type. -func (in NodeAllocatableResourceMapping) OpenAPIModelName() string { - return "io.k8s.api.resource.v1.NodeAllocatableResourceMapping" +func (in NodeAllocatableMapping) OpenAPIModelName() string { + return "io.k8s.api.resource.v1.NodeAllocatableMapping" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in NodeAllocatableOverhead) OpenAPIModelName() string { + return "io.k8s.api.resource.v1.NodeAllocatableOverhead" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in NodeAllocatableResource) OpenAPIModelName() string { + return "io.k8s.api.resource.v1.NodeAllocatableResource" } // OpenAPIModelName returns the OpenAPI model name for this type. diff --git a/vendor/k8s.io/api/resource/v1/zz_generated.prerelease-lifecycle.go b/vendor/k8s.io/api/resource/v1/zz_generated.prerelease-lifecycle.go index dbf5b3ccde..4c36f2715c 100644 --- a/vendor/k8s.io/api/resource/v1/zz_generated.prerelease-lifecycle.go +++ b/vendor/k8s.io/api/resource/v1/zz_generated.prerelease-lifecycle.go @@ -33,6 +33,18 @@ func (in *DeviceClassList) APILifecycleIntroduced() (major, minor int) { return 1, 34 } +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *DeviceTaintRule) APILifecycleIntroduced() (major, minor int) { + return 1, 37 +} + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *DeviceTaintRuleList) APILifecycleIntroduced() (major, minor int) { + return 1, 37 +} + // APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. func (in *ResourceClaim) APILifecycleIntroduced() (major, minor int) { diff --git a/vendor/k8s.io/api/resource/v1/zz_generated.validations.go b/vendor/k8s.io/api/resource/v1/zz_generated.validations.go new file mode 100644 index 0000000000..b771d5b92a --- /dev/null +++ b/vendor/k8s.io/api/resource/v1/zz_generated.validations.go @@ -0,0 +1,3348 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by validation-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + + corev1 "k8s.io/api/core/v1" + equality "k8s.io/apimachinery/pkg/api/equality" + operation "k8s.io/apimachinery/pkg/api/operation" + resource "k8s.io/apimachinery/pkg/api/resource" + safe "k8s.io/apimachinery/pkg/api/safe" + validate "k8s.io/apimachinery/pkg/api/validate" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + validation "k8s.io/apimachinery/pkg/apis/meta/v1/validation" + types "k8s.io/apimachinery/pkg/types" + sets "k8s.io/apimachinery/pkg/util/sets" + field "k8s.io/apimachinery/pkg/util/validation/field" +) + +// Validate_AllocatedDeviceStatus validates an instance of AllocatedDeviceStatus according +// to declarative validation rules in the API schema. +func Validate_AllocatedDeviceStatus( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *AllocatedDeviceStatus) (errs field.ErrorList) { + + // field AllocatedDeviceStatus.Driver has no validation + // field AllocatedDeviceStatus.Pool has no validation + // field AllocatedDeviceStatus.Device has no validation + + { // field AllocatedDeviceStatus.ShareID + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.UUID(ctx, op, fldPath, obj, oldObj).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *AllocatedDeviceStatus) *string { + return oldObj.ShareID + }) + errs = append(errs, fn(fldPath.Child("shareID"), obj.ShareID, oldVal, oldObj != nil)...) + } + + { // field AllocatedDeviceStatus.Conditions + fn := func( + fldPath *field.Path, + obj, oldObj []metav1.Condition, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with map semantics require unique keys + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, + func(a *metav1.Condition, b *metav1.Condition) bool { return a.Type == b.Type }).MarkAlpha(); len(e) != 0 { + errs = append(errs, e...) + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, + func(a *metav1.Condition, b *metav1.Condition) bool { return a.Type == b.Type }, validate.SemanticDeepEqual, validation.Validate_Condition); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *AllocatedDeviceStatus) []metav1.Condition { + return oldObj.Conditions + }) + errs = append(errs, fn(fldPath.Child("conditions"), obj.Conditions, oldVal, oldObj != nil)...) + } + + // field AllocatedDeviceStatus.Data has no validation + + { // field AllocatedDeviceStatus.NetworkData + fn := func( + fldPath *field.Path, + obj, oldObj *NetworkDeviceData, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_NetworkDeviceData(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *AllocatedDeviceStatus) *NetworkDeviceData { + return oldObj.NetworkData + }) + errs = append(errs, fn(fldPath.Child("networkData"), obj.NetworkData, oldVal, oldObj != nil)...) + } + + return errs +} + +var symbolsForAllocationConfigSource = sets.New(AllocationConfigSourceClaim, AllocationConfigSourceClass) + +// Validate_AllocationConfigSource validates an instance of AllocationConfigSource according +// to declarative validation rules in the API schema. +func Validate_AllocationConfigSource( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *AllocationConfigSource) (errs field.ErrorList) { + + if e := validate.Enum(ctx, op, fldPath, obj, oldObj, symbolsForAllocationConfigSource, nil).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + + return errs +} + +// Validate_AllocationResult validates an instance of AllocationResult according +// to declarative validation rules in the API schema. +func Validate_AllocationResult( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *AllocationResult) (errs field.ErrorList) { + + { // field AllocationResult.Devices + fn := func( + fldPath *field.Path, + obj, oldObj *DeviceAllocationResult, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call the type's validation function + errs = append(errs, Validate_DeviceAllocationResult(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *AllocationResult) *DeviceAllocationResult { + return &oldObj.Devices + }) + errs = append(errs, fn(fldPath.Child("devices"), &obj.Devices, oldVal, oldObj != nil)...) + } + + // field AllocationResult.NodeSelector has no validation + // field AllocationResult.AllocationTimestamp has no validation + return errs +} + +// Validate_CounterSet validates an instance of CounterSet according +// to declarative validation rules in the API schema. +func Validate_CounterSet( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *CounterSet) (errs field.ErrorList) { + + { // field CounterSet.Name + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.ShortName(ctx, op, fldPath, obj, oldObj).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CounterSet) *string { + return &oldObj.Name + }) + errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...) + } + + { // field CounterSet.Counters + fn := func( + fldPath *field.Path, + obj, oldObj map[string]Counter, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredMap(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.EachMapKey(ctx, op, fldPath, obj, oldObj, validate.ShortName).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CounterSet) map[string]Counter { + return oldObj.Counters + }) + errs = append(errs, fn(fldPath.Child("counters"), obj.Counters, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_Device validates an instance of Device according +// to declarative validation rules in the API schema. +func Validate_Device( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *Device) (errs field.ErrorList) { + + // field Device.Name has no validation + + { // field Device.Attributes + fn := func( + fldPath *field.Path, + obj, oldObj map[QualifiedName]DeviceAttribute, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalMap(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the map and call the value type's validation function + if e := validate.EachMapVal(ctx, op, fldPath, obj, oldObj, validate.SemanticDeepEqual, Validate_DeviceAttribute); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *Device) map[QualifiedName]DeviceAttribute { + return oldObj.Attributes + }) + errs = append(errs, fn(fldPath.Child("attributes"), obj.Attributes, oldVal, oldObj != nil)...) + } + + // field Device.Capacity has no validation + + { // field Device.ConsumesCounters + fn := func( + fldPath *field.Path, + obj, oldObj []DeviceCounterConsumption, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 2).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with map semantics require unique keys + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, + func(a *DeviceCounterConsumption, b *DeviceCounterConsumption) bool { + return a.CounterSet == b.CounterSet + }).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, + func(a *DeviceCounterConsumption, b *DeviceCounterConsumption) bool { + return a.CounterSet == b.CounterSet + }, validate.SemanticDeepEqual, Validate_DeviceCounterConsumption); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *Device) []DeviceCounterConsumption { + return oldObj.ConsumesCounters + }) + errs = append(errs, fn(fldPath.Child("consumesCounters"), obj.ConsumesCounters, oldVal, oldObj != nil)...) + } + + // field Device.NodeName has no validation + // field Device.NodeSelector has no validation + // field Device.AllNodes has no validation + + { // field Device.Taints + fn := func( + fldPath *field.Path, + obj, oldObj []DeviceTaint, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceTaint); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *Device) []DeviceTaint { + return oldObj.Taints + }) + errs = append(errs, fn(fldPath.Child("taints"), obj.Taints, oldVal, oldObj != nil)...) + } + + // field Device.BindsToNode has no validation + + { // field Device.BindingConditions + fn := func( + fldPath *field.Path, + obj, oldObj []string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 4).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *Device) []string { + return oldObj.BindingConditions + }) + errs = append(errs, fn(fldPath.Child("bindingConditions"), obj.BindingConditions, oldVal, oldObj != nil)...) + } + + { // field Device.BindingFailureConditions + fn := func( + fldPath *field.Path, + obj, oldObj []string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 4).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *Device) []string { + return oldObj.BindingFailureConditions + }) + errs = append(errs, fn(fldPath.Child("bindingFailureConditions"), obj.BindingFailureConditions, oldVal, oldObj != nil)...) + } + + // field Device.AllowMultipleAllocations has no validation + + { // field Device.NodeAllocatableResources + fn := func( + fldPath *field.Path, + obj, oldObj map[corev1.ResourceName]NodeAllocatableResource, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalMap(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the map and call the value type's validation function + if e := validate.EachMapVal(ctx, op, fldPath, obj, oldObj, validate.SemanticDeepEqual, Validate_NodeAllocatableResource); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *Device) map[corev1.ResourceName]NodeAllocatableResource { + return oldObj.NodeAllocatableResources + }) + errs = append(errs, fn(fldPath.Child("nodeAllocatableResources"), obj.NodeAllocatableResources, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeviceAllocationConfiguration validates an instance of DeviceAllocationConfiguration according +// to declarative validation rules in the API schema. +func Validate_DeviceAllocationConfiguration( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceAllocationConfiguration) (errs field.ErrorList) { + + { // field DeviceAllocationConfiguration.Source + fn := func( + fldPath *field.Path, + obj, oldObj *AllocationConfigSource, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_AllocationConfigSource(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceAllocationConfiguration) *AllocationConfigSource { + return &oldObj.Source + }) + errs = append(errs, fn(fldPath.Child("source"), &obj.Source, oldVal, oldObj != nil)...) + } + + { // field DeviceAllocationConfiguration.Requests + fn := func( + fldPath *field.Path, + obj, oldObj []string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with set semantics require unique values + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, validate.DirectEqual).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceAllocationConfiguration) []string { + return oldObj.Requests + }) + errs = append(errs, fn(fldPath.Child("requests"), obj.Requests, oldVal, oldObj != nil)...) + } + + { // field DeviceAllocationConfiguration.DeviceConfiguration + fn := func( + fldPath *field.Path, + obj, oldObj *DeviceConfiguration, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call the type's validation function + errs = append(errs, Validate_DeviceConfiguration(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceAllocationConfiguration) *DeviceConfiguration { + return &oldObj.DeviceConfiguration + }) + errs = append(errs, fn(safe.Value(fldPath, func() *field.Path { return fldPath.Child("DeviceConfiguration") }), &obj.DeviceConfiguration, oldVal, oldObj != nil)...) + } + + return errs +} + +var symbolsForDeviceAllocationMode = sets.New(DeviceAllocationModeAll, DeviceAllocationModeExactCount) + +// Validate_DeviceAllocationMode validates an instance of DeviceAllocationMode according +// to declarative validation rules in the API schema. +func Validate_DeviceAllocationMode( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceAllocationMode) (errs field.ErrorList) { + + if e := validate.Enum(ctx, op, fldPath, obj, oldObj, symbolsForDeviceAllocationMode, nil).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + + return errs +} + +// Validate_DeviceAllocationResult validates an instance of DeviceAllocationResult according +// to declarative validation rules in the API schema. +func Validate_DeviceAllocationResult( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceAllocationResult) (errs field.ErrorList) { + + { // field DeviceAllocationResult.Results + fn := func( + fldPath *field.Path, + obj, oldObj []DeviceRequestAllocationResult, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceRequestAllocationResult); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceAllocationResult) []DeviceRequestAllocationResult { + return oldObj.Results + }) + errs = append(errs, fn(fldPath.Child("results"), obj.Results, oldVal, oldObj != nil)...) + } + + { // field DeviceAllocationResult.Config + fn := func( + fldPath *field.Path, + obj, oldObj []DeviceAllocationConfiguration, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 64).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceAllocationConfiguration); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceAllocationResult) []DeviceAllocationConfiguration { + return oldObj.Config + }) + errs = append(errs, fn(fldPath.Child("config"), obj.Config, oldVal, oldObj != nil)...) + } + + return errs +} + +var unionMembershipFor_k8s_io_api_resource_v1_DeviceAttribute_ = validate.NewUnionMembership(validate.NewUnionMember("int"), validate.NewUnionMember("bool"), validate.NewUnionMember("string"), validate.NewUnionMember("version"), validate.NewUnionMember("ints"), validate.NewUnionMember("bools"), validate.NewUnionMember("strings"), validate.NewUnionMember("versions")) + +// Validate_DeviceAttribute validates an instance of DeviceAttribute according +// to declarative validation rules in the API schema. +func Validate_DeviceAttribute( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceAttribute) (errs field.ErrorList) { + + if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_resource_v1_DeviceAttribute_, + func(obj *DeviceAttribute) bool { + if obj == nil { + return false + } + return obj.IntValue != nil + }, + func(obj *DeviceAttribute) bool { + if obj == nil { + return false + } + return obj.BoolValue != nil + }, + func(obj *DeviceAttribute) bool { + if obj == nil { + return false + } + return obj.StringValue != nil + }, + func(obj *DeviceAttribute) bool { + if obj == nil { + return false + } + return obj.VersionValue != nil + }, + func(obj *DeviceAttribute) bool { + if obj == nil { + return false + } + return len(obj.IntValues) != 0 + }, + func(obj *DeviceAttribute) bool { + if obj == nil { + return false + } + return len(obj.BoolValues) != 0 + }, + func(obj *DeviceAttribute) bool { + if obj == nil { + return false + } + return len(obj.StringValues) != 0 + }, + func(obj *DeviceAttribute) bool { + if obj == nil { + return false + } + return len(obj.VersionValues) != 0 + }).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + + { // field DeviceAttribute.IntValue + fn := func( + fldPath *field.Path, + obj, oldObj *int64, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceAttribute) *int64 { + return oldObj.IntValue + }) + errs = append(errs, fn(fldPath.Child("int"), obj.IntValue, oldVal, oldObj != nil)...) + } + + { // field DeviceAttribute.BoolValue + fn := func( + fldPath *field.Path, + obj, oldObj *bool, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceAttribute) *bool { + return oldObj.BoolValue + }) + errs = append(errs, fn(fldPath.Child("bool"), obj.BoolValue, oldVal, oldObj != nil)...) + } + + { // field DeviceAttribute.StringValue + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceAttribute) *string { + return oldObj.StringValue + }) + errs = append(errs, fn(fldPath.Child("string"), obj.StringValue, oldVal, oldObj != nil)...) + } + + { // field DeviceAttribute.VersionValue + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceAttribute) *string { + return oldObj.VersionValue + }) + errs = append(errs, fn(fldPath.Child("version"), obj.VersionValue, oldVal, oldObj != nil)...) + } + + { // field DeviceAttribute.IntValues + fn := func( + fldPath *field.Path, + obj, oldObj []int64, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceAttribute) []int64 { + return oldObj.IntValues + }) + errs = append(errs, fn(fldPath.Child("ints"), obj.IntValues, oldVal, oldObj != nil)...) + } + + { // field DeviceAttribute.BoolValues + fn := func( + fldPath *field.Path, + obj, oldObj []bool, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceAttribute) []bool { + return oldObj.BoolValues + }) + errs = append(errs, fn(fldPath.Child("bools"), obj.BoolValues, oldVal, oldObj != nil)...) + } + + { // field DeviceAttribute.StringValues + fn := func( + fldPath *field.Path, + obj, oldObj []string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, + func(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *string) field.ErrorList { + return validate.MaxBytes(ctx, op, fldPath, obj, oldObj, 64) + }).MarkAlpha(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceAttribute) []string { + return oldObj.StringValues + }) + errs = append(errs, fn(fldPath.Child("strings"), obj.StringValues, oldVal, oldObj != nil)...) + } + + { // field DeviceAttribute.VersionValues + fn := func( + fldPath *field.Path, + obj, oldObj []string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceAttribute) []string { + return oldObj.VersionValues + }) + errs = append(errs, fn(fldPath.Child("versions"), obj.VersionValues, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeviceClaim validates an instance of DeviceClaim according +// to declarative validation rules in the API schema. +func Validate_DeviceClaim( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceClaim) (errs field.ErrorList) { + + { // field DeviceClaim.Requests + fn := func( + fldPath *field.Path, + obj, oldObj []DeviceRequest, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with map semantics require unique keys + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, + func(a *DeviceRequest, b *DeviceRequest) bool { return a.Name == b.Name }).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, + func(a *DeviceRequest, b *DeviceRequest) bool { return a.Name == b.Name }, validate.SemanticDeepEqual, Validate_DeviceRequest); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceClaim) []DeviceRequest { + return oldObj.Requests + }) + errs = append(errs, fn(fldPath.Child("requests"), obj.Requests, oldVal, oldObj != nil)...) + } + + { // field DeviceClaim.Constraints + fn := func( + fldPath *field.Path, + obj, oldObj []DeviceConstraint, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceConstraint); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceClaim) []DeviceConstraint { + return oldObj.Constraints + }) + errs = append(errs, fn(fldPath.Child("constraints"), obj.Constraints, oldVal, oldObj != nil)...) + } + + { // field DeviceClaim.Config + fn := func( + fldPath *field.Path, + obj, oldObj []DeviceClaimConfiguration, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceClaimConfiguration); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceClaim) []DeviceClaimConfiguration { + return oldObj.Config + }) + errs = append(errs, fn(fldPath.Child("config"), obj.Config, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeviceClaimConfiguration validates an instance of DeviceClaimConfiguration according +// to declarative validation rules in the API schema. +func Validate_DeviceClaimConfiguration( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceClaimConfiguration) (errs field.ErrorList) { + + { // field DeviceClaimConfiguration.Requests + fn := func( + fldPath *field.Path, + obj, oldObj []string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with set semantics require unique values + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, validate.DirectEqual).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceClaimConfiguration) []string { + return oldObj.Requests + }) + errs = append(errs, fn(fldPath.Child("requests"), obj.Requests, oldVal, oldObj != nil)...) + } + + { // field DeviceClaimConfiguration.DeviceConfiguration + fn := func( + fldPath *field.Path, + obj, oldObj *DeviceConfiguration, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call the type's validation function + errs = append(errs, Validate_DeviceConfiguration(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceClaimConfiguration) *DeviceConfiguration { + return &oldObj.DeviceConfiguration + }) + errs = append(errs, fn(safe.Value(fldPath, func() *field.Path { return fldPath.Child("DeviceConfiguration") }), &obj.DeviceConfiguration, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeviceClassConfiguration validates an instance of DeviceClassConfiguration according +// to declarative validation rules in the API schema. +func Validate_DeviceClassConfiguration( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceClassConfiguration) (errs field.ErrorList) { + + { // field DeviceClassConfiguration.DeviceConfiguration + fn := func( + fldPath *field.Path, + obj, oldObj *DeviceConfiguration, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call the type's validation function + errs = append(errs, Validate_DeviceConfiguration(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceClassConfiguration) *DeviceConfiguration { + return &oldObj.DeviceConfiguration + }) + errs = append(errs, fn(safe.Value(fldPath, func() *field.Path { return fldPath.Child("DeviceConfiguration") }), &obj.DeviceConfiguration, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeviceClassSpec validates an instance of DeviceClassSpec according +// to declarative validation rules in the API schema. +func Validate_DeviceClassSpec( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceClassSpec) (errs field.ErrorList) { + + { // field DeviceClassSpec.Selectors + fn := func( + fldPath *field.Path, + obj, oldObj []DeviceSelector, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceClassSpec) []DeviceSelector { + return oldObj.Selectors + }) + errs = append(errs, fn(fldPath.Child("selectors"), obj.Selectors, oldVal, oldObj != nil)...) + } + + { // field DeviceClassSpec.Config + fn := func( + fldPath *field.Path, + obj, oldObj []DeviceClassConfiguration, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceClassConfiguration); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceClassSpec) []DeviceClassConfiguration { + return oldObj.Config + }) + errs = append(errs, fn(fldPath.Child("config"), obj.Config, oldVal, oldObj != nil)...) + } + + { // field DeviceClassSpec.ExtendedResourceName + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.ExtendedResourceName(ctx, op, fldPath, obj, oldObj).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceClassSpec) *string { + return oldObj.ExtendedResourceName + }) + errs = append(errs, fn(fldPath.Child("extendedResourceName"), obj.ExtendedResourceName, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeviceConfiguration validates an instance of DeviceConfiguration according +// to declarative validation rules in the API schema. +func Validate_DeviceConfiguration( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceConfiguration) (errs field.ErrorList) { + + { // field DeviceConfiguration.Opaque + fn := func( + fldPath *field.Path, + obj, oldObj *OpaqueDeviceConfiguration, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_OpaqueDeviceConfiguration(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceConfiguration) *OpaqueDeviceConfiguration { + return oldObj.Opaque + }) + errs = append(errs, fn(fldPath.Child("opaque"), obj.Opaque, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeviceConstraint validates an instance of DeviceConstraint according +// to declarative validation rules in the API schema. +func Validate_DeviceConstraint( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceConstraint) (errs field.ErrorList) { + + { // field DeviceConstraint.Requests + fn := func( + fldPath *field.Path, + obj, oldObj []string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with set semantics require unique values + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, validate.DirectEqual).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceConstraint) []string { + return oldObj.Requests + }) + errs = append(errs, fn(fldPath.Child("requests"), obj.Requests, oldVal, oldObj != nil)...) + } + + { // field DeviceConstraint.MatchAttribute + fn := func( + fldPath *field.Path, + obj, oldObj *FullyQualifiedName, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.ResourceFullyQualifiedName(ctx, op, fldPath, obj, oldObj).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceConstraint) *FullyQualifiedName { + return oldObj.MatchAttribute + }) + errs = append(errs, fn(fldPath.Child("matchAttribute"), obj.MatchAttribute, oldVal, oldObj != nil)...) + } + + { // field DeviceConstraint.DistinctAttribute + fn := func( + fldPath *field.Path, + obj, oldObj *FullyQualifiedName, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.ResourceFullyQualifiedName(ctx, op, fldPath, obj, oldObj).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceConstraint) *FullyQualifiedName { + return oldObj.DistinctAttribute + }) + errs = append(errs, fn(fldPath.Child("distinctAttribute"), obj.DistinctAttribute, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeviceCounterConsumption validates an instance of DeviceCounterConsumption according +// to declarative validation rules in the API schema. +func Validate_DeviceCounterConsumption( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceCounterConsumption) (errs field.ErrorList) { + + { // field DeviceCounterConsumption.CounterSet + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.ShortName(ctx, op, fldPath, obj, oldObj).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceCounterConsumption) *string { + return &oldObj.CounterSet + }) + errs = append(errs, fn(fldPath.Child("counterSet"), &obj.CounterSet, oldVal, oldObj != nil)...) + } + + { // field DeviceCounterConsumption.Counters + fn := func( + fldPath *field.Path, + obj, oldObj map[string]Counter, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredMap(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.EachMapKey(ctx, op, fldPath, obj, oldObj, validate.ShortName).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceCounterConsumption) map[string]Counter { + return oldObj.Counters + }) + errs = append(errs, fn(fldPath.Child("counters"), obj.Counters, oldVal, oldObj != nil)...) + } + + { // field DeviceCounterConsumption.CompatibilityGroups + fn := func( + fldPath *field.Path, + obj, oldObj []string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 2).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, validate.DirectEqual, nil, validate.ShortName); len(e) != 0 { + errs = append(errs, e...) + } + // lists with set semantics require unique values + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, validate.DirectEqual); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceCounterConsumption) []string { + return oldObj.CompatibilityGroups + }) + errs = append(errs, fn(fldPath.Child("compatibilityGroups"), obj.CompatibilityGroups, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeviceDerivedAttribute validates an instance of DeviceDerivedAttribute according +// to declarative validation rules in the API schema. +func Validate_DeviceDerivedAttribute( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceDerivedAttribute) (errs field.ErrorList) { + + { // field DeviceDerivedAttribute.Name + fn := func( + fldPath *field.Path, + obj, oldObj *FullyQualifiedName, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.ResourceFullyQualifiedName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceDerivedAttribute) *FullyQualifiedName { + return &oldObj.Name + }) + errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...) + } + + { // field DeviceDerivedAttribute.Expression + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceDerivedAttribute) *string { + return &oldObj.Expression + }) + errs = append(errs, fn(fldPath.Child("expression"), &obj.Expression, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeviceRequest validates an instance of DeviceRequest according +// to declarative validation rules in the API schema. +func Validate_DeviceRequest( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceRequest) (errs field.ErrorList) { + + // field DeviceRequest.Name has no validation + + { // field DeviceRequest.Exactly + fn := func( + fldPath *field.Path, + obj, oldObj *ExactDeviceRequest, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_ExactDeviceRequest(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceRequest) *ExactDeviceRequest { + return oldObj.Exactly + }) + errs = append(errs, fn(fldPath.Child("exactly"), obj.Exactly, oldVal, oldObj != nil)...) + } + + { // field DeviceRequest.FirstAvailable + fn := func( + fldPath *field.Path, + obj, oldObj []DeviceSubRequest, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 8).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with map semantics require unique keys + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, + func(a *DeviceSubRequest, b *DeviceSubRequest) bool { return a.Name == b.Name }).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, + func(a *DeviceSubRequest, b *DeviceSubRequest) bool { return a.Name == b.Name }, validate.SemanticDeepEqual, Validate_DeviceSubRequest); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceRequest) []DeviceSubRequest { + return oldObj.FirstAvailable + }) + errs = append(errs, fn(fldPath.Child("firstAvailable"), obj.FirstAvailable, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeviceRequestAllocationResult validates an instance of DeviceRequestAllocationResult according +// to declarative validation rules in the API schema. +func Validate_DeviceRequestAllocationResult( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceRequestAllocationResult) (errs field.ErrorList) { + + // field DeviceRequestAllocationResult.Request has no validation + + { // field DeviceRequestAllocationResult.Driver + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LongNameCaseless(ctx, op, fldPath, obj, oldObj).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + if e := validate.MaxLength(ctx, op, fldPath, obj, oldObj, 63).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceRequestAllocationResult) *string { + return &oldObj.Driver + }) + errs = append(errs, fn(fldPath.Child("driver"), &obj.Driver, oldVal, oldObj != nil)...) + } + + { // field DeviceRequestAllocationResult.Pool + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.ResourcePoolName(ctx, op, fldPath, obj, oldObj).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceRequestAllocationResult) *string { + return &oldObj.Pool + }) + errs = append(errs, fn(fldPath.Child("pool"), &obj.Pool, oldVal, oldObj != nil)...) + } + + // field DeviceRequestAllocationResult.Device has no validation + // field DeviceRequestAllocationResult.AdminAccess has no validation + + { // field DeviceRequestAllocationResult.Tolerations + fn := func( + fldPath *field.Path, + obj, oldObj []DeviceToleration, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceToleration); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceRequestAllocationResult) []DeviceToleration { + return oldObj.Tolerations + }) + errs = append(errs, fn(fldPath.Child("tolerations"), obj.Tolerations, oldVal, oldObj != nil)...) + } + + { // field DeviceRequestAllocationResult.BindingConditions + fn := func( + fldPath *field.Path, + obj, oldObj []string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 4).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceRequestAllocationResult) []string { + return oldObj.BindingConditions + }) + errs = append(errs, fn(fldPath.Child("bindingConditions"), obj.BindingConditions, oldVal, oldObj != nil)...) + } + + { // field DeviceRequestAllocationResult.BindingFailureConditions + fn := func( + fldPath *field.Path, + obj, oldObj []string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 4).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceRequestAllocationResult) []string { + return oldObj.BindingFailureConditions + }) + errs = append(errs, fn(fldPath.Child("bindingFailureConditions"), obj.BindingFailureConditions, oldVal, oldObj != nil)...) + } + + { // field DeviceRequestAllocationResult.ShareID + fn := func( + fldPath *field.Path, + obj, oldObj *types.UID, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.UUID(ctx, op, fldPath, obj, oldObj).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceRequestAllocationResult) *types.UID { + return oldObj.ShareID + }) + errs = append(errs, fn(fldPath.Child("shareID"), obj.ShareID, oldVal, oldObj != nil)...) + } + + // field DeviceRequestAllocationResult.ConsumedCapacity has no validation + + { // field DeviceRequestAllocationResult.SkipNodeOperations + fn := func( + fldPath *field.Path, + obj, oldObj []SkipNodeOperation, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with set semantics require unique values + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, validate.DirectEqual); len(e) != 0 { + errs = append(errs, e...) + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, validate.DirectEqual, nil, Validate_SkipNodeOperation); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceRequestAllocationResult) []SkipNodeOperation { + return oldObj.SkipNodeOperations + }) + errs = append(errs, fn(fldPath.Child("skipNodeOperations"), obj.SkipNodeOperations, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeviceSubRequest validates an instance of DeviceSubRequest according +// to declarative validation rules in the API schema. +func Validate_DeviceSubRequest( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceSubRequest) (errs field.ErrorList) { + + // field DeviceSubRequest.Name has no validation + + { // field DeviceSubRequest.DeviceClassName + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LongName(ctx, op, fldPath, obj, oldObj).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceSubRequest) *string { + return &oldObj.DeviceClassName + }) + errs = append(errs, fn(fldPath.Child("deviceClassName"), &obj.DeviceClassName, oldVal, oldObj != nil)...) + } + + { // field DeviceSubRequest.Selectors + fn := func( + fldPath *field.Path, + obj, oldObj []DeviceSelector, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceSubRequest) []DeviceSelector { + return oldObj.Selectors + }) + errs = append(errs, fn(fldPath.Child("selectors"), obj.Selectors, oldVal, oldObj != nil)...) + } + + { // field DeviceSubRequest.AllocationMode + fn := func( + fldPath *field.Path, + obj, oldObj *DeviceAllocationMode, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_DeviceAllocationMode(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceSubRequest) *DeviceAllocationMode { + return &oldObj.AllocationMode + }) + errs = append(errs, fn(fldPath.Child("allocationMode"), &obj.AllocationMode, oldVal, oldObj != nil)...) + } + + // field DeviceSubRequest.Count has no validation + + { // field DeviceSubRequest.Tolerations + fn := func( + fldPath *field.Path, + obj, oldObj []DeviceToleration, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceToleration); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceSubRequest) []DeviceToleration { + return oldObj.Tolerations + }) + errs = append(errs, fn(fldPath.Child("tolerations"), obj.Tolerations, oldVal, oldObj != nil)...) + } + + // field DeviceSubRequest.Capacity has no validation + + { // field DeviceSubRequest.DerivedAttributes + fn := func( + fldPath *field.Path, + obj, oldObj []DeviceDerivedAttribute, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceDerivedAttribute); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceSubRequest) []DeviceDerivedAttribute { + return oldObj.DerivedAttributes + }) + errs = append(errs, fn(fldPath.Child("derivedAttributes"), obj.DerivedAttributes, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeviceTaint validates an instance of DeviceTaint according +// to declarative validation rules in the API schema. +func Validate_DeviceTaint( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceTaint) (errs field.ErrorList) { + + // field DeviceTaint.Key has no validation + // field DeviceTaint.Value has no validation + + { // field DeviceTaint.Effect + fn := func( + fldPath *field.Path, + obj, oldObj *DeviceTaintEffect, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_DeviceTaintEffect(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceTaint) *DeviceTaintEffect { + return &oldObj.Effect + }) + errs = append(errs, fn(fldPath.Child("effect"), &obj.Effect, oldVal, oldObj != nil)...) + } + + // field DeviceTaint.TimeAdded has no validation + return errs +} + +var symbolsForDeviceTaintEffect = sets.New(DeviceTaintEffectNoExecute, DeviceTaintEffectNoSchedule, DeviceTaintEffectNone) + +// Validate_DeviceTaintEffect validates an instance of DeviceTaintEffect according +// to declarative validation rules in the API schema. +func Validate_DeviceTaintEffect( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceTaintEffect) (errs field.ErrorList) { + + if e := validate.Enum(ctx, op, fldPath, obj, oldObj, symbolsForDeviceTaintEffect, nil).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + + return errs +} + +// Validate_DeviceTaintRuleSpec validates an instance of DeviceTaintRuleSpec according +// to declarative validation rules in the API schema. +func Validate_DeviceTaintRuleSpec( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceTaintRuleSpec) (errs field.ErrorList) { + + // field DeviceTaintRuleSpec.DeviceSelector has no validation + + { // field DeviceTaintRuleSpec.Taint + fn := func( + fldPath *field.Path, + obj, oldObj *DeviceTaint, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call the type's validation function + errs = append(errs, Validate_DeviceTaint(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceTaintRuleSpec) *DeviceTaint { + return &oldObj.Taint + }) + errs = append(errs, fn(fldPath.Child("taint"), &obj.Taint, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeviceTaintRuleStatus validates an instance of DeviceTaintRuleStatus according +// to declarative validation rules in the API schema. +func Validate_DeviceTaintRuleStatus( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceTaintRuleStatus) (errs field.ErrorList) { + + { // field DeviceTaintRuleStatus.Conditions + fn := func( + fldPath *field.Path, + obj, oldObj []metav1.Condition, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with map semantics require unique keys + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, + func(a *metav1.Condition, b *metav1.Condition) bool { return a.Type == b.Type }).MarkAlpha(); len(e) != 0 { + errs = append(errs, e...) + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, + func(a *metav1.Condition, b *metav1.Condition) bool { return a.Type == b.Type }, validate.SemanticDeepEqual, validation.Validate_Condition); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceTaintRuleStatus) []metav1.Condition { + return oldObj.Conditions + }) + errs = append(errs, fn(fldPath.Child("conditions"), obj.Conditions, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeviceToleration validates an instance of DeviceToleration according +// to declarative validation rules in the API schema. +func Validate_DeviceToleration( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceToleration) (errs field.ErrorList) { + + { // field DeviceToleration.Key + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LabelKey(ctx, op, fldPath, obj, oldObj).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceToleration) *string { + return &oldObj.Key + }) + errs = append(errs, fn(fldPath.Child("key"), &obj.Key, oldVal, oldObj != nil)...) + } + + { // field DeviceToleration.Operator + fn := func( + fldPath *field.Path, + obj, oldObj *DeviceTolerationOperator, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + // optional fields with default values are effectively required + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_DeviceTolerationOperator(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceToleration) *DeviceTolerationOperator { + return &oldObj.Operator + }) + errs = append(errs, fn(fldPath.Child("operator"), &obj.Operator, oldVal, oldObj != nil)...) + } + + // field DeviceToleration.Value has no validation + + { // field DeviceToleration.Effect + fn := func( + fldPath *field.Path, + obj, oldObj *DeviceTaintEffect, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_DeviceTaintEffect(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DeviceToleration) *DeviceTaintEffect { + return &oldObj.Effect + }) + errs = append(errs, fn(fldPath.Child("effect"), &obj.Effect, oldVal, oldObj != nil)...) + } + + // field DeviceToleration.TolerationSeconds has no validation + return errs +} + +var symbolsForDeviceTolerationOperator = sets.New(DeviceTolerationOpEqual, DeviceTolerationOpExists) + +// Validate_DeviceTolerationOperator validates an instance of DeviceTolerationOperator according +// to declarative validation rules in the API schema. +func Validate_DeviceTolerationOperator( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DeviceTolerationOperator) (errs field.ErrorList) { + + if e := validate.Enum(ctx, op, fldPath, obj, oldObj, symbolsForDeviceTolerationOperator, nil).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + + return errs +} + +// Validate_ExactDeviceRequest validates an instance of ExactDeviceRequest according +// to declarative validation rules in the API schema. +func Validate_ExactDeviceRequest( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *ExactDeviceRequest) (errs field.ErrorList) { + + // field ExactDeviceRequest.DeviceClassName has no validation + + { // field ExactDeviceRequest.Selectors + fn := func( + fldPath *field.Path, + obj, oldObj []DeviceSelector, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *ExactDeviceRequest) []DeviceSelector { + return oldObj.Selectors + }) + errs = append(errs, fn(fldPath.Child("selectors"), obj.Selectors, oldVal, oldObj != nil)...) + } + + { // field ExactDeviceRequest.AllocationMode + fn := func( + fldPath *field.Path, + obj, oldObj *DeviceAllocationMode, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_DeviceAllocationMode(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *ExactDeviceRequest) *DeviceAllocationMode { + return &oldObj.AllocationMode + }) + errs = append(errs, fn(fldPath.Child("allocationMode"), &obj.AllocationMode, oldVal, oldObj != nil)...) + } + + // field ExactDeviceRequest.Count has no validation + // field ExactDeviceRequest.AdminAccess has no validation + + { // field ExactDeviceRequest.Tolerations + fn := func( + fldPath *field.Path, + obj, oldObj []DeviceToleration, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceToleration); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *ExactDeviceRequest) []DeviceToleration { + return oldObj.Tolerations + }) + errs = append(errs, fn(fldPath.Child("tolerations"), obj.Tolerations, oldVal, oldObj != nil)...) + } + + // field ExactDeviceRequest.Capacity has no validation + + { // field ExactDeviceRequest.DerivedAttributes + fn := func( + fldPath *field.Path, + obj, oldObj []DeviceDerivedAttribute, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceDerivedAttribute); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *ExactDeviceRequest) []DeviceDerivedAttribute { + return oldObj.DerivedAttributes + }) + errs = append(errs, fn(fldPath.Child("derivedAttributes"), obj.DerivedAttributes, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_NetworkDeviceData validates an instance of NetworkDeviceData according +// to declarative validation rules in the API schema. +func Validate_NetworkDeviceData( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *NetworkDeviceData) (errs field.ErrorList) { + + { // field NetworkDeviceData.InterfaceName + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.MaxBytes(ctx, op, fldPath, obj, oldObj, 256).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *NetworkDeviceData) *string { + return &oldObj.InterfaceName + }) + errs = append(errs, fn(fldPath.Child("interfaceName"), &obj.InterfaceName, oldVal, oldObj != nil)...) + } + + { // field NetworkDeviceData.IPs + fn := func( + fldPath *field.Path, + obj, oldObj []string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 16).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with set semantics require unique values + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, validate.DirectEqual).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *NetworkDeviceData) []string { + return oldObj.IPs + }) + errs = append(errs, fn(fldPath.Child("ips"), obj.IPs, oldVal, oldObj != nil)...) + } + + { // field NetworkDeviceData.HardwareAddress + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.MaxBytes(ctx, op, fldPath, obj, oldObj, 128).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *NetworkDeviceData) *string { + return &oldObj.HardwareAddress + }) + errs = append(errs, fn(fldPath.Child("hardwareAddress"), &obj.HardwareAddress, oldVal, oldObj != nil)...) + } + + return errs +} + +var unionMembershipFor_k8s_io_api_resource_v1_NodeAllocatableMapping_ = validate.NewUnionMembership(validate.NewUnionMember("capacityKey"), validate.NewUnionMember("deviceMultiplier")) + +// Validate_NodeAllocatableMapping validates an instance of NodeAllocatableMapping according +// to declarative validation rules in the API schema. +func Validate_NodeAllocatableMapping( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *NodeAllocatableMapping) (errs field.ErrorList) { + + if e := validate.DependentRequired(ctx, op, fldPath, obj, oldObj, "capacityKey", + func(obj *NodeAllocatableMapping) bool { + if obj == nil { + return false + } + return obj.CapacityKey != nil + }, "capacityMultiplier", + func(obj *NodeAllocatableMapping) bool { + if obj == nil { + return false + } + return obj.CapacityMultiplier != nil + }).MarkAlpha(); len(e) != 0 { + errs = append(errs, e...) + } + if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_resource_v1_NodeAllocatableMapping_, + func(obj *NodeAllocatableMapping) bool { + if obj == nil { + return false + } + return obj.CapacityKey != nil + }, + func(obj *NodeAllocatableMapping) bool { + if obj == nil { + return false + } + return obj.DeviceMultiplier != nil + }); len(e) != 0 { + errs = append(errs, e...) + } + if e := validate.DependentRequired(ctx, op, fldPath, obj, oldObj, "capacityMultiplier", + func(obj *NodeAllocatableMapping) bool { + if obj == nil { + return false + } + return obj.CapacityMultiplier != nil + }, "capacityKey", + func(obj *NodeAllocatableMapping) bool { + if obj == nil { + return false + } + return obj.CapacityKey != nil + }).MarkAlpha(); len(e) != 0 { + errs = append(errs, e...) + } + + { // field NodeAllocatableMapping.CapacityKey + fn := func( + fldPath *field.Path, + obj, oldObj *QualifiedName, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *NodeAllocatableMapping) *QualifiedName { + return oldObj.CapacityKey + }) + errs = append(errs, fn(fldPath.Child("capacityKey"), obj.CapacityKey, oldVal, oldObj != nil)...) + } + + { // field NodeAllocatableMapping.CapacityMultiplier + fn := func( + fldPath *field.Path, + obj, oldObj *resource.Quantity, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *NodeAllocatableMapping) *resource.Quantity { + return oldObj.CapacityMultiplier + }) + errs = append(errs, fn(fldPath.Child("capacityMultiplier"), obj.CapacityMultiplier, oldVal, oldObj != nil)...) + } + + { // field NodeAllocatableMapping.DeviceMultiplier + fn := func( + fldPath *field.Path, + obj, oldObj *resource.Quantity, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *NodeAllocatableMapping) *resource.Quantity { + return oldObj.DeviceMultiplier + }) + errs = append(errs, fn(fldPath.Child("deviceMultiplier"), obj.DeviceMultiplier, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_NodeAllocatableOverhead validates an instance of NodeAllocatableOverhead according +// to declarative validation rules in the API schema. +func Validate_NodeAllocatableOverhead( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *NodeAllocatableOverhead) (errs field.ErrorList) { + + { // field NodeAllocatableOverhead.PerPod + fn := func( + fldPath *field.Path, + obj, oldObj *resource.Quantity, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *NodeAllocatableOverhead) *resource.Quantity { + return oldObj.PerPod + }) + errs = append(errs, fn(fldPath.Child("perPod"), obj.PerPod, oldVal, oldObj != nil)...) + } + + { // field NodeAllocatableOverhead.PerContainer + fn := func( + fldPath *field.Path, + obj, oldObj *resource.Quantity, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *NodeAllocatableOverhead) *resource.Quantity { + return oldObj.PerContainer + }) + errs = append(errs, fn(fldPath.Child("perContainer"), obj.PerContainer, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_NodeAllocatableResource validates an instance of NodeAllocatableResource according +// to declarative validation rules in the API schema. +func Validate_NodeAllocatableResource( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *NodeAllocatableResource) (errs field.ErrorList) { + + { // field NodeAllocatableResource.Mapping + fn := func( + fldPath *field.Path, + obj, oldObj *NodeAllocatableMapping, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_NodeAllocatableMapping(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *NodeAllocatableResource) *NodeAllocatableMapping { + return oldObj.Mapping + }) + errs = append(errs, fn(fldPath.Child("mapping"), obj.Mapping, oldVal, oldObj != nil)...) + } + + { // field NodeAllocatableResource.Overhead + fn := func( + fldPath *field.Path, + obj, oldObj *NodeAllocatableOverhead, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_NodeAllocatableOverhead(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *NodeAllocatableResource) *NodeAllocatableOverhead { + return oldObj.Overhead + }) + errs = append(errs, fn(fldPath.Child("overhead"), obj.Overhead, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_OpaqueDeviceConfiguration validates an instance of OpaqueDeviceConfiguration according +// to declarative validation rules in the API schema. +func Validate_OpaqueDeviceConfiguration( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *OpaqueDeviceConfiguration) (errs field.ErrorList) { + + { // field OpaqueDeviceConfiguration.Driver + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LongNameCaseless(ctx, op, fldPath, obj, oldObj).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + if e := validate.MaxLength(ctx, op, fldPath, obj, oldObj, 63).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *OpaqueDeviceConfiguration) *string { + return &oldObj.Driver + }) + errs = append(errs, fn(fldPath.Child("driver"), &obj.Driver, oldVal, oldObj != nil)...) + } + + // field OpaqueDeviceConfiguration.Parameters has no validation + return errs +} + +// Validate_ResourceClaimSpec validates an instance of ResourceClaimSpec according +// to declarative validation rules in the API schema. +func Validate_ResourceClaimSpec( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *ResourceClaimSpec) (errs field.ErrorList) { + + { // field ResourceClaimSpec.Devices + fn := func( + fldPath *field.Path, + obj, oldObj *DeviceClaim, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call the type's validation function + errs = append(errs, Validate_DeviceClaim(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *ResourceClaimSpec) *DeviceClaim { + return &oldObj.Devices + }) + errs = append(errs, fn(fldPath.Child("devices"), &obj.Devices, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_ResourceClaimStatus validates an instance of ResourceClaimStatus according +// to declarative validation rules in the API schema. +func Validate_ResourceClaimStatus( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *ResourceClaimStatus) (errs field.ErrorList) { + + { // field ResourceClaimStatus.Allocation + fn := func( + fldPath *field.Path, + obj, oldObj *AllocationResult, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.UpdatePointer(ctx, op, fldPath, obj, oldObj, validate.NoModify).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_AllocationResult(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *ResourceClaimStatus) *AllocationResult { + return oldObj.Allocation + }) + errs = append(errs, fn(fldPath.Child("allocation"), obj.Allocation, oldVal, oldObj != nil)...) + } + + { // field ResourceClaimStatus.ReservedFor + fn := func( + fldPath *field.Path, + obj, oldObj []ResourceClaimConsumerReference, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 256).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with map semantics require unique keys + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, + func(a *ResourceClaimConsumerReference, b *ResourceClaimConsumerReference) bool { return a.UID == b.UID }).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *ResourceClaimStatus) []ResourceClaimConsumerReference { + return oldObj.ReservedFor + }) + errs = append(errs, fn(fldPath.Child("reservedFor"), obj.ReservedFor, oldVal, oldObj != nil)...) + } + + { // field ResourceClaimStatus.Devices + fn := func( + fldPath *field.Path, + obj, oldObj []AllocatedDeviceStatus, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with map semantics require unique keys + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, + func(a *AllocatedDeviceStatus, b *AllocatedDeviceStatus) bool { + return a.Driver == b.Driver && a.Device == b.Device && a.Pool == b.Pool && ((a.ShareID == nil && b.ShareID == nil) || (a.ShareID != nil && b.ShareID != nil && *a.ShareID == *b.ShareID)) + }).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, + func(a *AllocatedDeviceStatus, b *AllocatedDeviceStatus) bool { + return a.Driver == b.Driver && a.Device == b.Device && a.Pool == b.Pool && ((a.ShareID == nil && b.ShareID == nil) || (a.ShareID != nil && b.ShareID != nil && *a.ShareID == *b.ShareID)) + }, validate.SemanticDeepEqual, Validate_AllocatedDeviceStatus); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *ResourceClaimStatus) []AllocatedDeviceStatus { + return oldObj.Devices + }) + errs = append(errs, fn(fldPath.Child("devices"), obj.Devices, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_ResourceClaimTemplateSpec validates an instance of ResourceClaimTemplateSpec according +// to declarative validation rules in the API schema. +func Validate_ResourceClaimTemplateSpec( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *ResourceClaimTemplateSpec) (errs field.ErrorList) { + + // field ResourceClaimTemplateSpec.ObjectMeta has no validation + + { // field ResourceClaimTemplateSpec.Spec + fn := func( + fldPath *field.Path, + obj, oldObj *ResourceClaimSpec, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call the type's validation function + errs = append(errs, Validate_ResourceClaimSpec(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *ResourceClaimTemplateSpec) *ResourceClaimSpec { + return &oldObj.Spec + }) + errs = append(errs, fn(fldPath.Child("spec"), &obj.Spec, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_ResourceSliceSpec validates an instance of ResourceSliceSpec according +// to declarative validation rules in the API schema. +func Validate_ResourceSliceSpec( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *ResourceSliceSpec) (errs field.ErrorList) { + + // field ResourceSliceSpec.Driver has no validation + // field ResourceSliceSpec.Pool has no validation + // field ResourceSliceSpec.NodeName has no validation + // field ResourceSliceSpec.NodeSelector has no validation + // field ResourceSliceSpec.AllNodes has no validation + + { // field ResourceSliceSpec.Devices + fn := func( + fldPath *field.Path, + obj, oldObj []Device, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_Device); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *ResourceSliceSpec) []Device { + return oldObj.Devices + }) + errs = append(errs, fn(fldPath.Child("devices"), obj.Devices, oldVal, oldObj != nil)...) + } + + // field ResourceSliceSpec.PerDeviceNodeSelection has no validation + + { // field ResourceSliceSpec.SharedCounters + fn := func( + fldPath *field.Path, + obj, oldObj []CounterSet, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 8).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with map semantics require unique keys + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, + func(a *CounterSet, b *CounterSet) bool { return a.Name == b.Name }).MarkBeta(); len(e) != 0 { + errs = append(errs, e...) + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, + func(a *CounterSet, b *CounterSet) bool { return a.Name == b.Name }, validate.SemanticDeepEqual, Validate_CounterSet); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *ResourceSliceSpec) []CounterSet { + return oldObj.SharedCounters + }) + errs = append(errs, fn(fldPath.Child("sharedCounters"), obj.SharedCounters, oldVal, oldObj != nil)...) + } + + { // field ResourceSliceSpec.PartitionTypeAttribute + fn := func( + fldPath *field.Path, + obj, oldObj *FullyQualifiedName, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "DRAPartitionableDevicesType", false, validate.ForbiddenPointer).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "DRAPartitionableDevicesType", false, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "DRAPartitionableDevicesType", true, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "DRAPartitionableDevicesType", true, validate.ResourceFullyQualifiedName); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *ResourceSliceSpec) *FullyQualifiedName { + return oldObj.PartitionTypeAttribute + }) + errs = append(errs, fn(fldPath.Child("partitionTypeAttribute"), obj.PartitionTypeAttribute, oldVal, oldObj != nil)...) + } + + { // field ResourceSliceSpec.SkipNodeOperations + fn := func( + fldPath *field.Path, + obj, oldObj []SkipNodeOperation, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with set semantics require unique values + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, validate.DirectEqual); len(e) != 0 { + errs = append(errs, e...) + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, validate.DirectEqual, nil, Validate_SkipNodeOperation); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *ResourceSliceSpec) []SkipNodeOperation { + return oldObj.SkipNodeOperations + }) + errs = append(errs, fn(fldPath.Child("skipNodeOperations"), obj.SkipNodeOperations, oldVal, oldObj != nil)...) + } + + return errs +} + +var symbolsForSkipNodeOperation = sets.New(SkipNodeOperationAll, SkipNodeOperationNodePrepareResources, SkipNodeOperationNodeUnprepareResources) + +// Validate_SkipNodeOperation validates an instance of SkipNodeOperation according +// to declarative validation rules in the API schema. +func Validate_SkipNodeOperation( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *SkipNodeOperation) (errs field.ErrorList) { + + if e := validate.Enum(ctx, op, fldPath, obj, oldObj, symbolsForSkipNodeOperation, nil); len(e) != 0 { + errs = append(errs, e...) + } + + return errs +} diff --git a/vendor/k8s.io/api/resource/v1alpha3/generated.pb.go b/vendor/k8s.io/api/resource/v1alpha3/generated.pb.go index fa1f5f4710..77199b046d 100644 --- a/vendor/k8s.io/api/resource/v1alpha3/generated.pb.go +++ b/vendor/k8s.io/api/resource/v1alpha3/generated.pb.go @@ -24,6 +24,7 @@ import ( io "io" + resource "k8s.io/apimachinery/pkg/api/resource" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" math_bits "math/bits" @@ -47,6 +48,8 @@ func (m *DeviceTaintRuleStatus) Reset() { *m = DeviceTaintRuleStatus{} } func (m *DeviceTaintSelector) Reset() { *m = DeviceTaintSelector{} } +func (m *PartitionTypeStatus) Reset() { *m = PartitionTypeStatus{} } + func (m *PoolStatus) Reset() { *m = PoolStatus{} } func (m *ResourcePoolStatusRequest) Reset() { *m = ResourcePoolStatusRequest{} } @@ -57,6 +60,10 @@ func (m *ResourcePoolStatusRequestSpec) Reset() { *m = ResourcePoolStatusRequest func (m *ResourcePoolStatusRequestStatus) Reset() { *m = ResourcePoolStatusRequestStatus{} } +func (m *ShareableCapacityStatus) Reset() { *m = ShareableCapacityStatus{} } + +func (m *ShareableSummaryStatus) Reset() { *m = ShareableSummaryStatus{} } + func (m *CELDeviceSelector) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -396,6 +403,49 @@ func (m *DeviceTaintSelector) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *PartitionTypeStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PartitionTypeStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PartitionTypeStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Attribute) + copy(dAtA[i:], m.Attribute) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Attribute))) + i-- + dAtA[i] = 0x22 + if m.Allocatable != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.Allocatable)) + i-- + dAtA[i] = 0x18 + } + if m.Total != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.Total)) + i-- + dAtA[i] = 0x10 + } + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *PoolStatus) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -416,6 +466,32 @@ func (m *PoolStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.ShareableSummary != nil { + { + size, err := m.ShareableSummary.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6a + } + if len(m.PartitionSummary) > 0 { + for iNdEx := len(m.PartitionSummary) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PartitionSummary[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + } + } if m.ValidationError != nil { i -= len(*m.ValidationError) copy(dAtA[i:], *m.ValidationError) @@ -593,6 +669,13 @@ func (m *ResourcePoolStatusRequestSpec) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if m.DefaultPartitionTypeAttribute != nil { + i -= len(*m.DefaultPartitionTypeAttribute) + copy(dAtA[i:], *m.DefaultPartitionTypeAttribute) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.DefaultPartitionTypeAttribute))) + i-- + dAtA[i] = 0x22 + } if m.Limit != nil { i = encodeVarintGenerated(dAtA, i, uint64(*m.Limit)) i-- @@ -669,6 +752,117 @@ func (m *ResourcePoolStatusRequestStatus) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } +func (m *ShareableCapacityStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ShareableCapacityStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ShareableCapacityStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Available != nil { + { + size, err := m.Available.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.Consumed != nil { + { + size, err := m.Consumed.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.Total != nil { + { + size, err := m.Total.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ShareableSummaryStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ShareableSummaryStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ShareableSummaryStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Capacity) > 0 { + for iNdEx := len(m.Capacity) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Capacity[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if m.PartiallyAvailableDevices != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.PartiallyAvailableDevices)) + i-- + dAtA[i] = 0x10 + } + if m.FullyAvailableDevices != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.FullyAvailableDevices)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { offset -= sovGenerated(v) base := offset @@ -806,6 +1000,25 @@ func (m *DeviceTaintSelector) Size() (n int) { return n } +func (m *PartitionTypeStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Type) + n += 1 + l + sovGenerated(uint64(l)) + if m.Total != nil { + n += 1 + sovGenerated(uint64(*m.Total)) + } + if m.Allocatable != nil { + n += 1 + sovGenerated(uint64(*m.Allocatable)) + } + l = len(m.Attribute) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + func (m *PoolStatus) Size() (n int) { if m == nil { return 0 @@ -840,6 +1053,16 @@ func (m *PoolStatus) Size() (n int) { l = len(*m.ValidationError) n += 1 + l + sovGenerated(uint64(l)) } + if len(m.PartitionSummary) > 0 { + for _, e := range m.PartitionSummary { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if m.ShareableSummary != nil { + l = m.ShareableSummary.Size() + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -892,6 +1115,10 @@ func (m *ResourcePoolStatusRequestSpec) Size() (n int) { if m.Limit != nil { n += 1 + sovGenerated(uint64(*m.Limit)) } + if m.DefaultPartitionTypeAttribute != nil { + l = len(*m.DefaultPartitionTypeAttribute) + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -919,6 +1146,50 @@ func (m *ResourcePoolStatusRequestStatus) Size() (n int) { return n } +func (m *ShareableCapacityStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if m.Total != nil { + l = m.Total.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Consumed != nil { + l = m.Consumed.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Available != nil { + l = m.Available.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *ShareableSummaryStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.FullyAvailableDevices != nil { + n += 1 + sovGenerated(uint64(*m.FullyAvailableDevices)) + } + if m.PartiallyAvailableDevices != nil { + n += 1 + sovGenerated(uint64(*m.PartiallyAvailableDevices)) + } + if len(m.Capacity) > 0 { + for _, e := range m.Capacity { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + func sovGenerated(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1011,10 +1282,28 @@ func (this *DeviceTaintSelector) String() string { }, "") return s } +func (this *PartitionTypeStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PartitionTypeStatus{`, + `Type:` + fmt.Sprintf("%v", this.Type) + `,`, + `Total:` + valueToStringGenerated(this.Total) + `,`, + `Allocatable:` + valueToStringGenerated(this.Allocatable) + `,`, + `Attribute:` + fmt.Sprintf("%v", this.Attribute) + `,`, + `}`, + }, "") + return s +} func (this *PoolStatus) String() string { if this == nil { return "nil" } + repeatedStringForPartitionSummary := "[]PartitionTypeStatus{" + for _, f := range this.PartitionSummary { + repeatedStringForPartitionSummary += strings.Replace(strings.Replace(f.String(), "PartitionTypeStatus", "PartitionTypeStatus", 1), `&`, ``, 1) + "," + } + repeatedStringForPartitionSummary += "}" s := strings.Join([]string{`&PoolStatus{`, `Driver:` + fmt.Sprintf("%v", this.Driver) + `,`, `PoolName:` + fmt.Sprintf("%v", this.PoolName) + `,`, @@ -1026,6 +1315,8 @@ func (this *PoolStatus) String() string { `ResourceSliceCount:` + valueToStringGenerated(this.ResourceSliceCount) + `,`, `Generation:` + fmt.Sprintf("%v", this.Generation) + `,`, `ValidationError:` + valueToStringGenerated(this.ValidationError) + `,`, + `PartitionSummary:` + repeatedStringForPartitionSummary + `,`, + `ShareableSummary:` + strings.Replace(this.ShareableSummary.String(), "ShareableSummaryStatus", "ShareableSummaryStatus", 1) + `,`, `}`, }, "") return s @@ -1066,6 +1357,7 @@ func (this *ResourcePoolStatusRequestSpec) String() string { `Driver:` + fmt.Sprintf("%v", this.Driver) + `,`, `PoolName:` + valueToStringGenerated(this.PoolName) + `,`, `Limit:` + valueToStringGenerated(this.Limit) + `,`, + `DefaultPartitionTypeAttribute:` + valueToStringGenerated(this.DefaultPartitionTypeAttribute) + `,`, `}`, }, "") return s @@ -1092,6 +1384,36 @@ func (this *ResourcePoolStatusRequestStatus) String() string { }, "") return s } +func (this *ShareableCapacityStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ShareableCapacityStatus{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Total:` + strings.Replace(fmt.Sprintf("%v", this.Total), "Quantity", "resource.Quantity", 1) + `,`, + `Consumed:` + strings.Replace(fmt.Sprintf("%v", this.Consumed), "Quantity", "resource.Quantity", 1) + `,`, + `Available:` + strings.Replace(fmt.Sprintf("%v", this.Available), "Quantity", "resource.Quantity", 1) + `,`, + `}`, + }, "") + return s +} +func (this *ShareableSummaryStatus) String() string { + if this == nil { + return "nil" + } + repeatedStringForCapacity := "[]ShareableCapacityStatus{" + for _, f := range this.Capacity { + repeatedStringForCapacity += strings.Replace(strings.Replace(f.String(), "ShareableCapacityStatus", "ShareableCapacityStatus", 1), `&`, ``, 1) + "," + } + repeatedStringForCapacity += "}" + s := strings.Join([]string{`&ShareableSummaryStatus{`, + `FullyAvailableDevices:` + valueToStringGenerated(this.FullyAvailableDevices) + `,`, + `PartiallyAvailableDevices:` + valueToStringGenerated(this.PartiallyAvailableDevices) + `,`, + `Capacity:` + repeatedStringForCapacity + `,`, + `}`, + }, "") + return s +} func valueToStringGenerated(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -2068,7 +2390,7 @@ func (m *DeviceTaintSelector) Unmarshal(dAtA []byte) error { } return nil } -func (m *PoolStatus) Unmarshal(dAtA []byte) error { +func (m *PartitionTypeStatus) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2091,15 +2413,15 @@ func (m *PoolStatus) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PoolStatus: wiretype end group for non-group") + return fmt.Errorf("proto: PartitionTypeStatus: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PoolStatus: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PartitionTypeStatus: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Driver", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2127,13 +2449,13 @@ func (m *PoolStatus) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Driver = string(dAtA[iNdEx:postIndex]) + m.Type = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PoolName", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) } - var stringLen uint64 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2143,27 +2465,35 @@ func (m *PoolStatus) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated + m.Total = &v + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Allocatable", wireType) } - if postIndex > l { - return io.ErrUnexpectedEOF + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - m.PoolName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: + m.Allocatable = &v + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Attribute", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2191,8 +2521,154 @@ func (m *PoolStatus) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := string(dAtA[iNdEx:postIndex]) - m.NodeName = &s + m.Attribute = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PoolStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PoolStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PoolStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Driver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Driver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PoolName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.NodeName = &s iNdEx = postIndex case 4: if wireType != 0 { @@ -2346,6 +2822,76 @@ func (m *PoolStatus) Unmarshal(dAtA []byte) error { s := string(dAtA[iNdEx:postIndex]) m.ValidationError = &s iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PartitionSummary", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PartitionSummary = append(m.PartitionSummary, PartitionTypeStatus{}) + if err := m.PartitionSummary[len(m.PartitionSummary)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ShareableSummary", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ShareableSummary == nil { + m.ShareableSummary = &ShareableSummaryStatus{} + } + if err := m.ShareableSummary.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -2750,6 +3296,39 @@ func (m *ResourcePoolStatusRequestSpec) Unmarshal(dAtA []byte) error { } } m.Limit = &v + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultPartitionTypeAttribute", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.DefaultPartitionTypeAttribute = &s + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -2909,6 +3488,320 @@ func (m *ResourcePoolStatusRequestStatus) Unmarshal(dAtA []byte) error { } return nil } +func (m *ShareableCapacityStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ShareableCapacityStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ShareableCapacityStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Total == nil { + m.Total = &resource.Quantity{} + } + if err := m.Total.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Consumed", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Consumed == nil { + m.Consumed = &resource.Quantity{} + } + if err := m.Consumed.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Available", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Available == nil { + m.Available = &resource.Quantity{} + } + if err := m.Available.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ShareableSummaryStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ShareableSummaryStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ShareableSummaryStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FullyAvailableDevices", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FullyAvailableDevices = &v + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PartiallyAvailableDevices", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PartiallyAvailableDevices = &v + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Capacity", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Capacity = append(m.Capacity, ShareableCapacityStatus{}) + if err := m.Capacity[len(m.Capacity)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipGenerated(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/vendor/k8s.io/api/resource/v1alpha3/generated.proto b/vendor/k8s.io/api/resource/v1alpha3/generated.proto index d6ee310806..daa969018c 100644 --- a/vendor/k8s.io/api/resource/v1alpha3/generated.proto +++ b/vendor/k8s.io/api/resource/v1alpha3/generated.proto @@ -21,6 +21,7 @@ syntax = "proto2"; package k8s.io.api.resource.v1alpha3; +import "k8s.io/apimachinery/pkg/api/resource/generated.proto"; import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; import "k8s.io/apimachinery/pkg/runtime/generated.proto"; import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; @@ -40,7 +41,7 @@ message CELDeviceSelector { // - driver (string): the name of the driver which defines this device. // - attributes (map[string]object): the device's attributes, grouped by prefix // (e.g. device.attributes["dra.example.com"] evaluates to an object with all - // of the attributes which were prefixed by "dra.example.com". + // of the attributes which were prefixed by "dra.example.com"). // - capacity (map[string]object): the device's capacities, grouped by prefix. // // Example: Consider a device with driver="dra.example.com", which exposes @@ -71,6 +72,15 @@ message CELDeviceSelector { // A robust expression should check for the existence of attributes // before referencing them. // + // Common errors: + // - "no such key": Use optional chaining (.? followed by orValue()) + // or guarding the check with has() for optional fields. + // See CEL Optional Types for details: + // https://pkg.go.dev/github.com/google/cel-go@v0.17.4/cel#OptionalTypes + // + // For more CEL expression syntax and examples, see: + // https://kubernetes.io/docs/reference/using-api/cel/ + // // For ease of use, the cel.bind() function is enabled, and can be used // to simplify expressions that access multiple attributes with the // same domain. For example: @@ -120,7 +130,7 @@ message DeviceTaint { // Consumers must treat unknown effects like None. // // +required - // +k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string effect = 3; // TimeAdded represents the time at which the taint was added or @@ -142,6 +152,7 @@ message DeviceTaint { // DeviceTaintRule adds one taint to all devices which match the selector. // This has the same effect as if the taint was specified directly // in the ResourceSlice by the DRA driver. +// +k8s:supportsSubresource="/status" message DeviceTaintRule { // Standard object metadata // +optional @@ -213,6 +224,9 @@ message DeviceTaintRuleStatus { // +listMapKey=type // +patchStrategy=merge // +patchMergeKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1; } @@ -248,6 +262,40 @@ message DeviceTaintSelector { optional string device = 4; } +// PartitionTypeStatus reports allocatability for a single partition type, +// identified by the value of a grouping attribute. +message PartitionTypeStatus { + // Attribute is the fully qualified name of the device attribute whose value + // groups this entry. It is the PartitionTypeAttribute declared by the + // devices' own slice, or the default named in the request when their slice + // declares none. + // + // +required + // +k8s:required + optional string attribute = 4; + + // Type is the partition type value (e.g. "Full" or "Half"). + // + // +required + // +k8s:required + optional string type = 1; + + // Total is the number of devices of this partition type in the pool. + // + // +required + // +k8s:required + // +k8s:minimum=0 + optional int32 total = 2; + + // Allocatable is the number of additional devices of this partition type + // that could still be allocated given current shared-counter consumption. + // + // +required + // +k8s:required + // +k8s:minimum=0 + optional int32 allocatable = 3; +} + // PoolStatus contains status information for a single resource pool. message PoolStatus { // Driver is the DRA driver name for this pool. @@ -339,6 +387,33 @@ message PoolStatus { // +k8s:optional // +k8s:maxBytes=256 optional string validationError = 10; + + // PartitionSummary reports allocatability per (attribute, partition type) + // for a partitionable pool that publishes SharedCounters. Each entry names + // the grouping attribute it was resolved from: the PartitionTypeAttribute + // declared by a device's own slice, or for devices whose slice declares + // none, the default named in the request. A pool that mixes partitions + // declared under different attributes reports each independently. When no + // slice declares an attribute and the request names no default, the pool + // reports no partition summary. + // + // +optional + // +k8s:optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:unique=map + // +k8s:listMapKey=attribute + // +k8s:listMapKey=type + // +k8s:maxItems=32 + repeated PartitionTypeStatus partitionSummary = 11; + + // ShareableSummary reports aggregate capacity for a pool that contains + // devices with AllowMultipleAllocations. It is populated only when at + // least one device in the pool is shareable. + // + // +optional + // +k8s:optional + optional ShareableSummaryStatus shareableSummary = 13; } // ResourcePoolStatusRequest triggers a one-time calculation of resource pool status @@ -410,6 +485,26 @@ message ResourcePoolStatusRequestSpec { // +k8s:minimum=1 // +k8s:maximum=1000 optional int32 limit = 3; + + // DefaultPartitionTypeAttribute optionally names a device attribute (by its + // fully qualified name, e.g. "gpu.example.com/profile") to use as the default + // grouping attribute for partitionable devices whose slice has not declared + // one themselves. + // + // A slice's own PartitionTypeAttribute always takes precedence. This default + // applies only to devices whose slice does not declare one, so that a request + // can still get an accurate partitionSummary from a driver that has not + // been updated to declare it. When neither the slice nor this default names + // an attribute, a partitionable pool reports no partitionSummary. + // + // Must include the domain qualifier. + // + // +optional + // +featureGate=DRAPartitionableDevicesType + // +k8s:ifDisabled(DRAPartitionableDevicesType)=+k8s:forbidden + // +k8s:ifEnabled(DRAPartitionableDevicesType)=+k8s:optional + // +k8s:ifEnabled(DRAPartitionableDevicesType)=+k8s:format=k8s-resource-fully-qualified-name + optional string defaultPartitionTypeAttribute = 4; } // ResourcePoolStatusRequestStatus contains the calculated pool status information. @@ -446,12 +541,69 @@ message ResourcePoolStatusRequestStatus { // +optional // +k8s:optional // +listType=map - // +k8s:listType=map // +listMapKey=type - // +k8s:listMapKey=type // +patchStrategy=merge // +patchMergeKey=type // +k8s:maxItems=10 + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 3; } +// ShareableCapacityStatus reports aggregate amounts for a single shareable +// capacity key. +message ShareableCapacityStatus { + // Name is the capacity name. + // + // +required + // +k8s:required + optional string name = 1; + + // Total is the sum of this capacity across shareable devices in the pool. + // + // +required + // +k8s:required + optional .k8s.io.apimachinery.pkg.api.resource.Quantity total = 2; + + // Consumed is the amount drawn by current allocations. + // + // +required + // +k8s:required + optional .k8s.io.apimachinery.pkg.api.resource.Quantity consumed = 3; + + // Available is Total minus Consumed, never negative. + // + // +required + // +k8s:required + optional .k8s.io.apimachinery.pkg.api.resource.Quantity available = 4; +} + +// ShareableSummaryStatus reports aggregate capacity for a pool that contains +// devices with AllowMultipleAllocations. +message ShareableSummaryStatus { + // FullyAvailableDevices is the number of shareable devices with no + // capacity consumed. + // + // +required + // +k8s:required + // +k8s:minimum=0 + optional int32 fullyAvailableDevices = 1; + + // PartiallyAvailableDevices is the number of shareable devices with some + // but not all capacity consumed. + // + // +required + // +k8s:required + // +k8s:minimum=0 + optional int32 partiallyAvailableDevices = 2; + + // Capacity reports aggregate total, consumed, and available amounts per + // shareable capacity key across the pool. + // + // +optional + // +k8s:optional + // +listType=atomic + // +k8s:maxItems=32 + repeated ShareableCapacityStatus capacity = 3; +} + diff --git a/vendor/k8s.io/api/resource/v1alpha3/types.go b/vendor/k8s.io/api/resource/v1alpha3/types.go index 1757c86150..8e1e884504 100644 --- a/vendor/k8s.io/api/resource/v1alpha3/types.go +++ b/vendor/k8s.io/api/resource/v1alpha3/types.go @@ -17,6 +17,7 @@ limitations under the License. package v1alpha3 import ( + resource "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -41,7 +42,7 @@ type CELDeviceSelector struct { // - driver (string): the name of the driver which defines this device. // - attributes (map[string]object): the device's attributes, grouped by prefix // (e.g. device.attributes["dra.example.com"] evaluates to an object with all - // of the attributes which were prefixed by "dra.example.com". + // of the attributes which were prefixed by "dra.example.com"). // - capacity (map[string]object): the device's capacities, grouped by prefix. // // Example: Consider a device with driver="dra.example.com", which exposes @@ -72,6 +73,15 @@ type CELDeviceSelector struct { // A robust expression should check for the existence of attributes // before referencing them. // + // Common errors: + // - "no such key": Use optional chaining (.? followed by orValue()) + // or guarding the check with has() for optional fields. + // See CEL Optional Types for details: + // https://pkg.go.dev/github.com/google/cel-go@v0.17.4/cel#OptionalTypes + // + // For more CEL expression syntax and examples, see: + // https://kubernetes.io/docs/reference/using-api/cel/ + // // For ease of use, the cel.bind() function is enabled, and can be used // to simplify expressions that access multiple attributes with the // same domain. For example: @@ -140,7 +150,7 @@ type DeviceTaint struct { // Consumers must treat unknown effects like None. // // +required - // +k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Effect DeviceTaintEffect `json:"effect" protobuf:"bytes,3,name=effect,casttype=DeviceTaintEffect"` // ^^^^ @@ -179,7 +189,7 @@ type DeviceTaint struct { } // +enum -// +k8s:enum +// +k8s:beta(since: "1.37")=+k8s:enum type DeviceTaintEffect string const ( @@ -203,8 +213,9 @@ const ( // DeviceTaintRule adds one taint to all devices which match the selector. // This has the same effect as if the taint was specified directly // in the ResourceSlice by the DRA driver. +// +k8s:supportsSubresource="/status" type DeviceTaintRule struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -322,6 +333,9 @@ type DeviceTaintRuleStatus struct { // +listMapKey=type // +patchStrategy=merge // +patchMergeKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` } @@ -336,7 +350,7 @@ const DeviceTaintConditionEvictionInProgress = "EvictionInProgress" // DeviceTaintRuleList is a collection of DeviceTaintRules. type DeviceTaintRuleList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -355,7 +369,7 @@ type DeviceTaintRuleList struct { // based on the provided filters. Once status is set, the request is considered complete and will not be reprocessed. // Users should delete and recreate requests to get updated information. type ResourcePoolStatusRequest struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata // +required metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -411,6 +425,26 @@ type ResourcePoolStatusRequestSpec struct { // +k8s:minimum=1 // +k8s:maximum=1000 Limit *int32 `json:"limit,omitempty" protobuf:"varint,3,opt,name=limit"` + + // DefaultPartitionTypeAttribute optionally names a device attribute (by its + // fully qualified name, e.g. "gpu.example.com/profile") to use as the default + // grouping attribute for partitionable devices whose slice has not declared + // one themselves. + // + // A slice's own PartitionTypeAttribute always takes precedence. This default + // applies only to devices whose slice does not declare one, so that a request + // can still get an accurate partitionSummary from a driver that has not + // been updated to declare it. When neither the slice nor this default names + // an attribute, a partitionable pool reports no partitionSummary. + // + // Must include the domain qualifier. + // + // +optional + // +featureGate=DRAPartitionableDevicesType + // +k8s:ifDisabled(DRAPartitionableDevicesType)=+k8s:forbidden + // +k8s:ifEnabled(DRAPartitionableDevicesType)=+k8s:optional + // +k8s:ifEnabled(DRAPartitionableDevicesType)=+k8s:format=k8s-resource-fully-qualified-name + DefaultPartitionTypeAttribute *string `json:"defaultPartitionTypeAttribute,omitempty" protobuf:"bytes,4,opt,name=defaultPartitionTypeAttribute"` } // ResourcePoolStatusRequestLimitDefault is the default value for spec.limit. @@ -453,12 +487,12 @@ type ResourcePoolStatusRequestStatus struct { // +optional // +k8s:optional // +listType=map - // +k8s:listType=map // +listMapKey=type - // +k8s:listMapKey=type // +patchStrategy=merge // +patchMergeKey=type // +k8s:maxItems=10 + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,3,rep,name=conditions"` } @@ -553,6 +587,124 @@ type PoolStatus struct { // +k8s:optional // +k8s:maxBytes=256 ValidationError *string `json:"validationError,omitempty" protobuf:"bytes,10,opt,name=validationError"` + + // PartitionSummary reports allocatability per (attribute, partition type) + // for a partitionable pool that publishes SharedCounters. Each entry names + // the grouping attribute it was resolved from: the PartitionTypeAttribute + // declared by a device's own slice, or for devices whose slice declares + // none, the default named in the request. A pool that mixes partitions + // declared under different attributes reports each independently. When no + // slice declares an attribute and the request names no default, the pool + // reports no partition summary. + // + // +optional + // +k8s:optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:unique=map + // +k8s:listMapKey=attribute + // +k8s:listMapKey=type + // +k8s:maxItems=32 + PartitionSummary []PartitionTypeStatus `json:"partitionSummary,omitempty" protobuf:"bytes,11,rep,name=partitionSummary"` + + // ShareableSummary reports aggregate capacity for a pool that contains + // devices with AllowMultipleAllocations. It is populated only when at + // least one device in the pool is shareable. + // + // +optional + // +k8s:optional + ShareableSummary *ShareableSummaryStatus `json:"shareableSummary,omitempty" protobuf:"bytes,13,opt,name=shareableSummary"` +} + +// PartitionTypeStatus reports allocatability for a single partition type, +// identified by the value of a grouping attribute. +type PartitionTypeStatus struct { + // Attribute is the fully qualified name of the device attribute whose value + // groups this entry. It is the PartitionTypeAttribute declared by the + // devices' own slice, or the default named in the request when their slice + // declares none. + // + // +required + // +k8s:required + Attribute string `json:"attribute,omitempty" protobuf:"bytes,4,name=attribute"` + + // Type is the partition type value (e.g. "Full" or "Half"). + // + // +required + // +k8s:required + Type string `json:"type,omitempty" protobuf:"bytes,1,name=type"` + + // Total is the number of devices of this partition type in the pool. + // + // +required + // +k8s:required + // +k8s:minimum=0 + Total *int32 `json:"total,omitempty" protobuf:"varint,2,opt,name=total"` + + // Allocatable is the number of additional devices of this partition type + // that could still be allocated given current shared-counter consumption. + // + // +required + // +k8s:required + // +k8s:minimum=0 + Allocatable *int32 `json:"allocatable,omitempty" protobuf:"varint,3,opt,name=allocatable"` +} + +// ShareableSummaryStatus reports aggregate capacity for a pool that contains +// devices with AllowMultipleAllocations. +type ShareableSummaryStatus struct { + // FullyAvailableDevices is the number of shareable devices with no + // capacity consumed. + // + // +required + // +k8s:required + // +k8s:minimum=0 + FullyAvailableDevices *int32 `json:"fullyAvailableDevices,omitempty" protobuf:"varint,1,opt,name=fullyAvailableDevices"` + + // PartiallyAvailableDevices is the number of shareable devices with some + // but not all capacity consumed. + // + // +required + // +k8s:required + // +k8s:minimum=0 + PartiallyAvailableDevices *int32 `json:"partiallyAvailableDevices,omitempty" protobuf:"varint,2,opt,name=partiallyAvailableDevices"` + + // Capacity reports aggregate total, consumed, and available amounts per + // shareable capacity key across the pool. + // + // +optional + // +k8s:optional + // +listType=atomic + // +k8s:maxItems=32 + Capacity []ShareableCapacityStatus `json:"capacity,omitempty" protobuf:"bytes,3,rep,name=capacity"` +} + +// ShareableCapacityStatus reports aggregate amounts for a single shareable +// capacity key. +type ShareableCapacityStatus struct { + // Name is the capacity name. + // + // +required + // +k8s:required + Name string `json:"name,omitempty" protobuf:"bytes,1,name=name"` + + // Total is the sum of this capacity across shareable devices in the pool. + // + // +required + // +k8s:required + Total *resource.Quantity `json:"total,omitempty" protobuf:"bytes,2,opt,name=total"` + + // Consumed is the amount drawn by current allocations. + // + // +required + // +k8s:required + Consumed *resource.Quantity `json:"consumed,omitempty" protobuf:"bytes,3,opt,name=consumed"` + + // Available is Total minus Consumed, never negative. + // + // +required + // +k8s:required + Available *resource.Quantity `json:"available,omitempty" protobuf:"bytes,4,opt,name=available"` } // ResourcePoolStatusRequestConditionComplete is the condition type for completed requests. @@ -566,7 +718,7 @@ const ResourcePoolStatusRequestConditionFailed = "Failed" // ResourcePoolStatusRequestList is a collection of ResourcePoolStatusRequests. type ResourcePoolStatusRequestList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/vendor/k8s.io/api/resource/v1alpha3/types_swagger_doc_generated.go b/vendor/k8s.io/api/resource/v1alpha3/types_swagger_doc_generated.go index 49ff642fea..4fddc16bc1 100644 --- a/vendor/k8s.io/api/resource/v1alpha3/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/resource/v1alpha3/types_swagger_doc_generated.go @@ -29,7 +29,7 @@ package v1alpha3 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_CELDeviceSelector = map[string]string{ "": "CELDeviceSelector contains a CEL expression for selecting a device.", - "expression": "Expression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort.\n\nThe expression's input is an object named \"device\", which carries the following properties:\n - driver (string): the name of the driver which defines this device.\n - attributes (map[string]object): the device's attributes, grouped by prefix\n (e.g. device.attributes[\"dra.example.com\"] evaluates to an object with all\n of the attributes which were prefixed by \"dra.example.com\".\n - capacity (map[string]object): the device's capacities, grouped by prefix.\n\nExample: Consider a device with driver=\"dra.example.com\", which exposes two attributes named \"model\" and \"ext.example.com/family\" and which exposes one capacity named \"modules\". This input to this expression would have the following fields:\n\n device.driver\n device.attributes[\"dra.example.com\"].model\n device.attributes[\"ext.example.com\"].family\n device.capacity[\"dra.example.com\"].modules\n\nThe device.driver field can be used to check for a specific driver, either as a high-level precondition (i.e. you only want to consider devices from this driver) or as part of a multi-clause expression that is meant to consider devices from different drivers.\n\nThe value type of each attribute is defined by the device definition, and users who write these expressions must consult the documentation for their specific drivers. The value type of each capacity is Quantity.\n\nIf an unknown prefix is used as a lookup in either device.attributes or device.capacity, an empty map will be returned. Any reference to an unknown field will cause an evaluation error and allocation to abort.\n\nA robust expression should check for the existence of attributes before referencing them.\n\nFor ease of use, the cel.bind() function is enabled, and can be used to simplify expressions that access multiple attributes with the same domain. For example:\n\n cel.bind(dra, device.attributes[\"dra.example.com\"], dra.someBool && dra.anotherBool)\n\nThe length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps.", + "expression": "Expression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort.\n\nThe expression's input is an object named \"device\", which carries the following properties:\n - driver (string): the name of the driver which defines this device.\n - attributes (map[string]object): the device's attributes, grouped by prefix\n (e.g. device.attributes[\"dra.example.com\"] evaluates to an object with all\n of the attributes which were prefixed by \"dra.example.com\").\n - capacity (map[string]object): the device's capacities, grouped by prefix.\n\nExample: Consider a device with driver=\"dra.example.com\", which exposes two attributes named \"model\" and \"ext.example.com/family\" and which exposes one capacity named \"modules\". This input to this expression would have the following fields:\n\n device.driver\n device.attributes[\"dra.example.com\"].model\n device.attributes[\"ext.example.com\"].family\n device.capacity[\"dra.example.com\"].modules\n\nThe device.driver field can be used to check for a specific driver, either as a high-level precondition (i.e. you only want to consider devices from this driver) or as part of a multi-clause expression that is meant to consider devices from different drivers.\n\nThe value type of each attribute is defined by the device definition, and users who write these expressions must consult the documentation for their specific drivers. The value type of each capacity is Quantity.\n\nIf an unknown prefix is used as a lookup in either device.attributes or device.capacity, an empty map will be returned. Any reference to an unknown field will cause an evaluation error and allocation to abort.\n\nA robust expression should check for the existence of attributes before referencing them.\n\nCommon errors: - \"no such key\": Use optional chaining (.? followed by orValue())\n or guarding the check with has() for optional fields.\n See CEL Optional Types for details:\n https://pkg.go.dev/github.com/google/cel-go@v0.17.4/cel#OptionalTypes\n\nFor more CEL expression syntax and examples, see: https://kubernetes.io/docs/reference/using-api/cel/\n\nFor ease of use, the cel.bind() function is enabled, and can be used to simplify expressions that access multiple attributes with the same domain. For example:\n\n cel.bind(dra, device.attributes[\"dra.example.com\"], dra.someBool && dra.anotherBool)\n\nThe length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps.", } func (CELDeviceSelector) SwaggerDoc() map[string]string { @@ -108,6 +108,18 @@ func (DeviceTaintSelector) SwaggerDoc() map[string]string { return map_DeviceTaintSelector } +var map_PartitionTypeStatus = map[string]string{ + "": "PartitionTypeStatus reports allocatability for a single partition type, identified by the value of a grouping attribute.", + "attribute": "Attribute is the fully qualified name of the device attribute whose value groups this entry. It is the PartitionTypeAttribute declared by the devices' own slice, or the default named in the request when their slice declares none.", + "type": "Type is the partition type value (e.g. \"Full\" or \"Half\").", + "total": "Total is the number of devices of this partition type in the pool.", + "allocatable": "Allocatable is the number of additional devices of this partition type that could still be allocated given current shared-counter consumption.", +} + +func (PartitionTypeStatus) SwaggerDoc() map[string]string { + return map_PartitionTypeStatus +} + var map_PoolStatus = map[string]string{ "": "PoolStatus contains status information for a single resource pool.", "driver": "Driver is the DRA driver name for this pool. Must be a DNS subdomain (e.g., \"gpu.example.com\").", @@ -120,6 +132,8 @@ var map_PoolStatus = map[string]string{ "unavailableDevices": "UnavailableDevices is the number of devices that are not available due to taints or other conditions, but are not allocated. A value of 0 means all unallocated devices are available. May be unset when validationError is set.", "nodeName": "NodeName is the node this pool is associated with. When omitted, the pool is not associated with a specific node. Must be a valid DNS subdomain name (RFC1123).", "validationError": "ValidationError is set when the pool's data could not be fully validated (e.g., incomplete slice publication). When set, device count fields and ResourceSliceCount may be unset.", + "partitionSummary": "PartitionSummary reports allocatability per (attribute, partition type) for a partitionable pool that publishes SharedCounters. Each entry names the grouping attribute it was resolved from: the PartitionTypeAttribute declared by a device's own slice, or for devices whose slice declares none, the default named in the request. A pool that mixes partitions declared under different attributes reports each independently. When no slice declares an attribute and the request names no default, the pool reports no partition summary.", + "shareableSummary": "ShareableSummary reports aggregate capacity for a pool that contains devices with AllowMultipleAllocations. It is populated only when at least one device in the pool is shareable.", } func (PoolStatus) SwaggerDoc() map[string]string { @@ -148,10 +162,11 @@ func (ResourcePoolStatusRequestList) SwaggerDoc() map[string]string { } var map_ResourcePoolStatusRequestSpec = map[string]string{ - "": "ResourcePoolStatusRequestSpec defines the filters for the pool status request.", - "driver": "Driver specifies the DRA driver name to filter pools. Only pools from ResourceSlices with this driver will be included. Must be a DNS subdomain (e.g., \"gpu.example.com\").", - "poolName": "PoolName optionally filters to a specific pool name. If not specified, all pools from the specified driver are included. When specified, must be a non-empty valid resource pool name (DNS subdomains separated by \"/\").", - "limit": "Limit optionally specifies the maximum number of pools to return in the status. If more pools match the filter criteria, the response will be truncated (i.e., len(status.pools) < status.poolCount).\n\nDefault: 100 Minimum: 1 Maximum: 1000", + "": "ResourcePoolStatusRequestSpec defines the filters for the pool status request.", + "driver": "Driver specifies the DRA driver name to filter pools. Only pools from ResourceSlices with this driver will be included. Must be a DNS subdomain (e.g., \"gpu.example.com\").", + "poolName": "PoolName optionally filters to a specific pool name. If not specified, all pools from the specified driver are included. When specified, must be a non-empty valid resource pool name (DNS subdomains separated by \"/\").", + "limit": "Limit optionally specifies the maximum number of pools to return in the status. If more pools match the filter criteria, the response will be truncated (i.e., len(status.pools) < status.poolCount).\n\nDefault: 100 Minimum: 1 Maximum: 1000", + "defaultPartitionTypeAttribute": "DefaultPartitionTypeAttribute optionally names a device attribute (by its fully qualified name, e.g. \"gpu.example.com/profile\") to use as the default grouping attribute for partitionable devices whose slice has not declared one themselves.\n\nA slice's own PartitionTypeAttribute always takes precedence. This default applies only to devices whose slice does not declare one, so that a request can still get an accurate partitionSummary from a driver that has not been updated to declare it. When neither the slice nor this default names an attribute, a partitionable pool reports no partitionSummary.\n\nMust include the domain qualifier.", } func (ResourcePoolStatusRequestSpec) SwaggerDoc() map[string]string { @@ -169,4 +184,27 @@ func (ResourcePoolStatusRequestStatus) SwaggerDoc() map[string]string { return map_ResourcePoolStatusRequestStatus } +var map_ShareableCapacityStatus = map[string]string{ + "": "ShareableCapacityStatus reports aggregate amounts for a single shareable capacity key.", + "name": "Name is the capacity name.", + "total": "Total is the sum of this capacity across shareable devices in the pool.", + "consumed": "Consumed is the amount drawn by current allocations.", + "available": "Available is Total minus Consumed, never negative.", +} + +func (ShareableCapacityStatus) SwaggerDoc() map[string]string { + return map_ShareableCapacityStatus +} + +var map_ShareableSummaryStatus = map[string]string{ + "": "ShareableSummaryStatus reports aggregate capacity for a pool that contains devices with AllowMultipleAllocations.", + "fullyAvailableDevices": "FullyAvailableDevices is the number of shareable devices with no capacity consumed.", + "partiallyAvailableDevices": "PartiallyAvailableDevices is the number of shareable devices with some but not all capacity consumed.", + "capacity": "Capacity reports aggregate total, consumed, and available amounts per shareable capacity key across the pool.", +} + +func (ShareableSummaryStatus) SwaggerDoc() map[string]string { + return map_ShareableSummaryStatus +} + // AUTO-GENERATED FUNCTIONS END HERE diff --git a/vendor/k8s.io/api/resource/v1alpha3/zz_generated.deepcopy.go b/vendor/k8s.io/api/resource/v1alpha3/zz_generated.deepcopy.go index 32ec2ad8e2..b3ec2e6c78 100644 --- a/vendor/k8s.io/api/resource/v1alpha3/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/resource/v1alpha3/zz_generated.deepcopy.go @@ -220,6 +220,32 @@ func (in *DeviceTaintSelector) DeepCopy() *DeviceTaintSelector { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PartitionTypeStatus) DeepCopyInto(out *PartitionTypeStatus) { + *out = *in + if in.Total != nil { + in, out := &in.Total, &out.Total + *out = new(int32) + **out = **in + } + if in.Allocatable != nil { + in, out := &in.Allocatable, &out.Allocatable + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionTypeStatus. +func (in *PartitionTypeStatus) DeepCopy() *PartitionTypeStatus { + if in == nil { + return nil + } + out := new(PartitionTypeStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PoolStatus) DeepCopyInto(out *PoolStatus) { *out = *in @@ -258,6 +284,18 @@ func (in *PoolStatus) DeepCopyInto(out *PoolStatus) { *out = new(string) **out = **in } + if in.PartitionSummary != nil { + in, out := &in.PartitionSummary, &out.PartitionSummary + *out = make([]PartitionTypeStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ShareableSummary != nil { + in, out := &in.ShareableSummary, &out.ShareableSummary + *out = new(ShareableSummaryStatus) + (*in).DeepCopyInto(*out) + } return } @@ -349,6 +387,11 @@ func (in *ResourcePoolStatusRequestSpec) DeepCopyInto(out *ResourcePoolStatusReq *out = new(int32) **out = **in } + if in.DefaultPartitionTypeAttribute != nil { + in, out := &in.DefaultPartitionTypeAttribute, &out.DefaultPartitionTypeAttribute + *out = new(string) + **out = **in + } return } @@ -396,3 +439,67 @@ func (in *ResourcePoolStatusRequestStatus) DeepCopy() *ResourcePoolStatusRequest in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ShareableCapacityStatus) DeepCopyInto(out *ShareableCapacityStatus) { + *out = *in + if in.Total != nil { + in, out := &in.Total, &out.Total + x := (*in).DeepCopy() + *out = &x + } + if in.Consumed != nil { + in, out := &in.Consumed, &out.Consumed + x := (*in).DeepCopy() + *out = &x + } + if in.Available != nil { + in, out := &in.Available, &out.Available + x := (*in).DeepCopy() + *out = &x + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShareableCapacityStatus. +func (in *ShareableCapacityStatus) DeepCopy() *ShareableCapacityStatus { + if in == nil { + return nil + } + out := new(ShareableCapacityStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ShareableSummaryStatus) DeepCopyInto(out *ShareableSummaryStatus) { + *out = *in + if in.FullyAvailableDevices != nil { + in, out := &in.FullyAvailableDevices, &out.FullyAvailableDevices + *out = new(int32) + **out = **in + } + if in.PartiallyAvailableDevices != nil { + in, out := &in.PartiallyAvailableDevices, &out.PartiallyAvailableDevices + *out = new(int32) + **out = **in + } + if in.Capacity != nil { + in, out := &in.Capacity, &out.Capacity + *out = make([]ShareableCapacityStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShareableSummaryStatus. +func (in *ShareableSummaryStatus) DeepCopy() *ShareableSummaryStatus { + if in == nil { + return nil + } + out := new(ShareableSummaryStatus) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/k8s.io/api/resource/v1alpha3/zz_generated.model_name.go b/vendor/k8s.io/api/resource/v1alpha3/zz_generated.model_name.go index 3ef712c223..255ca1dda5 100644 --- a/vendor/k8s.io/api/resource/v1alpha3/zz_generated.model_name.go +++ b/vendor/k8s.io/api/resource/v1alpha3/zz_generated.model_name.go @@ -61,6 +61,11 @@ func (in DeviceTaintSelector) OpenAPIModelName() string { return "io.k8s.api.resource.v1alpha3.DeviceTaintSelector" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PartitionTypeStatus) OpenAPIModelName() string { + return "io.k8s.api.resource.v1alpha3.PartitionTypeStatus" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in PoolStatus) OpenAPIModelName() string { return "io.k8s.api.resource.v1alpha3.PoolStatus" @@ -85,3 +90,13 @@ func (in ResourcePoolStatusRequestSpec) OpenAPIModelName() string { func (in ResourcePoolStatusRequestStatus) OpenAPIModelName() string { return "io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequestStatus" } + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in ShareableCapacityStatus) OpenAPIModelName() string { + return "io.k8s.api.resource.v1alpha3.ShareableCapacityStatus" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in ShareableSummaryStatus) OpenAPIModelName() string { + return "io.k8s.api.resource.v1alpha3.ShareableSummaryStatus" +} diff --git a/vendor/k8s.io/api/resource/v1beta1/generated.pb.go b/vendor/k8s.io/api/resource/v1beta1/generated.pb.go index 4170f77802..c279e0cc16 100644 --- a/vendor/k8s.io/api/resource/v1beta1/generated.pb.go +++ b/vendor/k8s.io/api/resource/v1beta1/generated.pb.go @@ -84,6 +84,8 @@ func (m *DeviceConstraint) Reset() { *m = DeviceConstraint{} } func (m *DeviceCounterConsumption) Reset() { *m = DeviceCounterConsumption{} } +func (m *DeviceDerivedAttribute) Reset() { *m = DeviceDerivedAttribute{} } + func (m *DeviceRequest) Reset() { *m = DeviceRequest{} } func (m *DeviceRequestAllocationResult) Reset() { *m = DeviceRequestAllocationResult{} } @@ -98,7 +100,11 @@ func (m *DeviceToleration) Reset() { *m = DeviceToleration{} } func (m *NetworkDeviceData) Reset() { *m = NetworkDeviceData{} } -func (m *NodeAllocatableResourceMapping) Reset() { *m = NodeAllocatableResourceMapping{} } +func (m *NodeAllocatableMapping) Reset() { *m = NodeAllocatableMapping{} } + +func (m *NodeAllocatableOverhead) Reset() { *m = NodeAllocatableOverhead{} } + +func (m *NodeAllocatableResource) Reset() { *m = NodeAllocatableResource{} } func (m *OpaqueDeviceConfiguration) Reset() { *m = OpaqueDeviceConfiguration{} } @@ -286,14 +292,14 @@ func (m *BasicDevice) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.NodeAllocatableResourceMappings) > 0 { - keysForNodeAllocatableResourceMappings := make([]string, 0, len(m.NodeAllocatableResourceMappings)) - for k := range m.NodeAllocatableResourceMappings { - keysForNodeAllocatableResourceMappings = append(keysForNodeAllocatableResourceMappings, string(k)) - } - sort.Strings(keysForNodeAllocatableResourceMappings) - for iNdEx := len(keysForNodeAllocatableResourceMappings) - 1; iNdEx >= 0; iNdEx-- { - v := m.NodeAllocatableResourceMappings[k8s_io_api_core_v1.ResourceName(keysForNodeAllocatableResourceMappings[iNdEx])] + if len(m.NodeAllocatableResources) > 0 { + keysForNodeAllocatableResources := make([]string, 0, len(m.NodeAllocatableResources)) + for k := range m.NodeAllocatableResources { + keysForNodeAllocatableResources = append(keysForNodeAllocatableResources, string(k)) + } + sort.Strings(keysForNodeAllocatableResources) + for iNdEx := len(keysForNodeAllocatableResources) - 1; iNdEx >= 0; iNdEx-- { + v := m.NodeAllocatableResources[k8s_io_api_core_v1.ResourceName(keysForNodeAllocatableResources[iNdEx])] baseI := i { size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) @@ -305,14 +311,14 @@ func (m *BasicDevice) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x12 - i -= len(keysForNodeAllocatableResourceMappings[iNdEx]) - copy(dAtA[i:], keysForNodeAllocatableResourceMappings[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(keysForNodeAllocatableResourceMappings[iNdEx]))) + i -= len(keysForNodeAllocatableResources[iNdEx]) + copy(dAtA[i:], keysForNodeAllocatableResources[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(keysForNodeAllocatableResources[iNdEx]))) i-- dAtA[i] = 0xa i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) i-- - dAtA[i] = 0x62 + dAtA[i] = 0x72 } } if m.AllowMultipleAllocations != nil { @@ -1422,6 +1428,15 @@ func (m *DeviceCounterConsumption) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l + if len(m.CompatibilityGroups) > 0 { + for iNdEx := len(m.CompatibilityGroups) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.CompatibilityGroups[iNdEx]) + copy(dAtA[i:], m.CompatibilityGroups[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.CompatibilityGroups[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } if len(m.Counters) > 0 { keysForCounters := make([]string, 0, len(m.Counters)) for k := range m.Counters { @@ -1459,6 +1474,39 @@ func (m *DeviceCounterConsumption) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *DeviceDerivedAttribute) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeviceDerivedAttribute) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeviceDerivedAttribute) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Expression) + copy(dAtA[i:], m.Expression) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Expression))) + i-- + dAtA[i] = 0x12 + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *DeviceRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1479,6 +1527,20 @@ func (m *DeviceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.DerivedAttributes) > 0 { + for iNdEx := len(m.DerivedAttributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DerivedAttributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + } + } if m.Capacity != nil { { size, err := m.Capacity.MarshalToSizedBuffer(dAtA[:i]) @@ -1584,6 +1646,15 @@ func (m *DeviceRequestAllocationResult) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if len(m.SkipNodeOperations) > 0 { + for iNdEx := len(m.SkipNodeOperations) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.SkipNodeOperations[iNdEx]) + copy(dAtA[i:], m.SkipNodeOperations[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.SkipNodeOperations[iNdEx]))) + i-- + dAtA[i] = 0x5a + } + } if len(m.ConsumedCapacity) > 0 { keysForConsumedCapacity := make([]string, 0, len(m.ConsumedCapacity)) for k := range m.ConsumedCapacity { @@ -1740,6 +1811,20 @@ func (m *DeviceSubRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.DerivedAttributes) > 0 { + for iNdEx := len(m.DerivedAttributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DerivedAttributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + } if m.Capacity != nil { { size, err := m.Capacity.MarshalToSizedBuffer(dAtA[:i]) @@ -1941,7 +2026,7 @@ func (m *NetworkDeviceData) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *NodeAllocatableResourceMapping) Marshal() (dAtA []byte, err error) { +func (m *NodeAllocatableMapping) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1951,19 +2036,31 @@ func (m *NodeAllocatableResourceMapping) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *NodeAllocatableResourceMapping) MarshalTo(dAtA []byte) (int, error) { +func (m *NodeAllocatableMapping) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *NodeAllocatableResourceMapping) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *NodeAllocatableMapping) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.AllocationMultiplier != nil { + if m.DeviceMultiplier != nil { + { + size, err := m.DeviceMultiplier.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.CapacityMultiplier != nil { { - size, err := m.AllocationMultiplier.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.CapacityMultiplier.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1983,6 +2080,100 @@ func (m *NodeAllocatableResourceMapping) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } +func (m *NodeAllocatableOverhead) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeAllocatableOverhead) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeAllocatableOverhead) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PerContainer != nil { + { + size, err := m.PerContainer.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.PerPod != nil { + { + size, err := m.PerPod.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NodeAllocatableResource) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeAllocatableResource) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeAllocatableResource) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Overhead != nil { + { + size, err := m.Overhead.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.Mapping != nil { + { + size, err := m.Mapping.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} + func (m *OpaqueDeviceConfiguration) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2537,6 +2728,22 @@ func (m *ResourceSliceSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.SkipNodeOperations) > 0 { + for iNdEx := len(m.SkipNodeOperations) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.SkipNodeOperations[iNdEx]) + copy(dAtA[i:], m.SkipNodeOperations[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.SkipNodeOperations[iNdEx]))) + i-- + dAtA[i] = 0x52 + } + } + if m.PartitionTypeAttribute != nil { + i -= len(*m.PartitionTypeAttribute) + copy(dAtA[i:], *m.PartitionTypeAttribute) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PartitionTypeAttribute))) + i-- + dAtA[i] = 0x4a + } if len(m.SharedCounters) > 0 { for iNdEx := len(m.SharedCounters) - 1; iNdEx >= 0; iNdEx-- { { @@ -2746,8 +2953,8 @@ func (m *BasicDevice) Size() (n int) { if m.AllowMultipleAllocations != nil { n += 2 } - if len(m.NodeAllocatableResourceMappings) > 0 { - for k, v := range m.NodeAllocatableResourceMappings { + if len(m.NodeAllocatableResources) > 0 { + for k, v := range m.NodeAllocatableResources { _ = k _ = v l = v.Size() @@ -3138,6 +3345,25 @@ func (m *DeviceCounterConsumption) Size() (n int) { n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) } } + if len(m.CompatibilityGroups) > 0 { + for _, s := range m.CompatibilityGroups { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *DeviceDerivedAttribute) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Expression) + n += 1 + l + sovGenerated(uint64(l)) return n } @@ -3179,6 +3405,12 @@ func (m *DeviceRequest) Size() (n int) { l = m.Capacity.Size() n += 1 + l + sovGenerated(uint64(l)) } + if len(m.DerivedAttributes) > 0 { + for _, e := range m.DerivedAttributes { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } return n } @@ -3230,6 +3462,12 @@ func (m *DeviceRequestAllocationResult) Size() (n int) { n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) } } + if len(m.SkipNodeOperations) > 0 { + for _, s := range m.SkipNodeOperations { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } return n } @@ -3275,6 +3513,12 @@ func (m *DeviceSubRequest) Size() (n int) { l = m.Capacity.Size() n += 1 + l + sovGenerated(uint64(l)) } + if len(m.DerivedAttributes) > 0 { + for _, e := range m.DerivedAttributes { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } return n } @@ -3336,7 +3580,7 @@ func (m *NetworkDeviceData) Size() (n int) { return n } -func (m *NodeAllocatableResourceMapping) Size() (n int) { +func (m *NodeAllocatableMapping) Size() (n int) { if m == nil { return 0 } @@ -3346,8 +3590,46 @@ func (m *NodeAllocatableResourceMapping) Size() (n int) { l = len(*m.CapacityKey) n += 1 + l + sovGenerated(uint64(l)) } - if m.AllocationMultiplier != nil { - l = m.AllocationMultiplier.Size() + if m.CapacityMultiplier != nil { + l = m.CapacityMultiplier.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.DeviceMultiplier != nil { + l = m.DeviceMultiplier.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *NodeAllocatableOverhead) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PerPod != nil { + l = m.PerPod.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.PerContainer != nil { + l = m.PerContainer.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *NodeAllocatableResource) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Mapping != nil { + l = m.Mapping.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Overhead != nil { + l = m.Overhead.Size() n += 1 + l + sovGenerated(uint64(l)) } return n @@ -3569,6 +3851,16 @@ func (m *ResourceSliceSpec) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) } } + if m.PartitionTypeAttribute != nil { + l = len(*m.PartitionTypeAttribute) + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.SkipNodeOperations) > 0 { + for _, s := range m.SkipNodeOperations { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } return n } @@ -3645,16 +3937,16 @@ func (this *BasicDevice) String() string { mapStringForCapacity += fmt.Sprintf("%v: %v,", k, this.Capacity[QualifiedName(k)]) } mapStringForCapacity += "}" - keysForNodeAllocatableResourceMappings := make([]string, 0, len(this.NodeAllocatableResourceMappings)) - for k := range this.NodeAllocatableResourceMappings { - keysForNodeAllocatableResourceMappings = append(keysForNodeAllocatableResourceMappings, string(k)) + keysForNodeAllocatableResources := make([]string, 0, len(this.NodeAllocatableResources)) + for k := range this.NodeAllocatableResources { + keysForNodeAllocatableResources = append(keysForNodeAllocatableResources, string(k)) } - sort.Strings(keysForNodeAllocatableResourceMappings) - mapStringForNodeAllocatableResourceMappings := "map[k8s_io_api_core_v1.ResourceName]NodeAllocatableResourceMapping{" - for _, k := range keysForNodeAllocatableResourceMappings { - mapStringForNodeAllocatableResourceMappings += fmt.Sprintf("%v: %v,", k, this.NodeAllocatableResourceMappings[k8s_io_api_core_v1.ResourceName(k)]) + sort.Strings(keysForNodeAllocatableResources) + mapStringForNodeAllocatableResources := "map[k8s_io_api_core_v1.ResourceName]NodeAllocatableResource{" + for _, k := range keysForNodeAllocatableResources { + mapStringForNodeAllocatableResources += fmt.Sprintf("%v: %v,", k, this.NodeAllocatableResources[k8s_io_api_core_v1.ResourceName(k)]) } - mapStringForNodeAllocatableResourceMappings += "}" + mapStringForNodeAllocatableResources += "}" s := strings.Join([]string{`&BasicDevice{`, `Attributes:` + mapStringForAttributes + `,`, `Capacity:` + mapStringForCapacity + `,`, @@ -3667,7 +3959,7 @@ func (this *BasicDevice) String() string { `BindingConditions:` + fmt.Sprintf("%v", this.BindingConditions) + `,`, `BindingFailureConditions:` + fmt.Sprintf("%v", this.BindingFailureConditions) + `,`, `AllowMultipleAllocations:` + valueToStringGenerated(this.AllowMultipleAllocations) + `,`, - `NodeAllocatableResourceMappings:` + mapStringForNodeAllocatableResourceMappings + `,`, + `NodeAllocatableResources:` + mapStringForNodeAllocatableResources + `,`, `}`, }, "") return s @@ -3970,6 +4262,18 @@ func (this *DeviceCounterConsumption) String() string { s := strings.Join([]string{`&DeviceCounterConsumption{`, `CounterSet:` + fmt.Sprintf("%v", this.CounterSet) + `,`, `Counters:` + mapStringForCounters + `,`, + `CompatibilityGroups:` + fmt.Sprintf("%v", this.CompatibilityGroups) + `,`, + `}`, + }, "") + return s +} +func (this *DeviceDerivedAttribute) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeviceDerivedAttribute{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Expression:` + fmt.Sprintf("%v", this.Expression) + `,`, `}`, }, "") return s @@ -3993,6 +4297,11 @@ func (this *DeviceRequest) String() string { repeatedStringForTolerations += strings.Replace(strings.Replace(f.String(), "DeviceToleration", "DeviceToleration", 1), `&`, ``, 1) + "," } repeatedStringForTolerations += "}" + repeatedStringForDerivedAttributes := "[]DeviceDerivedAttribute{" + for _, f := range this.DerivedAttributes { + repeatedStringForDerivedAttributes += strings.Replace(strings.Replace(f.String(), "DeviceDerivedAttribute", "DeviceDerivedAttribute", 1), `&`, ``, 1) + "," + } + repeatedStringForDerivedAttributes += "}" s := strings.Join([]string{`&DeviceRequest{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `DeviceClassName:` + fmt.Sprintf("%v", this.DeviceClassName) + `,`, @@ -4003,6 +4312,7 @@ func (this *DeviceRequest) String() string { `FirstAvailable:` + repeatedStringForFirstAvailable + `,`, `Tolerations:` + repeatedStringForTolerations + `,`, `Capacity:` + strings.Replace(this.Capacity.String(), "CapacityRequirements", "CapacityRequirements", 1) + `,`, + `DerivedAttributes:` + repeatedStringForDerivedAttributes + `,`, `}`, }, "") return s @@ -4037,6 +4347,7 @@ func (this *DeviceRequestAllocationResult) String() string { `BindingFailureConditions:` + fmt.Sprintf("%v", this.BindingFailureConditions) + `,`, `ShareID:` + valueToStringGenerated(this.ShareID) + `,`, `ConsumedCapacity:` + mapStringForConsumedCapacity + `,`, + `SkipNodeOperations:` + fmt.Sprintf("%v", this.SkipNodeOperations) + `,`, `}`, }, "") return s @@ -4065,6 +4376,11 @@ func (this *DeviceSubRequest) String() string { repeatedStringForTolerations += strings.Replace(strings.Replace(f.String(), "DeviceToleration", "DeviceToleration", 1), `&`, ``, 1) + "," } repeatedStringForTolerations += "}" + repeatedStringForDerivedAttributes := "[]DeviceDerivedAttribute{" + for _, f := range this.DerivedAttributes { + repeatedStringForDerivedAttributes += strings.Replace(strings.Replace(f.String(), "DeviceDerivedAttribute", "DeviceDerivedAttribute", 1), `&`, ``, 1) + "," + } + repeatedStringForDerivedAttributes += "}" s := strings.Join([]string{`&DeviceSubRequest{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `DeviceClassName:` + fmt.Sprintf("%v", this.DeviceClassName) + `,`, @@ -4073,6 +4389,7 @@ func (this *DeviceSubRequest) String() string { `Count:` + fmt.Sprintf("%v", this.Count) + `,`, `Tolerations:` + repeatedStringForTolerations + `,`, `Capacity:` + strings.Replace(this.Capacity.String(), "CapacityRequirements", "CapacityRequirements", 1) + `,`, + `DerivedAttributes:` + repeatedStringForDerivedAttributes + `,`, `}`, }, "") return s @@ -4103,13 +4420,36 @@ func (this *NetworkDeviceData) String() string { }, "") return s } -func (this *NodeAllocatableResourceMapping) String() string { +func (this *NodeAllocatableMapping) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&NodeAllocatableResourceMapping{`, + s := strings.Join([]string{`&NodeAllocatableMapping{`, `CapacityKey:` + valueToStringGenerated(this.CapacityKey) + `,`, - `AllocationMultiplier:` + strings.Replace(fmt.Sprintf("%v", this.AllocationMultiplier), "Quantity", "resource.Quantity", 1) + `,`, + `CapacityMultiplier:` + strings.Replace(fmt.Sprintf("%v", this.CapacityMultiplier), "Quantity", "resource.Quantity", 1) + `,`, + `DeviceMultiplier:` + strings.Replace(fmt.Sprintf("%v", this.DeviceMultiplier), "Quantity", "resource.Quantity", 1) + `,`, + `}`, + }, "") + return s +} +func (this *NodeAllocatableOverhead) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NodeAllocatableOverhead{`, + `PerPod:` + strings.Replace(fmt.Sprintf("%v", this.PerPod), "Quantity", "resource.Quantity", 1) + `,`, + `PerContainer:` + strings.Replace(fmt.Sprintf("%v", this.PerContainer), "Quantity", "resource.Quantity", 1) + `,`, + `}`, + }, "") + return s +} +func (this *NodeAllocatableResource) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NodeAllocatableResource{`, + `Mapping:` + strings.Replace(this.Mapping.String(), "NodeAllocatableMapping", "NodeAllocatableMapping", 1) + `,`, + `Overhead:` + strings.Replace(this.Overhead.String(), "NodeAllocatableOverhead", "NodeAllocatableOverhead", 1) + `,`, `}`, }, "") return s @@ -4298,6 +4638,8 @@ func (this *ResourceSliceSpec) String() string { `Devices:` + repeatedStringForDevices + `,`, `PerDeviceNodeSelection:` + valueToStringGenerated(this.PerDeviceNodeSelection) + `,`, `SharedCounters:` + repeatedStringForSharedCounters + `,`, + `PartitionTypeAttribute:` + valueToStringGenerated(this.PartitionTypeAttribute) + `,`, + `SkipNodeOperations:` + fmt.Sprintf("%v", this.SkipNodeOperations) + `,`, `}`, }, "") return s @@ -5301,9 +5643,9 @@ func (m *BasicDevice) Unmarshal(dAtA []byte) error { } b := bool(v != 0) m.AllowMultipleAllocations = &b - case 12: + case 14: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeAllocatableResourceMappings", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NodeAllocatableResources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5330,11 +5672,11 @@ func (m *BasicDevice) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.NodeAllocatableResourceMappings == nil { - m.NodeAllocatableResourceMappings = make(map[k8s_io_api_core_v1.ResourceName]NodeAllocatableResourceMapping) + if m.NodeAllocatableResources == nil { + m.NodeAllocatableResources = make(map[k8s_io_api_core_v1.ResourceName]NodeAllocatableResource) } var mapkey k8s_io_api_core_v1.ResourceName - mapvalue := &NodeAllocatableResourceMapping{} + mapvalue := &NodeAllocatableResource{} for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 @@ -5408,7 +5750,7 @@ func (m *BasicDevice) Unmarshal(dAtA []byte) error { if postmsgIndex > l { return io.ErrUnexpectedEOF } - mapvalue = &NodeAllocatableResourceMapping{} + mapvalue = &NodeAllocatableResource{} if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { return err } @@ -5428,7 +5770,7 @@ func (m *BasicDevice) Unmarshal(dAtA []byte) error { iNdEx += skippy } } - m.NodeAllocatableResourceMappings[k8s_io_api_core_v1.ResourceName(mapkey)] = *mapvalue + m.NodeAllocatableResources[k8s_io_api_core_v1.ResourceName(mapkey)] = *mapvalue iNdEx = postIndex default: iNdEx = preIndex @@ -8347,17 +8689,163 @@ func (m *DeviceCounterConsumption) Unmarshal(dAtA []byte) error { } m.Counters[mapkey] = *mapvalue iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompatibilityGroups", wireType) } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CompatibilityGroups = append(m.CompatibilityGroups, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceDerivedAttribute) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceDerivedAttribute: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceDerivedAttribute: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = FullyQualifiedName(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Expression", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Expression = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } iNdEx += skippy } @@ -8671,6 +9159,40 @@ func (m *DeviceRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DerivedAttributes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DerivedAttributes = append(m.DerivedAttributes, DeviceDerivedAttribute{}) + if err := m.DerivedAttributes[len(m.DerivedAttributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -9130,6 +9652,38 @@ func (m *DeviceRequestAllocationResult) Unmarshal(dAtA []byte) error { } m.ConsumedCapacity[QualifiedName(mapkey)] = *mapvalue iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SkipNodeOperations", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SkipNodeOperations = append(m.SkipNodeOperations, SkipNodeOperation(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -9485,6 +10039,40 @@ func (m *DeviceSubRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DerivedAttributes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DerivedAttributes = append(m.DerivedAttributes, DeviceDerivedAttribute{}) + if err := m.DerivedAttributes[len(m.DerivedAttributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -9569,7 +10157,355 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Effect", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Effect = DeviceTaintEffect(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeAdded", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TimeAdded == nil { + m.TimeAdded = &v1.Time{} + } + if err := m.TimeAdded.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceToleration) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceToleration: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceToleration: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Operator = DeviceTolerationOperator(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Effect", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Effect = DeviceTaintEffect(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TolerationSeconds", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.TolerationSeconds = &v + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NetworkDeviceData) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NetworkDeviceData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NetworkDeviceData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InterfaceName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -9597,11 +10533,11 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Value = string(dAtA[iNdEx:postIndex]) + m.InterfaceName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Effect", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field IPs", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -9629,13 +10565,13 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Effect = DeviceTaintEffect(dAtA[iNdEx:postIndex]) + m.IPs = append(m.IPs, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 4: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeAdded", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field HardwareAddress", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -9645,27 +10581,23 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if m.TimeAdded == nil { - m.TimeAdded = &v1.Time{} - } - if err := m.TimeAdded.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.HardwareAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -9688,7 +10620,7 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceToleration) Unmarshal(dAtA []byte) error { +func (m *NodeAllocatableMapping) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9711,15 +10643,15 @@ func (m *DeviceToleration) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceToleration: wiretype end group for non-group") + return fmt.Errorf("proto: NodeAllocatableMapping: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceToleration: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NodeAllocatableMapping: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CapacityKey", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -9747,13 +10679,14 @@ func (m *DeviceToleration) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Key = string(dAtA[iNdEx:postIndex]) + s := QualifiedName(dAtA[iNdEx:postIndex]) + m.CapacityKey = &s iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CapacityMultiplier", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -9763,61 +10696,33 @@ func (m *DeviceToleration) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Operator = DeviceTolerationOperator(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated + if m.CapacityMultiplier == nil { + m.CapacityMultiplier = &resource.Quantity{} } - if postIndex > l { - return io.ErrUnexpectedEOF + if err := m.CapacityMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.Value = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Effect", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DeviceMultiplier", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -9827,44 +10732,28 @@ func (m *DeviceToleration) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Effect = DeviceTaintEffect(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TolerationSeconds", wireType) + if m.DeviceMultiplier == nil { + m.DeviceMultiplier = &resource.Quantity{} } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } + if err := m.DeviceMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.TolerationSeconds = &v + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -9886,7 +10775,7 @@ func (m *DeviceToleration) Unmarshal(dAtA []byte) error { } return nil } -func (m *NetworkDeviceData) Unmarshal(dAtA []byte) error { +func (m *NodeAllocatableOverhead) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9909,17 +10798,17 @@ func (m *NetworkDeviceData) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: NetworkDeviceData: wiretype end group for non-group") + return fmt.Errorf("proto: NodeAllocatableOverhead: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: NetworkDeviceData: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NodeAllocatableOverhead: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InterfaceName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PerPod", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -9929,29 +10818,33 @@ func (m *NetworkDeviceData) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.InterfaceName = string(dAtA[iNdEx:postIndex]) + if m.PerPod == nil { + m.PerPod = &resource.Quantity{} + } + if err := m.PerPod.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IPs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PerContainer", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -9961,55 +10854,27 @@ func (m *NetworkDeviceData) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.IPs = append(m.IPs, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HardwareAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated + if m.PerContainer == nil { + m.PerContainer = &resource.Quantity{} } - if postIndex > l { - return io.ErrUnexpectedEOF + if err := m.PerContainer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.HardwareAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -10032,7 +10897,7 @@ func (m *NetworkDeviceData) Unmarshal(dAtA []byte) error { } return nil } -func (m *NodeAllocatableResourceMapping) Unmarshal(dAtA []byte) error { +func (m *NodeAllocatableResource) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -10055,17 +10920,17 @@ func (m *NodeAllocatableResourceMapping) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: NodeAllocatableResourceMapping: wiretype end group for non-group") + return fmt.Errorf("proto: NodeAllocatableResource: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: NodeAllocatableResourceMapping: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NodeAllocatableResource: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CapacityKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Mapping", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -10075,28 +10940,31 @@ func (m *NodeAllocatableResourceMapping) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - s := QualifiedName(dAtA[iNdEx:postIndex]) - m.CapacityKey = &s + if m.Mapping == nil { + m.Mapping = &NodeAllocatableMapping{} + } + if err := m.Mapping.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 2: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AllocationMultiplier", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Overhead", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -10123,10 +10991,10 @@ func (m *NodeAllocatableResourceMapping) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.AllocationMultiplier == nil { - m.AllocationMultiplier = &resource.Quantity{} + if m.Overhead == nil { + m.Overhead = &NodeAllocatableOverhead{} } - if err := m.AllocationMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Overhead.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -11920,6 +12788,71 @@ func (m *ResourceSliceSpec) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PartitionTypeAttribute", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := FullyQualifiedName(dAtA[iNdEx:postIndex]) + m.PartitionTypeAttribute = &s + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SkipNodeOperations", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SkipNodeOperations = append(m.SkipNodeOperations, SkipNodeOperation(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/vendor/k8s.io/api/resource/v1beta1/generated.proto b/vendor/k8s.io/api/resource/v1beta1/generated.proto index 79a51ee2c8..874a34db39 100644 --- a/vendor/k8s.io/api/resource/v1beta1/generated.proto +++ b/vendor/k8s.io/api/resource/v1beta1/generated.proto @@ -65,8 +65,8 @@ message AllocatedDeviceStatus { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-uuid optional string shareID = 7; // Conditions contains the latest observation of the device's state. @@ -78,6 +78,9 @@ message AllocatedDeviceStatus { // +optional // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 4; // Data contains arbitrary driver-specific data. @@ -90,7 +93,7 @@ message AllocatedDeviceStatus { // NetworkData contains network-related information specific to the device. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional NetworkDeviceData networkData = 6; } @@ -126,7 +129,7 @@ message BasicDevice { // The maximum number of attributes and capacities combined is 32. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional map attributes = 1; // Capacity defines the set of capacities for this device. @@ -147,13 +150,13 @@ message BasicDevice { // device is 2. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=counterSet + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=counterSet // +featureGate=DRAPartitionableDevices - // +k8s:alpha(since: "1.36")=+k8s:maxItems=2 + // +k8s:beta(since: "1.37")=+k8s:maxItems=2 repeated DeviceCounterConsumption consumesCounters = 3; // NodeName identifies the node where the device is available. @@ -199,7 +202,7 @@ message BasicDevice { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated DeviceTaint taints = 7; // BindsToNode indicates if the usage of an allocation involving this device @@ -229,8 +232,8 @@ message BasicDevice { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 repeated string bindingConditions = 9; // BindingFailureConditions defines the conditions for binding failure. @@ -247,8 +250,8 @@ message BasicDevice { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 repeated string bindingFailureConditions = 10; // AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests. @@ -260,7 +263,7 @@ message BasicDevice { // +featureGate=DRAConsumableCapacity optional bool allowMultipleAllocations = 11; - // NodeAllocatableResourceMappings defines the mapping of node resources + // NodeAllocatableResources defines the mapping of node resources // that are managed by the DRA driver exposing this device. This includes resources currently // reported in v1.Node `status.allocatable` that are not extended resources // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). @@ -272,8 +275,9 @@ message BasicDevice { // The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). // Extended resource names are not permitted as keys. // +optional + // +k8s:optional // +featureGate=DRANodeAllocatableResources - map nodeAllocatableResourceMappings = 12; + map nodeAllocatableResources = 14; } // CELDeviceSelector contains a CEL expression for selecting a device. @@ -288,7 +292,7 @@ message CELDeviceSelector { // - driver (string): the name of the driver which defines this device. // - attributes (map[string]object): the device's attributes, grouped by prefix // (e.g. device.attributes["dra.example.com"] evaluates to an object with all - // of the attributes which were prefixed by "dra.example.com". + // of the attributes which were prefixed by "dra.example.com"). // - capacity (map[string]object): the device's capacities, grouped by prefix. // - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device // (v1.34+ with the DRAConsumableCapacity feature enabled). @@ -321,6 +325,15 @@ message CELDeviceSelector { // A robust expression should check for the existence of attributes // before referencing them. // + // Common errors: + // - "no such key": Use optional chaining (.? followed by orValue()) + // or guarding the check with has() for optional fields. + // See CEL Optional Types for details: + // https://pkg.go.dev/github.com/google/cel-go@v0.17.4/cel#OptionalTypes + // + // For more CEL expression syntax and examples, see: + // https://kubernetes.io/docs/reference/using-api/cel/ + // // For ease of use, the cel.bind() function is enabled, and can be used // to simplify expressions that access multiple attributes with the // same domain. For example: @@ -390,6 +403,13 @@ message CapacityRequestPolicy { // CapacityRequestPolicyRange defines a valid range for consumable capacity values. // +// If the DRAFractionalCapacityRange feature gate is +// enabled and at least one of Min, Max, or Step is a fractional quantity (i.e. +// its value is not an integer), milli-unit arithmetic is used instead, +// supporting values with up to 3 decimal places (e.g. 100m = 0.1). +// The largest supported value then is 1000 times smaller compared to using 64-bit integers. +// Otherwise, all comparisons use 64-bit integer arithmetic via resource.Quantity.Value(). +// // - If the requested amount is less than Min, it is rounded up to the Min value. // - If Step is set and the requested amount is between Min and Max but not aligned with Step, // it will be rounded up to the next value equal to Min + (n * Step). @@ -473,8 +493,8 @@ message CounterSet { // It must be a DNS label. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-short-name optional string name = 1; // Counters defines the set of counters for this CounterSet @@ -483,8 +503,8 @@ message CounterSet { // The maximum number of counters is 32. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:eachKey=+k8s:format=k8s-short-name map counters = 2; } @@ -501,7 +521,7 @@ message Device { // // +optional // +oneOf=deviceType - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional BasicDevice basic = 2; } @@ -512,7 +532,7 @@ message DeviceAllocationConfiguration { // or from a claim. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string source = 1; // Requests lists the names of requests where the configuration applies. @@ -524,10 +544,10 @@ message DeviceAllocationConfiguration { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated string requests = 2; optional DeviceConfiguration deviceConfiguration = 3; @@ -539,8 +559,8 @@ message DeviceAllocationResult { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceRequestAllocationResult results = 1; // This field is a combination of all the claim and class configuration parameters. @@ -553,8 +573,8 @@ message DeviceAllocationResult { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=64 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=64 repeated DeviceAllocationConfiguration config = 2; } @@ -563,30 +583,30 @@ message DeviceAttribute { // IntValue is a number. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember optional int64 int = 2; // BoolValue is a true/false value. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember optional bool bool = 3; // StringValue is a string. Must not be longer than 64 characters. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember optional string string = 4; // VersionValue is a semantic version according to semver.org spec 2.0.0. // Must not be longer than 64 characters. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember optional string version = 5; // IntValues is a non-empty list of numbers. @@ -595,8 +615,8 @@ message DeviceAttribute { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember // +featureGate=DRAListTypeAttributes repeated int64 ints = 6; @@ -604,8 +624,8 @@ message DeviceAttribute { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember // +featureGate=DRAListTypeAttributes repeated bool bools = 7; @@ -616,8 +636,9 @@ message DeviceAttribute { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember + // +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:maxBytes=64 // +featureGate=DRAListTypeAttributes repeated string strings = 8; @@ -628,8 +649,8 @@ message DeviceAttribute { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember // +featureGate=DRAListTypeAttributes repeated string versions = 9; } @@ -667,11 +688,11 @@ message DeviceClaim { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=name + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceRequest requests = 1; // These constraints must be satisfied by the set of devices that get @@ -679,8 +700,8 @@ message DeviceClaim { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceConstraint constraints = 2; // This field holds configuration for multiple potential drivers which @@ -689,8 +710,8 @@ message DeviceClaim { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceClaimConfiguration config = 3; } @@ -705,10 +726,10 @@ message DeviceClaimConfiguration { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated string requests = 1; optional DeviceConfiguration deviceConfiguration = 2; @@ -724,8 +745,8 @@ message DeviceClaimConfiguration { message DeviceClass { // Standard object metadata // +optional - // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:format=k8s-long-name + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:format=k8s-long-name optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Spec defines what can be allocated and how to configure it. @@ -736,6 +757,7 @@ message DeviceClass { // the time of allocation. // // Changing the spec automatically increments the metadata.generation number. + // +optional optional DeviceClassSpec spec = 2; } @@ -761,8 +783,8 @@ message DeviceClassSpec { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceSelector selectors = 1; // Config defines configuration parameters that apply to each device that is claimed via this class. @@ -773,8 +795,8 @@ message DeviceClassSpec { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceClassConfiguration config = 2; // ExtendedResourceName is the extended resource name for the devices of this class. @@ -786,11 +808,10 @@ message DeviceClassSpec { // If two classes are created at the same time, then the name of the class // lexicographically sorted first is picked. // - // This is a beta field. // +optional // +featureGate=DRAExtendedResource - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-extended-resource-name + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-extended-resource-name optional string extendedResourceName = 4; } @@ -802,7 +823,7 @@ message DeviceConfiguration { // // +optional // +oneOf=ConfigurationType - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional OpaqueDeviceConfiguration opaque = 1; } @@ -820,10 +841,10 @@ message DeviceConstraint { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated string requests = 1; // MatchAttribute requires that all devices in question have this @@ -846,8 +867,8 @@ message DeviceConstraint { // // +optional // +oneOf=ConstraintType - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-fully-qualified-name + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-fully-qualified-name optional string matchAttribute = 2; // DistinctAttribute requires that all devices in question have this @@ -869,6 +890,8 @@ message DeviceConstraint { // +optional // +oneOf=ConstraintType // +featureGate=DRAConsumableCapacity + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-fully-qualified-name optional string distinctAttribute = 3; } @@ -879,8 +902,8 @@ message DeviceCounterConsumption { // counters defined will be consumed. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-short-name optional string counterSet = 1; // Counters defines the counters that will be consumed by the device. @@ -888,9 +911,94 @@ message DeviceCounterConsumption { // The maximum number of counters is 32. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:eachKey=+k8s:format=k8s-short-name map counters = 2; + + // CompatibilityGroups is a list of opaque group names for + // this counter set consumption. + // + // Devices that consume counters from the same counter set may only be + // allocated at the same time ("co-allocated") if they all share at least + // one common group: the intersection of the CompatibilityGroups of all + // co-allocated devices on that counter set must be non-empty. Devices + // that consume from different counter sets are never compared via this + // field. + // + // An unset field, an explicit nil, and an empty list are equivalent and + // mean "no groups": such a device is only co-allocatable with sibling + // devices on the same counter set that also have no groups, and is never + // co-allocatable with a device that declares one or more groups. + // + // Group names are opaque and meaningful only within the + // publishing driver's pool. + // + // The maximum number of groups is 2, and the names must be unique. + // + // +optional + // +listType=atomic + // +featureGate=DRADeviceCompatibilityGroups + // +k8s:listType=atomic + // +k8s:optional + // +k8s:maxItems=2 + // +k8s:unique=set + // +k8s:eachVal=+k8s:format=k8s-short-name + repeated string compatibilityGroups = 3; +} + +// DeviceDerivedAttribute defines a derived attribute computed via CEL. +message DeviceDerivedAttribute { + // Name is the identifier for this derived attribute, used in constraints. + // + // It must be a DNS subdomain followed by a slash ("/") followed by a C identifier + // (e.g. "example.com/numaNode" or "derived/numaNode"). + // + // If the chosen name matches an existing physical attribute from a driver, + // the derived attribute's expression will shadow the physical attribute, + // and its evaluated value will be used in constraints instead. When the goal + // is to define a derived attribute that is only used within the ResourceClaim + // and not meant to shadow an existing attribute, use a domain prefix that + // no DRA driver should be using (e.g. "derived/myAttribute"). + // + // It is not valid to define a derived attribute that isn't used in at least + // one constraint. + // + // +required + // +k8s:required + // +k8s:format=k8s-resource-fully-qualified-name + optional string name = 1; + + // Expression is a CEL expression evaluated against each candidate device. + // The expression must evaluate to a primitive scalar (string, integer, + // boolean, or semver) or a list of these scalars ([]string, []int64, + // []bool, []semver) to act as a virtual grouping key. Any other return type + // is an error and causes CEL evaluation for the device to fail. + // + // The expression's input is an object named "device", which carries the + // same properties as in a CELDeviceSelector. + // + // When pod scheduling encounters CEL runtime errors (such as looking + // up an attribute that isn't defined) for some devices, it will abort + // allocation and fail scheduling for the Pod. Surfacing evaluation + // errors immediately prevents silent topology matching failures that are + // extremely hard to detect. A robust expression should, for example, check + // for the existence of attributes before referencing them to avoid + // runtime evaluation errors. + // + // The expression gets evaluated after a device has passed the other + // selector expressions for the request in which this expression is used. + // This allows writing expressions that are tailored towards the specific + // devices being requested (for example, by assuming the device is from a + // certain vendor and skipping those checks). + // + // The length of the expression must be smaller or equal to 10 Ki. The + // cost of evaluating it is also limited based on the estimated number + // of logical steps; the combined cost of all derived attributes in a + // claim is capped by a shared CEL cost budget. + // + // +required + // +k8s:required + optional string expression = 2; } // DeviceRequest is a request for devices required for a claim. @@ -935,8 +1043,8 @@ message DeviceRequest { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceSelector selectors = 3; // AllocationMode and its related fields define how devices are allocated @@ -962,7 +1070,7 @@ message DeviceRequest { // requests with unknown modes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional string allocationMode = 4; // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1012,11 +1120,11 @@ message DeviceRequest { // +oneOf=deviceRequestType // +listType=atomic // +featureGate=DRAPrioritizedList - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name - // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=name + // +k8s:beta(since: "1.37")=+k8s:maxItems=8 repeated DeviceSubRequest firstAvailable = 7; // If specified, the request's tolerations. @@ -1043,7 +1151,7 @@ message DeviceRequest { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated DeviceToleration tolerations = 8; // Capacity define resource requirements against each capacity. @@ -1062,6 +1170,34 @@ message DeviceRequest { // +optional // +featureGate=DRAConsumableCapacity optional CapacityRequirements capacity = 9; + + // DerivedAttributes defines a set of virtual attributes computed via CEL expressions + // for each candidate device. These virtual attributes can be referenced in + // `.devices.constraints` to align and match different devices (e.g., co-allocating + // a GPU and a NIC on the same NUMA node) even if their drivers publish different + // attributes. Derived attributes are not available via `device.attributes` + // in the CEL environment when evaluating selector expressions. + // + // Derived attributes allow you to extract, transform, or normalize topology + // information (such as extracting a NUMA index from a complex topology string or + // renaming a vendor-specific attribute) into a common virtual attribute name at + // scheduling time. The scheduler then evaluates these virtual attributes exactly + // like static attributes when matching constraints. + // + // Every derived attribute defined in this list must be referenced by at least one + // MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + // + // The maximum number of derived attributes is 32. + // + // This is an alpha field and requires enabling the DRADerivedAttributes + // feature gate. + // + // +optional + // +listType=atomic + // +featureGate=DRADerivedAttributes + // +k8s:optional + // +k8s:maxItems=32 + repeated DeviceDerivedAttribute derivedAttributes = 10; } // DeviceRequestAllocationResult contains the allocation result for one request. @@ -1085,9 +1221,9 @@ message DeviceRequestAllocationResult { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 + // +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name-caseless + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:maxLength=63 optional string driver = 2; // This name together with the driver name and the device name field @@ -1097,8 +1233,8 @@ message DeviceRequestAllocationResult { // DNS sub-domains separated by slashes. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-pool-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-pool-name optional string pool = 3; // Device references one device instance via its name in the driver's @@ -1130,8 +1266,7 @@ message DeviceRequestAllocationResult { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=16 + // +k8s:beta(since: "1.37")=+k8s:optional repeated DeviceToleration tolerations = 6; // BindingConditions contains a copy of the BindingConditions @@ -1143,8 +1278,8 @@ message DeviceRequestAllocationResult { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 repeated string bindingConditions = 7; // BindingFailureConditions contains a copy of the BindingFailureConditions @@ -1156,8 +1291,8 @@ message DeviceRequestAllocationResult { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 repeated string bindingFailureConditions = 8; // ShareID uniquely identifies an individual allocation share of the device, @@ -1167,8 +1302,8 @@ message DeviceRequestAllocationResult { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-uuid optional string shareID = 9; // ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. @@ -1183,6 +1318,19 @@ message DeviceRequestAllocationResult { // +optional // +featureGate=DRAConsumableCapacity map consumedCapacity = 10; + + // SkipNodeOperations lists node-local resource operations (gRPC calls) + // that will be skipped for this allocated device when determining whether + // operations are necessary on the node. If all allocated devices for a driver in + // a claim skip an operation, that gRPC call will be skipped. It is a copy of + // the ResourceSlice.spec.skipNodeOperations value at the time when the device was allocated. + // + // +optional + // +listType=set + // +k8s:listType=set + // +featureGate=DRAOptionalNodeOperations + // +k8s:optional + repeated string skipNodeOperations = 11; } // DeviceSelector must have exactly one field set. @@ -1226,8 +1374,8 @@ message DeviceSubRequest { // to reference. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name optional string deviceClassName = 2; // Selectors define criteria which must be satisfied by a specific @@ -1237,8 +1385,8 @@ message DeviceSubRequest { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional repeated DeviceSelector selectors = 3; // AllocationMode and its related fields define how devices are allocated @@ -1260,7 +1408,7 @@ message DeviceSubRequest { // requests with unknown modes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional string allocationMode = 4; // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1291,7 +1439,7 @@ message DeviceSubRequest { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated DeviceToleration tolerations = 7; // Capacity define resource requirements against each capacity. @@ -1310,6 +1458,34 @@ message DeviceSubRequest { // +optional // +featureGate=DRAConsumableCapacity optional CapacityRequirements capacity = 8; + + // DerivedAttributes defines a set of virtual attributes computed via CEL expressions + // for each candidate device. These virtual attributes can be referenced in + // `.devices.constraints` to align and match different devices (e.g., co-allocating + // a GPU and a NIC on the same NUMA node) even if their drivers publish different + // attributes. Derived attributes are not available via `device.attributes` + // in the CEL environment when evaluating selector expressions. + // + // Derived attributes allow you to extract, transform, or normalize topology + // information (such as extracting a NUMA index from a complex topology string or + // renaming a vendor-specific attribute) into a common virtual attribute name at + // scheduling time. The scheduler then evaluates these virtual attributes exactly + // like static attributes when matching constraints. + // + // Every derived attribute defined in this list must be referenced by at least one + // MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + // + // The maximum number of derived attributes is 32. + // + // This is an alpha field and requires enabling the DRADerivedAttributes + // feature gate. + // + // +optional + // +listType=atomic + // +featureGate=DRADerivedAttributes + // +k8s:optional + // +k8s:maxItems=32 + repeated DeviceDerivedAttribute derivedAttributes = 9; } // The device this taint is attached to has the "effect" on @@ -1338,7 +1514,7 @@ message DeviceTaint { // Consumers must treat unknown effects like None. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string effect = 3; // TimeAdded represents the time at which the taint was added or @@ -1365,8 +1541,8 @@ message DeviceToleration { // Must be a label name. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-label-key + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-label-key optional string key = 1; // Operator represents a key's relationship to the value. @@ -1376,7 +1552,7 @@ message DeviceToleration { // // +optional // +default="Equal" - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional string operator = 2; // Value is the taint value the toleration matches to. @@ -1390,7 +1566,7 @@ message DeviceToleration { // When specified, allowed values are NoSchedule and NoExecute. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional string effect = 4; // TolerationSeconds represents the period of time the toleration (which must be @@ -1415,8 +1591,8 @@ message NetworkDeviceData { // Must not be longer than 256 bytes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxBytes=256 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxBytes=256 optional string interfaceName = 1; // IPs lists the network addresses assigned to the device's network interface. @@ -1429,10 +1605,10 @@ message NetworkDeviceData { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=16 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=16 repeated string ips = 2; // HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface. @@ -1440,47 +1616,104 @@ message NetworkDeviceData { // Must not be longer than 128 bytes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxBytes=128 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxBytes=128 optional string hardwareAddress = 3; } -// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity -// units requested to the corresponding quantity of the node allocatable resource. -message NodeAllocatableResourceMapping { +// NodeAllocatableMapping defines how a DRA allocation directly translates into a node allocatable resource quantity. +// The mapping can be derived from either the count of allocated devices or the specific capacity consumed. These options are mutually exclusive. +// Kubelet adds this mapped resource quantity from claim to both requests and limits at the pod-level cgroup, and to limits at the container-level cgroup for each container referencing the claim. +message NodeAllocatableMapping { // CapacityKey references a capacity name defined as a key in the // `spec.devices[*].capacity` map. When this field is set, the value associated with // this key in the `status.allocation.devices.results[*].consumedCapacity` map // (for a specific claim allocation) determines the base quantity for - // the node allocatable resource. If `allocationMultiplier` is also set, it is + // the node allocatable resource. `capacityMultiplier` must also be set and is // multiplied with the base quantity. // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", // and this field is set to "dra.example.com/memory", then for a claim allocation // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the - // node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should - // be omitted or set to "1". + // node allocatable resource mapping will be "4Gi". + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:alpha(since: "1.37")=+k8s:dependentRequired("capacityMultiplier") optional string capacityKey = 1; - // AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. - // It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. - // 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim. - // a. A DRA driver representing each CPU core as a device would have - // {ResourceName: "cpu", allocationMultiplier: "2"} in its - // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim, - // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. - // b. A GPU device that needs additional node memory per GPU allocation would - // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated - // GPU device instance of this type will account for 2Gi of memory. - // - // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed. - // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`. - // For example, if a Device's capacity "dra.example.com/cores" is consumed, - // and each "core" provides 2 "cpu"s, the mapping would be: - // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. - // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. - // +optional - optional .k8s.io.apimachinery.pkg.api.resource.Quantity allocationMultiplier = 2; + // CapacityMultiplier is used as a multiplier for the allocated capacity consumed. + // It is only valid if `capacityKey` is set. + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. + // For example, if a Device's capacity "dra.example.com/cores" is consumed, + // and each "core" provides 2 "cpu"s, the mapping would be: + // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", capacityMultiplier: "2"}. + // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. + // +optional + // +k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:dependentRequired("capacityKey") + optional .k8s.io.apimachinery.pkg.api.resource.Quantity capacityMultiplier = 2; + + // DeviceMultiplier is used as a multiplier for the allocated device count in the claim. + // The final node allocatable resource amount is `deviceCount` * `deviceMultiplier`. + // For example, a DRA driver representing each cache complex (CCX) as a device would have + // {ResourceName: "cpu", deviceMultiplier: "8"} in its `nodeAllocatableResources`. + // If 2 devices (CCX) are allocated to the claim, 2 * 8 = 16 CPUs would be considered as allocated. + // It is only valid when `capacityKey` and `capacityMultiplier` are not set. + // +optional + // +k8s:optional + // +k8s:unionMember + optional .k8s.io.apimachinery.pkg.api.resource.Quantity deviceMultiplier = 3; +} + +// NodeAllocatableOverhead defines auxiliary resource overheads incurred when allocating a device. +// Overheads can be specified as a fixed cost per pod referencing the claim, a variable cost per container reference, or both. +// Kubelet accounts for this overhead by adding it to both the pod-level and container-level cgroups of referencing containers. +message NodeAllocatableOverhead { + // PerPod is overhead applied once per pod referencing the claim on this node. + // This is a flat overhead incurred for every pod referencing the claim. + // +optional + // +k8s:optional + optional .k8s.io.apimachinery.pkg.api.resource.Quantity perPod = 1; + + // PerContainer is applied per container reference to the claim. + // This models overhead scaling linearly with the number of containers actively using the device. + // When both PerPod and PerContainer are specified, the total overhead allocated for each pod referencing + // the claim is computed as: + // Quantity = PerPod + (PerContainer * NumReferences) + // Kubelet accounts for this overhead in cgroups: + // - Pod-level cgroup (requests and limits): Kubelet adds PerPod + (PerContainer * NumReferences). + // - Container-level cgroup (limits only): Kubelet adds PerPod + PerContainer for each referencing container. + // This allows any single container to access the pod-level overhead, while the parent cgroup caps the total usage to account for PerPod exactly once. + // +optional + // +k8s:optional + optional .k8s.io.apimachinery.pkg.api.resource.Quantity perContainer = 2; +} + +// NodeAllocatableResource defines the translation between the DRA device/capacity +// units requested to the corresponding quantity of the node allocatable resource. +// At least one of Mapping or Overhead must be specified. Not specifying either is an invalid configuration. +message NodeAllocatableResource { + // Mapping is used when the device directly models a node allocatable resource like standard CPU or memory + // (e.g., with a CPU DRA driver). The calculated quantity is accounted for exactly once per claim instance + // on the node. To prevent node cgroup isolation friction, the scheduler explicitly + // blocks sharing mapped device claims across multiple pods. + // +optional + // +k8s:optional + optional NodeAllocatableMapping mapping = 3; + + // Overhead contains fields for modeling auxiliary overhead incurred on node allocatable resources + // when allocating devices that are not themselves modeling a node allocatable resource (e.g., host memory overhead for GPUs). + // Sharing overhead-mapped claims across multiple pods is allowed. The node allocatable overhead is accounted + // for individually for each pod referencing the claim. + // Overhead is always subtracted from the node's allocatable capacity for the resource, even when mapping + // is specified for the same resource. + // Eg: If a device models memory capacity per socket as a consumable capacity pool via Mapping (with CapacityKey), + // any overhead specified for the same resource will be subtracted from the node's general allocatable capacity + // and not from the per-socket capacity pool in Mapping. + // +optional + // +k8s:optional + optional NodeAllocatableOverhead overhead = 4; } // OpaqueDeviceConfiguration contains configuration parameters for a driver @@ -1496,9 +1729,9 @@ message OpaqueDeviceConfiguration { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:maxLength=63 + // +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name-caseless optional string driver = 1; // Parameters can contain arbitrary data. It is the responsibility of @@ -1527,7 +1760,8 @@ message ResourceClaim { // Spec describes what is being requested and how to configure it. // The spec is immutable. - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:immutable + // +optional optional ResourceClaimSpec spec = 2; // Status describes whether the claim is ready to use and what has been allocated. @@ -1582,8 +1816,8 @@ message ResourceClaimStatus { // Allocation is set once the claim has been allocated successfully. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:update=NoModify + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:update=NoModify optional AllocationResult allocation = 1; // ReservedFor indicates which entities are currently allowed to use @@ -1611,10 +1845,10 @@ message ResourceClaimStatus { // +listMapKey=uid // +patchStrategy=merge // +patchMergeKey=uid - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:listType=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=uid - // +k8s:alpha(since: "1.36")=+k8s:maxItems=256 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:listType=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=uid + // +k8s:beta(since: "1.37")=+k8s:maxItems=256 repeated ResourceClaimConsumerReference reservedFor = 2; // Devices contains the status of each device allocated for this @@ -1622,18 +1856,18 @@ message ResourceClaimStatus { // information. Entries are owned by their respective drivers. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +listType=map // +listMapKey=driver // +listMapKey=device // +listMapKey=pool // +listMapKey=shareID // +featureGate=DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:listType=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=driver - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=device - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=pool - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=shareID + // +k8s:beta(since: "1.37")=+k8s:listType=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=driver + // +k8s:beta(since: "1.37")=+k8s:listMapKey=device + // +k8s:beta(since: "1.37")=+k8s:listMapKey=pool + // +k8s:beta(since: "1.37")=+k8s:listMapKey=shareID repeated AllocatedDeviceStatus devices = 4; } @@ -1651,6 +1885,7 @@ message ResourceClaimTemplate { // This field is immutable. A ResourceClaim will get created by the // control plane for a Pod when needed and then not get updated // anymore. + // +optional optional ResourceClaimTemplateSpec spec = 2; } @@ -1670,11 +1905,13 @@ message ResourceClaimTemplateSpec { // when creating it. No other fields are allowed and will be rejected during // validation. // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Spec for the ResourceClaim. The entire content is copied unchanged // into the ResourceClaim that gets created from this template. The // same fields as in a ResourceClaim are also valid here. + // +optional optional ResourceClaimSpec spec = 2; } @@ -1682,6 +1919,8 @@ message ResourceClaimTemplateSpec { message ResourcePool { // Name is used to identify the pool. For node-local devices, this // is often the node name, but this is not required. + // A field selector can be used to list only ResourceSlice objects + // belonging to a certain pool. // // It must not be longer than 253 characters and must consist of one or more DNS sub-domains // separated by slashes. This field is immutable. @@ -1822,7 +2061,7 @@ message ResourceSliceSpec { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +zeroOrOneOf=ResourceSliceType repeated Device devices = 6; @@ -1848,14 +2087,50 @@ message ResourceSliceSpec { // The maximum number of counter sets is 8. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=name // +featureGate=DRAPartitionableDevices // +zeroOrOneOf=ResourceSliceType - // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 + // +k8s:beta(since: "1.37")=+k8s:maxItems=8 repeated CounterSet sharedCounters = 8; + + // PartitionTypeAttribute names a string device attribute (by fully + // qualified name, e.g. "gpu.example.com/profile") whose value labels + // each device with its partition type, such as "Full" or "Half" for a + // MIG-style GPU. + // + // When set, every partitionable device in the slice must carry the attribute + // and devices sharing a value must share the same ConsumesCounters cost. + // + // +optional + // +featureGate=DRAPartitionableDevicesType + // +k8s:ifDisabled(DRAPartitionableDevicesType)=+k8s:forbidden + // +k8s:ifEnabled(DRAPartitionableDevicesType)=+k8s:optional + // +k8s:ifEnabled(DRAPartitionableDevicesType)=+k8s:format=k8s-resource-fully-qualified-name + optional string partitionTypeAttribute = 9; + + // SkipNodeOperations lists node-local resource operations (gRPC calls) + // that will be skipped for the devices in this slice when determining whether + // operations are necessary on the node. If all allocated devices for a driver in + // a claim skip an operation, that gRPC call will be skipped. Valid values are: + // + // - "NodePrepareResources": NodePrepareResources gRPC calls are skipped. This + // value cannot be specified unless "NodeUnprepareResources" is also listed + // (or "*" is specified). + // - "NodeUnprepareResources": NodeUnprepareResources gRPC calls are skipped. + // - "*": All node-local resource operations are skipped. + // + // Other values may be added in the future. The kubelet must ignore unknown + // values. + // + // +optional + // +listType=set + // +k8s:listType=set + // +featureGate=DRAOptionalNodeOperations + // +k8s:optional + repeated string skipNodeOperations = 10; } diff --git a/vendor/k8s.io/api/resource/v1beta1/types.go b/vendor/k8s.io/api/resource/v1beta1/types.go index 0d35ac9895..f35e230ceb 100644 --- a/vendor/k8s.io/api/resource/v1beta1/types.go +++ b/vendor/k8s.io/api/resource/v1beta1/types.go @@ -78,7 +78,7 @@ const ( // This is an alpha type and requires enabling the DynamicResourceAllocation // feature gate. type ResourceSlice struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -97,6 +97,9 @@ const ( // ResourceSliceSelectorDriver can be used in a [metav1.ListOptions] // field selector to filter based on [ResourceSliceSpec.Driver]. ResourceSliceSelectorDriver = "spec.driver" + // ResourceSliceSelectorPoolName can be used in a [metav1.ListOptions] + // field selector to filter based on [ResourceSliceSpec.Pool.Name]. + ResourceSliceSelectorPoolName = "spec.pool.name" ) // ResourceSliceSpec contains the information published by the driver in one ResourceSlice. @@ -160,7 +163,7 @@ type ResourceSliceSpec struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +zeroOrOneOf=ResourceSliceType Devices []Device `json:"devices,omitempty" protobuf:"bytes,6,name=devices"` @@ -186,17 +189,68 @@ type ResourceSliceSpec struct { // The maximum number of counter sets is 8. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=name // +featureGate=DRAPartitionableDevices // +zeroOrOneOf=ResourceSliceType - // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 + // +k8s:beta(since: "1.37")=+k8s:maxItems=8 SharedCounters []CounterSet `json:"sharedCounters,omitempty" protobuf:"bytes,8,name=sharedCounters"` + + // PartitionTypeAttribute names a string device attribute (by fully + // qualified name, e.g. "gpu.example.com/profile") whose value labels + // each device with its partition type, such as "Full" or "Half" for a + // MIG-style GPU. + // + // When set, every partitionable device in the slice must carry the attribute + // and devices sharing a value must share the same ConsumesCounters cost. + // + // +optional + // +featureGate=DRAPartitionableDevicesType + // +k8s:ifDisabled(DRAPartitionableDevicesType)=+k8s:forbidden + // +k8s:ifEnabled(DRAPartitionableDevicesType)=+k8s:optional + // +k8s:ifEnabled(DRAPartitionableDevicesType)=+k8s:format=k8s-resource-fully-qualified-name + PartitionTypeAttribute *FullyQualifiedName `json:"partitionTypeAttribute,omitempty" protobuf:"bytes,9,opt,name=partitionTypeAttribute"` + + // SkipNodeOperations lists node-local resource operations (gRPC calls) + // that will be skipped for the devices in this slice when determining whether + // operations are necessary on the node. If all allocated devices for a driver in + // a claim skip an operation, that gRPC call will be skipped. Valid values are: + // + // - "NodePrepareResources": NodePrepareResources gRPC calls are skipped. This + // value cannot be specified unless "NodeUnprepareResources" is also listed + // (or "*" is specified). + // - "NodeUnprepareResources": NodeUnprepareResources gRPC calls are skipped. + // - "*": All node-local resource operations are skipped. + // + // Other values may be added in the future. The kubelet must ignore unknown + // values. + // + // +optional + // +listType=set + // +k8s:listType=set + // +featureGate=DRAOptionalNodeOperations + // +k8s:optional + SkipNodeOperations []SkipNodeOperation `json:"skipNodeOperations,omitempty" protobuf:"bytes,10,rep,name=skipNodeOperations,casttype=SkipNodeOperation"` } +// +enum +// +k8s:enum +type SkipNodeOperation string + +const ( + // SkipNodeOperationNodePrepareResources indicates that NodePrepareResources gRPC calls are skipped. + SkipNodeOperationNodePrepareResources SkipNodeOperation = "NodePrepareResources" + + // SkipNodeOperationNodeUnprepareResources indicates that NodeUnprepareResources gRPC calls are skipped. + SkipNodeOperationNodeUnprepareResources SkipNodeOperation = "NodeUnprepareResources" + + // SkipNodeOperationAll indicates that all node-local resource operations are skipped. + SkipNodeOperationAll SkipNodeOperation = "*" +) + // CounterSet defines a named set of counters // that are available to be used by devices defined in the // ResourcePool. @@ -210,8 +264,8 @@ type CounterSet struct { // It must be a DNS label. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-short-name Name string `json:"name" protobuf:"bytes,1,name=name"` // Counters defines the set of counters for this CounterSet @@ -220,8 +274,8 @@ type CounterSet struct { // The maximum number of counters is 32. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:eachKey=+k8s:format=k8s-short-name Counters map[string]Counter `json:"counters,omitempty" protobuf:"bytes,2,name=counters"` } @@ -241,6 +295,8 @@ const DriverNameMaxLength = 63 type ResourcePool struct { // Name is used to identify the pool. For node-local devices, this // is often the node name, but this is not required. + // A field selector can be used to list only ResourceSlice objects + // belonging to a certain pool. // // It must not be longer than 253 characters and must consist of one or more DNS sub-domains // separated by slashes. This field is immutable. @@ -305,6 +361,10 @@ const ResourceSliceMaxDeviceCounterConsumptionsPerDevice = 2 // per device counter consumption. const ResourceSliceMaxCountersPerDeviceCounterConsumption = 32 +// Defines the maximum number of compatibility groups that can be +// declared per device counter consumption. +const DeviceCompatibilityGroupsMaxSize = 2 + // Device represents one individual hardware instance that can be selected based // on its attributes. Besides the name, exactly one field must be set. type Device struct { @@ -318,7 +378,7 @@ type Device struct { // // +optional // +oneOf=deviceType - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Basic *BasicDevice `json:"basic,omitempty" protobuf:"bytes,2,opt,name=basic"` } @@ -330,7 +390,7 @@ type BasicDevice struct { // The maximum number of attributes and capacities combined is 32. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Attributes map[QualifiedName]DeviceAttribute `json:"attributes,omitempty" protobuf:"bytes,1,rep,name=attributes"` // Capacity defines the set of capacities for this device. @@ -351,13 +411,13 @@ type BasicDevice struct { // device is 2. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=counterSet + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=counterSet // +featureGate=DRAPartitionableDevices - // +k8s:alpha(since: "1.36")=+k8s:maxItems=2 + // +k8s:beta(since: "1.37")=+k8s:maxItems=2 ConsumesCounters []DeviceCounterConsumption `json:"consumesCounters,omitempty" protobuf:"bytes,3,rep,name=consumesCounters"` // NodeName identifies the node where the device is available. @@ -403,7 +463,7 @@ type BasicDevice struct { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Taints []DeviceTaint `json:"taints,omitempty" protobuf:"bytes,7,rep,name=taints"` // BindsToNode indicates if the usage of an allocation involving this device @@ -433,8 +493,8 @@ type BasicDevice struct { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 BindingConditions []string `json:"bindingConditions,omitempty" protobuf:"bytes,9,rep,name=bindingConditions"` // BindingFailureConditions defines the conditions for binding failure. @@ -451,8 +511,8 @@ type BasicDevice struct { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 BindingFailureConditions []string `json:"bindingFailureConditions,omitempty" protobuf:"bytes,10,rep,name=bindingFailureConditions"` // AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests. @@ -464,7 +524,10 @@ type BasicDevice struct { // +featureGate=DRAConsumableCapacity AllowMultipleAllocations *bool `json:"allowMultipleAllocations,omitempty" protobuf:"bytes,11,opt,name=allowMultipleAllocations"` - // NodeAllocatableResourceMappings defines the mapping of node resources + // NodeAllocatableResourceMappings is tombstoned as it got replaced with NodeAllocatableResources. + // NodeAllocatableResourceMappings map[v1.ResourceName]NodeAllocatableResourceMapping `json:"nodeAllocatableResourceMappings,omitempty" protobuf:"bytes,12,opt,name=nodeAllocatableResourceMappings"` + + // NodeAllocatableResources defines the mapping of node resources // that are managed by the DRA driver exposing this device. This includes resources currently // reported in v1.Node `status.allocatable` that are not extended resources // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). @@ -476,46 +539,104 @@ type BasicDevice struct { // The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). // Extended resource names are not permitted as keys. // +optional + // +k8s:optional // +featureGate=DRANodeAllocatableResources - NodeAllocatableResourceMappings map[v1.ResourceName]NodeAllocatableResourceMapping `json:"nodeAllocatableResourceMappings,omitempty" protobuf:"bytes,12,opt,name=nodeAllocatableResourceMappings"` + NodeAllocatableResources map[v1.ResourceName]NodeAllocatableResource `json:"nodeAllocatableResources,omitempty" protobuf:"bytes,14,opt,name=nodeAllocatableResources"` } -// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity +// NodeAllocatableResource defines the translation between the DRA device/capacity // units requested to the corresponding quantity of the node allocatable resource. -type NodeAllocatableResourceMapping struct { +// At least one of Mapping or Overhead must be specified. Not specifying either is an invalid configuration. +type NodeAllocatableResource struct { + // Mapping is used when the device directly models a node allocatable resource like standard CPU or memory + // (e.g., with a CPU DRA driver). The calculated quantity is accounted for exactly once per claim instance + // on the node. To prevent node cgroup isolation friction, the scheduler explicitly + // blocks sharing mapped device claims across multiple pods. + // +optional + // +k8s:optional + Mapping *NodeAllocatableMapping `json:"mapping,omitempty" protobuf:"bytes,3,opt,name=mapping"` + + // Overhead contains fields for modeling auxiliary overhead incurred on node allocatable resources + // when allocating devices that are not themselves modeling a node allocatable resource (e.g., host memory overhead for GPUs). + // Sharing overhead-mapped claims across multiple pods is allowed. The node allocatable overhead is accounted + // for individually for each pod referencing the claim. + // Overhead is always subtracted from the node's allocatable capacity for the resource, even when mapping + // is specified for the same resource. + // Eg: If a device models memory capacity per socket as a consumable capacity pool via Mapping (with CapacityKey), + // any overhead specified for the same resource will be subtracted from the node's general allocatable capacity + // and not from the per-socket capacity pool in Mapping. + // +optional + // +k8s:optional + Overhead *NodeAllocatableOverhead `json:"overhead,omitempty" protobuf:"bytes,4,opt,name=overhead"` +} + +// NodeAllocatableMapping defines how a DRA allocation directly translates into a node allocatable resource quantity. +// The mapping can be derived from either the count of allocated devices or the specific capacity consumed. These options are mutually exclusive. +// Kubelet adds this mapped resource quantity from claim to both requests and limits at the pod-level cgroup, and to limits at the container-level cgroup for each container referencing the claim. +type NodeAllocatableMapping struct { // CapacityKey references a capacity name defined as a key in the // `spec.devices[*].capacity` map. When this field is set, the value associated with // this key in the `status.allocation.devices.results[*].consumedCapacity` map // (for a specific claim allocation) determines the base quantity for - // the node allocatable resource. If `allocationMultiplier` is also set, it is + // the node allocatable resource. `capacityMultiplier` must also be set and is // multiplied with the base quantity. // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", // and this field is set to "dra.example.com/memory", then for a claim allocation // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the - // node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should - // be omitted or set to "1". + // node allocatable resource mapping will be "4Gi". + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:alpha(since: "1.37")=+k8s:dependentRequired("capacityMultiplier") CapacityKey *QualifiedName `json:"capacityKey,omitempty" protobuf:"bytes,1,opt,name=capacityKey"` - // AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. - // It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. - // 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim. - // a. A DRA driver representing each CPU core as a device would have - // {ResourceName: "cpu", allocationMultiplier: "2"} in its - // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim, - // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. - // b. A GPU device that needs additional node memory per GPU allocation would - // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated - // GPU device instance of this type will account for 2Gi of memory. - // - // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed. - // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`. - // For example, if a Device's capacity "dra.example.com/cores" is consumed, - // and each "core" provides 2 "cpu"s, the mapping would be: - // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. - // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. - // +optional - AllocationMultiplier *resource.Quantity `json:"allocationMultiplier,omitempty" protobuf:"bytes,2,opt,name=allocationMultiplier"` + // CapacityMultiplier is used as a multiplier for the allocated capacity consumed. + // It is only valid if `capacityKey` is set. + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. + // For example, if a Device's capacity "dra.example.com/cores" is consumed, + // and each "core" provides 2 "cpu"s, the mapping would be: + // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", capacityMultiplier: "2"}. + // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. + // +optional + // +k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:dependentRequired("capacityKey") + CapacityMultiplier *resource.Quantity `json:"capacityMultiplier,omitempty" protobuf:"bytes,2,opt,name=capacityMultiplier"` + + // DeviceMultiplier is used as a multiplier for the allocated device count in the claim. + // The final node allocatable resource amount is `deviceCount` * `deviceMultiplier`. + // For example, a DRA driver representing each cache complex (CCX) as a device would have + // {ResourceName: "cpu", deviceMultiplier: "8"} in its `nodeAllocatableResources`. + // If 2 devices (CCX) are allocated to the claim, 2 * 8 = 16 CPUs would be considered as allocated. + // It is only valid when `capacityKey` and `capacityMultiplier` are not set. + // +optional + // +k8s:optional + // +k8s:unionMember + DeviceMultiplier *resource.Quantity `json:"deviceMultiplier,omitempty" protobuf:"bytes,3,opt,name=deviceMultiplier"` +} + +// NodeAllocatableOverhead defines auxiliary resource overheads incurred when allocating a device. +// Overheads can be specified as a fixed cost per pod referencing the claim, a variable cost per container reference, or both. +// Kubelet accounts for this overhead by adding it to both the pod-level and container-level cgroups of referencing containers. +type NodeAllocatableOverhead struct { + // PerPod is overhead applied once per pod referencing the claim on this node. + // This is a flat overhead incurred for every pod referencing the claim. + // +optional + // +k8s:optional + PerPod *resource.Quantity `json:"perPod,omitempty" protobuf:"bytes,1,opt,name=perPod"` + + // PerContainer is applied per container reference to the claim. + // This models overhead scaling linearly with the number of containers actively using the device. + // When both PerPod and PerContainer are specified, the total overhead allocated for each pod referencing + // the claim is computed as: + // Quantity = PerPod + (PerContainer * NumReferences) + // Kubelet accounts for this overhead in cgroups: + // - Pod-level cgroup (requests and limits): Kubelet adds PerPod + (PerContainer * NumReferences). + // - Container-level cgroup (limits only): Kubelet adds PerPod + PerContainer for each referencing container. + // This allows any single container to access the pod-level overhead, while the parent cgroup caps the total usage to account for PerPod exactly once. + // +optional + // +k8s:optional + PerContainer *resource.Quantity `json:"perContainer,omitempty" protobuf:"bytes,2,opt,name=perContainer"` } // DeviceCounterConsumption defines a set of counters that @@ -525,8 +646,8 @@ type DeviceCounterConsumption struct { // counters defined will be consumed. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-short-name CounterSet string `json:"counterSet" protobuf:"bytes,1,opt,name=counterSet"` // Counters defines the counters that will be consumed by the device. @@ -534,9 +655,39 @@ type DeviceCounterConsumption struct { // The maximum number of counters is 32. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:eachKey=+k8s:format=k8s-short-name Counters map[string]Counter `json:"counters,omitempty" protobuf:"bytes,2,opt,name=counters"` + + // CompatibilityGroups is a list of opaque group names for + // this counter set consumption. + // + // Devices that consume counters from the same counter set may only be + // allocated at the same time ("co-allocated") if they all share at least + // one common group: the intersection of the CompatibilityGroups of all + // co-allocated devices on that counter set must be non-empty. Devices + // that consume from different counter sets are never compared via this + // field. + // + // An unset field, an explicit nil, and an empty list are equivalent and + // mean "no groups": such a device is only co-allocatable with sibling + // devices on the same counter set that also have no groups, and is never + // co-allocatable with a device that declares one or more groups. + // + // Group names are opaque and meaningful only within the + // publishing driver's pool. + // + // The maximum number of groups is 2, and the names must be unique. + // + // +optional + // +listType=atomic + // +featureGate=DRADeviceCompatibilityGroups + // +k8s:listType=atomic + // +k8s:optional + // +k8s:maxItems=2 + // +k8s:unique=set + // +k8s:eachVal=+k8s:format=k8s-short-name + CompatibilityGroups []string `json:"compatibilityGroups,omitempty" protobuf:"bytes,3,rep,name=compatibilityGroups"` } // DeviceCapacity describes a quantity associated with a device. @@ -612,6 +763,13 @@ type CapacityRequestPolicy struct { // CapacityRequestPolicyRange defines a valid range for consumable capacity values. // +// If the DRAFractionalCapacityRange feature gate is +// enabled and at least one of Min, Max, or Step is a fractional quantity (i.e. +// its value is not an integer), milli-unit arithmetic is used instead, +// supporting values with up to 3 decimal places (e.g. 100m = 0.1). +// The largest supported value then is 1000 times smaller compared to using 64-bit integers. +// Otherwise, all comparisons use 64-bit integer arithmetic via resource.Quantity.Value(). +// // - If the requested amount is less than Min, it is rounded up to the Min value. // - If Step is set and the requested amount is between Min and Max but not aligned with Step, // it will be rounded up to the next value equal to Min + (n * Step). @@ -691,30 +849,30 @@ type DeviceAttribute struct { // IntValue is a number. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember IntValue *int64 `json:"int,omitempty" protobuf:"varint,2,opt,name=int"` // BoolValue is a true/false value. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember BoolValue *bool `json:"bool,omitempty" protobuf:"varint,3,opt,name=bool"` // StringValue is a string. Must not be longer than 64 characters. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember StringValue *string `json:"string,omitempty" protobuf:"bytes,4,opt,name=string"` // VersionValue is a semantic version according to semver.org spec 2.0.0. // Must not be longer than 64 characters. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember VersionValue *string `json:"version,omitempty" protobuf:"bytes,5,opt,name=version"` // IntValues is a non-empty list of numbers. @@ -723,8 +881,8 @@ type DeviceAttribute struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember // +featureGate=DRAListTypeAttributes IntValues []int64 `json:"ints,omitempty" protobuf:"varint,6,opt,name=ints"` @@ -732,8 +890,8 @@ type DeviceAttribute struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember // +featureGate=DRAListTypeAttributes BoolValues []bool `json:"bools,omitempty" protobuf:"varint,7,opt,name=bools"` @@ -744,8 +902,9 @@ type DeviceAttribute struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember + // +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:maxBytes=64 // +featureGate=DRAListTypeAttributes StringValues []string `json:"strings,omitempty" protobuf:"bytes,8,opt,name=strings"` @@ -756,8 +915,8 @@ type DeviceAttribute struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember // +featureGate=DRAListTypeAttributes VersionValues []string `json:"versions,omitempty" protobuf:"bytes,9,opt,name=versions"` } @@ -794,7 +953,7 @@ type DeviceTaint struct { // Consumers must treat unknown effects like None. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Effect DeviceTaintEffect `json:"effect" protobuf:"bytes,3,name=effect,casttype=DeviceTaintEffect"` // ^^^^ @@ -833,7 +992,7 @@ type DeviceTaint struct { } // +enum -// +k8s:alpha(since: "1.36")=+k8s:enum +// +k8s:beta(since: "1.37")=+k8s:enum type DeviceTaintEffect string const ( @@ -854,7 +1013,7 @@ const ( // ResourceSliceList is a collection of ResourceSlices. type ResourceSliceList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -877,14 +1036,15 @@ type ResourceSliceList struct { // This is an alpha type and requires enabling the DynamicResourceAllocation // feature gate. type ResourceClaim struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec describes what is being requested and how to configure it. // The spec is immutable. - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:immutable + // +optional Spec ResourceClaimSpec `json:"spec" protobuf:"bytes,2,name=spec"` // Status describes whether the claim is ready to use and what has been allocated. @@ -912,11 +1072,11 @@ type DeviceClaim struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=name + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Requests []DeviceRequest `json:"requests" protobuf:"bytes,1,name=requests"` // These constraints must be satisfied by the set of devices that get @@ -924,8 +1084,8 @@ type DeviceClaim struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Constraints []DeviceConstraint `json:"constraints,omitempty" protobuf:"bytes,2,opt,name=constraints"` // This field holds configuration for multiple potential drivers which @@ -934,8 +1094,8 @@ type DeviceClaim struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Config []DeviceClaimConfiguration `json:"config,omitempty" protobuf:"bytes,3,opt,name=config"` // Potential future extension, ignored by older schedulers. This is @@ -1002,8 +1162,8 @@ type DeviceRequest struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,3,name=selectors"` // AllocationMode and its related fields define how devices are allocated @@ -1029,7 +1189,7 @@ type DeviceRequest struct { // requests with unknown modes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional AllocationMode DeviceAllocationMode `json:"allocationMode,omitempty" protobuf:"bytes,4,opt,name=allocationMode"` // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1079,11 +1239,11 @@ type DeviceRequest struct { // +oneOf=deviceRequestType // +listType=atomic // +featureGate=DRAPrioritizedList - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name - // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=name + // +k8s:beta(since: "1.37")=+k8s:maxItems=8 FirstAvailable []DeviceSubRequest `json:"firstAvailable,omitempty" protobuf:"bytes,7,name=firstAvailable"` // If specified, the request's tolerations. @@ -1110,7 +1270,7 @@ type DeviceRequest struct { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Tolerations []DeviceToleration `json:"tolerations,omitempty" protobuf:"bytes,8,opt,name=tolerations"` // Capacity define resource requirements against each capacity. @@ -1129,6 +1289,34 @@ type DeviceRequest struct { // +optional // +featureGate=DRAConsumableCapacity Capacity *CapacityRequirements `json:"capacity,omitempty" protobuf:"bytes,9,opt,name=capacity"` + + // DerivedAttributes defines a set of virtual attributes computed via CEL expressions + // for each candidate device. These virtual attributes can be referenced in + // `.devices.constraints` to align and match different devices (e.g., co-allocating + // a GPU and a NIC on the same NUMA node) even if their drivers publish different + // attributes. Derived attributes are not available via `device.attributes` + // in the CEL environment when evaluating selector expressions. + // + // Derived attributes allow you to extract, transform, or normalize topology + // information (such as extracting a NUMA index from a complex topology string or + // renaming a vendor-specific attribute) into a common virtual attribute name at + // scheduling time. The scheduler then evaluates these virtual attributes exactly + // like static attributes when matching constraints. + // + // Every derived attribute defined in this list must be referenced by at least one + // MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + // + // The maximum number of derived attributes is 32. + // + // This is an alpha field and requires enabling the DRADerivedAttributes + // feature gate. + // + // +optional + // +listType=atomic + // +featureGate=DRADerivedAttributes + // +k8s:optional + // +k8s:maxItems=32 + DerivedAttributes []DeviceDerivedAttribute `json:"derivedAttributes,omitempty" protobuf:"bytes,10,rep,name=derivedAttributes"` } // DeviceSubRequest describes a request for device provided in the @@ -1163,8 +1351,8 @@ type DeviceSubRequest struct { // to reference. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name DeviceClassName string `json:"deviceClassName" protobuf:"bytes,2,name=deviceClassName"` // Selectors define criteria which must be satisfied by a specific @@ -1174,8 +1362,8 @@ type DeviceSubRequest struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,3,name=selectors"` // AllocationMode and its related fields define how devices are allocated @@ -1197,7 +1385,7 @@ type DeviceSubRequest struct { // requests with unknown modes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional AllocationMode DeviceAllocationMode `json:"allocationMode,omitempty" protobuf:"bytes,4,opt,name=allocationMode"` // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1228,7 +1416,7 @@ type DeviceSubRequest struct { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Tolerations []DeviceToleration `json:"tolerations,omitempty" protobuf:"bytes,7,opt,name=tolerations"` // Capacity define resource requirements against each capacity. @@ -1247,6 +1435,34 @@ type DeviceSubRequest struct { // +optional // +featureGate=DRAConsumableCapacity Capacity *CapacityRequirements `json:"capacity,omitempty" protobuf:"bytes,8,opt,name=capacity"` + + // DerivedAttributes defines a set of virtual attributes computed via CEL expressions + // for each candidate device. These virtual attributes can be referenced in + // `.devices.constraints` to align and match different devices (e.g., co-allocating + // a GPU and a NIC on the same NUMA node) even if their drivers publish different + // attributes. Derived attributes are not available via `device.attributes` + // in the CEL environment when evaluating selector expressions. + // + // Derived attributes allow you to extract, transform, or normalize topology + // information (such as extracting a NUMA index from a complex topology string or + // renaming a vendor-specific attribute) into a common virtual attribute name at + // scheduling time. The scheduler then evaluates these virtual attributes exactly + // like static attributes when matching constraints. + // + // Every derived attribute defined in this list must be referenced by at least one + // MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + // + // The maximum number of derived attributes is 32. + // + // This is an alpha field and requires enabling the DRADerivedAttributes + // feature gate. + // + // +optional + // +listType=atomic + // +featureGate=DRADerivedAttributes + // +k8s:optional + // +k8s:maxItems=32 + DerivedAttributes []DeviceDerivedAttribute `json:"derivedAttributes,omitempty" protobuf:"bytes,9,rep,name=derivedAttributes"` } // CapacityRequirements defines the capacity requirements for a specific device request. @@ -1278,14 +1494,70 @@ type CapacityRequirements struct { Requests map[QualifiedName]resource.Quantity `json:"requests,omitempty" protobuf:"bytes,1,rep,name=requests,castkey=QualifiedName"` } +// DeviceDerivedAttribute defines a derived attribute computed via CEL. +type DeviceDerivedAttribute struct { + // Name is the identifier for this derived attribute, used in constraints. + // + // It must be a DNS subdomain followed by a slash ("/") followed by a C identifier + // (e.g. "example.com/numaNode" or "derived/numaNode"). + // + // If the chosen name matches an existing physical attribute from a driver, + // the derived attribute's expression will shadow the physical attribute, + // and its evaluated value will be used in constraints instead. When the goal + // is to define a derived attribute that is only used within the ResourceClaim + // and not meant to shadow an existing attribute, use a domain prefix that + // no DRA driver should be using (e.g. "derived/myAttribute"). + // + // It is not valid to define a derived attribute that isn't used in at least + // one constraint. + // + // +required + // +k8s:required + // +k8s:format=k8s-resource-fully-qualified-name + Name FullyQualifiedName `json:"name" protobuf:"bytes,1,name=name"` + + // Expression is a CEL expression evaluated against each candidate device. + // The expression must evaluate to a primitive scalar (string, integer, + // boolean, or semver) or a list of these scalars ([]string, []int64, + // []bool, []semver) to act as a virtual grouping key. Any other return type + // is an error and causes CEL evaluation for the device to fail. + // + // The expression's input is an object named "device", which carries the + // same properties as in a CELDeviceSelector. + // + // When pod scheduling encounters CEL runtime errors (such as looking + // up an attribute that isn't defined) for some devices, it will abort + // allocation and fail scheduling for the Pod. Surfacing evaluation + // errors immediately prevents silent topology matching failures that are + // extremely hard to detect. A robust expression should, for example, check + // for the existence of attributes before referencing them to avoid + // runtime evaluation errors. + // + // The expression gets evaluated after a device has passed the other + // selector expressions for the request in which this expression is used. + // This allows writing expressions that are tailored towards the specific + // devices being requested (for example, by assuming the device is from a + // certain vendor and skipping those checks). + // + // The length of the expression must be smaller or equal to 10 Ki. The + // cost of evaluating it is also limited based on the estimated number + // of logical steps; the combined cost of all derived attributes in a + // claim is capped by a shared CEL cost budget. + // + // +required + // +k8s:required + Expression string `json:"expression" protobuf:"bytes,2,name=expression"` +} + const ( DeviceSelectorsMaxSize = 32 FirstAvailableDeviceRequestMaxSize = 8 DeviceTolerationsMaxLength = 16 + DeviceDerivedAttributesMaxSize = 32 ) // +enum -// +k8s:alpha(since: "1.36")=+k8s:enum +// +k8s:beta(since: "1.37")=+k8s:enum type DeviceAllocationMode string // Valid [DeviceRequest.CountMode] values. @@ -1315,7 +1587,7 @@ type CELDeviceSelector struct { // - driver (string): the name of the driver which defines this device. // - attributes (map[string]object): the device's attributes, grouped by prefix // (e.g. device.attributes["dra.example.com"] evaluates to an object with all - // of the attributes which were prefixed by "dra.example.com". + // of the attributes which were prefixed by "dra.example.com"). // - capacity (map[string]object): the device's capacities, grouped by prefix. // - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device // (v1.34+ with the DRAConsumableCapacity feature enabled). @@ -1348,6 +1620,15 @@ type CELDeviceSelector struct { // A robust expression should check for the existence of attributes // before referencing them. // + // Common errors: + // - "no such key": Use optional chaining (.? followed by orValue()) + // or guarding the check with has() for optional fields. + // See CEL Optional Types for details: + // https://pkg.go.dev/github.com/google/cel-go@v0.17.4/cel#OptionalTypes + // + // For more CEL expression syntax and examples, see: + // https://kubernetes.io/docs/reference/using-api/cel/ + // // For ease of use, the cel.bind() function is enabled, and can be used // to simplify expressions that access multiple attributes with the // same domain. For example: @@ -1395,6 +1676,25 @@ type CELDeviceSelector struct { // However, this depends on how fast the machine is. const CELSelectorExpressionMaxCost = 1000000 +// DeviceClaimDerivedAttributeCELMaxCost is the maximum combined execution cost +// allowed for all derived attribute CEL expressions within a single DeviceClaim. +// +// During validation, the API server computes the estimated execution cost of each +// derived attribute expression. The sum of these costs across all requests in the +// claim must not exceed this budget. If it does, the claim is rejected. +// +// To stay within the budget, consumers should simplify their CEL expressions, +// avoid computationally expensive operations like deep nesting or iterations +// (such as `.all()` or `.exists()`), and minimize the total number of derived +// attributes in a claim. +// +// This shared budget prevents excessively complex claims from degrading the +// performance of the kube-scheduler. The limit is set to 1,000,000 instruction +// executions (roughly 0.1 seconds of evaluation time), tying the collective +// cost of all derived attributes to the maximum cost allowed for a single +// CEL selector. +const DeviceClaimDerivedAttributeCELMaxCost = 1000000 + // CELSelectorExpressionMaxLength is the maximum length of a CEL selector expression string. const CELSelectorExpressionMaxLength = 10 * 1024 @@ -1412,10 +1712,10 @@ type DeviceConstraint struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Requests []string `json:"requests,omitempty" protobuf:"bytes,1,opt,name=requests"` // MatchAttribute requires that all devices in question have this @@ -1438,8 +1738,8 @@ type DeviceConstraint struct { // // +optional // +oneOf=ConstraintType - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-fully-qualified-name + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-fully-qualified-name MatchAttribute *FullyQualifiedName `json:"matchAttribute,omitempty" protobuf:"bytes,2,opt,name=matchAttribute"` // Potential future extension, not part of the current design: @@ -1471,6 +1771,8 @@ type DeviceConstraint struct { // +optional // +oneOf=ConstraintType // +featureGate=DRAConsumableCapacity + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-fully-qualified-name DistinctAttribute *FullyQualifiedName `json:"distinctAttribute,omitempty" protobuf:"bytes,3,opt,name=distinctAttribute"` } @@ -1485,13 +1787,13 @@ type DeviceClaimConfiguration struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Requests []string `json:"requests,omitempty" protobuf:"bytes,1,opt,name=requests"` - DeviceConfiguration `json:",inline" protobuf:"bytes,2,name=deviceConfiguration"` + DeviceConfiguration `json:"" protobuf:"bytes,2,name=deviceConfiguration"` } // DeviceConfiguration must have exactly one field set. It gets embedded @@ -1502,7 +1804,7 @@ type DeviceConfiguration struct { // // +optional // +oneOf=ConfigurationType - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Opaque *OpaqueDeviceConfiguration `json:"opaque,omitempty" protobuf:"bytes,1,opt,name=opaque"` } @@ -1519,9 +1821,9 @@ type OpaqueDeviceConfiguration struct { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:maxLength=63 + // +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name-caseless Driver string `json:"driver" protobuf:"bytes,1,name=driver"` // Parameters can contain arbitrary data. It is the responsibility of @@ -1547,8 +1849,8 @@ type DeviceToleration struct { // Must be a label name. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-label-key + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-label-key Key string `json:"key,omitempty" protobuf:"bytes,1,opt,name=key"` // Operator represents a key's relationship to the value. @@ -1558,7 +1860,7 @@ type DeviceToleration struct { // // +optional // +default="Equal" - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Operator DeviceTolerationOperator `json:"operator,omitempty" protobuf:"bytes,2,opt,name=operator,casttype=DeviceTolerationOperator"` // Value is the taint value the toleration matches to. @@ -1572,7 +1874,7 @@ type DeviceToleration struct { // When specified, allowed values are NoSchedule and NoExecute. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Effect DeviceTaintEffect `json:"effect,omitempty" protobuf:"bytes,4,opt,name=effect,casttype=DeviceTaintEffect"` // TolerationSeconds represents the period of time the toleration (which must be @@ -1589,7 +1891,7 @@ type DeviceToleration struct { // A toleration operator is the set of operators that can be used in a toleration. // // +enum -// +k8s:alpha(since: "1.36")=+k8s:enum +// +k8s:beta(since: "1.37")=+k8s:enum type DeviceTolerationOperator string const ( @@ -1603,8 +1905,8 @@ type ResourceClaimStatus struct { // Allocation is set once the claim has been allocated successfully. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:update=NoModify + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:update=NoModify Allocation *AllocationResult `json:"allocation,omitempty" protobuf:"bytes,1,opt,name=allocation"` // ReservedFor indicates which entities are currently allowed to use @@ -1632,10 +1934,10 @@ type ResourceClaimStatus struct { // +listMapKey=uid // +patchStrategy=merge // +patchMergeKey=uid - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:listType=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=uid - // +k8s:alpha(since: "1.36")=+k8s:maxItems=256 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:listType=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=uid + // +k8s:beta(since: "1.37")=+k8s:maxItems=256 ReservedFor []ResourceClaimConsumerReference `json:"reservedFor,omitempty" protobuf:"bytes,2,opt,name=reservedFor" patchStrategy:"merge" patchMergeKey:"uid"` // DeallocationRequested is tombstoned since Kubernetes 1.32 where @@ -1648,18 +1950,18 @@ type ResourceClaimStatus struct { // information. Entries are owned by their respective drivers. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +listType=map // +listMapKey=driver // +listMapKey=device // +listMapKey=pool // +listMapKey=shareID // +featureGate=DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:listType=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=driver - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=device - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=pool - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=shareID + // +k8s:beta(since: "1.37")=+k8s:listType=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=driver + // +k8s:beta(since: "1.37")=+k8s:listMapKey=device + // +k8s:beta(since: "1.37")=+k8s:listMapKey=pool + // +k8s:beta(since: "1.37")=+k8s:listMapKey=shareID Devices []AllocatedDeviceStatus `json:"devices,omitempty" protobuf:"bytes,4,opt,name=devices"` } @@ -1722,8 +2024,8 @@ type DeviceAllocationResult struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Results []DeviceRequestAllocationResult `json:"results,omitempty" protobuf:"bytes,1,opt,name=results"` // This field is a combination of all the claim and class configuration parameters. @@ -1736,8 +2038,8 @@ type DeviceAllocationResult struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=64 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=64 Config []DeviceAllocationConfiguration `json:"config,omitempty" protobuf:"bytes,2,opt,name=config"` } @@ -1766,9 +2068,9 @@ type DeviceRequestAllocationResult struct { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 + // +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name-caseless + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:maxLength=63 Driver string `json:"driver" protobuf:"bytes,2,name=driver"` // This name together with the driver name and the device name field @@ -1778,8 +2080,8 @@ type DeviceRequestAllocationResult struct { // DNS sub-domains separated by slashes. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-pool-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-pool-name Pool string `json:"pool" protobuf:"bytes,3,name=pool"` // Device references one device instance via its name in the driver's @@ -1811,8 +2113,7 @@ type DeviceRequestAllocationResult struct { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=16 + // +k8s:beta(since: "1.37")=+k8s:optional Tolerations []DeviceToleration `json:"tolerations,omitempty" protobuf:"bytes,6,opt,name=tolerations"` // BindingConditions contains a copy of the BindingConditions @@ -1824,8 +2125,8 @@ type DeviceRequestAllocationResult struct { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 BindingConditions []string `json:"bindingConditions,omitempty" protobuf:"bytes,7,rep,name=bindingConditions"` // BindingFailureConditions contains a copy of the BindingFailureConditions @@ -1837,8 +2138,8 @@ type DeviceRequestAllocationResult struct { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 BindingFailureConditions []string `json:"bindingFailureConditions,omitempty" protobuf:"bytes,8,rep,name=bindingFailureConditions"` // ShareID uniquely identifies an individual allocation share of the device, @@ -1848,8 +2149,8 @@ type DeviceRequestAllocationResult struct { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-uuid ShareID *types.UID `json:"shareID,omitempty" protobuf:"bytes,9,opt,name=shareID"` // ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. @@ -1864,6 +2165,19 @@ type DeviceRequestAllocationResult struct { // +optional // +featureGate=DRAConsumableCapacity ConsumedCapacity map[QualifiedName]resource.Quantity `json:"consumedCapacity,omitempty" protobuf:"bytes,10,rep,name=consumedCapacity"` + + // SkipNodeOperations lists node-local resource operations (gRPC calls) + // that will be skipped for this allocated device when determining whether + // operations are necessary on the node. If all allocated devices for a driver in + // a claim skip an operation, that gRPC call will be skipped. It is a copy of + // the ResourceSlice.spec.skipNodeOperations value at the time when the device was allocated. + // + // +optional + // +listType=set + // +k8s:listType=set + // +featureGate=DRAOptionalNodeOperations + // +k8s:optional + SkipNodeOperations []SkipNodeOperation `json:"skipNodeOperations,omitempty" protobuf:"bytes,11,rep,name=skipNodeOperations,casttype=SkipNodeOperation"` } // DeviceAllocationConfiguration gets embedded in an AllocationResult. @@ -1873,7 +2187,7 @@ type DeviceAllocationConfiguration struct { // or from a claim. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Source AllocationConfigSource `json:"source" protobuf:"bytes,1,name=source"` // Requests lists the names of requests where the configuration applies. @@ -1885,17 +2199,17 @@ type DeviceAllocationConfiguration struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Requests []string `json:"requests,omitempty" protobuf:"bytes,2,opt,name=requests"` - DeviceConfiguration `json:",inline" protobuf:"bytes,3,name=deviceConfiguration"` + DeviceConfiguration `json:"" protobuf:"bytes,3,name=deviceConfiguration"` } // +enum -// +k8s:alpha(since: "1.36")=+k8s:enum +// +k8s:beta(since: "1.37")=+k8s:enum type AllocationConfigSource string // Valid [DeviceAllocationConfiguration.Source] values. @@ -1909,7 +2223,7 @@ const ( // ResourceClaimList is a collection of claims. type ResourceClaimList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -1931,11 +2245,11 @@ type ResourceClaimList struct { // This is an alpha type and requires enabling the DynamicResourceAllocation // feature gate. type DeviceClass struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata // +optional - // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:format=k8s-long-name + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:format=k8s-long-name metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec defines what can be allocated and how to configure it. @@ -1946,6 +2260,7 @@ type DeviceClass struct { // the time of allocation. // // Changing the spec automatically increments the metadata.generation number. + // +optional Spec DeviceClassSpec `json:"spec" protobuf:"bytes,2,name=spec"` } @@ -1956,8 +2271,8 @@ type DeviceClassSpec struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,1,opt,name=selectors"` // Config defines configuration parameters that apply to each device that is claimed via this class. @@ -1968,8 +2283,8 @@ type DeviceClassSpec struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Config []DeviceClassConfiguration `json:"config,omitempty" protobuf:"bytes,2,opt,name=config"` // SuitableNodes is tombstoned since Kubernetes 1.32 where @@ -1986,17 +2301,16 @@ type DeviceClassSpec struct { // If two classes are created at the same time, then the name of the class // lexicographically sorted first is picked. // - // This is a beta field. // +optional // +featureGate=DRAExtendedResource - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-extended-resource-name + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-extended-resource-name ExtendedResourceName *string `json:"extendedResourceName,omitempty" protobuf:"bytes,4,opt,name=extendedResourceName"` } // DeviceClassConfiguration is used in DeviceClass. type DeviceClassConfiguration struct { - DeviceConfiguration `json:",inline" protobuf:"bytes,1,opt,name=deviceConfiguration"` + DeviceConfiguration `json:"" protobuf:"bytes,1,opt,name=deviceConfiguration"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object @@ -2004,7 +2318,7 @@ type DeviceClassConfiguration struct { // DeviceClassList is a collection of classes. type DeviceClassList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -2022,7 +2336,7 @@ type DeviceClassList struct { // This is an alpha type and requires enabling the DynamicResourceAllocation // feature gate. type ResourceClaimTemplate struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -2032,6 +2346,7 @@ type ResourceClaimTemplate struct { // This field is immutable. A ResourceClaim will get created by the // control plane for a Pod when needed and then not get updated // anymore. + // +optional Spec ResourceClaimTemplateSpec `json:"spec" protobuf:"bytes,2,name=spec"` } @@ -2041,11 +2356,13 @@ type ResourceClaimTemplateSpec struct { // when creating it. No other fields are allowed and will be rejected during // validation. // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec for the ResourceClaim. The entire content is copied unchanged // into the ResourceClaim that gets created from this template. The // same fields as in a ResourceClaim are also valid here. + // +optional Spec ResourceClaimSpec `json:"spec" protobuf:"bytes,2,name=spec"` } @@ -2054,7 +2371,7 @@ type ResourceClaimTemplateSpec struct { // ResourceClaimTemplateList is a collection of claim templates. type ResourceClaimTemplateList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -2116,8 +2433,8 @@ type AllocatedDeviceStatus struct { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-uuid ShareID *string `json:"shareID,omitempty" protobuf:"bytes,7,opt,name=shareID"` // Conditions contains the latest observation of the device's state. @@ -2129,6 +2446,9 @@ type AllocatedDeviceStatus struct { // +optional // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type Conditions []metav1.Condition `json:"conditions" protobuf:"bytes,4,opt,name=conditions"` // Data contains arbitrary driver-specific data. @@ -2141,7 +2461,7 @@ type AllocatedDeviceStatus struct { // NetworkData contains network-related information specific to the device. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional NetworkData *NetworkDeviceData `json:"networkData,omitempty" protobuf:"bytes,6,opt,name=networkData"` } @@ -2156,8 +2476,8 @@ type NetworkDeviceData struct { // Must not be longer than 256 bytes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxBytes=256 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxBytes=256 InterfaceName string `json:"interfaceName,omitempty" protobuf:"bytes,1,opt,name=interfaceName"` // IPs lists the network addresses assigned to the device's network interface. @@ -2170,10 +2490,10 @@ type NetworkDeviceData struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=16 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=16 IPs []string `json:"ips,omitempty" protobuf:"bytes,2,opt,name=ips"` // HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface. @@ -2181,7 +2501,7 @@ type NetworkDeviceData struct { // Must not be longer than 128 bytes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxBytes=128 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxBytes=128 HardwareAddress string `json:"hardwareAddress,omitempty" protobuf:"bytes,3,opt,name=hardwareAddress"` } diff --git a/vendor/k8s.io/api/resource/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/resource/v1beta1/types_swagger_doc_generated.go index 4b147a3f3e..d1485ad84a 100644 --- a/vendor/k8s.io/api/resource/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/resource/v1beta1/types_swagger_doc_generated.go @@ -54,19 +54,19 @@ func (AllocationResult) SwaggerDoc() map[string]string { } var map_BasicDevice = map[string]string{ - "": "BasicDevice defines one device instance.", - "attributes": "Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", - "capacity": "Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", - "consumesCounters": "ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets.\n\nThere can only be a single entry per counterSet.\n\nThe maximum number of device counter consumptions per device is 2.", - "nodeName": "NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", - "nodeSelector": "NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", - "allNodes": "AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", - "taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", - "bindsToNode": "BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "bindingConditions": "BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod.\n\nThe maximum number of binding conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "bindingFailureConditions": "BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is true, a binding failure occurred.\n\nThe maximum number of binding failure conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "allowMultipleAllocations": "AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.\n\nIf AllowMultipleAllocations is set to true, the device can be allocated more than once, and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.", - "nodeAllocatableResourceMappings": "NodeAllocatableResourceMappings defines the mapping of node resources that are managed by the DRA driver exposing this device. This includes resources currently reported in v1.Node `status.allocatable` that are not extended resources (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). Examples include \"cpu\", \"memory\", \"ephemeral-storage\", and hugepages. In addition to standard requests made through the Pod `spec`, these resources can also be requested through claims and allocated by the DRA driver. For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory dependencies of an accelerator device. The keys of this map are the node-allocatable resource names (e.g., \"cpu\", \"memory\"). Extended resource names are not permitted as keys.", + "": "BasicDevice defines one device instance.", + "attributes": "Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", + "capacity": "Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", + "consumesCounters": "ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets.\n\nThere can only be a single entry per counterSet.\n\nThe maximum number of device counter consumptions per device is 2.", + "nodeName": "NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", + "nodeSelector": "NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", + "allNodes": "AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", + "taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", + "bindsToNode": "BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "bindingConditions": "BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod.\n\nThe maximum number of binding conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "bindingFailureConditions": "BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is true, a binding failure occurred.\n\nThe maximum number of binding failure conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "allowMultipleAllocations": "AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.\n\nIf AllowMultipleAllocations is set to true, the device can be allocated more than once, and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.", + "nodeAllocatableResources": "NodeAllocatableResources defines the mapping of node resources that are managed by the DRA driver exposing this device. This includes resources currently reported in v1.Node `status.allocatable` that are not extended resources (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). Examples include \"cpu\", \"memory\", \"ephemeral-storage\", and hugepages. In addition to standard requests made through the Pod `spec`, these resources can also be requested through claims and allocated by the DRA driver. For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory dependencies of an accelerator device. The keys of this map are the node-allocatable resource names (e.g., \"cpu\", \"memory\"). Extended resource names are not permitted as keys.", } func (BasicDevice) SwaggerDoc() map[string]string { @@ -75,7 +75,7 @@ func (BasicDevice) SwaggerDoc() map[string]string { var map_CELDeviceSelector = map[string]string{ "": "CELDeviceSelector contains a CEL expression for selecting a device.", - "expression": "Expression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort.\n\nThe expression's input is an object named \"device\", which carries the following properties:\n - driver (string): the name of the driver which defines this device.\n - attributes (map[string]object): the device's attributes, grouped by prefix\n (e.g. device.attributes[\"dra.example.com\"] evaluates to an object with all\n of the attributes which were prefixed by \"dra.example.com\".\n - capacity (map[string]object): the device's capacities, grouped by prefix.\n - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device\n (v1.34+ with the DRAConsumableCapacity feature enabled).\n\nExample: Consider a device with driver=\"dra.example.com\", which exposes two attributes named \"model\" and \"ext.example.com/family\" and which exposes one capacity named \"modules\". This input to this expression would have the following fields:\n\n device.driver\n device.attributes[\"dra.example.com\"].model\n device.attributes[\"ext.example.com\"].family\n device.capacity[\"dra.example.com\"].modules\n\nThe device.driver field can be used to check for a specific driver, either as a high-level precondition (i.e. you only want to consider devices from this driver) or as part of a multi-clause expression that is meant to consider devices from different drivers.\n\nThe value type of each attribute is defined by the device definition, and users who write these expressions must consult the documentation for their specific drivers. The value type of each capacity is Quantity.\n\nIf an unknown prefix is used as a lookup in either device.attributes or device.capacity, an empty map will be returned. Any reference to an unknown field will cause an evaluation error and allocation to abort.\n\nA robust expression should check for the existence of attributes before referencing them.\n\nFor ease of use, the cel.bind() function is enabled, and can be used to simplify expressions that access multiple attributes with the same domain. For example:\n\n cel.bind(dra, device.attributes[\"dra.example.com\"], dra.someBool && dra.anotherBool)\n\nWhen the DRAListTypeAttributes feature gate is enabled, the includes() helper is available and it can work for both scalar and list-type attributes. It was introduced to support smooth migration from scalar attributes to list-type attributes while keeping CEL expressions simple. For example:\n\n device.attributes[\"dra.example.com\"].models.includes(\"some-model\")\n\nThe length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps.", + "expression": "Expression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort.\n\nThe expression's input is an object named \"device\", which carries the following properties:\n - driver (string): the name of the driver which defines this device.\n - attributes (map[string]object): the device's attributes, grouped by prefix\n (e.g. device.attributes[\"dra.example.com\"] evaluates to an object with all\n of the attributes which were prefixed by \"dra.example.com\").\n - capacity (map[string]object): the device's capacities, grouped by prefix.\n - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device\n (v1.34+ with the DRAConsumableCapacity feature enabled).\n\nExample: Consider a device with driver=\"dra.example.com\", which exposes two attributes named \"model\" and \"ext.example.com/family\" and which exposes one capacity named \"modules\". This input to this expression would have the following fields:\n\n device.driver\n device.attributes[\"dra.example.com\"].model\n device.attributes[\"ext.example.com\"].family\n device.capacity[\"dra.example.com\"].modules\n\nThe device.driver field can be used to check for a specific driver, either as a high-level precondition (i.e. you only want to consider devices from this driver) or as part of a multi-clause expression that is meant to consider devices from different drivers.\n\nThe value type of each attribute is defined by the device definition, and users who write these expressions must consult the documentation for their specific drivers. The value type of each capacity is Quantity.\n\nIf an unknown prefix is used as a lookup in either device.attributes or device.capacity, an empty map will be returned. Any reference to an unknown field will cause an evaluation error and allocation to abort.\n\nA robust expression should check for the existence of attributes before referencing them.\n\nCommon errors: - \"no such key\": Use optional chaining (.? followed by orValue())\n or guarding the check with has() for optional fields.\n See CEL Optional Types for details:\n https://pkg.go.dev/github.com/google/cel-go@v0.17.4/cel#OptionalTypes\n\nFor more CEL expression syntax and examples, see: https://kubernetes.io/docs/reference/using-api/cel/\n\nFor ease of use, the cel.bind() function is enabled, and can be used to simplify expressions that access multiple attributes with the same domain. For example:\n\n cel.bind(dra, device.attributes[\"dra.example.com\"], dra.someBool && dra.anotherBool)\n\nWhen the DRAListTypeAttributes feature gate is enabled, the includes() helper is available and it can work for both scalar and list-type attributes. It was introduced to support smooth migration from scalar attributes to list-type attributes while keeping CEL expressions simple. For example:\n\n device.attributes[\"dra.example.com\"].models.includes(\"some-model\")\n\nThe length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps.", } func (CELDeviceSelector) SwaggerDoc() map[string]string { @@ -94,7 +94,7 @@ func (CapacityRequestPolicy) SwaggerDoc() map[string]string { } var map_CapacityRequestPolicyRange = map[string]string{ - "": "CapacityRequestPolicyRange defines a valid range for consumable capacity values.\n\n - If the requested amount is less than Min, it is rounded up to the Min value.\n - If Step is set and the requested amount is between Min and Max but not aligned with Step,\n it will be rounded up to the next value equal to Min + (n * Step).\n - If Step is not set, the requested amount is used as-is if it falls within the range Min to Max (if set).\n - If the requested or rounded amount exceeds Max (if set), the request does not satisfy the policy,\n and the device cannot be allocated.", + "": "CapacityRequestPolicyRange defines a valid range for consumable capacity values.\n\nIf the DRAFractionalCapacityRange feature gate is enabled and at least one of Min, Max, or Step is a fractional quantity (i.e. its value is not an integer), milli-unit arithmetic is used instead, supporting values with up to 3 decimal places (e.g. 100m = 0.1). The largest supported value then is 1000 times smaller compared to using 64-bit integers. Otherwise, all comparisons use 64-bit integer arithmetic via resource.Quantity.Value().\n\n - If the requested amount is less than Min, it is rounded up to the Min value.\n - If Step is set and the requested amount is between Min and Max but not aligned with Step,\n it will be rounded up to the next value equal to Min + (n * Step).\n - If Step is not set, the requested amount is used as-is if it falls within the range Min to Max (if set).\n - If the requested or rounded amount exceeds Max (if set), the request does not satisfy the policy,\n and the device cannot be allocated.", "min": "Min specifies the minimum capacity allowed for a consumption request.\n\nMin must be greater than or equal to zero, and less than or equal to the capacity value. requestPolicy.default must be more than or equal to the minimum.", "max": "Max defines the upper limit for capacity that can be requested.\n\nMax must be less than or equal to the capacity value. Min and requestPolicy.default must be less than or equal to the maximum.", "step": "Step defines the step size between valid capacity amounts within the range.\n\nMax (if set) and requestPolicy.default must be a multiple of Step. Min + Step must be less than or equal to the capacity value.", @@ -240,7 +240,7 @@ var map_DeviceClassSpec = map[string]string{ "": "DeviceClassSpec is used in a [DeviceClass] to define what can be allocated and how to configure it.", "selectors": "Each selector must be satisfied by a device which is claimed via this class.", "config": "Config defines configuration parameters that apply to each device that is claimed via this class. Some classses may potentially be satisfied by multiple drivers, so each instance of a vendor configuration applies to exactly one driver.\n\nThey are passed to the driver, but are not considered while allocating the claim.", - "extendedResourceName": "ExtendedResourceName is the extended resource name for the devices of this class. The devices of this class can be used to satisfy a pod's extended resource requests. It has the same format as the name of a pod's extended resource. It should be unique among all the device classes in a cluster. If two device classes have the same name, then the class created later is picked to satisfy a pod's extended resource requests. If two classes are created at the same time, then the name of the class lexicographically sorted first is picked.\n\nThis is a beta field.", + "extendedResourceName": "ExtendedResourceName is the extended resource name for the devices of this class. The devices of this class can be used to satisfy a pod's extended resource requests. It has the same format as the name of a pod's extended resource. It should be unique among all the device classes in a cluster. If two device classes have the same name, then the class created later is picked to satisfy a pod's extended resource requests. If two classes are created at the same time, then the name of the class lexicographically sorted first is picked.", } func (DeviceClassSpec) SwaggerDoc() map[string]string { @@ -268,26 +268,38 @@ func (DeviceConstraint) SwaggerDoc() map[string]string { } var map_DeviceCounterConsumption = map[string]string{ - "": "DeviceCounterConsumption defines a set of counters that a device will consume from a CounterSet.", - "counterSet": "CounterSet is the name of the set from which the counters defined will be consumed.", - "counters": "Counters defines the counters that will be consumed by the device.\n\nThe maximum number of counters is 32.", + "": "DeviceCounterConsumption defines a set of counters that a device will consume from a CounterSet.", + "counterSet": "CounterSet is the name of the set from which the counters defined will be consumed.", + "counters": "Counters defines the counters that will be consumed by the device.\n\nThe maximum number of counters is 32.", + "compatibilityGroups": "CompatibilityGroups is a list of opaque group names for this counter set consumption.\n\nDevices that consume counters from the same counter set may only be allocated at the same time (\"co-allocated\") if they all share at least one common group: the intersection of the CompatibilityGroups of all co-allocated devices on that counter set must be non-empty. Devices that consume from different counter sets are never compared via this field.\n\nAn unset field, an explicit nil, and an empty list are equivalent and mean \"no groups\": such a device is only co-allocatable with sibling devices on the same counter set that also have no groups, and is never co-allocatable with a device that declares one or more groups.\n\nGroup names are opaque and meaningful only within the publishing driver's pool.\n\nThe maximum number of groups is 2, and the names must be unique.", } func (DeviceCounterConsumption) SwaggerDoc() map[string]string { return map_DeviceCounterConsumption } +var map_DeviceDerivedAttribute = map[string]string{ + "": "DeviceDerivedAttribute defines a derived attribute computed via CEL.", + "name": "Name is the identifier for this derived attribute, used in constraints.\n\nIt must be a DNS subdomain followed by a slash (\"/\") followed by a C identifier (e.g. \"example.com/numaNode\" or \"derived/numaNode\").\n\nIf the chosen name matches an existing physical attribute from a driver, the derived attribute's expression will shadow the physical attribute, and its evaluated value will be used in constraints instead. When the goal is to define a derived attribute that is only used within the ResourceClaim and not meant to shadow an existing attribute, use a domain prefix that no DRA driver should be using (e.g. \"derived/myAttribute\").\n\nIt is not valid to define a derived attribute that isn't used in at least one constraint.", + "expression": "Expression is a CEL expression evaluated against each candidate device. The expression must evaluate to a primitive scalar (string, integer, boolean, or semver) or a list of these scalars ([]string, []int64, []bool, []semver) to act as a virtual grouping key. Any other return type is an error and causes CEL evaluation for the device to fail.\n\nThe expression's input is an object named \"device\", which carries the same properties as in a CELDeviceSelector.\n\nWhen pod scheduling encounters CEL runtime errors (such as looking up an attribute that isn't defined) for some devices, it will abort allocation and fail scheduling for the Pod. Surfacing evaluation errors immediately prevents silent topology matching failures that are extremely hard to detect. A robust expression should, for example, check for the existence of attributes before referencing them to avoid runtime evaluation errors.\n\nThe expression gets evaluated after a device has passed the other selector expressions for the request in which this expression is used. This allows writing expressions that are tailored towards the specific devices being requested (for example, by assuming the device is from a certain vendor and skipping those checks).\n\nThe length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps; the combined cost of all derived attributes in a claim is capped by a shared CEL cost budget.", +} + +func (DeviceDerivedAttribute) SwaggerDoc() map[string]string { + return map_DeviceDerivedAttribute +} + var map_DeviceRequest = map[string]string{ - "": "DeviceRequest is a request for devices required for a claim. This is typically a request for a single resource like a device, but can also ask for several identical devices.", - "name": "Name can be used to reference this request in a pod.spec.containers[].resources.claims entry and in a constraint of the claim.\n\nMust be a DNS label and unique among all DeviceRequests in a ResourceClaim.", - "deviceClassName": "DeviceClassName references a specific DeviceClass, which can define additional configuration and selectors to be inherited by this request.\n\nA class is required if no subrequests are specified in the firstAvailable list and no class can be set if subrequests are specified in the firstAvailable list. Which classes are available depends on the cluster.\n\nAdministrators may use this to restrict which devices may get requested by only installing classes with selectors for permitted devices. If users are free to request anything without restrictions, then administrators can create an empty DeviceClass for users to reference.", - "selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this request. All selectors must be satisfied for a device to be considered.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.", - "allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this request. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This request is for all of the matching devices in a pool.\n At least one device must exist on the node for the allocation to succeed.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other requests must specify this field.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.", - "count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.", - "adminAccess": "AdminAccess indicates that this is a claim for administrative access to the device(s). Claims with AdminAccess are expected to be used for monitoring or other management services for a device. They ignore all ordinary claims to the device with respect to access modes and any resource allocations.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.\n\nThis is an alpha field and requires enabling the DRAAdminAccess feature gate. Admin access is disabled if this field is unset or set to false, otherwise it is enabled.", - "firstAvailable": "FirstAvailable contains subrequests, of which exactly one will be satisfied by the scheduler to satisfy this request. It tries to satisfy them in the order in which they are listed here. So if there are two entries in the list, the scheduler will only check the second one if it determines that the first one cannot be used.\n\nThis field may only be set in the entries of DeviceClaim.Requests.\n\nDRA does not yet implement scoring, so the scheduler will select the first set of devices that satisfies all the requests in the claim. And if the requirements can be satisfied on more than one node, other scheduling features will determine which node is chosen. This means that the set of devices allocated to a claim might not be the optimal set available to the cluster. Scoring will be implemented later.", - "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", - "capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.", + "": "DeviceRequest is a request for devices required for a claim. This is typically a request for a single resource like a device, but can also ask for several identical devices.", + "name": "Name can be used to reference this request in a pod.spec.containers[].resources.claims entry and in a constraint of the claim.\n\nMust be a DNS label and unique among all DeviceRequests in a ResourceClaim.", + "deviceClassName": "DeviceClassName references a specific DeviceClass, which can define additional configuration and selectors to be inherited by this request.\n\nA class is required if no subrequests are specified in the firstAvailable list and no class can be set if subrequests are specified in the firstAvailable list. Which classes are available depends on the cluster.\n\nAdministrators may use this to restrict which devices may get requested by only installing classes with selectors for permitted devices. If users are free to request anything without restrictions, then administrators can create an empty DeviceClass for users to reference.", + "selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this request. All selectors must be satisfied for a device to be considered.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.", + "allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this request. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This request is for all of the matching devices in a pool.\n At least one device must exist on the node for the allocation to succeed.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other requests must specify this field.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.", + "count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.", + "adminAccess": "AdminAccess indicates that this is a claim for administrative access to the device(s). Claims with AdminAccess are expected to be used for monitoring or other management services for a device. They ignore all ordinary claims to the device with respect to access modes and any resource allocations.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.\n\nThis is an alpha field and requires enabling the DRAAdminAccess feature gate. Admin access is disabled if this field is unset or set to false, otherwise it is enabled.", + "firstAvailable": "FirstAvailable contains subrequests, of which exactly one will be satisfied by the scheduler to satisfy this request. It tries to satisfy them in the order in which they are listed here. So if there are two entries in the list, the scheduler will only check the second one if it determines that the first one cannot be used.\n\nThis field may only be set in the entries of DeviceClaim.Requests.\n\nDRA does not yet implement scoring, so the scheduler will select the first set of devices that satisfies all the requests in the claim. And if the requirements can be satisfied on more than one node, other scheduling features will determine which node is chosen. This means that the set of devices allocated to a claim might not be the optimal set available to the cluster. Scoring will be implemented later.", + "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", + "capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.", + "derivedAttributes": "DerivedAttributes defines a set of virtual attributes computed via CEL expressions for each candidate device. These virtual attributes can be referenced in `.devices.constraints` to align and match different devices (e.g., co-allocating a GPU and a NIC on the same NUMA node) even if their drivers publish different attributes. Derived attributes are not available via `device.attributes` in the CEL environment when evaluating selector expressions.\n\nDerived attributes allow you to extract, transform, or normalize topology information (such as extracting a NUMA index from a complex topology string or renaming a vendor-specific attribute) into a common virtual attribute name at scheduling time. The scheduler then evaluates these virtual attributes exactly like static attributes when matching constraints.\n\nEvery derived attribute defined in this list must be referenced by at least one MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list.\n\nThe maximum number of derived attributes is 32.\n\nThis is an alpha field and requires enabling the DRADerivedAttributes feature gate.", } func (DeviceRequest) SwaggerDoc() map[string]string { @@ -306,6 +318,7 @@ var map_DeviceRequestAllocationResult = map[string]string{ "bindingFailureConditions": "BindingFailureConditions contains a copy of the BindingFailureConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", "shareID": "ShareID uniquely identifies an individual allocation share of the device, used when the device supports multiple simultaneous allocations. It serves as an additional map key to differentiate concurrent shares of the same device.", "consumedCapacity": "ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. The consumed amount may differ from the requested amount: it is rounded up to the nearest valid value based on the device’s requestPolicy if applicable (i.e., may not be less than the requested amount).\n\nThe total consumed capacity for each device must not exceed the DeviceCapacity's Value.\n\nThis field is populated only for devices that allow multiple allocations. All capacity entries are included, even if the consumed amount is zero.", + "skipNodeOperations": "SkipNodeOperations lists node-local resource operations (gRPC calls) that will be skipped for this allocated device when determining whether operations are necessary on the node. If all allocated devices for a driver in a claim skip an operation, that gRPC call will be skipped. It is a copy of the ResourceSlice.spec.skipNodeOperations value at the time when the device was allocated.", } func (DeviceRequestAllocationResult) SwaggerDoc() map[string]string { @@ -322,14 +335,15 @@ func (DeviceSelector) SwaggerDoc() map[string]string { } var map_DeviceSubRequest = map[string]string{ - "": "DeviceSubRequest describes a request for device provided in the claim.spec.devices.requests[].firstAvailable array. Each is typically a request for a single resource like a device, but can also ask for several identical devices.\n\nDeviceSubRequest is similar to Request, but doesn't expose the AdminAccess or FirstAvailable fields, as those can only be set on the top-level request. AdminAccess is not supported for requests with a prioritized list, and recursive FirstAvailable fields are not supported.", - "name": "Name can be used to reference this subrequest in the list of constraints or the list of configurations for the claim. References must use the format
/.\n\nMust be a DNS label.", - "deviceClassName": "DeviceClassName references a specific DeviceClass, which can define additional configuration and selectors to be inherited by this subrequest.\n\nA class is required. Which classes are available depends on the cluster.\n\nAdministrators may use this to restrict which devices may get requested by only installing classes with selectors for permitted devices. If users are free to request anything without restrictions, then administrators can create an empty DeviceClass for users to reference.", - "selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this subrequest. All selectors must be satisfied for a device to be considered.", - "allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this subrequest. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This subrequest is for all of the matching devices in a pool.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other subrequests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.", - "count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.", - "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", - "capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.", + "": "DeviceSubRequest describes a request for device provided in the claim.spec.devices.requests[].firstAvailable array. Each is typically a request for a single resource like a device, but can also ask for several identical devices.\n\nDeviceSubRequest is similar to Request, but doesn't expose the AdminAccess or FirstAvailable fields, as those can only be set on the top-level request. AdminAccess is not supported for requests with a prioritized list, and recursive FirstAvailable fields are not supported.", + "name": "Name can be used to reference this subrequest in the list of constraints or the list of configurations for the claim. References must use the format
/.\n\nMust be a DNS label.", + "deviceClassName": "DeviceClassName references a specific DeviceClass, which can define additional configuration and selectors to be inherited by this subrequest.\n\nA class is required. Which classes are available depends on the cluster.\n\nAdministrators may use this to restrict which devices may get requested by only installing classes with selectors for permitted devices. If users are free to request anything without restrictions, then administrators can create an empty DeviceClass for users to reference.", + "selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this subrequest. All selectors must be satisfied for a device to be considered.", + "allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this subrequest. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This subrequest is for all of the matching devices in a pool.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other subrequests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.", + "count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.", + "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", + "capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.", + "derivedAttributes": "DerivedAttributes defines a set of virtual attributes computed via CEL expressions for each candidate device. These virtual attributes can be referenced in `.devices.constraints` to align and match different devices (e.g., co-allocating a GPU and a NIC on the same NUMA node) even if their drivers publish different attributes. Derived attributes are not available via `device.attributes` in the CEL environment when evaluating selector expressions.\n\nDerived attributes allow you to extract, transform, or normalize topology information (such as extracting a NUMA index from a complex topology string or renaming a vendor-specific attribute) into a common virtual attribute name at scheduling time. The scheduler then evaluates these virtual attributes exactly like static attributes when matching constraints.\n\nEvery derived attribute defined in this list must be referenced by at least one MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list.\n\nThe maximum number of derived attributes is 32.\n\nThis is an alpha field and requires enabling the DRADerivedAttributes feature gate.", } func (DeviceSubRequest) SwaggerDoc() map[string]string { @@ -372,14 +386,35 @@ func (NetworkDeviceData) SwaggerDoc() map[string]string { return map_NetworkDeviceData } -var map_NodeAllocatableResourceMapping = map[string]string{ - "": "NodeAllocatableResourceMapping defines the translation between the DRA device/capacity units requested to the corresponding quantity of the node allocatable resource.", - "capacityKey": "CapacityKey references a capacity name defined as a key in the `spec.devices[*].capacity` map. When this field is set, the value associated with this key in the `status.allocation.devices.results[*].consumedCapacity` map (for a specific claim allocation) determines the base quantity for the node allocatable resource. If `allocationMultiplier` is also set, it is multiplied with the base quantity. For example, if `spec.devices[*].capacity` has an entry \"dra.example.com/memory\": \"128Gi\", and this field is set to \"dra.example.com/memory\", then for a claim allocation that consumes { \"dra.example.com/memory\": \"4Gi\" } the base quantity for the node allocatable resource mapping will be \"4Gi\", and `allocationMultiplier` should be omitted or set to \"1\".", - "allocationMultiplier": "AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim.\n\t a. A DRA driver representing each CPU core as a device would have\n {ResourceName: \"cpu\", allocationMultiplier: \"2\"} in its\n `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim,\n\t\t 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity.\n b. A GPU device that needs additional node memory per GPU allocation would\n have {ResourceName: \"memory\", allocationMultiplier: \"2Gi\"}. Each allocated\n\t\t GPU device instance of this type will account for 2Gi of memory.\n\n2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed.\n\t The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`.\n For example, if a Device's capacity \"dra.example.com/cores\" is consumed,\n and each \"core\" provides 2 \"cpu\"s, the mapping would be:\n {ResourceName: \"cpu\", capacityKey: \"dra.example.com/cores\", allocationMultiplier: \"2\"}.\n If a claim consumes 8 \"dra.example.com/cores\", the CPU footprint is 8 * 2 = 16.", +var map_NodeAllocatableMapping = map[string]string{ + "": "NodeAllocatableMapping defines how a DRA allocation directly translates into a node allocatable resource quantity. The mapping can be derived from either the count of allocated devices or the specific capacity consumed. These options are mutually exclusive. Kubelet adds this mapped resource quantity from claim to both requests and limits at the pod-level cgroup, and to limits at the container-level cgroup for each container referencing the claim.", + "capacityKey": "CapacityKey references a capacity name defined as a key in the `spec.devices[*].capacity` map. When this field is set, the value associated with this key in the `status.allocation.devices.results[*].consumedCapacity` map (for a specific claim allocation) determines the base quantity for the node allocatable resource. `capacityMultiplier` must also be set and is multiplied with the base quantity. For example, if `spec.devices[*].capacity` has an entry \"dra.example.com/memory\": \"128Gi\", and this field is set to \"dra.example.com/memory\", then for a claim allocation that consumes { \"dra.example.com/memory\": \"4Gi\" } the base quantity for the node allocatable resource mapping will be \"4Gi\". The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`.", + "capacityMultiplier": "CapacityMultiplier is used as a multiplier for the allocated capacity consumed. It is only valid if `capacityKey` is set. The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. For example, if a Device's capacity \"dra.example.com/cores\" is consumed, and each \"core\" provides 2 \"cpu\"s, the mapping would be: {ResourceName: \"cpu\", capacityKey: \"dra.example.com/cores\", capacityMultiplier: \"2\"}. If a claim consumes 8 \"dra.example.com/cores\", the CPU footprint is 8 * 2 = 16.", + "deviceMultiplier": "DeviceMultiplier is used as a multiplier for the allocated device count in the claim. The final node allocatable resource amount is `deviceCount` * `deviceMultiplier`. For example, a DRA driver representing each cache complex (CCX) as a device would have {ResourceName: \"cpu\", deviceMultiplier: \"8\"} in its `nodeAllocatableResources`. If 2 devices (CCX) are allocated to the claim, 2 * 8 = 16 CPUs would be considered as allocated. It is only valid when `capacityKey` and `capacityMultiplier` are not set.", +} + +func (NodeAllocatableMapping) SwaggerDoc() map[string]string { + return map_NodeAllocatableMapping +} + +var map_NodeAllocatableOverhead = map[string]string{ + "": "NodeAllocatableOverhead defines auxiliary resource overheads incurred when allocating a device. Overheads can be specified as a fixed cost per pod referencing the claim, a variable cost per container reference, or both. Kubelet accounts for this overhead by adding it to both the pod-level and container-level cgroups of referencing containers.", + "perPod": "PerPod is overhead applied once per pod referencing the claim on this node. This is a flat overhead incurred for every pod referencing the claim.", + "perContainer": "PerContainer is applied per container reference to the claim. This models overhead scaling linearly with the number of containers actively using the device. When both PerPod and PerContainer are specified, the total overhead allocated for each pod referencing the claim is computed as: Quantity = PerPod + (PerContainer * NumReferences) Kubelet accounts for this overhead in cgroups: - Pod-level cgroup (requests and limits): Kubelet adds PerPod + (PerContainer * NumReferences). - Container-level cgroup (limits only): Kubelet adds PerPod + PerContainer for each referencing container. This allows any single container to access the pod-level overhead, while the parent cgroup caps the total usage to account for PerPod exactly once.", +} + +func (NodeAllocatableOverhead) SwaggerDoc() map[string]string { + return map_NodeAllocatableOverhead +} + +var map_NodeAllocatableResource = map[string]string{ + "": "NodeAllocatableResource defines the translation between the DRA device/capacity units requested to the corresponding quantity of the node allocatable resource. At least one of Mapping or Overhead must be specified. Not specifying either is an invalid configuration.", + "mapping": "Mapping is used when the device directly models a node allocatable resource like standard CPU or memory (e.g., with a CPU DRA driver). The calculated quantity is accounted for exactly once per claim instance on the node. To prevent node cgroup isolation friction, the scheduler explicitly blocks sharing mapped device claims across multiple pods.", + "overhead": "Overhead contains fields for modeling auxiliary overhead incurred on node allocatable resources when allocating devices that are not themselves modeling a node allocatable resource (e.g., host memory overhead for GPUs). Sharing overhead-mapped claims across multiple pods is allowed. The node allocatable overhead is accounted for individually for each pod referencing the claim. Overhead is always subtracted from the node's allocatable capacity for the resource, even when mapping is specified for the same resource. Eg: If a device models memory capacity per socket as a consumable capacity pool via Mapping (with CapacityKey), any overhead specified for the same resource will be subtracted from the node's general allocatable capacity and not from the per-socket capacity pool in Mapping.", } -func (NodeAllocatableResourceMapping) SwaggerDoc() map[string]string { - return map_NodeAllocatableResourceMapping +func (NodeAllocatableResource) SwaggerDoc() map[string]string { + return map_NodeAllocatableResource } var map_OpaqueDeviceConfiguration = map[string]string{ @@ -477,7 +512,7 @@ func (ResourceClaimTemplateSpec) SwaggerDoc() map[string]string { var map_ResourcePool = map[string]string{ "": "ResourcePool describes the pool that ResourceSlices belong to.", - "name": "Name is used to identify the pool. For node-local devices, this is often the node name, but this is not required.\n\nIt must not be longer than 253 characters and must consist of one or more DNS sub-domains separated by slashes. This field is immutable.", + "name": "Name is used to identify the pool. For node-local devices, this is often the node name, but this is not required. A field selector can be used to list only ResourceSlice objects belonging to a certain pool.\n\nIt must not be longer than 253 characters and must consist of one or more DNS sub-domains separated by slashes. This field is immutable.", "generation": "Generation tracks the change in a pool over time. Whenever a driver changes something about one or more of the resources in a pool, it must change the generation in all ResourceSlices which are part of that pool. Consumers of ResourceSlices should only consider resources from the pool with the highest generation number. The generation may be reset by drivers, which should be fine for consumers, assuming that all ResourceSlices in a pool are updated to match or deleted.\n\nCombined with ResourceSliceCount, this mechanism enables consumers to detect pools which are comprised of multiple ResourceSlices and are in an incomplete state.", "resourceSliceCount": "ResourceSliceCount is the total number of ResourceSlices in the pool at this generation number. Must be greater than zero.\n\nConsumers can use this to check whether they have seen all ResourceSlices belonging to the same pool.", } @@ -516,6 +551,8 @@ var map_ResourceSliceSpec = map[string]string{ "devices": "Devices lists some or all of the devices in this pool.\n\nMust not have more than 128 entries. If any device uses taints or consumes counters the limit is 64.\n\nOnly one of Devices and SharedCounters can be set in a ResourceSlice.", "perDeviceNodeSelection": "PerDeviceNodeSelection defines whether the access from nodes to resources in the pool is set on the ResourceSlice level or on each device. If it is set to true, every device defined the ResourceSlice must specify this individually.\n\nExactly one of NodeName, NodeSelector, AllNodes, and PerDeviceNodeSelection must be set.", "sharedCounters": "SharedCounters defines a list of counter sets, each of which has a name and a list of counters available.\n\nThe names of the counter sets must be unique in the ResourcePool.\n\nOnly one of Devices and SharedCounters can be set in a ResourceSlice.\n\nThe maximum number of counter sets is 8.", + "partitionTypeAttribute": "PartitionTypeAttribute names a string device attribute (by fully qualified name, e.g. \"gpu.example.com/profile\") whose value labels each device with its partition type, such as \"Full\" or \"Half\" for a MIG-style GPU.\n\nWhen set, every partitionable device in the slice must carry the attribute and devices sharing a value must share the same ConsumesCounters cost.", + "skipNodeOperations": "SkipNodeOperations lists node-local resource operations (gRPC calls) that will be skipped for the devices in this slice when determining whether operations are necessary on the node. If all allocated devices for a driver in a claim skip an operation, that gRPC call will be skipped. Valid values are:\n\n- \"NodePrepareResources\": NodePrepareResources gRPC calls are skipped. This\n value cannot be specified unless \"NodeUnprepareResources\" is also listed\n (or \"*\" is specified).\n- \"NodeUnprepareResources\": NodeUnprepareResources gRPC calls are skipped. - \"*\": All node-local resource operations are skipped.\n\nOther values may be added in the future. The kubelet must ignore unknown values.", } func (ResourceSliceSpec) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/resource/v1beta1/zz_generated.deepcopy.go b/vendor/k8s.io/api/resource/v1beta1/zz_generated.deepcopy.go index 78ec7b0d58..85ec2bdf68 100644 --- a/vendor/k8s.io/api/resource/v1beta1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/resource/v1beta1/zz_generated.deepcopy.go @@ -159,9 +159,9 @@ func (in *BasicDevice) DeepCopyInto(out *BasicDevice) { *out = new(bool) **out = **in } - if in.NodeAllocatableResourceMappings != nil { - in, out := &in.NodeAllocatableResourceMappings, &out.NodeAllocatableResourceMappings - *out = make(map[corev1.ResourceName]NodeAllocatableResourceMapping, len(*in)) + if in.NodeAllocatableResources != nil { + in, out := &in.NodeAllocatableResources, &out.NodeAllocatableResources + *out = make(map[corev1.ResourceName]NodeAllocatableResource, len(*in)) for key, val := range *in { (*out)[key] = *val.DeepCopy() } @@ -706,6 +706,11 @@ func (in *DeviceCounterConsumption) DeepCopyInto(out *DeviceCounterConsumption) (*out)[key] = *val.DeepCopy() } } + if in.CompatibilityGroups != nil { + in, out := &in.CompatibilityGroups, &out.CompatibilityGroups + *out = make([]string, len(*in)) + copy(*out, *in) + } return } @@ -719,6 +724,22 @@ func (in *DeviceCounterConsumption) DeepCopy() *DeviceCounterConsumption { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceDerivedAttribute) DeepCopyInto(out *DeviceDerivedAttribute) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceDerivedAttribute. +func (in *DeviceDerivedAttribute) DeepCopy() *DeviceDerivedAttribute { + if in == nil { + return nil + } + out := new(DeviceDerivedAttribute) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DeviceRequest) DeepCopyInto(out *DeviceRequest) { *out = *in @@ -753,6 +774,11 @@ func (in *DeviceRequest) DeepCopyInto(out *DeviceRequest) { *out = new(CapacityRequirements) (*in).DeepCopyInto(*out) } + if in.DerivedAttributes != nil { + in, out := &in.DerivedAttributes, &out.DerivedAttributes + *out = make([]DeviceDerivedAttribute, len(*in)) + copy(*out, *in) + } return } @@ -803,6 +829,11 @@ func (in *DeviceRequestAllocationResult) DeepCopyInto(out *DeviceRequestAllocati (*out)[key] = val.DeepCopy() } } + if in.SkipNodeOperations != nil { + in, out := &in.SkipNodeOperations, &out.SkipNodeOperations + *out = make([]SkipNodeOperation, len(*in)) + copy(*out, *in) + } return } @@ -859,6 +890,11 @@ func (in *DeviceSubRequest) DeepCopyInto(out *DeviceSubRequest) { *out = new(CapacityRequirements) (*in).DeepCopyInto(*out) } + if in.DerivedAttributes != nil { + in, out := &in.DerivedAttributes, &out.DerivedAttributes + *out = make([]DeviceDerivedAttribute, len(*in)) + copy(*out, *in) + } return } @@ -935,27 +971,84 @@ func (in *NetworkDeviceData) DeepCopy() *NetworkDeviceData { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeAllocatableResourceMapping) DeepCopyInto(out *NodeAllocatableResourceMapping) { +func (in *NodeAllocatableMapping) DeepCopyInto(out *NodeAllocatableMapping) { *out = *in if in.CapacityKey != nil { in, out := &in.CapacityKey, &out.CapacityKey *out = new(QualifiedName) **out = **in } - if in.AllocationMultiplier != nil { - in, out := &in.AllocationMultiplier, &out.AllocationMultiplier + if in.CapacityMultiplier != nil { + in, out := &in.CapacityMultiplier, &out.CapacityMultiplier + x := (*in).DeepCopy() + *out = &x + } + if in.DeviceMultiplier != nil { + in, out := &in.DeviceMultiplier, &out.DeviceMultiplier x := (*in).DeepCopy() *out = &x } return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableResourceMapping. -func (in *NodeAllocatableResourceMapping) DeepCopy() *NodeAllocatableResourceMapping { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableMapping. +func (in *NodeAllocatableMapping) DeepCopy() *NodeAllocatableMapping { if in == nil { return nil } - out := new(NodeAllocatableResourceMapping) + out := new(NodeAllocatableMapping) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeAllocatableOverhead) DeepCopyInto(out *NodeAllocatableOverhead) { + *out = *in + if in.PerPod != nil { + in, out := &in.PerPod, &out.PerPod + x := (*in).DeepCopy() + *out = &x + } + if in.PerContainer != nil { + in, out := &in.PerContainer, &out.PerContainer + x := (*in).DeepCopy() + *out = &x + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableOverhead. +func (in *NodeAllocatableOverhead) DeepCopy() *NodeAllocatableOverhead { + if in == nil { + return nil + } + out := new(NodeAllocatableOverhead) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeAllocatableResource) DeepCopyInto(out *NodeAllocatableResource) { + *out = *in + if in.Mapping != nil { + in, out := &in.Mapping, &out.Mapping + *out = new(NodeAllocatableMapping) + (*in).DeepCopyInto(*out) + } + if in.Overhead != nil { + in, out := &in.Overhead, &out.Overhead + *out = new(NodeAllocatableOverhead) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableResource. +func (in *NodeAllocatableResource) DeepCopy() *NodeAllocatableResource { + if in == nil { + return nil + } + out := new(NodeAllocatableResource) in.DeepCopyInto(out) return out } @@ -1286,6 +1379,16 @@ func (in *ResourceSliceSpec) DeepCopyInto(out *ResourceSliceSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.PartitionTypeAttribute != nil { + in, out := &in.PartitionTypeAttribute, &out.PartitionTypeAttribute + *out = new(FullyQualifiedName) + **out = **in + } + if in.SkipNodeOperations != nil { + in, out := &in.SkipNodeOperations, &out.SkipNodeOperations + *out = make([]SkipNodeOperation, len(*in)) + copy(*out, *in) + } return } diff --git a/vendor/k8s.io/api/resource/v1beta1/zz_generated.model_name.go b/vendor/k8s.io/api/resource/v1beta1/zz_generated.model_name.go index a2887e7534..783ec0312d 100644 --- a/vendor/k8s.io/api/resource/v1beta1/zz_generated.model_name.go +++ b/vendor/k8s.io/api/resource/v1beta1/zz_generated.model_name.go @@ -136,6 +136,11 @@ func (in DeviceCounterConsumption) OpenAPIModelName() string { return "io.k8s.api.resource.v1beta1.DeviceCounterConsumption" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in DeviceDerivedAttribute) OpenAPIModelName() string { + return "io.k8s.api.resource.v1beta1.DeviceDerivedAttribute" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in DeviceRequest) OpenAPIModelName() string { return "io.k8s.api.resource.v1beta1.DeviceRequest" @@ -172,8 +177,18 @@ func (in NetworkDeviceData) OpenAPIModelName() string { } // OpenAPIModelName returns the OpenAPI model name for this type. -func (in NodeAllocatableResourceMapping) OpenAPIModelName() string { - return "io.k8s.api.resource.v1beta1.NodeAllocatableResourceMapping" +func (in NodeAllocatableMapping) OpenAPIModelName() string { + return "io.k8s.api.resource.v1beta1.NodeAllocatableMapping" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in NodeAllocatableOverhead) OpenAPIModelName() string { + return "io.k8s.api.resource.v1beta1.NodeAllocatableOverhead" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in NodeAllocatableResource) OpenAPIModelName() string { + return "io.k8s.api.resource.v1beta1.NodeAllocatableResource" } // OpenAPIModelName returns the OpenAPI model name for this type. diff --git a/vendor/k8s.io/api/resource/v1beta2/generated.pb.go b/vendor/k8s.io/api/resource/v1beta2/generated.pb.go index 6b59098807..d1aae258ea 100644 --- a/vendor/k8s.io/api/resource/v1beta2/generated.pb.go +++ b/vendor/k8s.io/api/resource/v1beta2/generated.pb.go @@ -82,6 +82,8 @@ func (m *DeviceConstraint) Reset() { *m = DeviceConstraint{} } func (m *DeviceCounterConsumption) Reset() { *m = DeviceCounterConsumption{} } +func (m *DeviceDerivedAttribute) Reset() { *m = DeviceDerivedAttribute{} } + func (m *DeviceRequest) Reset() { *m = DeviceRequest{} } func (m *DeviceRequestAllocationResult) Reset() { *m = DeviceRequestAllocationResult{} } @@ -108,7 +110,11 @@ func (m *ExactDeviceRequest) Reset() { *m = ExactDeviceRequest{} } func (m *NetworkDeviceData) Reset() { *m = NetworkDeviceData{} } -func (m *NodeAllocatableResourceMapping) Reset() { *m = NodeAllocatableResourceMapping{} } +func (m *NodeAllocatableMapping) Reset() { *m = NodeAllocatableMapping{} } + +func (m *NodeAllocatableOverhead) Reset() { *m = NodeAllocatableOverhead{} } + +func (m *NodeAllocatableResource) Reset() { *m = NodeAllocatableResource{} } func (m *OpaqueDeviceConfiguration) Reset() { *m = OpaqueDeviceConfiguration{} } @@ -586,14 +592,14 @@ func (m *Device) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.NodeAllocatableResourceMappings) > 0 { - keysForNodeAllocatableResourceMappings := make([]string, 0, len(m.NodeAllocatableResourceMappings)) - for k := range m.NodeAllocatableResourceMappings { - keysForNodeAllocatableResourceMappings = append(keysForNodeAllocatableResourceMappings, string(k)) - } - sort.Strings(keysForNodeAllocatableResourceMappings) - for iNdEx := len(keysForNodeAllocatableResourceMappings) - 1; iNdEx >= 0; iNdEx-- { - v := m.NodeAllocatableResourceMappings[k8s_io_api_core_v1.ResourceName(keysForNodeAllocatableResourceMappings[iNdEx])] + if len(m.NodeAllocatableResources) > 0 { + keysForNodeAllocatableResources := make([]string, 0, len(m.NodeAllocatableResources)) + for k := range m.NodeAllocatableResources { + keysForNodeAllocatableResources = append(keysForNodeAllocatableResources, string(k)) + } + sort.Strings(keysForNodeAllocatableResources) + for iNdEx := len(keysForNodeAllocatableResources) - 1; iNdEx >= 0; iNdEx-- { + v := m.NodeAllocatableResources[k8s_io_api_core_v1.ResourceName(keysForNodeAllocatableResources[iNdEx])] baseI := i { size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) @@ -605,14 +611,14 @@ func (m *Device) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x12 - i -= len(keysForNodeAllocatableResourceMappings[iNdEx]) - copy(dAtA[i:], keysForNodeAllocatableResourceMappings[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(keysForNodeAllocatableResourceMappings[iNdEx]))) + i -= len(keysForNodeAllocatableResources[iNdEx]) + copy(dAtA[i:], keysForNodeAllocatableResources[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(keysForNodeAllocatableResources[iNdEx]))) i-- dAtA[i] = 0xa i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) i-- - dAtA[i] = 0x6a + dAtA[i] = 0x72 } } if m.AllowMultipleAllocations != nil { @@ -1397,6 +1403,15 @@ func (m *DeviceCounterConsumption) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l + if len(m.CompatibilityGroups) > 0 { + for iNdEx := len(m.CompatibilityGroups) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.CompatibilityGroups[iNdEx]) + copy(dAtA[i:], m.CompatibilityGroups[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.CompatibilityGroups[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } if len(m.Counters) > 0 { keysForCounters := make([]string, 0, len(m.Counters)) for k := range m.Counters { @@ -1434,6 +1449,39 @@ func (m *DeviceCounterConsumption) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *DeviceDerivedAttribute) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeviceDerivedAttribute) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeviceDerivedAttribute) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Expression) + copy(dAtA[i:], m.Expression) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Expression))) + i-- + dAtA[i] = 0x12 + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *DeviceRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1508,6 +1556,15 @@ func (m *DeviceRequestAllocationResult) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if len(m.SkipNodeOperations) > 0 { + for iNdEx := len(m.SkipNodeOperations) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.SkipNodeOperations[iNdEx]) + copy(dAtA[i:], m.SkipNodeOperations[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.SkipNodeOperations[iNdEx]))) + i-- + dAtA[i] = 0x5a + } + } if len(m.ConsumedCapacity) > 0 { keysForConsumedCapacity := make([]string, 0, len(m.ConsumedCapacity)) for k := range m.ConsumedCapacity { @@ -1664,6 +1721,20 @@ func (m *DeviceSubRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.DerivedAttributes) > 0 { + for iNdEx := len(m.DerivedAttributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DerivedAttributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } if m.Capacity != nil { { size, err := m.Capacity.MarshalToSizedBuffer(dAtA[:i]) @@ -2069,6 +2140,20 @@ func (m *ExactDeviceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.DerivedAttributes) > 0 { + for iNdEx := len(m.DerivedAttributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DerivedAttributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } if m.Capacity != nil { { size, err := m.Capacity.MarshalToSizedBuffer(dAtA[:i]) @@ -2177,7 +2262,7 @@ func (m *NetworkDeviceData) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *NodeAllocatableResourceMapping) Marshal() (dAtA []byte, err error) { +func (m *NodeAllocatableMapping) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2187,19 +2272,31 @@ func (m *NodeAllocatableResourceMapping) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *NodeAllocatableResourceMapping) MarshalTo(dAtA []byte) (int, error) { +func (m *NodeAllocatableMapping) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *NodeAllocatableResourceMapping) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *NodeAllocatableMapping) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.AllocationMultiplier != nil { + if m.DeviceMultiplier != nil { + { + size, err := m.DeviceMultiplier.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.CapacityMultiplier != nil { { - size, err := m.AllocationMultiplier.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.CapacityMultiplier.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2219,6 +2316,100 @@ func (m *NodeAllocatableResourceMapping) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } +func (m *NodeAllocatableOverhead) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeAllocatableOverhead) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeAllocatableOverhead) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PerContainer != nil { + { + size, err := m.PerContainer.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.PerPod != nil { + { + size, err := m.PerPod.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NodeAllocatableResource) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeAllocatableResource) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeAllocatableResource) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Overhead != nil { + { + size, err := m.Overhead.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.Mapping != nil { + { + size, err := m.Mapping.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} + func (m *OpaqueDeviceConfiguration) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2773,6 +2964,22 @@ func (m *ResourceSliceSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.SkipNodeOperations) > 0 { + for iNdEx := len(m.SkipNodeOperations) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.SkipNodeOperations[iNdEx]) + copy(dAtA[i:], m.SkipNodeOperations[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.SkipNodeOperations[iNdEx]))) + i-- + dAtA[i] = 0x52 + } + } + if m.PartitionTypeAttribute != nil { + i -= len(*m.PartitionTypeAttribute) + copy(dAtA[i:], *m.PartitionTypeAttribute) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PartitionTypeAttribute))) + i-- + dAtA[i] = 0x4a + } if len(m.SharedCounters) > 0 { for iNdEx := len(m.SharedCounters) - 1; iNdEx >= 0; iNdEx-- { { @@ -3092,8 +3299,8 @@ func (m *Device) Size() (n int) { if m.AllowMultipleAllocations != nil { n += 2 } - if len(m.NodeAllocatableResourceMappings) > 0 { - for k, v := range m.NodeAllocatableResourceMappings { + if len(m.NodeAllocatableResources) > 0 { + for k, v := range m.NodeAllocatableResources { _ = k _ = v l = v.Size() @@ -3365,6 +3572,25 @@ func (m *DeviceCounterConsumption) Size() (n int) { n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) } } + if len(m.CompatibilityGroups) > 0 { + for _, s := range m.CompatibilityGroups { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *DeviceDerivedAttribute) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Expression) + n += 1 + l + sovGenerated(uint64(l)) return n } @@ -3437,6 +3663,12 @@ func (m *DeviceRequestAllocationResult) Size() (n int) { n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) } } + if len(m.SkipNodeOperations) > 0 { + for _, s := range m.SkipNodeOperations { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } return n } @@ -3482,6 +3714,12 @@ func (m *DeviceSubRequest) Size() (n int) { l = m.Capacity.Size() n += 1 + l + sovGenerated(uint64(l)) } + if len(m.DerivedAttributes) > 0 { + for _, e := range m.DerivedAttributes { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } return n } @@ -3637,6 +3875,12 @@ func (m *ExactDeviceRequest) Size() (n int) { l = m.Capacity.Size() n += 1 + l + sovGenerated(uint64(l)) } + if len(m.DerivedAttributes) > 0 { + for _, e := range m.DerivedAttributes { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } return n } @@ -3659,7 +3903,7 @@ func (m *NetworkDeviceData) Size() (n int) { return n } -func (m *NodeAllocatableResourceMapping) Size() (n int) { +func (m *NodeAllocatableMapping) Size() (n int) { if m == nil { return 0 } @@ -3669,8 +3913,46 @@ func (m *NodeAllocatableResourceMapping) Size() (n int) { l = len(*m.CapacityKey) n += 1 + l + sovGenerated(uint64(l)) } - if m.AllocationMultiplier != nil { - l = m.AllocationMultiplier.Size() + if m.CapacityMultiplier != nil { + l = m.CapacityMultiplier.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.DeviceMultiplier != nil { + l = m.DeviceMultiplier.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *NodeAllocatableOverhead) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PerPod != nil { + l = m.PerPod.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.PerContainer != nil { + l = m.PerContainer.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *NodeAllocatableResource) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Mapping != nil { + l = m.Mapping.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Overhead != nil { + l = m.Overhead.Size() n += 1 + l + sovGenerated(uint64(l)) } return n @@ -3896,6 +4178,16 @@ func (m *ResourceSliceSpec) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) } } + if m.PartitionTypeAttribute != nil { + l = len(*m.PartitionTypeAttribute) + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.SkipNodeOperations) > 0 { + for _, s := range m.SkipNodeOperations { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } return n } @@ -4062,16 +4354,16 @@ func (this *Device) String() string { mapStringForCapacity += fmt.Sprintf("%v: %v,", k, this.Capacity[QualifiedName(k)]) } mapStringForCapacity += "}" - keysForNodeAllocatableResourceMappings := make([]string, 0, len(this.NodeAllocatableResourceMappings)) - for k := range this.NodeAllocatableResourceMappings { - keysForNodeAllocatableResourceMappings = append(keysForNodeAllocatableResourceMappings, string(k)) + keysForNodeAllocatableResources := make([]string, 0, len(this.NodeAllocatableResources)) + for k := range this.NodeAllocatableResources { + keysForNodeAllocatableResources = append(keysForNodeAllocatableResources, string(k)) } - sort.Strings(keysForNodeAllocatableResourceMappings) - mapStringForNodeAllocatableResourceMappings := "map[k8s_io_api_core_v1.ResourceName]NodeAllocatableResourceMapping{" - for _, k := range keysForNodeAllocatableResourceMappings { - mapStringForNodeAllocatableResourceMappings += fmt.Sprintf("%v: %v,", k, this.NodeAllocatableResourceMappings[k8s_io_api_core_v1.ResourceName(k)]) + sort.Strings(keysForNodeAllocatableResources) + mapStringForNodeAllocatableResources := "map[k8s_io_api_core_v1.ResourceName]NodeAllocatableResource{" + for _, k := range keysForNodeAllocatableResources { + mapStringForNodeAllocatableResources += fmt.Sprintf("%v: %v,", k, this.NodeAllocatableResources[k8s_io_api_core_v1.ResourceName(k)]) } - mapStringForNodeAllocatableResourceMappings += "}" + mapStringForNodeAllocatableResources += "}" s := strings.Join([]string{`&Device{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `Attributes:` + mapStringForAttributes + `,`, @@ -4085,7 +4377,7 @@ func (this *Device) String() string { `BindingConditions:` + fmt.Sprintf("%v", this.BindingConditions) + `,`, `BindingFailureConditions:` + fmt.Sprintf("%v", this.BindingFailureConditions) + `,`, `AllowMultipleAllocations:` + valueToStringGenerated(this.AllowMultipleAllocations) + `,`, - `NodeAllocatableResourceMappings:` + mapStringForNodeAllocatableResourceMappings + `,`, + `NodeAllocatableResources:` + mapStringForNodeAllocatableResources + `,`, `}`, }, "") return s @@ -4287,6 +4579,18 @@ func (this *DeviceCounterConsumption) String() string { s := strings.Join([]string{`&DeviceCounterConsumption{`, `CounterSet:` + fmt.Sprintf("%v", this.CounterSet) + `,`, `Counters:` + mapStringForCounters + `,`, + `CompatibilityGroups:` + fmt.Sprintf("%v", this.CompatibilityGroups) + `,`, + `}`, + }, "") + return s +} +func (this *DeviceDerivedAttribute) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeviceDerivedAttribute{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Expression:` + fmt.Sprintf("%v", this.Expression) + `,`, `}`, }, "") return s @@ -4338,6 +4642,7 @@ func (this *DeviceRequestAllocationResult) String() string { `BindingFailureConditions:` + fmt.Sprintf("%v", this.BindingFailureConditions) + `,`, `ShareID:` + valueToStringGenerated(this.ShareID) + `,`, `ConsumedCapacity:` + mapStringForConsumedCapacity + `,`, + `SkipNodeOperations:` + fmt.Sprintf("%v", this.SkipNodeOperations) + `,`, `}`, }, "") return s @@ -4366,6 +4671,11 @@ func (this *DeviceSubRequest) String() string { repeatedStringForTolerations += strings.Replace(strings.Replace(f.String(), "DeviceToleration", "DeviceToleration", 1), `&`, ``, 1) + "," } repeatedStringForTolerations += "}" + repeatedStringForDerivedAttributes := "[]DeviceDerivedAttribute{" + for _, f := range this.DerivedAttributes { + repeatedStringForDerivedAttributes += strings.Replace(strings.Replace(f.String(), "DeviceDerivedAttribute", "DeviceDerivedAttribute", 1), `&`, ``, 1) + "," + } + repeatedStringForDerivedAttributes += "}" s := strings.Join([]string{`&DeviceSubRequest{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `DeviceClassName:` + fmt.Sprintf("%v", this.DeviceClassName) + `,`, @@ -4374,6 +4684,7 @@ func (this *DeviceSubRequest) String() string { `Count:` + fmt.Sprintf("%v", this.Count) + `,`, `Tolerations:` + repeatedStringForTolerations + `,`, `Capacity:` + strings.Replace(this.Capacity.String(), "CapacityRequirements", "CapacityRequirements", 1) + `,`, + `DerivedAttributes:` + repeatedStringForDerivedAttributes + `,`, `}`, }, "") return s @@ -4472,6 +4783,11 @@ func (this *ExactDeviceRequest) String() string { repeatedStringForTolerations += strings.Replace(strings.Replace(f.String(), "DeviceToleration", "DeviceToleration", 1), `&`, ``, 1) + "," } repeatedStringForTolerations += "}" + repeatedStringForDerivedAttributes := "[]DeviceDerivedAttribute{" + for _, f := range this.DerivedAttributes { + repeatedStringForDerivedAttributes += strings.Replace(strings.Replace(f.String(), "DeviceDerivedAttribute", "DeviceDerivedAttribute", 1), `&`, ``, 1) + "," + } + repeatedStringForDerivedAttributes += "}" s := strings.Join([]string{`&ExactDeviceRequest{`, `DeviceClassName:` + fmt.Sprintf("%v", this.DeviceClassName) + `,`, `Selectors:` + repeatedStringForSelectors + `,`, @@ -4480,6 +4796,7 @@ func (this *ExactDeviceRequest) String() string { `AdminAccess:` + valueToStringGenerated(this.AdminAccess) + `,`, `Tolerations:` + repeatedStringForTolerations + `,`, `Capacity:` + strings.Replace(this.Capacity.String(), "CapacityRequirements", "CapacityRequirements", 1) + `,`, + `DerivedAttributes:` + repeatedStringForDerivedAttributes + `,`, `}`, }, "") return s @@ -4496,13 +4813,36 @@ func (this *NetworkDeviceData) String() string { }, "") return s } -func (this *NodeAllocatableResourceMapping) String() string { +func (this *NodeAllocatableMapping) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&NodeAllocatableResourceMapping{`, + s := strings.Join([]string{`&NodeAllocatableMapping{`, `CapacityKey:` + valueToStringGenerated(this.CapacityKey) + `,`, - `AllocationMultiplier:` + strings.Replace(fmt.Sprintf("%v", this.AllocationMultiplier), "Quantity", "resource.Quantity", 1) + `,`, + `CapacityMultiplier:` + strings.Replace(fmt.Sprintf("%v", this.CapacityMultiplier), "Quantity", "resource.Quantity", 1) + `,`, + `DeviceMultiplier:` + strings.Replace(fmt.Sprintf("%v", this.DeviceMultiplier), "Quantity", "resource.Quantity", 1) + `,`, + `}`, + }, "") + return s +} +func (this *NodeAllocatableOverhead) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NodeAllocatableOverhead{`, + `PerPod:` + strings.Replace(fmt.Sprintf("%v", this.PerPod), "Quantity", "resource.Quantity", 1) + `,`, + `PerContainer:` + strings.Replace(fmt.Sprintf("%v", this.PerContainer), "Quantity", "resource.Quantity", 1) + `,`, + `}`, + }, "") + return s +} +func (this *NodeAllocatableResource) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NodeAllocatableResource{`, + `Mapping:` + strings.Replace(this.Mapping.String(), "NodeAllocatableMapping", "NodeAllocatableMapping", 1) + `,`, + `Overhead:` + strings.Replace(this.Overhead.String(), "NodeAllocatableOverhead", "NodeAllocatableOverhead", 1) + `,`, `}`, }, "") return s @@ -4691,6 +5031,8 @@ func (this *ResourceSliceSpec) String() string { `Devices:` + repeatedStringForDevices + `,`, `PerDeviceNodeSelection:` + valueToStringGenerated(this.PerDeviceNodeSelection) + `,`, `SharedCounters:` + repeatedStringForSharedCounters + `,`, + `PartitionTypeAttribute:` + valueToStringGenerated(this.PartitionTypeAttribute) + `,`, + `SkipNodeOperations:` + fmt.Sprintf("%v", this.SkipNodeOperations) + `,`, `}`, }, "") return s @@ -6595,9 +6937,9 @@ func (m *Device) Unmarshal(dAtA []byte) error { } b := bool(v != 0) m.AllowMultipleAllocations = &b - case 13: + case 14: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeAllocatableResourceMappings", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NodeAllocatableResources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6624,11 +6966,11 @@ func (m *Device) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.NodeAllocatableResourceMappings == nil { - m.NodeAllocatableResourceMappings = make(map[k8s_io_api_core_v1.ResourceName]NodeAllocatableResourceMapping) + if m.NodeAllocatableResources == nil { + m.NodeAllocatableResources = make(map[k8s_io_api_core_v1.ResourceName]NodeAllocatableResource) } var mapkey k8s_io_api_core_v1.ResourceName - mapvalue := &NodeAllocatableResourceMapping{} + mapvalue := &NodeAllocatableResource{} for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 @@ -6702,7 +7044,7 @@ func (m *Device) Unmarshal(dAtA []byte) error { if postmsgIndex > l { return io.ErrUnexpectedEOF } - mapvalue = &NodeAllocatableResourceMapping{} + mapvalue = &NodeAllocatableResource{} if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { return err } @@ -6722,7 +7064,7 @@ func (m *Device) Unmarshal(dAtA []byte) error { iNdEx += skippy } } - m.NodeAllocatableResourceMappings[k8s_io_api_core_v1.ResourceName(mapkey)] = *mapvalue + m.NodeAllocatableResources[k8s_io_api_core_v1.ResourceName(mapkey)] = *mapvalue iNdEx = postIndex default: iNdEx = preIndex @@ -8654,16 +8996,162 @@ func (m *DeviceCounterConsumption) Unmarshal(dAtA []byte) error { } m.Counters[mapkey] = *mapvalue iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompatibilityGroups", wireType) } - if (iNdEx + skippy) > l { + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CompatibilityGroups = append(m.CompatibilityGroups, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceDerivedAttribute) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceDerivedAttribute: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceDerivedAttribute: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = FullyQualifiedName(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Expression", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Expression = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy @@ -9265,6 +9753,38 @@ func (m *DeviceRequestAllocationResult) Unmarshal(dAtA []byte) error { } m.ConsumedCapacity[QualifiedName(mapkey)] = *mapvalue iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SkipNodeOperations", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SkipNodeOperations = append(m.SkipNodeOperations, SkipNodeOperation(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -9620,6 +10140,40 @@ func (m *DeviceSubRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DerivedAttributes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DerivedAttributes = append(m.DerivedAttributes, DeviceDerivedAttribute{}) + if err := m.DerivedAttributes[len(m.DerivedAttributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -10876,6 +11430,40 @@ func (m *ExactDeviceRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DerivedAttributes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DerivedAttributes = append(m.DerivedAttributes, DeviceDerivedAttribute{}) + if err := m.DerivedAttributes[len(m.DerivedAttributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -11043,7 +11631,7 @@ func (m *NetworkDeviceData) Unmarshal(dAtA []byte) error { } return nil } -func (m *NodeAllocatableResourceMapping) Unmarshal(dAtA []byte) error { +func (m *NodeAllocatableMapping) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -11066,10 +11654,10 @@ func (m *NodeAllocatableResourceMapping) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: NodeAllocatableResourceMapping: wiretype end group for non-group") + return fmt.Errorf("proto: NodeAllocatableMapping: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: NodeAllocatableResourceMapping: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NodeAllocatableMapping: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -11107,7 +11695,7 @@ func (m *NodeAllocatableResourceMapping) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AllocationMultiplier", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CapacityMultiplier", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -11134,29 +11722,309 @@ func (m *NodeAllocatableResourceMapping) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.AllocationMultiplier == nil { - m.AllocationMultiplier = &resource.Quantity{} + if m.CapacityMultiplier == nil { + m.CapacityMultiplier = &resource.Quantity{} } - if err := m.AllocationMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.CapacityMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DeviceMultiplier", wireType) } - iNdEx += skippy - } - } - + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DeviceMultiplier == nil { + m.DeviceMultiplier = &resource.Quantity{} + } + if err := m.DeviceMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NodeAllocatableOverhead) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NodeAllocatableOverhead: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeAllocatableOverhead: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PerPod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PerPod == nil { + m.PerPod = &resource.Quantity{} + } + if err := m.PerPod.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PerContainer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PerContainer == nil { + m.PerContainer = &resource.Quantity{} + } + if err := m.PerContainer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NodeAllocatableResource) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NodeAllocatableResource: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeAllocatableResource: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Mapping", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Mapping == nil { + m.Mapping = &NodeAllocatableMapping{} + } + if err := m.Mapping.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Overhead", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Overhead == nil { + m.Overhead = &NodeAllocatableOverhead{} + } + if err := m.Overhead.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + if iNdEx > l { return io.ErrUnexpectedEOF } @@ -12933,6 +13801,71 @@ func (m *ResourceSliceSpec) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PartitionTypeAttribute", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := FullyQualifiedName(dAtA[iNdEx:postIndex]) + m.PartitionTypeAttribute = &s + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SkipNodeOperations", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SkipNodeOperations = append(m.SkipNodeOperations, SkipNodeOperation(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/vendor/k8s.io/api/resource/v1beta2/generated.proto b/vendor/k8s.io/api/resource/v1beta2/generated.proto index 82bb033b3e..3268169cee 100644 --- a/vendor/k8s.io/api/resource/v1beta2/generated.proto +++ b/vendor/k8s.io/api/resource/v1beta2/generated.proto @@ -65,8 +65,8 @@ message AllocatedDeviceStatus { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-uuid optional string shareID = 7; // Conditions contains the latest observation of the device's state. @@ -78,6 +78,9 @@ message AllocatedDeviceStatus { // +optional // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 4; // Data contains arbitrary driver-specific data. @@ -90,7 +93,7 @@ message AllocatedDeviceStatus { // NetworkData contains network-related information specific to the device. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional NetworkDeviceData networkData = 6; } @@ -130,7 +133,7 @@ message CELDeviceSelector { // - driver (string): the name of the driver which defines this device. // - attributes (map[string]object): the device's attributes, grouped by prefix // (e.g. device.attributes["dra.example.com"] evaluates to an object with all - // of the attributes which were prefixed by "dra.example.com". + // of the attributes which were prefixed by "dra.example.com"). // - capacity (map[string]object): the device's capacities, grouped by prefix. // - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device // (v1.34+ with the DRAConsumableCapacity feature enabled). @@ -163,6 +166,15 @@ message CELDeviceSelector { // A robust expression should check for the existence of attributes // before referencing them. // + // Common errors: + // - "no such key": Use optional chaining (.? followed by orValue()) + // or guarding the check with has() for optional fields. + // See CEL Optional Types for details: + // https://pkg.go.dev/github.com/google/cel-go@v0.17.4/cel#OptionalTypes + // + // For more CEL expression syntax and examples, see: + // https://kubernetes.io/docs/reference/using-api/cel/ + // // For ease of use, the cel.bind() function is enabled, and can be used // to simplify expressions that access multiple attributes with the // same domain. For example: @@ -232,6 +244,13 @@ message CapacityRequestPolicy { // CapacityRequestPolicyRange defines a valid range for consumable capacity values. // +// If the DRAFractionalCapacityRange feature gate is +// enabled and at least one of Min, Max, or Step is a fractional quantity (i.e. +// its value is not an integer), milli-unit arithmetic is used instead, +// supporting values with up to 3 decimal places (e.g. 100m = 0.1). +// The largest supported value then is 1000 times smaller compared to using 64-bit integers. +// Otherwise, all comparisons use 64-bit integer arithmetic via resource.Quantity.Value(). +// // - If the requested amount is less than Min, it is rounded up to the Min value. // - If Step is set and the requested amount is between Min and Max but not aligned with Step, // it will be rounded up to the next value equal to Min + (n * Step). @@ -315,8 +334,8 @@ message CounterSet { // It must be a DNS label. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-short-name optional string name = 1; // Counters defines the set of counters for this CounterSet @@ -325,8 +344,8 @@ message CounterSet { // The maximum number of counters is 32. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:eachKey=+k8s:format=k8s-short-name map counters = 2; } @@ -345,7 +364,7 @@ message Device { // The maximum number of attributes and capacities combined is 32. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional map attributes = 2; // Capacity defines the set of capacities for this device. @@ -366,13 +385,13 @@ message Device { // device is 2. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=counterSet + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=counterSet // +featureGate=DRAPartitionableDevices - // +k8s:alpha(since: "1.36")=+k8s:maxItems=2 + // +k8s:beta(since: "1.37")=+k8s:maxItems=2 repeated DeviceCounterConsumption consumesCounters = 4; // NodeName identifies the node where the device is available. @@ -419,7 +438,7 @@ message Device { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated DeviceTaint taints = 8; // BindsToNode indicates if the usage of an allocation involving this device @@ -449,8 +468,8 @@ message Device { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 repeated string bindingConditions = 10; // BindingFailureConditions defines the conditions for binding failure. @@ -467,8 +486,8 @@ message Device { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 repeated string bindingFailureConditions = 11; // AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests. @@ -480,7 +499,7 @@ message Device { // +featureGate=DRAConsumableCapacity optional bool allowMultipleAllocations = 12; - // NodeAllocatableResourceMappings defines the mapping of node resources + // NodeAllocatableResources defines the mapping of node resources // that are managed by the DRA driver exposing this device. This includes resources currently // reported in v1.Node `status.allocatable` that are not extended resources // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). @@ -492,8 +511,9 @@ message Device { // The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). // Extended resource names are not permitted as keys. // +optional + // +k8s:optional // +featureGate=DRANodeAllocatableResources - map nodeAllocatableResourceMappings = 13; + map nodeAllocatableResources = 14; } // DeviceAllocationConfiguration gets embedded in an AllocationResult. @@ -503,7 +523,7 @@ message DeviceAllocationConfiguration { // or from a claim. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string source = 1; // Requests lists the names of requests where the configuration applies. @@ -515,10 +535,10 @@ message DeviceAllocationConfiguration { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated string requests = 2; optional DeviceConfiguration deviceConfiguration = 3; @@ -530,8 +550,8 @@ message DeviceAllocationResult { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceRequestAllocationResult results = 1; // This field is a combination of all the claim and class configuration parameters. @@ -544,8 +564,8 @@ message DeviceAllocationResult { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=64 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=64 repeated DeviceAllocationConfiguration config = 2; } @@ -554,30 +574,30 @@ message DeviceAttribute { // IntValue is a number. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember optional int64 int = 2; // BoolValue is a true/false value. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember optional bool bool = 3; // StringValue is a string. Must not be longer than 64 characters. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember optional string string = 4; // VersionValue is a semantic version according to semver.org spec 2.0.0. // Must not be longer than 64 characters. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember optional string version = 5; // IntValues is a non-empty list of numbers. @@ -587,8 +607,8 @@ message DeviceAttribute { // +optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember // +featureGate=DRAListTypeAttributes repeated int64 ints = 6; @@ -597,8 +617,8 @@ message DeviceAttribute { // +optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember // +featureGate=DRAListTypeAttributes repeated bool bools = 7; @@ -610,8 +630,9 @@ message DeviceAttribute { // +optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember + // +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:maxBytes=64 // +featureGate=DRAListTypeAttributes repeated string strings = 8; @@ -623,8 +644,8 @@ message DeviceAttribute { // +optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember // +featureGate=DRAListTypeAttributes repeated string versions = 9; } @@ -662,11 +683,11 @@ message DeviceClaim { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=name + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceRequest requests = 1; // These constraints must be satisfied by the set of devices that get @@ -674,8 +695,8 @@ message DeviceClaim { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceConstraint constraints = 2; // This field holds configuration for multiple potential drivers which @@ -684,8 +705,8 @@ message DeviceClaim { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceClaimConfiguration config = 3; } @@ -700,10 +721,10 @@ message DeviceClaimConfiguration { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated string requests = 1; optional DeviceConfiguration deviceConfiguration = 2; @@ -719,8 +740,8 @@ message DeviceClaimConfiguration { message DeviceClass { // Standard object metadata // +optional - // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:format=k8s-long-name + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:format=k8s-long-name optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Spec defines what can be allocated and how to configure it. @@ -731,6 +752,7 @@ message DeviceClass { // the time of allocation. // // Changing the spec automatically increments the metadata.generation number. + // +optional optional DeviceClassSpec spec = 2; } @@ -756,8 +778,8 @@ message DeviceClassSpec { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceSelector selectors = 1; // Config defines configuration parameters that apply to each device that is claimed via this class. @@ -768,8 +790,8 @@ message DeviceClassSpec { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceClassConfiguration config = 2; // ExtendedResourceName is the extended resource name for the devices of this class. @@ -781,11 +803,10 @@ message DeviceClassSpec { // If two classes are created at the same time, then the name of the class // lexicographically sorted first is picked. // - // This is a beta field. // +optional // +featureGate=DRAExtendedResource - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-extended-resource-name + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-extended-resource-name optional string extendedResourceName = 4; } @@ -797,7 +818,7 @@ message DeviceConfiguration { // // +optional // +oneOf=ConfigurationType - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional OpaqueDeviceConfiguration opaque = 1; } @@ -815,10 +836,10 @@ message DeviceConstraint { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated string requests = 1; // MatchAttribute requires that all devices in question have this @@ -841,8 +862,8 @@ message DeviceConstraint { // // +optional // +oneOf=ConstraintType - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-fully-qualified-name + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-fully-qualified-name optional string matchAttribute = 2; // DistinctAttribute requires that all devices in question have this @@ -864,6 +885,8 @@ message DeviceConstraint { // +optional // +oneOf=ConstraintType // +featureGate=DRAConsumableCapacity + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-fully-qualified-name optional string distinctAttribute = 3; } @@ -874,8 +897,8 @@ message DeviceCounterConsumption { // counters defined will be consumed. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-short-name optional string counterSet = 1; // Counters defines the counters that will be consumed by the device. @@ -883,9 +906,94 @@ message DeviceCounterConsumption { // The maximum number of counters is 32. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:eachKey=+k8s:format=k8s-short-name map counters = 2; + + // CompatibilityGroups is a list of opaque group names for + // this counter set consumption. + // + // Devices that consume counters from the same counter set may only be + // allocated at the same time ("co-allocated") if they all share at least + // one common group: the intersection of the CompatibilityGroups of all + // co-allocated devices on that counter set must be non-empty. Devices + // that consume from different counter sets are never compared via this + // field. + // + // An unset field, an explicit nil, and an empty list are equivalent and + // mean "no groups": such a device is only co-allocatable with sibling + // devices on the same counter set that also have no groups, and is never + // co-allocatable with a device that declares one or more groups. + // + // Group names are opaque and meaningful only within the + // publishing driver's pool. + // + // The maximum number of groups is 2, and the names must be unique. + // + // +optional + // +listType=atomic + // +featureGate=DRADeviceCompatibilityGroups + // +k8s:listType=atomic + // +k8s:optional + // +k8s:maxItems=2 + // +k8s:unique=set + // +k8s:eachVal=+k8s:format=k8s-short-name + repeated string compatibilityGroups = 3; +} + +// DeviceDerivedAttribute defines a derived attribute computed via CEL. +message DeviceDerivedAttribute { + // Name is the identifier for this derived attribute, used in constraints. + // + // It must be a DNS subdomain followed by a slash ("/") followed by a C identifier + // (e.g. "example.com/numaNode" or "derived/numaNode"). + // + // If the chosen name matches an existing physical attribute from a driver, + // the derived attribute's expression will shadow the physical attribute, + // and its evaluated value will be used in constraints instead. When the goal + // is to define a derived attribute that is only used within the ResourceClaim + // and not meant to shadow an existing attribute, use a domain prefix that + // no DRA driver should be using (e.g. "derived/myAttribute"). + // + // It is not valid to define a derived attribute that isn't used in at least + // one constraint. + // + // +required + // +k8s:required + // +k8s:format=k8s-resource-fully-qualified-name + optional string name = 1; + + // Expression is a CEL expression evaluated against each candidate device. + // The expression must evaluate to a primitive scalar (string, integer, + // boolean, or semver) or a list of these scalars ([]string, []int64, + // []bool, []semver) to act as a virtual grouping key. Any other return type + // is an error and causes CEL evaluation for the device to fail. + // + // The expression's input is an object named "device", which carries the + // same properties as in a CELDeviceSelector. + // + // When pod scheduling encounters CEL runtime errors (such as looking + // up an attribute that isn't defined) for some devices, it will abort + // allocation and fail scheduling for the Pod. Surfacing evaluation + // errors immediately prevents silent topology matching failures that are + // extremely hard to detect. A robust expression should, for example, check + // for the existence of attributes before referencing them to avoid + // runtime evaluation errors. + // + // The expression gets evaluated after a device has passed the other + // selector expressions for the request in which this expression is used. + // This allows writing expressions that are tailored towards the specific + // devices being requested (for example, by assuming the device is from a + // certain vendor and skipping those checks). + // + // The length of the expression must be smaller or equal to 10 Ki. The + // cost of evaluating it is also limited based on the estimated number + // of logical steps; the combined cost of all derived attributes in a + // claim is capped by a shared CEL cost budget. + // + // +required + // +k8s:required + optional string expression = 2; } // DeviceRequest is a request for devices required for a claim. @@ -914,7 +1022,7 @@ message DeviceRequest { // // +optional // +oneOf=deviceRequestType - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional ExactDeviceRequest exactly = 2; // FirstAvailable contains subrequests, of which exactly one will be @@ -935,11 +1043,11 @@ message DeviceRequest { // +oneOf=deviceRequestType // +listType=atomic // +featureGate=DRAPrioritizedList - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name - // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=name + // +k8s:beta(since: "1.37")=+k8s:maxItems=8 repeated DeviceSubRequest firstAvailable = 3; } @@ -964,9 +1072,9 @@ message DeviceRequestAllocationResult { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless - // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name-caseless + // +k8s:beta(since: "1.37")=+k8s:maxLength=63 + // +k8s:beta(since: "1.37")=+k8s:required optional string driver = 2; // This name together with the driver name and the device name field @@ -976,8 +1084,8 @@ message DeviceRequestAllocationResult { // DNS sub-domains separated by slashes. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-pool-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-pool-name optional string pool = 3; // Device references one device instance via its name in the driver's @@ -1009,7 +1117,7 @@ message DeviceRequestAllocationResult { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated DeviceToleration tolerations = 6; // BindingConditions contains a copy of the BindingConditions @@ -1021,8 +1129,8 @@ message DeviceRequestAllocationResult { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 repeated string bindingConditions = 7; // BindingFailureConditions contains a copy of the BindingFailureConditions @@ -1034,8 +1142,8 @@ message DeviceRequestAllocationResult { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 repeated string bindingFailureConditions = 8; // ShareID uniquely identifies an individual allocation share of the device, @@ -1045,8 +1153,8 @@ message DeviceRequestAllocationResult { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-uuid optional string shareID = 9; // ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. @@ -1061,6 +1169,19 @@ message DeviceRequestAllocationResult { // +optional // +featureGate=DRAConsumableCapacity map consumedCapacity = 10; + + // SkipNodeOperations lists node-local resource operations (gRPC calls) + // that will be skipped for this allocated device when determining whether + // operations are necessary on the node. If all allocated devices for a driver in + // a claim skip an operation, that gRPC call will be skipped. It is a copy of + // the ResourceSlice.spec.skipNodeOperations value at the time when the device was allocated. + // + // +optional + // +listType=set + // +k8s:listType=set + // +featureGate=DRAOptionalNodeOperations + // +k8s:optional + repeated string skipNodeOperations = 11; } // DeviceSelector must have exactly one field set. @@ -1103,8 +1224,8 @@ message DeviceSubRequest { // to reference. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name optional string deviceClassName = 2; // Selectors define criteria which must be satisfied by a specific @@ -1114,8 +1235,8 @@ message DeviceSubRequest { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceSelector selectors = 3; // AllocationMode and its related fields define how devices are allocated @@ -1137,7 +1258,7 @@ message DeviceSubRequest { // requests with unknown modes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional string allocationMode = 4; // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1168,7 +1289,7 @@ message DeviceSubRequest { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated DeviceToleration tolerations = 6; // Capacity define resource requirements against each capacity. @@ -1187,6 +1308,34 @@ message DeviceSubRequest { // +optional // +featureGate=DRAConsumableCapacity optional CapacityRequirements capacity = 7; + + // DerivedAttributes defines a set of virtual attributes computed via CEL expressions + // for each candidate device. These virtual attributes can be referenced in + // `.devices.constraints` to align and match different devices (e.g., co-allocating + // a GPU and a NIC on the same NUMA node) even if their drivers publish different + // attributes. Derived attributes are not available via `device.attributes` + // in the CEL environment when evaluating selector expressions. + // + // Derived attributes allow you to extract, transform, or normalize topology + // information (such as extracting a NUMA index from a complex topology string or + // renaming a vendor-specific attribute) into a common virtual attribute name at + // scheduling time. The scheduler then evaluates these virtual attributes exactly + // like static attributes when matching constraints. + // + // Every derived attribute defined in this list must be referenced by at least one + // MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + // + // The maximum number of derived attributes is 32. + // + // This is an alpha field and requires enabling the DRADerivedAttributes + // feature gate. + // + // +optional + // +listType=atomic + // +featureGate=DRADerivedAttributes + // +k8s:optional + // +k8s:maxItems=32 + repeated DeviceDerivedAttribute derivedAttributes = 8; } // The device this taint is attached to has the "effect" on @@ -1215,7 +1364,7 @@ message DeviceTaint { // Consumers must treat unknown effects like None. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required optional string effect = 3; // TimeAdded represents the time at which the taint was added or @@ -1237,6 +1386,7 @@ message DeviceTaint { // DeviceTaintRule adds one taint to all devices which match the selector. // This has the same effect as if the taint was specified directly // in the ResourceSlice by the DRA driver. +// +k8s:supportsSubresource="/status" message DeviceTaintRule { // Standard object metadata // +optional @@ -1308,6 +1458,9 @@ message DeviceTaintRuleStatus { // +listMapKey=type // +patchStrategy=merge // +patchMergeKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1; } @@ -1351,8 +1504,8 @@ message DeviceToleration { // Must be a label name. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-label-key + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-label-key optional string key = 1; // Operator represents a key's relationship to the value. @@ -1362,7 +1515,7 @@ message DeviceToleration { // // +optional // +default="Equal" - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional string operator = 2; // Value is the taint value the toleration matches to. @@ -1376,7 +1529,7 @@ message DeviceToleration { // When specified, allowed values are NoSchedule and NoExecute. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional string effect = 4; // TolerationSeconds represents the period of time the toleration (which must be @@ -1414,8 +1567,8 @@ message ExactDeviceRequest { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 repeated DeviceSelector selectors = 2; // AllocationMode and its related fields define how devices are allocated @@ -1438,7 +1591,7 @@ message ExactDeviceRequest { // requests with unknown modes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional optional string allocationMode = 3; // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1483,7 +1636,7 @@ message ExactDeviceRequest { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional repeated DeviceToleration tolerations = 6; // Capacity define resource requirements against each capacity. @@ -1502,6 +1655,34 @@ message ExactDeviceRequest { // +optional // +featureGate=DRAConsumableCapacity optional CapacityRequirements capacity = 7; + + // DerivedAttributes defines a set of virtual attributes computed via CEL expressions + // for each candidate device. These virtual attributes can be referenced in + // `.devices.constraints` to align and match different devices (e.g., co-allocating + // a GPU and a NIC on the same NUMA node) even if their drivers publish different + // attributes. Derived attributes are not available via `device.attributes` + // in the CEL environment when evaluating selector expressions. + // + // Derived attributes allow you to extract, transform, or normalize topology + // information (such as extracting a NUMA index from a complex topology string or + // renaming a vendor-specific attribute) into a common virtual attribute name at + // scheduling time. The scheduler then evaluates these virtual attributes exactly + // like static attributes when matching constraints. + // + // Every derived attribute defined in this list must be referenced by at least one + // MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + // + // The maximum number of derived attributes is 32. + // + // This is an alpha field and requires enabling the DRADerivedAttributes + // feature gate. + // + // +optional + // +listType=atomic + // +featureGate=DRADerivedAttributes + // +k8s:optional + // +k8s:maxItems=32 + repeated DeviceDerivedAttribute derivedAttributes = 8; } // NetworkDeviceData provides network-related details for the allocated device. @@ -1515,8 +1696,8 @@ message NetworkDeviceData { // Must not be longer than 256 bytes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxBytes=256 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxBytes=256 optional string interfaceName = 1; // IPs lists the network addresses assigned to the device's network interface. @@ -1527,10 +1708,10 @@ message NetworkDeviceData { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=16 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=16 repeated string ips = 2; // HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface. @@ -1538,47 +1719,104 @@ message NetworkDeviceData { // Must not be longer than 128 bytes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxBytes=128 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxBytes=128 optional string hardwareAddress = 3; } -// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity -// units requested to the corresponding quantity of the node allocatable resource. -message NodeAllocatableResourceMapping { +// NodeAllocatableMapping defines how a DRA allocation directly translates into a node allocatable resource quantity. +// The mapping can be derived from either the count of allocated devices (via deviceMultiplier) or the specific capacity consumed (via capacityKey and capacityMultiplier). These options are mutually exclusive. +// Kubelet adds this mapped resource quantity from claim to both requests and limits at the pod-level cgroup, and to limits at the container-level cgroup for each container referencing the claim. +message NodeAllocatableMapping { // CapacityKey references a capacity name defined as a key in the // `spec.devices[*].capacity` map. When this field is set, the value associated with // this key in the `status.allocation.devices.results[*].consumedCapacity` map // (for a specific claim allocation) determines the base quantity for - // the node allocatable resource. If `allocationMultiplier` is also set, it is + // the node allocatable resource. `capacityMultiplier` must also be set and is // multiplied with the base quantity. // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", // and this field is set to "dra.example.com/memory", then for a claim allocation // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the - // node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should - // be omitted or set to "1". + // node allocatable resource mapping will be "4Gi". + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:alpha(since: "1.37")=+k8s:dependentRequired("capacityMultiplier") optional string capacityKey = 1; - // AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. - // It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. - // 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim. - // a. A DRA driver representing each CPU core as a device would have - // {ResourceName: "cpu", allocationMultiplier: "2"} in its - // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim, - // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. - // b. A GPU device that needs additional node memory per GPU allocation would - // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated - // GPU device instance of this type will account for 2Gi of memory. - // - // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed. - // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`. - // For example, if a Device's capacity "dra.example.com/cores" is consumed, - // and each "core" provides 2 "cpu"s, the mapping would be: - // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. - // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. - // +optional - optional .k8s.io.apimachinery.pkg.api.resource.Quantity allocationMultiplier = 2; + // CapacityMultiplier is used as a multiplier for the allocated capacity consumed. + // It is only valid if `capacityKey` is set. + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. + // For example, if a Device's capacity "dra.example.com/cores" is consumed, + // and each "core" provides 2 "cpu"s, the mapping would be: + // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", capacityMultiplier: "2"}. + // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. + // +optional + // +k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:dependentRequired("capacityKey") + optional .k8s.io.apimachinery.pkg.api.resource.Quantity capacityMultiplier = 2; + + // DeviceMultiplier is used as a multiplier for the allocated device count in the claim. + // The final node allocatable resource amount is `deviceCount` * `deviceMultiplier`. + // For example, a DRA driver representing each cache complex (CCX) as a device would have + // {ResourceName: "cpu", deviceMultiplier: "8"} in its `nodeAllocatableResources`. + // If 2 devices (CCX) are allocated to the claim, 2 * 8 = 16 CPUs would be considered as allocated. + // It is only valid when `capacityKey` and `capacityMultiplier` are not set. + // +optional + // +k8s:optional + // +k8s:unionMember + optional .k8s.io.apimachinery.pkg.api.resource.Quantity deviceMultiplier = 3; +} + +// NodeAllocatableOverhead defines auxiliary resource overheads incurred when allocating a device. +// Overheads can be specified as a fixed cost per pod referencing the claim, a variable cost per container reference, or both. +// Kubelet accounts for this overhead by adding it to both the pod-level and container-level cgroups of referencing containers. +message NodeAllocatableOverhead { + // PerPod is overhead applied once per pod referencing the claim on this node. + // This is a flat overhead incurred for every pod referencing the claim. + // +optional + // +k8s:optional + optional .k8s.io.apimachinery.pkg.api.resource.Quantity perPod = 1; + + // PerContainer is applied per container reference to the claim. + // This models overhead scaling linearly with the number of containers actively using the device. + // When both PerPod and PerContainer are specified, the total overhead allocated for each pod referencing + // the claim is computed as: + // Quantity = PerPod + (PerContainer * NumReferences) + // Kubelet accounts for this overhead in cgroups: + // - Pod-level cgroup (requests and limits): Kubelet adds PerPod + (PerContainer * NumReferences). + // - Container-level cgroup (limits only): Kubelet adds PerPod + PerContainer for each referencing container. + // This allows any single container to access the pod-level overhead, while the parent cgroup caps the total usage to account for PerPod exactly once. + // +optional + // +k8s:optional + optional .k8s.io.apimachinery.pkg.api.resource.Quantity perContainer = 2; +} + +// NodeAllocatableResource defines the translation between the DRA device/capacity +// units requested to the corresponding quantity of the node allocatable resource. +// At least one of Mapping or Overhead must be specified. Not specifying either is an invalid configuration. +message NodeAllocatableResource { + // Mapping is used when the device directly models a node allocatable resource like standard CPU or memory + // (e.g., with a CPU DRA driver). The calculated quantity is accounted for exactly once per claim instance + // on the node. To prevent node cgroup isolation friction, the scheduler explicitly + // blocks sharing mapped device claims across multiple pods. + // +optional + // +k8s:optional + optional NodeAllocatableMapping mapping = 3; + + // Overhead contains fields for modeling auxiliary overhead incurred on node allocatable resources + // when allocating devices that are not themselves modeling a node allocatable resource (e.g., host memory overhead for GPUs). + // Sharing overhead-mapped claims across multiple pods is allowed. The node allocatable overhead is accounted + // for individually for each pod referencing the claim. + // Overhead is always subtracted from the node's allocatable capacity for the resource, even when mapping + // is specified for the same resource. + // Eg: If a device models memory capacity per socket as a consumable capacity pool via Mapping (with CapacityKey), + // any overhead specified for the same resource will be subtracted from the node's general allocatable capacity + // and not from the per-socket capacity pool in Mapping. + // +optional + // +k8s:optional + optional NodeAllocatableOverhead overhead = 4; } // OpaqueDeviceConfiguration contains configuration parameters for a driver @@ -1594,9 +1832,9 @@ message OpaqueDeviceConfiguration { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:maxLength=63 + // +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name-caseless optional string driver = 1; // Parameters can contain arbitrary data. It is the responsibility of @@ -1625,7 +1863,8 @@ message ResourceClaim { // Spec describes what is being requested and how to configure it. // The spec is immutable. - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:immutable + // +optional optional ResourceClaimSpec spec = 2; // Status describes whether the claim is ready to use and what has been allocated. @@ -1680,8 +1919,8 @@ message ResourceClaimStatus { // Allocation is set once the claim has been allocated successfully. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:update=NoModify + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:update=NoModify optional AllocationResult allocation = 1; // ReservedFor indicates which entities are currently allowed to use @@ -1709,10 +1948,10 @@ message ResourceClaimStatus { // +listMapKey=uid // +patchStrategy=merge // +patchMergeKey=uid - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:listType=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=uid - // +k8s:alpha(since: "1.36")=+k8s:maxItems=256 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:listType=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=uid + // +k8s:beta(since: "1.37")=+k8s:maxItems=256 repeated ResourceClaimConsumerReference reservedFor = 2; // Devices contains the status of each device allocated for this @@ -1720,18 +1959,18 @@ message ResourceClaimStatus { // information. Entries are owned by their respective drivers. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +listType=map // +listMapKey=driver // +listMapKey=device // +listMapKey=pool // +listMapKey=shareID // +featureGate=DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:listType=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=driver - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=device - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=pool - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=shareID + // +k8s:beta(since: "1.37")=+k8s:listType=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=driver + // +k8s:beta(since: "1.37")=+k8s:listMapKey=device + // +k8s:beta(since: "1.37")=+k8s:listMapKey=pool + // +k8s:beta(since: "1.37")=+k8s:listMapKey=shareID repeated AllocatedDeviceStatus devices = 4; } @@ -1749,6 +1988,7 @@ message ResourceClaimTemplate { // This field is immutable. A ResourceClaim will get created by the // control plane for a Pod when needed and then not get updated // anymore. + // +optional optional ResourceClaimTemplateSpec spec = 2; } @@ -1768,11 +2008,13 @@ message ResourceClaimTemplateSpec { // when creating it. No other fields are allowed and will be rejected during // validation. // +optional + // +k8s:opaqueType optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Spec for the ResourceClaim. The entire content is copied unchanged // into the ResourceClaim that gets created from this template. The // same fields as in a ResourceClaim are also valid here. + // +optional optional ResourceClaimSpec spec = 2; } @@ -1780,6 +2022,8 @@ message ResourceClaimTemplateSpec { message ResourcePool { // Name is used to identify the pool. For node-local devices, this // is often the node name, but this is not required. + // A field selector can be used to list only ResourceSlice objects + // belonging to a certain pool. // // It must not be longer than 253 characters and must consist of one or more DNS sub-domains // separated by slashes. This field is immutable. @@ -1920,7 +2164,7 @@ message ResourceSliceSpec { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +zeroOrOneOf=ResourceSliceType repeated Device devices = 6; @@ -1946,14 +2190,50 @@ message ResourceSliceSpec { // The maximum number of counter sets is 8. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=name // +featureGate=DRAPartitionableDevices // +zeroOrOneOf=ResourceSliceType - // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 + // +k8s:beta(since: "1.37")=+k8s:maxItems=8 repeated CounterSet sharedCounters = 8; + + // PartitionTypeAttribute names a string device attribute (by fully + // qualified name, e.g. "gpu.example.com/profile") whose value labels + // each device with its partition type, such as "Full" or "Half" for a + // MIG-style GPU. + // + // When set, every partitionable device in the slice must carry the attribute + // and devices sharing a value must share the same ConsumesCounters cost. + // + // +optional + // +featureGate=DRAPartitionableDevicesType + // +k8s:ifDisabled(DRAPartitionableDevicesType)=+k8s:forbidden + // +k8s:ifEnabled(DRAPartitionableDevicesType)=+k8s:optional + // +k8s:ifEnabled(DRAPartitionableDevicesType)=+k8s:format=k8s-resource-fully-qualified-name + optional string partitionTypeAttribute = 9; + + // SkipNodeOperations lists node-local resource operations (gRPC calls) + // that will be skipped for the devices in this slice when determining whether + // operations are necessary on the node. If all allocated devices for a driver in + // a claim skip an operation, that gRPC call will be skipped. Valid values are: + // + // - "NodePrepareResources": NodePrepareResources gRPC calls are skipped. This + // value cannot be specified unless "NodeUnprepareResources" is also listed + // (or "*" is specified). + // - "NodeUnprepareResources": NodeUnprepareResources gRPC calls are skipped. + // - "*": All node-local resource operations are skipped. + // + // Other values may be added in the future. The kubelet must ignore unknown + // values. + // + // +optional + // +listType=set + // +k8s:listType=set + // +featureGate=DRAOptionalNodeOperations + // +k8s:optional + repeated string skipNodeOperations = 10; } diff --git a/vendor/k8s.io/api/resource/v1beta2/types.go b/vendor/k8s.io/api/resource/v1beta2/types.go index 47a46355f0..04b5e9fbc5 100644 --- a/vendor/k8s.io/api/resource/v1beta2/types.go +++ b/vendor/k8s.io/api/resource/v1beta2/types.go @@ -78,7 +78,7 @@ const ( // This is an alpha type and requires enabling the DynamicResourceAllocation // feature gate. type ResourceSlice struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -97,6 +97,9 @@ const ( // ResourceSliceSelectorDriver can be used in a [metav1.ListOptions] // field selector to filter based on [ResourceSliceSpec.Driver]. ResourceSliceSelectorDriver = "spec.driver" + // ResourceSliceSelectorPoolName can be used in a [metav1.ListOptions] + // field selector to filter based on [ResourceSliceSpec.Pool.Name]. + ResourceSliceSelectorPoolName = "spec.pool.name" ) // ResourceSliceSpec contains the information published by the driver in one ResourceSlice. @@ -160,7 +163,7 @@ type ResourceSliceSpec struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +zeroOrOneOf=ResourceSliceType Devices []Device `json:"devices,omitempty" protobuf:"bytes,6,name=devices"` @@ -186,17 +189,68 @@ type ResourceSliceSpec struct { // The maximum number of counter sets is 8. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=name // +featureGate=DRAPartitionableDevices // +zeroOrOneOf=ResourceSliceType - // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 + // +k8s:beta(since: "1.37")=+k8s:maxItems=8 SharedCounters []CounterSet `json:"sharedCounters,omitempty" protobuf:"bytes,8,name=sharedCounters"` + + // PartitionTypeAttribute names a string device attribute (by fully + // qualified name, e.g. "gpu.example.com/profile") whose value labels + // each device with its partition type, such as "Full" or "Half" for a + // MIG-style GPU. + // + // When set, every partitionable device in the slice must carry the attribute + // and devices sharing a value must share the same ConsumesCounters cost. + // + // +optional + // +featureGate=DRAPartitionableDevicesType + // +k8s:ifDisabled(DRAPartitionableDevicesType)=+k8s:forbidden + // +k8s:ifEnabled(DRAPartitionableDevicesType)=+k8s:optional + // +k8s:ifEnabled(DRAPartitionableDevicesType)=+k8s:format=k8s-resource-fully-qualified-name + PartitionTypeAttribute *FullyQualifiedName `json:"partitionTypeAttribute,omitempty" protobuf:"bytes,9,opt,name=partitionTypeAttribute"` + + // SkipNodeOperations lists node-local resource operations (gRPC calls) + // that will be skipped for the devices in this slice when determining whether + // operations are necessary on the node. If all allocated devices for a driver in + // a claim skip an operation, that gRPC call will be skipped. Valid values are: + // + // - "NodePrepareResources": NodePrepareResources gRPC calls are skipped. This + // value cannot be specified unless "NodeUnprepareResources" is also listed + // (or "*" is specified). + // - "NodeUnprepareResources": NodeUnprepareResources gRPC calls are skipped. + // - "*": All node-local resource operations are skipped. + // + // Other values may be added in the future. The kubelet must ignore unknown + // values. + // + // +optional + // +listType=set + // +k8s:listType=set + // +featureGate=DRAOptionalNodeOperations + // +k8s:optional + SkipNodeOperations []SkipNodeOperation `json:"skipNodeOperations,omitempty" protobuf:"bytes,10,rep,name=skipNodeOperations,casttype=SkipNodeOperation"` } +// +enum +// +k8s:enum +type SkipNodeOperation string + +const ( + // SkipNodeOperationNodePrepareResources indicates that NodePrepareResources gRPC calls are skipped. + SkipNodeOperationNodePrepareResources SkipNodeOperation = "NodePrepareResources" + + // SkipNodeOperationNodeUnprepareResources indicates that NodeUnprepareResources gRPC calls are skipped. + SkipNodeOperationNodeUnprepareResources SkipNodeOperation = "NodeUnprepareResources" + + // SkipNodeOperationAll indicates that all node-local resource operations are skipped. + SkipNodeOperationAll SkipNodeOperation = "*" +) + // CounterSet defines a named set of counters // that are available to be used by devices defined in the // ResourcePool. @@ -210,8 +264,8 @@ type CounterSet struct { // It must be a DNS label. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-short-name Name string `json:"name" protobuf:"bytes,1,name=name"` // Counters defines the set of counters for this CounterSet @@ -220,8 +274,8 @@ type CounterSet struct { // The maximum number of counters is 32. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:eachKey=+k8s:format=k8s-short-name Counters map[string]Counter `json:"counters,omitempty" protobuf:"bytes,2,name=counters"` } @@ -233,6 +287,8 @@ const DriverNameMaxLength = 63 type ResourcePool struct { // Name is used to identify the pool. For node-local devices, this // is often the node name, but this is not required. + // A field selector can be used to list only ResourceSlice objects + // belonging to a certain pool. // // It must not be longer than 253 characters and must consist of one or more DNS sub-domains // separated by slashes. This field is immutable. @@ -297,6 +353,10 @@ const ResourceSliceMaxDeviceCounterConsumptionsPerDevice = 2 // per device counter consumption. const ResourceSliceMaxCountersPerDeviceCounterConsumption = 32 +// Defines the maximum number of compatibility groups that can be +// declared per device counter consumption. +const DeviceCompatibilityGroupsMaxSize = 2 + // Device represents one individual hardware instance that can be selected based // on its attributes. Besides the name, exactly one field must be set. type Device struct { @@ -312,7 +372,7 @@ type Device struct { // The maximum number of attributes and capacities combined is 32. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Attributes map[QualifiedName]DeviceAttribute `json:"attributes,omitempty" protobuf:"bytes,2,rep,name=attributes"` // Capacity defines the set of capacities for this device. @@ -333,13 +393,13 @@ type Device struct { // device is 2. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=counterSet + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=counterSet // +featureGate=DRAPartitionableDevices - // +k8s:alpha(since: "1.36")=+k8s:maxItems=2 + // +k8s:beta(since: "1.37")=+k8s:maxItems=2 ConsumesCounters []DeviceCounterConsumption `json:"consumesCounters,omitempty" protobuf:"bytes,4,rep,name=consumesCounters"` // NodeName identifies the node where the device is available. @@ -386,7 +446,7 @@ type Device struct { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Taints []DeviceTaint `json:"taints,omitempty" protobuf:"bytes,8,rep,name=taints"` // BindsToNode indicates if the usage of an allocation involving this device @@ -416,8 +476,8 @@ type Device struct { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 BindingConditions []string `json:"bindingConditions,omitempty" protobuf:"bytes,10,rep,name=bindingConditions"` // BindingFailureConditions defines the conditions for binding failure. @@ -434,8 +494,8 @@ type Device struct { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 BindingFailureConditions []string `json:"bindingFailureConditions,omitempty" protobuf:"bytes,11,rep,name=bindingFailureConditions"` // AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests. @@ -447,7 +507,10 @@ type Device struct { // +featureGate=DRAConsumableCapacity AllowMultipleAllocations *bool `json:"allowMultipleAllocations,omitempty" protobuf:"bytes,12,opt,name=allowMultipleAllocations"` - // NodeAllocatableResourceMappings defines the mapping of node resources + // NodeAllocatableResourceMappings is tombstoned as it got replaced with NodeAllocatableResources. + // NodeAllocatableResourceMappings map[v1.ResourceName]NodeAllocatableResourceMapping `json:"nodeAllocatableResourceMappings,omitempty" protobuf:"bytes,13,opt,name=nodeAllocatableResourceMappings"` + + // NodeAllocatableResources defines the mapping of node resources // that are managed by the DRA driver exposing this device. This includes resources currently // reported in v1.Node `status.allocatable` that are not extended resources // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). @@ -459,46 +522,104 @@ type Device struct { // The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). // Extended resource names are not permitted as keys. // +optional + // +k8s:optional // +featureGate=DRANodeAllocatableResources - NodeAllocatableResourceMappings map[v1.ResourceName]NodeAllocatableResourceMapping `json:"nodeAllocatableResourceMappings,omitempty" protobuf:"bytes,13,opt,name=nodeAllocatableResourceMappings"` + NodeAllocatableResources map[v1.ResourceName]NodeAllocatableResource `json:"nodeAllocatableResources,omitempty" protobuf:"bytes,14,opt,name=nodeAllocatableResources"` } -// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity +// NodeAllocatableResource defines the translation between the DRA device/capacity // units requested to the corresponding quantity of the node allocatable resource. -type NodeAllocatableResourceMapping struct { +// At least one of Mapping or Overhead must be specified. Not specifying either is an invalid configuration. +type NodeAllocatableResource struct { + // Mapping is used when the device directly models a node allocatable resource like standard CPU or memory + // (e.g., with a CPU DRA driver). The calculated quantity is accounted for exactly once per claim instance + // on the node. To prevent node cgroup isolation friction, the scheduler explicitly + // blocks sharing mapped device claims across multiple pods. + // +optional + // +k8s:optional + Mapping *NodeAllocatableMapping `json:"mapping,omitempty" protobuf:"bytes,3,opt,name=mapping"` + + // Overhead contains fields for modeling auxiliary overhead incurred on node allocatable resources + // when allocating devices that are not themselves modeling a node allocatable resource (e.g., host memory overhead for GPUs). + // Sharing overhead-mapped claims across multiple pods is allowed. The node allocatable overhead is accounted + // for individually for each pod referencing the claim. + // Overhead is always subtracted from the node's allocatable capacity for the resource, even when mapping + // is specified for the same resource. + // Eg: If a device models memory capacity per socket as a consumable capacity pool via Mapping (with CapacityKey), + // any overhead specified for the same resource will be subtracted from the node's general allocatable capacity + // and not from the per-socket capacity pool in Mapping. + // +optional + // +k8s:optional + Overhead *NodeAllocatableOverhead `json:"overhead,omitempty" protobuf:"bytes,4,opt,name=overhead"` +} + +// NodeAllocatableMapping defines how a DRA allocation directly translates into a node allocatable resource quantity. +// The mapping can be derived from either the count of allocated devices (via deviceMultiplier) or the specific capacity consumed (via capacityKey and capacityMultiplier). These options are mutually exclusive. +// Kubelet adds this mapped resource quantity from claim to both requests and limits at the pod-level cgroup, and to limits at the container-level cgroup for each container referencing the claim. +type NodeAllocatableMapping struct { // CapacityKey references a capacity name defined as a key in the // `spec.devices[*].capacity` map. When this field is set, the value associated with // this key in the `status.allocation.devices.results[*].consumedCapacity` map // (for a specific claim allocation) determines the base quantity for - // the node allocatable resource. If `allocationMultiplier` is also set, it is + // the node allocatable resource. `capacityMultiplier` must also be set and is // multiplied with the base quantity. // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", // and this field is set to "dra.example.com/memory", then for a claim allocation // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the - // node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should - // be omitted or set to "1". + // node allocatable resource mapping will be "4Gi". + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:alpha(since: "1.37")=+k8s:dependentRequired("capacityMultiplier") CapacityKey *QualifiedName `json:"capacityKey,omitempty" protobuf:"bytes,1,opt,name=capacityKey"` - // AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. - // It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. - // 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim. - // a. A DRA driver representing each CPU core as a device would have - // {ResourceName: "cpu", allocationMultiplier: "2"} in its - // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim, - // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. - // b. A GPU device that needs additional node memory per GPU allocation would - // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated - // GPU device instance of this type will account for 2Gi of memory. - // - // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed. - // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`. - // For example, if a Device's capacity "dra.example.com/cores" is consumed, - // and each "core" provides 2 "cpu"s, the mapping would be: - // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. - // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. - // +optional - AllocationMultiplier *resource.Quantity `json:"allocationMultiplier,omitempty" protobuf:"bytes,2,opt,name=allocationMultiplier"` + // CapacityMultiplier is used as a multiplier for the allocated capacity consumed. + // It is only valid if `capacityKey` is set. + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. + // For example, if a Device's capacity "dra.example.com/cores" is consumed, + // and each "core" provides 2 "cpu"s, the mapping would be: + // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", capacityMultiplier: "2"}. + // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. + // +optional + // +k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:dependentRequired("capacityKey") + CapacityMultiplier *resource.Quantity `json:"capacityMultiplier,omitempty" protobuf:"bytes,2,opt,name=capacityMultiplier"` + + // DeviceMultiplier is used as a multiplier for the allocated device count in the claim. + // The final node allocatable resource amount is `deviceCount` * `deviceMultiplier`. + // For example, a DRA driver representing each cache complex (CCX) as a device would have + // {ResourceName: "cpu", deviceMultiplier: "8"} in its `nodeAllocatableResources`. + // If 2 devices (CCX) are allocated to the claim, 2 * 8 = 16 CPUs would be considered as allocated. + // It is only valid when `capacityKey` and `capacityMultiplier` are not set. + // +optional + // +k8s:optional + // +k8s:unionMember + DeviceMultiplier *resource.Quantity `json:"deviceMultiplier,omitempty" protobuf:"bytes,3,opt,name=deviceMultiplier"` +} + +// NodeAllocatableOverhead defines auxiliary resource overheads incurred when allocating a device. +// Overheads can be specified as a fixed cost per pod referencing the claim, a variable cost per container reference, or both. +// Kubelet accounts for this overhead by adding it to both the pod-level and container-level cgroups of referencing containers. +type NodeAllocatableOverhead struct { + // PerPod is overhead applied once per pod referencing the claim on this node. + // This is a flat overhead incurred for every pod referencing the claim. + // +optional + // +k8s:optional + PerPod *resource.Quantity `json:"perPod,omitempty" protobuf:"bytes,1,opt,name=perPod"` + + // PerContainer is applied per container reference to the claim. + // This models overhead scaling linearly with the number of containers actively using the device. + // When both PerPod and PerContainer are specified, the total overhead allocated for each pod referencing + // the claim is computed as: + // Quantity = PerPod + (PerContainer * NumReferences) + // Kubelet accounts for this overhead in cgroups: + // - Pod-level cgroup (requests and limits): Kubelet adds PerPod + (PerContainer * NumReferences). + // - Container-level cgroup (limits only): Kubelet adds PerPod + PerContainer for each referencing container. + // This allows any single container to access the pod-level overhead, while the parent cgroup caps the total usage to account for PerPod exactly once. + // +optional + // +k8s:optional + PerContainer *resource.Quantity `json:"perContainer,omitempty" protobuf:"bytes,2,opt,name=perContainer"` } // DeviceCounterConsumption defines a set of counters that @@ -508,8 +629,8 @@ type DeviceCounterConsumption struct { // counters defined will be consumed. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-short-name CounterSet string `json:"counterSet" protobuf:"bytes,1,opt,name=counterSet"` // Counters defines the counters that will be consumed by the device. @@ -517,9 +638,39 @@ type DeviceCounterConsumption struct { // The maximum number of counters is 32. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:eachKey=+k8s:format=k8s-short-name Counters map[string]Counter `json:"counters,omitempty" protobuf:"bytes,2,opt,name=counters"` + + // CompatibilityGroups is a list of opaque group names for + // this counter set consumption. + // + // Devices that consume counters from the same counter set may only be + // allocated at the same time ("co-allocated") if they all share at least + // one common group: the intersection of the CompatibilityGroups of all + // co-allocated devices on that counter set must be non-empty. Devices + // that consume from different counter sets are never compared via this + // field. + // + // An unset field, an explicit nil, and an empty list are equivalent and + // mean "no groups": such a device is only co-allocatable with sibling + // devices on the same counter set that also have no groups, and is never + // co-allocatable with a device that declares one or more groups. + // + // Group names are opaque and meaningful only within the + // publishing driver's pool. + // + // The maximum number of groups is 2, and the names must be unique. + // + // +optional + // +listType=atomic + // +featureGate=DRADeviceCompatibilityGroups + // +k8s:listType=atomic + // +k8s:optional + // +k8s:maxItems=2 + // +k8s:unique=set + // +k8s:eachVal=+k8s:format=k8s-short-name + CompatibilityGroups []string `json:"compatibilityGroups,omitempty" protobuf:"bytes,3,rep,name=compatibilityGroups"` } // DeviceCapacity describes a quantity associated with a device. @@ -603,6 +754,13 @@ type CapacityRequestPolicy struct { // CapacityRequestPolicyRange defines a valid range for consumable capacity values. // +// If the DRAFractionalCapacityRange feature gate is +// enabled and at least one of Min, Max, or Step is a fractional quantity (i.e. +// its value is not an integer), milli-unit arithmetic is used instead, +// supporting values with up to 3 decimal places (e.g. 100m = 0.1). +// The largest supported value then is 1000 times smaller compared to using 64-bit integers. +// Otherwise, all comparisons use 64-bit integer arithmetic via resource.Quantity.Value(). +// // - If the requested amount is less than Min, it is rounded up to the Min value. // - If Step is set and the requested amount is between Min and Max but not aligned with Step, // it will be rounded up to the next value equal to Min + (n * Step). @@ -682,30 +840,30 @@ type DeviceAttribute struct { // IntValue is a number. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember IntValue *int64 `json:"int,omitempty" protobuf:"varint,2,opt,name=int"` // BoolValue is a true/false value. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember BoolValue *bool `json:"bool,omitempty" protobuf:"varint,3,opt,name=bool"` // StringValue is a string. Must not be longer than 64 characters. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember StringValue *string `json:"string,omitempty" protobuf:"bytes,4,opt,name=string"` // VersionValue is a semantic version according to semver.org spec 2.0.0. // Must not be longer than 64 characters. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember VersionValue *string `json:"version,omitempty" protobuf:"bytes,5,opt,name=version"` // IntValues is a non-empty list of numbers. @@ -715,8 +873,8 @@ type DeviceAttribute struct { // +optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember // +featureGate=DRAListTypeAttributes IntValues []int64 `json:"ints,omitempty" protobuf:"varint,6,opt,name=ints"` @@ -725,8 +883,8 @@ type DeviceAttribute struct { // +optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember // +featureGate=DRAListTypeAttributes BoolValues []bool `json:"bools,omitempty" protobuf:"varint,7,opt,name=bools"` @@ -738,8 +896,9 @@ type DeviceAttribute struct { // +optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember + // +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:maxBytes=64 // +featureGate=DRAListTypeAttributes StringValues []string `json:"strings,omitempty" protobuf:"bytes,8,opt,name=strings"` @@ -751,8 +910,8 @@ type DeviceAttribute struct { // +optional // +listType=atomic // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:unionMember // +featureGate=DRAListTypeAttributes VersionValues []string `json:"versions,omitempty" protobuf:"bytes,9,opt,name=versions"` } @@ -789,7 +948,7 @@ type DeviceTaint struct { // Consumers must treat unknown effects like None. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Effect DeviceTaintEffect `json:"effect" protobuf:"bytes,3,name=effect,casttype=DeviceTaintEffect"` // ^^^^ @@ -828,7 +987,7 @@ type DeviceTaint struct { } // +enum -// +k8s:alpha(since: "1.36")=+k8s:enum +// +k8s:beta(since: "1.37")=+k8s:enum type DeviceTaintEffect string const ( @@ -852,8 +1011,9 @@ const ( // DeviceTaintRule adds one taint to all devices which match the selector. // This has the same effect as if the taint was specified directly // in the ResourceSlice by the DRA driver. +// +k8s:supportsSubresource="/status" type DeviceTaintRule struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -971,6 +1131,9 @@ type DeviceTaintRuleStatus struct { // +listMapKey=type // +patchStrategy=merge // +patchMergeKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` } @@ -985,7 +1148,7 @@ const DeviceTaintConditionEvictionInProgress = "EvictionInProgress" // DeviceTaintRuleList is a collection of DeviceTaintRules. type DeviceTaintRuleList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -999,7 +1162,7 @@ type DeviceTaintRuleList struct { // ResourceSliceList is a collection of ResourceSlices. type ResourceSliceList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -1022,14 +1185,15 @@ type ResourceSliceList struct { // This is an alpha type and requires enabling the DynamicResourceAllocation // feature gate. type ResourceClaim struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec describes what is being requested and how to configure it. // The spec is immutable. - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:immutable + // +optional Spec ResourceClaimSpec `json:"spec" protobuf:"bytes,2,name=spec"` // Status describes whether the claim is ready to use and what has been allocated. @@ -1057,11 +1221,11 @@ type DeviceClaim struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=name + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Requests []DeviceRequest `json:"requests" protobuf:"bytes,1,name=requests"` // These constraints must be satisfied by the set of devices that get @@ -1069,8 +1233,8 @@ type DeviceClaim struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Constraints []DeviceConstraint `json:"constraints,omitempty" protobuf:"bytes,2,opt,name=constraints"` // This field holds configuration for multiple potential drivers which @@ -1079,8 +1243,8 @@ type DeviceClaim struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Config []DeviceClaimConfiguration `json:"config,omitempty" protobuf:"bytes,3,opt,name=config"` // Potential future extension, ignored by older schedulers. This is @@ -1131,7 +1295,7 @@ type DeviceRequest struct { // // +optional // +oneOf=deviceRequestType - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Exactly *ExactDeviceRequest `json:"exactly,omitempty" protobuf:"bytes,2,name=exactly"` // FirstAvailable contains subrequests, of which exactly one will be @@ -1152,11 +1316,11 @@ type DeviceRequest struct { // +oneOf=deviceRequestType // +listType=atomic // +featureGate=DRAPrioritizedList - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name - // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 + // +k8s:beta(since: "1.37")=+k8s:unique=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=name + // +k8s:beta(since: "1.37")=+k8s:maxItems=8 FirstAvailable []DeviceSubRequest `json:"firstAvailable,omitempty" protobuf:"bytes,3,name=firstAvailable"` } @@ -1184,8 +1348,8 @@ type ExactDeviceRequest struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,2,name=selectors"` // AllocationMode and its related fields define how devices are allocated @@ -1208,7 +1372,7 @@ type ExactDeviceRequest struct { // requests with unknown modes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional AllocationMode DeviceAllocationMode `json:"allocationMode,omitempty" protobuf:"bytes,3,opt,name=allocationMode"` // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1253,7 +1417,7 @@ type ExactDeviceRequest struct { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Tolerations []DeviceToleration `json:"tolerations,omitempty" protobuf:"bytes,6,opt,name=tolerations"` // Capacity define resource requirements against each capacity. @@ -1272,6 +1436,34 @@ type ExactDeviceRequest struct { // +optional // +featureGate=DRAConsumableCapacity Capacity *CapacityRequirements `json:"capacity,omitempty" protobuf:"bytes,7,opt,name=capacity"` + + // DerivedAttributes defines a set of virtual attributes computed via CEL expressions + // for each candidate device. These virtual attributes can be referenced in + // `.devices.constraints` to align and match different devices (e.g., co-allocating + // a GPU and a NIC on the same NUMA node) even if their drivers publish different + // attributes. Derived attributes are not available via `device.attributes` + // in the CEL environment when evaluating selector expressions. + // + // Derived attributes allow you to extract, transform, or normalize topology + // information (such as extracting a NUMA index from a complex topology string or + // renaming a vendor-specific attribute) into a common virtual attribute name at + // scheduling time. The scheduler then evaluates these virtual attributes exactly + // like static attributes when matching constraints. + // + // Every derived attribute defined in this list must be referenced by at least one + // MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + // + // The maximum number of derived attributes is 32. + // + // This is an alpha field and requires enabling the DRADerivedAttributes + // feature gate. + // + // +optional + // +listType=atomic + // +featureGate=DRADerivedAttributes + // +k8s:optional + // +k8s:maxItems=32 + DerivedAttributes []DeviceDerivedAttribute `json:"derivedAttributes,omitempty" protobuf:"bytes,8,rep,name=derivedAttributes"` } // DeviceSubRequest describes a request for device provided in the @@ -1305,8 +1497,8 @@ type DeviceSubRequest struct { // to reference. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name DeviceClassName string `json:"deviceClassName" protobuf:"bytes,2,name=deviceClassName"` // Selectors define criteria which must be satisfied by a specific @@ -1316,8 +1508,8 @@ type DeviceSubRequest struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,3,name=selectors"` // AllocationMode and its related fields define how devices are allocated @@ -1339,7 +1531,7 @@ type DeviceSubRequest struct { // requests with unknown modes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional AllocationMode DeviceAllocationMode `json:"allocationMode,omitempty" protobuf:"bytes,4,opt,name=allocationMode"` // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1370,7 +1562,7 @@ type DeviceSubRequest struct { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Tolerations []DeviceToleration `json:"tolerations,omitempty" protobuf:"bytes,6,opt,name=tolerations"` // Capacity define resource requirements against each capacity. @@ -1389,6 +1581,34 @@ type DeviceSubRequest struct { // +optional // +featureGate=DRAConsumableCapacity Capacity *CapacityRequirements `json:"capacity,omitempty" protobuf:"bytes,7,opt,name=capacity"` + + // DerivedAttributes defines a set of virtual attributes computed via CEL expressions + // for each candidate device. These virtual attributes can be referenced in + // `.devices.constraints` to align and match different devices (e.g., co-allocating + // a GPU and a NIC on the same NUMA node) even if their drivers publish different + // attributes. Derived attributes are not available via `device.attributes` + // in the CEL environment when evaluating selector expressions. + // + // Derived attributes allow you to extract, transform, or normalize topology + // information (such as extracting a NUMA index from a complex topology string or + // renaming a vendor-specific attribute) into a common virtual attribute name at + // scheduling time. The scheduler then evaluates these virtual attributes exactly + // like static attributes when matching constraints. + // + // Every derived attribute defined in this list must be referenced by at least one + // MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + // + // The maximum number of derived attributes is 32. + // + // This is an alpha field and requires enabling the DRADerivedAttributes + // feature gate. + // + // +optional + // +listType=atomic + // +featureGate=DRADerivedAttributes + // +k8s:optional + // +k8s:maxItems=32 + DerivedAttributes []DeviceDerivedAttribute `json:"derivedAttributes,omitempty" protobuf:"bytes,8,rep,name=derivedAttributes"` } // CapacityRequirements defines the capacity requirements for a specific device request. @@ -1420,14 +1640,70 @@ type CapacityRequirements struct { Requests map[QualifiedName]resource.Quantity `json:"requests,omitempty" protobuf:"bytes,1,rep,name=requests,castkey=QualifiedName"` } +// DeviceDerivedAttribute defines a derived attribute computed via CEL. +type DeviceDerivedAttribute struct { + // Name is the identifier for this derived attribute, used in constraints. + // + // It must be a DNS subdomain followed by a slash ("/") followed by a C identifier + // (e.g. "example.com/numaNode" or "derived/numaNode"). + // + // If the chosen name matches an existing physical attribute from a driver, + // the derived attribute's expression will shadow the physical attribute, + // and its evaluated value will be used in constraints instead. When the goal + // is to define a derived attribute that is only used within the ResourceClaim + // and not meant to shadow an existing attribute, use a domain prefix that + // no DRA driver should be using (e.g. "derived/myAttribute"). + // + // It is not valid to define a derived attribute that isn't used in at least + // one constraint. + // + // +required + // +k8s:required + // +k8s:format=k8s-resource-fully-qualified-name + Name FullyQualifiedName `json:"name" protobuf:"bytes,1,name=name"` + + // Expression is a CEL expression evaluated against each candidate device. + // The expression must evaluate to a primitive scalar (string, integer, + // boolean, or semver) or a list of these scalars ([]string, []int64, + // []bool, []semver) to act as a virtual grouping key. Any other return type + // is an error and causes CEL evaluation for the device to fail. + // + // The expression's input is an object named "device", which carries the + // same properties as in a CELDeviceSelector. + // + // When pod scheduling encounters CEL runtime errors (such as looking + // up an attribute that isn't defined) for some devices, it will abort + // allocation and fail scheduling for the Pod. Surfacing evaluation + // errors immediately prevents silent topology matching failures that are + // extremely hard to detect. A robust expression should, for example, check + // for the existence of attributes before referencing them to avoid + // runtime evaluation errors. + // + // The expression gets evaluated after a device has passed the other + // selector expressions for the request in which this expression is used. + // This allows writing expressions that are tailored towards the specific + // devices being requested (for example, by assuming the device is from a + // certain vendor and skipping those checks). + // + // The length of the expression must be smaller or equal to 10 Ki. The + // cost of evaluating it is also limited based on the estimated number + // of logical steps; the combined cost of all derived attributes in a + // claim is capped by a shared CEL cost budget. + // + // +required + // +k8s:required + Expression string `json:"expression" protobuf:"bytes,2,name=expression"` +} + const ( DeviceSelectorsMaxSize = 32 FirstAvailableDeviceRequestMaxSize = 8 DeviceTolerationsMaxLength = 16 + DeviceDerivedAttributesMaxSize = 32 ) // +enum -// +k8s:alpha(since: "1.36")=+k8s:enum +// +k8s:beta(since: "1.37")=+k8s:enum type DeviceAllocationMode string // Valid [DeviceRequest.CountMode] values. @@ -1457,7 +1733,7 @@ type CELDeviceSelector struct { // - driver (string): the name of the driver which defines this device. // - attributes (map[string]object): the device's attributes, grouped by prefix // (e.g. device.attributes["dra.example.com"] evaluates to an object with all - // of the attributes which were prefixed by "dra.example.com". + // of the attributes which were prefixed by "dra.example.com"). // - capacity (map[string]object): the device's capacities, grouped by prefix. // - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device // (v1.34+ with the DRAConsumableCapacity feature enabled). @@ -1490,6 +1766,15 @@ type CELDeviceSelector struct { // A robust expression should check for the existence of attributes // before referencing them. // + // Common errors: + // - "no such key": Use optional chaining (.? followed by orValue()) + // or guarding the check with has() for optional fields. + // See CEL Optional Types for details: + // https://pkg.go.dev/github.com/google/cel-go@v0.17.4/cel#OptionalTypes + // + // For more CEL expression syntax and examples, see: + // https://kubernetes.io/docs/reference/using-api/cel/ + // // For ease of use, the cel.bind() function is enabled, and can be used // to simplify expressions that access multiple attributes with the // same domain. For example: @@ -1537,6 +1822,25 @@ type CELDeviceSelector struct { // However, this depends on how fast the machine is. const CELSelectorExpressionMaxCost = 1000000 +// DeviceClaimDerivedAttributeCELMaxCost is the maximum combined execution cost +// allowed for all derived attribute CEL expressions within a single DeviceClaim. +// +// During validation, the API server computes the estimated execution cost of each +// derived attribute expression. The sum of these costs across all requests in the +// claim must not exceed this budget. If it does, the claim is rejected. +// +// To stay within the budget, consumers should simplify their CEL expressions, +// avoid computationally expensive operations like deep nesting or iterations +// (such as `.all()` or `.exists()`), and minimize the total number of derived +// attributes in a claim. +// +// This shared budget prevents excessively complex claims from degrading the +// performance of the kube-scheduler. The limit is set to 1,000,000 instruction +// executions (roughly 0.1 seconds of evaluation time), tying the collective +// cost of all derived attributes to the maximum cost allowed for a single +// CEL selector. +const DeviceClaimDerivedAttributeCELMaxCost = 1000000 + // CELSelectorExpressionMaxLength is the maximum length of a CEL selector expression string. const CELSelectorExpressionMaxLength = 10 * 1024 @@ -1554,10 +1858,10 @@ type DeviceConstraint struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Requests []string `json:"requests,omitempty" protobuf:"bytes,1,opt,name=requests"` // MatchAttribute requires that all devices in question have this @@ -1580,8 +1884,8 @@ type DeviceConstraint struct { // // +optional // +oneOf=ConstraintType - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-fully-qualified-name + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-fully-qualified-name MatchAttribute *FullyQualifiedName `json:"matchAttribute,omitempty" protobuf:"bytes,2,opt,name=matchAttribute"` // Potential future extension, not part of the current design: @@ -1613,6 +1917,8 @@ type DeviceConstraint struct { // +optional // +oneOf=ConstraintType // +featureGate=DRAConsumableCapacity + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-fully-qualified-name DistinctAttribute *FullyQualifiedName `json:"distinctAttribute,omitempty" protobuf:"bytes,3,opt,name=distinctAttribute"` } @@ -1627,13 +1933,13 @@ type DeviceClaimConfiguration struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Requests []string `json:"requests,omitempty" protobuf:"bytes,1,opt,name=requests"` - DeviceConfiguration `json:",inline" protobuf:"bytes,2,name=deviceConfiguration"` + DeviceConfiguration `json:"" protobuf:"bytes,2,name=deviceConfiguration"` } // DeviceConfiguration must have exactly one field set. It gets embedded @@ -1644,7 +1950,7 @@ type DeviceConfiguration struct { // // +optional // +oneOf=ConfigurationType - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Opaque *OpaqueDeviceConfiguration `json:"opaque,omitempty" protobuf:"bytes,1,opt,name=opaque"` } @@ -1661,9 +1967,9 @@ type OpaqueDeviceConfiguration struct { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:maxLength=63 + // +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name-caseless Driver string `json:"driver" protobuf:"bytes,1,name=driver"` // Parameters can contain arbitrary data. It is the responsibility of @@ -1689,8 +1995,8 @@ type DeviceToleration struct { // Must be a label name. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-label-key + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-label-key Key string `json:"key,omitempty" protobuf:"bytes,1,opt,name=key"` // Operator represents a key's relationship to the value. @@ -1700,7 +2006,7 @@ type DeviceToleration struct { // // +optional // +default="Equal" - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Operator DeviceTolerationOperator `json:"operator,omitempty" protobuf:"bytes,2,opt,name=operator,casttype=DeviceTolerationOperator"` // Value is the taint value the toleration matches to. @@ -1714,7 +2020,7 @@ type DeviceToleration struct { // When specified, allowed values are NoSchedule and NoExecute. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Effect DeviceTaintEffect `json:"effect,omitempty" protobuf:"bytes,4,opt,name=effect,casttype=DeviceTaintEffect"` // TolerationSeconds represents the period of time the toleration (which must be @@ -1731,7 +2037,7 @@ type DeviceToleration struct { // A toleration operator is the set of operators that can be used in a toleration. // // +enum -// +k8s:alpha(since: "1.36")=+k8s:enum +// +k8s:beta(since: "1.37")=+k8s:enum type DeviceTolerationOperator string const ( @@ -1745,8 +2051,8 @@ type ResourceClaimStatus struct { // Allocation is set once the claim has been allocated successfully. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:update=NoModify + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:update=NoModify Allocation *AllocationResult `json:"allocation,omitempty" protobuf:"bytes,1,opt,name=allocation"` // ReservedFor indicates which entities are currently allowed to use @@ -1774,10 +2080,10 @@ type ResourceClaimStatus struct { // +listMapKey=uid // +patchStrategy=merge // +patchMergeKey=uid - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:listType=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=uid - // +k8s:alpha(since: "1.36")=+k8s:maxItems=256 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:listType=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=uid + // +k8s:beta(since: "1.37")=+k8s:maxItems=256 ReservedFor []ResourceClaimConsumerReference `json:"reservedFor,omitempty" protobuf:"bytes,2,opt,name=reservedFor" patchStrategy:"merge" patchMergeKey:"uid"` // DeallocationRequested is tombstoned since Kubernetes 1.32 where @@ -1790,18 +2096,18 @@ type ResourceClaimStatus struct { // information. Entries are owned by their respective drivers. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +listType=map // +listMapKey=driver // +listMapKey=device // +listMapKey=pool // +listMapKey=shareID // +featureGate=DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:listType=map - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=driver - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=device - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=pool - // +k8s:alpha(since: "1.36")=+k8s:listMapKey=shareID + // +k8s:beta(since: "1.37")=+k8s:listType=map + // +k8s:beta(since: "1.37")=+k8s:listMapKey=driver + // +k8s:beta(since: "1.37")=+k8s:listMapKey=device + // +k8s:beta(since: "1.37")=+k8s:listMapKey=pool + // +k8s:beta(since: "1.37")=+k8s:listMapKey=shareID Devices []AllocatedDeviceStatus `json:"devices,omitempty" protobuf:"bytes,4,opt,name=devices"` } @@ -1864,8 +2170,8 @@ type DeviceAllocationResult struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Results []DeviceRequestAllocationResult `json:"results,omitempty" protobuf:"bytes,1,opt,name=results"` // This field is a combination of all the claim and class configuration parameters. @@ -1878,8 +2184,8 @@ type DeviceAllocationResult struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=64 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=64 Config []DeviceAllocationConfiguration `json:"config,omitempty" protobuf:"bytes,2,opt,name=config"` } @@ -1908,9 +2214,9 @@ type DeviceRequestAllocationResult struct { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless - // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name-caseless + // +k8s:beta(since: "1.37")=+k8s:maxLength=63 + // +k8s:beta(since: "1.37")=+k8s:required Driver string `json:"driver" protobuf:"bytes,2,name=driver"` // This name together with the driver name and the device name field @@ -1920,8 +2226,8 @@ type DeviceRequestAllocationResult struct { // DNS sub-domains separated by slashes. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-pool-name + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-pool-name Pool string `json:"pool" protobuf:"bytes,3,name=pool"` // Device references one device instance via its name in the driver's @@ -1953,7 +2259,7 @@ type DeviceRequestAllocationResult struct { // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional Tolerations []DeviceToleration `json:"tolerations,omitempty" protobuf:"bytes,6,opt,name=tolerations"` // BindingConditions contains a copy of the BindingConditions @@ -1965,8 +2271,8 @@ type DeviceRequestAllocationResult struct { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 BindingConditions []string `json:"bindingConditions,omitempty" protobuf:"bytes,7,rep,name=bindingConditions"` // BindingFailureConditions contains a copy of the BindingFailureConditions @@ -1978,8 +2284,8 @@ type DeviceRequestAllocationResult struct { // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=4 BindingFailureConditions []string `json:"bindingFailureConditions,omitempty" protobuf:"bytes,8,rep,name=bindingFailureConditions"` // ShareID uniquely identifies an individual allocation share of the device, @@ -1989,8 +2295,8 @@ type DeviceRequestAllocationResult struct { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-uuid ShareID *types.UID `json:"shareID,omitempty" protobuf:"bytes,9,opt,name=shareID"` // ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. @@ -2005,6 +2311,19 @@ type DeviceRequestAllocationResult struct { // +optional // +featureGate=DRAConsumableCapacity ConsumedCapacity map[QualifiedName]resource.Quantity `json:"consumedCapacity,omitempty" protobuf:"bytes,10,rep,name=consumedCapacity"` + + // SkipNodeOperations lists node-local resource operations (gRPC calls) + // that will be skipped for this allocated device when determining whether + // operations are necessary on the node. If all allocated devices for a driver in + // a claim skip an operation, that gRPC call will be skipped. It is a copy of + // the ResourceSlice.spec.skipNodeOperations value at the time when the device was allocated. + // + // +optional + // +listType=set + // +k8s:listType=set + // +featureGate=DRAOptionalNodeOperations + // +k8s:optional + SkipNodeOperations []SkipNodeOperation `json:"skipNodeOperations,omitempty" protobuf:"bytes,11,rep,name=skipNodeOperations,casttype=SkipNodeOperation"` } // DeviceAllocationConfiguration gets embedded in an AllocationResult. @@ -2014,7 +2333,7 @@ type DeviceAllocationConfiguration struct { // or from a claim. // // +required - // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:required Source AllocationConfigSource `json:"source" protobuf:"bytes,1,name=source"` // Requests lists the names of requests where the configuration applies. @@ -2026,17 +2345,17 @@ type DeviceAllocationConfiguration struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Requests []string `json:"requests,omitempty" protobuf:"bytes,2,opt,name=requests"` - DeviceConfiguration `json:",inline" protobuf:"bytes,3,name=deviceConfiguration"` + DeviceConfiguration `json:"" protobuf:"bytes,3,name=deviceConfiguration"` } // +enum -// +k8s:alpha(since: "1.36")=+k8s:enum +// +k8s:beta(since: "1.37")=+k8s:enum type AllocationConfigSource string // Valid [DeviceAllocationConfiguration.Source] values. @@ -2050,7 +2369,7 @@ const ( // ResourceClaimList is a collection of claims. type ResourceClaimList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -2072,11 +2391,11 @@ type ResourceClaimList struct { // This is an alpha type and requires enabling the DynamicResourceAllocation // feature gate. type DeviceClass struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata // +optional - // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:format=k8s-long-name + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:format=k8s-long-name metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec defines what can be allocated and how to configure it. @@ -2087,6 +2406,7 @@ type DeviceClass struct { // the time of allocation. // // Changing the spec automatically increments the metadata.generation number. + // +optional Spec DeviceClassSpec `json:"spec" protobuf:"bytes,2,name=spec"` } @@ -2097,8 +2417,8 @@ type DeviceClassSpec struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,1,opt,name=selectors"` // Config defines configuration parameters that apply to each device that is claimed via this class. @@ -2109,8 +2429,8 @@ type DeviceClassSpec struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxItems=32 Config []DeviceClassConfiguration `json:"config,omitempty" protobuf:"bytes,2,opt,name=config"` // SuitableNodes is tombstoned since Kubernetes 1.32 where @@ -2127,17 +2447,16 @@ type DeviceClassSpec struct { // If two classes are created at the same time, then the name of the class // lexicographically sorted first is picked. // - // This is a beta field. // +optional // +featureGate=DRAExtendedResource - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-extended-resource-name + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-extended-resource-name ExtendedResourceName *string `json:"extendedResourceName,omitempty" protobuf:"bytes,4,opt,name=extendedResourceName"` } // DeviceClassConfiguration is used in DeviceClass. type DeviceClassConfiguration struct { - DeviceConfiguration `json:",inline" protobuf:"bytes,1,opt,name=deviceConfiguration"` + DeviceConfiguration `json:"" protobuf:"bytes,1,opt,name=deviceConfiguration"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object @@ -2145,7 +2464,7 @@ type DeviceClassConfiguration struct { // DeviceClassList is a collection of classes. type DeviceClassList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -2163,7 +2482,7 @@ type DeviceClassList struct { // This is an alpha type and requires enabling the DynamicResourceAllocation // feature gate. type ResourceClaimTemplate struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -2173,6 +2492,7 @@ type ResourceClaimTemplate struct { // This field is immutable. A ResourceClaim will get created by the // control plane for a Pod when needed and then not get updated // anymore. + // +optional Spec ResourceClaimTemplateSpec `json:"spec" protobuf:"bytes,2,name=spec"` } @@ -2182,11 +2502,13 @@ type ResourceClaimTemplateSpec struct { // when creating it. No other fields are allowed and will be rejected during // validation. // +optional + // +k8s:opaqueType metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec for the ResourceClaim. The entire content is copied unchanged // into the ResourceClaim that gets created from this template. The // same fields as in a ResourceClaim are also valid here. + // +optional Spec ResourceClaimSpec `json:"spec" protobuf:"bytes,2,name=spec"` } @@ -2195,7 +2517,7 @@ type ResourceClaimTemplateSpec struct { // ResourceClaimTemplateList is a collection of claim templates. type ResourceClaimTemplateList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -2257,8 +2579,8 @@ type AllocatedDeviceStatus struct { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:format=k8s-uuid ShareID *string `json:"shareID,omitempty" protobuf:"bytes,7,opt,name=shareID"` // Conditions contains the latest observation of the device's state. @@ -2270,6 +2592,9 @@ type AllocatedDeviceStatus struct { // +optional // +listType=map // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type Conditions []metav1.Condition `json:"conditions" protobuf:"bytes,4,opt,name=conditions"` // Data contains arbitrary driver-specific data. @@ -2282,7 +2607,7 @@ type AllocatedDeviceStatus struct { // NetworkData contains network-related information specific to the device. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional NetworkData *NetworkDeviceData `json:"networkData,omitempty" protobuf:"bytes,6,opt,name=networkData"` } @@ -2297,8 +2622,8 @@ type NetworkDeviceData struct { // Must not be longer than 256 bytes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxBytes=256 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxBytes=256 InterfaceName string `json:"interfaceName,omitempty" protobuf:"bytes,1,opt,name=interfaceName"` // IPs lists the network addresses assigned to the device's network interface. @@ -2309,10 +2634,10 @@ type NetworkDeviceData struct { // // +optional // +listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:optional // +k8s:listType=atomic - // +k8s:alpha(since: "1.36")=+k8s:unique=set - // +k8s:alpha(since: "1.36")=+k8s:maxItems=16 + // +k8s:beta(since: "1.37")=+k8s:unique=set + // +k8s:beta(since: "1.37")=+k8s:maxItems=16 IPs []string `json:"ips,omitempty" protobuf:"bytes,2,opt,name=ips"` // HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface. @@ -2320,7 +2645,7 @@ type NetworkDeviceData struct { // Must not be longer than 128 bytes. // // +optional - // +k8s:alpha(since: "1.36")=+k8s:optional - // +k8s:alpha(since: "1.36")=+k8s:maxBytes=128 + // +k8s:beta(since: "1.37")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:maxBytes=128 HardwareAddress string `json:"hardwareAddress,omitempty" protobuf:"bytes,3,opt,name=hardwareAddress"` } diff --git a/vendor/k8s.io/api/resource/v1beta2/types_swagger_doc_generated.go b/vendor/k8s.io/api/resource/v1beta2/types_swagger_doc_generated.go index 122170ec25..3f0c9176b4 100644 --- a/vendor/k8s.io/api/resource/v1beta2/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/resource/v1beta2/types_swagger_doc_generated.go @@ -55,7 +55,7 @@ func (AllocationResult) SwaggerDoc() map[string]string { var map_CELDeviceSelector = map[string]string{ "": "CELDeviceSelector contains a CEL expression for selecting a device.", - "expression": "Expression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort.\n\nThe expression's input is an object named \"device\", which carries the following properties:\n - driver (string): the name of the driver which defines this device.\n - attributes (map[string]object): the device's attributes, grouped by prefix\n (e.g. device.attributes[\"dra.example.com\"] evaluates to an object with all\n of the attributes which were prefixed by \"dra.example.com\".\n - capacity (map[string]object): the device's capacities, grouped by prefix.\n - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device\n (v1.34+ with the DRAConsumableCapacity feature enabled).\n\nExample: Consider a device with driver=\"dra.example.com\", which exposes two attributes named \"model\" and \"ext.example.com/family\" and which exposes one capacity named \"modules\". This input to this expression would have the following fields:\n\n device.driver\n device.attributes[\"dra.example.com\"].model\n device.attributes[\"ext.example.com\"].family\n device.capacity[\"dra.example.com\"].modules\n\nThe device.driver field can be used to check for a specific driver, either as a high-level precondition (i.e. you only want to consider devices from this driver) or as part of a multi-clause expression that is meant to consider devices from different drivers.\n\nThe value type of each attribute is defined by the device definition, and users who write these expressions must consult the documentation for their specific drivers. The value type of each capacity is Quantity.\n\nIf an unknown prefix is used as a lookup in either device.attributes or device.capacity, an empty map will be returned. Any reference to an unknown field will cause an evaluation error and allocation to abort.\n\nA robust expression should check for the existence of attributes before referencing them.\n\nFor ease of use, the cel.bind() function is enabled, and can be used to simplify expressions that access multiple attributes with the same domain. For example:\n\n cel.bind(dra, device.attributes[\"dra.example.com\"], dra.someBool && dra.anotherBool)\n\nWhen the DRAListTypeAttributes feature gate is enabled, the includes() helper is available and it can work for both scalar and list-type attributes. It was introduced to support smooth migration from scalar attributes to list-type attributes while keeping CEL expressions simple. For example:\n\n device.attributes[\"dra.example.com\"].models.includes(\"some-model\")\n\nThe length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps.", + "expression": "Expression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort.\n\nThe expression's input is an object named \"device\", which carries the following properties:\n - driver (string): the name of the driver which defines this device.\n - attributes (map[string]object): the device's attributes, grouped by prefix\n (e.g. device.attributes[\"dra.example.com\"] evaluates to an object with all\n of the attributes which were prefixed by \"dra.example.com\").\n - capacity (map[string]object): the device's capacities, grouped by prefix.\n - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device\n (v1.34+ with the DRAConsumableCapacity feature enabled).\n\nExample: Consider a device with driver=\"dra.example.com\", which exposes two attributes named \"model\" and \"ext.example.com/family\" and which exposes one capacity named \"modules\". This input to this expression would have the following fields:\n\n device.driver\n device.attributes[\"dra.example.com\"].model\n device.attributes[\"ext.example.com\"].family\n device.capacity[\"dra.example.com\"].modules\n\nThe device.driver field can be used to check for a specific driver, either as a high-level precondition (i.e. you only want to consider devices from this driver) or as part of a multi-clause expression that is meant to consider devices from different drivers.\n\nThe value type of each attribute is defined by the device definition, and users who write these expressions must consult the documentation for their specific drivers. The value type of each capacity is Quantity.\n\nIf an unknown prefix is used as a lookup in either device.attributes or device.capacity, an empty map will be returned. Any reference to an unknown field will cause an evaluation error and allocation to abort.\n\nA robust expression should check for the existence of attributes before referencing them.\n\nCommon errors: - \"no such key\": Use optional chaining (.? followed by orValue())\n or guarding the check with has() for optional fields.\n See CEL Optional Types for details:\n https://pkg.go.dev/github.com/google/cel-go@v0.17.4/cel#OptionalTypes\n\nFor more CEL expression syntax and examples, see: https://kubernetes.io/docs/reference/using-api/cel/\n\nFor ease of use, the cel.bind() function is enabled, and can be used to simplify expressions that access multiple attributes with the same domain. For example:\n\n cel.bind(dra, device.attributes[\"dra.example.com\"], dra.someBool && dra.anotherBool)\n\nWhen the DRAListTypeAttributes feature gate is enabled, the includes() helper is available and it can work for both scalar and list-type attributes. It was introduced to support smooth migration from scalar attributes to list-type attributes while keeping CEL expressions simple. For example:\n\n device.attributes[\"dra.example.com\"].models.includes(\"some-model\")\n\nThe length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps.", } func (CELDeviceSelector) SwaggerDoc() map[string]string { @@ -74,7 +74,7 @@ func (CapacityRequestPolicy) SwaggerDoc() map[string]string { } var map_CapacityRequestPolicyRange = map[string]string{ - "": "CapacityRequestPolicyRange defines a valid range for consumable capacity values.\n\n - If the requested amount is less than Min, it is rounded up to the Min value.\n - If Step is set and the requested amount is between Min and Max but not aligned with Step,\n it will be rounded up to the next value equal to Min + (n * Step).\n - If Step is not set, the requested amount is used as-is if it falls within the range Min to Max (if set).\n - If the requested or rounded amount exceeds Max (if set), the request does not satisfy the policy,\n and the device cannot be allocated.", + "": "CapacityRequestPolicyRange defines a valid range for consumable capacity values.\n\nIf the DRAFractionalCapacityRange feature gate is enabled and at least one of Min, Max, or Step is a fractional quantity (i.e. its value is not an integer), milli-unit arithmetic is used instead, supporting values with up to 3 decimal places (e.g. 100m = 0.1). The largest supported value then is 1000 times smaller compared to using 64-bit integers. Otherwise, all comparisons use 64-bit integer arithmetic via resource.Quantity.Value().\n\n - If the requested amount is less than Min, it is rounded up to the Min value.\n - If Step is set and the requested amount is between Min and Max but not aligned with Step,\n it will be rounded up to the next value equal to Min + (n * Step).\n - If Step is not set, the requested amount is used as-is if it falls within the range Min to Max (if set).\n - If the requested or rounded amount exceeds Max (if set), the request does not satisfy the policy,\n and the device cannot be allocated.", "min": "Min specifies the minimum capacity allowed for a consumption request.\n\nMin must be greater than or equal to zero, and less than or equal to the capacity value. requestPolicy.default must be more than or equal to the minimum.", "max": "Max defines the upper limit for capacity that can be requested.\n\nMax must be less than or equal to the capacity value. Min and requestPolicy.default must be less than or equal to the maximum.", "step": "Step defines the step size between valid capacity amounts within the range.\n\nMax (if set) and requestPolicy.default must be a multiple of Step. Min + Step must be less than or equal to the capacity value.", @@ -113,20 +113,20 @@ func (CounterSet) SwaggerDoc() map[string]string { } var map_Device = map[string]string{ - "": "Device represents one individual hardware instance that can be selected based on its attributes. Besides the name, exactly one field must be set.", - "name": "Name is unique identifier among all devices managed by the driver in the pool. It must be a DNS label.", - "attributes": "Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", - "capacity": "Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", - "consumesCounters": "ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets.\n\nThere can only be a single entry per counterSet.\n\nThe maximum number of device counter consumptions per device is 2.", - "nodeName": "NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", - "nodeSelector": "NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", - "allNodes": "AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", - "taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", - "bindsToNode": "BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "bindingConditions": "BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod.\n\nThe maximum number of binding conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "bindingFailureConditions": "BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is set to \"True\", a binding failure occurred.\n\nThe maximum number of binding failure conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "allowMultipleAllocations": "AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.\n\nIf AllowMultipleAllocations is set to true, the device can be allocated more than once, and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.", - "nodeAllocatableResourceMappings": "NodeAllocatableResourceMappings defines the mapping of node resources that are managed by the DRA driver exposing this device. This includes resources currently reported in v1.Node `status.allocatable` that are not extended resources (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). Examples include \"cpu\", \"memory\", \"ephemeral-storage\", and hugepages. In addition to standard requests made through the Pod `spec`, these resources can also be requested through claims and allocated by the DRA driver. For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory dependencies of an accelerator device. The keys of this map are the node-allocatable resource names (e.g., \"cpu\", \"memory\"). Extended resource names are not permitted as keys.", + "": "Device represents one individual hardware instance that can be selected based on its attributes. Besides the name, exactly one field must be set.", + "name": "Name is unique identifier among all devices managed by the driver in the pool. It must be a DNS label.", + "attributes": "Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", + "capacity": "Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", + "consumesCounters": "ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets.\n\nThere can only be a single entry per counterSet.\n\nThe maximum number of device counter consumptions per device is 2.", + "nodeName": "NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", + "nodeSelector": "NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", + "allNodes": "AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", + "taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", + "bindsToNode": "BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "bindingConditions": "BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod.\n\nThe maximum number of binding conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "bindingFailureConditions": "BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is set to \"True\", a binding failure occurred.\n\nThe maximum number of binding failure conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "allowMultipleAllocations": "AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.\n\nIf AllowMultipleAllocations is set to true, the device can be allocated more than once, and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.", + "nodeAllocatableResources": "NodeAllocatableResources defines the mapping of node resources that are managed by the DRA driver exposing this device. This includes resources currently reported in v1.Node `status.allocatable` that are not extended resources (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). Examples include \"cpu\", \"memory\", \"ephemeral-storage\", and hugepages. In addition to standard requests made through the Pod `spec`, these resources can also be requested through claims and allocated by the DRA driver. For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory dependencies of an accelerator device. The keys of this map are the node-allocatable resource names (e.g., \"cpu\", \"memory\"). Extended resource names are not permitted as keys.", } func (Device) SwaggerDoc() map[string]string { @@ -231,7 +231,7 @@ var map_DeviceClassSpec = map[string]string{ "": "DeviceClassSpec is used in a [DeviceClass] to define what can be allocated and how to configure it.", "selectors": "Each selector must be satisfied by a device which is claimed via this class.", "config": "Config defines configuration parameters that apply to each device that is claimed via this class. Some classses may potentially be satisfied by multiple drivers, so each instance of a vendor configuration applies to exactly one driver.\n\nThey are passed to the driver, but are not considered while allocating the claim.", - "extendedResourceName": "ExtendedResourceName is the extended resource name for the devices of this class. The devices of this class can be used to satisfy a pod's extended resource requests. It has the same format as the name of a pod's extended resource. It should be unique among all the device classes in a cluster. If two device classes have the same name, then the class created later is picked to satisfy a pod's extended resource requests. If two classes are created at the same time, then the name of the class lexicographically sorted first is picked.\n\nThis is a beta field.", + "extendedResourceName": "ExtendedResourceName is the extended resource name for the devices of this class. The devices of this class can be used to satisfy a pod's extended resource requests. It has the same format as the name of a pod's extended resource. It should be unique among all the device classes in a cluster. If two device classes have the same name, then the class created later is picked to satisfy a pod's extended resource requests. If two classes are created at the same time, then the name of the class lexicographically sorted first is picked.", } func (DeviceClassSpec) SwaggerDoc() map[string]string { @@ -259,15 +259,26 @@ func (DeviceConstraint) SwaggerDoc() map[string]string { } var map_DeviceCounterConsumption = map[string]string{ - "": "DeviceCounterConsumption defines a set of counters that a device will consume from a CounterSet.", - "counterSet": "CounterSet is the name of the set from which the counters defined will be consumed.", - "counters": "Counters defines the counters that will be consumed by the device.\n\nThe maximum number of counters is 32.", + "": "DeviceCounterConsumption defines a set of counters that a device will consume from a CounterSet.", + "counterSet": "CounterSet is the name of the set from which the counters defined will be consumed.", + "counters": "Counters defines the counters that will be consumed by the device.\n\nThe maximum number of counters is 32.", + "compatibilityGroups": "CompatibilityGroups is a list of opaque group names for this counter set consumption.\n\nDevices that consume counters from the same counter set may only be allocated at the same time (\"co-allocated\") if they all share at least one common group: the intersection of the CompatibilityGroups of all co-allocated devices on that counter set must be non-empty. Devices that consume from different counter sets are never compared via this field.\n\nAn unset field, an explicit nil, and an empty list are equivalent and mean \"no groups\": such a device is only co-allocatable with sibling devices on the same counter set that also have no groups, and is never co-allocatable with a device that declares one or more groups.\n\nGroup names are opaque and meaningful only within the publishing driver's pool.\n\nThe maximum number of groups is 2, and the names must be unique.", } func (DeviceCounterConsumption) SwaggerDoc() map[string]string { return map_DeviceCounterConsumption } +var map_DeviceDerivedAttribute = map[string]string{ + "": "DeviceDerivedAttribute defines a derived attribute computed via CEL.", + "name": "Name is the identifier for this derived attribute, used in constraints.\n\nIt must be a DNS subdomain followed by a slash (\"/\") followed by a C identifier (e.g. \"example.com/numaNode\" or \"derived/numaNode\").\n\nIf the chosen name matches an existing physical attribute from a driver, the derived attribute's expression will shadow the physical attribute, and its evaluated value will be used in constraints instead. When the goal is to define a derived attribute that is only used within the ResourceClaim and not meant to shadow an existing attribute, use a domain prefix that no DRA driver should be using (e.g. \"derived/myAttribute\").\n\nIt is not valid to define a derived attribute that isn't used in at least one constraint.", + "expression": "Expression is a CEL expression evaluated against each candidate device. The expression must evaluate to a primitive scalar (string, integer, boolean, or semver) or a list of these scalars ([]string, []int64, []bool, []semver) to act as a virtual grouping key. Any other return type is an error and causes CEL evaluation for the device to fail.\n\nThe expression's input is an object named \"device\", which carries the same properties as in a CELDeviceSelector.\n\nWhen pod scheduling encounters CEL runtime errors (such as looking up an attribute that isn't defined) for some devices, it will abort allocation and fail scheduling for the Pod. Surfacing evaluation errors immediately prevents silent topology matching failures that are extremely hard to detect. A robust expression should, for example, check for the existence of attributes before referencing them to avoid runtime evaluation errors.\n\nThe expression gets evaluated after a device has passed the other selector expressions for the request in which this expression is used. This allows writing expressions that are tailored towards the specific devices being requested (for example, by assuming the device is from a certain vendor and skipping those checks).\n\nThe length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps; the combined cost of all derived attributes in a claim is capped by a shared CEL cost budget.", +} + +func (DeviceDerivedAttribute) SwaggerDoc() map[string]string { + return map_DeviceDerivedAttribute +} + var map_DeviceRequest = map[string]string{ "": "DeviceRequest is a request for devices required for a claim. This is typically a request for a single resource like a device, but can also ask for several identical devices. With FirstAvailable it is also possible to provide a prioritized list of requests.", "name": "Name can be used to reference this request in a pod.spec.containers[].resources.claims entry and in a constraint of the claim.\n\nReferences using the name in the DeviceRequest will uniquely identify a request when the Exactly field is set. When the FirstAvailable field is set, a reference to the name of the DeviceRequest will match whatever subrequest is chosen by the scheduler.\n\nMust be a DNS label.", @@ -291,6 +302,7 @@ var map_DeviceRequestAllocationResult = map[string]string{ "bindingFailureConditions": "BindingFailureConditions contains a copy of the BindingFailureConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", "shareID": "ShareID uniquely identifies an individual allocation share of the device, used when the device supports multiple simultaneous allocations. It serves as an additional map key to differentiate concurrent shares of the same device.", "consumedCapacity": "ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. The consumed amount may differ from the requested amount: it is rounded up to the nearest valid value based on the device’s requestPolicy if applicable (i.e., may not be less than the requested amount).\n\nThe total consumed capacity for each device must not exceed the DeviceCapacity's Value.\n\nThis field is populated only for devices that allow multiple allocations. All capacity entries are included, even if the consumed amount is zero.", + "skipNodeOperations": "SkipNodeOperations lists node-local resource operations (gRPC calls) that will be skipped for this allocated device when determining whether operations are necessary on the node. If all allocated devices for a driver in a claim skip an operation, that gRPC call will be skipped. It is a copy of the ResourceSlice.spec.skipNodeOperations value at the time when the device was allocated.", } func (DeviceRequestAllocationResult) SwaggerDoc() map[string]string { @@ -307,14 +319,15 @@ func (DeviceSelector) SwaggerDoc() map[string]string { } var map_DeviceSubRequest = map[string]string{ - "": "DeviceSubRequest describes a request for device provided in the claim.spec.devices.requests[].firstAvailable array. Each is typically a request for a single resource like a device, but can also ask for several identical devices.\n\nDeviceSubRequest is similar to ExactDeviceRequest, but doesn't expose the AdminAccess field as that one is only supported when requesting a specific device.", - "name": "Name can be used to reference this subrequest in the list of constraints or the list of configurations for the claim. References must use the format
/.\n\nMust be a DNS label.", - "deviceClassName": "DeviceClassName references a specific DeviceClass, which can define additional configuration and selectors to be inherited by this subrequest.\n\nA class is required. Which classes are available depends on the cluster.\n\nAdministrators may use this to restrict which devices may get requested by only installing classes with selectors for permitted devices. If users are free to request anything without restrictions, then administrators can create an empty DeviceClass for users to reference.", - "selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this subrequest. All selectors must be satisfied for a device to be considered.", - "allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this subrequest. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This subrequest is for all of the matching devices in a pool.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other subrequests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.", - "count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.", - "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", - "capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.", + "": "DeviceSubRequest describes a request for device provided in the claim.spec.devices.requests[].firstAvailable array. Each is typically a request for a single resource like a device, but can also ask for several identical devices.\n\nDeviceSubRequest is similar to ExactDeviceRequest, but doesn't expose the AdminAccess field as that one is only supported when requesting a specific device.", + "name": "Name can be used to reference this subrequest in the list of constraints or the list of configurations for the claim. References must use the format
/.\n\nMust be a DNS label.", + "deviceClassName": "DeviceClassName references a specific DeviceClass, which can define additional configuration and selectors to be inherited by this subrequest.\n\nA class is required. Which classes are available depends on the cluster.\n\nAdministrators may use this to restrict which devices may get requested by only installing classes with selectors for permitted devices. If users are free to request anything without restrictions, then administrators can create an empty DeviceClass for users to reference.", + "selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this subrequest. All selectors must be satisfied for a device to be considered.", + "allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this subrequest. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This subrequest is for all of the matching devices in a pool.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other subrequests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.", + "count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.", + "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", + "capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.", + "derivedAttributes": "DerivedAttributes defines a set of virtual attributes computed via CEL expressions for each candidate device. These virtual attributes can be referenced in `.devices.constraints` to align and match different devices (e.g., co-allocating a GPU and a NIC on the same NUMA node) even if their drivers publish different attributes. Derived attributes are not available via `device.attributes` in the CEL environment when evaluating selector expressions.\n\nDerived attributes allow you to extract, transform, or normalize topology information (such as extracting a NUMA index from a complex topology string or renaming a vendor-specific attribute) into a common virtual attribute name at scheduling time. The scheduler then evaluates these virtual attributes exactly like static attributes when matching constraints.\n\nEvery derived attribute defined in this list must be referenced by at least one MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list.\n\nThe maximum number of derived attributes is 32.\n\nThis is an alpha field and requires enabling the DRADerivedAttributes feature gate.", } func (DeviceSubRequest) SwaggerDoc() map[string]string { @@ -398,14 +411,15 @@ func (DeviceToleration) SwaggerDoc() map[string]string { } var map_ExactDeviceRequest = map[string]string{ - "": "ExactDeviceRequest is a request for one or more identical devices.", - "deviceClassName": "DeviceClassName references a specific DeviceClass, which can define additional configuration and selectors to be inherited by this request.\n\nA DeviceClassName is required.\n\nAdministrators may use this to restrict which devices may get requested by only installing classes with selectors for permitted devices. If users are free to request anything without restrictions, then administrators can create an empty DeviceClass for users to reference.", - "selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this request. All selectors must be satisfied for a device to be considered.", - "allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this request. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This request is for all of the matching devices in a pool.\n At least one device must exist on the node for the allocation to succeed.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other requests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.", - "count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.", - "adminAccess": "AdminAccess indicates that this is a claim for administrative access to the device(s). Claims with AdminAccess are expected to be used for monitoring or other management services for a device. They ignore all ordinary claims to the device with respect to access modes and any resource allocations.\n\nThis is an alpha field and requires enabling the DRAAdminAccess feature gate. Admin access is disabled if this field is unset or set to false, otherwise it is enabled.", - "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", - "capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.", + "": "ExactDeviceRequest is a request for one or more identical devices.", + "deviceClassName": "DeviceClassName references a specific DeviceClass, which can define additional configuration and selectors to be inherited by this request.\n\nA DeviceClassName is required.\n\nAdministrators may use this to restrict which devices may get requested by only installing classes with selectors for permitted devices. If users are free to request anything without restrictions, then administrators can create an empty DeviceClass for users to reference.", + "selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this request. All selectors must be satisfied for a device to be considered.", + "allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this request. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This request is for all of the matching devices in a pool.\n At least one device must exist on the node for the allocation to succeed.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other requests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.", + "count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.", + "adminAccess": "AdminAccess indicates that this is a claim for administrative access to the device(s). Claims with AdminAccess are expected to be used for monitoring or other management services for a device. They ignore all ordinary claims to the device with respect to access modes and any resource allocations.\n\nThis is an alpha field and requires enabling the DRAAdminAccess feature gate. Admin access is disabled if this field is unset or set to false, otherwise it is enabled.", + "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", + "capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.", + "derivedAttributes": "DerivedAttributes defines a set of virtual attributes computed via CEL expressions for each candidate device. These virtual attributes can be referenced in `.devices.constraints` to align and match different devices (e.g., co-allocating a GPU and a NIC on the same NUMA node) even if their drivers publish different attributes. Derived attributes are not available via `device.attributes` in the CEL environment when evaluating selector expressions.\n\nDerived attributes allow you to extract, transform, or normalize topology information (such as extracting a NUMA index from a complex topology string or renaming a vendor-specific attribute) into a common virtual attribute name at scheduling time. The scheduler then evaluates these virtual attributes exactly like static attributes when matching constraints.\n\nEvery derived attribute defined in this list must be referenced by at least one MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list.\n\nThe maximum number of derived attributes is 32.\n\nThis is an alpha field and requires enabling the DRADerivedAttributes feature gate.", } func (ExactDeviceRequest) SwaggerDoc() map[string]string { @@ -423,14 +437,35 @@ func (NetworkDeviceData) SwaggerDoc() map[string]string { return map_NetworkDeviceData } -var map_NodeAllocatableResourceMapping = map[string]string{ - "": "NodeAllocatableResourceMapping defines the translation between the DRA device/capacity units requested to the corresponding quantity of the node allocatable resource.", - "capacityKey": "CapacityKey references a capacity name defined as a key in the `spec.devices[*].capacity` map. When this field is set, the value associated with this key in the `status.allocation.devices.results[*].consumedCapacity` map (for a specific claim allocation) determines the base quantity for the node allocatable resource. If `allocationMultiplier` is also set, it is multiplied with the base quantity. For example, if `spec.devices[*].capacity` has an entry \"dra.example.com/memory\": \"128Gi\", and this field is set to \"dra.example.com/memory\", then for a claim allocation that consumes { \"dra.example.com/memory\": \"4Gi\" } the base quantity for the node allocatable resource mapping will be \"4Gi\", and `allocationMultiplier` should be omitted or set to \"1\".", - "allocationMultiplier": "AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim.\n\t a. A DRA driver representing each CPU core as a device would have\n {ResourceName: \"cpu\", allocationMultiplier: \"2\"} in its\n `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim,\n\t\t 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity.\n b. A GPU device that needs additional node memory per GPU allocation would\n have {ResourceName: \"memory\", allocationMultiplier: \"2Gi\"}. Each allocated\n\t\t GPU device instance of this type will account for 2Gi of memory.\n\n2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed.\n\t The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`.\n For example, if a Device's capacity \"dra.example.com/cores\" is consumed,\n and each \"core\" provides 2 \"cpu\"s, the mapping would be:\n {ResourceName: \"cpu\", capacityKey: \"dra.example.com/cores\", allocationMultiplier: \"2\"}.\n If a claim consumes 8 \"dra.example.com/cores\", the CPU footprint is 8 * 2 = 16.", +var map_NodeAllocatableMapping = map[string]string{ + "": "NodeAllocatableMapping defines how a DRA allocation directly translates into a node allocatable resource quantity. The mapping can be derived from either the count of allocated devices (via deviceMultiplier) or the specific capacity consumed (via capacityKey and capacityMultiplier). These options are mutually exclusive. Kubelet adds this mapped resource quantity from claim to both requests and limits at the pod-level cgroup, and to limits at the container-level cgroup for each container referencing the claim.", + "capacityKey": "CapacityKey references a capacity name defined as a key in the `spec.devices[*].capacity` map. When this field is set, the value associated with this key in the `status.allocation.devices.results[*].consumedCapacity` map (for a specific claim allocation) determines the base quantity for the node allocatable resource. `capacityMultiplier` must also be set and is multiplied with the base quantity. For example, if `spec.devices[*].capacity` has an entry \"dra.example.com/memory\": \"128Gi\", and this field is set to \"dra.example.com/memory\", then for a claim allocation that consumes { \"dra.example.com/memory\": \"4Gi\" } the base quantity for the node allocatable resource mapping will be \"4Gi\". The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`.", + "capacityMultiplier": "CapacityMultiplier is used as a multiplier for the allocated capacity consumed. It is only valid if `capacityKey` is set. The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. For example, if a Device's capacity \"dra.example.com/cores\" is consumed, and each \"core\" provides 2 \"cpu\"s, the mapping would be: {ResourceName: \"cpu\", capacityKey: \"dra.example.com/cores\", capacityMultiplier: \"2\"}. If a claim consumes 8 \"dra.example.com/cores\", the CPU footprint is 8 * 2 = 16.", + "deviceMultiplier": "DeviceMultiplier is used as a multiplier for the allocated device count in the claim. The final node allocatable resource amount is `deviceCount` * `deviceMultiplier`. For example, a DRA driver representing each cache complex (CCX) as a device would have {ResourceName: \"cpu\", deviceMultiplier: \"8\"} in its `nodeAllocatableResources`. If 2 devices (CCX) are allocated to the claim, 2 * 8 = 16 CPUs would be considered as allocated. It is only valid when `capacityKey` and `capacityMultiplier` are not set.", +} + +func (NodeAllocatableMapping) SwaggerDoc() map[string]string { + return map_NodeAllocatableMapping +} + +var map_NodeAllocatableOverhead = map[string]string{ + "": "NodeAllocatableOverhead defines auxiliary resource overheads incurred when allocating a device. Overheads can be specified as a fixed cost per pod referencing the claim, a variable cost per container reference, or both. Kubelet accounts for this overhead by adding it to both the pod-level and container-level cgroups of referencing containers.", + "perPod": "PerPod is overhead applied once per pod referencing the claim on this node. This is a flat overhead incurred for every pod referencing the claim.", + "perContainer": "PerContainer is applied per container reference to the claim. This models overhead scaling linearly with the number of containers actively using the device. When both PerPod and PerContainer are specified, the total overhead allocated for each pod referencing the claim is computed as: Quantity = PerPod + (PerContainer * NumReferences) Kubelet accounts for this overhead in cgroups: - Pod-level cgroup (requests and limits): Kubelet adds PerPod + (PerContainer * NumReferences). - Container-level cgroup (limits only): Kubelet adds PerPod + PerContainer for each referencing container. This allows any single container to access the pod-level overhead, while the parent cgroup caps the total usage to account for PerPod exactly once.", +} + +func (NodeAllocatableOverhead) SwaggerDoc() map[string]string { + return map_NodeAllocatableOverhead +} + +var map_NodeAllocatableResource = map[string]string{ + "": "NodeAllocatableResource defines the translation between the DRA device/capacity units requested to the corresponding quantity of the node allocatable resource. At least one of Mapping or Overhead must be specified. Not specifying either is an invalid configuration.", + "mapping": "Mapping is used when the device directly models a node allocatable resource like standard CPU or memory (e.g., with a CPU DRA driver). The calculated quantity is accounted for exactly once per claim instance on the node. To prevent node cgroup isolation friction, the scheduler explicitly blocks sharing mapped device claims across multiple pods.", + "overhead": "Overhead contains fields for modeling auxiliary overhead incurred on node allocatable resources when allocating devices that are not themselves modeling a node allocatable resource (e.g., host memory overhead for GPUs). Sharing overhead-mapped claims across multiple pods is allowed. The node allocatable overhead is accounted for individually for each pod referencing the claim. Overhead is always subtracted from the node's allocatable capacity for the resource, even when mapping is specified for the same resource. Eg: If a device models memory capacity per socket as a consumable capacity pool via Mapping (with CapacityKey), any overhead specified for the same resource will be subtracted from the node's general allocatable capacity and not from the per-socket capacity pool in Mapping.", } -func (NodeAllocatableResourceMapping) SwaggerDoc() map[string]string { - return map_NodeAllocatableResourceMapping +func (NodeAllocatableResource) SwaggerDoc() map[string]string { + return map_NodeAllocatableResource } var map_OpaqueDeviceConfiguration = map[string]string{ @@ -528,7 +563,7 @@ func (ResourceClaimTemplateSpec) SwaggerDoc() map[string]string { var map_ResourcePool = map[string]string{ "": "ResourcePool describes the pool that ResourceSlices belong to.", - "name": "Name is used to identify the pool. For node-local devices, this is often the node name, but this is not required.\n\nIt must not be longer than 253 characters and must consist of one or more DNS sub-domains separated by slashes. This field is immutable.", + "name": "Name is used to identify the pool. For node-local devices, this is often the node name, but this is not required. A field selector can be used to list only ResourceSlice objects belonging to a certain pool.\n\nIt must not be longer than 253 characters and must consist of one or more DNS sub-domains separated by slashes. This field is immutable.", "generation": "Generation tracks the change in a pool over time. Whenever a driver changes something about one or more of the resources in a pool, it must change the generation in all ResourceSlices which are part of that pool. Consumers of ResourceSlices should only consider resources from the pool with the highest generation number. The generation may be reset by drivers, which should be fine for consumers, assuming that all ResourceSlices in a pool are updated to match or deleted.\n\nCombined with ResourceSliceCount, this mechanism enables consumers to detect pools which are comprised of multiple ResourceSlices and are in an incomplete state.", "resourceSliceCount": "ResourceSliceCount is the total number of ResourceSlices in the pool at this generation number. Must be greater than zero.\n\nConsumers can use this to check whether they have seen all ResourceSlices belonging to the same pool.", } @@ -567,6 +602,8 @@ var map_ResourceSliceSpec = map[string]string{ "devices": "Devices lists some or all of the devices in this pool.\n\nMust not have more than 128 entries. If any device uses taints or consumes counters the limit is 64.\n\nOnly one of Devices and SharedCounters can be set in a ResourceSlice.", "perDeviceNodeSelection": "PerDeviceNodeSelection defines whether the access from nodes to resources in the pool is set on the ResourceSlice level or on each device. If it is set to true, every device defined the ResourceSlice must specify this individually.\n\nExactly one of NodeName, NodeSelector, AllNodes, and PerDeviceNodeSelection must be set.", "sharedCounters": "SharedCounters defines a list of counter sets, each of which has a name and a list of counters available.\n\nThe names of the counter sets must be unique in the ResourcePool.\n\nOnly one of Devices and SharedCounters can be set in a ResourceSlice.\n\nThe maximum number of counter sets is 8.", + "partitionTypeAttribute": "PartitionTypeAttribute names a string device attribute (by fully qualified name, e.g. \"gpu.example.com/profile\") whose value labels each device with its partition type, such as \"Full\" or \"Half\" for a MIG-style GPU.\n\nWhen set, every partitionable device in the slice must carry the attribute and devices sharing a value must share the same ConsumesCounters cost.", + "skipNodeOperations": "SkipNodeOperations lists node-local resource operations (gRPC calls) that will be skipped for the devices in this slice when determining whether operations are necessary on the node. If all allocated devices for a driver in a claim skip an operation, that gRPC call will be skipped. Valid values are:\n\n- \"NodePrepareResources\": NodePrepareResources gRPC calls are skipped. This\n value cannot be specified unless \"NodeUnprepareResources\" is also listed\n (or \"*\" is specified).\n- \"NodeUnprepareResources\": NodeUnprepareResources gRPC calls are skipped. - \"*\": All node-local resource operations are skipped.\n\nOther values may be added in the future. The kubelet must ignore unknown values.", } func (ResourceSliceSpec) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/resource/v1beta2/zz_generated.deepcopy.go b/vendor/k8s.io/api/resource/v1beta2/zz_generated.deepcopy.go index 820ad2af61..5e87f13ca1 100644 --- a/vendor/k8s.io/api/resource/v1beta2/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/resource/v1beta2/zz_generated.deepcopy.go @@ -302,9 +302,9 @@ func (in *Device) DeepCopyInto(out *Device) { *out = new(bool) **out = **in } - if in.NodeAllocatableResourceMappings != nil { - in, out := &in.NodeAllocatableResourceMappings, &out.NodeAllocatableResourceMappings - *out = make(map[corev1.ResourceName]NodeAllocatableResourceMapping, len(*in)) + if in.NodeAllocatableResources != nil { + in, out := &in.NodeAllocatableResources, &out.NodeAllocatableResources + *out = make(map[corev1.ResourceName]NodeAllocatableResource, len(*in)) for key, val := range *in { (*out)[key] = *val.DeepCopy() } @@ -685,6 +685,11 @@ func (in *DeviceCounterConsumption) DeepCopyInto(out *DeviceCounterConsumption) (*out)[key] = *val.DeepCopy() } } + if in.CompatibilityGroups != nil { + in, out := &in.CompatibilityGroups, &out.CompatibilityGroups + *out = make([]string, len(*in)) + copy(*out, *in) + } return } @@ -698,6 +703,22 @@ func (in *DeviceCounterConsumption) DeepCopy() *DeviceCounterConsumption { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceDerivedAttribute) DeepCopyInto(out *DeviceDerivedAttribute) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceDerivedAttribute. +func (in *DeviceDerivedAttribute) DeepCopy() *DeviceDerivedAttribute { + if in == nil { + return nil + } + out := new(DeviceDerivedAttribute) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DeviceRequest) DeepCopyInto(out *DeviceRequest) { *out = *in @@ -763,6 +784,11 @@ func (in *DeviceRequestAllocationResult) DeepCopyInto(out *DeviceRequestAllocati (*out)[key] = val.DeepCopy() } } + if in.SkipNodeOperations != nil { + in, out := &in.SkipNodeOperations, &out.SkipNodeOperations + *out = make([]SkipNodeOperation, len(*in)) + copy(*out, *in) + } return } @@ -819,6 +845,11 @@ func (in *DeviceSubRequest) DeepCopyInto(out *DeviceSubRequest) { *out = new(CapacityRequirements) (*in).DeepCopyInto(*out) } + if in.DerivedAttributes != nil { + in, out := &in.DerivedAttributes, &out.DerivedAttributes + *out = make([]DeviceDerivedAttribute, len(*in)) + copy(*out, *in) + } return } @@ -1037,6 +1068,11 @@ func (in *ExactDeviceRequest) DeepCopyInto(out *ExactDeviceRequest) { *out = new(CapacityRequirements) (*in).DeepCopyInto(*out) } + if in.DerivedAttributes != nil { + in, out := &in.DerivedAttributes, &out.DerivedAttributes + *out = make([]DeviceDerivedAttribute, len(*in)) + copy(*out, *in) + } return } @@ -1072,27 +1108,84 @@ func (in *NetworkDeviceData) DeepCopy() *NetworkDeviceData { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeAllocatableResourceMapping) DeepCopyInto(out *NodeAllocatableResourceMapping) { +func (in *NodeAllocatableMapping) DeepCopyInto(out *NodeAllocatableMapping) { *out = *in if in.CapacityKey != nil { in, out := &in.CapacityKey, &out.CapacityKey *out = new(QualifiedName) **out = **in } - if in.AllocationMultiplier != nil { - in, out := &in.AllocationMultiplier, &out.AllocationMultiplier + if in.CapacityMultiplier != nil { + in, out := &in.CapacityMultiplier, &out.CapacityMultiplier + x := (*in).DeepCopy() + *out = &x + } + if in.DeviceMultiplier != nil { + in, out := &in.DeviceMultiplier, &out.DeviceMultiplier x := (*in).DeepCopy() *out = &x } return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableResourceMapping. -func (in *NodeAllocatableResourceMapping) DeepCopy() *NodeAllocatableResourceMapping { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableMapping. +func (in *NodeAllocatableMapping) DeepCopy() *NodeAllocatableMapping { if in == nil { return nil } - out := new(NodeAllocatableResourceMapping) + out := new(NodeAllocatableMapping) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeAllocatableOverhead) DeepCopyInto(out *NodeAllocatableOverhead) { + *out = *in + if in.PerPod != nil { + in, out := &in.PerPod, &out.PerPod + x := (*in).DeepCopy() + *out = &x + } + if in.PerContainer != nil { + in, out := &in.PerContainer, &out.PerContainer + x := (*in).DeepCopy() + *out = &x + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableOverhead. +func (in *NodeAllocatableOverhead) DeepCopy() *NodeAllocatableOverhead { + if in == nil { + return nil + } + out := new(NodeAllocatableOverhead) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeAllocatableResource) DeepCopyInto(out *NodeAllocatableResource) { + *out = *in + if in.Mapping != nil { + in, out := &in.Mapping, &out.Mapping + *out = new(NodeAllocatableMapping) + (*in).DeepCopyInto(*out) + } + if in.Overhead != nil { + in, out := &in.Overhead, &out.Overhead + *out = new(NodeAllocatableOverhead) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableResource. +func (in *NodeAllocatableResource) DeepCopy() *NodeAllocatableResource { + if in == nil { + return nil + } + out := new(NodeAllocatableResource) in.DeepCopyInto(out) return out } @@ -1433,6 +1526,16 @@ func (in *ResourceSliceSpec) DeepCopyInto(out *ResourceSliceSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.PartitionTypeAttribute != nil { + in, out := &in.PartitionTypeAttribute, &out.PartitionTypeAttribute + *out = new(FullyQualifiedName) + **out = **in + } + if in.SkipNodeOperations != nil { + in, out := &in.SkipNodeOperations, &out.SkipNodeOperations + *out = make([]SkipNodeOperation, len(*in)) + copy(*out, *in) + } return } diff --git a/vendor/k8s.io/api/resource/v1beta2/zz_generated.model_name.go b/vendor/k8s.io/api/resource/v1beta2/zz_generated.model_name.go index ce388ffd2e..7135589ce4 100644 --- a/vendor/k8s.io/api/resource/v1beta2/zz_generated.model_name.go +++ b/vendor/k8s.io/api/resource/v1beta2/zz_generated.model_name.go @@ -131,6 +131,11 @@ func (in DeviceCounterConsumption) OpenAPIModelName() string { return "io.k8s.api.resource.v1beta2.DeviceCounterConsumption" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in DeviceDerivedAttribute) OpenAPIModelName() string { + return "io.k8s.api.resource.v1beta2.DeviceDerivedAttribute" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in DeviceRequest) OpenAPIModelName() string { return "io.k8s.api.resource.v1beta2.DeviceRequest" @@ -197,8 +202,18 @@ func (in NetworkDeviceData) OpenAPIModelName() string { } // OpenAPIModelName returns the OpenAPI model name for this type. -func (in NodeAllocatableResourceMapping) OpenAPIModelName() string { - return "io.k8s.api.resource.v1beta2.NodeAllocatableResourceMapping" +func (in NodeAllocatableMapping) OpenAPIModelName() string { + return "io.k8s.api.resource.v1beta2.NodeAllocatableMapping" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in NodeAllocatableOverhead) OpenAPIModelName() string { + return "io.k8s.api.resource.v1beta2.NodeAllocatableOverhead" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in NodeAllocatableResource) OpenAPIModelName() string { + return "io.k8s.api.resource.v1beta2.NodeAllocatableResource" } // OpenAPIModelName returns the OpenAPI model name for this type. diff --git a/vendor/k8s.io/api/scheduling/v1/generated.proto b/vendor/k8s.io/api/scheduling/v1/generated.proto index 6be7204de1..20eb5907d4 100644 --- a/vendor/k8s.io/api/scheduling/v1/generated.proto +++ b/vendor/k8s.io/api/scheduling/v1/generated.proto @@ -32,7 +32,7 @@ option go_package = "k8s.io/api/scheduling/v1"; // PriorityClass defines mapping from a priority class name to the priority // integer value. The value can be any valid integer. message PriorityClass { - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; diff --git a/vendor/k8s.io/api/scheduling/v1/types.go b/vendor/k8s.io/api/scheduling/v1/types.go index 655b5eb159..f1f259fee0 100644 --- a/vendor/k8s.io/api/scheduling/v1/types.go +++ b/vendor/k8s.io/api/scheduling/v1/types.go @@ -29,8 +29,8 @@ import ( // PriorityClass defines mapping from a priority class name to the priority // integer value. The value can be any valid integer. type PriorityClass struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -65,7 +65,7 @@ type PriorityClass struct { // PriorityClassList is a collection of priority classes. type PriorityClassList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional diff --git a/vendor/k8s.io/api/scheduling/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/scheduling/v1/types_swagger_doc_generated.go index f167e19707..8913d60025 100644 --- a/vendor/k8s.io/api/scheduling/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/scheduling/v1/types_swagger_doc_generated.go @@ -29,7 +29,7 @@ package v1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_PriorityClass = map[string]string{ "": "PriorityClass defines mapping from a priority class name to the priority integer value. The value can be any valid integer.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "value": "value represents the integer value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.", "globalDefault": "globalDefault specifies whether this PriorityClass should be considered as the default priority for pods that do not have any priority class. Only one PriorityClass can be marked as `globalDefault`. However, if more than one PriorityClasses exists with their `globalDefault` field set to true, the smallest value of such global default PriorityClasses will be used as the default priority.", "description": "description is an arbitrary string that usually provides guidelines on when this priority class should be used.", diff --git a/vendor/k8s.io/api/scheduling/v1alpha2/generated.proto b/vendor/k8s.io/api/scheduling/v1alpha2/generated.proto deleted file mode 100644 index 73b3308e38..0000000000 --- a/vendor/k8s.io/api/scheduling/v1alpha2/generated.proto +++ /dev/null @@ -1,550 +0,0 @@ -/* -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. -*/ - - -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package k8s.io.api.scheduling.v1alpha2; - -import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "k8s.io/api/scheduling/v1alpha2"; - -// BasicSchedulingPolicy indicates that standard Kubernetes -// scheduling behavior should be used. -message BasicSchedulingPolicy { -} - -// GangSchedulingPolicy defines the parameters for gang scheduling. -message GangSchedulingPolicy { - // MinCount is the minimum number of pods that must be schedulable or scheduled - // at the same time for the scheduler to admit the entire group. - // It must be a positive integer. - // - // +required - // +k8s:required - // +k8s:minimum=1 - optional int32 minCount = 1; -} - -// PodGroup represents a runtime instance of pods grouped together. -// PodGroups are created by workload controllers (Job, LWS, JobSet, etc...) from -// Workload.podGroupTemplates. -// PodGroup API enablement is toggled by the GenericWorkload feature gate. -message PodGroup { - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - // Spec defines the desired state of the PodGroup. - // - // +required - optional PodGroupSpec spec = 2; - - // Status represents the current observed state of the PodGroup. - // - // +optional - optional PodGroupStatus status = 3; -} - -// PodGroupList contains a list of PodGroup resources. -message PodGroupList { - // Standard list metadata. - // - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - // Items is the list of PodGroups. - repeated PodGroup items = 2; -} - -// PodGroupResourceClaim references exactly one ResourceClaim, either directly -// or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim -// for the PodGroup. -// -// It adds a name to it that uniquely identifies the ResourceClaim inside the PodGroup. -// Pods that need access to the ResourceClaim define a matching reference in its -// own Spec.ResourceClaims. The Pod's claim must match all fields of the -// PodGroup's claim exactly. -message PodGroupResourceClaim { - // Name uniquely identifies this resource claim inside the PodGroup. - // This must be a DNS_LABEL. - // - // +required - // +k8s:required - // +k8s:format=k8s-short-name - optional string name = 1; - - // ResourceClaimName is the name of a ResourceClaim object in the same - // namespace as this PodGroup. The ResourceClaim will be reserved for the - // PodGroup instead of its individual pods. - // - // Exactly one of ResourceClaimName and ResourceClaimTemplateName must - // be set. - // - // +optional - // +k8s:optional - // +k8s:unionMember - // +k8s:format=k8s-long-name - optional string resourceClaimName = 2; - - // ResourceClaimTemplateName is the name of a ResourceClaimTemplate - // object in the same namespace as this PodGroup. - // - // The template will be used to create a new ResourceClaim, which will - // be bound to this PodGroup. When this PodGroup is deleted, the ResourceClaim - // will also be deleted. The PodGroup name and resource name, along with a - // generated component, will be used to form a unique name for the - // ResourceClaim, which will be recorded in podgroup.status.resourceClaimStatuses. - // - // This field is immutable and no changes will be made to the - // corresponding ResourceClaim by the control plane after creating the - // ResourceClaim. - // - // Exactly one of ResourceClaimName and ResourceClaimTemplateName must - // be set. - // - // +optional - // +k8s:optional - // +k8s:unionMember - // +k8s:format=k8s-long-name - optional string resourceClaimTemplateName = 3; -} - -// PodGroupResourceClaimStatus is stored in the PodGroupStatus for each -// PodGroupResourceClaim which references a ResourceClaimTemplate. It stores the -// generated name for the corresponding ResourceClaim. -message PodGroupResourceClaimStatus { - // Name uniquely identifies this resource claim inside the PodGroup. This - // must match the name of an entry in podgroup.spec.resourceClaims, which - // implies that the string must be a DNS_LABEL. - // - // +required - optional string name = 1; - - // ResourceClaimName is the name of the ResourceClaim that was generated for - // the PodGroup in the namespace of the PodGroup. If this is unset, then - // generating a ResourceClaim was not necessary. The - // podgroup.spec.resourceClaims entry can be ignored in this case. - // - // +optional - // +k8s:optional - // +k8s:format=k8s-long-name - optional string resourceClaimName = 2; -} - -// PodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a PodGroup. -message PodGroupSchedulingConstraints { - // Topology defines the topology constraints for the pod group. - // Currently only a single topology constraint can be specified. This may change in the future. - // - // +optional - // +k8s:optional - // +k8s:maxItems=1 - // +listType=atomic - // +k8s:listType=atomic - repeated TopologyConstraint topology = 1; -} - -// PodGroupSchedulingPolicy defines the scheduling configuration for a PodGroup. -// Exactly one policy must be set. -// +union -message PodGroupSchedulingPolicy { - // Basic specifies that the pods in this group should be scheduled using - // standard Kubernetes scheduling behavior. - // - // +optional - // +k8s:optional - // +k8s:unionMember - optional BasicSchedulingPolicy basic = 1; - - // Gang specifies that the pods in this group should be scheduled using - // all-or-nothing semantics. - // - // +optional - // +k8s:optional - // +k8s:unionMember - optional GangSchedulingPolicy gang = 2; -} - -// PodGroupSpec defines the desired state of a PodGroup. -message PodGroupSpec { - // PodGroupTemplateRef references an optional PodGroup template within other object - // (e.g. Workload) that was used to create the PodGroup. This field is immutable. - // - // +optional - // +k8s:optional - // +k8s:immutable - optional PodGroupTemplateReference podGroupTemplateRef = 1; - - // SchedulingPolicy defines the scheduling policy for this instance of the PodGroup. - // Controllers are expected to fill this field by copying it from a PodGroupTemplate. - // This field is immutable. - // - // +required - // +k8s:immutable - optional PodGroupSchedulingPolicy schedulingPolicy = 2; - - // SchedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroup. - // Controllers are expected to fill this field by copying it from a PodGroupTemplate. - // This field is immutable. - // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. - // - // +featureGate=TopologyAwareWorkloadScheduling - // +optional - // +k8s:ifDisabled(TopologyAwareWorkloadScheduling)=+k8s:forbidden - // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:optional - // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:immutable - optional PodGroupSchedulingConstraints schedulingConstraints = 3; - - // ResourceClaims defines which ResourceClaims may be shared among Pods in - // the group. Pods consume the devices allocated to a PodGroup's claim by - // defining a claim in its own Spec.ResourceClaims that matches the - // PodGroup's claim exactly. The claim must have the same name and refer to - // the same ResourceClaim or ResourceClaimTemplate. - // - // This is an alpha-level field and requires that the - // DRAWorkloadResourceClaims feature gate is enabled. - // - // This field is immutable. - // - // +optional - // +patchMergeKey=name - // +patchStrategy=merge,retainKeys - // +listType=map - // +listMapKey=name - // +k8s:optional - // +k8s:listType=map - // +k8s:listMapKey=name - // +k8s:maxItems=4 - // +k8s:immutable - // +featureGate=DRAWorkloadResourceClaims - repeated PodGroupResourceClaim resourceClaims = 4; - - // DisruptionMode defines the mode in which a given PodGroup can be disrupted. - // Controllers are expected to fill this field by copying it from a PodGroupTemplate. - // One of Pod, PodGroup. Defaults to Pod if unset. - // This field is immutable. - // This field is available only when the WorkloadAwarePreemption feature gate - // is enabled. - // - // +featureGate=WorkloadAwarePreemption - // +optional - // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:immutable - // +default="Pod" - optional string disruptionMode = 5; - - // PriorityClassName defines the priority that should be considered when scheduling this pod group. - // Controllers are expected to fill this field by copying it from a PodGroupTemplate. - // Otherwise, it is validated and resolved similarly to the PriorityClassName on PodGroupTemplate - // (i.e. if no priority class is specified, admission control can set this to the global default - // priority class if it exists. Otherwise, the pod group's priority will be zero). - // This field is immutable. - // This field is available only when the WorkloadAwarePreemption feature gate - // is enabled. - // - // +featureGate=WorkloadAwarePreemption - // +optional - // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:format=k8s-long-name - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:immutable - optional string priorityClassName = 6; - - // Priority is the value of priority of this pod group. Various system components - // use this field to find the priority of the pod group. When Priority Admission - // Controller is enabled, it prevents users from setting this field. The admission - // controller populates this field from PriorityClassName. - // The higher the value, the higher the priority. - // This field is immutable. - // This field is available only when the WorkloadAwarePreemption feature gate - // is enabled. - // - // +featureGate=WorkloadAwarePreemption - // +optional - // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:immutable - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:maximum=1000000000 # HighestUserDefinablePriority - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:minimum=-2147483648 - optional int32 priority = 7; -} - -// PodGroupStatus represents information about the status of a pod group. -message PodGroupStatus { - // Conditions represent the latest observations of the PodGroup's state. - // - // Known condition types: - // - "PodGroupScheduled": Indicates whether the scheduling requirement has been satisfied. - // - "DisruptionTarget": Indicates whether the PodGroup is about to be terminated - // due to disruption such as preemption. - // - // Known reasons for the PodGroupScheduled condition: - // - "Unschedulable": The PodGroup cannot be scheduled due to resource constraints, - // affinity/anti-affinity rules, or insufficient capacity for the gang. - // - "SchedulerError": The PodGroup cannot be scheduled due to some internal error - // that happened during scheduling, for example due to nodeAffinity parsing errors. - // - // Known reasons for the DisruptionTarget condition: - // - "PreemptionByScheduler": The PodGroup was preempted by the scheduler to make room for - // higher-priority PodGroups or Pods. - // - // +optional - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1; - - // Status of resource claims. - // +optional - // +patchMergeKey=name - // +patchStrategy=merge,retainKeys - // +listType=map - // +listMapKey=name - // +k8s:optional - // +k8s:listType=map - // +k8s:listMapKey=name - // +k8s:maxItems=4 - // +featureGate=DRAWorkloadResourceClaims - repeated PodGroupResourceClaimStatus resourceClaimStatuses = 2; -} - -// PodGroupTemplate represents a template for a set of pods with a scheduling policy. -message PodGroupTemplate { - // Name is a unique identifier for the PodGroupTemplate within the Workload. - // It must be a DNS label. This field is immutable. - // - // +required - // +k8s:required - // +k8s:format=k8s-short-name - optional string name = 1; - - // SchedulingPolicy defines the scheduling policy for this PodGroupTemplate. - // - // +required - optional PodGroupSchedulingPolicy schedulingPolicy = 2; - - // SchedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroupTemplate. - // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. - // - // +featureGate=TopologyAwareWorkloadScheduling - // +optional - // +k8s:ifDisabled(TopologyAwareWorkloadScheduling)=+k8s:forbidden - // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:optional - optional PodGroupSchedulingConstraints schedulingConstraints = 3; - - // ResourceClaims defines which ResourceClaims may be shared among Pods in - // the group. Pods consume the devices allocated to a PodGroup's claim by - // defining a claim in its own Spec.ResourceClaims that matches the - // PodGroup's claim exactly. The claim must have the same name and refer to - // the same ResourceClaim or ResourceClaimTemplate. - // - // This is an alpha-level field and requires that the - // DRAWorkloadResourceClaims feature gate is enabled. - // - // This field is immutable. - // - // +optional - // +patchMergeKey=name - // +patchStrategy=merge,retainKeys - // +listType=map - // +listMapKey=name - // +k8s:optional - // +k8s:listType=map - // +k8s:listMapKey=name - // +k8s:maxItems=4 - // +k8s:immutable - // +featureGate=DRAWorkloadResourceClaims - repeated PodGroupResourceClaim resourceClaims = 4; - - // DisruptionMode defines the mode in which a given PodGroup can be disrupted. - // One of Pod, PodGroup. - // This field is available only when the WorkloadAwarePreemption feature gate - // is enabled. - // - // +featureGate=WorkloadAwarePreemption - // +optional - // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional - optional string disruptionMode = 5; - - // PriorityClassName indicates the priority that should be considered when scheduling - // a pod group created from this template. If no priority class is specified, admission - // control can set this to the global default priority class if it exists. Otherwise, - // pod groups created from this template will have the priority set to zero. - // This field is available only when the WorkloadAwarePreemption feature gate - // is enabled. - // - // +featureGate=WorkloadAwarePreemption - // +optional - // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:format=k8s-long-name - optional string priorityClassName = 6; - - // Priority is the value of priority of pod groups created from this template. Various - // system components use this field to find the priority of the pod group. When - // Priority Admission Controller is enabled, it prevents users from setting this field. - // The admission controller populates this field from PriorityClassName. - // The higher the value, the higher the priority. - // This field is available only when the WorkloadAwarePreemption feature gate - // is enabled. - // - // +featureGate=WorkloadAwarePreemption - // +optional - // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:maximum=1000000000 # HighestUserDefinablePriority - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:minimum=-2147483648 - optional int32 priority = 7; -} - -// PodGroupTemplateReference references a PodGroup template defined in some object (e.g. Workload). -// Exactly one reference must be set. -// +union -message PodGroupTemplateReference { - // Workload references the PodGroupTemplate within the Workload object that was used to create - // the PodGroup. - // - // +optional - // +k8s:optional - // +k8s:unionMember - optional WorkloadPodGroupTemplateReference workload = 1; -} - -// TopologyConstraint defines a topology constraint for a PodGroup. -message TopologyConstraint { - // Key specifies the key of the node label representing the topology domain. - // All pods within the PodGroup must be colocated within the same domain instance. - // Different PodGroups can land on different domain instances even if they derive from the same PodGroupTemplate. - // Examples: "topology.kubernetes.io/rack" - // - // +required - // +k8s:required - // +k8s:format=k8s-label-key - optional string key = 1; -} - -// TypedLocalObjectReference allows to reference typed object inside the same namespace. -message TypedLocalObjectReference { - // APIGroup is the group for the resource being referenced. - // If APIGroup is empty, the specified Kind must be in the core API group. - // For any other third-party types, setting APIGroup is required. - // It must be a DNS subdomain. - // - // +optional - // +k8s:optional - // +k8s:format=k8s-long-name - optional string apiGroup = 1; - - // Kind is the type of resource being referenced. - // It must be a path segment name. - // - // +required - // +k8s:required - // +k8s:format=k8s-path-segment-name - optional string kind = 2; - - // Name is the name of resource being referenced. - // It must be a path segment name. - // - // +required - // +k8s:required - // +k8s:format=k8s-path-segment-name - optional string name = 3; -} - -// Workload allows for expressing scheduling constraints that should be used -// when managing the lifecycle of workloads from the scheduling perspective, -// including scheduling, preemption, eviction and other phases. -// Workload API enablement is toggled by the GenericWorkload feature gate. -message Workload { - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - // Spec defines the desired behavior of a Workload. - // - // +required - optional WorkloadSpec spec = 2; -} - -// WorkloadList contains a list of Workload resources. -message WorkloadList { - // Standard list metadata. - // - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - // Items is the list of Workloads. - repeated Workload items = 2; -} - -// WorkloadPodGroupTemplateReference references the PodGroupTemplate within the Workload object. -message WorkloadPodGroupTemplateReference { - // WorkloadName defines the name of the Workload object. - // - // +required - // +k8s:required - // +k8s:format=k8s-long-name - optional string workloadName = 1; - - // PodGroupTemplateName defines the PodGroupTemplate name within the Workload object. - // - // +required - // +k8s:required - // +k8s:format=k8s-short-name - optional string podGroupTemplateName = 2; -} - -// WorkloadSpec defines the desired state of a Workload. -message WorkloadSpec { - // ControllerRef is an optional reference to the controlling object, such as a - // Deployment or Job. This field is intended for use by tools like CLIs - // to provide a link back to the original workload definition. - // This field is immutable. - // - // +optional - // +k8s:optional - // +k8s:immutable - optional TypedLocalObjectReference controllerRef = 1; - - // PodGroupTemplates is the list of templates that make up the Workload. - // The maximum number of templates is 8. This field is immutable. - // - // +required - // +listType=map - // +listMapKey=name - // +k8s:required - // +k8s:listType=map - // +k8s:listMapKey=name - // +k8s:maxItems=8 - // +k8s:immutable - repeated PodGroupTemplate podGroupTemplates = 2; -} - diff --git a/vendor/k8s.io/api/scheduling/v1alpha2/types.go b/vendor/k8s.io/api/scheduling/v1alpha2/types.go deleted file mode 100644 index 1f84f2c43d..0000000000 --- a/vendor/k8s.io/api/scheduling/v1alpha2/types.go +++ /dev/null @@ -1,601 +0,0 @@ -/* -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. -*/ - -package v1alpha2 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// Workload allows for expressing scheduling constraints that should be used -// when managing the lifecycle of workloads from the scheduling perspective, -// including scheduling, preemption, eviction and other phases. -// Workload API enablement is toggled by the GenericWorkload feature gate. -type Workload struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Spec defines the desired behavior of a Workload. - // - // +required - Spec WorkloadSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// WorkloadList contains a list of Workload resources. -type WorkloadList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata. - // - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Items is the list of Workloads. - Items []Workload `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// WorkloadMaxPodGroupTemplates is the maximum number of pod group templates per Workload. -const WorkloadMaxPodGroupTemplates = 8 - -// WorkloadSpec defines the desired state of a Workload. -type WorkloadSpec struct { - // ControllerRef is an optional reference to the controlling object, such as a - // Deployment or Job. This field is intended for use by tools like CLIs - // to provide a link back to the original workload definition. - // This field is immutable. - // - // +optional - // +k8s:optional - // +k8s:immutable - ControllerRef *TypedLocalObjectReference `json:"controllerRef,omitempty" protobuf:"bytes,1,opt,name=controllerRef"` - - // PodGroupTemplates is the list of templates that make up the Workload. - // The maximum number of templates is 8. This field is immutable. - // - // +required - // +listType=map - // +listMapKey=name - // +k8s:required - // +k8s:listType=map - // +k8s:listMapKey=name - // +k8s:maxItems=8 - // +k8s:immutable - PodGroupTemplates []PodGroupTemplate `json:"podGroupTemplates" protobuf:"bytes,2,rep,name=podGroupTemplates"` -} - -// TypedLocalObjectReference allows to reference typed object inside the same namespace. -type TypedLocalObjectReference struct { - // APIGroup is the group for the resource being referenced. - // If APIGroup is empty, the specified Kind must be in the core API group. - // For any other third-party types, setting APIGroup is required. - // It must be a DNS subdomain. - // - // +optional - // +k8s:optional - // +k8s:format=k8s-long-name - APIGroup string `json:"apiGroup,omitempty" protobuf:"bytes,1,opt,name=apiGroup"` - // Kind is the type of resource being referenced. - // It must be a path segment name. - // - // +required - // +k8s:required - // +k8s:format=k8s-path-segment-name - Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` - // Name is the name of resource being referenced. - // It must be a path segment name. - // - // +required - // +k8s:required - // +k8s:format=k8s-path-segment-name - Name string `json:"name" protobuf:"bytes,3,opt,name=name"` -} - -// MaxPodGroupResourceClaims is the maximum number of resource claims for a -// PodGroup or a Workload's PodGroupTemplate. -const MaxPodGroupResourceClaims = 4 - -// PodGroupTemplate represents a template for a set of pods with a scheduling policy. -type PodGroupTemplate struct { - // Name is a unique identifier for the PodGroupTemplate within the Workload. - // It must be a DNS label. This field is immutable. - // - // +required - // +k8s:required - // +k8s:format=k8s-short-name - Name string `json:"name" protobuf:"bytes,1,opt,name=name"` - - // SchedulingPolicy defines the scheduling policy for this PodGroupTemplate. - // - // +required - SchedulingPolicy PodGroupSchedulingPolicy `json:"schedulingPolicy" protobuf:"bytes,2,opt,name=schedulingPolicy"` - - // SchedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroupTemplate. - // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. - // - // +featureGate=TopologyAwareWorkloadScheduling - // +optional - // +k8s:ifDisabled(TopologyAwareWorkloadScheduling)=+k8s:forbidden - // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:optional - SchedulingConstraints *PodGroupSchedulingConstraints `json:"schedulingConstraints" protobuf:"bytes,3,opt,name=schedulingConstraints"` - - // ResourceClaims defines which ResourceClaims may be shared among Pods in - // the group. Pods consume the devices allocated to a PodGroup's claim by - // defining a claim in its own Spec.ResourceClaims that matches the - // PodGroup's claim exactly. The claim must have the same name and refer to - // the same ResourceClaim or ResourceClaimTemplate. - // - // This is an alpha-level field and requires that the - // DRAWorkloadResourceClaims feature gate is enabled. - // - // This field is immutable. - // - // +optional - // +patchMergeKey=name - // +patchStrategy=merge,retainKeys - // +listType=map - // +listMapKey=name - // +k8s:optional - // +k8s:listType=map - // +k8s:listMapKey=name - // +k8s:maxItems=4 - // +k8s:immutable - // +featureGate=DRAWorkloadResourceClaims - ResourceClaims []PodGroupResourceClaim `json:"resourceClaims,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name" protobuf:"bytes,4,rep,name=resourceClaims"` - - // DisruptionMode defines the mode in which a given PodGroup can be disrupted. - // One of Pod, PodGroup. - // This field is available only when the WorkloadAwarePreemption feature gate - // is enabled. - // - // +featureGate=WorkloadAwarePreemption - // +optional - // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional - DisruptionMode *DisruptionMode `json:"disruptionMode,omitempty" protobuf:"bytes,5,opt,name=disruptionMode,casttype=DisruptionMode"` - - // PriorityClassName indicates the priority that should be considered when scheduling - // a pod group created from this template. If no priority class is specified, admission - // control can set this to the global default priority class if it exists. Otherwise, - // pod groups created from this template will have the priority set to zero. - // This field is available only when the WorkloadAwarePreemption feature gate - // is enabled. - // - // +featureGate=WorkloadAwarePreemption - // +optional - // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:format=k8s-long-name - PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,6,opt,name=priorityClassName"` - - // Priority is the value of priority of pod groups created from this template. Various - // system components use this field to find the priority of the pod group. When - // Priority Admission Controller is enabled, it prevents users from setting this field. - // The admission controller populates this field from PriorityClassName. - // The higher the value, the higher the priority. - // This field is available only when the WorkloadAwarePreemption feature gate - // is enabled. - // - // +featureGate=WorkloadAwarePreemption - // +optional - // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:maximum=1000000000 # HighestUserDefinablePriority - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:minimum=-2147483648 - Priority *int32 `json:"priority,omitempty" protobuf:"varint,7,opt,name=priority"` -} - -// PodGroupSchedulingPolicy defines the scheduling configuration for a PodGroup. -// Exactly one policy must be set. -// +union -type PodGroupSchedulingPolicy struct { - // Basic specifies that the pods in this group should be scheduled using - // standard Kubernetes scheduling behavior. - // - // +optional - // +k8s:optional - // +k8s:unionMember - Basic *BasicSchedulingPolicy `json:"basic,omitempty" protobuf:"bytes,1,opt,name=basic"` - - // Gang specifies that the pods in this group should be scheduled using - // all-or-nothing semantics. - // - // +optional - // +k8s:optional - // +k8s:unionMember - Gang *GangSchedulingPolicy `json:"gang,omitempty" protobuf:"bytes,2,opt,name=gang"` -} - -// BasicSchedulingPolicy indicates that standard Kubernetes -// scheduling behavior should be used. -type BasicSchedulingPolicy struct { - // This is intentionally empty. Its presence indicates that the basic - // scheduling policy should be applied. In the future, new fields may appear, - // describing such constraints on a pod group level without "all or nothing" - // (gang) scheduling. -} - -// GangSchedulingPolicy defines the parameters for gang scheduling. -type GangSchedulingPolicy struct { - // MinCount is the minimum number of pods that must be schedulable or scheduled - // at the same time for the scheduler to admit the entire group. - // It must be a positive integer. - // - // +required - // +k8s:required - // +k8s:minimum=1 - MinCount int32 `json:"minCount" protobuf:"varint,1,opt,name=minCount"` -} - -// PodGroupResourceClaim references exactly one ResourceClaim, either directly -// or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim -// for the PodGroup. -// -// It adds a name to it that uniquely identifies the ResourceClaim inside the PodGroup. -// Pods that need access to the ResourceClaim define a matching reference in its -// own Spec.ResourceClaims. The Pod's claim must match all fields of the -// PodGroup's claim exactly. -type PodGroupResourceClaim struct { - // Name uniquely identifies this resource claim inside the PodGroup. - // This must be a DNS_LABEL. - // - // +required - // +k8s:required - // +k8s:format=k8s-short-name - Name string `json:"name" protobuf:"bytes,1,opt,name=name"` - - // ResourceClaimName is the name of a ResourceClaim object in the same - // namespace as this PodGroup. The ResourceClaim will be reserved for the - // PodGroup instead of its individual pods. - // - // Exactly one of ResourceClaimName and ResourceClaimTemplateName must - // be set. - // - // +optional - // +k8s:optional - // +k8s:unionMember - // +k8s:format=k8s-long-name - ResourceClaimName *string `json:"resourceClaimName,omitempty" protobuf:"bytes,2,opt,name=resourceClaimName"` - - // ResourceClaimTemplateName is the name of a ResourceClaimTemplate - // object in the same namespace as this PodGroup. - // - // The template will be used to create a new ResourceClaim, which will - // be bound to this PodGroup. When this PodGroup is deleted, the ResourceClaim - // will also be deleted. The PodGroup name and resource name, along with a - // generated component, will be used to form a unique name for the - // ResourceClaim, which will be recorded in podgroup.status.resourceClaimStatuses. - // - // This field is immutable and no changes will be made to the - // corresponding ResourceClaim by the control plane after creating the - // ResourceClaim. - // - // Exactly one of ResourceClaimName and ResourceClaimTemplateName must - // be set. - // - // +optional - // +k8s:optional - // +k8s:unionMember - // +k8s:format=k8s-long-name - ResourceClaimTemplateName *string `json:"resourceClaimTemplateName,omitempty" protobuf:"bytes,3,opt,name=resourceClaimTemplateName"` -} - -// DisruptionMode describes the mode in which a PodGroup can be disrupted (e.g. preempted). -// +enum -// +k8s:enum -type DisruptionMode string - -const ( - // DisruptionModePod means that individual pods can be disrupted or preempted independently. - // It doesn't depend on exact set of pods currently running in this PodGroup. - DisruptionModePod DisruptionMode = "Pod" - // DisruptionModePodGroup means that the whole PodGroup needs to be disrupted - // or preempted together. - DisruptionModePodGroup DisruptionMode = "PodGroup" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:supportsSubresource="/status" - -// PodGroup represents a runtime instance of pods grouped together. -// PodGroups are created by workload controllers (Job, LWS, JobSet, etc...) from -// Workload.podGroupTemplates. -// PodGroup API enablement is toggled by the GenericWorkload feature gate. -type PodGroup struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Spec defines the desired state of the PodGroup. - // - // +required - Spec PodGroupSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - - // Status represents the current observed state of the PodGroup. - // - // +optional - Status PodGroupStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// PodGroupList contains a list of PodGroup resources. -type PodGroupList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata. - // - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Items is the list of PodGroups. - Items []PodGroup `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// PodGroupSpec defines the desired state of a PodGroup. -type PodGroupSpec struct { - // PodGroupTemplateRef references an optional PodGroup template within other object - // (e.g. Workload) that was used to create the PodGroup. This field is immutable. - // - // +optional - // +k8s:optional - // +k8s:immutable - PodGroupTemplateRef *PodGroupTemplateReference `json:"podGroupTemplateRef" protobuf:"bytes,1,opt,name=podGroupTemplateRef"` - - // SchedulingPolicy defines the scheduling policy for this instance of the PodGroup. - // Controllers are expected to fill this field by copying it from a PodGroupTemplate. - // This field is immutable. - // - // +required - // +k8s:immutable - SchedulingPolicy PodGroupSchedulingPolicy `json:"schedulingPolicy" protobuf:"bytes,2,opt,name=schedulingPolicy"` - - // SchedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroup. - // Controllers are expected to fill this field by copying it from a PodGroupTemplate. - // This field is immutable. - // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. - // - // +featureGate=TopologyAwareWorkloadScheduling - // +optional - // +k8s:ifDisabled(TopologyAwareWorkloadScheduling)=+k8s:forbidden - // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:optional - // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:immutable - SchedulingConstraints *PodGroupSchedulingConstraints `json:"schedulingConstraints,omitempty" protobuf:"bytes,3,opt,name=schedulingConstraints"` - - // ResourceClaims defines which ResourceClaims may be shared among Pods in - // the group. Pods consume the devices allocated to a PodGroup's claim by - // defining a claim in its own Spec.ResourceClaims that matches the - // PodGroup's claim exactly. The claim must have the same name and refer to - // the same ResourceClaim or ResourceClaimTemplate. - // - // This is an alpha-level field and requires that the - // DRAWorkloadResourceClaims feature gate is enabled. - // - // This field is immutable. - // - // +optional - // +patchMergeKey=name - // +patchStrategy=merge,retainKeys - // +listType=map - // +listMapKey=name - // +k8s:optional - // +k8s:listType=map - // +k8s:listMapKey=name - // +k8s:maxItems=4 - // +k8s:immutable - // +featureGate=DRAWorkloadResourceClaims - ResourceClaims []PodGroupResourceClaim `json:"resourceClaims,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name" protobuf:"bytes,4,rep,name=resourceClaims"` - - // DisruptionMode defines the mode in which a given PodGroup can be disrupted. - // Controllers are expected to fill this field by copying it from a PodGroupTemplate. - // One of Pod, PodGroup. Defaults to Pod if unset. - // This field is immutable. - // This field is available only when the WorkloadAwarePreemption feature gate - // is enabled. - // - // +featureGate=WorkloadAwarePreemption - // +optional - // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:immutable - // +default="Pod" - DisruptionMode *DisruptionMode `json:"disruptionMode,omitempty" protobuf:"bytes,5,opt,name=disruptionMode,casttype=DisruptionMode"` - - // PriorityClassName defines the priority that should be considered when scheduling this pod group. - // Controllers are expected to fill this field by copying it from a PodGroupTemplate. - // Otherwise, it is validated and resolved similarly to the PriorityClassName on PodGroupTemplate - // (i.e. if no priority class is specified, admission control can set this to the global default - // priority class if it exists. Otherwise, the pod group's priority will be zero). - // This field is immutable. - // This field is available only when the WorkloadAwarePreemption feature gate - // is enabled. - // - // +featureGate=WorkloadAwarePreemption - // +optional - // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:format=k8s-long-name - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:immutable - PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,6,opt,name=priorityClassName"` - - // Priority is the value of priority of this pod group. Various system components - // use this field to find the priority of the pod group. When Priority Admission - // Controller is enabled, it prevents users from setting this field. The admission - // controller populates this field from PriorityClassName. - // The higher the value, the higher the priority. - // This field is immutable. - // This field is available only when the WorkloadAwarePreemption feature gate - // is enabled. - // - // +featureGate=WorkloadAwarePreemption - // +optional - // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:immutable - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:maximum=1000000000 # HighestUserDefinablePriority - // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:minimum=-2147483648 - Priority *int32 `json:"priority,omitempty" protobuf:"varint,7,opt,name=priority"` -} - -// PodGroupStatus represents information about the status of a pod group. -type PodGroupStatus struct { - // Conditions represent the latest observations of the PodGroup's state. - // - // Known condition types: - // - "PodGroupScheduled": Indicates whether the scheduling requirement has been satisfied. - // - "DisruptionTarget": Indicates whether the PodGroup is about to be terminated - // due to disruption such as preemption. - // - // Known reasons for the PodGroupScheduled condition: - // - "Unschedulable": The PodGroup cannot be scheduled due to resource constraints, - // affinity/anti-affinity rules, or insufficient capacity for the gang. - // - "SchedulerError": The PodGroup cannot be scheduled due to some internal error - // that happened during scheduling, for example due to nodeAffinity parsing errors. - // - // Known reasons for the DisruptionTarget condition: - // - "PreemptionByScheduler": The PodGroup was preempted by the scheduler to make room for - // higher-priority PodGroups or Pods. - // - // +optional - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` - - // Status of resource claims. - // +optional - // +patchMergeKey=name - // +patchStrategy=merge,retainKeys - // +listType=map - // +listMapKey=name - // +k8s:optional - // +k8s:listType=map - // +k8s:listMapKey=name - // +k8s:maxItems=4 - // +featureGate=DRAWorkloadResourceClaims - ResourceClaimStatuses []PodGroupResourceClaimStatus `json:"resourceClaimStatuses,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name" protobuf:"bytes,2,rep,name=resourceClaimStatuses"` -} - -// Well-known condition types for PodGroups. -const ( - // PodGroupScheduled represents status of the scheduling process for this PodGroup. - PodGroupScheduled string = "PodGroupScheduled" - // DisruptionTarget indicates the PodGroup is about to be terminated due to disruption - // such as preemption. - DisruptionTarget string = "DisruptionTarget" -) - -// Well-known condition reasons for PodGroups. -const ( - // Unschedulable reason in the PodGroupScheduled condition indicates that the PodGroup cannot be scheduled - // due to resource constraints, affinity/anti-affinity rules, or insufficient capacity for the PodGroup. - PodGroupReasonUnschedulable string = "Unschedulable" - // SchedulerError reason in the PodGroupScheduled condition means that some internal error happens - // during scheduling, for example due to nodeAffinity parsing errors. - PodGroupReasonSchedulerError string = "SchedulerError" - // PreemptionByScheduler reason in the DisruptionTarget condition indicates the PodGroup was preempted - // to make room for higher-priority PodGroups or Pods. - PodGroupReasonPreemptionByScheduler string = "PreemptionByScheduler" -) - -// PodGroupResourceClaimStatus is stored in the PodGroupStatus for each -// PodGroupResourceClaim which references a ResourceClaimTemplate. It stores the -// generated name for the corresponding ResourceClaim. -type PodGroupResourceClaimStatus struct { - // Name uniquely identifies this resource claim inside the PodGroup. This - // must match the name of an entry in podgroup.spec.resourceClaims, which - // implies that the string must be a DNS_LABEL. - // - // +required - Name string `json:"name" protobuf:"bytes,1,name=name"` - - // ResourceClaimName is the name of the ResourceClaim that was generated for - // the PodGroup in the namespace of the PodGroup. If this is unset, then - // generating a ResourceClaim was not necessary. The - // podgroup.spec.resourceClaims entry can be ignored in this case. - // - // +optional - // +k8s:optional - // +k8s:format=k8s-long-name - ResourceClaimName *string `json:"resourceClaimName,omitempty" protobuf:"bytes,2,opt,name=resourceClaimName"` -} - -// PodGroupTemplateReference references a PodGroup template defined in some object (e.g. Workload). -// Exactly one reference must be set. -// +union -type PodGroupTemplateReference struct { - // Workload references the PodGroupTemplate within the Workload object that was used to create - // the PodGroup. - // - // +optional - // +k8s:optional - // +k8s:unionMember - Workload *WorkloadPodGroupTemplateReference `json:"workload" protobuf:"bytes,1,opt,name=workload"` -} - -// WorkloadPodGroupTemplateReference references the PodGroupTemplate within the Workload object. -type WorkloadPodGroupTemplateReference struct { - // WorkloadName defines the name of the Workload object. - // - // +required - // +k8s:required - // +k8s:format=k8s-long-name - WorkloadName string `json:"workloadName" protobuf:"bytes,1,opt,name=workloadName"` - - // PodGroupTemplateName defines the PodGroupTemplate name within the Workload object. - // - // +required - // +k8s:required - // +k8s:format=k8s-short-name - PodGroupTemplateName string `json:"podGroupTemplateName" protobuf:"bytes,2,opt,name=podGroupTemplateName"` -} - -// PodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a PodGroup. -type PodGroupSchedulingConstraints struct { - // Topology defines the topology constraints for the pod group. - // Currently only a single topology constraint can be specified. This may change in the future. - // - // +optional - // +k8s:optional - // +k8s:maxItems=1 - // +listType=atomic - // +k8s:listType=atomic - Topology []TopologyConstraint `json:"topology,omitempty" protobuf:"bytes,1,rep,name=topology"` -} - -// TopologyConstraint defines a topology constraint for a PodGroup. -type TopologyConstraint struct { - // Key specifies the key of the node label representing the topology domain. - // All pods within the PodGroup must be colocated within the same domain instance. - // Different PodGroups can land on different domain instances even if they derive from the same PodGroupTemplate. - // Examples: "topology.kubernetes.io/rack" - // - // +required - // +k8s:required - // +k8s:format=k8s-label-key - Key string `json:"key" protobuf:"bytes,1,opt,name=key"` -} diff --git a/vendor/k8s.io/api/scheduling/v1alpha2/types_swagger_doc_generated.go b/vendor/k8s.io/api/scheduling/v1alpha2/types_swagger_doc_generated.go deleted file mode 100644 index 2dc06b1c6f..0000000000 --- a/vendor/k8s.io/api/scheduling/v1alpha2/types_swagger_doc_generated.go +++ /dev/null @@ -1,217 +0,0 @@ -/* -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. -*/ - -package v1alpha2 - -// This file contains a collection of methods that can be used from go-restful to -// generate Swagger API documentation for its models. Please read this PR for more -// information on the implementation: https://github.com/emicklei/go-restful/pull/215 -// -// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if -// they are on one line! For multiple line or blocks that you want to ignore use ---. -// Any context after a --- is ignored. -// -// Those methods can be generated by using hack/update-codegen.sh - -// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. -var map_BasicSchedulingPolicy = map[string]string{ - "": "BasicSchedulingPolicy indicates that standard Kubernetes scheduling behavior should be used.", -} - -func (BasicSchedulingPolicy) SwaggerDoc() map[string]string { - return map_BasicSchedulingPolicy -} - -var map_GangSchedulingPolicy = map[string]string{ - "": "GangSchedulingPolicy defines the parameters for gang scheduling.", - "minCount": "MinCount is the minimum number of pods that must be schedulable or scheduled at the same time for the scheduler to admit the entire group. It must be a positive integer.", -} - -func (GangSchedulingPolicy) SwaggerDoc() map[string]string { - return map_GangSchedulingPolicy -} - -var map_PodGroup = map[string]string{ - "": "PodGroup represents a runtime instance of pods grouped together. PodGroups are created by workload controllers (Job, LWS, JobSet, etc...) from Workload.podGroupTemplates. PodGroup API enablement is toggled by the GenericWorkload feature gate.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "Spec defines the desired state of the PodGroup.", - "status": "Status represents the current observed state of the PodGroup.", -} - -func (PodGroup) SwaggerDoc() map[string]string { - return map_PodGroup -} - -var map_PodGroupList = map[string]string{ - "": "PodGroupList contains a list of PodGroup resources.", - "metadata": "Standard list metadata.", - "items": "Items is the list of PodGroups.", -} - -func (PodGroupList) SwaggerDoc() map[string]string { - return map_PodGroupList -} - -var map_PodGroupResourceClaim = map[string]string{ - "": "PodGroupResourceClaim references exactly one ResourceClaim, either directly or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim for the PodGroup.\n\nIt adds a name to it that uniquely identifies the ResourceClaim inside the PodGroup. Pods that need access to the ResourceClaim define a matching reference in its own Spec.ResourceClaims. The Pod's claim must match all fields of the PodGroup's claim exactly.", - "name": "Name uniquely identifies this resource claim inside the PodGroup. This must be a DNS_LABEL.", - "resourceClaimName": "ResourceClaimName is the name of a ResourceClaim object in the same namespace as this PodGroup. The ResourceClaim will be reserved for the PodGroup instead of its individual pods.\n\nExactly one of ResourceClaimName and ResourceClaimTemplateName must be set.", - "resourceClaimTemplateName": "ResourceClaimTemplateName is the name of a ResourceClaimTemplate object in the same namespace as this PodGroup.\n\nThe template will be used to create a new ResourceClaim, which will be bound to this PodGroup. When this PodGroup is deleted, the ResourceClaim will also be deleted. The PodGroup name and resource name, along with a generated component, will be used to form a unique name for the ResourceClaim, which will be recorded in podgroup.status.resourceClaimStatuses.\n\nThis field is immutable and no changes will be made to the corresponding ResourceClaim by the control plane after creating the ResourceClaim.\n\nExactly one of ResourceClaimName and ResourceClaimTemplateName must be set.", -} - -func (PodGroupResourceClaim) SwaggerDoc() map[string]string { - return map_PodGroupResourceClaim -} - -var map_PodGroupResourceClaimStatus = map[string]string{ - "": "PodGroupResourceClaimStatus is stored in the PodGroupStatus for each PodGroupResourceClaim which references a ResourceClaimTemplate. It stores the generated name for the corresponding ResourceClaim.", - "name": "Name uniquely identifies this resource claim inside the PodGroup. This must match the name of an entry in podgroup.spec.resourceClaims, which implies that the string must be a DNS_LABEL.", - "resourceClaimName": "ResourceClaimName is the name of the ResourceClaim that was generated for the PodGroup in the namespace of the PodGroup. If this is unset, then generating a ResourceClaim was not necessary. The podgroup.spec.resourceClaims entry can be ignored in this case.", -} - -func (PodGroupResourceClaimStatus) SwaggerDoc() map[string]string { - return map_PodGroupResourceClaimStatus -} - -var map_PodGroupSchedulingConstraints = map[string]string{ - "": "PodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a PodGroup.", - "topology": "Topology defines the topology constraints for the pod group. Currently only a single topology constraint can be specified. This may change in the future.", -} - -func (PodGroupSchedulingConstraints) SwaggerDoc() map[string]string { - return map_PodGroupSchedulingConstraints -} - -var map_PodGroupSchedulingPolicy = map[string]string{ - "": "PodGroupSchedulingPolicy defines the scheduling configuration for a PodGroup. Exactly one policy must be set.", - "basic": "Basic specifies that the pods in this group should be scheduled using standard Kubernetes scheduling behavior.", - "gang": "Gang specifies that the pods in this group should be scheduled using all-or-nothing semantics.", -} - -func (PodGroupSchedulingPolicy) SwaggerDoc() map[string]string { - return map_PodGroupSchedulingPolicy -} - -var map_PodGroupSpec = map[string]string{ - "": "PodGroupSpec defines the desired state of a PodGroup.", - "podGroupTemplateRef": "PodGroupTemplateRef references an optional PodGroup template within other object (e.g. Workload) that was used to create the PodGroup. This field is immutable.", - "schedulingPolicy": "SchedulingPolicy defines the scheduling policy for this instance of the PodGroup. Controllers are expected to fill this field by copying it from a PodGroupTemplate. This field is immutable.", - "schedulingConstraints": "SchedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroup. Controllers are expected to fill this field by copying it from a PodGroupTemplate. This field is immutable. This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled.", - "resourceClaims": "ResourceClaims defines which ResourceClaims may be shared among Pods in the group. Pods consume the devices allocated to a PodGroup's claim by defining a claim in its own Spec.ResourceClaims that matches the PodGroup's claim exactly. The claim must have the same name and refer to the same ResourceClaim or ResourceClaimTemplate.\n\nThis is an alpha-level field and requires that the DRAWorkloadResourceClaims feature gate is enabled.\n\nThis field is immutable.", - "disruptionMode": "DisruptionMode defines the mode in which a given PodGroup can be disrupted. Controllers are expected to fill this field by copying it from a PodGroupTemplate. One of Pod, PodGroup. Defaults to Pod if unset. This field is immutable. This field is available only when the WorkloadAwarePreemption feature gate is enabled.", - "priorityClassName": "PriorityClassName defines the priority that should be considered when scheduling this pod group. Controllers are expected to fill this field by copying it from a PodGroupTemplate. Otherwise, it is validated and resolved similarly to the PriorityClassName on PodGroupTemplate (i.e. if no priority class is specified, admission control can set this to the global default priority class if it exists. Otherwise, the pod group's priority will be zero). This field is immutable. This field is available only when the WorkloadAwarePreemption feature gate is enabled.", - "priority": "Priority is the value of priority of this pod group. Various system components use this field to find the priority of the pod group. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority. This field is immutable. This field is available only when the WorkloadAwarePreemption feature gate is enabled.", -} - -func (PodGroupSpec) SwaggerDoc() map[string]string { - return map_PodGroupSpec -} - -var map_PodGroupStatus = map[string]string{ - "": "PodGroupStatus represents information about the status of a pod group.", - "conditions": "Conditions represent the latest observations of the PodGroup's state.\n\nKnown condition types: - \"PodGroupScheduled\": Indicates whether the scheduling requirement has been satisfied. - \"DisruptionTarget\": Indicates whether the PodGroup is about to be terminated\n due to disruption such as preemption.\n\nKnown reasons for the PodGroupScheduled condition: - \"Unschedulable\": The PodGroup cannot be scheduled due to resource constraints,\n affinity/anti-affinity rules, or insufficient capacity for the gang.\n- \"SchedulerError\": The PodGroup cannot be scheduled due to some internal error\n that happened during scheduling, for example due to nodeAffinity parsing errors.\n\nKnown reasons for the DisruptionTarget condition: - \"PreemptionByScheduler\": The PodGroup was preempted by the scheduler to make room for\n higher-priority PodGroups or Pods.", - "resourceClaimStatuses": "Status of resource claims.", -} - -func (PodGroupStatus) SwaggerDoc() map[string]string { - return map_PodGroupStatus -} - -var map_PodGroupTemplate = map[string]string{ - "": "PodGroupTemplate represents a template for a set of pods with a scheduling policy.", - "name": "Name is a unique identifier for the PodGroupTemplate within the Workload. It must be a DNS label. This field is immutable.", - "schedulingPolicy": "SchedulingPolicy defines the scheduling policy for this PodGroupTemplate.", - "schedulingConstraints": "SchedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroupTemplate. This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled.", - "resourceClaims": "ResourceClaims defines which ResourceClaims may be shared among Pods in the group. Pods consume the devices allocated to a PodGroup's claim by defining a claim in its own Spec.ResourceClaims that matches the PodGroup's claim exactly. The claim must have the same name and refer to the same ResourceClaim or ResourceClaimTemplate.\n\nThis is an alpha-level field and requires that the DRAWorkloadResourceClaims feature gate is enabled.\n\nThis field is immutable.", - "disruptionMode": "DisruptionMode defines the mode in which a given PodGroup can be disrupted. One of Pod, PodGroup. This field is available only when the WorkloadAwarePreemption feature gate is enabled.", - "priorityClassName": "PriorityClassName indicates the priority that should be considered when scheduling a pod group created from this template. If no priority class is specified, admission control can set this to the global default priority class if it exists. Otherwise, pod groups created from this template will have the priority set to zero. This field is available only when the WorkloadAwarePreemption feature gate is enabled.", - "priority": "Priority is the value of priority of pod groups created from this template. Various system components use this field to find the priority of the pod group. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority. This field is available only when the WorkloadAwarePreemption feature gate is enabled.", -} - -func (PodGroupTemplate) SwaggerDoc() map[string]string { - return map_PodGroupTemplate -} - -var map_PodGroupTemplateReference = map[string]string{ - "": "PodGroupTemplateReference references a PodGroup template defined in some object (e.g. Workload). Exactly one reference must be set.", - "workload": "Workload references the PodGroupTemplate within the Workload object that was used to create the PodGroup.", -} - -func (PodGroupTemplateReference) SwaggerDoc() map[string]string { - return map_PodGroupTemplateReference -} - -var map_TopologyConstraint = map[string]string{ - "": "TopologyConstraint defines a topology constraint for a PodGroup.", - "key": "Key specifies the key of the node label representing the topology domain. All pods within the PodGroup must be colocated within the same domain instance. Different PodGroups can land on different domain instances even if they derive from the same PodGroupTemplate. Examples: \"topology.kubernetes.io/rack\"", -} - -func (TopologyConstraint) SwaggerDoc() map[string]string { - return map_TopologyConstraint -} - -var map_TypedLocalObjectReference = map[string]string{ - "": "TypedLocalObjectReference allows to reference typed object inside the same namespace.", - "apiGroup": "APIGroup is the group for the resource being referenced. If APIGroup is empty, the specified Kind must be in the core API group. For any other third-party types, setting APIGroup is required. It must be a DNS subdomain.", - "kind": "Kind is the type of resource being referenced. It must be a path segment name.", - "name": "Name is the name of resource being referenced. It must be a path segment name.", -} - -func (TypedLocalObjectReference) SwaggerDoc() map[string]string { - return map_TypedLocalObjectReference -} - -var map_Workload = map[string]string{ - "": "Workload allows for expressing scheduling constraints that should be used when managing the lifecycle of workloads from the scheduling perspective, including scheduling, preemption, eviction and other phases. Workload API enablement is toggled by the GenericWorkload feature gate.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "Spec defines the desired behavior of a Workload.", -} - -func (Workload) SwaggerDoc() map[string]string { - return map_Workload -} - -var map_WorkloadList = map[string]string{ - "": "WorkloadList contains a list of Workload resources.", - "metadata": "Standard list metadata.", - "items": "Items is the list of Workloads.", -} - -func (WorkloadList) SwaggerDoc() map[string]string { - return map_WorkloadList -} - -var map_WorkloadPodGroupTemplateReference = map[string]string{ - "": "WorkloadPodGroupTemplateReference references the PodGroupTemplate within the Workload object.", - "workloadName": "WorkloadName defines the name of the Workload object.", - "podGroupTemplateName": "PodGroupTemplateName defines the PodGroupTemplate name within the Workload object.", -} - -func (WorkloadPodGroupTemplateReference) SwaggerDoc() map[string]string { - return map_WorkloadPodGroupTemplateReference -} - -var map_WorkloadSpec = map[string]string{ - "": "WorkloadSpec defines the desired state of a Workload.", - "controllerRef": "ControllerRef is an optional reference to the controlling object, such as a Deployment or Job. This field is intended for use by tools like CLIs to provide a link back to the original workload definition. This field is immutable.", - "podGroupTemplates": "PodGroupTemplates is the list of templates that make up the Workload. The maximum number of templates is 8. This field is immutable.", -} - -func (WorkloadSpec) SwaggerDoc() map[string]string { - return map_WorkloadSpec -} - -// AUTO-GENERATED FUNCTIONS END HERE diff --git a/vendor/k8s.io/api/scheduling/v1alpha2/zz_generated.deepcopy.go b/vendor/k8s.io/api/scheduling/v1alpha2/zz_generated.deepcopy.go deleted file mode 100644 index 901bb0a3ad..0000000000 --- a/vendor/k8s.io/api/scheduling/v1alpha2/zz_generated.deepcopy.go +++ /dev/null @@ -1,484 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BasicSchedulingPolicy) DeepCopyInto(out *BasicSchedulingPolicy) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BasicSchedulingPolicy. -func (in *BasicSchedulingPolicy) DeepCopy() *BasicSchedulingPolicy { - if in == nil { - return nil - } - out := new(BasicSchedulingPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GangSchedulingPolicy) DeepCopyInto(out *GangSchedulingPolicy) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GangSchedulingPolicy. -func (in *GangSchedulingPolicy) DeepCopy() *GangSchedulingPolicy { - if in == nil { - return nil - } - out := new(GangSchedulingPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroup) DeepCopyInto(out *PodGroup) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroup. -func (in *PodGroup) DeepCopy() *PodGroup { - if in == nil { - return nil - } - out := new(PodGroup) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PodGroup) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroupList) DeepCopyInto(out *PodGroupList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]PodGroup, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupList. -func (in *PodGroupList) DeepCopy() *PodGroupList { - if in == nil { - return nil - } - out := new(PodGroupList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PodGroupList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroupResourceClaim) DeepCopyInto(out *PodGroupResourceClaim) { - *out = *in - if in.ResourceClaimName != nil { - in, out := &in.ResourceClaimName, &out.ResourceClaimName - *out = new(string) - **out = **in - } - if in.ResourceClaimTemplateName != nil { - in, out := &in.ResourceClaimTemplateName, &out.ResourceClaimTemplateName - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupResourceClaim. -func (in *PodGroupResourceClaim) DeepCopy() *PodGroupResourceClaim { - if in == nil { - return nil - } - out := new(PodGroupResourceClaim) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroupResourceClaimStatus) DeepCopyInto(out *PodGroupResourceClaimStatus) { - *out = *in - if in.ResourceClaimName != nil { - in, out := &in.ResourceClaimName, &out.ResourceClaimName - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupResourceClaimStatus. -func (in *PodGroupResourceClaimStatus) DeepCopy() *PodGroupResourceClaimStatus { - if in == nil { - return nil - } - out := new(PodGroupResourceClaimStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroupSchedulingConstraints) DeepCopyInto(out *PodGroupSchedulingConstraints) { - *out = *in - if in.Topology != nil { - in, out := &in.Topology, &out.Topology - *out = make([]TopologyConstraint, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupSchedulingConstraints. -func (in *PodGroupSchedulingConstraints) DeepCopy() *PodGroupSchedulingConstraints { - if in == nil { - return nil - } - out := new(PodGroupSchedulingConstraints) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroupSchedulingPolicy) DeepCopyInto(out *PodGroupSchedulingPolicy) { - *out = *in - if in.Basic != nil { - in, out := &in.Basic, &out.Basic - *out = new(BasicSchedulingPolicy) - **out = **in - } - if in.Gang != nil { - in, out := &in.Gang, &out.Gang - *out = new(GangSchedulingPolicy) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupSchedulingPolicy. -func (in *PodGroupSchedulingPolicy) DeepCopy() *PodGroupSchedulingPolicy { - if in == nil { - return nil - } - out := new(PodGroupSchedulingPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroupSpec) DeepCopyInto(out *PodGroupSpec) { - *out = *in - if in.PodGroupTemplateRef != nil { - in, out := &in.PodGroupTemplateRef, &out.PodGroupTemplateRef - *out = new(PodGroupTemplateReference) - (*in).DeepCopyInto(*out) - } - in.SchedulingPolicy.DeepCopyInto(&out.SchedulingPolicy) - if in.SchedulingConstraints != nil { - in, out := &in.SchedulingConstraints, &out.SchedulingConstraints - *out = new(PodGroupSchedulingConstraints) - (*in).DeepCopyInto(*out) - } - if in.ResourceClaims != nil { - in, out := &in.ResourceClaims, &out.ResourceClaims - *out = make([]PodGroupResourceClaim, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.DisruptionMode != nil { - in, out := &in.DisruptionMode, &out.DisruptionMode - *out = new(DisruptionMode) - **out = **in - } - if in.Priority != nil { - in, out := &in.Priority, &out.Priority - *out = new(int32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupSpec. -func (in *PodGroupSpec) DeepCopy() *PodGroupSpec { - if in == nil { - return nil - } - out := new(PodGroupSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroupStatus) DeepCopyInto(out *PodGroupStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.ResourceClaimStatuses != nil { - in, out := &in.ResourceClaimStatuses, &out.ResourceClaimStatuses - *out = make([]PodGroupResourceClaimStatus, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupStatus. -func (in *PodGroupStatus) DeepCopy() *PodGroupStatus { - if in == nil { - return nil - } - out := new(PodGroupStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroupTemplate) DeepCopyInto(out *PodGroupTemplate) { - *out = *in - in.SchedulingPolicy.DeepCopyInto(&out.SchedulingPolicy) - if in.SchedulingConstraints != nil { - in, out := &in.SchedulingConstraints, &out.SchedulingConstraints - *out = new(PodGroupSchedulingConstraints) - (*in).DeepCopyInto(*out) - } - if in.ResourceClaims != nil { - in, out := &in.ResourceClaims, &out.ResourceClaims - *out = make([]PodGroupResourceClaim, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.DisruptionMode != nil { - in, out := &in.DisruptionMode, &out.DisruptionMode - *out = new(DisruptionMode) - **out = **in - } - if in.Priority != nil { - in, out := &in.Priority, &out.Priority - *out = new(int32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupTemplate. -func (in *PodGroupTemplate) DeepCopy() *PodGroupTemplate { - if in == nil { - return nil - } - out := new(PodGroupTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroupTemplateReference) DeepCopyInto(out *PodGroupTemplateReference) { - *out = *in - if in.Workload != nil { - in, out := &in.Workload, &out.Workload - *out = new(WorkloadPodGroupTemplateReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupTemplateReference. -func (in *PodGroupTemplateReference) DeepCopy() *PodGroupTemplateReference { - if in == nil { - return nil - } - out := new(PodGroupTemplateReference) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TopologyConstraint) DeepCopyInto(out *TopologyConstraint) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TopologyConstraint. -func (in *TopologyConstraint) DeepCopy() *TopologyConstraint { - if in == nil { - return nil - } - out := new(TopologyConstraint) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TypedLocalObjectReference) DeepCopyInto(out *TypedLocalObjectReference) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TypedLocalObjectReference. -func (in *TypedLocalObjectReference) DeepCopy() *TypedLocalObjectReference { - if in == nil { - return nil - } - out := new(TypedLocalObjectReference) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Workload) DeepCopyInto(out *Workload) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Workload. -func (in *Workload) DeepCopy() *Workload { - if in == nil { - return nil - } - out := new(Workload) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Workload) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WorkloadList) DeepCopyInto(out *WorkloadList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Workload, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadList. -func (in *WorkloadList) DeepCopy() *WorkloadList { - if in == nil { - return nil - } - out := new(WorkloadList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *WorkloadList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WorkloadPodGroupTemplateReference) DeepCopyInto(out *WorkloadPodGroupTemplateReference) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadPodGroupTemplateReference. -func (in *WorkloadPodGroupTemplateReference) DeepCopy() *WorkloadPodGroupTemplateReference { - if in == nil { - return nil - } - out := new(WorkloadPodGroupTemplateReference) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WorkloadSpec) DeepCopyInto(out *WorkloadSpec) { - *out = *in - if in.ControllerRef != nil { - in, out := &in.ControllerRef, &out.ControllerRef - *out = new(TypedLocalObjectReference) - **out = **in - } - if in.PodGroupTemplates != nil { - in, out := &in.PodGroupTemplates, &out.PodGroupTemplates - *out = make([]PodGroupTemplate, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadSpec. -func (in *WorkloadSpec) DeepCopy() *WorkloadSpec { - if in == nil { - return nil - } - out := new(WorkloadSpec) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/k8s.io/api/scheduling/v1alpha2/zz_generated.model_name.go b/vendor/k8s.io/api/scheduling/v1alpha2/zz_generated.model_name.go deleted file mode 100644 index 1b7effea96..0000000000 --- a/vendor/k8s.io/api/scheduling/v1alpha2/zz_generated.model_name.go +++ /dev/null @@ -1,112 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by openapi-gen. DO NOT EDIT. - -package v1alpha2 - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in BasicSchedulingPolicy) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha2.BasicSchedulingPolicy" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in GangSchedulingPolicy) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha2.GangSchedulingPolicy" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PodGroup) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha2.PodGroup" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PodGroupList) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha2.PodGroupList" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PodGroupResourceClaim) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaim" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PodGroupResourceClaimStatus) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaimStatus" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PodGroupSchedulingConstraints) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingConstraints" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PodGroupSchedulingPolicy) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingPolicy" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PodGroupSpec) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha2.PodGroupSpec" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PodGroupStatus) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha2.PodGroupStatus" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PodGroupTemplate) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha2.PodGroupTemplate" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PodGroupTemplateReference) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha2.PodGroupTemplateReference" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in TopologyConstraint) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha2.TopologyConstraint" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in TypedLocalObjectReference) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha2.TypedLocalObjectReference" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in Workload) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha2.Workload" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in WorkloadList) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha2.WorkloadList" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in WorkloadPodGroupTemplateReference) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha2.WorkloadPodGroupTemplateReference" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in WorkloadSpec) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha2.WorkloadSpec" -} diff --git a/vendor/k8s.io/api/scheduling/v1alpha3/doc.go b/vendor/k8s.io/api/scheduling/v1alpha3/doc.go new file mode 100644 index 0000000000..d2e7419d68 --- /dev/null +++ b/vendor/k8s.io/api/scheduling/v1alpha3/doc.go @@ -0,0 +1,37 @@ +/* +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. +*/ + +// +k8s:deepcopy-gen=package +// +k8s:protobuf-gen=package +// +k8s:openapi-gen=true +// +k8s:openapi-model-package=io.k8s.api.scheduling.v1alpha3 + +// +groupName=scheduling.k8s.io + +// +k8s:validation-gen=* +// +k8s:validation-gen-input=k8s.io/api/scheduling/v1alpha3 +// +k8s:validation-gen-scheme-registry=nil + +// A non-registering copy of the declarative validation is generated in this +// package so out-of-tree consumers can run the same validation the +// kube-apiserver enforces without importing k8s.io/kubernetes/pkg or mutating +// a shared scheme on import. The registered copy lives in +// k8s.io/kubernetes/pkg/apis/scheduling/v1alpha3. +// The `*` selector generates validators for all types, including the +// WorkloadPodGroup* building blocks that are not reachable from a TypeMeta +// root. + +package v1alpha3 diff --git a/vendor/k8s.io/api/scheduling/v1alpha3/generated.pb.go b/vendor/k8s.io/api/scheduling/v1alpha3/generated.pb.go new file mode 100644 index 0000000000..5c56e7bc94 --- /dev/null +++ b/vendor/k8s.io/api/scheduling/v1alpha3/generated.pb.go @@ -0,0 +1,8927 @@ +/* +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 protoc-gen-gogo. DO NOT EDIT. +// source: k8s.io/api/scheduling/v1alpha3/generated.proto + +package v1alpha3 + +import ( + fmt "fmt" + + io "io" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + math_bits "math/bits" + reflect "reflect" + strings "strings" +) + +func (m *AllCompositeDisruptionMode) Reset() { *m = AllCompositeDisruptionMode{} } + +func (m *AllDisruptionMode) Reset() { *m = AllDisruptionMode{} } + +func (m *BasicSchedulingPolicy) Reset() { *m = BasicSchedulingPolicy{} } + +func (m *CompositeBasicSchedulingPolicy) Reset() { *m = CompositeBasicSchedulingPolicy{} } + +func (m *CompositeDisruptionMode) Reset() { *m = CompositeDisruptionMode{} } + +func (m *CompositeGangSchedulingPolicy) Reset() { *m = CompositeGangSchedulingPolicy{} } + +func (m *CompositePodGroup) Reset() { *m = CompositePodGroup{} } + +func (m *CompositePodGroupList) Reset() { *m = CompositePodGroupList{} } + +func (m *CompositePodGroupSchedulingConstraints) Reset() { + *m = CompositePodGroupSchedulingConstraints{} +} + +func (m *CompositePodGroupSchedulingPolicy) Reset() { *m = CompositePodGroupSchedulingPolicy{} } + +func (m *CompositePodGroupSpec) Reset() { *m = CompositePodGroupSpec{} } + +func (m *CompositePodGroupStatus) Reset() { *m = CompositePodGroupStatus{} } + +func (m *CompositePodGroupTemplate) Reset() { *m = CompositePodGroupTemplate{} } + +func (m *DisruptionMode) Reset() { *m = DisruptionMode{} } + +func (m *GangSchedulingPolicy) Reset() { *m = GangSchedulingPolicy{} } + +func (m *PodGroup) Reset() { *m = PodGroup{} } + +func (m *PodGroupList) Reset() { *m = PodGroupList{} } + +func (m *PodGroupResourceClaim) Reset() { *m = PodGroupResourceClaim{} } + +func (m *PodGroupResourceClaimStatus) Reset() { *m = PodGroupResourceClaimStatus{} } + +func (m *PodGroupSchedulingConstraints) Reset() { *m = PodGroupSchedulingConstraints{} } + +func (m *PodGroupSchedulingPolicy) Reset() { *m = PodGroupSchedulingPolicy{} } + +func (m *PodGroupSpec) Reset() { *m = PodGroupSpec{} } + +func (m *PodGroupStatus) Reset() { *m = PodGroupStatus{} } + +func (m *PodGroupTemplate) Reset() { *m = PodGroupTemplate{} } + +func (m *SingleCompositeDisruptionMode) Reset() { *m = SingleCompositeDisruptionMode{} } + +func (m *SingleDisruptionMode) Reset() { *m = SingleDisruptionMode{} } + +func (m *TopologyConstraint) Reset() { *m = TopologyConstraint{} } + +func (m *TypedLocalObjectReference) Reset() { *m = TypedLocalObjectReference{} } + +func (m *Workload) Reset() { *m = Workload{} } + +func (m *WorkloadCompositePodGroupAllDisruptionMode) Reset() { + *m = WorkloadCompositePodGroupAllDisruptionMode{} +} + +func (m *WorkloadCompositePodGroupBasicSchedulingPolicy) Reset() { + *m = WorkloadCompositePodGroupBasicSchedulingPolicy{} +} + +func (m *WorkloadCompositePodGroupDisruptionMode) Reset() { + *m = WorkloadCompositePodGroupDisruptionMode{} +} + +func (m *WorkloadCompositePodGroupGangSchedulingPolicy) Reset() { + *m = WorkloadCompositePodGroupGangSchedulingPolicy{} +} + +func (m *WorkloadCompositePodGroupSchedulingConstraints) Reset() { + *m = WorkloadCompositePodGroupSchedulingConstraints{} +} + +func (m *WorkloadCompositePodGroupSchedulingPolicy) Reset() { + *m = WorkloadCompositePodGroupSchedulingPolicy{} +} + +func (m *WorkloadCompositePodGroupSingleDisruptionMode) Reset() { + *m = WorkloadCompositePodGroupSingleDisruptionMode{} +} + +func (m *WorkloadList) Reset() { *m = WorkloadList{} } + +func (m *WorkloadPodGroupAllDisruptionMode) Reset() { *m = WorkloadPodGroupAllDisruptionMode{} } + +func (m *WorkloadPodGroupBasicSchedulingPolicy) Reset() { *m = WorkloadPodGroupBasicSchedulingPolicy{} } + +func (m *WorkloadPodGroupDisruptionMode) Reset() { *m = WorkloadPodGroupDisruptionMode{} } + +func (m *WorkloadPodGroupGangSchedulingPolicy) Reset() { *m = WorkloadPodGroupGangSchedulingPolicy{} } + +func (m *WorkloadPodGroupResourceClaim) Reset() { *m = WorkloadPodGroupResourceClaim{} } + +func (m *WorkloadPodGroupSchedulingConstraints) Reset() { *m = WorkloadPodGroupSchedulingConstraints{} } + +func (m *WorkloadPodGroupSchedulingPolicy) Reset() { *m = WorkloadPodGroupSchedulingPolicy{} } + +func (m *WorkloadPodGroupSingleDisruptionMode) Reset() { *m = WorkloadPodGroupSingleDisruptionMode{} } + +func (m *WorkloadReference) Reset() { *m = WorkloadReference{} } + +func (m *WorkloadSpec) Reset() { *m = WorkloadSpec{} } + +func (m *AllCompositeDisruptionMode) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AllCompositeDisruptionMode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AllCompositeDisruptionMode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *AllDisruptionMode) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AllDisruptionMode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AllDisruptionMode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *BasicSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BasicSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BasicSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *CompositeBasicSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CompositeBasicSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompositeBasicSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *CompositeDisruptionMode) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CompositeDisruptionMode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompositeDisruptionMode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.All != nil { + { + size, err := m.All.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Single != nil { + { + size, err := m.Single.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CompositeGangSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CompositeGangSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompositeGangSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i = encodeVarintGenerated(dAtA, i, uint64(m.MinGroupCount)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil +} + +func (m *CompositePodGroup) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CompositePodGroup) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompositePodGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *CompositePodGroupList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CompositePodGroupList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompositePodGroupList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *CompositePodGroupSchedulingConstraints) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CompositePodGroupSchedulingConstraints) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompositePodGroupSchedulingConstraints) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Topology) > 0 { + for iNdEx := len(m.Topology) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Topology[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *CompositePodGroupSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CompositePodGroupSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompositePodGroupSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Gang != nil { + { + size, err := m.Gang.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Basic != nil { + { + size, err := m.Basic.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CompositePodGroupSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CompositePodGroupSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompositePodGroupSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PreemptionPolicy != nil { + i -= len(*m.PreemptionPolicy) + copy(dAtA[i:], *m.PreemptionPolicy) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PreemptionPolicy))) + i-- + dAtA[i] = 0x42 + } + if m.Priority != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.Priority)) + i-- + dAtA[i] = 0x38 + } + i -= len(m.PriorityClassName) + copy(dAtA[i:], m.PriorityClassName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.PriorityClassName))) + i-- + dAtA[i] = 0x32 + if m.DisruptionMode != nil { + { + size, err := m.DisruptionMode.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if m.SchedulingConstraints != nil { + { + size, err := m.SchedulingConstraints.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + { + size, err := m.SchedulingPolicy.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.WorkloadRef != nil { + { + size, err := m.WorkloadRef.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.ParentCompositePodGroupName != nil { + i -= len(*m.ParentCompositePodGroupName) + copy(dAtA[i:], *m.ParentCompositePodGroupName) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ParentCompositePodGroupName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CompositePodGroupStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CompositePodGroupStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompositePodGroupStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Conditions) > 0 { + for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *CompositePodGroupTemplate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CompositePodGroupTemplate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompositePodGroupTemplate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CompositePodGroupTemplates) > 0 { + for iNdEx := len(m.CompositePodGroupTemplates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CompositePodGroupTemplates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + } + if len(m.PodGroupTemplates) > 0 { + for iNdEx := len(m.PodGroupTemplates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PodGroupTemplates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } + if m.PreemptionPolicy != nil { + i -= len(*m.PreemptionPolicy) + copy(dAtA[i:], *m.PreemptionPolicy) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PreemptionPolicy))) + i-- + dAtA[i] = 0x3a + } + if m.Priority != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.Priority)) + i-- + dAtA[i] = 0x30 + } + i -= len(m.PriorityClassName) + copy(dAtA[i:], m.PriorityClassName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.PriorityClassName))) + i-- + dAtA[i] = 0x2a + if m.DisruptionMode != nil { + { + size, err := m.DisruptionMode.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.SchedulingConstraints != nil { + { + size, err := m.SchedulingConstraints.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + { + size, err := m.SchedulingPolicy.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *DisruptionMode) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DisruptionMode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DisruptionMode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.All != nil { + { + size, err := m.All.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Single != nil { + { + size, err := m.Single.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GangSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GangSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GangSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i = encodeVarintGenerated(dAtA, i, uint64(m.MinCount)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil +} + +func (m *PodGroup) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroup) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PodGroupList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PodGroupResourceClaim) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupResourceClaim) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupResourceClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ResourceClaimTemplateName != nil { + i -= len(*m.ResourceClaimTemplateName) + copy(dAtA[i:], *m.ResourceClaimTemplateName) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ResourceClaimTemplateName))) + i-- + dAtA[i] = 0x1a + } + if m.ResourceClaimName != nil { + i -= len(*m.ResourceClaimName) + copy(dAtA[i:], *m.ResourceClaimName) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ResourceClaimName))) + i-- + dAtA[i] = 0x12 + } + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PodGroupResourceClaimStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupResourceClaimStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupResourceClaimStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ResourceClaimName != nil { + i -= len(*m.ResourceClaimName) + copy(dAtA[i:], *m.ResourceClaimName) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ResourceClaimName))) + i-- + dAtA[i] = 0x12 + } + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PodGroupSchedulingConstraints) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupSchedulingConstraints) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupSchedulingConstraints) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Topology) > 0 { + for iNdEx := len(m.Topology) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Topology[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *PodGroupSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Gang != nil { + { + size, err := m.Gang.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Basic != nil { + { + size, err := m.Basic.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PodGroupSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PreemptionPolicy != nil { + i -= len(*m.PreemptionPolicy) + copy(dAtA[i:], *m.PreemptionPolicy) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PreemptionPolicy))) + i-- + dAtA[i] = 0x4a + } + if m.Priority != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.Priority)) + i-- + dAtA[i] = 0x40 + } + i -= len(m.PriorityClassName) + copy(dAtA[i:], m.PriorityClassName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.PriorityClassName))) + i-- + dAtA[i] = 0x3a + if m.DisruptionMode != nil { + { + size, err := m.DisruptionMode.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if len(m.ResourceClaims) > 0 { + for iNdEx := len(m.ResourceClaims) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ResourceClaims[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if m.SchedulingConstraints != nil { + { + size, err := m.SchedulingConstraints.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + { + size, err := m.SchedulingPolicy.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.WorkloadRef != nil { + { + size, err := m.WorkloadRef.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.ParentCompositePodGroupName != nil { + i -= len(*m.ParentCompositePodGroupName) + copy(dAtA[i:], *m.ParentCompositePodGroupName) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ParentCompositePodGroupName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PodGroupStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ResourceClaimStatuses) > 0 { + for iNdEx := len(m.ResourceClaimStatuses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ResourceClaimStatuses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Conditions) > 0 { + for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *PodGroupTemplate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupTemplate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupTemplate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PreemptionPolicy != nil { + i -= len(*m.PreemptionPolicy) + copy(dAtA[i:], *m.PreemptionPolicy) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PreemptionPolicy))) + i-- + dAtA[i] = 0x42 + } + if m.Priority != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.Priority)) + i-- + dAtA[i] = 0x38 + } + i -= len(m.PriorityClassName) + copy(dAtA[i:], m.PriorityClassName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.PriorityClassName))) + i-- + dAtA[i] = 0x32 + if m.DisruptionMode != nil { + { + size, err := m.DisruptionMode.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if len(m.ResourceClaims) > 0 { + for iNdEx := len(m.ResourceClaims) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ResourceClaims[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.SchedulingConstraints != nil { + { + size, err := m.SchedulingConstraints.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + { + size, err := m.SchedulingPolicy.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *SingleCompositeDisruptionMode) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SingleCompositeDisruptionMode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SingleCompositeDisruptionMode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *SingleDisruptionMode) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SingleDisruptionMode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SingleDisruptionMode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *TopologyConstraint) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TopologyConstraint) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TopologyConstraint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *TypedLocalObjectReference) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TypedLocalObjectReference) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TypedLocalObjectReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x1a + i -= len(m.Kind) + copy(dAtA[i:], m.Kind) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Kind))) + i-- + dAtA[i] = 0x12 + i -= len(m.APIGroup) + copy(dAtA[i:], m.APIGroup) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIGroup))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Workload) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Workload) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Workload) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *WorkloadCompositePodGroupAllDisruptionMode) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadCompositePodGroupAllDisruptionMode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadCompositePodGroupAllDisruptionMode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *WorkloadCompositePodGroupBasicSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadCompositePodGroupBasicSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadCompositePodGroupBasicSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *WorkloadCompositePodGroupDisruptionMode) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadCompositePodGroupDisruptionMode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadCompositePodGroupDisruptionMode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.All != nil { + { + size, err := m.All.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Single != nil { + { + size, err := m.Single.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *WorkloadCompositePodGroupGangSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadCompositePodGroupGangSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadCompositePodGroupGangSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MinGroupCount != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.MinGroupCount)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *WorkloadCompositePodGroupSchedulingConstraints) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadCompositePodGroupSchedulingConstraints) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadCompositePodGroupSchedulingConstraints) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Topology) > 0 { + for iNdEx := len(m.Topology) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Topology[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *WorkloadCompositePodGroupSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadCompositePodGroupSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadCompositePodGroupSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Gang != nil { + { + size, err := m.Gang.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Basic != nil { + { + size, err := m.Basic.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *WorkloadCompositePodGroupSingleDisruptionMode) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadCompositePodGroupSingleDisruptionMode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadCompositePodGroupSingleDisruptionMode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *WorkloadList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *WorkloadPodGroupAllDisruptionMode) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadPodGroupAllDisruptionMode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadPodGroupAllDisruptionMode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *WorkloadPodGroupBasicSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadPodGroupBasicSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadPodGroupBasicSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *WorkloadPodGroupDisruptionMode) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadPodGroupDisruptionMode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadPodGroupDisruptionMode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.All != nil { + { + size, err := m.All.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Single != nil { + { + size, err := m.Single.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *WorkloadPodGroupGangSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadPodGroupGangSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadPodGroupGangSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MinCount != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.MinCount)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *WorkloadPodGroupResourceClaim) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadPodGroupResourceClaim) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadPodGroupResourceClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ResourceClaimTemplateName != nil { + i -= len(*m.ResourceClaimTemplateName) + copy(dAtA[i:], *m.ResourceClaimTemplateName) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ResourceClaimTemplateName))) + i-- + dAtA[i] = 0x1a + } + if m.ResourceClaimName != nil { + i -= len(*m.ResourceClaimName) + copy(dAtA[i:], *m.ResourceClaimName) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ResourceClaimName))) + i-- + dAtA[i] = 0x12 + } + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *WorkloadPodGroupSchedulingConstraints) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadPodGroupSchedulingConstraints) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadPodGroupSchedulingConstraints) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Topology) > 0 { + for iNdEx := len(m.Topology) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Topology[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *WorkloadPodGroupSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadPodGroupSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadPodGroupSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Gang != nil { + { + size, err := m.Gang.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Basic != nil { + { + size, err := m.Basic.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *WorkloadPodGroupSingleDisruptionMode) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadPodGroupSingleDisruptionMode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadPodGroupSingleDisruptionMode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *WorkloadReference) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadReference) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.TemplateName) + copy(dAtA[i:], m.TemplateName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.TemplateName))) + i-- + dAtA[i] = 0x12 + i -= len(m.WorkloadName) + copy(dAtA[i:], m.WorkloadName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.WorkloadName))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *WorkloadSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CompositePodGroupTemplates) > 0 { + for iNdEx := len(m.CompositePodGroupTemplates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CompositePodGroupTemplates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.PodGroupTemplates) > 0 { + for iNdEx := len(m.PodGroupTemplates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PodGroupTemplates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.ControllerRef != nil { + { + size, err := m.ControllerRef.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { + offset -= sovGenerated(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *AllCompositeDisruptionMode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *AllDisruptionMode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *BasicSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *CompositeBasicSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *CompositeDisruptionMode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Single != nil { + l = m.Single.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.All != nil { + l = m.All.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *CompositeGangSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovGenerated(uint64(m.MinGroupCount)) + return n +} + +func (m *CompositePodGroup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *CompositePodGroupList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *CompositePodGroupSchedulingConstraints) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Topology) > 0 { + for _, e := range m.Topology { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *CompositePodGroupSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Basic != nil { + l = m.Basic.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Gang != nil { + l = m.Gang.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *CompositePodGroupSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ParentCompositePodGroupName != nil { + l = len(*m.ParentCompositePodGroupName) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.WorkloadRef != nil { + l = m.WorkloadRef.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + l = m.SchedulingPolicy.Size() + n += 1 + l + sovGenerated(uint64(l)) + if m.SchedulingConstraints != nil { + l = m.SchedulingConstraints.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.DisruptionMode != nil { + l = m.DisruptionMode.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + l = len(m.PriorityClassName) + n += 1 + l + sovGenerated(uint64(l)) + if m.Priority != nil { + n += 1 + sovGenerated(uint64(*m.Priority)) + } + if m.PreemptionPolicy != nil { + l = len(*m.PreemptionPolicy) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *CompositePodGroupStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Conditions) > 0 { + for _, e := range m.Conditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *CompositePodGroupTemplate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = m.SchedulingPolicy.Size() + n += 1 + l + sovGenerated(uint64(l)) + if m.SchedulingConstraints != nil { + l = m.SchedulingConstraints.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.DisruptionMode != nil { + l = m.DisruptionMode.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + l = len(m.PriorityClassName) + n += 1 + l + sovGenerated(uint64(l)) + if m.Priority != nil { + n += 1 + sovGenerated(uint64(*m.Priority)) + } + if m.PreemptionPolicy != nil { + l = len(*m.PreemptionPolicy) + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.PodGroupTemplates) > 0 { + for _, e := range m.PodGroupTemplates { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.CompositePodGroupTemplates) > 0 { + for _, e := range m.CompositePodGroupTemplates { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *DisruptionMode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Single != nil { + l = m.Single.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.All != nil { + l = m.All.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *GangSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovGenerated(uint64(m.MinCount)) + return n +} + +func (m *PodGroup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *PodGroupList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *PodGroupResourceClaim) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if m.ResourceClaimName != nil { + l = len(*m.ResourceClaimName) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.ResourceClaimTemplateName != nil { + l = len(*m.ResourceClaimTemplateName) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *PodGroupResourceClaimStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if m.ResourceClaimName != nil { + l = len(*m.ResourceClaimName) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *PodGroupSchedulingConstraints) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Topology) > 0 { + for _, e := range m.Topology { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *PodGroupSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Basic != nil { + l = m.Basic.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Gang != nil { + l = m.Gang.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *PodGroupSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ParentCompositePodGroupName != nil { + l = len(*m.ParentCompositePodGroupName) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.WorkloadRef != nil { + l = m.WorkloadRef.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + l = m.SchedulingPolicy.Size() + n += 1 + l + sovGenerated(uint64(l)) + if m.SchedulingConstraints != nil { + l = m.SchedulingConstraints.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.ResourceClaims) > 0 { + for _, e := range m.ResourceClaims { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if m.DisruptionMode != nil { + l = m.DisruptionMode.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + l = len(m.PriorityClassName) + n += 1 + l + sovGenerated(uint64(l)) + if m.Priority != nil { + n += 1 + sovGenerated(uint64(*m.Priority)) + } + if m.PreemptionPolicy != nil { + l = len(*m.PreemptionPolicy) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *PodGroupStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Conditions) > 0 { + for _, e := range m.Conditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.ResourceClaimStatuses) > 0 { + for _, e := range m.ResourceClaimStatuses { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *PodGroupTemplate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = m.SchedulingPolicy.Size() + n += 1 + l + sovGenerated(uint64(l)) + if m.SchedulingConstraints != nil { + l = m.SchedulingConstraints.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.ResourceClaims) > 0 { + for _, e := range m.ResourceClaims { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if m.DisruptionMode != nil { + l = m.DisruptionMode.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + l = len(m.PriorityClassName) + n += 1 + l + sovGenerated(uint64(l)) + if m.Priority != nil { + n += 1 + sovGenerated(uint64(*m.Priority)) + } + if m.PreemptionPolicy != nil { + l = len(*m.PreemptionPolicy) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *SingleCompositeDisruptionMode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *SingleDisruptionMode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *TopologyConstraint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *TypedLocalObjectReference) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.APIGroup) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Kind) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *Workload) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *WorkloadCompositePodGroupAllDisruptionMode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *WorkloadCompositePodGroupBasicSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *WorkloadCompositePodGroupDisruptionMode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Single != nil { + l = m.Single.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.All != nil { + l = m.All.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *WorkloadCompositePodGroupGangSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MinGroupCount != nil { + n += 1 + sovGenerated(uint64(*m.MinGroupCount)) + } + return n +} + +func (m *WorkloadCompositePodGroupSchedulingConstraints) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Topology) > 0 { + for _, e := range m.Topology { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *WorkloadCompositePodGroupSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Basic != nil { + l = m.Basic.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Gang != nil { + l = m.Gang.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *WorkloadCompositePodGroupSingleDisruptionMode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *WorkloadList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *WorkloadPodGroupAllDisruptionMode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *WorkloadPodGroupBasicSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *WorkloadPodGroupDisruptionMode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Single != nil { + l = m.Single.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.All != nil { + l = m.All.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *WorkloadPodGroupGangSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MinCount != nil { + n += 1 + sovGenerated(uint64(*m.MinCount)) + } + return n +} + +func (m *WorkloadPodGroupResourceClaim) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if m.ResourceClaimName != nil { + l = len(*m.ResourceClaimName) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.ResourceClaimTemplateName != nil { + l = len(*m.ResourceClaimTemplateName) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *WorkloadPodGroupSchedulingConstraints) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Topology) > 0 { + for _, e := range m.Topology { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *WorkloadPodGroupSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Basic != nil { + l = m.Basic.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Gang != nil { + l = m.Gang.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *WorkloadPodGroupSingleDisruptionMode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *WorkloadReference) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.WorkloadName) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.TemplateName) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *WorkloadSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ControllerRef != nil { + l = m.ControllerRef.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.PodGroupTemplates) > 0 { + for _, e := range m.PodGroupTemplates { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.CompositePodGroupTemplates) > 0 { + for _, e := range m.CompositePodGroupTemplates { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func sovGenerated(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenerated(x uint64) (n int) { + return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *AllCompositeDisruptionMode) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&AllCompositeDisruptionMode{`, + `}`, + }, "") + return s +} +func (this *AllDisruptionMode) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&AllDisruptionMode{`, + `}`, + }, "") + return s +} +func (this *BasicSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&BasicSchedulingPolicy{`, + `}`, + }, "") + return s +} +func (this *CompositeBasicSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CompositeBasicSchedulingPolicy{`, + `}`, + }, "") + return s +} +func (this *CompositeDisruptionMode) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CompositeDisruptionMode{`, + `Single:` + strings.Replace(this.Single.String(), "SingleCompositeDisruptionMode", "SingleCompositeDisruptionMode", 1) + `,`, + `All:` + strings.Replace(this.All.String(), "AllCompositeDisruptionMode", "AllCompositeDisruptionMode", 1) + `,`, + `}`, + }, "") + return s +} +func (this *CompositeGangSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CompositeGangSchedulingPolicy{`, + `MinGroupCount:` + fmt.Sprintf("%v", this.MinGroupCount) + `,`, + `}`, + }, "") + return s +} +func (this *CompositePodGroup) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CompositePodGroup{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "CompositePodGroupSpec", "CompositePodGroupSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "CompositePodGroupStatus", "CompositePodGroupStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *CompositePodGroupList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]CompositePodGroup{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "CompositePodGroup", "CompositePodGroup", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&CompositePodGroupList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *CompositePodGroupSchedulingConstraints) String() string { + if this == nil { + return "nil" + } + repeatedStringForTopology := "[]TopologyConstraint{" + for _, f := range this.Topology { + repeatedStringForTopology += strings.Replace(strings.Replace(f.String(), "TopologyConstraint", "TopologyConstraint", 1), `&`, ``, 1) + "," + } + repeatedStringForTopology += "}" + s := strings.Join([]string{`&CompositePodGroupSchedulingConstraints{`, + `Topology:` + repeatedStringForTopology + `,`, + `}`, + }, "") + return s +} +func (this *CompositePodGroupSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CompositePodGroupSchedulingPolicy{`, + `Basic:` + strings.Replace(this.Basic.String(), "CompositeBasicSchedulingPolicy", "CompositeBasicSchedulingPolicy", 1) + `,`, + `Gang:` + strings.Replace(this.Gang.String(), "CompositeGangSchedulingPolicy", "CompositeGangSchedulingPolicy", 1) + `,`, + `}`, + }, "") + return s +} +func (this *CompositePodGroupSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CompositePodGroupSpec{`, + `ParentCompositePodGroupName:` + valueToStringGenerated(this.ParentCompositePodGroupName) + `,`, + `WorkloadRef:` + strings.Replace(this.WorkloadRef.String(), "WorkloadReference", "WorkloadReference", 1) + `,`, + `SchedulingPolicy:` + strings.Replace(strings.Replace(this.SchedulingPolicy.String(), "CompositePodGroupSchedulingPolicy", "CompositePodGroupSchedulingPolicy", 1), `&`, ``, 1) + `,`, + `SchedulingConstraints:` + strings.Replace(this.SchedulingConstraints.String(), "CompositePodGroupSchedulingConstraints", "CompositePodGroupSchedulingConstraints", 1) + `,`, + `DisruptionMode:` + strings.Replace(this.DisruptionMode.String(), "CompositeDisruptionMode", "CompositeDisruptionMode", 1) + `,`, + `PriorityClassName:` + fmt.Sprintf("%v", this.PriorityClassName) + `,`, + `Priority:` + valueToStringGenerated(this.Priority) + `,`, + `PreemptionPolicy:` + valueToStringGenerated(this.PreemptionPolicy) + `,`, + `}`, + }, "") + return s +} +func (this *CompositePodGroupStatus) String() string { + if this == nil { + return "nil" + } + repeatedStringForConditions := "[]Condition{" + for _, f := range this.Conditions { + repeatedStringForConditions += fmt.Sprintf("%v", f) + "," + } + repeatedStringForConditions += "}" + s := strings.Join([]string{`&CompositePodGroupStatus{`, + `Conditions:` + repeatedStringForConditions + `,`, + `}`, + }, "") + return s +} +func (this *CompositePodGroupTemplate) String() string { + if this == nil { + return "nil" + } + repeatedStringForPodGroupTemplates := "[]PodGroupTemplate{" + for _, f := range this.PodGroupTemplates { + repeatedStringForPodGroupTemplates += strings.Replace(strings.Replace(f.String(), "PodGroupTemplate", "PodGroupTemplate", 1), `&`, ``, 1) + "," + } + repeatedStringForPodGroupTemplates += "}" + repeatedStringForCompositePodGroupTemplates := "[]CompositePodGroupTemplate{" + for _, f := range this.CompositePodGroupTemplates { + repeatedStringForCompositePodGroupTemplates += strings.Replace(strings.Replace(f.String(), "CompositePodGroupTemplate", "CompositePodGroupTemplate", 1), `&`, ``, 1) + "," + } + repeatedStringForCompositePodGroupTemplates += "}" + s := strings.Join([]string{`&CompositePodGroupTemplate{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `SchedulingPolicy:` + strings.Replace(strings.Replace(this.SchedulingPolicy.String(), "CompositePodGroupSchedulingPolicy", "CompositePodGroupSchedulingPolicy", 1), `&`, ``, 1) + `,`, + `SchedulingConstraints:` + strings.Replace(this.SchedulingConstraints.String(), "CompositePodGroupSchedulingConstraints", "CompositePodGroupSchedulingConstraints", 1) + `,`, + `DisruptionMode:` + strings.Replace(this.DisruptionMode.String(), "CompositeDisruptionMode", "CompositeDisruptionMode", 1) + `,`, + `PriorityClassName:` + fmt.Sprintf("%v", this.PriorityClassName) + `,`, + `Priority:` + valueToStringGenerated(this.Priority) + `,`, + `PreemptionPolicy:` + valueToStringGenerated(this.PreemptionPolicy) + `,`, + `PodGroupTemplates:` + repeatedStringForPodGroupTemplates + `,`, + `CompositePodGroupTemplates:` + repeatedStringForCompositePodGroupTemplates + `,`, + `}`, + }, "") + return s +} +func (this *DisruptionMode) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DisruptionMode{`, + `Single:` + strings.Replace(this.Single.String(), "SingleDisruptionMode", "SingleDisruptionMode", 1) + `,`, + `All:` + strings.Replace(this.All.String(), "AllDisruptionMode", "AllDisruptionMode", 1) + `,`, + `}`, + }, "") + return s +} +func (this *GangSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&GangSchedulingPolicy{`, + `MinCount:` + fmt.Sprintf("%v", this.MinCount) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroup) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PodGroup{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "PodGroupSpec", "PodGroupSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "PodGroupStatus", "PodGroupStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]PodGroup{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "PodGroup", "PodGroup", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&PodGroupList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupResourceClaim) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PodGroupResourceClaim{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `ResourceClaimName:` + valueToStringGenerated(this.ResourceClaimName) + `,`, + `ResourceClaimTemplateName:` + valueToStringGenerated(this.ResourceClaimTemplateName) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupResourceClaimStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PodGroupResourceClaimStatus{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `ResourceClaimName:` + valueToStringGenerated(this.ResourceClaimName) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupSchedulingConstraints) String() string { + if this == nil { + return "nil" + } + repeatedStringForTopology := "[]TopologyConstraint{" + for _, f := range this.Topology { + repeatedStringForTopology += strings.Replace(strings.Replace(f.String(), "TopologyConstraint", "TopologyConstraint", 1), `&`, ``, 1) + "," + } + repeatedStringForTopology += "}" + s := strings.Join([]string{`&PodGroupSchedulingConstraints{`, + `Topology:` + repeatedStringForTopology + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PodGroupSchedulingPolicy{`, + `Basic:` + strings.Replace(this.Basic.String(), "BasicSchedulingPolicy", "BasicSchedulingPolicy", 1) + `,`, + `Gang:` + strings.Replace(this.Gang.String(), "GangSchedulingPolicy", "GangSchedulingPolicy", 1) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupSpec) String() string { + if this == nil { + return "nil" + } + repeatedStringForResourceClaims := "[]PodGroupResourceClaim{" + for _, f := range this.ResourceClaims { + repeatedStringForResourceClaims += strings.Replace(strings.Replace(f.String(), "PodGroupResourceClaim", "PodGroupResourceClaim", 1), `&`, ``, 1) + "," + } + repeatedStringForResourceClaims += "}" + s := strings.Join([]string{`&PodGroupSpec{`, + `ParentCompositePodGroupName:` + valueToStringGenerated(this.ParentCompositePodGroupName) + `,`, + `WorkloadRef:` + strings.Replace(this.WorkloadRef.String(), "WorkloadReference", "WorkloadReference", 1) + `,`, + `SchedulingPolicy:` + strings.Replace(strings.Replace(this.SchedulingPolicy.String(), "PodGroupSchedulingPolicy", "PodGroupSchedulingPolicy", 1), `&`, ``, 1) + `,`, + `SchedulingConstraints:` + strings.Replace(this.SchedulingConstraints.String(), "PodGroupSchedulingConstraints", "PodGroupSchedulingConstraints", 1) + `,`, + `ResourceClaims:` + repeatedStringForResourceClaims + `,`, + `DisruptionMode:` + strings.Replace(this.DisruptionMode.String(), "DisruptionMode", "DisruptionMode", 1) + `,`, + `PriorityClassName:` + fmt.Sprintf("%v", this.PriorityClassName) + `,`, + `Priority:` + valueToStringGenerated(this.Priority) + `,`, + `PreemptionPolicy:` + valueToStringGenerated(this.PreemptionPolicy) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupStatus) String() string { + if this == nil { + return "nil" + } + repeatedStringForConditions := "[]Condition{" + for _, f := range this.Conditions { + repeatedStringForConditions += fmt.Sprintf("%v", f) + "," + } + repeatedStringForConditions += "}" + repeatedStringForResourceClaimStatuses := "[]PodGroupResourceClaimStatus{" + for _, f := range this.ResourceClaimStatuses { + repeatedStringForResourceClaimStatuses += strings.Replace(strings.Replace(f.String(), "PodGroupResourceClaimStatus", "PodGroupResourceClaimStatus", 1), `&`, ``, 1) + "," + } + repeatedStringForResourceClaimStatuses += "}" + s := strings.Join([]string{`&PodGroupStatus{`, + `Conditions:` + repeatedStringForConditions + `,`, + `ResourceClaimStatuses:` + repeatedStringForResourceClaimStatuses + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupTemplate) String() string { + if this == nil { + return "nil" + } + repeatedStringForResourceClaims := "[]PodGroupResourceClaim{" + for _, f := range this.ResourceClaims { + repeatedStringForResourceClaims += strings.Replace(strings.Replace(f.String(), "PodGroupResourceClaim", "PodGroupResourceClaim", 1), `&`, ``, 1) + "," + } + repeatedStringForResourceClaims += "}" + s := strings.Join([]string{`&PodGroupTemplate{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `SchedulingPolicy:` + strings.Replace(strings.Replace(this.SchedulingPolicy.String(), "PodGroupSchedulingPolicy", "PodGroupSchedulingPolicy", 1), `&`, ``, 1) + `,`, + `SchedulingConstraints:` + strings.Replace(this.SchedulingConstraints.String(), "PodGroupSchedulingConstraints", "PodGroupSchedulingConstraints", 1) + `,`, + `ResourceClaims:` + repeatedStringForResourceClaims + `,`, + `DisruptionMode:` + strings.Replace(this.DisruptionMode.String(), "DisruptionMode", "DisruptionMode", 1) + `,`, + `PriorityClassName:` + fmt.Sprintf("%v", this.PriorityClassName) + `,`, + `Priority:` + valueToStringGenerated(this.Priority) + `,`, + `PreemptionPolicy:` + valueToStringGenerated(this.PreemptionPolicy) + `,`, + `}`, + }, "") + return s +} +func (this *SingleCompositeDisruptionMode) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&SingleCompositeDisruptionMode{`, + `}`, + }, "") + return s +} +func (this *SingleDisruptionMode) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&SingleDisruptionMode{`, + `}`, + }, "") + return s +} +func (this *TopologyConstraint) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TopologyConstraint{`, + `Key:` + fmt.Sprintf("%v", this.Key) + `,`, + `}`, + }, "") + return s +} +func (this *TypedLocalObjectReference) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TypedLocalObjectReference{`, + `APIGroup:` + fmt.Sprintf("%v", this.APIGroup) + `,`, + `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `}`, + }, "") + return s +} +func (this *Workload) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Workload{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "WorkloadSpec", "WorkloadSpec", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *WorkloadCompositePodGroupAllDisruptionMode) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WorkloadCompositePodGroupAllDisruptionMode{`, + `}`, + }, "") + return s +} +func (this *WorkloadCompositePodGroupBasicSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WorkloadCompositePodGroupBasicSchedulingPolicy{`, + `}`, + }, "") + return s +} +func (this *WorkloadCompositePodGroupDisruptionMode) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WorkloadCompositePodGroupDisruptionMode{`, + `Single:` + strings.Replace(this.Single.String(), "WorkloadCompositePodGroupSingleDisruptionMode", "WorkloadCompositePodGroupSingleDisruptionMode", 1) + `,`, + `All:` + strings.Replace(this.All.String(), "WorkloadCompositePodGroupAllDisruptionMode", "WorkloadCompositePodGroupAllDisruptionMode", 1) + `,`, + `}`, + }, "") + return s +} +func (this *WorkloadCompositePodGroupGangSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WorkloadCompositePodGroupGangSchedulingPolicy{`, + `MinGroupCount:` + valueToStringGenerated(this.MinGroupCount) + `,`, + `}`, + }, "") + return s +} +func (this *WorkloadCompositePodGroupSchedulingConstraints) String() string { + if this == nil { + return "nil" + } + repeatedStringForTopology := "[]TopologyConstraint{" + for _, f := range this.Topology { + repeatedStringForTopology += strings.Replace(strings.Replace(f.String(), "TopologyConstraint", "TopologyConstraint", 1), `&`, ``, 1) + "," + } + repeatedStringForTopology += "}" + s := strings.Join([]string{`&WorkloadCompositePodGroupSchedulingConstraints{`, + `Topology:` + repeatedStringForTopology + `,`, + `}`, + }, "") + return s +} +func (this *WorkloadCompositePodGroupSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WorkloadCompositePodGroupSchedulingPolicy{`, + `Basic:` + strings.Replace(this.Basic.String(), "WorkloadCompositePodGroupBasicSchedulingPolicy", "WorkloadCompositePodGroupBasicSchedulingPolicy", 1) + `,`, + `Gang:` + strings.Replace(this.Gang.String(), "WorkloadCompositePodGroupGangSchedulingPolicy", "WorkloadCompositePodGroupGangSchedulingPolicy", 1) + `,`, + `}`, + }, "") + return s +} +func (this *WorkloadCompositePodGroupSingleDisruptionMode) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WorkloadCompositePodGroupSingleDisruptionMode{`, + `}`, + }, "") + return s +} +func (this *WorkloadList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]Workload{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Workload", "Workload", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&WorkloadList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *WorkloadPodGroupAllDisruptionMode) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WorkloadPodGroupAllDisruptionMode{`, + `}`, + }, "") + return s +} +func (this *WorkloadPodGroupBasicSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WorkloadPodGroupBasicSchedulingPolicy{`, + `}`, + }, "") + return s +} +func (this *WorkloadPodGroupDisruptionMode) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WorkloadPodGroupDisruptionMode{`, + `Single:` + strings.Replace(this.Single.String(), "WorkloadPodGroupSingleDisruptionMode", "WorkloadPodGroupSingleDisruptionMode", 1) + `,`, + `All:` + strings.Replace(this.All.String(), "WorkloadPodGroupAllDisruptionMode", "WorkloadPodGroupAllDisruptionMode", 1) + `,`, + `}`, + }, "") + return s +} +func (this *WorkloadPodGroupGangSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WorkloadPodGroupGangSchedulingPolicy{`, + `MinCount:` + valueToStringGenerated(this.MinCount) + `,`, + `}`, + }, "") + return s +} +func (this *WorkloadPodGroupResourceClaim) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WorkloadPodGroupResourceClaim{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `ResourceClaimName:` + valueToStringGenerated(this.ResourceClaimName) + `,`, + `ResourceClaimTemplateName:` + valueToStringGenerated(this.ResourceClaimTemplateName) + `,`, + `}`, + }, "") + return s +} +func (this *WorkloadPodGroupSchedulingConstraints) String() string { + if this == nil { + return "nil" + } + repeatedStringForTopology := "[]TopologyConstraint{" + for _, f := range this.Topology { + repeatedStringForTopology += strings.Replace(strings.Replace(f.String(), "TopologyConstraint", "TopologyConstraint", 1), `&`, ``, 1) + "," + } + repeatedStringForTopology += "}" + s := strings.Join([]string{`&WorkloadPodGroupSchedulingConstraints{`, + `Topology:` + repeatedStringForTopology + `,`, + `}`, + }, "") + return s +} +func (this *WorkloadPodGroupSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WorkloadPodGroupSchedulingPolicy{`, + `Basic:` + strings.Replace(this.Basic.String(), "WorkloadPodGroupBasicSchedulingPolicy", "WorkloadPodGroupBasicSchedulingPolicy", 1) + `,`, + `Gang:` + strings.Replace(this.Gang.String(), "WorkloadPodGroupGangSchedulingPolicy", "WorkloadPodGroupGangSchedulingPolicy", 1) + `,`, + `}`, + }, "") + return s +} +func (this *WorkloadPodGroupSingleDisruptionMode) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WorkloadPodGroupSingleDisruptionMode{`, + `}`, + }, "") + return s +} +func (this *WorkloadReference) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WorkloadReference{`, + `WorkloadName:` + fmt.Sprintf("%v", this.WorkloadName) + `,`, + `TemplateName:` + fmt.Sprintf("%v", this.TemplateName) + `,`, + `}`, + }, "") + return s +} +func (this *WorkloadSpec) String() string { + if this == nil { + return "nil" + } + repeatedStringForPodGroupTemplates := "[]PodGroupTemplate{" + for _, f := range this.PodGroupTemplates { + repeatedStringForPodGroupTemplates += strings.Replace(strings.Replace(f.String(), "PodGroupTemplate", "PodGroupTemplate", 1), `&`, ``, 1) + "," + } + repeatedStringForPodGroupTemplates += "}" + repeatedStringForCompositePodGroupTemplates := "[]CompositePodGroupTemplate{" + for _, f := range this.CompositePodGroupTemplates { + repeatedStringForCompositePodGroupTemplates += strings.Replace(strings.Replace(f.String(), "CompositePodGroupTemplate", "CompositePodGroupTemplate", 1), `&`, ``, 1) + "," + } + repeatedStringForCompositePodGroupTemplates += "}" + s := strings.Join([]string{`&WorkloadSpec{`, + `ControllerRef:` + strings.Replace(this.ControllerRef.String(), "TypedLocalObjectReference", "TypedLocalObjectReference", 1) + `,`, + `PodGroupTemplates:` + repeatedStringForPodGroupTemplates + `,`, + `CompositePodGroupTemplates:` + repeatedStringForCompositePodGroupTemplates + `,`, + `}`, + }, "") + return s +} +func valueToStringGenerated(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *AllCompositeDisruptionMode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AllCompositeDisruptionMode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AllCompositeDisruptionMode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AllDisruptionMode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AllDisruptionMode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AllDisruptionMode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BasicSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BasicSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BasicSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompositeBasicSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CompositeBasicSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompositeBasicSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompositeDisruptionMode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CompositeDisruptionMode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompositeDisruptionMode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Single", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Single == nil { + m.Single = &SingleCompositeDisruptionMode{} + } + if err := m.Single.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field All", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.All == nil { + m.All = &AllCompositeDisruptionMode{} + } + if err := m.All.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompositeGangSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CompositeGangSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompositeGangSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinGroupCount", wireType) + } + m.MinGroupCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinGroupCount |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompositePodGroup) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CompositePodGroup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompositePodGroup: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompositePodGroupList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CompositePodGroupList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompositePodGroupList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, CompositePodGroup{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompositePodGroupSchedulingConstraints) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CompositePodGroupSchedulingConstraints: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompositePodGroupSchedulingConstraints: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Topology", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Topology = append(m.Topology, TopologyConstraint{}) + if err := m.Topology[len(m.Topology)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompositePodGroupSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CompositePodGroupSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompositePodGroupSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Basic", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Basic == nil { + m.Basic = &CompositeBasicSchedulingPolicy{} + } + if err := m.Basic.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Gang", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Gang == nil { + m.Gang = &CompositeGangSchedulingPolicy{} + } + if err := m.Gang.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompositePodGroupSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CompositePodGroupSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompositePodGroupSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParentCompositePodGroupName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ParentCompositePodGroupName = &s + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WorkloadRef", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.WorkloadRef == nil { + m.WorkloadRef = &WorkloadReference{} + } + if err := m.WorkloadRef.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingPolicy", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SchedulingPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingConstraints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SchedulingConstraints == nil { + m.SchedulingConstraints = &CompositePodGroupSchedulingConstraints{} + } + if err := m.SchedulingConstraints.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisruptionMode", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DisruptionMode == nil { + m.DisruptionMode = &CompositeDisruptionMode{} + } + if err := m.DisruptionMode.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PriorityClassName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PriorityClassName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Priority = &v + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PreemptionPolicy", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := PreemptionPolicy(dAtA[iNdEx:postIndex]) + m.PreemptionPolicy = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompositePodGroupStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CompositePodGroupStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompositePodGroupStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Conditions = append(m.Conditions, v1.Condition{}) + if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompositePodGroupTemplate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CompositePodGroupTemplate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompositePodGroupTemplate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingPolicy", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SchedulingPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingConstraints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SchedulingConstraints == nil { + m.SchedulingConstraints = &CompositePodGroupSchedulingConstraints{} + } + if err := m.SchedulingConstraints.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisruptionMode", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DisruptionMode == nil { + m.DisruptionMode = &CompositeDisruptionMode{} + } + if err := m.DisruptionMode.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PriorityClassName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PriorityClassName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Priority = &v + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PreemptionPolicy", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := PreemptionPolicy(dAtA[iNdEx:postIndex]) + m.PreemptionPolicy = &s + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PodGroupTemplates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PodGroupTemplates = append(m.PodGroupTemplates, PodGroupTemplate{}) + if err := m.PodGroupTemplates[len(m.PodGroupTemplates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompositePodGroupTemplates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CompositePodGroupTemplates = append(m.CompositePodGroupTemplates, CompositePodGroupTemplate{}) + if err := m.CompositePodGroupTemplates[len(m.CompositePodGroupTemplates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DisruptionMode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DisruptionMode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DisruptionMode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Single", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Single == nil { + m.Single = &SingleDisruptionMode{} + } + if err := m.Single.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field All", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.All == nil { + m.All = &AllDisruptionMode{} + } + if err := m.All.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GangSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GangSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GangSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCount", wireType) + } + m.MinCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinCount |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroup) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroup: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, PodGroup{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupResourceClaim) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupResourceClaim: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupResourceClaim: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ResourceClaimName = &s + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimTemplateName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ResourceClaimTemplateName = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupResourceClaimStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupResourceClaimStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupResourceClaimStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ResourceClaimName = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupSchedulingConstraints) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupSchedulingConstraints: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupSchedulingConstraints: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Topology", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Topology = append(m.Topology, TopologyConstraint{}) + if err := m.Topology[len(m.Topology)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Basic", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Basic == nil { + m.Basic = &BasicSchedulingPolicy{} + } + if err := m.Basic.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Gang", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Gang == nil { + m.Gang = &GangSchedulingPolicy{} + } + if err := m.Gang.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParentCompositePodGroupName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ParentCompositePodGroupName = &s + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WorkloadRef", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.WorkloadRef == nil { + m.WorkloadRef = &WorkloadReference{} + } + if err := m.WorkloadRef.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingPolicy", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SchedulingPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingConstraints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SchedulingConstraints == nil { + m.SchedulingConstraints = &PodGroupSchedulingConstraints{} + } + if err := m.SchedulingConstraints.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaims", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceClaims = append(m.ResourceClaims, PodGroupResourceClaim{}) + if err := m.ResourceClaims[len(m.ResourceClaims)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisruptionMode", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DisruptionMode == nil { + m.DisruptionMode = &DisruptionMode{} + } + if err := m.DisruptionMode.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PriorityClassName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PriorityClassName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Priority = &v + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PreemptionPolicy", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := PreemptionPolicy(dAtA[iNdEx:postIndex]) + m.PreemptionPolicy = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Conditions = append(m.Conditions, v1.Condition{}) + if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimStatuses", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceClaimStatuses = append(m.ResourceClaimStatuses, PodGroupResourceClaimStatus{}) + if err := m.ResourceClaimStatuses[len(m.ResourceClaimStatuses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupTemplate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupTemplate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupTemplate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingPolicy", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SchedulingPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingConstraints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SchedulingConstraints == nil { + m.SchedulingConstraints = &PodGroupSchedulingConstraints{} + } + if err := m.SchedulingConstraints.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaims", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceClaims = append(m.ResourceClaims, PodGroupResourceClaim{}) + if err := m.ResourceClaims[len(m.ResourceClaims)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisruptionMode", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DisruptionMode == nil { + m.DisruptionMode = &DisruptionMode{} + } + if err := m.DisruptionMode.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PriorityClassName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PriorityClassName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Priority = &v + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PreemptionPolicy", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := PreemptionPolicy(dAtA[iNdEx:postIndex]) + m.PreemptionPolicy = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SingleCompositeDisruptionMode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SingleCompositeDisruptionMode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SingleCompositeDisruptionMode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SingleDisruptionMode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SingleDisruptionMode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SingleDisruptionMode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TopologyConstraint) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TopologyConstraint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TopologyConstraint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TypedLocalObjectReference) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TypedLocalObjectReference: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TypedLocalObjectReference: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field APIGroup", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.APIGroup = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Kind = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Workload) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Workload: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Workload: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadCompositePodGroupAllDisruptionMode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadCompositePodGroupAllDisruptionMode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadCompositePodGroupAllDisruptionMode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadCompositePodGroupBasicSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadCompositePodGroupBasicSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadCompositePodGroupBasicSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadCompositePodGroupDisruptionMode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadCompositePodGroupDisruptionMode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadCompositePodGroupDisruptionMode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Single", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Single == nil { + m.Single = &WorkloadCompositePodGroupSingleDisruptionMode{} + } + if err := m.Single.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field All", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.All == nil { + m.All = &WorkloadCompositePodGroupAllDisruptionMode{} + } + if err := m.All.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadCompositePodGroupGangSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadCompositePodGroupGangSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadCompositePodGroupGangSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinGroupCount", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.MinGroupCount = &v + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadCompositePodGroupSchedulingConstraints) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadCompositePodGroupSchedulingConstraints: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadCompositePodGroupSchedulingConstraints: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Topology", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Topology = append(m.Topology, TopologyConstraint{}) + if err := m.Topology[len(m.Topology)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadCompositePodGroupSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadCompositePodGroupSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadCompositePodGroupSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Basic", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Basic == nil { + m.Basic = &WorkloadCompositePodGroupBasicSchedulingPolicy{} + } + if err := m.Basic.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Gang", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Gang == nil { + m.Gang = &WorkloadCompositePodGroupGangSchedulingPolicy{} + } + if err := m.Gang.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadCompositePodGroupSingleDisruptionMode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadCompositePodGroupSingleDisruptionMode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadCompositePodGroupSingleDisruptionMode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, Workload{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadPodGroupAllDisruptionMode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadPodGroupAllDisruptionMode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadPodGroupAllDisruptionMode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadPodGroupBasicSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadPodGroupBasicSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadPodGroupBasicSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadPodGroupDisruptionMode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadPodGroupDisruptionMode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadPodGroupDisruptionMode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Single", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Single == nil { + m.Single = &WorkloadPodGroupSingleDisruptionMode{} + } + if err := m.Single.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field All", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.All == nil { + m.All = &WorkloadPodGroupAllDisruptionMode{} + } + if err := m.All.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadPodGroupGangSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadPodGroupGangSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadPodGroupGangSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCount", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.MinCount = &v + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadPodGroupResourceClaim) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadPodGroupResourceClaim: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadPodGroupResourceClaim: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ResourceClaimName = &s + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimTemplateName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ResourceClaimTemplateName = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadPodGroupSchedulingConstraints) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadPodGroupSchedulingConstraints: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadPodGroupSchedulingConstraints: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Topology", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Topology = append(m.Topology, TopologyConstraint{}) + if err := m.Topology[len(m.Topology)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadPodGroupSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadPodGroupSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadPodGroupSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Basic", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Basic == nil { + m.Basic = &WorkloadPodGroupBasicSchedulingPolicy{} + } + if err := m.Basic.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Gang", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Gang == nil { + m.Gang = &WorkloadPodGroupGangSchedulingPolicy{} + } + if err := m.Gang.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadPodGroupSingleDisruptionMode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadPodGroupSingleDisruptionMode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadPodGroupSingleDisruptionMode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadReference) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadReference: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadReference: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WorkloadName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WorkloadName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TemplateName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TemplateName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ControllerRef", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ControllerRef == nil { + m.ControllerRef = &TypedLocalObjectReference{} + } + if err := m.ControllerRef.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PodGroupTemplates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PodGroupTemplates = append(m.PodGroupTemplates, PodGroupTemplate{}) + if err := m.PodGroupTemplates[len(m.PodGroupTemplates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompositePodGroupTemplates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CompositePodGroupTemplates = append(m.CompositePodGroupTemplates, CompositePodGroupTemplate{}) + if err := m.CompositePodGroupTemplates[len(m.CompositePodGroupTemplates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenerated(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenerated + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenerated + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenerated + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") +) diff --git a/vendor/k8s.io/api/scheduling/v1alpha3/generated.proto b/vendor/k8s.io/api/scheduling/v1alpha3/generated.proto new file mode 100644 index 0000000000..662b27b43e --- /dev/null +++ b/vendor/k8s.io/api/scheduling/v1alpha3/generated.proto @@ -0,0 +1,1353 @@ +/* +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. +*/ + + +// This file was autogenerated by go-to-protobuf. Do not edit it manually! + +syntax = "proto2"; + +package k8s.io.api.scheduling.v1alpha3; + +import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; + +// Package-wide variables from generator "generated". +option go_package = "k8s.io/api/scheduling/v1alpha3"; + +// AllCompositeDisruptionMode means that children of a CompositePodGroup can only be +// disrupted or preempted together. +message AllCompositeDisruptionMode { +} + +// AllDisruptionMode specifies that children can only be disrupted together. +message AllDisruptionMode { +} + +// BasicSchedulingPolicy indicates that standard Kubernetes +// scheduling behavior should be used. +message BasicSchedulingPolicy { +} + +// CompositeBasicSchedulingPolicy indicates that the groups belonging to the composite group +// should be scheduled independently. +message CompositeBasicSchedulingPolicy { +} + +// CompositeDisruptionMode defines how individual entities within a composite pod group can be disrupted. +// Exactly one mode must be set. +// +// +union +message CompositeDisruptionMode { + // single specifies that children groups can be disrupted independently from each other. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional SingleCompositeDisruptionMode single = 1; + + // all specifies that all children groups can only be disrupted together. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional AllCompositeDisruptionMode all = 2; +} + +// CompositeGangSchedulingPolicy indicates that the groups belonging to the composite group +// should be scheduled using all-or-nothing semantics. +message CompositeGangSchedulingPolicy { + // minGroupCount is the minimum number of child groups that must be schedulable + // or scheduled at the same time for the scheduler to admit the entire group. + // It must be a positive integer. + // + // +required + // +k8s:required + // +k8s:minimum=1 + optional int32 minGroupCount = 1; +} + +// CompositePodGroup represents a runtime instance of pod groups grouped together. +// CompositePodGroups are created by workload controllers (LWS, JobSet, etc...) from +// Workload.compositePodGroupTemplates. +// CompositePodGroup API enablement is toggled by the CompositePodGroup feature gate. +message CompositePodGroup { + // metadata is the standard object metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // spec defines the desired state of the CompositePodGroup. + // + // +required + optional CompositePodGroupSpec spec = 2; + + // status represents the current observed state of the CompositePodGroup. + // + // +optional + optional CompositePodGroupStatus status = 3; +} + +// CompositePodGroupList contains a list of CompositePodGroup resources. +message CompositePodGroupList { + // Standard list metadata. + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // Items is the list of CompositePodGroups. + repeated CompositePodGroup items = 2; +} + +// CompositePodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a CompositePodGroup. +message CompositePodGroupSchedulingConstraints { + // topology defines the topology constraints for the composite pod group. + // Currently only a single topology constraint can be specified. This may change in the future. + // + // +optional + // +k8s:optional + // +k8s:maxItems=1 + // +listType=atomic + // +k8s:listType=atomic + repeated TopologyConstraint topology = 1; +} + +// CompositePodGroupSchedulingPolicy defines the scheduling configuration for a CompositePodGroup. +// Exactly one policy must be set. +// +// +union +message CompositePodGroupSchedulingPolicy { + // basic specifies that the groups of this composite group should be scheduled independently. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + // +k8s:unionMember + optional CompositeBasicSchedulingPolicy basic = 1; + + // gang specifies that the groups of this composite group should be scheduled using + // all-or-nothing semantics. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:update=NoSet + // +k8s:update=NoUnset + optional CompositeGangSchedulingPolicy gang = 2; +} + +// CompositePodGroupSpec defines the desired state of CompositePodGroup. +message CompositePodGroupSpec { + // parentCompositePodGroupName contains the name of the parent composite pod group + // within the same namespace as this composite pod group. It must be a DNS name. + // If it's nil, then this composite pod group is a root of a workload's hierarchy. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + // +k8s:format=k8s-long-name + optional string parentCompositePodGroupName = 1; + + // workloadRef references an optional CompositePodGroup template within the + // Workload object that was used to create the CompositePodGroup. + // This field is required. + // This field is immutable. + // + // +required + // +k8s:required + // +k8s:immutable + optional WorkloadReference workloadRef = 2; + + // schedulingPolicy defines the scheduling policy for this instance of the CompositePodGroup. + // Controllers are expected to fill this field by copying it from a CompositePodGroupTemplate. + // This field is immutable. + // + // +required + // +k8s:immutable + optional CompositePodGroupSchedulingPolicy schedulingPolicy = 3; + + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this CompositePodGroup. + // Controllers are expected to fill this field by copying it from a CompositePodGroupTemplate. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + optional CompositePodGroupSchedulingConstraints schedulingConstraints = 4; + + // disruptionMode defines the mode in which a given CompositePodGroup can be disrupted. + // Controllers are expected to fill this field by copying it from a CompositePodGroupTemplate. + // One of Single, All. Defaults to Single if unset. + // This field is immutable. + // + // +default={"single": {}} + // +optional + // +k8s:optional + // +k8s:immutable + optional CompositeDisruptionMode disruptionMode = 5; + + // priorityClassName defines the priority that should be considered when scheduling this CompositePodGroup. + // Controllers are expected to fill this field by copying it from a CompositePodGroupTemplate. + // If left unspecified, it is validated and resolved similarly to the PriorityClassName field in Pods + // (i.e. if no priority class is specified, admission control can set this to the global default + // priority class if it exists. Otherwise, the composite pod group's priority will be zero). + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + // +k8s:immutable + optional string priorityClassName = 6; + + // priority is the value of priority of this composite pod group. Various system components + // use this field to find the priority of the composite pod group. When Priority Admission + // Controller is enabled, it prevents users from setting this field. The admission + // controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + // +k8s:maximum=1000000000 # HighestUserDefinablePriority + optional int32 priority = 7; + + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. + // When Priority Admission Controller is enabled, it populates this field from PriorityClassName, + // and defaults to PreemptLowerPriority if value is unset in PriorityClass. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + // + // +featureGate=PodGroupPreemptionPolicy + // +optional + // +k8s:immutable + // +k8s:ifDisabled("PodGroupPreemptionPolicy")=+k8s:forbidden + // +k8s:ifEnabled("PodGroupPreemptionPolicy")=+k8s:optional + optional string preemptionPolicy = 8; +} + +// CompositePodGroupStatus represents information about the status of a composite pod group. +message CompositePodGroupStatus { + // conditions represent the latest observations of the CompositePodGroup's state. + // + // Known condition types: + // - "CompositePodGroupInitiallyScheduled": Indicates whether the overall scheduling requirement + // for the subtree under this CompositePodGroup has been satisfied. Once this condition + // transitions to True, it serves as a terminal state and will never revert to False, + // even if pods are subsequently deleted and group constraints are no longer met. + // - "DisruptionTarget": Indicates whether the CompositePodGroup is about to be terminated + // due to disruption such as preemption. + // + // Known reasons for the CompositePodGroupInitiallyScheduled condition: + // - "Unschedulable": The CompositePodGroup's subtree could not be placed due to resource constraints, + // affinity/anti-affinity, or topological constraints. + // - "SchedulerError": The CompositePodGroup cannot be scheduled due to some internal error + // that occurred during scheduling. + // - "Invalid": Set to True when kube-scheduler detects an invalid group layout during + // runtime validation. The `message` field details the specific layout violation (such as + // a detected cycle, exceeding the maximum depth of 4, or referencing multiple distinct Workloads). + // + // Known reasons for the DisruptionTarget condition: + // - "PreemptionByScheduler": The CompositePodGroup was targeted by the scheduler's preemption loop + // to free up capacity for higher-priority preemptors. + // + // +optional + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1; +} + +// CompositePodGroupTemplate represents a template for a CompositePodGroup with a scheduling policy. +message CompositePodGroupTemplate { + // name is a unique identifier for the CompositePodGroupTemplate within the Workload. + // It must be a DNS label. This field is required. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + optional string name = 1; + + // schedulingPolicy defines the scheduling policy for this template. + // + // +required + optional CompositePodGroupSchedulingPolicy schedulingPolicy = 2; + + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this CompositePodGroupTemplate. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + optional CompositePodGroupSchedulingConstraints schedulingConstraints = 3; + + // disruptionMode defines the mode in which a given CompositePodGroup can be disrupted. + // One of Single, All. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + optional CompositeDisruptionMode disruptionMode = 4; + + // priorityClassName indicates the priority that should be considered when scheduling + // a composite pod group created from this template. If no priority class is specified, + // admission control can set this to the global default priority class if it exists. + // Otherwise, composite pod groups created from this template will have the priority set + // to zero. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + // +k8s:immutable + optional string priorityClassName = 5; + + // priority is the value of priority of composite pod groups created from this template. + // Various system components use this field to find the priority of the composite pod group. + // When Priority Admission Controller is enabled, it prevents users from setting this field. + // The admission controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:maximum=1000000000 # HighestUserDefinablePriority + // +k8s:immutable + optional int32 priority = 6; + + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + // + // +featureGate=PodGroupPreemptionPolicy + // +optional + // +k8s:immutable + // +k8s:ifDisabled("PodGroupPreemptionPolicy")=+k8s:forbidden + // +k8s:ifEnabled("PodGroupPreemptionPolicy")=+k8s:optional + optional string preemptionPolicy = 7; + + // podGroupTemplates is the list of templates for children PodGroups. + // The maximum number of templates is 8. At least one entry in CompositePodGroupTemplates + // or PodGroupTemplates must be set. + // + // +optional + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=8 + // +k8s:update=NoAddItem + // +k8s:update=NoRemoveItem + repeated PodGroupTemplate podGroupTemplates = 8; + + // compositePodGroupTemplates is the list of templates for children CompositePodGroups. + // The maximum number of templates is 8. At least one entry in CompositePodGroupTemplates + // or PodGroupTemplates must be set. + // + // +optional + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=8 + // +k8s:update=NoAddItem + // +k8s:update=NoRemoveItem + repeated CompositePodGroupTemplate compositePodGroupTemplates = 9; +} + +// DisruptionMode defines how individual entities within a group can be disrupted. +// Exactly one mode can be set. +// +// +union +message DisruptionMode { + // single specifies that children can be disrupted independently from each other. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional SingleDisruptionMode single = 1; + + // all specifies that all children can only be disrupted together. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional AllDisruptionMode all = 2; +} + +// GangSchedulingPolicy defines the parameters for gang scheduling. +message GangSchedulingPolicy { + // minCount is the minimum number of pods that must be schedulable or scheduled + // at the same time for the scheduler to admit the entire group. + // It must be a positive integer. This field is mutable to support workload scaling. + // + // Note that the scheduler operates on an eventually consistent model. Updates + // to minCount may not be immediately reflected in scheduling decisions due to + // propagation delays. If minCount is updated while a scheduling cycle is in + // progress for that group, the new value may not take effect until the next + // cycle. Moreover, minCount is only enforced during scheduling, meaning that + // modifications to this field do not affect already-scheduled pods, applying + // only to those evaluated in future cycles. + // + // +required + // +k8s:required + // +k8s:minimum=1 + optional int32 minCount = 1; +} + +// PodGroup represents a runtime instance of pods grouped together. +// PodGroups are created by workload controllers (Job, LWS, JobSet, etc...) from +// Workload.podGroupTemplates. +// PodGroup API enablement is toggled by the GenericWorkload feature gate. +message PodGroup { + // metadata is the standard object metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // spec defines the desired state of the PodGroup. + // + // +required + optional PodGroupSpec spec = 2; + + // status represents the current observed state of the PodGroup. + // + // +optional + optional PodGroupStatus status = 3; +} + +// PodGroupList contains a list of PodGroup resources. +message PodGroupList { + // Standard list metadata. + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // Items is the list of PodGroups. + repeated PodGroup items = 2; +} + +// PodGroupResourceClaim references exactly one ResourceClaim, either directly +// or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim +// for the PodGroup. +// +// It adds a name to it that uniquely identifies the ResourceClaim inside the PodGroup. +// Pods that need access to the ResourceClaim define a matching reference in its +// own Spec.ResourceClaims. The Pod's claim must match all fields of the +// PodGroup's claim exactly. +message PodGroupResourceClaim { + // name uniquely identifies this resource claim inside the PodGroup. + // This must be a DNS_LABEL. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + optional string name = 1; + + // resourceClaimName is the name of a ResourceClaim object in the same + // namespace as this PodGroup. The ResourceClaim will be reserved for the + // PodGroup instead of its individual pods. + // + // Exactly one of ResourceClaimName and ResourceClaimTemplateName must + // be set. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:format=k8s-long-name + optional string resourceClaimName = 2; + + // resourceClaimTemplateName is the name of a ResourceClaimTemplate + // object in the same namespace as this PodGroup. + // + // The template will be used to create a new ResourceClaim, which will + // be bound to this PodGroup. When this PodGroup is deleted, the ResourceClaim + // will also be deleted. The PodGroup name and resource name, along with a + // generated component, will be used to form a unique name for the + // ResourceClaim, which will be recorded in podgroup.status.resourceClaimStatuses. + // + // This field is immutable and no changes will be made to the + // corresponding ResourceClaim by the control plane after creating the + // ResourceClaim. + // + // Exactly one of ResourceClaimName and ResourceClaimTemplateName must + // be set. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:format=k8s-long-name + optional string resourceClaimTemplateName = 3; +} + +// PodGroupResourceClaimStatus is stored in the PodGroupStatus for each +// PodGroupResourceClaim which references a ResourceClaimTemplate. It stores the +// generated name for the corresponding ResourceClaim. +message PodGroupResourceClaimStatus { + // name uniquely identifies this resource claim inside the PodGroup. This + // must match the name of an entry in podgroup.spec.resourceClaims, which + // implies that the string must be a DNS_LABEL. + // + // +required + optional string name = 1; + + // resourceClaimName is the name of the ResourceClaim that was generated for + // the PodGroup in the namespace of the PodGroup. If this is unset, then + // generating a ResourceClaim was not necessary. The + // podgroup.spec.resourceClaims entry can be ignored in this case. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + optional string resourceClaimName = 2; +} + +// PodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a PodGroup. +message PodGroupSchedulingConstraints { + // topology defines the topology constraints for the pod group. + // Currently only a single topology constraint can be specified. This may change in the future. + // + // +optional + // +k8s:optional + // +k8s:maxItems=1 + // +listType=atomic + // +k8s:listType=atomic + repeated TopologyConstraint topology = 1; +} + +// PodGroupSchedulingPolicy defines the scheduling configuration for a PodGroup. +// Exactly one policy must be set. The policy is chosen at creation time by setting either the +// Basic or Gang field. The PodGroup may not change policy after creation. +// Fields within chosen policy may be updated after creation when their individual fields allow it. +// +// +union +message PodGroupSchedulingPolicy { + // basic specifies that the pods in this group should be scheduled using + // standard Kubernetes scheduling behavior. Setting this field at group creation time + // opts this group to basic scheduling; this field cannot be changed afterward. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:immutable + optional BasicSchedulingPolicy basic = 1; + + // gang specifies that the pods in this group should be scheduled using + // all-or-nothing semantics. Setting this field at group creation time + // opts this group to gang scheduling; this field cannot be set or unset afterward. + // The minCount field within Gang scheduling policy remains mutable after group creation. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:update=NoSet + // +k8s:update=NoUnset + optional GangSchedulingPolicy gang = 2; +} + +// PodGroupSpec defines the desired state of a PodGroup. +message PodGroupSpec { + // parentCompositePodGroupName contains the name of the parent composite pod group + // within the same namespace as this pod group. + // If it's nil, then this pod group is a root of a workload's hierarchy. + // This field is used only when the CompositePodGroup feature gate is enabled. + // This field is immutable. + // + // +featureGate=CompositePodGroup + // +optional + // +k8s:ifDisabled(CompositePodGroup)=+k8s:forbidden + // +k8s:ifEnabled(CompositePodGroup)=+k8s:optional + // +k8s:immutable + // +k8s:format=k8s-long-name + // +k8s:alpha(since: "1.37")=+k8s:dependentRequired("workloadRef") + optional string parentCompositePodGroupName = 1; + + // workloadRef references an optional PodGroup template within the Workload + // object that was used to create the PodGroup. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + optional WorkloadReference workloadRef = 2; + + // schedulingPolicy defines the scheduling policy for this instance of the PodGroup. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // + // +required + optional PodGroupSchedulingPolicy schedulingPolicy = 3; + + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroup. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // This field is immutable. + // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. + // + // +featureGate=TopologyAwareWorkloadScheduling + // +optional + // +k8s:ifDisabled(TopologyAwareWorkloadScheduling)=+k8s:forbidden + // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:optional + // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:immutable + optional PodGroupSchedulingConstraints schedulingConstraints = 4; + + // resourceClaims defines which ResourceClaims may be shared among Pods in + // the group. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // + // This is a beta-level field and requires that the + // DRAWorkloadResourceClaims feature gate is enabled. + // + // This field is immutable. + // + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +k8s:immutable + // +featureGate=DRAWorkloadResourceClaims + repeated PodGroupResourceClaim resourceClaims = 5; + + // disruptionMode defines the mode in which a given PodGroup can be disrupted. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // One of Single, All. Defaults to Single if unset. + // This field is immutable. + // + // +default={"single": {}} + // +optional + // +k8s:optional + // +k8s:immutable + optional DisruptionMode disruptionMode = 6; + + // priorityClassName defines the priority that should be considered when scheduling this pod group. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // Otherwise, it is validated and resolved similarly to the PriorityClassName on PodGroupTemplate + // (i.e. if no priority class is specified, admission control can set this to the global default + // priority class if it exists. Otherwise, the pod group's priority will be zero). + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + // +k8s:format=k8s-long-name + optional string priorityClassName = 7; + + // priority is the value of priority of this pod group. Various system components + // use this field to find the priority of the pod group. When Priority Admission + // Controller is enabled, it prevents users from setting this field. The admission + // controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + // +k8s:maximum=1000000000 # HighestUserDefinablePriority + optional int32 priority = 8; + + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. + // When Priority Admission Controller is enabled, it populates this field from PriorityClassName, + // and defaults to PreemptLowerPriority if value is unset in PriorityClass. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + // + // +featureGate=PodGroupPreemptionPolicy + // +optional + // +k8s:immutable + // +k8s:ifDisabled("PodGroupPreemptionPolicy")=+k8s:forbidden + // +k8s:ifEnabled("PodGroupPreemptionPolicy")=+k8s:optional + optional string preemptionPolicy = 9; +} + +// PodGroupStatus represents information about the status of a pod group. +message PodGroupStatus { + // conditions represent the latest observations of the PodGroup's state. + // + // Known condition types: + // - "PodGroupInitiallyScheduled": Indicates whether the scheduling requirement has been satisfied. + // Once this condition transitions to True, it serves as a terminal state and will never revert to False, + // even if pods are subsequently evicted and group constraints are no longer met. + // - "DisruptionTarget": Indicates whether the PodGroup is about to be terminated + // due to disruption such as preemption. + // + // Known reasons for the PodGroupInitiallyScheduled condition: + // - "Unschedulable": The PodGroup cannot be scheduled due to resource constraints, + // affinity/anti-affinity rules, or insufficient capacity for the gang. + // - "SchedulerError": The PodGroup cannot be scheduled due to some internal error + // that happened during scheduling, for example due to nodeAffinity parsing errors. + // + // Known reasons for the DisruptionTarget condition: + // - "PreemptionByScheduler": The PodGroup was preempted by the scheduler to make room for + // higher-priority PodGroups or Pods. + // + // +optional + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1; + + // resourceClaimStatuses is status of resource claims. + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +featureGate=DRAWorkloadResourceClaims + repeated PodGroupResourceClaimStatus resourceClaimStatuses = 2; +} + +// PodGroupTemplate represents a template for a set of pods with a scheduling policy. +message PodGroupTemplate { + // name is a unique identifier for the PodGroupTemplate within the Workload. + // It must be a DNS label. This field is immutable. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + optional string name = 1; + + // schedulingPolicy defines the scheduling policy for this PodGroupTemplate. + // + // +required + optional PodGroupSchedulingPolicy schedulingPolicy = 2; + + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroupTemplate. + // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. + // This field is immutable. + // + // +featureGate=TopologyAwareWorkloadScheduling + // +optional + // +k8s:ifDisabled(TopologyAwareWorkloadScheduling)=+k8s:forbidden + // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:optional + // +k8s:immutable + optional PodGroupSchedulingConstraints schedulingConstraints = 3; + + // resourceClaims defines which ResourceClaims may be shared among Pods in + // the group. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // + // This is a beta-level field and requires that the + // DRAWorkloadResourceClaims feature gate is enabled. + // + // This field is immutable. + // + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +featureGate=DRAWorkloadResourceClaims + // +k8s:immutable + repeated PodGroupResourceClaim resourceClaims = 4; + + // disruptionMode defines the mode in which a given PodGroup can be disrupted. + // One of Single, All. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + optional DisruptionMode disruptionMode = 5; + + // priorityClassName indicates the priority that should be considered when scheduling + // a pod group created from this template. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + // +k8s:immutable + optional string priorityClassName = 6; + + // priority is the value of priority of pod groups created from this template. Various + // system components use this field to find the priority of the pod group. + // The higher the value, the higher the priority. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:maximum=1000000000 # HighestUserDefinablePriority + // +k8s:immutable + optional int32 priority = 7; + + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + // + // +featureGate=PodGroupPreemptionPolicy + // +optional + // +k8s:immutable + // +k8s:ifDisabled("PodGroupPreemptionPolicy")=+k8s:forbidden + // +k8s:ifEnabled("PodGroupPreemptionPolicy")=+k8s:optional + optional string preemptionPolicy = 8; +} + +// SingleCompositeDisruptionMode means that individual children of a CompositePodGroup +// can be disrupted or preempted independently. +message SingleCompositeDisruptionMode { +} + +// SingleDisruptionMode specifies that children can be disrupted independently. +message SingleDisruptionMode { +} + +// TopologyConstraint defines a topology constraint for a PodGroup. +message TopologyConstraint { + // key specifies the key of the node label representing the topology domain. + // All pods within the PodGroup must be colocated within the same domain instance. + // Different PodGroups can land on different domain instances even if they derive from the same PodGroupTemplate. + // Examples: "topology.kubernetes.io/rack" + // + // +required + // +k8s:required + // +k8s:format=k8s-label-key + optional string key = 1; +} + +// TypedLocalObjectReference allows to reference typed object inside the same namespace. +message TypedLocalObjectReference { + // apiGroup is the group for the resource being referenced. + // If APIGroup is empty, the specified Kind must be in the core API group. + // For any other third-party types, setting APIGroup is required. + // It must be a DNS subdomain. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + optional string apiGroup = 1; + + // kind is the type of resource being referenced. + // It must be a path segment name. + // + // +required + // +k8s:required + // +k8s:format=k8s-path-segment-name + optional string kind = 2; + + // name is the name of resource being referenced. + // It must be a path segment name. + // + // +required + // +k8s:required + // +k8s:format=k8s-path-segment-name + optional string name = 3; +} + +// Workload allows for expressing scheduling constraints that should be used +// when managing the lifecycle of workloads from the scheduling perspective, +// including scheduling, preemption, eviction and other phases. +// Workload API enablement is toggled by the GenericWorkload feature gate. +message Workload { + // metadata is the standard object metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // spec defines the desired behavior of a Workload. + // + // +required + optional WorkloadSpec spec = 2; +} + +// WorkloadCompositePodGroupAllDisruptionMode indicates that all child groups +// must be disrupted together. +message WorkloadCompositePodGroupAllDisruptionMode { +} + +// WorkloadCompositePodGroupBasicSchedulingPolicy indicates that the child groups +// of a composite group should be scheduled independently. +message WorkloadCompositePodGroupBasicSchedulingPolicy { +} + +// WorkloadCompositePodGroupDisruptionMode defines how the child groups of a +// composite group can be disrupted. Exactly one mode must be set. +// +// --- +// +// This is a reusable building block meant to be embedded in a composite +// controller's own API, next to its other scheduling fields. It is the +// group-of-groups analogue of WorkloadPodGroupDisruptionMode. It's recommended +// to freeze the field after creation (+k8s:immutable), since the selected mode +// is immutable in the compiled Workload. For example, +// +// type JobSetSchedulingConfiguration struct { +// // DisruptionMode defines the mode in which this JobSet's child groups +// // can be disrupted. +// // One of Single, All. +// // This field is immutable after creation: it may not be added or removed, +// // and the selected mode may not be changed. +// // +optional +// // +k8s:optional +// // +k8s:immutable +// DisruptionMode *schedulingv1alpha3.WorkloadCompositePodGroupDisruptionMode `json:"disruptionMode,omitempty" protobuf:"bytes,N,opt,name=disruptionMode"` +// +// // other scheduling fields +// } +// +// +union +message WorkloadCompositePodGroupDisruptionMode { + // single specifies that child groups can be disrupted independently from + // each other. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional WorkloadCompositePodGroupSingleDisruptionMode single = 1; + + // all specifies that all child groups must be disrupted together. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional WorkloadCompositePodGroupAllDisruptionMode all = 2; +} + +// WorkloadCompositePodGroupGangSchedulingPolicy defines the parameters for gang +// scheduling of a composite group's child groups. +message WorkloadCompositePodGroupGangSchedulingPolicy { + // minGroupCount is the minimum number of child groups that must be + // schedulable at the same time for the scheduler to admit the entire + // composite group. + // This field is optional. If it is not specified, the controller + // should inject a context-specific sane default (e.g., the number of + // child groups). + // If set, it must be a positive integer. + // + // +optional + // +k8s:optional + // +k8s:minimum=1 + optional int32 minGroupCount = 1; +} + +// WorkloadCompositePodGroupSchedulingConstraints defines composite-level +// scheduling constraints, such as topology, for a CompositePodGroup (a group of +// groups) managed by a workload controller. +// +// --- +// +// This is a reusable building block meant to be embedded in a composite +// controller's own API, next to its other scheduling fields. It is the +// group-of-groups analogue of WorkloadPodGroupSchedulingConstraints. It's +// recommended to freeze the field after creation (+k8s:immutable), since +// constraints are immutable in the compiled Workload. For example, +// +// type JobSetSchedulingConfiguration struct { +// // SchedulingConstraints defines scheduling constraints (e.g. topology) +// // for this JobSet. +// // This field is immutable after creation. +// // +optional +// // +k8s:optional +// // +k8s:immutable +// SchedulingConstraints *schedulingv1alpha3.WorkloadCompositePodGroupSchedulingConstraints `json:"schedulingConstraints,omitempty" protobuf:"bytes,N,opt,name=schedulingConstraints"` +// +// // other scheduling fields +// } +message WorkloadCompositePodGroupSchedulingConstraints { + // topology specifies desired topological placements for all child groups + // within the composite group. + // If unset, no topology placement is requested. + // + // +optional + // +k8s:optional + // +k8s:maxItems=1 + // +listType=atomic + // +k8s:listType=atomic + repeated TopologyConstraint topology = 1; +} + +// WorkloadCompositePodGroupSchedulingPolicy defines the scheduling policy for a +// CompositePodGroup (a group of groups) managed by a workload controller. +// Exactly one policy must be set. +// +// --- +// +// This is a reusable building block meant to be embedded in a composite +// controller's own API, next to its other scheduling fields. It is the +// group-of-groups analogue of WorkloadPodGroupSchedulingPolicy. The composite +// scheduling policy is immutable, so it's recommended to freeze the whole +// field after creation (+k8s:immutable). For example, +// +// type JobSetSchedulingConfiguration struct { +// // SchedulingPolicy defines the scheduling policy for this JobSet. +// // Exactly one of Basic or Gang must be set. +// // This field is immutable after creation. +// // +optional +// // +k8s:optional +// // +k8s:immutable +// SchedulingPolicy *schedulingv1alpha3.WorkloadCompositePodGroupSchedulingPolicy `json:"schedulingPolicy,omitempty" protobuf:"bytes,N,opt,name=schedulingPolicy"` +// +// // other scheduling fields +// } +// +// +union +message WorkloadCompositePodGroupSchedulingPolicy { + // basic specifies that the child groups of this composite group should be + // scheduled independently. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional WorkloadCompositePodGroupBasicSchedulingPolicy basic = 1; + + // gang specifies that the child groups of this composite group should be + // scheduled using all-or-nothing semantics. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional WorkloadCompositePodGroupGangSchedulingPolicy gang = 2; +} + +// WorkloadCompositePodGroupSingleDisruptionMode indicates that child groups +// can be disrupted independently. +message WorkloadCompositePodGroupSingleDisruptionMode { +} + +// WorkloadList contains a list of Workload resources. +message WorkloadList { + // Standard list metadata. + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // Items is the list of Workloads. + repeated Workload items = 2; +} + +// WorkloadPodGroupAllDisruptionMode indicates that all pods in the +// group must be disrupted together. +message WorkloadPodGroupAllDisruptionMode { +} + +// WorkloadPodGroupBasicSchedulingPolicy indicates standard Kubernetes +// scheduling behavior. +message WorkloadPodGroupBasicSchedulingPolicy { +} + +// WorkloadPodGroupDisruptionMode defines how individual pods within a +// group can be disrupted. Exactly one mode must be set. +// +// --- +// +// This is a reusable building block meant to be embedded in a controller's own +// API, next to its other scheduling fields (for example, in a Job's +// spec.scheduling). It's recommended to freeze the field after creation +// (+k8s:immutable), since the selected mode is immutable in the compiled +// Workload. For example, +// +// type JobSchedulingConfiguration struct { +// // DisruptionMode defines the mode in which the Job's pods can be disrupted. +// // One of Single, All. +// // This field is immutable after creation: it may not be added or removed, +// // and the selected mode may not be changed. +// // +optional +// // +k8s:optional +// // +k8s:immutable +// DisruptionMode *schedulingv1alpha3.WorkloadPodGroupDisruptionMode `json:"disruptionMode,omitempty" protobuf:"bytes,N,opt,name=disruptionMode"` +// +// // other scheduling fields +// } +// +// +union +message WorkloadPodGroupDisruptionMode { + // single specifies that pods can be disrupted independently from each other. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional WorkloadPodGroupSingleDisruptionMode single = 1; + + // all specifies that all pods in the group must be disrupted together. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional WorkloadPodGroupAllDisruptionMode all = 2; +} + +// WorkloadPodGroupGangSchedulingPolicy defines the parameters for gang +// (all-or-nothing) scheduling. +message WorkloadPodGroupGangSchedulingPolicy { + // minCount is the minimum number of pods that must be scheduled + // at the same time for the scheduler to admit the entire group. + // This field is optional. If it is not specified, the controller + // should inject a context-specific sane default (e.g., + // parallelism for a Job). + // If set, it must be a positive integer. + // + // +optional + // +k8s:optional + // +k8s:minimum=1 + optional int32 minCount = 1; +} + +// WorkloadPodGroupResourceClaim references a dynamic resource claim +// that is shared across pods in the group. +// +// --- +// +// This is a reusable building block meant to be embedded in a controller's own +// API as a list, next to its other scheduling fields (for example, in a Job's +// spec.scheduling). It's recommended to freeze the whole list after creation +// (+k8s:immutable), since the list is immutable in the compiled Workload. For +// example, +// +// type JobSchedulingConfiguration struct { +// // ResourceClaims lists the ResourceClaims shared among the group's pods. +// // At most 4 claims may be set, matching the limit on the resulting PodGroup. +// // This list is immutable after creation: entries may neither be added, +// // removed, nor modified. +// // +optional +// // +patchMergeKey=name +// // +patchStrategy=merge +// // +listType=map +// // +listMapKey=name +// // +k8s:optional +// // +k8s:listType=map +// // +k8s:listMapKey=name +// // +k8s:maxItems=4 +// // +k8s:immutable +// ResourceClaims []schedulingv1alpha3.WorkloadPodGroupResourceClaim `json:"resourceClaims,omitempty" protobuf:"bytes,N,rep,name=resourceClaims"` +// +// // other scheduling fields +// } +message WorkloadPodGroupResourceClaim { + // name uniquely identifies this resource claim inside the group. + // This field is required. It must be a DNS_LABEL. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + optional string name = 1; + + // resourceClaimName is the name of a ResourceClaim object in the same + // namespace. + // This field is optional. If it is not specified, no resource claim + // is used. If set, it must be a DNS subdomain. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:format=k8s-long-name + optional string resourceClaimName = 2; + + // resourceClaimTemplateName is the name of a ResourceClaimTemplate + // object in the same namespace. + // This field is optional. If it is not specified, no resource claim + // template is used. If set, it must be a DNS subdomain. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:format=k8s-long-name + optional string resourceClaimTemplateName = 3; +} + +// WorkloadPodGroupSchedulingConstraints defines leaf-level scheduling +// constraints, such as topology. +// +// --- +// +// This is a reusable building block meant to be embedded in a controller's own +// API, next to its other scheduling fields (for example, in a Job's +// spec.scheduling). It's recommended to freeze the field after creation +// (+k8s:immutable), since constraints are immutable in the compiled Workload. +// For example, +// +// type JobSchedulingConfiguration struct { +// // SchedulingConstraints defines scheduling constraints (e.g. topology) +// // for the Job's pods. +// // This field is immutable after creation. +// // +optional +// // +k8s:optional +// // +k8s:immutable +// SchedulingConstraints *schedulingv1alpha3.WorkloadPodGroupSchedulingConstraints `json:"schedulingConstraints,omitempty" protobuf:"bytes,N,opt,name=schedulingConstraints"` +// +// // other scheduling fields +// } +message WorkloadPodGroupSchedulingConstraints { + // topology specifies desired topological placements for all pods + // within the pod group. + // If unset, no topology placement is requested. + // + // +optional + // +k8s:optional + // +k8s:maxItems=1 + // +listType=atomic + // +k8s:listType=atomic + repeated TopologyConstraint topology = 1; +} + +// WorkloadPodGroupSchedulingPolicy defines the scheduling policy for a +// group of pods managed by a workload controller. +// Exactly one policy must be set. +// +// --- +// +// This is a reusable building block meant to be embedded in a controller's own +// API, next to its other scheduling fields (for example, in a Job's +// spec.scheduling). It's recommended to block changing the policy +// after creation, while still allowing gang.minCount to change. DV cannot +// express that only gang.minCount is mutable while the basic/gang variant is +// frozen, so the embedder must enforce variant immutability with hand-written +// validation. For example, +// +// type JobSchedulingConfiguration struct { +// // SchedulingPolicy defines the scheduling policy for this Job. +// // Exactly one of Basic or Gang must be set. +// // This field is immutable after creation: the policy may not be added or +// // removed. The policy variant (basic/gang) is frozen by the controller's +// // hand-written validation; only schedulingPolicy.gang.minCount may be changed. +// // +optional +// // +k8s:optional +// // +k8s:update=NoSet +// // +k8s:update=NoUnset +// SchedulingPolicy *schedulingv1alpha3.WorkloadPodGroupSchedulingPolicy `json:"schedulingPolicy,omitempty" protobuf:"bytes,N,opt,name=schedulingPolicy"` +// +// // other scheduling fields +// } +// +// +union +message WorkloadPodGroupSchedulingPolicy { + // basic specifies that standard, pod-by-pod Kubernetes scheduling + // behavior should be used. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional WorkloadPodGroupBasicSchedulingPolicy basic = 1; + + // gang specifies all-or-nothing scheduling semantics. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional WorkloadPodGroupGangSchedulingPolicy gang = 2; +} + +// WorkloadPodGroupSingleDisruptionMode indicates that individual pods +// can be disrupted independently. +message WorkloadPodGroupSingleDisruptionMode { +} + +// WorkloadReference references the Workload object together with the template +// that was used to create a particular PodGroup. +message WorkloadReference { + // workloadName is the name of the Workload object that contains a template + // that was used when creating a pod group. It must + // be a DNS name. + // This field is required. + // + // +required + // +k8s:required + // +k8s:format=k8s-long-name + optional string workloadName = 1; + + // templateName is the name of a template within the Workload object that + // was used to create a pod group. It must be a DNS label. + // This field is required. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + optional string templateName = 2; +} + +// WorkloadSpec defines the desired state of a Workload. +message WorkloadSpec { + // controllerRef is an optional reference to the controlling object, such as a + // Deployment or Job. This field is intended for use by tools like CLIs + // to provide a link back to the original workload definition. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + optional TypedLocalObjectReference controllerRef = 1; + + // podGroupTemplates is the list of templates that make up the Workload. + // The maximum number of templates is 8. Templates cannot be added or removed after the workload is created. + // Existing templates may still be updated where their individual fields allow it. + // Exactly one of CompositePodGroupTemplates and PodGroupTemplates must be set. + // + // +optional + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:unionMember + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=8 + // +k8s:update=NoAddItem + // +k8s:update=NoRemoveItem + repeated PodGroupTemplate podGroupTemplates = 2; + + // compositePodGroupTemplates is the list of CompositePodGroup templates that make up the Workload. + // The maximum number of templates is 8. This field is immutable. + // Exactly one of CompositePodGroupTemplates and PodGroupTemplates must be set. + // + // This field is used only when the CompositePodGroup feature gate is enabled. + // + // +featureGate=CompositePodGroup + // +optional + // +listType=map + // +listMapKey=name + // +k8s:ifDisabled("CompositePodGroup")=+k8s:forbidden + // +k8s:ifEnabled("CompositePodGroup")=+k8s:optional + // +k8s:unionMember + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=8 + // +k8s:update=NoAddItem + // +k8s:update=NoRemoveItem + repeated CompositePodGroupTemplate compositePodGroupTemplates = 3; +} + diff --git a/vendor/k8s.io/api/scheduling/v1alpha2/register.go b/vendor/k8s.io/api/scheduling/v1alpha3/register.go similarity index 95% rename from vendor/k8s.io/api/scheduling/v1alpha2/register.go rename to vendor/k8s.io/api/scheduling/v1alpha3/register.go index fc03ae5ec9..fe3bac60e5 100644 --- a/vendor/k8s.io/api/scheduling/v1alpha2/register.go +++ b/vendor/k8s.io/api/scheduling/v1alpha3/register.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1alpha3 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -26,7 +26,7 @@ import ( const GroupName = "scheduling.k8s.io" // SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha2"} +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha3"} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { @@ -49,6 +49,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &WorkloadList{}, &PodGroup{}, &PodGroupList{}, + &CompositePodGroup{}, + &CompositePodGroupList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/vendor/k8s.io/api/scheduling/v1alpha3/types.go b/vendor/k8s.io/api/scheduling/v1alpha3/types.go new file mode 100644 index 0000000000..138659ae41 --- /dev/null +++ b/vendor/k8s.io/api/scheduling/v1alpha3/types.go @@ -0,0 +1,1429 @@ +/* +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. +*/ + +package v1alpha3 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Workload allows for expressing scheduling constraints that should be used +// when managing the lifecycle of workloads from the scheduling perspective, +// including scheduling, preemption, eviction and other phases. +// Workload API enablement is toggled by the GenericWorkload feature gate. +type Workload struct { + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // spec defines the desired behavior of a Workload. + // + // +required + Spec WorkloadSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// WorkloadList contains a list of Workload resources. +type WorkloadList struct { + metav1.TypeMeta `json:""` + // Standard list metadata. + // + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Items is the list of Workloads. + Items []Workload `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +const ( + // WorkloadMaxPodGroupTemplates is the maximum number of pod group templates per Workload. + WorkloadMaxPodGroupTemplates = 8 + // WorkloadMaxTreeDepth is the maximum allowed depth for a tree of (composite) pod group templates in a Workload. + WorkloadMaxTreeDepth = 4 +) + +// WorkloadSpec defines the desired state of a Workload. +type WorkloadSpec struct { + // controllerRef is an optional reference to the controlling object, such as a + // Deployment or Job. This field is intended for use by tools like CLIs + // to provide a link back to the original workload definition. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + ControllerRef *TypedLocalObjectReference `json:"controllerRef,omitempty" protobuf:"bytes,1,opt,name=controllerRef"` + + // podGroupTemplates is the list of templates that make up the Workload. + // The maximum number of templates is 8. Templates cannot be added or removed after the workload is created. + // Existing templates may still be updated where their individual fields allow it. + // Exactly one of CompositePodGroupTemplates and PodGroupTemplates must be set. + // + // +optional + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:unionMember + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=8 + // +k8s:update=NoAddItem + // +k8s:update=NoRemoveItem + PodGroupTemplates []PodGroupTemplate `json:"podGroupTemplates" protobuf:"bytes,2,rep,name=podGroupTemplates"` + + // compositePodGroupTemplates is the list of CompositePodGroup templates that make up the Workload. + // The maximum number of templates is 8. This field is immutable. + // Exactly one of CompositePodGroupTemplates and PodGroupTemplates must be set. + // + // This field is used only when the CompositePodGroup feature gate is enabled. + // + // +featureGate=CompositePodGroup + // +optional + // +listType=map + // +listMapKey=name + // +k8s:ifDisabled("CompositePodGroup")=+k8s:forbidden + // +k8s:ifEnabled("CompositePodGroup")=+k8s:optional + // +k8s:unionMember + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=8 + // +k8s:update=NoAddItem + // +k8s:update=NoRemoveItem + CompositePodGroupTemplates []CompositePodGroupTemplate `json:"compositePodGroupTemplates,omitempty" protobuf:"bytes,3,rep,name=compositePodGroupTemplates"` +} + +// TypedLocalObjectReference allows to reference typed object inside the same namespace. +type TypedLocalObjectReference struct { + // apiGroup is the group for the resource being referenced. + // If APIGroup is empty, the specified Kind must be in the core API group. + // For any other third-party types, setting APIGroup is required. + // It must be a DNS subdomain. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + APIGroup string `json:"apiGroup,omitempty" protobuf:"bytes,1,opt,name=apiGroup"` + // kind is the type of resource being referenced. + // It must be a path segment name. + // + // +required + // +k8s:required + // +k8s:format=k8s-path-segment-name + Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` + // name is the name of resource being referenced. + // It must be a path segment name. + // + // +required + // +k8s:required + // +k8s:format=k8s-path-segment-name + Name string `json:"name" protobuf:"bytes,3,opt,name=name"` +} + +// MaxPodGroupResourceClaims is the maximum number of resource claims for a +// PodGroup or a Workload's PodGroupTemplate. +const MaxPodGroupResourceClaims = 4 + +// PodGroupTemplate represents a template for a set of pods with a scheduling policy. +type PodGroupTemplate struct { + // name is a unique identifier for the PodGroupTemplate within the Workload. + // It must be a DNS label. This field is immutable. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + + // schedulingPolicy defines the scheduling policy for this PodGroupTemplate. + // + // +required + SchedulingPolicy PodGroupSchedulingPolicy `json:"schedulingPolicy" protobuf:"bytes,2,opt,name=schedulingPolicy"` + + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroupTemplate. + // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. + // This field is immutable. + // + // +featureGate=TopologyAwareWorkloadScheduling + // +optional + // +k8s:ifDisabled(TopologyAwareWorkloadScheduling)=+k8s:forbidden + // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:optional + // +k8s:immutable + SchedulingConstraints *PodGroupSchedulingConstraints `json:"schedulingConstraints" protobuf:"bytes,3,opt,name=schedulingConstraints"` + + // resourceClaims defines which ResourceClaims may be shared among Pods in + // the group. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // + // This is a beta-level field and requires that the + // DRAWorkloadResourceClaims feature gate is enabled. + // + // This field is immutable. + // + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +featureGate=DRAWorkloadResourceClaims + // +k8s:immutable + ResourceClaims []PodGroupResourceClaim `json:"resourceClaims,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name" protobuf:"bytes,4,rep,name=resourceClaims"` + + // disruptionMode defines the mode in which a given PodGroup can be disrupted. + // One of Single, All. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + DisruptionMode *DisruptionMode `json:"disruptionMode,omitempty" protobuf:"bytes,5,opt,name=disruptionMode"` + + // priorityClassName indicates the priority that should be considered when scheduling + // a pod group created from this template. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + // +k8s:immutable + PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,6,opt,name=priorityClassName"` + + // priority is the value of priority of pod groups created from this template. Various + // system components use this field to find the priority of the pod group. + // The higher the value, the higher the priority. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:maximum=1000000000 # HighestUserDefinablePriority + // +k8s:immutable + Priority *int32 `json:"priority,omitempty" protobuf:"varint,7,opt,name=priority"` + + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + // + // +featureGate=PodGroupPreemptionPolicy + // +optional + // +k8s:immutable + // +k8s:ifDisabled("PodGroupPreemptionPolicy")=+k8s:forbidden + // +k8s:ifEnabled("PodGroupPreemptionPolicy")=+k8s:optional + PreemptionPolicy *PreemptionPolicy `json:"preemptionPolicy,omitempty" protobuf:"bytes,8,opt,name=preemptionPolicy"` +} + +// CompositePodGroupTemplate represents a template for a CompositePodGroup with a scheduling policy. +type CompositePodGroupTemplate struct { + // name is a unique identifier for the CompositePodGroupTemplate within the Workload. + // It must be a DNS label. This field is required. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + + // schedulingPolicy defines the scheduling policy for this template. + // + // +required + SchedulingPolicy CompositePodGroupSchedulingPolicy `json:"schedulingPolicy" protobuf:"bytes,2,opt,name=schedulingPolicy"` + + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this CompositePodGroupTemplate. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + SchedulingConstraints *CompositePodGroupSchedulingConstraints `json:"schedulingConstraints,omitempty" protobuf:"bytes,3,opt,name=schedulingConstraints"` + + // disruptionMode defines the mode in which a given CompositePodGroup can be disrupted. + // One of Single, All. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + DisruptionMode *CompositeDisruptionMode `json:"disruptionMode,omitempty" protobuf:"bytes,4,opt,name=disruptionMode"` + + // priorityClassName indicates the priority that should be considered when scheduling + // a composite pod group created from this template. If no priority class is specified, + // admission control can set this to the global default priority class if it exists. + // Otherwise, composite pod groups created from this template will have the priority set + // to zero. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + // +k8s:immutable + PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,5,opt,name=priorityClassName"` + + // priority is the value of priority of composite pod groups created from this template. + // Various system components use this field to find the priority of the composite pod group. + // When Priority Admission Controller is enabled, it prevents users from setting this field. + // The admission controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:maximum=1000000000 # HighestUserDefinablePriority + // +k8s:immutable + Priority *int32 `json:"priority,omitempty" protobuf:"varint,6,opt,name=priority"` + + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + // + // +featureGate=PodGroupPreemptionPolicy + // +optional + // +k8s:immutable + // +k8s:ifDisabled("PodGroupPreemptionPolicy")=+k8s:forbidden + // +k8s:ifEnabled("PodGroupPreemptionPolicy")=+k8s:optional + PreemptionPolicy *PreemptionPolicy `json:"preemptionPolicy,omitempty" protobuf:"bytes,7,opt,name=preemptionPolicy"` + + // podGroupTemplates is the list of templates for children PodGroups. + // The maximum number of templates is 8. At least one entry in CompositePodGroupTemplates + // or PodGroupTemplates must be set. + // + // +optional + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=8 + // +k8s:update=NoAddItem + // +k8s:update=NoRemoveItem + PodGroupTemplates []PodGroupTemplate `json:"podGroupTemplates,omitempty" protobuf:"bytes,8,rep,name=podGroupTemplates"` + + // compositePodGroupTemplates is the list of templates for children CompositePodGroups. + // The maximum number of templates is 8. At least one entry in CompositePodGroupTemplates + // or PodGroupTemplates must be set. + // + // +optional + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=8 + // +k8s:update=NoAddItem + // +k8s:update=NoRemoveItem + CompositePodGroupTemplates []CompositePodGroupTemplate `json:"compositePodGroupTemplates,omitempty" protobuf:"bytes,9,rep,name=compositePodGroupTemplates"` +} + +// PodGroupSchedulingPolicy defines the scheduling configuration for a PodGroup. +// Exactly one policy must be set. The policy is chosen at creation time by setting either the +// Basic or Gang field. The PodGroup may not change policy after creation. +// Fields within chosen policy may be updated after creation when their individual fields allow it. +// +// +union +type PodGroupSchedulingPolicy struct { + // basic specifies that the pods in this group should be scheduled using + // standard Kubernetes scheduling behavior. Setting this field at group creation time + // opts this group to basic scheduling; this field cannot be changed afterward. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:immutable + Basic *BasicSchedulingPolicy `json:"basic,omitempty" protobuf:"bytes,1,opt,name=basic"` + + // gang specifies that the pods in this group should be scheduled using + // all-or-nothing semantics. Setting this field at group creation time + // opts this group to gang scheduling; this field cannot be set or unset afterward. + // The minCount field within Gang scheduling policy remains mutable after group creation. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:update=NoSet + // +k8s:update=NoUnset + Gang *GangSchedulingPolicy `json:"gang,omitempty" protobuf:"bytes,2,opt,name=gang"` +} + +// BasicSchedulingPolicy indicates that standard Kubernetes +// scheduling behavior should be used. +type BasicSchedulingPolicy struct { + // This is intentionally empty. Its presence indicates that the basic + // scheduling policy should be applied. In the future, new fields may appear, + // describing such constraints on a pod group level without "all or nothing" + // (gang) scheduling. +} + +// GangSchedulingPolicy defines the parameters for gang scheduling. +type GangSchedulingPolicy struct { + // minCount is the minimum number of pods that must be schedulable or scheduled + // at the same time for the scheduler to admit the entire group. + // It must be a positive integer. This field is mutable to support workload scaling. + // + // Note that the scheduler operates on an eventually consistent model. Updates + // to minCount may not be immediately reflected in scheduling decisions due to + // propagation delays. If minCount is updated while a scheduling cycle is in + // progress for that group, the new value may not take effect until the next + // cycle. Moreover, minCount is only enforced during scheduling, meaning that + // modifications to this field do not affect already-scheduled pods, applying + // only to those evaluated in future cycles. + // + // +required + // +k8s:required + // +k8s:minimum=1 + MinCount int32 `json:"minCount" protobuf:"varint,1,opt,name=minCount"` +} + +// PodGroupResourceClaim references exactly one ResourceClaim, either directly +// or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim +// for the PodGroup. +// +// It adds a name to it that uniquely identifies the ResourceClaim inside the PodGroup. +// Pods that need access to the ResourceClaim define a matching reference in its +// own Spec.ResourceClaims. The Pod's claim must match all fields of the +// PodGroup's claim exactly. +type PodGroupResourceClaim struct { + // name uniquely identifies this resource claim inside the PodGroup. + // This must be a DNS_LABEL. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + + // resourceClaimName is the name of a ResourceClaim object in the same + // namespace as this PodGroup. The ResourceClaim will be reserved for the + // PodGroup instead of its individual pods. + // + // Exactly one of ResourceClaimName and ResourceClaimTemplateName must + // be set. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:format=k8s-long-name + ResourceClaimName *string `json:"resourceClaimName,omitempty" protobuf:"bytes,2,opt,name=resourceClaimName"` + + // resourceClaimTemplateName is the name of a ResourceClaimTemplate + // object in the same namespace as this PodGroup. + // + // The template will be used to create a new ResourceClaim, which will + // be bound to this PodGroup. When this PodGroup is deleted, the ResourceClaim + // will also be deleted. The PodGroup name and resource name, along with a + // generated component, will be used to form a unique name for the + // ResourceClaim, which will be recorded in podgroup.status.resourceClaimStatuses. + // + // This field is immutable and no changes will be made to the + // corresponding ResourceClaim by the control plane after creating the + // ResourceClaim. + // + // Exactly one of ResourceClaimName and ResourceClaimTemplateName must + // be set. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:format=k8s-long-name + ResourceClaimTemplateName *string `json:"resourceClaimTemplateName,omitempty" protobuf:"bytes,3,opt,name=resourceClaimTemplateName"` +} + +// DisruptionMode defines how individual entities within a group can be disrupted. +// Exactly one mode can be set. +// +// +union +type DisruptionMode struct { + // single specifies that children can be disrupted independently from each other. + // + // +optional + // +k8s:optional + // +k8s:unionMember + Single *SingleDisruptionMode `json:"single,omitempty" protobuf:"bytes,1,opt,name=single"` + + // all specifies that all children can only be disrupted together. + // + // +optional + // +k8s:optional + // +k8s:unionMember + All *AllDisruptionMode `json:"all,omitempty" protobuf:"bytes,2,opt,name=all"` +} + +// SingleDisruptionMode specifies that children can be disrupted independently. +type SingleDisruptionMode struct { + // Intentionally empty now. +} + +// AllDisruptionMode specifies that children can only be disrupted together. +type AllDisruptionMode struct { + // Intentionally empty now. +} + +// PreemptionPolicy describes a policy for if/when to preempt a pod. +// +enum +// +k8s:enum +type PreemptionPolicy string + +const ( + // PreemptLowerPriority means that pod can preempt other pods with lower priority. + PreemptLowerPriority PreemptionPolicy = "PreemptLowerPriority" + // PreemptNever means that pod never preempts other pods with lower priority. + PreemptNever PreemptionPolicy = "Never" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:supportsSubresource="/status" + +// PodGroup represents a runtime instance of pods grouped together. +// PodGroups are created by workload controllers (Job, LWS, JobSet, etc...) from +// Workload.podGroupTemplates. +// PodGroup API enablement is toggled by the GenericWorkload feature gate. +type PodGroup struct { + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // spec defines the desired state of the PodGroup. + // + // +required + Spec PodGroupSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` + + // status represents the current observed state of the PodGroup. + // + // +optional + Status PodGroupStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PodGroupList contains a list of PodGroup resources. +type PodGroupList struct { + metav1.TypeMeta `json:""` + // Standard list metadata. + // + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Items is the list of PodGroups. + Items []PodGroup `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// PodGroupSpec defines the desired state of a PodGroup. +type PodGroupSpec struct { + // parentCompositePodGroupName contains the name of the parent composite pod group + // within the same namespace as this pod group. + // If it's nil, then this pod group is a root of a workload's hierarchy. + // This field is used only when the CompositePodGroup feature gate is enabled. + // This field is immutable. + // + // +featureGate=CompositePodGroup + // +optional + // +k8s:ifDisabled(CompositePodGroup)=+k8s:forbidden + // +k8s:ifEnabled(CompositePodGroup)=+k8s:optional + // +k8s:immutable + // +k8s:format=k8s-long-name + // +k8s:alpha(since: "1.37")=+k8s:dependentRequired("workloadRef") + ParentCompositePodGroupName *string `json:"parentCompositePodGroupName,omitempty" protobuf:"bytes,1,opt,name=parentCompositePodGroupName"` + + // workloadRef references an optional PodGroup template within the Workload + // object that was used to create the PodGroup. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + WorkloadRef *WorkloadReference `json:"workloadRef,omitempty" protobuf:"bytes,2,opt,name=workloadRef"` + + // schedulingPolicy defines the scheduling policy for this instance of the PodGroup. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // + // +required + SchedulingPolicy PodGroupSchedulingPolicy `json:"schedulingPolicy" protobuf:"bytes,3,opt,name=schedulingPolicy"` + + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroup. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // This field is immutable. + // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. + // + // +featureGate=TopologyAwareWorkloadScheduling + // +optional + // +k8s:ifDisabled(TopologyAwareWorkloadScheduling)=+k8s:forbidden + // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:optional + // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:immutable + SchedulingConstraints *PodGroupSchedulingConstraints `json:"schedulingConstraints,omitempty" protobuf:"bytes,4,opt,name=schedulingConstraints"` + + // resourceClaims defines which ResourceClaims may be shared among Pods in + // the group. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // + // This is a beta-level field and requires that the + // DRAWorkloadResourceClaims feature gate is enabled. + // + // This field is immutable. + // + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +k8s:immutable + // +featureGate=DRAWorkloadResourceClaims + ResourceClaims []PodGroupResourceClaim `json:"resourceClaims,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name" protobuf:"bytes,5,rep,name=resourceClaims"` + + // disruptionMode defines the mode in which a given PodGroup can be disrupted. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // One of Single, All. Defaults to Single if unset. + // This field is immutable. + // + // +default={"single": {}} + // +optional + // +k8s:optional + // +k8s:immutable + DisruptionMode *DisruptionMode `json:"disruptionMode,omitempty" protobuf:"bytes,6,opt,name=disruptionMode"` + + // priorityClassName defines the priority that should be considered when scheduling this pod group. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // Otherwise, it is validated and resolved similarly to the PriorityClassName on PodGroupTemplate + // (i.e. if no priority class is specified, admission control can set this to the global default + // priority class if it exists. Otherwise, the pod group's priority will be zero). + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + // +k8s:format=k8s-long-name + PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,7,opt,name=priorityClassName"` + + // priority is the value of priority of this pod group. Various system components + // use this field to find the priority of the pod group. When Priority Admission + // Controller is enabled, it prevents users from setting this field. The admission + // controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + // +k8s:maximum=1000000000 # HighestUserDefinablePriority + Priority *int32 `json:"priority,omitempty" protobuf:"varint,8,opt,name=priority"` + + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. + // When Priority Admission Controller is enabled, it populates this field from PriorityClassName, + // and defaults to PreemptLowerPriority if value is unset in PriorityClass. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + // + // +featureGate=PodGroupPreemptionPolicy + // +optional + // +k8s:immutable + // +k8s:ifDisabled("PodGroupPreemptionPolicy")=+k8s:forbidden + // +k8s:ifEnabled("PodGroupPreemptionPolicy")=+k8s:optional + PreemptionPolicy *PreemptionPolicy `json:"preemptionPolicy,omitempty" protobuf:"bytes,9,opt,name=preemptionPolicy"` +} + +// PodGroupStatus represents information about the status of a pod group. +type PodGroupStatus struct { + // conditions represent the latest observations of the PodGroup's state. + // + // Known condition types: + // - "PodGroupInitiallyScheduled": Indicates whether the scheduling requirement has been satisfied. + // Once this condition transitions to True, it serves as a terminal state and will never revert to False, + // even if pods are subsequently evicted and group constraints are no longer met. + // - "DisruptionTarget": Indicates whether the PodGroup is about to be terminated + // due to disruption such as preemption. + // + // Known reasons for the PodGroupInitiallyScheduled condition: + // - "Unschedulable": The PodGroup cannot be scheduled due to resource constraints, + // affinity/anti-affinity rules, or insufficient capacity for the gang. + // - "SchedulerError": The PodGroup cannot be scheduled due to some internal error + // that happened during scheduling, for example due to nodeAffinity parsing errors. + // + // Known reasons for the DisruptionTarget condition: + // - "PreemptionByScheduler": The PodGroup was preempted by the scheduler to make room for + // higher-priority PodGroups or Pods. + // + // +optional + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + + // resourceClaimStatuses is status of resource claims. + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +featureGate=DRAWorkloadResourceClaims + ResourceClaimStatuses []PodGroupResourceClaimStatus `json:"resourceClaimStatuses,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name" protobuf:"bytes,2,rep,name=resourceClaimStatuses"` +} + +// Well-known condition types for PodGroups. +const ( + // PodGroupInitiallyScheduled represents status of the scheduling process for this PodGroup till first success. + PodGroupInitiallyScheduled string = "PodGroupInitiallyScheduled" + // DisruptionTarget indicates the PodGroup is about to be terminated due to disruption + // such as preemption. + DisruptionTarget string = "DisruptionTarget" +) + +// Well-known condition reasons for PodGroups. +const ( + // Unschedulable reason in the PodGroupInitiallyScheduled condition indicates that the PodGroup cannot be scheduled + // due to resource constraints, affinity/anti-affinity rules, or insufficient capacity for the PodGroup. + PodGroupReasonUnschedulable string = "Unschedulable" + // SchedulerError reason in the PodGroupInitiallyScheduled condition means that some internal error happens + // during scheduling, for example due to nodeAffinity parsing errors. + PodGroupReasonSchedulerError string = "SchedulerError" + // PreemptionByScheduler reason in the DisruptionTarget condition indicates the PodGroup was preempted + // to make room for higher-priority PodGroups or Pods. + PodGroupReasonPreemptionByScheduler string = "PreemptionByScheduler" +) + +// PodGroupResourceClaimStatus is stored in the PodGroupStatus for each +// PodGroupResourceClaim which references a ResourceClaimTemplate. It stores the +// generated name for the corresponding ResourceClaim. +type PodGroupResourceClaimStatus struct { + // name uniquely identifies this resource claim inside the PodGroup. This + // must match the name of an entry in podgroup.spec.resourceClaims, which + // implies that the string must be a DNS_LABEL. + // + // +required + Name string `json:"name" protobuf:"bytes,1,name=name"` + + // resourceClaimName is the name of the ResourceClaim that was generated for + // the PodGroup in the namespace of the PodGroup. If this is unset, then + // generating a ResourceClaim was not necessary. The + // podgroup.spec.resourceClaims entry can be ignored in this case. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + ResourceClaimName *string `json:"resourceClaimName,omitempty" protobuf:"bytes,2,opt,name=resourceClaimName"` +} + +// WorkloadReference references the Workload object together with the template +// that was used to create a particular PodGroup. +type WorkloadReference struct { + // workloadName is the name of the Workload object that contains a template + // that was used when creating a pod group. It must + // be a DNS name. + // This field is required. + // + // +required + // +k8s:required + // +k8s:format=k8s-long-name + WorkloadName string `json:"workloadName" protobuf:"bytes,1,opt,name=workloadName"` + + // templateName is the name of a template within the Workload object that + // was used to create a pod group. It must be a DNS label. + // This field is required. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + TemplateName string `json:"templateName" protobuf:"bytes,2,opt,name=templateName"` +} + +// PodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a PodGroup. +type PodGroupSchedulingConstraints struct { + // topology defines the topology constraints for the pod group. + // Currently only a single topology constraint can be specified. This may change in the future. + // + // +optional + // +k8s:optional + // +k8s:maxItems=1 + // +listType=atomic + // +k8s:listType=atomic + Topology []TopologyConstraint `json:"topology,omitempty" protobuf:"bytes,1,rep,name=topology"` +} + +// TopologyConstraint defines a topology constraint for a PodGroup. +type TopologyConstraint struct { + // key specifies the key of the node label representing the topology domain. + // All pods within the PodGroup must be colocated within the same domain instance. + // Different PodGroups can land on different domain instances even if they derive from the same PodGroupTemplate. + // Examples: "topology.kubernetes.io/rack" + // + // +required + // +k8s:required + // +k8s:format=k8s-label-key + Key string `json:"key" protobuf:"bytes,1,opt,name=key"` +} + +// WorkloadPodGroupSchedulingPolicy defines the scheduling policy for a +// group of pods managed by a workload controller. +// Exactly one policy must be set. +// +// --- +// +// This is a reusable building block meant to be embedded in a controller's own +// API, next to its other scheduling fields (for example, in a Job's +// spec.scheduling). It's recommended to block changing the policy +// after creation, while still allowing gang.minCount to change. DV cannot +// express that only gang.minCount is mutable while the basic/gang variant is +// frozen, so the embedder must enforce variant immutability with hand-written +// validation. For example, +// +// type JobSchedulingConfiguration struct { +// // SchedulingPolicy defines the scheduling policy for this Job. +// // Exactly one of Basic or Gang must be set. +// // This field is immutable after creation: the policy may not be added or +// // removed. The policy variant (basic/gang) is frozen by the controller's +// // hand-written validation; only schedulingPolicy.gang.minCount may be changed. +// // +optional +// // +k8s:optional +// // +k8s:update=NoSet +// // +k8s:update=NoUnset +// SchedulingPolicy *schedulingv1alpha3.WorkloadPodGroupSchedulingPolicy `json:"schedulingPolicy,omitempty" protobuf:"bytes,N,opt,name=schedulingPolicy"` +// +// // other scheduling fields +// } +// +// +union +type WorkloadPodGroupSchedulingPolicy struct { + // basic specifies that standard, pod-by-pod Kubernetes scheduling + // behavior should be used. + // + // +optional + // +k8s:optional + // +k8s:unionMember + Basic *WorkloadPodGroupBasicSchedulingPolicy `json:"basic,omitempty" protobuf:"bytes,1,opt,name=basic"` + + // gang specifies all-or-nothing scheduling semantics. + // + // +optional + // +k8s:optional + // +k8s:unionMember + Gang *WorkloadPodGroupGangSchedulingPolicy `json:"gang,omitempty" protobuf:"bytes,2,opt,name=gang"` +} + +// WorkloadPodGroupBasicSchedulingPolicy indicates standard Kubernetes +// scheduling behavior. +type WorkloadPodGroupBasicSchedulingPolicy struct { + // Intentionally empty for now. +} + +// WorkloadPodGroupGangSchedulingPolicy defines the parameters for gang +// (all-or-nothing) scheduling. +type WorkloadPodGroupGangSchedulingPolicy struct { + // minCount is the minimum number of pods that must be scheduled + // at the same time for the scheduler to admit the entire group. + // This field is optional. If it is not specified, the controller + // should inject a context-specific sane default (e.g., + // parallelism for a Job). + // If set, it must be a positive integer. + // + // +optional + // +k8s:optional + // +k8s:minimum=1 + MinCount *int32 `json:"minCount,omitempty" protobuf:"varint,1,opt,name=minCount"` +} + +// WorkloadPodGroupSchedulingConstraints defines leaf-level scheduling +// constraints, such as topology. +// +// --- +// +// This is a reusable building block meant to be embedded in a controller's own +// API, next to its other scheduling fields (for example, in a Job's +// spec.scheduling). It's recommended to freeze the field after creation +// (+k8s:immutable), since constraints are immutable in the compiled Workload. +// For example, +// +// type JobSchedulingConfiguration struct { +// // SchedulingConstraints defines scheduling constraints (e.g. topology) +// // for the Job's pods. +// // This field is immutable after creation. +// // +optional +// // +k8s:optional +// // +k8s:immutable +// SchedulingConstraints *schedulingv1alpha3.WorkloadPodGroupSchedulingConstraints `json:"schedulingConstraints,omitempty" protobuf:"bytes,N,opt,name=schedulingConstraints"` +// +// // other scheduling fields +// } +type WorkloadPodGroupSchedulingConstraints struct { + // topology specifies desired topological placements for all pods + // within the pod group. + // If unset, no topology placement is requested. + // + // +optional + // +k8s:optional + // +k8s:maxItems=1 + // +listType=atomic + // +k8s:listType=atomic + Topology []TopologyConstraint `json:"topology,omitempty" protobuf:"bytes,1,rep,name=topology"` +} + +// WorkloadPodGroupResourceClaim references a dynamic resource claim +// that is shared across pods in the group. +// +// --- +// +// This is a reusable building block meant to be embedded in a controller's own +// API as a list, next to its other scheduling fields (for example, in a Job's +// spec.scheduling). It's recommended to freeze the whole list after creation +// (+k8s:immutable), since the list is immutable in the compiled Workload. For +// example, +// +// type JobSchedulingConfiguration struct { +// // ResourceClaims lists the ResourceClaims shared among the group's pods. +// // At most 4 claims may be set, matching the limit on the resulting PodGroup. +// // This list is immutable after creation: entries may neither be added, +// // removed, nor modified. +// // +optional +// // +patchMergeKey=name +// // +patchStrategy=merge +// // +listType=map +// // +listMapKey=name +// // +k8s:optional +// // +k8s:listType=map +// // +k8s:listMapKey=name +// // +k8s:maxItems=4 +// // +k8s:immutable +// ResourceClaims []schedulingv1alpha3.WorkloadPodGroupResourceClaim `json:"resourceClaims,omitempty" protobuf:"bytes,N,rep,name=resourceClaims"` +// +// // other scheduling fields +// } +type WorkloadPodGroupResourceClaim struct { + // name uniquely identifies this resource claim inside the group. + // This field is required. It must be a DNS_LABEL. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + + // resourceClaimName is the name of a ResourceClaim object in the same + // namespace. + // This field is optional. If it is not specified, no resource claim + // is used. If set, it must be a DNS subdomain. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:format=k8s-long-name + ResourceClaimName *string `json:"resourceClaimName,omitempty" protobuf:"bytes,2,opt,name=resourceClaimName"` + + // resourceClaimTemplateName is the name of a ResourceClaimTemplate + // object in the same namespace. + // This field is optional. If it is not specified, no resource claim + // template is used. If set, it must be a DNS subdomain. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:format=k8s-long-name + ResourceClaimTemplateName *string `json:"resourceClaimTemplateName,omitempty" protobuf:"bytes,3,opt,name=resourceClaimTemplateName"` +} + +// WorkloadPodGroupDisruptionMode defines how individual pods within a +// group can be disrupted. Exactly one mode must be set. +// +// --- +// +// This is a reusable building block meant to be embedded in a controller's own +// API, next to its other scheduling fields (for example, in a Job's +// spec.scheduling). It's recommended to freeze the field after creation +// (+k8s:immutable), since the selected mode is immutable in the compiled +// Workload. For example, +// +// type JobSchedulingConfiguration struct { +// // DisruptionMode defines the mode in which the Job's pods can be disrupted. +// // One of Single, All. +// // This field is immutable after creation: it may not be added or removed, +// // and the selected mode may not be changed. +// // +optional +// // +k8s:optional +// // +k8s:immutable +// DisruptionMode *schedulingv1alpha3.WorkloadPodGroupDisruptionMode `json:"disruptionMode,omitempty" protobuf:"bytes,N,opt,name=disruptionMode"` +// +// // other scheduling fields +// } +// +// +union +type WorkloadPodGroupDisruptionMode struct { + // single specifies that pods can be disrupted independently from each other. + // + // +optional + // +k8s:optional + // +k8s:unionMember + Single *WorkloadPodGroupSingleDisruptionMode `json:"single,omitempty" protobuf:"bytes,1,opt,name=single"` + + // all specifies that all pods in the group must be disrupted together. + // + // +optional + // +k8s:optional + // +k8s:unionMember + All *WorkloadPodGroupAllDisruptionMode `json:"all,omitempty" protobuf:"bytes,2,opt,name=all"` +} + +// WorkloadPodGroupSingleDisruptionMode indicates that individual pods +// can be disrupted independently. +type WorkloadPodGroupSingleDisruptionMode struct { + // Intentionally empty for now. +} + +// WorkloadPodGroupAllDisruptionMode indicates that all pods in the +// group must be disrupted together. +type WorkloadPodGroupAllDisruptionMode struct { + // Intentionally empty for now. +} + +// WorkloadCompositePodGroupSchedulingPolicy defines the scheduling policy for a +// CompositePodGroup (a group of groups) managed by a workload controller. +// Exactly one policy must be set. +// +// --- +// +// This is a reusable building block meant to be embedded in a composite +// controller's own API, next to its other scheduling fields. It is the +// group-of-groups analogue of WorkloadPodGroupSchedulingPolicy. The composite +// scheduling policy is immutable, so it's recommended to freeze the whole +// field after creation (+k8s:immutable). For example, +// +// type JobSetSchedulingConfiguration struct { +// // SchedulingPolicy defines the scheduling policy for this JobSet. +// // Exactly one of Basic or Gang must be set. +// // This field is immutable after creation. +// // +optional +// // +k8s:optional +// // +k8s:immutable +// SchedulingPolicy *schedulingv1alpha3.WorkloadCompositePodGroupSchedulingPolicy `json:"schedulingPolicy,omitempty" protobuf:"bytes,N,opt,name=schedulingPolicy"` +// +// // other scheduling fields +// } +// +// +union +type WorkloadCompositePodGroupSchedulingPolicy struct { + // basic specifies that the child groups of this composite group should be + // scheduled independently. + // + // +optional + // +k8s:optional + // +k8s:unionMember + Basic *WorkloadCompositePodGroupBasicSchedulingPolicy `json:"basic,omitempty" protobuf:"bytes,1,opt,name=basic"` + + // gang specifies that the child groups of this composite group should be + // scheduled using all-or-nothing semantics. + // + // +optional + // +k8s:optional + // +k8s:unionMember + Gang *WorkloadCompositePodGroupGangSchedulingPolicy `json:"gang,omitempty" protobuf:"bytes,2,opt,name=gang"` +} + +// WorkloadCompositePodGroupBasicSchedulingPolicy indicates that the child groups +// of a composite group should be scheduled independently. +type WorkloadCompositePodGroupBasicSchedulingPolicy struct { + // Intentionally empty for now. +} + +// WorkloadCompositePodGroupGangSchedulingPolicy defines the parameters for gang +// scheduling of a composite group's child groups. +type WorkloadCompositePodGroupGangSchedulingPolicy struct { + // minGroupCount is the minimum number of child groups that must be + // schedulable at the same time for the scheduler to admit the entire + // composite group. + // This field is optional. If it is not specified, the controller + // should inject a context-specific sane default (e.g., the number of + // child groups). + // If set, it must be a positive integer. + // + // +optional + // +k8s:optional + // +k8s:minimum=1 + MinGroupCount *int32 `json:"minGroupCount,omitempty" protobuf:"varint,1,opt,name=minGroupCount"` +} + +// WorkloadCompositePodGroupSchedulingConstraints defines composite-level +// scheduling constraints, such as topology, for a CompositePodGroup (a group of +// groups) managed by a workload controller. +// +// --- +// +// This is a reusable building block meant to be embedded in a composite +// controller's own API, next to its other scheduling fields. It is the +// group-of-groups analogue of WorkloadPodGroupSchedulingConstraints. It's +// recommended to freeze the field after creation (+k8s:immutable), since +// constraints are immutable in the compiled Workload. For example, +// +// type JobSetSchedulingConfiguration struct { +// // SchedulingConstraints defines scheduling constraints (e.g. topology) +// // for this JobSet. +// // This field is immutable after creation. +// // +optional +// // +k8s:optional +// // +k8s:immutable +// SchedulingConstraints *schedulingv1alpha3.WorkloadCompositePodGroupSchedulingConstraints `json:"schedulingConstraints,omitempty" protobuf:"bytes,N,opt,name=schedulingConstraints"` +// +// // other scheduling fields +// } +type WorkloadCompositePodGroupSchedulingConstraints struct { + // topology specifies desired topological placements for all child groups + // within the composite group. + // If unset, no topology placement is requested. + // + // +optional + // +k8s:optional + // +k8s:maxItems=1 + // +listType=atomic + // +k8s:listType=atomic + Topology []TopologyConstraint `json:"topology,omitempty" protobuf:"bytes,1,rep,name=topology"` +} + +// WorkloadCompositePodGroupDisruptionMode defines how the child groups of a +// composite group can be disrupted. Exactly one mode must be set. +// +// --- +// +// This is a reusable building block meant to be embedded in a composite +// controller's own API, next to its other scheduling fields. It is the +// group-of-groups analogue of WorkloadPodGroupDisruptionMode. It's recommended +// to freeze the field after creation (+k8s:immutable), since the selected mode +// is immutable in the compiled Workload. For example, +// +// type JobSetSchedulingConfiguration struct { +// // DisruptionMode defines the mode in which this JobSet's child groups +// // can be disrupted. +// // One of Single, All. +// // This field is immutable after creation: it may not be added or removed, +// // and the selected mode may not be changed. +// // +optional +// // +k8s:optional +// // +k8s:immutable +// DisruptionMode *schedulingv1alpha3.WorkloadCompositePodGroupDisruptionMode `json:"disruptionMode,omitempty" protobuf:"bytes,N,opt,name=disruptionMode"` +// +// // other scheduling fields +// } +// +// +union +type WorkloadCompositePodGroupDisruptionMode struct { + // single specifies that child groups can be disrupted independently from + // each other. + // + // +optional + // +k8s:optional + // +k8s:unionMember + Single *WorkloadCompositePodGroupSingleDisruptionMode `json:"single,omitempty" protobuf:"bytes,1,opt,name=single"` + + // all specifies that all child groups must be disrupted together. + // + // +optional + // +k8s:optional + // +k8s:unionMember + All *WorkloadCompositePodGroupAllDisruptionMode `json:"all,omitempty" protobuf:"bytes,2,opt,name=all"` +} + +// WorkloadCompositePodGroupSingleDisruptionMode indicates that child groups +// can be disrupted independently. +type WorkloadCompositePodGroupSingleDisruptionMode struct { + // Intentionally empty for now. +} + +// WorkloadCompositePodGroupAllDisruptionMode indicates that all child groups +// must be disrupted together. +type WorkloadCompositePodGroupAllDisruptionMode struct { + // Intentionally empty for now. +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:supportsSubresource="/status" + +// CompositePodGroup represents a runtime instance of pod groups grouped together. +// CompositePodGroups are created by workload controllers (LWS, JobSet, etc...) from +// Workload.compositePodGroupTemplates. +// CompositePodGroup API enablement is toggled by the CompositePodGroup feature gate. +type CompositePodGroup struct { + metav1.TypeMeta `json:""` + + // metadata is the standard object metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // spec defines the desired state of the CompositePodGroup. + // + // +required + Spec CompositePodGroupSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` + + // status represents the current observed state of the CompositePodGroup. + // + // +optional + Status CompositePodGroupStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// CompositePodGroupList contains a list of CompositePodGroup resources. +type CompositePodGroupList struct { + metav1.TypeMeta `json:""` + // Standard list metadata. + // + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Items is the list of CompositePodGroups. + Items []CompositePodGroup `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// CompositePodGroupSpec defines the desired state of CompositePodGroup. +type CompositePodGroupSpec struct { + // parentCompositePodGroupName contains the name of the parent composite pod group + // within the same namespace as this composite pod group. It must be a DNS name. + // If it's nil, then this composite pod group is a root of a workload's hierarchy. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + // +k8s:format=k8s-long-name + ParentCompositePodGroupName *string `json:"parentCompositePodGroupName,omitempty" protobuf:"bytes,1,opt,name=parentCompositePodGroupName"` + + // workloadRef references an optional CompositePodGroup template within the + // Workload object that was used to create the CompositePodGroup. + // This field is required. + // This field is immutable. + // + // +required + // +k8s:required + // +k8s:immutable + WorkloadRef *WorkloadReference `json:"workloadRef" protobuf:"bytes,2,opt,name=workloadRef"` + + // schedulingPolicy defines the scheduling policy for this instance of the CompositePodGroup. + // Controllers are expected to fill this field by copying it from a CompositePodGroupTemplate. + // This field is immutable. + // + // +required + // +k8s:immutable + SchedulingPolicy CompositePodGroupSchedulingPolicy `json:"schedulingPolicy" protobuf:"bytes,3,opt,name=schedulingPolicy"` + + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this CompositePodGroup. + // Controllers are expected to fill this field by copying it from a CompositePodGroupTemplate. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + SchedulingConstraints *CompositePodGroupSchedulingConstraints `json:"schedulingConstraints,omitempty" protobuf:"bytes,4,opt,name=schedulingConstraints"` + + // disruptionMode defines the mode in which a given CompositePodGroup can be disrupted. + // Controllers are expected to fill this field by copying it from a CompositePodGroupTemplate. + // One of Single, All. Defaults to Single if unset. + // This field is immutable. + // + // +default={"single": {}} + // +optional + // +k8s:optional + // +k8s:immutable + DisruptionMode *CompositeDisruptionMode `json:"disruptionMode,omitempty" protobuf:"bytes,5,opt,name=disruptionMode"` + + // priorityClassName defines the priority that should be considered when scheduling this CompositePodGroup. + // Controllers are expected to fill this field by copying it from a CompositePodGroupTemplate. + // If left unspecified, it is validated and resolved similarly to the PriorityClassName field in Pods + // (i.e. if no priority class is specified, admission control can set this to the global default + // priority class if it exists. Otherwise, the composite pod group's priority will be zero). + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + // +k8s:immutable + PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,6,opt,name=priorityClassName"` + + // priority is the value of priority of this composite pod group. Various system components + // use this field to find the priority of the composite pod group. When Priority Admission + // Controller is enabled, it prevents users from setting this field. The admission + // controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + // +k8s:maximum=1000000000 # HighestUserDefinablePriority + Priority *int32 `json:"priority,omitempty" protobuf:"varint,7,opt,name=priority"` + + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. + // When Priority Admission Controller is enabled, it populates this field from PriorityClassName, + // and defaults to PreemptLowerPriority if value is unset in PriorityClass. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + // + // +featureGate=PodGroupPreemptionPolicy + // +optional + // +k8s:immutable + // +k8s:ifDisabled("PodGroupPreemptionPolicy")=+k8s:forbidden + // +k8s:ifEnabled("PodGroupPreemptionPolicy")=+k8s:optional + PreemptionPolicy *PreemptionPolicy `json:"preemptionPolicy,omitempty" protobuf:"bytes,8,opt,name=preemptionPolicy"` +} + +// CompositePodGroupSchedulingPolicy defines the scheduling configuration for a CompositePodGroup. +// Exactly one policy must be set. +// +// +union +type CompositePodGroupSchedulingPolicy struct { + // basic specifies that the groups of this composite group should be scheduled independently. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + // +k8s:unionMember + Basic *CompositeBasicSchedulingPolicy `json:"basic,omitempty" protobuf:"bytes,1,opt,name=basic"` + + // gang specifies that the groups of this composite group should be scheduled using + // all-or-nothing semantics. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:update=NoSet + // +k8s:update=NoUnset + Gang *CompositeGangSchedulingPolicy `json:"gang,omitempty" protobuf:"bytes,2,opt,name=gang"` +} + +// CompositeBasicSchedulingPolicy indicates that the groups belonging to the composite group +// should be scheduled independently. +type CompositeBasicSchedulingPolicy struct { + // This is intentionally empty. Its presence indicates that the basic group + // scheduling policy should be applied. In the future, new fields may appear, + // describing such constraints on a composite pod group level without "all or + // nothing" (gang) scheduling. +} + +// CompositeGangSchedulingPolicy indicates that the groups belonging to the composite group +// should be scheduled using all-or-nothing semantics. +type CompositeGangSchedulingPolicy struct { + // minGroupCount is the minimum number of child groups that must be schedulable + // or scheduled at the same time for the scheduler to admit the entire group. + // It must be a positive integer. + // + // +required + // +k8s:required + // +k8s:minimum=1 + MinGroupCount int32 `json:"minGroupCount" protobuf:"varint,1,req,name=minGroupCount"` +} + +// CompositeDisruptionMode defines how individual entities within a composite pod group can be disrupted. +// Exactly one mode must be set. +// +// +union +type CompositeDisruptionMode struct { + // single specifies that children groups can be disrupted independently from each other. + // + // +optional + // +k8s:optional + // +k8s:unionMember + Single *SingleCompositeDisruptionMode `json:"single,omitempty" protobuf:"bytes,1,opt,name=single"` + + // all specifies that all children groups can only be disrupted together. + // + // +optional + // +k8s:optional + // +k8s:unionMember + All *AllCompositeDisruptionMode `json:"all,omitempty" protobuf:"bytes,2,opt,name=all"` +} + +// SingleCompositeDisruptionMode means that individual children of a CompositePodGroup +// can be disrupted or preempted independently. +type SingleCompositeDisruptionMode struct { + // This is intentionally empty. +} + +// AllCompositeDisruptionMode means that children of a CompositePodGroup can only be +// disrupted or preempted together. +type AllCompositeDisruptionMode struct { + // This is intentionally empty. +} + +// CompositePodGroupStatus represents information about the status of a composite pod group. +type CompositePodGroupStatus struct { + // conditions represent the latest observations of the CompositePodGroup's state. + // + // Known condition types: + // - "CompositePodGroupInitiallyScheduled": Indicates whether the overall scheduling requirement + // for the subtree under this CompositePodGroup has been satisfied. Once this condition + // transitions to True, it serves as a terminal state and will never revert to False, + // even if pods are subsequently deleted and group constraints are no longer met. + // - "DisruptionTarget": Indicates whether the CompositePodGroup is about to be terminated + // due to disruption such as preemption. + // + // Known reasons for the CompositePodGroupInitiallyScheduled condition: + // - "Unschedulable": The CompositePodGroup's subtree could not be placed due to resource constraints, + // affinity/anti-affinity, or topological constraints. + // - "SchedulerError": The CompositePodGroup cannot be scheduled due to some internal error + // that occurred during scheduling. + // - "Invalid": Set to True when kube-scheduler detects an invalid group layout during + // runtime validation. The `message` field details the specific layout violation (such as + // a detected cycle, exceeding the maximum depth of 4, or referencing multiple distinct Workloads). + // + // Known reasons for the DisruptionTarget condition: + // - "PreemptionByScheduler": The CompositePodGroup was targeted by the scheduler's preemption loop + // to free up capacity for higher-priority preemptors. + // + // +optional + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` +} + +// CompositePodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a CompositePodGroup. +type CompositePodGroupSchedulingConstraints struct { + // topology defines the topology constraints for the composite pod group. + // Currently only a single topology constraint can be specified. This may change in the future. + // + // +optional + // +k8s:optional + // +k8s:maxItems=1 + // +listType=atomic + // +k8s:listType=atomic + Topology []TopologyConstraint `json:"topology,omitempty" protobuf:"bytes,1,rep,name=topology"` +} diff --git a/vendor/k8s.io/api/scheduling/v1alpha3/types_swagger_doc_generated.go b/vendor/k8s.io/api/scheduling/v1alpha3/types_swagger_doc_generated.go new file mode 100644 index 0000000000..953a72fcd2 --- /dev/null +++ b/vendor/k8s.io/api/scheduling/v1alpha3/types_swagger_doc_generated.go @@ -0,0 +1,498 @@ +/* +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. +*/ + +package v1alpha3 + +// This file contains a collection of methods that can be used from go-restful to +// generate Swagger API documentation for its models. Please read this PR for more +// information on the implementation: https://github.com/emicklei/go-restful/pull/215 +// +// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if +// they are on one line! For multiple line or blocks that you want to ignore use ---. +// Any context after a --- is ignored. +// +// Those methods can be generated by using hack/update-codegen.sh + +// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. +var map_AllCompositeDisruptionMode = map[string]string{ + "": "AllCompositeDisruptionMode means that children of a CompositePodGroup can only be disrupted or preempted together.", +} + +func (AllCompositeDisruptionMode) SwaggerDoc() map[string]string { + return map_AllCompositeDisruptionMode +} + +var map_AllDisruptionMode = map[string]string{ + "": "AllDisruptionMode specifies that children can only be disrupted together.", +} + +func (AllDisruptionMode) SwaggerDoc() map[string]string { + return map_AllDisruptionMode +} + +var map_BasicSchedulingPolicy = map[string]string{ + "": "BasicSchedulingPolicy indicates that standard Kubernetes scheduling behavior should be used.", +} + +func (BasicSchedulingPolicy) SwaggerDoc() map[string]string { + return map_BasicSchedulingPolicy +} + +var map_CompositeBasicSchedulingPolicy = map[string]string{ + "": "CompositeBasicSchedulingPolicy indicates that the groups belonging to the composite group should be scheduled independently.", +} + +func (CompositeBasicSchedulingPolicy) SwaggerDoc() map[string]string { + return map_CompositeBasicSchedulingPolicy +} + +var map_CompositeDisruptionMode = map[string]string{ + "": "CompositeDisruptionMode defines how individual entities within a composite pod group can be disrupted. Exactly one mode must be set.", + "single": "single specifies that children groups can be disrupted independently from each other.", + "all": "all specifies that all children groups can only be disrupted together.", +} + +func (CompositeDisruptionMode) SwaggerDoc() map[string]string { + return map_CompositeDisruptionMode +} + +var map_CompositeGangSchedulingPolicy = map[string]string{ + "": "CompositeGangSchedulingPolicy indicates that the groups belonging to the composite group should be scheduled using all-or-nothing semantics.", + "minGroupCount": "minGroupCount is the minimum number of child groups that must be schedulable or scheduled at the same time for the scheduler to admit the entire group. It must be a positive integer.", +} + +func (CompositeGangSchedulingPolicy) SwaggerDoc() map[string]string { + return map_CompositeGangSchedulingPolicy +} + +var map_CompositePodGroup = map[string]string{ + "": "CompositePodGroup represents a runtime instance of pod groups grouped together. CompositePodGroups are created by workload controllers (LWS, JobSet, etc...) from Workload.compositePodGroupTemplates. CompositePodGroup API enablement is toggled by the CompositePodGroup feature gate.", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec defines the desired state of the CompositePodGroup.", + "status": "status represents the current observed state of the CompositePodGroup.", +} + +func (CompositePodGroup) SwaggerDoc() map[string]string { + return map_CompositePodGroup +} + +var map_CompositePodGroupList = map[string]string{ + "": "CompositePodGroupList contains a list of CompositePodGroup resources.", + "metadata": "Standard list metadata.", + "items": "Items is the list of CompositePodGroups.", +} + +func (CompositePodGroupList) SwaggerDoc() map[string]string { + return map_CompositePodGroupList +} + +var map_CompositePodGroupSchedulingConstraints = map[string]string{ + "": "CompositePodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a CompositePodGroup.", + "topology": "topology defines the topology constraints for the composite pod group. Currently only a single topology constraint can be specified. This may change in the future.", +} + +func (CompositePodGroupSchedulingConstraints) SwaggerDoc() map[string]string { + return map_CompositePodGroupSchedulingConstraints +} + +var map_CompositePodGroupSchedulingPolicy = map[string]string{ + "": "CompositePodGroupSchedulingPolicy defines the scheduling configuration for a CompositePodGroup. Exactly one policy must be set.", + "basic": "basic specifies that the groups of this composite group should be scheduled independently. This field is immutable.", + "gang": "gang specifies that the groups of this composite group should be scheduled using all-or-nothing semantics.", +} + +func (CompositePodGroupSchedulingPolicy) SwaggerDoc() map[string]string { + return map_CompositePodGroupSchedulingPolicy +} + +var map_CompositePodGroupSpec = map[string]string{ + "": "CompositePodGroupSpec defines the desired state of CompositePodGroup.", + "parentCompositePodGroupName": "parentCompositePodGroupName contains the name of the parent composite pod group within the same namespace as this composite pod group. It must be a DNS name. If it's nil, then this composite pod group is a root of a workload's hierarchy. This field is immutable.", + "workloadRef": "workloadRef references an optional CompositePodGroup template within the Workload object that was used to create the CompositePodGroup. This field is required. This field is immutable.", + "schedulingPolicy": "schedulingPolicy defines the scheduling policy for this instance of the CompositePodGroup. Controllers are expected to fill this field by copying it from a CompositePodGroupTemplate. This field is immutable.", + "schedulingConstraints": "schedulingConstraints defines optional scheduling constraints (e.g. topology) for this CompositePodGroup. Controllers are expected to fill this field by copying it from a CompositePodGroupTemplate. This field is immutable.", + "disruptionMode": "disruptionMode defines the mode in which a given CompositePodGroup can be disrupted. Controllers are expected to fill this field by copying it from a CompositePodGroupTemplate. One of Single, All. Defaults to Single if unset. This field is immutable.", + "priorityClassName": "priorityClassName defines the priority that should be considered when scheduling this CompositePodGroup. Controllers are expected to fill this field by copying it from a CompositePodGroupTemplate. If left unspecified, it is validated and resolved similarly to the PriorityClassName field in Pods (i.e. if no priority class is specified, admission control can set this to the global default priority class if it exists. Otherwise, the composite pod group's priority will be zero). This field is immutable.", + "priority": "priority is the value of priority of this composite pod group. Various system components use this field to find the priority of the composite pod group. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority. This field is immutable.", + "preemptionPolicy": "preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. When Priority Admission Controller is enabled, it populates this field from PriorityClassName, and defaults to PreemptLowerPriority if value is unset in PriorityClass. This field is immutable. This field is available only when the PodGroupPreemptionPolicy feature gate is enabled.", +} + +func (CompositePodGroupSpec) SwaggerDoc() map[string]string { + return map_CompositePodGroupSpec +} + +var map_CompositePodGroupStatus = map[string]string{ + "": "CompositePodGroupStatus represents information about the status of a composite pod group.", + "conditions": "conditions represent the latest observations of the CompositePodGroup's state.\n\nKnown condition types: - \"CompositePodGroupInitiallyScheduled\": Indicates whether the overall scheduling requirement\n for the subtree under this CompositePodGroup has been satisfied. Once this condition\n transitions to True, it serves as a terminal state and will never revert to False,\n even if pods are subsequently deleted and group constraints are no longer met.\n- \"DisruptionTarget\": Indicates whether the CompositePodGroup is about to be terminated\n due to disruption such as preemption.\n\nKnown reasons for the CompositePodGroupInitiallyScheduled condition: - \"Unschedulable\": The CompositePodGroup's subtree could not be placed due to resource constraints,\n affinity/anti-affinity, or topological constraints.\n- \"SchedulerError\": The CompositePodGroup cannot be scheduled due to some internal error\n that occurred during scheduling.\n- \"Invalid\": Set to True when kube-scheduler detects an invalid group layout during\n runtime validation. The `message` field details the specific layout violation (such as\n a detected cycle, exceeding the maximum depth of 4, or referencing multiple distinct Workloads).\n\nKnown reasons for the DisruptionTarget condition: - \"PreemptionByScheduler\": The CompositePodGroup was targeted by the scheduler's preemption loop\n to free up capacity for higher-priority preemptors.", +} + +func (CompositePodGroupStatus) SwaggerDoc() map[string]string { + return map_CompositePodGroupStatus +} + +var map_CompositePodGroupTemplate = map[string]string{ + "": "CompositePodGroupTemplate represents a template for a CompositePodGroup with a scheduling policy.", + "name": "name is a unique identifier for the CompositePodGroupTemplate within the Workload. It must be a DNS label. This field is required.", + "schedulingPolicy": "schedulingPolicy defines the scheduling policy for this template.", + "schedulingConstraints": "schedulingConstraints defines optional scheduling constraints (e.g. topology) for this CompositePodGroupTemplate. This field is immutable.", + "disruptionMode": "disruptionMode defines the mode in which a given CompositePodGroup can be disrupted. One of Single, All. This field is immutable.", + "priorityClassName": "priorityClassName indicates the priority that should be considered when scheduling a composite pod group created from this template. If no priority class is specified, admission control can set this to the global default priority class if it exists. Otherwise, composite pod groups created from this template will have the priority set to zero. This field is immutable.", + "priority": "priority is the value of priority of composite pod groups created from this template. Various system components use this field to find the priority of the composite pod group. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority. This field is immutable.", + "preemptionPolicy": "preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. One of Never, PreemptLowerPriority. This field is immutable. This field is available only when the PodGroupPreemptionPolicy feature gate is enabled.", + "podGroupTemplates": "podGroupTemplates is the list of templates for children PodGroups. The maximum number of templates is 8. At least one entry in CompositePodGroupTemplates or PodGroupTemplates must be set.", + "compositePodGroupTemplates": "compositePodGroupTemplates is the list of templates for children CompositePodGroups. The maximum number of templates is 8. At least one entry in CompositePodGroupTemplates or PodGroupTemplates must be set.", +} + +func (CompositePodGroupTemplate) SwaggerDoc() map[string]string { + return map_CompositePodGroupTemplate +} + +var map_DisruptionMode = map[string]string{ + "": "DisruptionMode defines how individual entities within a group can be disrupted. Exactly one mode can be set.", + "single": "single specifies that children can be disrupted independently from each other.", + "all": "all specifies that all children can only be disrupted together.", +} + +func (DisruptionMode) SwaggerDoc() map[string]string { + return map_DisruptionMode +} + +var map_GangSchedulingPolicy = map[string]string{ + "": "GangSchedulingPolicy defines the parameters for gang scheduling.", + "minCount": "minCount is the minimum number of pods that must be schedulable or scheduled at the same time for the scheduler to admit the entire group. It must be a positive integer. This field is mutable to support workload scaling.\n\nNote that the scheduler operates on an eventually consistent model. Updates to minCount may not be immediately reflected in scheduling decisions due to propagation delays. If minCount is updated while a scheduling cycle is in progress for that group, the new value may not take effect until the next cycle. Moreover, minCount is only enforced during scheduling, meaning that modifications to this field do not affect already-scheduled pods, applying only to those evaluated in future cycles.", +} + +func (GangSchedulingPolicy) SwaggerDoc() map[string]string { + return map_GangSchedulingPolicy +} + +var map_PodGroup = map[string]string{ + "": "PodGroup represents a runtime instance of pods grouped together. PodGroups are created by workload controllers (Job, LWS, JobSet, etc...) from Workload.podGroupTemplates. PodGroup API enablement is toggled by the GenericWorkload feature gate.", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec defines the desired state of the PodGroup.", + "status": "status represents the current observed state of the PodGroup.", +} + +func (PodGroup) SwaggerDoc() map[string]string { + return map_PodGroup +} + +var map_PodGroupList = map[string]string{ + "": "PodGroupList contains a list of PodGroup resources.", + "metadata": "Standard list metadata.", + "items": "Items is the list of PodGroups.", +} + +func (PodGroupList) SwaggerDoc() map[string]string { + return map_PodGroupList +} + +var map_PodGroupResourceClaim = map[string]string{ + "": "PodGroupResourceClaim references exactly one ResourceClaim, either directly or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim for the PodGroup.\n\nIt adds a name to it that uniquely identifies the ResourceClaim inside the PodGroup. Pods that need access to the ResourceClaim define a matching reference in its own Spec.ResourceClaims. The Pod's claim must match all fields of the PodGroup's claim exactly.", + "name": "name uniquely identifies this resource claim inside the PodGroup. This must be a DNS_LABEL.", + "resourceClaimName": "resourceClaimName is the name of a ResourceClaim object in the same namespace as this PodGroup. The ResourceClaim will be reserved for the PodGroup instead of its individual pods.\n\nExactly one of ResourceClaimName and ResourceClaimTemplateName must be set.", + "resourceClaimTemplateName": "resourceClaimTemplateName is the name of a ResourceClaimTemplate object in the same namespace as this PodGroup.\n\nThe template will be used to create a new ResourceClaim, which will be bound to this PodGroup. When this PodGroup is deleted, the ResourceClaim will also be deleted. The PodGroup name and resource name, along with a generated component, will be used to form a unique name for the ResourceClaim, which will be recorded in podgroup.status.resourceClaimStatuses.\n\nThis field is immutable and no changes will be made to the corresponding ResourceClaim by the control plane after creating the ResourceClaim.\n\nExactly one of ResourceClaimName and ResourceClaimTemplateName must be set.", +} + +func (PodGroupResourceClaim) SwaggerDoc() map[string]string { + return map_PodGroupResourceClaim +} + +var map_PodGroupResourceClaimStatus = map[string]string{ + "": "PodGroupResourceClaimStatus is stored in the PodGroupStatus for each PodGroupResourceClaim which references a ResourceClaimTemplate. It stores the generated name for the corresponding ResourceClaim.", + "name": "name uniquely identifies this resource claim inside the PodGroup. This must match the name of an entry in podgroup.spec.resourceClaims, which implies that the string must be a DNS_LABEL.", + "resourceClaimName": "resourceClaimName is the name of the ResourceClaim that was generated for the PodGroup in the namespace of the PodGroup. If this is unset, then generating a ResourceClaim was not necessary. The podgroup.spec.resourceClaims entry can be ignored in this case.", +} + +func (PodGroupResourceClaimStatus) SwaggerDoc() map[string]string { + return map_PodGroupResourceClaimStatus +} + +var map_PodGroupSchedulingConstraints = map[string]string{ + "": "PodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a PodGroup.", + "topology": "topology defines the topology constraints for the pod group. Currently only a single topology constraint can be specified. This may change in the future.", +} + +func (PodGroupSchedulingConstraints) SwaggerDoc() map[string]string { + return map_PodGroupSchedulingConstraints +} + +var map_PodGroupSchedulingPolicy = map[string]string{ + "": "PodGroupSchedulingPolicy defines the scheduling configuration for a PodGroup. Exactly one policy must be set. The policy is chosen at creation time by setting either the Basic or Gang field. The PodGroup may not change policy after creation. Fields within chosen policy may be updated after creation when their individual fields allow it.", + "basic": "basic specifies that the pods in this group should be scheduled using standard Kubernetes scheduling behavior. Setting this field at group creation time opts this group to basic scheduling; this field cannot be changed afterward.", + "gang": "gang specifies that the pods in this group should be scheduled using all-or-nothing semantics. Setting this field at group creation time opts this group to gang scheduling; this field cannot be set or unset afterward. The minCount field within Gang scheduling policy remains mutable after group creation.", +} + +func (PodGroupSchedulingPolicy) SwaggerDoc() map[string]string { + return map_PodGroupSchedulingPolicy +} + +var map_PodGroupSpec = map[string]string{ + "": "PodGroupSpec defines the desired state of a PodGroup.", + "parentCompositePodGroupName": "parentCompositePodGroupName contains the name of the parent composite pod group within the same namespace as this pod group. If it's nil, then this pod group is a root of a workload's hierarchy. This field is used only when the CompositePodGroup feature gate is enabled. This field is immutable.", + "workloadRef": "workloadRef references an optional PodGroup template within the Workload object that was used to create the PodGroup. This field is immutable.", + "schedulingPolicy": "schedulingPolicy defines the scheduling policy for this instance of the PodGroup. Controllers are expected to fill this field by copying it from a PodGroupTemplate.", + "schedulingConstraints": "schedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroup. Controllers are expected to fill this field by copying it from a PodGroupTemplate. This field is immutable. This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled.", + "resourceClaims": "resourceClaims defines which ResourceClaims may be shared among Pods in the group. Pods consume the devices allocated to a PodGroup's claim by defining a claim in its own Spec.ResourceClaims that matches the PodGroup's claim exactly. The claim must have the same name and refer to the same ResourceClaim or ResourceClaimTemplate.\n\nThis is a beta-level field and requires that the DRAWorkloadResourceClaims feature gate is enabled.\n\nThis field is immutable.", + "disruptionMode": "disruptionMode defines the mode in which a given PodGroup can be disrupted. Controllers are expected to fill this field by copying it from a PodGroupTemplate. One of Single, All. Defaults to Single if unset. This field is immutable.", + "priorityClassName": "priorityClassName defines the priority that should be considered when scheduling this pod group. Controllers are expected to fill this field by copying it from a PodGroupTemplate. Otherwise, it is validated and resolved similarly to the PriorityClassName on PodGroupTemplate (i.e. if no priority class is specified, admission control can set this to the global default priority class if it exists. Otherwise, the pod group's priority will be zero). This field is immutable.", + "priority": "priority is the value of priority of this pod group. Various system components use this field to find the priority of the pod group. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority. This field is immutable.", + "preemptionPolicy": "preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. When Priority Admission Controller is enabled, it populates this field from PriorityClassName, and defaults to PreemptLowerPriority if value is unset in PriorityClass. This field is immutable. This field is available only when the PodGroupPreemptionPolicy feature gate is enabled.", +} + +func (PodGroupSpec) SwaggerDoc() map[string]string { + return map_PodGroupSpec +} + +var map_PodGroupStatus = map[string]string{ + "": "PodGroupStatus represents information about the status of a pod group.", + "conditions": "conditions represent the latest observations of the PodGroup's state.\n\nKnown condition types: - \"PodGroupInitiallyScheduled\": Indicates whether the scheduling requirement has been satisfied. Once this condition transitions to True, it serves as a terminal state and will never revert to False, even if pods are subsequently evicted and group constraints are no longer met. - \"DisruptionTarget\": Indicates whether the PodGroup is about to be terminated\n due to disruption such as preemption.\n\nKnown reasons for the PodGroupInitiallyScheduled condition: - \"Unschedulable\": The PodGroup cannot be scheduled due to resource constraints,\n affinity/anti-affinity rules, or insufficient capacity for the gang.\n- \"SchedulerError\": The PodGroup cannot be scheduled due to some internal error\n that happened during scheduling, for example due to nodeAffinity parsing errors.\n\nKnown reasons for the DisruptionTarget condition: - \"PreemptionByScheduler\": The PodGroup was preempted by the scheduler to make room for\n higher-priority PodGroups or Pods.", + "resourceClaimStatuses": "resourceClaimStatuses is status of resource claims.", +} + +func (PodGroupStatus) SwaggerDoc() map[string]string { + return map_PodGroupStatus +} + +var map_PodGroupTemplate = map[string]string{ + "": "PodGroupTemplate represents a template for a set of pods with a scheduling policy.", + "name": "name is a unique identifier for the PodGroupTemplate within the Workload. It must be a DNS label. This field is immutable.", + "schedulingPolicy": "schedulingPolicy defines the scheduling policy for this PodGroupTemplate.", + "schedulingConstraints": "schedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroupTemplate. This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. This field is immutable.", + "resourceClaims": "resourceClaims defines which ResourceClaims may be shared among Pods in the group. Pods consume the devices allocated to a PodGroup's claim by defining a claim in its own Spec.ResourceClaims that matches the PodGroup's claim exactly. The claim must have the same name and refer to the same ResourceClaim or ResourceClaimTemplate.\n\nThis is a beta-level field and requires that the DRAWorkloadResourceClaims feature gate is enabled.\n\nThis field is immutable.", + "disruptionMode": "disruptionMode defines the mode in which a given PodGroup can be disrupted. One of Single, All. This field is immutable.", + "priorityClassName": "priorityClassName indicates the priority that should be considered when scheduling a pod group created from this template. This field is immutable.", + "priority": "priority is the value of priority of pod groups created from this template. Various system components use this field to find the priority of the pod group. The higher the value, the higher the priority. This field is immutable.", + "preemptionPolicy": "preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. One of Never, PreemptLowerPriority. This field is immutable. This field is available only when the PodGroupPreemptionPolicy feature gate is enabled.", +} + +func (PodGroupTemplate) SwaggerDoc() map[string]string { + return map_PodGroupTemplate +} + +var map_SingleCompositeDisruptionMode = map[string]string{ + "": "SingleCompositeDisruptionMode means that individual children of a CompositePodGroup can be disrupted or preempted independently.", +} + +func (SingleCompositeDisruptionMode) SwaggerDoc() map[string]string { + return map_SingleCompositeDisruptionMode +} + +var map_SingleDisruptionMode = map[string]string{ + "": "SingleDisruptionMode specifies that children can be disrupted independently.", +} + +func (SingleDisruptionMode) SwaggerDoc() map[string]string { + return map_SingleDisruptionMode +} + +var map_TopologyConstraint = map[string]string{ + "": "TopologyConstraint defines a topology constraint for a PodGroup.", + "key": "key specifies the key of the node label representing the topology domain. All pods within the PodGroup must be colocated within the same domain instance. Different PodGroups can land on different domain instances even if they derive from the same PodGroupTemplate. Examples: \"topology.kubernetes.io/rack\"", +} + +func (TopologyConstraint) SwaggerDoc() map[string]string { + return map_TopologyConstraint +} + +var map_TypedLocalObjectReference = map[string]string{ + "": "TypedLocalObjectReference allows to reference typed object inside the same namespace.", + "apiGroup": "apiGroup is the group for the resource being referenced. If APIGroup is empty, the specified Kind must be in the core API group. For any other third-party types, setting APIGroup is required. It must be a DNS subdomain.", + "kind": "kind is the type of resource being referenced. It must be a path segment name.", + "name": "name is the name of resource being referenced. It must be a path segment name.", +} + +func (TypedLocalObjectReference) SwaggerDoc() map[string]string { + return map_TypedLocalObjectReference +} + +var map_Workload = map[string]string{ + "": "Workload allows for expressing scheduling constraints that should be used when managing the lifecycle of workloads from the scheduling perspective, including scheduling, preemption, eviction and other phases. Workload API enablement is toggled by the GenericWorkload feature gate.", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec defines the desired behavior of a Workload.", +} + +func (Workload) SwaggerDoc() map[string]string { + return map_Workload +} + +var map_WorkloadCompositePodGroupAllDisruptionMode = map[string]string{ + "": "WorkloadCompositePodGroupAllDisruptionMode indicates that all child groups must be disrupted together.", +} + +func (WorkloadCompositePodGroupAllDisruptionMode) SwaggerDoc() map[string]string { + return map_WorkloadCompositePodGroupAllDisruptionMode +} + +var map_WorkloadCompositePodGroupBasicSchedulingPolicy = map[string]string{ + "": "WorkloadCompositePodGroupBasicSchedulingPolicy indicates that the child groups of a composite group should be scheduled independently.", +} + +func (WorkloadCompositePodGroupBasicSchedulingPolicy) SwaggerDoc() map[string]string { + return map_WorkloadCompositePodGroupBasicSchedulingPolicy +} + +var map_WorkloadCompositePodGroupDisruptionMode = map[string]string{ + "": "WorkloadCompositePodGroupDisruptionMode defines how the child groups of a composite group can be disrupted. Exactly one mode must be set.", + "single": "single specifies that child groups can be disrupted independently from each other.", + "all": "all specifies that all child groups must be disrupted together.", +} + +func (WorkloadCompositePodGroupDisruptionMode) SwaggerDoc() map[string]string { + return map_WorkloadCompositePodGroupDisruptionMode +} + +var map_WorkloadCompositePodGroupGangSchedulingPolicy = map[string]string{ + "": "WorkloadCompositePodGroupGangSchedulingPolicy defines the parameters for gang scheduling of a composite group's child groups.", + "minGroupCount": "minGroupCount is the minimum number of child groups that must be schedulable at the same time for the scheduler to admit the entire composite group. This field is optional. If it is not specified, the controller should inject a context-specific sane default (e.g., the number of child groups). If set, it must be a positive integer.", +} + +func (WorkloadCompositePodGroupGangSchedulingPolicy) SwaggerDoc() map[string]string { + return map_WorkloadCompositePodGroupGangSchedulingPolicy +} + +var map_WorkloadCompositePodGroupSchedulingConstraints = map[string]string{ + "": "WorkloadCompositePodGroupSchedulingConstraints defines composite-level scheduling constraints, such as topology, for a CompositePodGroup (a group of groups) managed by a workload controller.", + "topology": "topology specifies desired topological placements for all child groups within the composite group. If unset, no topology placement is requested.", +} + +func (WorkloadCompositePodGroupSchedulingConstraints) SwaggerDoc() map[string]string { + return map_WorkloadCompositePodGroupSchedulingConstraints +} + +var map_WorkloadCompositePodGroupSchedulingPolicy = map[string]string{ + "": "WorkloadCompositePodGroupSchedulingPolicy defines the scheduling policy for a CompositePodGroup (a group of groups) managed by a workload controller. Exactly one policy must be set.", + "basic": "basic specifies that the child groups of this composite group should be scheduled independently.", + "gang": "gang specifies that the child groups of this composite group should be scheduled using all-or-nothing semantics.", +} + +func (WorkloadCompositePodGroupSchedulingPolicy) SwaggerDoc() map[string]string { + return map_WorkloadCompositePodGroupSchedulingPolicy +} + +var map_WorkloadCompositePodGroupSingleDisruptionMode = map[string]string{ + "": "WorkloadCompositePodGroupSingleDisruptionMode indicates that child groups can be disrupted independently.", +} + +func (WorkloadCompositePodGroupSingleDisruptionMode) SwaggerDoc() map[string]string { + return map_WorkloadCompositePodGroupSingleDisruptionMode +} + +var map_WorkloadList = map[string]string{ + "": "WorkloadList contains a list of Workload resources.", + "metadata": "Standard list metadata.", + "items": "Items is the list of Workloads.", +} + +func (WorkloadList) SwaggerDoc() map[string]string { + return map_WorkloadList +} + +var map_WorkloadPodGroupAllDisruptionMode = map[string]string{ + "": "WorkloadPodGroupAllDisruptionMode indicates that all pods in the group must be disrupted together.", +} + +func (WorkloadPodGroupAllDisruptionMode) SwaggerDoc() map[string]string { + return map_WorkloadPodGroupAllDisruptionMode +} + +var map_WorkloadPodGroupBasicSchedulingPolicy = map[string]string{ + "": "WorkloadPodGroupBasicSchedulingPolicy indicates standard Kubernetes scheduling behavior.", +} + +func (WorkloadPodGroupBasicSchedulingPolicy) SwaggerDoc() map[string]string { + return map_WorkloadPodGroupBasicSchedulingPolicy +} + +var map_WorkloadPodGroupDisruptionMode = map[string]string{ + "": "WorkloadPodGroupDisruptionMode defines how individual pods within a group can be disrupted. Exactly one mode must be set.", + "single": "single specifies that pods can be disrupted independently from each other.", + "all": "all specifies that all pods in the group must be disrupted together.", +} + +func (WorkloadPodGroupDisruptionMode) SwaggerDoc() map[string]string { + return map_WorkloadPodGroupDisruptionMode +} + +var map_WorkloadPodGroupGangSchedulingPolicy = map[string]string{ + "": "WorkloadPodGroupGangSchedulingPolicy defines the parameters for gang (all-or-nothing) scheduling.", + "minCount": "minCount is the minimum number of pods that must be scheduled at the same time for the scheduler to admit the entire group. This field is optional. If it is not specified, the controller should inject a context-specific sane default (e.g., parallelism for a Job). If set, it must be a positive integer.", +} + +func (WorkloadPodGroupGangSchedulingPolicy) SwaggerDoc() map[string]string { + return map_WorkloadPodGroupGangSchedulingPolicy +} + +var map_WorkloadPodGroupResourceClaim = map[string]string{ + "": "WorkloadPodGroupResourceClaim references a dynamic resource claim that is shared across pods in the group.", + "name": "name uniquely identifies this resource claim inside the group. This field is required. It must be a DNS_LABEL.", + "resourceClaimName": "resourceClaimName is the name of a ResourceClaim object in the same namespace. This field is optional. If it is not specified, no resource claim is used. If set, it must be a DNS subdomain.", + "resourceClaimTemplateName": "resourceClaimTemplateName is the name of a ResourceClaimTemplate object in the same namespace. This field is optional. If it is not specified, no resource claim template is used. If set, it must be a DNS subdomain.", +} + +func (WorkloadPodGroupResourceClaim) SwaggerDoc() map[string]string { + return map_WorkloadPodGroupResourceClaim +} + +var map_WorkloadPodGroupSchedulingConstraints = map[string]string{ + "": "WorkloadPodGroupSchedulingConstraints defines leaf-level scheduling constraints, such as topology.", + "topology": "topology specifies desired topological placements for all pods within the pod group. If unset, no topology placement is requested.", +} + +func (WorkloadPodGroupSchedulingConstraints) SwaggerDoc() map[string]string { + return map_WorkloadPodGroupSchedulingConstraints +} + +var map_WorkloadPodGroupSchedulingPolicy = map[string]string{ + "": "WorkloadPodGroupSchedulingPolicy defines the scheduling policy for a group of pods managed by a workload controller. Exactly one policy must be set.", + "basic": "basic specifies that standard, pod-by-pod Kubernetes scheduling behavior should be used.", + "gang": "gang specifies all-or-nothing scheduling semantics.", +} + +func (WorkloadPodGroupSchedulingPolicy) SwaggerDoc() map[string]string { + return map_WorkloadPodGroupSchedulingPolicy +} + +var map_WorkloadPodGroupSingleDisruptionMode = map[string]string{ + "": "WorkloadPodGroupSingleDisruptionMode indicates that individual pods can be disrupted independently.", +} + +func (WorkloadPodGroupSingleDisruptionMode) SwaggerDoc() map[string]string { + return map_WorkloadPodGroupSingleDisruptionMode +} + +var map_WorkloadReference = map[string]string{ + "": "WorkloadReference references the Workload object together with the template that was used to create a particular PodGroup.", + "workloadName": "workloadName is the name of the Workload object that contains a template that was used when creating a pod group. It must be a DNS name. This field is required.", + "templateName": "templateName is the name of a template within the Workload object that was used to create a pod group. It must be a DNS label. This field is required.", +} + +func (WorkloadReference) SwaggerDoc() map[string]string { + return map_WorkloadReference +} + +var map_WorkloadSpec = map[string]string{ + "": "WorkloadSpec defines the desired state of a Workload.", + "controllerRef": "controllerRef is an optional reference to the controlling object, such as a Deployment or Job. This field is intended for use by tools like CLIs to provide a link back to the original workload definition. This field is immutable.", + "podGroupTemplates": "podGroupTemplates is the list of templates that make up the Workload. The maximum number of templates is 8. Templates cannot be added or removed after the workload is created. Existing templates may still be updated where their individual fields allow it. Exactly one of CompositePodGroupTemplates and PodGroupTemplates must be set.", + "compositePodGroupTemplates": "compositePodGroupTemplates is the list of CompositePodGroup templates that make up the Workload. The maximum number of templates is 8. This field is immutable. Exactly one of CompositePodGroupTemplates and PodGroupTemplates must be set.\n\nThis field is used only when the CompositePodGroup feature gate is enabled.", +} + +func (WorkloadSpec) SwaggerDoc() map[string]string { + return map_WorkloadSpec +} + +// AUTO-GENERATED FUNCTIONS END HERE diff --git a/vendor/k8s.io/api/scheduling/v1alpha3/zz_generated.deepcopy.go b/vendor/k8s.io/api/scheduling/v1alpha3/zz_generated.deepcopy.go new file mode 100644 index 0000000000..ae0a82088b --- /dev/null +++ b/vendor/k8s.io/api/scheduling/v1alpha3/zz_generated.deepcopy.go @@ -0,0 +1,1172 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AllCompositeDisruptionMode) DeepCopyInto(out *AllCompositeDisruptionMode) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AllCompositeDisruptionMode. +func (in *AllCompositeDisruptionMode) DeepCopy() *AllCompositeDisruptionMode { + if in == nil { + return nil + } + out := new(AllCompositeDisruptionMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AllDisruptionMode) DeepCopyInto(out *AllDisruptionMode) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AllDisruptionMode. +func (in *AllDisruptionMode) DeepCopy() *AllDisruptionMode { + if in == nil { + return nil + } + out := new(AllDisruptionMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BasicSchedulingPolicy) DeepCopyInto(out *BasicSchedulingPolicy) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BasicSchedulingPolicy. +func (in *BasicSchedulingPolicy) DeepCopy() *BasicSchedulingPolicy { + if in == nil { + return nil + } + out := new(BasicSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CompositeBasicSchedulingPolicy) DeepCopyInto(out *CompositeBasicSchedulingPolicy) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositeBasicSchedulingPolicy. +func (in *CompositeBasicSchedulingPolicy) DeepCopy() *CompositeBasicSchedulingPolicy { + if in == nil { + return nil + } + out := new(CompositeBasicSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CompositeDisruptionMode) DeepCopyInto(out *CompositeDisruptionMode) { + *out = *in + if in.Single != nil { + in, out := &in.Single, &out.Single + *out = new(SingleCompositeDisruptionMode) + **out = **in + } + if in.All != nil { + in, out := &in.All, &out.All + *out = new(AllCompositeDisruptionMode) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositeDisruptionMode. +func (in *CompositeDisruptionMode) DeepCopy() *CompositeDisruptionMode { + if in == nil { + return nil + } + out := new(CompositeDisruptionMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CompositeGangSchedulingPolicy) DeepCopyInto(out *CompositeGangSchedulingPolicy) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositeGangSchedulingPolicy. +func (in *CompositeGangSchedulingPolicy) DeepCopy() *CompositeGangSchedulingPolicy { + if in == nil { + return nil + } + out := new(CompositeGangSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CompositePodGroup) DeepCopyInto(out *CompositePodGroup) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositePodGroup. +func (in *CompositePodGroup) DeepCopy() *CompositePodGroup { + if in == nil { + return nil + } + out := new(CompositePodGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CompositePodGroup) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CompositePodGroupList) DeepCopyInto(out *CompositePodGroupList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]CompositePodGroup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositePodGroupList. +func (in *CompositePodGroupList) DeepCopy() *CompositePodGroupList { + if in == nil { + return nil + } + out := new(CompositePodGroupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CompositePodGroupList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CompositePodGroupSchedulingConstraints) DeepCopyInto(out *CompositePodGroupSchedulingConstraints) { + *out = *in + if in.Topology != nil { + in, out := &in.Topology, &out.Topology + *out = make([]TopologyConstraint, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositePodGroupSchedulingConstraints. +func (in *CompositePodGroupSchedulingConstraints) DeepCopy() *CompositePodGroupSchedulingConstraints { + if in == nil { + return nil + } + out := new(CompositePodGroupSchedulingConstraints) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CompositePodGroupSchedulingPolicy) DeepCopyInto(out *CompositePodGroupSchedulingPolicy) { + *out = *in + if in.Basic != nil { + in, out := &in.Basic, &out.Basic + *out = new(CompositeBasicSchedulingPolicy) + **out = **in + } + if in.Gang != nil { + in, out := &in.Gang, &out.Gang + *out = new(CompositeGangSchedulingPolicy) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositePodGroupSchedulingPolicy. +func (in *CompositePodGroupSchedulingPolicy) DeepCopy() *CompositePodGroupSchedulingPolicy { + if in == nil { + return nil + } + out := new(CompositePodGroupSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CompositePodGroupSpec) DeepCopyInto(out *CompositePodGroupSpec) { + *out = *in + if in.ParentCompositePodGroupName != nil { + in, out := &in.ParentCompositePodGroupName, &out.ParentCompositePodGroupName + *out = new(string) + **out = **in + } + if in.WorkloadRef != nil { + in, out := &in.WorkloadRef, &out.WorkloadRef + *out = new(WorkloadReference) + **out = **in + } + in.SchedulingPolicy.DeepCopyInto(&out.SchedulingPolicy) + if in.SchedulingConstraints != nil { + in, out := &in.SchedulingConstraints, &out.SchedulingConstraints + *out = new(CompositePodGroupSchedulingConstraints) + (*in).DeepCopyInto(*out) + } + if in.DisruptionMode != nil { + in, out := &in.DisruptionMode, &out.DisruptionMode + *out = new(CompositeDisruptionMode) + (*in).DeepCopyInto(*out) + } + if in.Priority != nil { + in, out := &in.Priority, &out.Priority + *out = new(int32) + **out = **in + } + if in.PreemptionPolicy != nil { + in, out := &in.PreemptionPolicy, &out.PreemptionPolicy + *out = new(PreemptionPolicy) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositePodGroupSpec. +func (in *CompositePodGroupSpec) DeepCopy() *CompositePodGroupSpec { + if in == nil { + return nil + } + out := new(CompositePodGroupSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CompositePodGroupStatus) DeepCopyInto(out *CompositePodGroupStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositePodGroupStatus. +func (in *CompositePodGroupStatus) DeepCopy() *CompositePodGroupStatus { + if in == nil { + return nil + } + out := new(CompositePodGroupStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CompositePodGroupTemplate) DeepCopyInto(out *CompositePodGroupTemplate) { + *out = *in + in.SchedulingPolicy.DeepCopyInto(&out.SchedulingPolicy) + if in.SchedulingConstraints != nil { + in, out := &in.SchedulingConstraints, &out.SchedulingConstraints + *out = new(CompositePodGroupSchedulingConstraints) + (*in).DeepCopyInto(*out) + } + if in.DisruptionMode != nil { + in, out := &in.DisruptionMode, &out.DisruptionMode + *out = new(CompositeDisruptionMode) + (*in).DeepCopyInto(*out) + } + if in.Priority != nil { + in, out := &in.Priority, &out.Priority + *out = new(int32) + **out = **in + } + if in.PreemptionPolicy != nil { + in, out := &in.PreemptionPolicy, &out.PreemptionPolicy + *out = new(PreemptionPolicy) + **out = **in + } + if in.PodGroupTemplates != nil { + in, out := &in.PodGroupTemplates, &out.PodGroupTemplates + *out = make([]PodGroupTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.CompositePodGroupTemplates != nil { + in, out := &in.CompositePodGroupTemplates, &out.CompositePodGroupTemplates + *out = make([]CompositePodGroupTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositePodGroupTemplate. +func (in *CompositePodGroupTemplate) DeepCopy() *CompositePodGroupTemplate { + if in == nil { + return nil + } + out := new(CompositePodGroupTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DisruptionMode) DeepCopyInto(out *DisruptionMode) { + *out = *in + if in.Single != nil { + in, out := &in.Single, &out.Single + *out = new(SingleDisruptionMode) + **out = **in + } + if in.All != nil { + in, out := &in.All, &out.All + *out = new(AllDisruptionMode) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DisruptionMode. +func (in *DisruptionMode) DeepCopy() *DisruptionMode { + if in == nil { + return nil + } + out := new(DisruptionMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GangSchedulingPolicy) DeepCopyInto(out *GangSchedulingPolicy) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GangSchedulingPolicy. +func (in *GangSchedulingPolicy) DeepCopy() *GangSchedulingPolicy { + if in == nil { + return nil + } + out := new(GangSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroup) DeepCopyInto(out *PodGroup) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroup. +func (in *PodGroup) DeepCopy() *PodGroup { + if in == nil { + return nil + } + out := new(PodGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PodGroup) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupList) DeepCopyInto(out *PodGroupList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]PodGroup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupList. +func (in *PodGroupList) DeepCopy() *PodGroupList { + if in == nil { + return nil + } + out := new(PodGroupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PodGroupList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupResourceClaim) DeepCopyInto(out *PodGroupResourceClaim) { + *out = *in + if in.ResourceClaimName != nil { + in, out := &in.ResourceClaimName, &out.ResourceClaimName + *out = new(string) + **out = **in + } + if in.ResourceClaimTemplateName != nil { + in, out := &in.ResourceClaimTemplateName, &out.ResourceClaimTemplateName + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupResourceClaim. +func (in *PodGroupResourceClaim) DeepCopy() *PodGroupResourceClaim { + if in == nil { + return nil + } + out := new(PodGroupResourceClaim) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupResourceClaimStatus) DeepCopyInto(out *PodGroupResourceClaimStatus) { + *out = *in + if in.ResourceClaimName != nil { + in, out := &in.ResourceClaimName, &out.ResourceClaimName + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupResourceClaimStatus. +func (in *PodGroupResourceClaimStatus) DeepCopy() *PodGroupResourceClaimStatus { + if in == nil { + return nil + } + out := new(PodGroupResourceClaimStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupSchedulingConstraints) DeepCopyInto(out *PodGroupSchedulingConstraints) { + *out = *in + if in.Topology != nil { + in, out := &in.Topology, &out.Topology + *out = make([]TopologyConstraint, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupSchedulingConstraints. +func (in *PodGroupSchedulingConstraints) DeepCopy() *PodGroupSchedulingConstraints { + if in == nil { + return nil + } + out := new(PodGroupSchedulingConstraints) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupSchedulingPolicy) DeepCopyInto(out *PodGroupSchedulingPolicy) { + *out = *in + if in.Basic != nil { + in, out := &in.Basic, &out.Basic + *out = new(BasicSchedulingPolicy) + **out = **in + } + if in.Gang != nil { + in, out := &in.Gang, &out.Gang + *out = new(GangSchedulingPolicy) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupSchedulingPolicy. +func (in *PodGroupSchedulingPolicy) DeepCopy() *PodGroupSchedulingPolicy { + if in == nil { + return nil + } + out := new(PodGroupSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupSpec) DeepCopyInto(out *PodGroupSpec) { + *out = *in + if in.ParentCompositePodGroupName != nil { + in, out := &in.ParentCompositePodGroupName, &out.ParentCompositePodGroupName + *out = new(string) + **out = **in + } + if in.WorkloadRef != nil { + in, out := &in.WorkloadRef, &out.WorkloadRef + *out = new(WorkloadReference) + **out = **in + } + in.SchedulingPolicy.DeepCopyInto(&out.SchedulingPolicy) + if in.SchedulingConstraints != nil { + in, out := &in.SchedulingConstraints, &out.SchedulingConstraints + *out = new(PodGroupSchedulingConstraints) + (*in).DeepCopyInto(*out) + } + if in.ResourceClaims != nil { + in, out := &in.ResourceClaims, &out.ResourceClaims + *out = make([]PodGroupResourceClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DisruptionMode != nil { + in, out := &in.DisruptionMode, &out.DisruptionMode + *out = new(DisruptionMode) + (*in).DeepCopyInto(*out) + } + if in.Priority != nil { + in, out := &in.Priority, &out.Priority + *out = new(int32) + **out = **in + } + if in.PreemptionPolicy != nil { + in, out := &in.PreemptionPolicy, &out.PreemptionPolicy + *out = new(PreemptionPolicy) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupSpec. +func (in *PodGroupSpec) DeepCopy() *PodGroupSpec { + if in == nil { + return nil + } + out := new(PodGroupSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupStatus) DeepCopyInto(out *PodGroupStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ResourceClaimStatuses != nil { + in, out := &in.ResourceClaimStatuses, &out.ResourceClaimStatuses + *out = make([]PodGroupResourceClaimStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupStatus. +func (in *PodGroupStatus) DeepCopy() *PodGroupStatus { + if in == nil { + return nil + } + out := new(PodGroupStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupTemplate) DeepCopyInto(out *PodGroupTemplate) { + *out = *in + in.SchedulingPolicy.DeepCopyInto(&out.SchedulingPolicy) + if in.SchedulingConstraints != nil { + in, out := &in.SchedulingConstraints, &out.SchedulingConstraints + *out = new(PodGroupSchedulingConstraints) + (*in).DeepCopyInto(*out) + } + if in.ResourceClaims != nil { + in, out := &in.ResourceClaims, &out.ResourceClaims + *out = make([]PodGroupResourceClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DisruptionMode != nil { + in, out := &in.DisruptionMode, &out.DisruptionMode + *out = new(DisruptionMode) + (*in).DeepCopyInto(*out) + } + if in.Priority != nil { + in, out := &in.Priority, &out.Priority + *out = new(int32) + **out = **in + } + if in.PreemptionPolicy != nil { + in, out := &in.PreemptionPolicy, &out.PreemptionPolicy + *out = new(PreemptionPolicy) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupTemplate. +func (in *PodGroupTemplate) DeepCopy() *PodGroupTemplate { + if in == nil { + return nil + } + out := new(PodGroupTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SingleCompositeDisruptionMode) DeepCopyInto(out *SingleCompositeDisruptionMode) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SingleCompositeDisruptionMode. +func (in *SingleCompositeDisruptionMode) DeepCopy() *SingleCompositeDisruptionMode { + if in == nil { + return nil + } + out := new(SingleCompositeDisruptionMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SingleDisruptionMode) DeepCopyInto(out *SingleDisruptionMode) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SingleDisruptionMode. +func (in *SingleDisruptionMode) DeepCopy() *SingleDisruptionMode { + if in == nil { + return nil + } + out := new(SingleDisruptionMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TopologyConstraint) DeepCopyInto(out *TopologyConstraint) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TopologyConstraint. +func (in *TopologyConstraint) DeepCopy() *TopologyConstraint { + if in == nil { + return nil + } + out := new(TopologyConstraint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TypedLocalObjectReference) DeepCopyInto(out *TypedLocalObjectReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TypedLocalObjectReference. +func (in *TypedLocalObjectReference) DeepCopy() *TypedLocalObjectReference { + if in == nil { + return nil + } + out := new(TypedLocalObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Workload) DeepCopyInto(out *Workload) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Workload. +func (in *Workload) DeepCopy() *Workload { + if in == nil { + return nil + } + out := new(Workload) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Workload) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadCompositePodGroupAllDisruptionMode) DeepCopyInto(out *WorkloadCompositePodGroupAllDisruptionMode) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadCompositePodGroupAllDisruptionMode. +func (in *WorkloadCompositePodGroupAllDisruptionMode) DeepCopy() *WorkloadCompositePodGroupAllDisruptionMode { + if in == nil { + return nil + } + out := new(WorkloadCompositePodGroupAllDisruptionMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadCompositePodGroupBasicSchedulingPolicy) DeepCopyInto(out *WorkloadCompositePodGroupBasicSchedulingPolicy) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadCompositePodGroupBasicSchedulingPolicy. +func (in *WorkloadCompositePodGroupBasicSchedulingPolicy) DeepCopy() *WorkloadCompositePodGroupBasicSchedulingPolicy { + if in == nil { + return nil + } + out := new(WorkloadCompositePodGroupBasicSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadCompositePodGroupDisruptionMode) DeepCopyInto(out *WorkloadCompositePodGroupDisruptionMode) { + *out = *in + if in.Single != nil { + in, out := &in.Single, &out.Single + *out = new(WorkloadCompositePodGroupSingleDisruptionMode) + **out = **in + } + if in.All != nil { + in, out := &in.All, &out.All + *out = new(WorkloadCompositePodGroupAllDisruptionMode) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadCompositePodGroupDisruptionMode. +func (in *WorkloadCompositePodGroupDisruptionMode) DeepCopy() *WorkloadCompositePodGroupDisruptionMode { + if in == nil { + return nil + } + out := new(WorkloadCompositePodGroupDisruptionMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadCompositePodGroupGangSchedulingPolicy) DeepCopyInto(out *WorkloadCompositePodGroupGangSchedulingPolicy) { + *out = *in + if in.MinGroupCount != nil { + in, out := &in.MinGroupCount, &out.MinGroupCount + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadCompositePodGroupGangSchedulingPolicy. +func (in *WorkloadCompositePodGroupGangSchedulingPolicy) DeepCopy() *WorkloadCompositePodGroupGangSchedulingPolicy { + if in == nil { + return nil + } + out := new(WorkloadCompositePodGroupGangSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadCompositePodGroupSchedulingConstraints) DeepCopyInto(out *WorkloadCompositePodGroupSchedulingConstraints) { + *out = *in + if in.Topology != nil { + in, out := &in.Topology, &out.Topology + *out = make([]TopologyConstraint, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadCompositePodGroupSchedulingConstraints. +func (in *WorkloadCompositePodGroupSchedulingConstraints) DeepCopy() *WorkloadCompositePodGroupSchedulingConstraints { + if in == nil { + return nil + } + out := new(WorkloadCompositePodGroupSchedulingConstraints) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadCompositePodGroupSchedulingPolicy) DeepCopyInto(out *WorkloadCompositePodGroupSchedulingPolicy) { + *out = *in + if in.Basic != nil { + in, out := &in.Basic, &out.Basic + *out = new(WorkloadCompositePodGroupBasicSchedulingPolicy) + **out = **in + } + if in.Gang != nil { + in, out := &in.Gang, &out.Gang + *out = new(WorkloadCompositePodGroupGangSchedulingPolicy) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadCompositePodGroupSchedulingPolicy. +func (in *WorkloadCompositePodGroupSchedulingPolicy) DeepCopy() *WorkloadCompositePodGroupSchedulingPolicy { + if in == nil { + return nil + } + out := new(WorkloadCompositePodGroupSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadCompositePodGroupSingleDisruptionMode) DeepCopyInto(out *WorkloadCompositePodGroupSingleDisruptionMode) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadCompositePodGroupSingleDisruptionMode. +func (in *WorkloadCompositePodGroupSingleDisruptionMode) DeepCopy() *WorkloadCompositePodGroupSingleDisruptionMode { + if in == nil { + return nil + } + out := new(WorkloadCompositePodGroupSingleDisruptionMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadList) DeepCopyInto(out *WorkloadList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Workload, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadList. +func (in *WorkloadList) DeepCopy() *WorkloadList { + if in == nil { + return nil + } + out := new(WorkloadList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *WorkloadList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadPodGroupAllDisruptionMode) DeepCopyInto(out *WorkloadPodGroupAllDisruptionMode) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadPodGroupAllDisruptionMode. +func (in *WorkloadPodGroupAllDisruptionMode) DeepCopy() *WorkloadPodGroupAllDisruptionMode { + if in == nil { + return nil + } + out := new(WorkloadPodGroupAllDisruptionMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadPodGroupBasicSchedulingPolicy) DeepCopyInto(out *WorkloadPodGroupBasicSchedulingPolicy) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadPodGroupBasicSchedulingPolicy. +func (in *WorkloadPodGroupBasicSchedulingPolicy) DeepCopy() *WorkloadPodGroupBasicSchedulingPolicy { + if in == nil { + return nil + } + out := new(WorkloadPodGroupBasicSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadPodGroupDisruptionMode) DeepCopyInto(out *WorkloadPodGroupDisruptionMode) { + *out = *in + if in.Single != nil { + in, out := &in.Single, &out.Single + *out = new(WorkloadPodGroupSingleDisruptionMode) + **out = **in + } + if in.All != nil { + in, out := &in.All, &out.All + *out = new(WorkloadPodGroupAllDisruptionMode) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadPodGroupDisruptionMode. +func (in *WorkloadPodGroupDisruptionMode) DeepCopy() *WorkloadPodGroupDisruptionMode { + if in == nil { + return nil + } + out := new(WorkloadPodGroupDisruptionMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadPodGroupGangSchedulingPolicy) DeepCopyInto(out *WorkloadPodGroupGangSchedulingPolicy) { + *out = *in + if in.MinCount != nil { + in, out := &in.MinCount, &out.MinCount + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadPodGroupGangSchedulingPolicy. +func (in *WorkloadPodGroupGangSchedulingPolicy) DeepCopy() *WorkloadPodGroupGangSchedulingPolicy { + if in == nil { + return nil + } + out := new(WorkloadPodGroupGangSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadPodGroupResourceClaim) DeepCopyInto(out *WorkloadPodGroupResourceClaim) { + *out = *in + if in.ResourceClaimName != nil { + in, out := &in.ResourceClaimName, &out.ResourceClaimName + *out = new(string) + **out = **in + } + if in.ResourceClaimTemplateName != nil { + in, out := &in.ResourceClaimTemplateName, &out.ResourceClaimTemplateName + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadPodGroupResourceClaim. +func (in *WorkloadPodGroupResourceClaim) DeepCopy() *WorkloadPodGroupResourceClaim { + if in == nil { + return nil + } + out := new(WorkloadPodGroupResourceClaim) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadPodGroupSchedulingConstraints) DeepCopyInto(out *WorkloadPodGroupSchedulingConstraints) { + *out = *in + if in.Topology != nil { + in, out := &in.Topology, &out.Topology + *out = make([]TopologyConstraint, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadPodGroupSchedulingConstraints. +func (in *WorkloadPodGroupSchedulingConstraints) DeepCopy() *WorkloadPodGroupSchedulingConstraints { + if in == nil { + return nil + } + out := new(WorkloadPodGroupSchedulingConstraints) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadPodGroupSchedulingPolicy) DeepCopyInto(out *WorkloadPodGroupSchedulingPolicy) { + *out = *in + if in.Basic != nil { + in, out := &in.Basic, &out.Basic + *out = new(WorkloadPodGroupBasicSchedulingPolicy) + **out = **in + } + if in.Gang != nil { + in, out := &in.Gang, &out.Gang + *out = new(WorkloadPodGroupGangSchedulingPolicy) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadPodGroupSchedulingPolicy. +func (in *WorkloadPodGroupSchedulingPolicy) DeepCopy() *WorkloadPodGroupSchedulingPolicy { + if in == nil { + return nil + } + out := new(WorkloadPodGroupSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadPodGroupSingleDisruptionMode) DeepCopyInto(out *WorkloadPodGroupSingleDisruptionMode) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadPodGroupSingleDisruptionMode. +func (in *WorkloadPodGroupSingleDisruptionMode) DeepCopy() *WorkloadPodGroupSingleDisruptionMode { + if in == nil { + return nil + } + out := new(WorkloadPodGroupSingleDisruptionMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadReference) DeepCopyInto(out *WorkloadReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadReference. +func (in *WorkloadReference) DeepCopy() *WorkloadReference { + if in == nil { + return nil + } + out := new(WorkloadReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadSpec) DeepCopyInto(out *WorkloadSpec) { + *out = *in + if in.ControllerRef != nil { + in, out := &in.ControllerRef, &out.ControllerRef + *out = new(TypedLocalObjectReference) + **out = **in + } + if in.PodGroupTemplates != nil { + in, out := &in.PodGroupTemplates, &out.PodGroupTemplates + *out = make([]PodGroupTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.CompositePodGroupTemplates != nil { + in, out := &in.CompositePodGroupTemplates, &out.CompositePodGroupTemplates + *out = make([]CompositePodGroupTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadSpec. +func (in *WorkloadSpec) DeepCopy() *WorkloadSpec { + if in == nil { + return nil + } + out := new(WorkloadSpec) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/k8s.io/api/scheduling/v1alpha3/zz_generated.model_name.go b/vendor/k8s.io/api/scheduling/v1alpha3/zz_generated.model_name.go new file mode 100644 index 0000000000..acd9818f25 --- /dev/null +++ b/vendor/k8s.io/api/scheduling/v1alpha3/zz_generated.model_name.go @@ -0,0 +1,257 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by openapi-gen. DO NOT EDIT. + +package v1alpha3 + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in AllCompositeDisruptionMode) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.AllCompositeDisruptionMode" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in AllDisruptionMode) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.AllDisruptionMode" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in BasicSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.BasicSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in CompositeBasicSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.CompositeBasicSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in CompositeDisruptionMode) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.CompositeDisruptionMode" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in CompositeGangSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.CompositeGangSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in CompositePodGroup) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.CompositePodGroup" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in CompositePodGroupList) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.CompositePodGroupList" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in CompositePodGroupSchedulingConstraints) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.CompositePodGroupSchedulingConstraints" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in CompositePodGroupSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.CompositePodGroupSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in CompositePodGroupSpec) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.CompositePodGroupSpec" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in CompositePodGroupStatus) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.CompositePodGroupStatus" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in CompositePodGroupTemplate) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.CompositePodGroupTemplate" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in DisruptionMode) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.DisruptionMode" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in GangSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.GangSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroup) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.PodGroup" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupList) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.PodGroupList" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupResourceClaim) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.PodGroupResourceClaim" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupResourceClaimStatus) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.PodGroupResourceClaimStatus" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupSchedulingConstraints) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.PodGroupSchedulingConstraints" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.PodGroupSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupSpec) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.PodGroupSpec" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupStatus) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.PodGroupStatus" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupTemplate) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.PodGroupTemplate" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in SingleCompositeDisruptionMode) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.SingleCompositeDisruptionMode" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in SingleDisruptionMode) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.SingleDisruptionMode" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in TopologyConstraint) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.TopologyConstraint" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in TypedLocalObjectReference) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.TypedLocalObjectReference" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in Workload) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.Workload" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadCompositePodGroupAllDisruptionMode) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.WorkloadCompositePodGroupAllDisruptionMode" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadCompositePodGroupBasicSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.WorkloadCompositePodGroupBasicSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadCompositePodGroupDisruptionMode) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.WorkloadCompositePodGroupDisruptionMode" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadCompositePodGroupGangSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.WorkloadCompositePodGroupGangSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadCompositePodGroupSchedulingConstraints) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.WorkloadCompositePodGroupSchedulingConstraints" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadCompositePodGroupSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.WorkloadCompositePodGroupSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadCompositePodGroupSingleDisruptionMode) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.WorkloadCompositePodGroupSingleDisruptionMode" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadList) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.WorkloadList" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadPodGroupAllDisruptionMode) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupAllDisruptionMode" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadPodGroupBasicSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupBasicSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadPodGroupDisruptionMode) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupDisruptionMode" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadPodGroupGangSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupGangSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadPodGroupResourceClaim) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupResourceClaim" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadPodGroupSchedulingConstraints) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupSchedulingConstraints" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadPodGroupSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadPodGroupSingleDisruptionMode) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupSingleDisruptionMode" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadReference) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.WorkloadReference" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadSpec) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha3.WorkloadSpec" +} diff --git a/vendor/k8s.io/api/scheduling/v1alpha3/zz_generated.validations.go b/vendor/k8s.io/api/scheduling/v1alpha3/zz_generated.validations.go new file mode 100644 index 0000000000..3202dbe2be --- /dev/null +++ b/vendor/k8s.io/api/scheduling/v1alpha3/zz_generated.validations.go @@ -0,0 +1,3368 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by validation-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + context "context" + + equality "k8s.io/apimachinery/pkg/api/equality" + operation "k8s.io/apimachinery/pkg/api/operation" + safe "k8s.io/apimachinery/pkg/api/safe" + validate "k8s.io/apimachinery/pkg/api/validate" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + validation "k8s.io/apimachinery/pkg/apis/meta/v1/validation" + sets "k8s.io/apimachinery/pkg/util/sets" + field "k8s.io/apimachinery/pkg/util/validation/field" +) + +var unionMembershipFor_k8s_io_api_scheduling_v1alpha3_CompositeDisruptionMode_ = validate.NewUnionMembership(validate.NewUnionMember("single"), validate.NewUnionMember("all")) + +// Validate_CompositeDisruptionMode validates an instance of CompositeDisruptionMode according +// to declarative validation rules in the API schema. +func Validate_CompositeDisruptionMode( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *CompositeDisruptionMode) (errs field.ErrorList) { + + if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_scheduling_v1alpha3_CompositeDisruptionMode_, + func(obj *CompositeDisruptionMode) bool { + if obj == nil { + return false + } + return obj.Single != nil + }, + func(obj *CompositeDisruptionMode) bool { + if obj == nil { + return false + } + return obj.All != nil + }); len(e) != 0 { + errs = append(errs, e...) + } + + { // field CompositeDisruptionMode.Single + fn := func( + fldPath *field.Path, + obj, oldObj *SingleCompositeDisruptionMode, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositeDisruptionMode) *SingleCompositeDisruptionMode { + return oldObj.Single + }) + errs = append(errs, fn(fldPath.Child("single"), obj.Single, oldVal, oldObj != nil)...) + } + + { // field CompositeDisruptionMode.All + fn := func( + fldPath *field.Path, + obj, oldObj *AllCompositeDisruptionMode, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositeDisruptionMode) *AllCompositeDisruptionMode { + return oldObj.All + }) + errs = append(errs, fn(fldPath.Child("all"), obj.All, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_CompositeGangSchedulingPolicy validates an instance of CompositeGangSchedulingPolicy according +// to declarative validation rules in the API schema. +func Validate_CompositeGangSchedulingPolicy( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *CompositeGangSchedulingPolicy) (errs field.ErrorList) { + + { // field CompositeGangSchedulingPolicy.MinGroupCount + fn := func( + fldPath *field.Path, + obj, oldObj *int32, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.Minimum(ctx, op, fldPath, obj, oldObj, 1); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositeGangSchedulingPolicy) *int32 { + return &oldObj.MinGroupCount + }) + errs = append(errs, fn(fldPath.Child("minGroupCount"), &obj.MinGroupCount, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_CompositePodGroup validates an instance of CompositePodGroup according +// to declarative validation rules in the API schema. +func Validate_CompositePodGroup( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *CompositePodGroup) (errs field.ErrorList) { + + // field CompositePodGroup.TypeMeta has no validation + + { // field CompositePodGroup.ObjectMeta + fn := func( + fldPath *field.Path, + obj, oldObj *v1.ObjectMeta, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call the type's validation function + errs = append(errs, validation.Validate_ObjectMeta(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroup) *v1.ObjectMeta { + return &oldObj.ObjectMeta + }) + errs = append(errs, fn(fldPath.Child("metadata"), &obj.ObjectMeta, oldVal, oldObj != nil)...) + } + + { // field CompositePodGroup.Spec + fn := func( + fldPath *field.Path, + obj, oldObj *CompositePodGroupSpec, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call the type's validation function + errs = append(errs, Validate_CompositePodGroupSpec(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroup) *CompositePodGroupSpec { + return &oldObj.Spec + }) + errs = append(errs, fn(fldPath.Child("spec"), &obj.Spec, oldVal, oldObj != nil)...) + } + + { // field CompositePodGroup.Status + fn := func( + fldPath *field.Path, + obj, oldObj *CompositePodGroupStatus, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call the type's validation function + errs = append(errs, Validate_CompositePodGroupStatus(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroup) *CompositePodGroupStatus { + return &oldObj.Status + }) + errs = append(errs, fn(fldPath.Child("status"), &obj.Status, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_CompositePodGroupSchedulingConstraints validates an instance of CompositePodGroupSchedulingConstraints according +// to declarative validation rules in the API schema. +func Validate_CompositePodGroupSchedulingConstraints( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *CompositePodGroupSchedulingConstraints) (errs field.ErrorList) { + + { // field CompositePodGroupSchedulingConstraints.Topology + fn := func( + fldPath *field.Path, + obj, oldObj []TopologyConstraint, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 1).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_TopologyConstraint); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupSchedulingConstraints) []TopologyConstraint { + return oldObj.Topology + }) + errs = append(errs, fn(fldPath.Child("topology"), obj.Topology, oldVal, oldObj != nil)...) + } + + return errs +} + +var unionMembershipFor_k8s_io_api_scheduling_v1alpha3_CompositePodGroupSchedulingPolicy_ = validate.NewUnionMembership(validate.NewUnionMember("basic"), validate.NewUnionMember("gang")) + +// Validate_CompositePodGroupSchedulingPolicy validates an instance of CompositePodGroupSchedulingPolicy according +// to declarative validation rules in the API schema. +func Validate_CompositePodGroupSchedulingPolicy( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *CompositePodGroupSchedulingPolicy) (errs field.ErrorList) { + + if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_scheduling_v1alpha3_CompositePodGroupSchedulingPolicy_, + func(obj *CompositePodGroupSchedulingPolicy) bool { + if obj == nil { + return false + } + return obj.Basic != nil + }, + func(obj *CompositePodGroupSchedulingPolicy) bool { + if obj == nil { + return false + } + return obj.Gang != nil + }); len(e) != 0 { + errs = append(errs, e...) + } + + { // field CompositePodGroupSchedulingPolicy.Basic + fn := func( + fldPath *field.Path, + obj, oldObj *CompositeBasicSchedulingPolicy, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupSchedulingPolicy) *CompositeBasicSchedulingPolicy { + return oldObj.Basic + }) + errs = append(errs, fn(fldPath.Child("basic"), obj.Basic, oldVal, oldObj != nil)...) + } + + { // field CompositePodGroupSchedulingPolicy.Gang + fn := func( + fldPath *field.Path, + obj, oldObj *CompositeGangSchedulingPolicy, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.UpdatePointer(ctx, op, fldPath, obj, oldObj, validate.NoSet, validate.NoUnset).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_CompositeGangSchedulingPolicy(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupSchedulingPolicy) *CompositeGangSchedulingPolicy { + return oldObj.Gang + }) + errs = append(errs, fn(fldPath.Child("gang"), obj.Gang, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_CompositePodGroupSpec validates an instance of CompositePodGroupSpec according +// to declarative validation rules in the API schema. +func Validate_CompositePodGroupSpec( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *CompositePodGroupSpec) (errs field.ErrorList) { + + { // field CompositePodGroupSpec.ParentCompositePodGroupName + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupSpec) *string { + return oldObj.ParentCompositePodGroupName + }) + errs = append(errs, fn(fldPath.Child("parentCompositePodGroupName"), obj.ParentCompositePodGroupName, oldVal, oldObj != nil)...) + } + + { // field CompositePodGroupSpec.WorkloadRef + fn := func( + fldPath *field.Path, + obj, oldObj *WorkloadReference, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_WorkloadReference(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupSpec) *WorkloadReference { + return oldObj.WorkloadRef + }) + errs = append(errs, fn(fldPath.Child("workloadRef"), obj.WorkloadRef, oldVal, oldObj != nil)...) + } + + { // field CompositePodGroupSpec.SchedulingPolicy + fn := func( + fldPath *field.Path, + obj, oldObj *CompositePodGroupSchedulingPolicy, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_CompositePodGroupSchedulingPolicy(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupSpec) *CompositePodGroupSchedulingPolicy { + return &oldObj.SchedulingPolicy + }) + errs = append(errs, fn(fldPath.Child("schedulingPolicy"), &obj.SchedulingPolicy, oldVal, oldObj != nil)...) + } + + { // field CompositePodGroupSpec.SchedulingConstraints + fn := func( + fldPath *field.Path, + obj, oldObj *CompositePodGroupSchedulingConstraints, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_CompositePodGroupSchedulingConstraints(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupSpec) *CompositePodGroupSchedulingConstraints { + return oldObj.SchedulingConstraints + }) + errs = append(errs, fn(fldPath.Child("schedulingConstraints"), obj.SchedulingConstraints, oldVal, oldObj != nil)...) + } + + { // field CompositePodGroupSpec.DisruptionMode + fn := func( + fldPath *field.Path, + obj, oldObj *CompositeDisruptionMode, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + // optional fields with default values are effectively required + if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_CompositeDisruptionMode(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupSpec) *CompositeDisruptionMode { + return oldObj.DisruptionMode + }) + errs = append(errs, fn(fldPath.Child("disruptionMode"), obj.DisruptionMode, oldVal, oldObj != nil)...) + } + + { // field CompositePodGroupSpec.PriorityClassName + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupSpec) *string { + return &oldObj.PriorityClassName + }) + errs = append(errs, fn(fldPath.Child("priorityClassName"), &obj.PriorityClassName, oldVal, oldObj != nil)...) + } + + { // field CompositePodGroupSpec.Priority + fn := func( + fldPath *field.Path, + obj, oldObj *int32, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.Maximum(ctx, op, fldPath, obj, oldObj, 1000000000); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupSpec) *int32 { + return oldObj.Priority + }) + errs = append(errs, fn(fldPath.Child("priority"), obj.Priority, oldVal, oldObj != nil)...) + } + + { // field CompositePodGroupSpec.PreemptionPolicy + fn := func( + fldPath *field.Path, + obj, oldObj *PreemptionPolicy, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", false, validate.ForbiddenPointer).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", false, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", true, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_PreemptionPolicy(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupSpec) *PreemptionPolicy { + return oldObj.PreemptionPolicy + }) + errs = append(errs, fn(fldPath.Child("preemptionPolicy"), obj.PreemptionPolicy, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_CompositePodGroupStatus validates an instance of CompositePodGroupStatus according +// to declarative validation rules in the API schema. +func Validate_CompositePodGroupStatus( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *CompositePodGroupStatus) (errs field.ErrorList) { + + { // field CompositePodGroupStatus.Conditions + fn := func( + fldPath *field.Path, + obj, oldObj []v1.Condition, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with map semantics require unique keys + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, + func(a *v1.Condition, b *v1.Condition) bool { return a.Type == b.Type }).MarkAlpha(); len(e) != 0 { + errs = append(errs, e...) + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, + func(a *v1.Condition, b *v1.Condition) bool { return a.Type == b.Type }, validate.SemanticDeepEqual, validation.Validate_Condition); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupStatus) []v1.Condition { + return oldObj.Conditions + }) + errs = append(errs, fn(fldPath.Child("conditions"), obj.Conditions, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_CompositePodGroupTemplate validates an instance of CompositePodGroupTemplate according +// to declarative validation rules in the API schema. +func Validate_CompositePodGroupTemplate( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *CompositePodGroupTemplate) (errs field.ErrorList) { + + { // field CompositePodGroupTemplate.Name + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupTemplate) *string { + return &oldObj.Name + }) + errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...) + } + + { // field CompositePodGroupTemplate.SchedulingPolicy + fn := func( + fldPath *field.Path, + obj, oldObj *CompositePodGroupSchedulingPolicy, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call the type's validation function + errs = append(errs, Validate_CompositePodGroupSchedulingPolicy(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupTemplate) *CompositePodGroupSchedulingPolicy { + return &oldObj.SchedulingPolicy + }) + errs = append(errs, fn(fldPath.Child("schedulingPolicy"), &obj.SchedulingPolicy, oldVal, oldObj != nil)...) + } + + { // field CompositePodGroupTemplate.SchedulingConstraints + fn := func( + fldPath *field.Path, + obj, oldObj *CompositePodGroupSchedulingConstraints, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_CompositePodGroupSchedulingConstraints(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupTemplate) *CompositePodGroupSchedulingConstraints { + return oldObj.SchedulingConstraints + }) + errs = append(errs, fn(fldPath.Child("schedulingConstraints"), obj.SchedulingConstraints, oldVal, oldObj != nil)...) + } + + { // field CompositePodGroupTemplate.DisruptionMode + fn := func( + fldPath *field.Path, + obj, oldObj *CompositeDisruptionMode, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_CompositeDisruptionMode(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupTemplate) *CompositeDisruptionMode { + return oldObj.DisruptionMode + }) + errs = append(errs, fn(fldPath.Child("disruptionMode"), obj.DisruptionMode, oldVal, oldObj != nil)...) + } + + { // field CompositePodGroupTemplate.PriorityClassName + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupTemplate) *string { + return &oldObj.PriorityClassName + }) + errs = append(errs, fn(fldPath.Child("priorityClassName"), &obj.PriorityClassName, oldVal, oldObj != nil)...) + } + + { // field CompositePodGroupTemplate.Priority + fn := func( + fldPath *field.Path, + obj, oldObj *int32, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.Maximum(ctx, op, fldPath, obj, oldObj, 1000000000); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupTemplate) *int32 { + return oldObj.Priority + }) + errs = append(errs, fn(fldPath.Child("priority"), obj.Priority, oldVal, oldObj != nil)...) + } + + { // field CompositePodGroupTemplate.PreemptionPolicy + fn := func( + fldPath *field.Path, + obj, oldObj *PreemptionPolicy, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", false, validate.ForbiddenPointer).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", false, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", true, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_PreemptionPolicy(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupTemplate) *PreemptionPolicy { + return oldObj.PreemptionPolicy + }) + errs = append(errs, fn(fldPath.Child("preemptionPolicy"), obj.PreemptionPolicy, oldVal, oldObj != nil)...) + } + + { // field CompositePodGroupTemplate.PodGroupTemplates + fn := func( + fldPath *field.Path, + obj, oldObj []PodGroupTemplate, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 8).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.ValSliceUpdate(ctx, op, fldPath, obj, oldObj, + func(a *PodGroupTemplate, b *PodGroupTemplate) bool { return a.Name == b.Name }, validate.NoAddItem, validate.NoRemoveItem).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with map semantics require unique keys + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, + func(a *PodGroupTemplate, b *PodGroupTemplate) bool { return a.Name == b.Name }); len(e) != 0 { + errs = append(errs, e...) + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, + func(a *PodGroupTemplate, b *PodGroupTemplate) bool { return a.Name == b.Name }, validate.SemanticDeepEqual, Validate_PodGroupTemplate); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupTemplate) []PodGroupTemplate { + return oldObj.PodGroupTemplates + }) + errs = append(errs, fn(fldPath.Child("podGroupTemplates"), obj.PodGroupTemplates, oldVal, oldObj != nil)...) + } + + { // field CompositePodGroupTemplate.CompositePodGroupTemplates + fn := func( + fldPath *field.Path, + obj, oldObj []CompositePodGroupTemplate, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 8).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.ValSliceUpdate(ctx, op, fldPath, obj, oldObj, + func(a *CompositePodGroupTemplate, b *CompositePodGroupTemplate) bool { return a.Name == b.Name }, validate.NoAddItem, validate.NoRemoveItem).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with map semantics require unique keys + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, + func(a *CompositePodGroupTemplate, b *CompositePodGroupTemplate) bool { return a.Name == b.Name }); len(e) != 0 { + errs = append(errs, e...) + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, + func(a *CompositePodGroupTemplate, b *CompositePodGroupTemplate) bool { return a.Name == b.Name }, validate.SemanticDeepEqual, Validate_CompositePodGroupTemplate); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *CompositePodGroupTemplate) []CompositePodGroupTemplate { + return oldObj.CompositePodGroupTemplates + }) + errs = append(errs, fn(fldPath.Child("compositePodGroupTemplates"), obj.CompositePodGroupTemplates, oldVal, oldObj != nil)...) + } + + return errs +} + +var unionMembershipFor_k8s_io_api_scheduling_v1alpha3_DisruptionMode_ = validate.NewUnionMembership(validate.NewUnionMember("single"), validate.NewUnionMember("all")) + +// Validate_DisruptionMode validates an instance of DisruptionMode according +// to declarative validation rules in the API schema. +func Validate_DisruptionMode( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *DisruptionMode) (errs field.ErrorList) { + + if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_scheduling_v1alpha3_DisruptionMode_, + func(obj *DisruptionMode) bool { + if obj == nil { + return false + } + return obj.Single != nil + }, + func(obj *DisruptionMode) bool { + if obj == nil { + return false + } + return obj.All != nil + }); len(e) != 0 { + errs = append(errs, e...) + } + + { // field DisruptionMode.Single + fn := func( + fldPath *field.Path, + obj, oldObj *SingleDisruptionMode, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DisruptionMode) *SingleDisruptionMode { + return oldObj.Single + }) + errs = append(errs, fn(fldPath.Child("single"), obj.Single, oldVal, oldObj != nil)...) + } + + { // field DisruptionMode.All + fn := func( + fldPath *field.Path, + obj, oldObj *AllDisruptionMode, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *DisruptionMode) *AllDisruptionMode { + return oldObj.All + }) + errs = append(errs, fn(fldPath.Child("all"), obj.All, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_GangSchedulingPolicy validates an instance of GangSchedulingPolicy according +// to declarative validation rules in the API schema. +func Validate_GangSchedulingPolicy( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *GangSchedulingPolicy) (errs field.ErrorList) { + + { // field GangSchedulingPolicy.MinCount + fn := func( + fldPath *field.Path, + obj, oldObj *int32, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.Minimum(ctx, op, fldPath, obj, oldObj, 1); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *GangSchedulingPolicy) *int32 { + return &oldObj.MinCount + }) + errs = append(errs, fn(fldPath.Child("minCount"), &obj.MinCount, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_PodGroup validates an instance of PodGroup according +// to declarative validation rules in the API schema. +func Validate_PodGroup( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *PodGroup) (errs field.ErrorList) { + + // field PodGroup.TypeMeta has no validation + + { // field PodGroup.ObjectMeta + fn := func( + fldPath *field.Path, + obj, oldObj *v1.ObjectMeta, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call the type's validation function + errs = append(errs, validation.Validate_ObjectMeta(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroup) *v1.ObjectMeta { + return &oldObj.ObjectMeta + }) + errs = append(errs, fn(fldPath.Child("metadata"), &obj.ObjectMeta, oldVal, oldObj != nil)...) + } + + { // field PodGroup.Spec + fn := func( + fldPath *field.Path, + obj, oldObj *PodGroupSpec, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call the type's validation function + errs = append(errs, Validate_PodGroupSpec(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroup) *PodGroupSpec { + return &oldObj.Spec + }) + errs = append(errs, fn(fldPath.Child("spec"), &obj.Spec, oldVal, oldObj != nil)...) + } + + { // field PodGroup.Status + fn := func( + fldPath *field.Path, + obj, oldObj *PodGroupStatus, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call the type's validation function + errs = append(errs, Validate_PodGroupStatus(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroup) *PodGroupStatus { + return &oldObj.Status + }) + errs = append(errs, fn(fldPath.Child("status"), &obj.Status, oldVal, oldObj != nil)...) + } + + return errs +} + +var unionMembershipFor_k8s_io_api_scheduling_v1alpha3_PodGroupResourceClaim_ = validate.NewUnionMembership(validate.NewUnionMember("resourceClaimName"), validate.NewUnionMember("resourceClaimTemplateName")) + +// Validate_PodGroupResourceClaim validates an instance of PodGroupResourceClaim according +// to declarative validation rules in the API schema. +func Validate_PodGroupResourceClaim( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *PodGroupResourceClaim) (errs field.ErrorList) { + + if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_scheduling_v1alpha3_PodGroupResourceClaim_, + func(obj *PodGroupResourceClaim) bool { + if obj == nil { + return false + } + return obj.ResourceClaimName != nil + }, + func(obj *PodGroupResourceClaim) bool { + if obj == nil { + return false + } + return obj.ResourceClaimTemplateName != nil + }); len(e) != 0 { + errs = append(errs, e...) + } + + { // field PodGroupResourceClaim.Name + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupResourceClaim) *string { + return &oldObj.Name + }) + errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...) + } + + { // field PodGroupResourceClaim.ResourceClaimName + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupResourceClaim) *string { + return oldObj.ResourceClaimName + }) + errs = append(errs, fn(fldPath.Child("resourceClaimName"), obj.ResourceClaimName, oldVal, oldObj != nil)...) + } + + { // field PodGroupResourceClaim.ResourceClaimTemplateName + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupResourceClaim) *string { + return oldObj.ResourceClaimTemplateName + }) + errs = append(errs, fn(fldPath.Child("resourceClaimTemplateName"), obj.ResourceClaimTemplateName, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_PodGroupResourceClaimStatus validates an instance of PodGroupResourceClaimStatus according +// to declarative validation rules in the API schema. +func Validate_PodGroupResourceClaimStatus( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *PodGroupResourceClaimStatus) (errs field.ErrorList) { + + // field PodGroupResourceClaimStatus.Name has no validation + + { // field PodGroupResourceClaimStatus.ResourceClaimName + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupResourceClaimStatus) *string { + return oldObj.ResourceClaimName + }) + errs = append(errs, fn(fldPath.Child("resourceClaimName"), obj.ResourceClaimName, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_PodGroupSchedulingConstraints validates an instance of PodGroupSchedulingConstraints according +// to declarative validation rules in the API schema. +func Validate_PodGroupSchedulingConstraints( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *PodGroupSchedulingConstraints) (errs field.ErrorList) { + + { // field PodGroupSchedulingConstraints.Topology + fn := func( + fldPath *field.Path, + obj, oldObj []TopologyConstraint, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 1).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_TopologyConstraint); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupSchedulingConstraints) []TopologyConstraint { + return oldObj.Topology + }) + errs = append(errs, fn(fldPath.Child("topology"), obj.Topology, oldVal, oldObj != nil)...) + } + + return errs +} + +var unionMembershipFor_k8s_io_api_scheduling_v1alpha3_PodGroupSchedulingPolicy_ = validate.NewUnionMembership(validate.NewUnionMember("basic"), validate.NewUnionMember("gang")) + +// Validate_PodGroupSchedulingPolicy validates an instance of PodGroupSchedulingPolicy according +// to declarative validation rules in the API schema. +func Validate_PodGroupSchedulingPolicy( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *PodGroupSchedulingPolicy) (errs field.ErrorList) { + + if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_scheduling_v1alpha3_PodGroupSchedulingPolicy_, + func(obj *PodGroupSchedulingPolicy) bool { + if obj == nil { + return false + } + return obj.Basic != nil + }, + func(obj *PodGroupSchedulingPolicy) bool { + if obj == nil { + return false + } + return obj.Gang != nil + }); len(e) != 0 { + errs = append(errs, e...) + } + + { // field PodGroupSchedulingPolicy.Basic + fn := func( + fldPath *field.Path, + obj, oldObj *BasicSchedulingPolicy, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupSchedulingPolicy) *BasicSchedulingPolicy { + return oldObj.Basic + }) + errs = append(errs, fn(fldPath.Child("basic"), obj.Basic, oldVal, oldObj != nil)...) + } + + { // field PodGroupSchedulingPolicy.Gang + fn := func( + fldPath *field.Path, + obj, oldObj *GangSchedulingPolicy, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.UpdatePointer(ctx, op, fldPath, obj, oldObj, validate.NoSet, validate.NoUnset).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_GangSchedulingPolicy(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupSchedulingPolicy) *GangSchedulingPolicy { + return oldObj.Gang + }) + errs = append(errs, fn(fldPath.Child("gang"), obj.Gang, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_PodGroupSpec validates an instance of PodGroupSpec according +// to declarative validation rules in the API schema. +func Validate_PodGroupSpec( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *PodGroupSpec) (errs field.ErrorList) { + + if e := validate.DependentRequired(ctx, op, fldPath, obj, oldObj, "parentCompositePodGroupName", + func(obj *PodGroupSpec) bool { + if obj == nil { + return false + } + return obj.ParentCompositePodGroupName != nil + }, "workloadRef", + func(obj *PodGroupSpec) bool { + if obj == nil { + return false + } + return obj.WorkloadRef != nil + }).MarkAlpha(); len(e) != 0 { + errs = append(errs, e...) + } + + { // field PodGroupSpec.ParentCompositePodGroupName + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "CompositePodGroup", false, validate.ForbiddenPointer).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "CompositePodGroup", false, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "CompositePodGroup", true, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupSpec) *string { + return oldObj.ParentCompositePodGroupName + }) + errs = append(errs, fn(fldPath.Child("parentCompositePodGroupName"), obj.ParentCompositePodGroupName, oldVal, oldObj != nil)...) + } + + { // field PodGroupSpec.WorkloadRef + fn := func( + fldPath *field.Path, + obj, oldObj *WorkloadReference, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_WorkloadReference(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupSpec) *WorkloadReference { + return oldObj.WorkloadRef + }) + errs = append(errs, fn(fldPath.Child("workloadRef"), obj.WorkloadRef, oldVal, oldObj != nil)...) + } + + { // field PodGroupSpec.SchedulingPolicy + fn := func( + fldPath *field.Path, + obj, oldObj *PodGroupSchedulingPolicy, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call the type's validation function + errs = append(errs, Validate_PodGroupSchedulingPolicy(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupSpec) *PodGroupSchedulingPolicy { + return &oldObj.SchedulingPolicy + }) + errs = append(errs, fn(fldPath.Child("schedulingPolicy"), &obj.SchedulingPolicy, oldVal, oldObj != nil)...) + } + + { // field PodGroupSpec.SchedulingConstraints + fn := func( + fldPath *field.Path, + obj, oldObj *PodGroupSchedulingConstraints, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "TopologyAwareWorkloadScheduling", false, validate.ForbiddenPointer).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "TopologyAwareWorkloadScheduling", false, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "TopologyAwareWorkloadScheduling", true, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "TopologyAwareWorkloadScheduling", true, validate.Immutable).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_PodGroupSchedulingConstraints(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupSpec) *PodGroupSchedulingConstraints { + return oldObj.SchedulingConstraints + }) + errs = append(errs, fn(fldPath.Child("schedulingConstraints"), obj.SchedulingConstraints, oldVal, oldObj != nil)...) + } + + { // field PodGroupSpec.ResourceClaims + fn := func( + fldPath *field.Path, + obj, oldObj []PodGroupResourceClaim, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 4).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with map semantics require unique keys + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, + func(a *PodGroupResourceClaim, b *PodGroupResourceClaim) bool { return a.Name == b.Name }); len(e) != 0 { + errs = append(errs, e...) + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, + func(a *PodGroupResourceClaim, b *PodGroupResourceClaim) bool { return a.Name == b.Name }, validate.SemanticDeepEqual, Validate_PodGroupResourceClaim); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupSpec) []PodGroupResourceClaim { + return oldObj.ResourceClaims + }) + errs = append(errs, fn(fldPath.Child("resourceClaims"), obj.ResourceClaims, oldVal, oldObj != nil)...) + } + + { // field PodGroupSpec.DisruptionMode + fn := func( + fldPath *field.Path, + obj, oldObj *DisruptionMode, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + // optional fields with default values are effectively required + if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_DisruptionMode(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupSpec) *DisruptionMode { + return oldObj.DisruptionMode + }) + errs = append(errs, fn(fldPath.Child("disruptionMode"), obj.DisruptionMode, oldVal, oldObj != nil)...) + } + + { // field PodGroupSpec.PriorityClassName + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupSpec) *string { + return &oldObj.PriorityClassName + }) + errs = append(errs, fn(fldPath.Child("priorityClassName"), &obj.PriorityClassName, oldVal, oldObj != nil)...) + } + + { // field PodGroupSpec.Priority + fn := func( + fldPath *field.Path, + obj, oldObj *int32, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.Maximum(ctx, op, fldPath, obj, oldObj, 1000000000); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupSpec) *int32 { + return oldObj.Priority + }) + errs = append(errs, fn(fldPath.Child("priority"), obj.Priority, oldVal, oldObj != nil)...) + } + + { // field PodGroupSpec.PreemptionPolicy + fn := func( + fldPath *field.Path, + obj, oldObj *PreemptionPolicy, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", false, validate.ForbiddenPointer).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", false, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", true, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_PreemptionPolicy(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupSpec) *PreemptionPolicy { + return oldObj.PreemptionPolicy + }) + errs = append(errs, fn(fldPath.Child("preemptionPolicy"), obj.PreemptionPolicy, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_PodGroupStatus validates an instance of PodGroupStatus according +// to declarative validation rules in the API schema. +func Validate_PodGroupStatus( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *PodGroupStatus) (errs field.ErrorList) { + + { // field PodGroupStatus.Conditions + fn := func( + fldPath *field.Path, + obj, oldObj []v1.Condition, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with map semantics require unique keys + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, + func(a *v1.Condition, b *v1.Condition) bool { return a.Type == b.Type }).MarkAlpha(); len(e) != 0 { + errs = append(errs, e...) + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, + func(a *v1.Condition, b *v1.Condition) bool { return a.Type == b.Type }, validate.SemanticDeepEqual, validation.Validate_Condition); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupStatus) []v1.Condition { + return oldObj.Conditions + }) + errs = append(errs, fn(fldPath.Child("conditions"), obj.Conditions, oldVal, oldObj != nil)...) + } + + { // field PodGroupStatus.ResourceClaimStatuses + fn := func( + fldPath *field.Path, + obj, oldObj []PodGroupResourceClaimStatus, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 4).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with map semantics require unique keys + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, + func(a *PodGroupResourceClaimStatus, b *PodGroupResourceClaimStatus) bool { return a.Name == b.Name }); len(e) != 0 { + errs = append(errs, e...) + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, + func(a *PodGroupResourceClaimStatus, b *PodGroupResourceClaimStatus) bool { return a.Name == b.Name }, validate.SemanticDeepEqual, Validate_PodGroupResourceClaimStatus); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupStatus) []PodGroupResourceClaimStatus { + return oldObj.ResourceClaimStatuses + }) + errs = append(errs, fn(fldPath.Child("resourceClaimStatuses"), obj.ResourceClaimStatuses, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_PodGroupTemplate validates an instance of PodGroupTemplate according +// to declarative validation rules in the API schema. +func Validate_PodGroupTemplate( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *PodGroupTemplate) (errs field.ErrorList) { + + { // field PodGroupTemplate.Name + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupTemplate) *string { + return &oldObj.Name + }) + errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...) + } + + { // field PodGroupTemplate.SchedulingPolicy + fn := func( + fldPath *field.Path, + obj, oldObj *PodGroupSchedulingPolicy, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call the type's validation function + errs = append(errs, Validate_PodGroupSchedulingPolicy(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupTemplate) *PodGroupSchedulingPolicy { + return &oldObj.SchedulingPolicy + }) + errs = append(errs, fn(fldPath.Child("schedulingPolicy"), &obj.SchedulingPolicy, oldVal, oldObj != nil)...) + } + + { // field PodGroupTemplate.SchedulingConstraints + fn := func( + fldPath *field.Path, + obj, oldObj *PodGroupSchedulingConstraints, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "TopologyAwareWorkloadScheduling", false, validate.ForbiddenPointer).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "TopologyAwareWorkloadScheduling", false, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "TopologyAwareWorkloadScheduling", true, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_PodGroupSchedulingConstraints(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupTemplate) *PodGroupSchedulingConstraints { + return oldObj.SchedulingConstraints + }) + errs = append(errs, fn(fldPath.Child("schedulingConstraints"), obj.SchedulingConstraints, oldVal, oldObj != nil)...) + } + + { // field PodGroupTemplate.ResourceClaims + fn := func( + fldPath *field.Path, + obj, oldObj []PodGroupResourceClaim, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 4).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with map semantics require unique keys + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, + func(a *PodGroupResourceClaim, b *PodGroupResourceClaim) bool { return a.Name == b.Name }); len(e) != 0 { + errs = append(errs, e...) + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, + func(a *PodGroupResourceClaim, b *PodGroupResourceClaim) bool { return a.Name == b.Name }, validate.SemanticDeepEqual, Validate_PodGroupResourceClaim); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupTemplate) []PodGroupResourceClaim { + return oldObj.ResourceClaims + }) + errs = append(errs, fn(fldPath.Child("resourceClaims"), obj.ResourceClaims, oldVal, oldObj != nil)...) + } + + { // field PodGroupTemplate.DisruptionMode + fn := func( + fldPath *field.Path, + obj, oldObj *DisruptionMode, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_DisruptionMode(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupTemplate) *DisruptionMode { + return oldObj.DisruptionMode + }) + errs = append(errs, fn(fldPath.Child("disruptionMode"), obj.DisruptionMode, oldVal, oldObj != nil)...) + } + + { // field PodGroupTemplate.PriorityClassName + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupTemplate) *string { + return &oldObj.PriorityClassName + }) + errs = append(errs, fn(fldPath.Child("priorityClassName"), &obj.PriorityClassName, oldVal, oldObj != nil)...) + } + + { // field PodGroupTemplate.Priority + fn := func( + fldPath *field.Path, + obj, oldObj *int32, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.Maximum(ctx, op, fldPath, obj, oldObj, 1000000000); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupTemplate) *int32 { + return oldObj.Priority + }) + errs = append(errs, fn(fldPath.Child("priority"), obj.Priority, oldVal, oldObj != nil)...) + } + + { // field PodGroupTemplate.PreemptionPolicy + fn := func( + fldPath *field.Path, + obj, oldObj *PreemptionPolicy, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", false, validate.ForbiddenPointer).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", false, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", true, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_PreemptionPolicy(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *PodGroupTemplate) *PreemptionPolicy { + return oldObj.PreemptionPolicy + }) + errs = append(errs, fn(fldPath.Child("preemptionPolicy"), obj.PreemptionPolicy, oldVal, oldObj != nil)...) + } + + return errs +} + +var symbolsForPreemptionPolicy = sets.New(PreemptLowerPriority, PreemptNever) + +// Validate_PreemptionPolicy validates an instance of PreemptionPolicy according +// to declarative validation rules in the API schema. +func Validate_PreemptionPolicy( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *PreemptionPolicy) (errs field.ErrorList) { + + if e := validate.Enum(ctx, op, fldPath, obj, oldObj, symbolsForPreemptionPolicy, nil); len(e) != 0 { + errs = append(errs, e...) + } + + return errs +} + +// Validate_TopologyConstraint validates an instance of TopologyConstraint according +// to declarative validation rules in the API schema. +func Validate_TopologyConstraint( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *TopologyConstraint) (errs field.ErrorList) { + + { // field TopologyConstraint.Key + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LabelKey(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *TopologyConstraint) *string { + return &oldObj.Key + }) + errs = append(errs, fn(fldPath.Child("key"), &obj.Key, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_TypedLocalObjectReference validates an instance of TypedLocalObjectReference according +// to declarative validation rules in the API schema. +func Validate_TypedLocalObjectReference( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *TypedLocalObjectReference) (errs field.ErrorList) { + + { // field TypedLocalObjectReference.APIGroup + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *TypedLocalObjectReference) *string { + return &oldObj.APIGroup + }) + errs = append(errs, fn(fldPath.Child("apiGroup"), &obj.APIGroup, oldVal, oldObj != nil)...) + } + + { // field TypedLocalObjectReference.Kind + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.PathSegmentName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *TypedLocalObjectReference) *string { + return &oldObj.Kind + }) + errs = append(errs, fn(fldPath.Child("kind"), &obj.Kind, oldVal, oldObj != nil)...) + } + + { // field TypedLocalObjectReference.Name + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.PathSegmentName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *TypedLocalObjectReference) *string { + return &oldObj.Name + }) + errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_Workload validates an instance of Workload according +// to declarative validation rules in the API schema. +func Validate_Workload( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *Workload) (errs field.ErrorList) { + + // field Workload.TypeMeta has no validation + + { // field Workload.ObjectMeta + fn := func( + fldPath *field.Path, + obj, oldObj *v1.ObjectMeta, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call the type's validation function + errs = append(errs, validation.Validate_ObjectMeta(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *Workload) *v1.ObjectMeta { + return &oldObj.ObjectMeta + }) + errs = append(errs, fn(fldPath.Child("metadata"), &obj.ObjectMeta, oldVal, oldObj != nil)...) + } + + { // field Workload.Spec + fn := func( + fldPath *field.Path, + obj, oldObj *WorkloadSpec, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call the type's validation function + errs = append(errs, Validate_WorkloadSpec(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *Workload) *WorkloadSpec { + return &oldObj.Spec + }) + errs = append(errs, fn(fldPath.Child("spec"), &obj.Spec, oldVal, oldObj != nil)...) + } + + return errs +} + +var unionMembershipFor_k8s_io_api_scheduling_v1alpha3_WorkloadCompositePodGroupDisruptionMode_ = validate.NewUnionMembership(validate.NewUnionMember("single"), validate.NewUnionMember("all")) + +// Validate_WorkloadCompositePodGroupDisruptionMode validates an instance of WorkloadCompositePodGroupDisruptionMode according +// to declarative validation rules in the API schema. +func Validate_WorkloadCompositePodGroupDisruptionMode( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *WorkloadCompositePodGroupDisruptionMode) (errs field.ErrorList) { + + if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_scheduling_v1alpha3_WorkloadCompositePodGroupDisruptionMode_, + func(obj *WorkloadCompositePodGroupDisruptionMode) bool { + if obj == nil { + return false + } + return obj.Single != nil + }, + func(obj *WorkloadCompositePodGroupDisruptionMode) bool { + if obj == nil { + return false + } + return obj.All != nil + }); len(e) != 0 { + errs = append(errs, e...) + } + + { // field WorkloadCompositePodGroupDisruptionMode.Single + fn := func( + fldPath *field.Path, + obj, oldObj *WorkloadCompositePodGroupSingleDisruptionMode, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadCompositePodGroupDisruptionMode) *WorkloadCompositePodGroupSingleDisruptionMode { + return oldObj.Single + }) + errs = append(errs, fn(fldPath.Child("single"), obj.Single, oldVal, oldObj != nil)...) + } + + { // field WorkloadCompositePodGroupDisruptionMode.All + fn := func( + fldPath *field.Path, + obj, oldObj *WorkloadCompositePodGroupAllDisruptionMode, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadCompositePodGroupDisruptionMode) *WorkloadCompositePodGroupAllDisruptionMode { + return oldObj.All + }) + errs = append(errs, fn(fldPath.Child("all"), obj.All, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_WorkloadCompositePodGroupGangSchedulingPolicy validates an instance of WorkloadCompositePodGroupGangSchedulingPolicy according +// to declarative validation rules in the API schema. +func Validate_WorkloadCompositePodGroupGangSchedulingPolicy( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *WorkloadCompositePodGroupGangSchedulingPolicy) (errs field.ErrorList) { + + { // field WorkloadCompositePodGroupGangSchedulingPolicy.MinGroupCount + fn := func( + fldPath *field.Path, + obj, oldObj *int32, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.Minimum(ctx, op, fldPath, obj, oldObj, 1); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadCompositePodGroupGangSchedulingPolicy) *int32 { + return oldObj.MinGroupCount + }) + errs = append(errs, fn(fldPath.Child("minGroupCount"), obj.MinGroupCount, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_WorkloadCompositePodGroupSchedulingConstraints validates an instance of WorkloadCompositePodGroupSchedulingConstraints according +// to declarative validation rules in the API schema. +func Validate_WorkloadCompositePodGroupSchedulingConstraints( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *WorkloadCompositePodGroupSchedulingConstraints) (errs field.ErrorList) { + + { // field WorkloadCompositePodGroupSchedulingConstraints.Topology + fn := func( + fldPath *field.Path, + obj, oldObj []TopologyConstraint, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 1).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_TopologyConstraint); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadCompositePodGroupSchedulingConstraints) []TopologyConstraint { + return oldObj.Topology + }) + errs = append(errs, fn(fldPath.Child("topology"), obj.Topology, oldVal, oldObj != nil)...) + } + + return errs +} + +var unionMembershipFor_k8s_io_api_scheduling_v1alpha3_WorkloadCompositePodGroupSchedulingPolicy_ = validate.NewUnionMembership(validate.NewUnionMember("basic"), validate.NewUnionMember("gang")) + +// Validate_WorkloadCompositePodGroupSchedulingPolicy validates an instance of WorkloadCompositePodGroupSchedulingPolicy according +// to declarative validation rules in the API schema. +func Validate_WorkloadCompositePodGroupSchedulingPolicy( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *WorkloadCompositePodGroupSchedulingPolicy) (errs field.ErrorList) { + + if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_scheduling_v1alpha3_WorkloadCompositePodGroupSchedulingPolicy_, + func(obj *WorkloadCompositePodGroupSchedulingPolicy) bool { + if obj == nil { + return false + } + return obj.Basic != nil + }, + func(obj *WorkloadCompositePodGroupSchedulingPolicy) bool { + if obj == nil { + return false + } + return obj.Gang != nil + }); len(e) != 0 { + errs = append(errs, e...) + } + + { // field WorkloadCompositePodGroupSchedulingPolicy.Basic + fn := func( + fldPath *field.Path, + obj, oldObj *WorkloadCompositePodGroupBasicSchedulingPolicy, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadCompositePodGroupSchedulingPolicy) *WorkloadCompositePodGroupBasicSchedulingPolicy { + return oldObj.Basic + }) + errs = append(errs, fn(fldPath.Child("basic"), obj.Basic, oldVal, oldObj != nil)...) + } + + { // field WorkloadCompositePodGroupSchedulingPolicy.Gang + fn := func( + fldPath *field.Path, + obj, oldObj *WorkloadCompositePodGroupGangSchedulingPolicy, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_WorkloadCompositePodGroupGangSchedulingPolicy(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadCompositePodGroupSchedulingPolicy) *WorkloadCompositePodGroupGangSchedulingPolicy { + return oldObj.Gang + }) + errs = append(errs, fn(fldPath.Child("gang"), obj.Gang, oldVal, oldObj != nil)...) + } + + return errs +} + +var unionMembershipFor_k8s_io_api_scheduling_v1alpha3_WorkloadPodGroupDisruptionMode_ = validate.NewUnionMembership(validate.NewUnionMember("single"), validate.NewUnionMember("all")) + +// Validate_WorkloadPodGroupDisruptionMode validates an instance of WorkloadPodGroupDisruptionMode according +// to declarative validation rules in the API schema. +func Validate_WorkloadPodGroupDisruptionMode( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *WorkloadPodGroupDisruptionMode) (errs field.ErrorList) { + + if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_scheduling_v1alpha3_WorkloadPodGroupDisruptionMode_, + func(obj *WorkloadPodGroupDisruptionMode) bool { + if obj == nil { + return false + } + return obj.Single != nil + }, + func(obj *WorkloadPodGroupDisruptionMode) bool { + if obj == nil { + return false + } + return obj.All != nil + }); len(e) != 0 { + errs = append(errs, e...) + } + + { // field WorkloadPodGroupDisruptionMode.Single + fn := func( + fldPath *field.Path, + obj, oldObj *WorkloadPodGroupSingleDisruptionMode, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadPodGroupDisruptionMode) *WorkloadPodGroupSingleDisruptionMode { + return oldObj.Single + }) + errs = append(errs, fn(fldPath.Child("single"), obj.Single, oldVal, oldObj != nil)...) + } + + { // field WorkloadPodGroupDisruptionMode.All + fn := func( + fldPath *field.Path, + obj, oldObj *WorkloadPodGroupAllDisruptionMode, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadPodGroupDisruptionMode) *WorkloadPodGroupAllDisruptionMode { + return oldObj.All + }) + errs = append(errs, fn(fldPath.Child("all"), obj.All, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_WorkloadPodGroupGangSchedulingPolicy validates an instance of WorkloadPodGroupGangSchedulingPolicy according +// to declarative validation rules in the API schema. +func Validate_WorkloadPodGroupGangSchedulingPolicy( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *WorkloadPodGroupGangSchedulingPolicy) (errs field.ErrorList) { + + { // field WorkloadPodGroupGangSchedulingPolicy.MinCount + fn := func( + fldPath *field.Path, + obj, oldObj *int32, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.Minimum(ctx, op, fldPath, obj, oldObj, 1); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadPodGroupGangSchedulingPolicy) *int32 { + return oldObj.MinCount + }) + errs = append(errs, fn(fldPath.Child("minCount"), obj.MinCount, oldVal, oldObj != nil)...) + } + + return errs +} + +var unionMembershipFor_k8s_io_api_scheduling_v1alpha3_WorkloadPodGroupResourceClaim_ = validate.NewUnionMembership(validate.NewUnionMember("resourceClaimName"), validate.NewUnionMember("resourceClaimTemplateName")) + +// Validate_WorkloadPodGroupResourceClaim validates an instance of WorkloadPodGroupResourceClaim according +// to declarative validation rules in the API schema. +func Validate_WorkloadPodGroupResourceClaim( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *WorkloadPodGroupResourceClaim) (errs field.ErrorList) { + + if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_scheduling_v1alpha3_WorkloadPodGroupResourceClaim_, + func(obj *WorkloadPodGroupResourceClaim) bool { + if obj == nil { + return false + } + return obj.ResourceClaimName != nil + }, + func(obj *WorkloadPodGroupResourceClaim) bool { + if obj == nil { + return false + } + return obj.ResourceClaimTemplateName != nil + }); len(e) != 0 { + errs = append(errs, e...) + } + + { // field WorkloadPodGroupResourceClaim.Name + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadPodGroupResourceClaim) *string { + return &oldObj.Name + }) + errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...) + } + + { // field WorkloadPodGroupResourceClaim.ResourceClaimName + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadPodGroupResourceClaim) *string { + return oldObj.ResourceClaimName + }) + errs = append(errs, fn(fldPath.Child("resourceClaimName"), obj.ResourceClaimName, oldVal, oldObj != nil)...) + } + + { // field WorkloadPodGroupResourceClaim.ResourceClaimTemplateName + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadPodGroupResourceClaim) *string { + return oldObj.ResourceClaimTemplateName + }) + errs = append(errs, fn(fldPath.Child("resourceClaimTemplateName"), obj.ResourceClaimTemplateName, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_WorkloadPodGroupSchedulingConstraints validates an instance of WorkloadPodGroupSchedulingConstraints according +// to declarative validation rules in the API schema. +func Validate_WorkloadPodGroupSchedulingConstraints( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *WorkloadPodGroupSchedulingConstraints) (errs field.ErrorList) { + + { // field WorkloadPodGroupSchedulingConstraints.Topology + fn := func( + fldPath *field.Path, + obj, oldObj []TopologyConstraint, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 1).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_TopologyConstraint); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadPodGroupSchedulingConstraints) []TopologyConstraint { + return oldObj.Topology + }) + errs = append(errs, fn(fldPath.Child("topology"), obj.Topology, oldVal, oldObj != nil)...) + } + + return errs +} + +var unionMembershipFor_k8s_io_api_scheduling_v1alpha3_WorkloadPodGroupSchedulingPolicy_ = validate.NewUnionMembership(validate.NewUnionMember("basic"), validate.NewUnionMember("gang")) + +// Validate_WorkloadPodGroupSchedulingPolicy validates an instance of WorkloadPodGroupSchedulingPolicy according +// to declarative validation rules in the API schema. +func Validate_WorkloadPodGroupSchedulingPolicy( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *WorkloadPodGroupSchedulingPolicy) (errs field.ErrorList) { + + if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_scheduling_v1alpha3_WorkloadPodGroupSchedulingPolicy_, + func(obj *WorkloadPodGroupSchedulingPolicy) bool { + if obj == nil { + return false + } + return obj.Basic != nil + }, + func(obj *WorkloadPodGroupSchedulingPolicy) bool { + if obj == nil { + return false + } + return obj.Gang != nil + }); len(e) != 0 { + errs = append(errs, e...) + } + + { // field WorkloadPodGroupSchedulingPolicy.Basic + fn := func( + fldPath *field.Path, + obj, oldObj *WorkloadPodGroupBasicSchedulingPolicy, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadPodGroupSchedulingPolicy) *WorkloadPodGroupBasicSchedulingPolicy { + return oldObj.Basic + }) + errs = append(errs, fn(fldPath.Child("basic"), obj.Basic, oldVal, oldObj != nil)...) + } + + { // field WorkloadPodGroupSchedulingPolicy.Gang + fn := func( + fldPath *field.Path, + obj, oldObj *WorkloadPodGroupGangSchedulingPolicy, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_WorkloadPodGroupGangSchedulingPolicy(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadPodGroupSchedulingPolicy) *WorkloadPodGroupGangSchedulingPolicy { + return oldObj.Gang + }) + errs = append(errs, fn(fldPath.Child("gang"), obj.Gang, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_WorkloadReference validates an instance of WorkloadReference according +// to declarative validation rules in the API schema. +func Validate_WorkloadReference( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *WorkloadReference) (errs field.ErrorList) { + + { // field WorkloadReference.WorkloadName + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadReference) *string { + return &oldObj.WorkloadName + }) + errs = append(errs, fn(fldPath.Child("workloadName"), &obj.WorkloadName, oldVal, oldObj != nil)...) + } + + { // field WorkloadReference.TemplateName + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadReference) *string { + return &oldObj.TemplateName + }) + errs = append(errs, fn(fldPath.Child("templateName"), &obj.TemplateName, oldVal, oldObj != nil)...) + } + + return errs +} + +var unionMembershipFor_k8s_io_api_scheduling_v1alpha3_WorkloadSpec_ = validate.NewUnionMembership(validate.NewUnionMember("podGroupTemplates"), validate.NewUnionMember("compositePodGroupTemplates")) + +// Validate_WorkloadSpec validates an instance of WorkloadSpec according +// to declarative validation rules in the API schema. +func Validate_WorkloadSpec( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *WorkloadSpec) (errs field.ErrorList) { + + if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_scheduling_v1alpha3_WorkloadSpec_, + func(obj *WorkloadSpec) bool { + if obj == nil { + return false + } + return len(obj.PodGroupTemplates) != 0 + }, + func(obj *WorkloadSpec) bool { + if obj == nil { + return false + } + return len(obj.CompositePodGroupTemplates) != 0 + }); len(e) != 0 { + errs = append(errs, e...) + } + + { // field WorkloadSpec.ControllerRef + fn := func( + fldPath *field.Path, + obj, oldObj *TypedLocalObjectReference, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_TypedLocalObjectReference(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadSpec) *TypedLocalObjectReference { + return oldObj.ControllerRef + }) + errs = append(errs, fn(fldPath.Child("controllerRef"), obj.ControllerRef, oldVal, oldObj != nil)...) + } + + { // field WorkloadSpec.PodGroupTemplates + fn := func( + fldPath *field.Path, + obj, oldObj []PodGroupTemplate, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 8).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.ValSliceUpdate(ctx, op, fldPath, obj, oldObj, + func(a *PodGroupTemplate, b *PodGroupTemplate) bool { return a.Name == b.Name }, validate.NoAddItem, validate.NoRemoveItem).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with map semantics require unique keys + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, + func(a *PodGroupTemplate, b *PodGroupTemplate) bool { return a.Name == b.Name }); len(e) != 0 { + errs = append(errs, e...) + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, + func(a *PodGroupTemplate, b *PodGroupTemplate) bool { return a.Name == b.Name }, validate.SemanticDeepEqual, Validate_PodGroupTemplate); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadSpec) []PodGroupTemplate { + return oldObj.PodGroupTemplates + }) + errs = append(errs, fn(fldPath.Child("podGroupTemplates"), obj.PodGroupTemplates, oldVal, oldObj != nil)...) + } + + { // field WorkloadSpec.CompositePodGroupTemplates + fn := func( + fldPath *field.Path, + obj, oldObj []CompositePodGroupTemplate, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "CompositePodGroup", false, validate.ForbiddenSlice).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "CompositePodGroup", false, validate.OptionalSlice).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "CompositePodGroup", true, validate.OptionalSlice).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 8).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.ValSliceUpdate(ctx, op, fldPath, obj, oldObj, + func(a *CompositePodGroupTemplate, b *CompositePodGroupTemplate) bool { return a.Name == b.Name }, validate.NoAddItem, validate.NoRemoveItem).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // lists with map semantics require unique keys + if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj, + func(a *CompositePodGroupTemplate, b *CompositePodGroupTemplate) bool { return a.Name == b.Name }); len(e) != 0 { + errs = append(errs, e...) + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, + func(a *CompositePodGroupTemplate, b *CompositePodGroupTemplate) bool { return a.Name == b.Name }, validate.SemanticDeepEqual, Validate_CompositePodGroupTemplate); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *WorkloadSpec) []CompositePodGroupTemplate { + return oldObj.CompositePodGroupTemplates + }) + errs = append(errs, fn(fldPath.Child("compositePodGroupTemplates"), obj.CompositePodGroupTemplates, oldVal, oldObj != nil)...) + } + + return errs +} diff --git a/vendor/k8s.io/api/scheduling/v1beta1/generated.pb.go b/vendor/k8s.io/api/scheduling/v1beta1/generated.pb.go index cd25ded408..d8572d3c01 100644 --- a/vendor/k8s.io/api/scheduling/v1beta1/generated.pb.go +++ b/vendor/k8s.io/api/scheduling/v1beta1/generated.pb.go @@ -25,17 +25,76 @@ import ( io "io" k8s_io_api_core_v1 "k8s.io/api/core/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" math_bits "math/bits" reflect "reflect" strings "strings" ) +func (m *AllCompositeDisruptionMode) Reset() { *m = AllCompositeDisruptionMode{} } + +func (m *AllDisruptionMode) Reset() { *m = AllDisruptionMode{} } + +func (m *BasicSchedulingPolicy) Reset() { *m = BasicSchedulingPolicy{} } + +func (m *CompositeBasicSchedulingPolicy) Reset() { *m = CompositeBasicSchedulingPolicy{} } + +func (m *CompositeDisruptionMode) Reset() { *m = CompositeDisruptionMode{} } + +func (m *CompositeGangSchedulingPolicy) Reset() { *m = CompositeGangSchedulingPolicy{} } + +func (m *CompositePodGroupSchedulingConstraints) Reset() { + *m = CompositePodGroupSchedulingConstraints{} +} + +func (m *CompositePodGroupSchedulingPolicy) Reset() { *m = CompositePodGroupSchedulingPolicy{} } + +func (m *CompositePodGroupTemplate) Reset() { *m = CompositePodGroupTemplate{} } + +func (m *DisruptionMode) Reset() { *m = DisruptionMode{} } + +func (m *GangSchedulingPolicy) Reset() { *m = GangSchedulingPolicy{} } + +func (m *PodGroup) Reset() { *m = PodGroup{} } + +func (m *PodGroupList) Reset() { *m = PodGroupList{} } + +func (m *PodGroupResourceClaim) Reset() { *m = PodGroupResourceClaim{} } + +func (m *PodGroupResourceClaimStatus) Reset() { *m = PodGroupResourceClaimStatus{} } + +func (m *PodGroupSchedulingConstraints) Reset() { *m = PodGroupSchedulingConstraints{} } + +func (m *PodGroupSchedulingPolicy) Reset() { *m = PodGroupSchedulingPolicy{} } + +func (m *PodGroupSpec) Reset() { *m = PodGroupSpec{} } + +func (m *PodGroupStatus) Reset() { *m = PodGroupStatus{} } + +func (m *PodGroupTemplate) Reset() { *m = PodGroupTemplate{} } + func (m *PriorityClass) Reset() { *m = PriorityClass{} } func (m *PriorityClassList) Reset() { *m = PriorityClassList{} } -func (m *PriorityClass) Marshal() (dAtA []byte, err error) { +func (m *SingleCompositeDisruptionMode) Reset() { *m = SingleCompositeDisruptionMode{} } + +func (m *SingleDisruptionMode) Reset() { *m = SingleDisruptionMode{} } + +func (m *TopologyConstraint) Reset() { *m = TopologyConstraint{} } + +func (m *TypedLocalObjectReference) Reset() { *m = TypedLocalObjectReference{} } + +func (m *Workload) Reset() { *m = Workload{} } + +func (m *WorkloadList) Reset() { *m = WorkloadList{} } + +func (m *WorkloadReference) Reset() { *m = WorkloadReference{} } + +func (m *WorkloadSpec) Reset() { *m = WorkloadSpec{} } + +func (m *AllCompositeDisruptionMode) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -45,53 +104,162 @@ func (m *PriorityClass) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PriorityClass) MarshalTo(dAtA []byte) (int, error) { +func (m *AllCompositeDisruptionMode) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PriorityClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *AllCompositeDisruptionMode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.PreemptionPolicy != nil { - i -= len(*m.PreemptionPolicy) - copy(dAtA[i:], *m.PreemptionPolicy) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PreemptionPolicy))) - i-- - dAtA[i] = 0x2a + return len(dAtA) - i, nil +} + +func (m *AllDisruptionMode) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x22 - i-- - if m.GlobalDefault { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + return dAtA[:n], nil +} + +func (m *AllDisruptionMode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AllDisruptionMode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *BasicSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - i-- - dAtA[i] = 0x18 - i = encodeVarintGenerated(dAtA, i, uint64(m.Value)) - i-- - dAtA[i] = 0x10 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + return dAtA[:n], nil +} + +func (m *BasicSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BasicSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *CompositeBasicSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CompositeBasicSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompositeBasicSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *CompositeDisruptionMode) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CompositeDisruptionMode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompositeDisruptionMode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.All != nil { + { + size, err := m.All.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if m.Single != nil { + { + size, err := m.Single.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CompositeGangSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *CompositeGangSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompositeGangSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i = encodeVarintGenerated(dAtA, i, uint64(m.MinGroupCount)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 return len(dAtA) - i, nil } -func (m *PriorityClassList) Marshal() (dAtA []byte, err error) { +func (m *CompositePodGroupSchedulingConstraints) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -101,20 +269,20 @@ func (m *PriorityClassList) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PriorityClassList) MarshalTo(dAtA []byte) (int, error) { +func (m *CompositePodGroupSchedulingConstraints) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PriorityClassList) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *CompositePodGroupSchedulingConstraints) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Topology) > 0 { + for iNdEx := len(m.Topology) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Topology[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -122,114 +290,5354 @@ func (m *PriorityClassList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + dAtA[i] = 0xa } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *CompositePodGroupSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *PriorityClass) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - n += 1 + sovGenerated(uint64(m.Value)) - n += 2 - l = len(m.Description) - n += 1 + l + sovGenerated(uint64(l)) - if m.PreemptionPolicy != nil { - l = len(*m.PreemptionPolicy) - n += 1 + l + sovGenerated(uint64(l)) - } - return n + +func (m *CompositePodGroupSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PriorityClassList) Size() (n int) { - if m == nil { - return 0 - } +func (m *CompositePodGroupSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) + if m.Gang != nil { + { + size, err := m.Gang.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 } - return n + if m.Basic != nil { + { + size, err := m.Basic.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +func (m *CompositePodGroupTemplate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + +func (m *CompositePodGroupTemplate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (this *PriorityClass) String() string { - if this == nil { + +func (m *CompositePodGroupTemplate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CompositePodGroupTemplates) > 0 { + for iNdEx := len(m.CompositePodGroupTemplates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CompositePodGroupTemplates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + } + if len(m.PodGroupTemplates) > 0 { + for iNdEx := len(m.PodGroupTemplates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PodGroupTemplates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } + if m.PreemptionPolicy != nil { + i -= len(*m.PreemptionPolicy) + copy(dAtA[i:], *m.PreemptionPolicy) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PreemptionPolicy))) + i-- + dAtA[i] = 0x3a + } + if m.Priority != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.Priority)) + i-- + dAtA[i] = 0x30 + } + i -= len(m.PriorityClassName) + copy(dAtA[i:], m.PriorityClassName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.PriorityClassName))) + i-- + dAtA[i] = 0x2a + if m.DisruptionMode != nil { + { + size, err := m.DisruptionMode.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.SchedulingConstraints != nil { + { + size, err := m.SchedulingConstraints.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + { + size, err := m.SchedulingPolicy.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *DisruptionMode) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DisruptionMode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DisruptionMode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.All != nil { + { + size, err := m.All.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Single != nil { + { + size, err := m.Single.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GangSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GangSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GangSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i = encodeVarintGenerated(dAtA, i, uint64(m.MinCount)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil +} + +func (m *PodGroup) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroup) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PodGroupList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PodGroupResourceClaim) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupResourceClaim) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupResourceClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ResourceClaimTemplateName != nil { + i -= len(*m.ResourceClaimTemplateName) + copy(dAtA[i:], *m.ResourceClaimTemplateName) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ResourceClaimTemplateName))) + i-- + dAtA[i] = 0x1a + } + if m.ResourceClaimName != nil { + i -= len(*m.ResourceClaimName) + copy(dAtA[i:], *m.ResourceClaimName) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ResourceClaimName))) + i-- + dAtA[i] = 0x12 + } + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PodGroupResourceClaimStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupResourceClaimStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupResourceClaimStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ResourceClaimName != nil { + i -= len(*m.ResourceClaimName) + copy(dAtA[i:], *m.ResourceClaimName) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ResourceClaimName))) + i-- + dAtA[i] = 0x12 + } + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PodGroupSchedulingConstraints) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupSchedulingConstraints) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupSchedulingConstraints) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Topology) > 0 { + for iNdEx := len(m.Topology) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Topology[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *PodGroupSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Gang != nil { + { + size, err := m.Gang.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Basic != nil { + { + size, err := m.Basic.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PodGroupSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PreemptionPolicy != nil { + i -= len(*m.PreemptionPolicy) + copy(dAtA[i:], *m.PreemptionPolicy) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PreemptionPolicy))) + i-- + dAtA[i] = 0x4a + } + if m.Priority != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.Priority)) + i-- + dAtA[i] = 0x40 + } + i -= len(m.PriorityClassName) + copy(dAtA[i:], m.PriorityClassName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.PriorityClassName))) + i-- + dAtA[i] = 0x3a + if m.DisruptionMode != nil { + { + size, err := m.DisruptionMode.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if len(m.ResourceClaims) > 0 { + for iNdEx := len(m.ResourceClaims) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ResourceClaims[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if m.SchedulingConstraints != nil { + { + size, err := m.SchedulingConstraints.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + { + size, err := m.SchedulingPolicy.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.WorkloadRef != nil { + { + size, err := m.WorkloadRef.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.ParentCompositePodGroupName != nil { + i -= len(*m.ParentCompositePodGroupName) + copy(dAtA[i:], *m.ParentCompositePodGroupName) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ParentCompositePodGroupName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PodGroupStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ResourceClaimStatuses) > 0 { + for iNdEx := len(m.ResourceClaimStatuses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ResourceClaimStatuses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Conditions) > 0 { + for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *PodGroupTemplate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupTemplate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupTemplate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PreemptionPolicy != nil { + i -= len(*m.PreemptionPolicy) + copy(dAtA[i:], *m.PreemptionPolicy) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PreemptionPolicy))) + i-- + dAtA[i] = 0x42 + } + if m.Priority != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.Priority)) + i-- + dAtA[i] = 0x38 + } + i -= len(m.PriorityClassName) + copy(dAtA[i:], m.PriorityClassName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.PriorityClassName))) + i-- + dAtA[i] = 0x32 + if m.DisruptionMode != nil { + { + size, err := m.DisruptionMode.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if len(m.ResourceClaims) > 0 { + for iNdEx := len(m.ResourceClaims) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ResourceClaims[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.SchedulingConstraints != nil { + { + size, err := m.SchedulingConstraints.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + { + size, err := m.SchedulingPolicy.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PriorityClass) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PriorityClass) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PriorityClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PreemptionPolicy != nil { + i -= len(*m.PreemptionPolicy) + copy(dAtA[i:], *m.PreemptionPolicy) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PreemptionPolicy))) + i-- + dAtA[i] = 0x2a + } + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x22 + i-- + if m.GlobalDefault { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + i = encodeVarintGenerated(dAtA, i, uint64(m.Value)) + i-- + dAtA[i] = 0x10 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PriorityClassList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PriorityClassList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PriorityClassList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *SingleCompositeDisruptionMode) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SingleCompositeDisruptionMode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SingleCompositeDisruptionMode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *SingleDisruptionMode) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SingleDisruptionMode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SingleDisruptionMode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *TopologyConstraint) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TopologyConstraint) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TopologyConstraint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *TypedLocalObjectReference) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TypedLocalObjectReference) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TypedLocalObjectReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x1a + i -= len(m.Kind) + copy(dAtA[i:], m.Kind) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Kind))) + i-- + dAtA[i] = 0x12 + i -= len(m.APIGroup) + copy(dAtA[i:], m.APIGroup) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIGroup))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Workload) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Workload) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Workload) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *WorkloadList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *WorkloadReference) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadReference) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.TemplateName) + copy(dAtA[i:], m.TemplateName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.TemplateName))) + i-- + dAtA[i] = 0x12 + i -= len(m.WorkloadName) + copy(dAtA[i:], m.WorkloadName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.WorkloadName))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *WorkloadSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CompositePodGroupTemplates) > 0 { + for iNdEx := len(m.CompositePodGroupTemplates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CompositePodGroupTemplates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.PodGroupTemplates) > 0 { + for iNdEx := len(m.PodGroupTemplates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PodGroupTemplates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.ControllerRef != nil { + { + size, err := m.ControllerRef.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { + offset -= sovGenerated(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *AllCompositeDisruptionMode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *AllDisruptionMode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *BasicSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *CompositeBasicSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *CompositeDisruptionMode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Single != nil { + l = m.Single.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.All != nil { + l = m.All.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *CompositeGangSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovGenerated(uint64(m.MinGroupCount)) + return n +} + +func (m *CompositePodGroupSchedulingConstraints) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Topology) > 0 { + for _, e := range m.Topology { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *CompositePodGroupSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Basic != nil { + l = m.Basic.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Gang != nil { + l = m.Gang.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *CompositePodGroupTemplate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = m.SchedulingPolicy.Size() + n += 1 + l + sovGenerated(uint64(l)) + if m.SchedulingConstraints != nil { + l = m.SchedulingConstraints.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.DisruptionMode != nil { + l = m.DisruptionMode.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + l = len(m.PriorityClassName) + n += 1 + l + sovGenerated(uint64(l)) + if m.Priority != nil { + n += 1 + sovGenerated(uint64(*m.Priority)) + } + if m.PreemptionPolicy != nil { + l = len(*m.PreemptionPolicy) + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.PodGroupTemplates) > 0 { + for _, e := range m.PodGroupTemplates { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.CompositePodGroupTemplates) > 0 { + for _, e := range m.CompositePodGroupTemplates { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *DisruptionMode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Single != nil { + l = m.Single.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.All != nil { + l = m.All.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *GangSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovGenerated(uint64(m.MinCount)) + return n +} + +func (m *PodGroup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *PodGroupList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *PodGroupResourceClaim) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if m.ResourceClaimName != nil { + l = len(*m.ResourceClaimName) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.ResourceClaimTemplateName != nil { + l = len(*m.ResourceClaimTemplateName) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *PodGroupResourceClaimStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if m.ResourceClaimName != nil { + l = len(*m.ResourceClaimName) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *PodGroupSchedulingConstraints) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Topology) > 0 { + for _, e := range m.Topology { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *PodGroupSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Basic != nil { + l = m.Basic.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Gang != nil { + l = m.Gang.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *PodGroupSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ParentCompositePodGroupName != nil { + l = len(*m.ParentCompositePodGroupName) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.WorkloadRef != nil { + l = m.WorkloadRef.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + l = m.SchedulingPolicy.Size() + n += 1 + l + sovGenerated(uint64(l)) + if m.SchedulingConstraints != nil { + l = m.SchedulingConstraints.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.ResourceClaims) > 0 { + for _, e := range m.ResourceClaims { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if m.DisruptionMode != nil { + l = m.DisruptionMode.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + l = len(m.PriorityClassName) + n += 1 + l + sovGenerated(uint64(l)) + if m.Priority != nil { + n += 1 + sovGenerated(uint64(*m.Priority)) + } + if m.PreemptionPolicy != nil { + l = len(*m.PreemptionPolicy) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *PodGroupStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Conditions) > 0 { + for _, e := range m.Conditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.ResourceClaimStatuses) > 0 { + for _, e := range m.ResourceClaimStatuses { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *PodGroupTemplate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = m.SchedulingPolicy.Size() + n += 1 + l + sovGenerated(uint64(l)) + if m.SchedulingConstraints != nil { + l = m.SchedulingConstraints.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.ResourceClaims) > 0 { + for _, e := range m.ResourceClaims { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if m.DisruptionMode != nil { + l = m.DisruptionMode.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + l = len(m.PriorityClassName) + n += 1 + l + sovGenerated(uint64(l)) + if m.Priority != nil { + n += 1 + sovGenerated(uint64(*m.Priority)) + } + if m.PreemptionPolicy != nil { + l = len(*m.PreemptionPolicy) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *PriorityClass) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + n += 1 + sovGenerated(uint64(m.Value)) + n += 2 + l = len(m.Description) + n += 1 + l + sovGenerated(uint64(l)) + if m.PreemptionPolicy != nil { + l = len(*m.PreemptionPolicy) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *PriorityClassList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *SingleCompositeDisruptionMode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *SingleDisruptionMode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *TopologyConstraint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *TypedLocalObjectReference) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.APIGroup) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Kind) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *Workload) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *WorkloadList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *WorkloadReference) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.WorkloadName) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.TemplateName) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *WorkloadSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ControllerRef != nil { + l = m.ControllerRef.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.PodGroupTemplates) > 0 { + for _, e := range m.PodGroupTemplates { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.CompositePodGroupTemplates) > 0 { + for _, e := range m.CompositePodGroupTemplates { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func sovGenerated(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenerated(x uint64) (n int) { + return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *AllCompositeDisruptionMode) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&AllCompositeDisruptionMode{`, + `}`, + }, "") + return s +} +func (this *AllDisruptionMode) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&AllDisruptionMode{`, + `}`, + }, "") + return s +} +func (this *BasicSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&BasicSchedulingPolicy{`, + `}`, + }, "") + return s +} +func (this *CompositeBasicSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CompositeBasicSchedulingPolicy{`, + `}`, + }, "") + return s +} +func (this *CompositeDisruptionMode) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CompositeDisruptionMode{`, + `Single:` + strings.Replace(this.Single.String(), "SingleCompositeDisruptionMode", "SingleCompositeDisruptionMode", 1) + `,`, + `All:` + strings.Replace(this.All.String(), "AllCompositeDisruptionMode", "AllCompositeDisruptionMode", 1) + `,`, + `}`, + }, "") + return s +} +func (this *CompositeGangSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CompositeGangSchedulingPolicy{`, + `MinGroupCount:` + fmt.Sprintf("%v", this.MinGroupCount) + `,`, + `}`, + }, "") + return s +} +func (this *CompositePodGroupSchedulingConstraints) String() string { + if this == nil { + return "nil" + } + repeatedStringForTopology := "[]TopologyConstraint{" + for _, f := range this.Topology { + repeatedStringForTopology += strings.Replace(strings.Replace(f.String(), "TopologyConstraint", "TopologyConstraint", 1), `&`, ``, 1) + "," + } + repeatedStringForTopology += "}" + s := strings.Join([]string{`&CompositePodGroupSchedulingConstraints{`, + `Topology:` + repeatedStringForTopology + `,`, + `}`, + }, "") + return s +} +func (this *CompositePodGroupSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CompositePodGroupSchedulingPolicy{`, + `Basic:` + strings.Replace(this.Basic.String(), "CompositeBasicSchedulingPolicy", "CompositeBasicSchedulingPolicy", 1) + `,`, + `Gang:` + strings.Replace(this.Gang.String(), "CompositeGangSchedulingPolicy", "CompositeGangSchedulingPolicy", 1) + `,`, + `}`, + }, "") + return s +} +func (this *CompositePodGroupTemplate) String() string { + if this == nil { + return "nil" + } + repeatedStringForPodGroupTemplates := "[]PodGroupTemplate{" + for _, f := range this.PodGroupTemplates { + repeatedStringForPodGroupTemplates += strings.Replace(strings.Replace(f.String(), "PodGroupTemplate", "PodGroupTemplate", 1), `&`, ``, 1) + "," + } + repeatedStringForPodGroupTemplates += "}" + repeatedStringForCompositePodGroupTemplates := "[]CompositePodGroupTemplate{" + for _, f := range this.CompositePodGroupTemplates { + repeatedStringForCompositePodGroupTemplates += strings.Replace(strings.Replace(f.String(), "CompositePodGroupTemplate", "CompositePodGroupTemplate", 1), `&`, ``, 1) + "," + } + repeatedStringForCompositePodGroupTemplates += "}" + s := strings.Join([]string{`&CompositePodGroupTemplate{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `SchedulingPolicy:` + strings.Replace(strings.Replace(this.SchedulingPolicy.String(), "CompositePodGroupSchedulingPolicy", "CompositePodGroupSchedulingPolicy", 1), `&`, ``, 1) + `,`, + `SchedulingConstraints:` + strings.Replace(this.SchedulingConstraints.String(), "CompositePodGroupSchedulingConstraints", "CompositePodGroupSchedulingConstraints", 1) + `,`, + `DisruptionMode:` + strings.Replace(this.DisruptionMode.String(), "CompositeDisruptionMode", "CompositeDisruptionMode", 1) + `,`, + `PriorityClassName:` + fmt.Sprintf("%v", this.PriorityClassName) + `,`, + `Priority:` + valueToStringGenerated(this.Priority) + `,`, + `PreemptionPolicy:` + valueToStringGenerated(this.PreemptionPolicy) + `,`, + `PodGroupTemplates:` + repeatedStringForPodGroupTemplates + `,`, + `CompositePodGroupTemplates:` + repeatedStringForCompositePodGroupTemplates + `,`, + `}`, + }, "") + return s +} +func (this *DisruptionMode) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DisruptionMode{`, + `Single:` + strings.Replace(this.Single.String(), "SingleDisruptionMode", "SingleDisruptionMode", 1) + `,`, + `All:` + strings.Replace(this.All.String(), "AllDisruptionMode", "AllDisruptionMode", 1) + `,`, + `}`, + }, "") + return s +} +func (this *GangSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&GangSchedulingPolicy{`, + `MinCount:` + fmt.Sprintf("%v", this.MinCount) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroup) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PodGroup{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "PodGroupSpec", "PodGroupSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "PodGroupStatus", "PodGroupStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]PodGroup{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "PodGroup", "PodGroup", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&PodGroupList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupResourceClaim) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PodGroupResourceClaim{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `ResourceClaimName:` + valueToStringGenerated(this.ResourceClaimName) + `,`, + `ResourceClaimTemplateName:` + valueToStringGenerated(this.ResourceClaimTemplateName) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupResourceClaimStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PodGroupResourceClaimStatus{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `ResourceClaimName:` + valueToStringGenerated(this.ResourceClaimName) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupSchedulingConstraints) String() string { + if this == nil { + return "nil" + } + repeatedStringForTopology := "[]TopologyConstraint{" + for _, f := range this.Topology { + repeatedStringForTopology += strings.Replace(strings.Replace(f.String(), "TopologyConstraint", "TopologyConstraint", 1), `&`, ``, 1) + "," + } + repeatedStringForTopology += "}" + s := strings.Join([]string{`&PodGroupSchedulingConstraints{`, + `Topology:` + repeatedStringForTopology + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PodGroupSchedulingPolicy{`, + `Basic:` + strings.Replace(this.Basic.String(), "BasicSchedulingPolicy", "BasicSchedulingPolicy", 1) + `,`, + `Gang:` + strings.Replace(this.Gang.String(), "GangSchedulingPolicy", "GangSchedulingPolicy", 1) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupSpec) String() string { + if this == nil { + return "nil" + } + repeatedStringForResourceClaims := "[]PodGroupResourceClaim{" + for _, f := range this.ResourceClaims { + repeatedStringForResourceClaims += strings.Replace(strings.Replace(f.String(), "PodGroupResourceClaim", "PodGroupResourceClaim", 1), `&`, ``, 1) + "," + } + repeatedStringForResourceClaims += "}" + s := strings.Join([]string{`&PodGroupSpec{`, + `ParentCompositePodGroupName:` + valueToStringGenerated(this.ParentCompositePodGroupName) + `,`, + `WorkloadRef:` + strings.Replace(this.WorkloadRef.String(), "WorkloadReference", "WorkloadReference", 1) + `,`, + `SchedulingPolicy:` + strings.Replace(strings.Replace(this.SchedulingPolicy.String(), "PodGroupSchedulingPolicy", "PodGroupSchedulingPolicy", 1), `&`, ``, 1) + `,`, + `SchedulingConstraints:` + strings.Replace(this.SchedulingConstraints.String(), "PodGroupSchedulingConstraints", "PodGroupSchedulingConstraints", 1) + `,`, + `ResourceClaims:` + repeatedStringForResourceClaims + `,`, + `DisruptionMode:` + strings.Replace(this.DisruptionMode.String(), "DisruptionMode", "DisruptionMode", 1) + `,`, + `PriorityClassName:` + fmt.Sprintf("%v", this.PriorityClassName) + `,`, + `Priority:` + valueToStringGenerated(this.Priority) + `,`, + `PreemptionPolicy:` + valueToStringGenerated(this.PreemptionPolicy) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupStatus) String() string { + if this == nil { + return "nil" + } + repeatedStringForConditions := "[]Condition{" + for _, f := range this.Conditions { + repeatedStringForConditions += fmt.Sprintf("%v", f) + "," + } + repeatedStringForConditions += "}" + repeatedStringForResourceClaimStatuses := "[]PodGroupResourceClaimStatus{" + for _, f := range this.ResourceClaimStatuses { + repeatedStringForResourceClaimStatuses += strings.Replace(strings.Replace(f.String(), "PodGroupResourceClaimStatus", "PodGroupResourceClaimStatus", 1), `&`, ``, 1) + "," + } + repeatedStringForResourceClaimStatuses += "}" + s := strings.Join([]string{`&PodGroupStatus{`, + `Conditions:` + repeatedStringForConditions + `,`, + `ResourceClaimStatuses:` + repeatedStringForResourceClaimStatuses + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupTemplate) String() string { + if this == nil { + return "nil" + } + repeatedStringForResourceClaims := "[]PodGroupResourceClaim{" + for _, f := range this.ResourceClaims { + repeatedStringForResourceClaims += strings.Replace(strings.Replace(f.String(), "PodGroupResourceClaim", "PodGroupResourceClaim", 1), `&`, ``, 1) + "," + } + repeatedStringForResourceClaims += "}" + s := strings.Join([]string{`&PodGroupTemplate{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `SchedulingPolicy:` + strings.Replace(strings.Replace(this.SchedulingPolicy.String(), "PodGroupSchedulingPolicy", "PodGroupSchedulingPolicy", 1), `&`, ``, 1) + `,`, + `SchedulingConstraints:` + strings.Replace(this.SchedulingConstraints.String(), "PodGroupSchedulingConstraints", "PodGroupSchedulingConstraints", 1) + `,`, + `ResourceClaims:` + repeatedStringForResourceClaims + `,`, + `DisruptionMode:` + strings.Replace(this.DisruptionMode.String(), "DisruptionMode", "DisruptionMode", 1) + `,`, + `PriorityClassName:` + fmt.Sprintf("%v", this.PriorityClassName) + `,`, + `Priority:` + valueToStringGenerated(this.Priority) + `,`, + `PreemptionPolicy:` + valueToStringGenerated(this.PreemptionPolicy) + `,`, + `}`, + }, "") + return s +} +func (this *PriorityClass) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PriorityClass{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `GlobalDefault:` + fmt.Sprintf("%v", this.GlobalDefault) + `,`, + `Description:` + fmt.Sprintf("%v", this.Description) + `,`, + `PreemptionPolicy:` + valueToStringGenerated(this.PreemptionPolicy) + `,`, + `}`, + }, "") + return s +} +func (this *PriorityClassList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]PriorityClass{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "PriorityClass", "PriorityClass", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&PriorityClassList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *SingleCompositeDisruptionMode) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&SingleCompositeDisruptionMode{`, + `}`, + }, "") + return s +} +func (this *SingleDisruptionMode) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&SingleDisruptionMode{`, + `}`, + }, "") + return s +} +func (this *TopologyConstraint) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TopologyConstraint{`, + `Key:` + fmt.Sprintf("%v", this.Key) + `,`, + `}`, + }, "") + return s +} +func (this *TypedLocalObjectReference) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TypedLocalObjectReference{`, + `APIGroup:` + fmt.Sprintf("%v", this.APIGroup) + `,`, + `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `}`, + }, "") + return s +} +func (this *Workload) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Workload{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "WorkloadSpec", "WorkloadSpec", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *WorkloadList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]Workload{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Workload", "Workload", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&WorkloadList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *WorkloadReference) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WorkloadReference{`, + `WorkloadName:` + fmt.Sprintf("%v", this.WorkloadName) + `,`, + `TemplateName:` + fmt.Sprintf("%v", this.TemplateName) + `,`, + `}`, + }, "") + return s +} +func (this *WorkloadSpec) String() string { + if this == nil { + return "nil" + } + repeatedStringForPodGroupTemplates := "[]PodGroupTemplate{" + for _, f := range this.PodGroupTemplates { + repeatedStringForPodGroupTemplates += strings.Replace(strings.Replace(f.String(), "PodGroupTemplate", "PodGroupTemplate", 1), `&`, ``, 1) + "," + } + repeatedStringForPodGroupTemplates += "}" + repeatedStringForCompositePodGroupTemplates := "[]CompositePodGroupTemplate{" + for _, f := range this.CompositePodGroupTemplates { + repeatedStringForCompositePodGroupTemplates += strings.Replace(strings.Replace(f.String(), "CompositePodGroupTemplate", "CompositePodGroupTemplate", 1), `&`, ``, 1) + "," + } + repeatedStringForCompositePodGroupTemplates += "}" + s := strings.Join([]string{`&WorkloadSpec{`, + `ControllerRef:` + strings.Replace(this.ControllerRef.String(), "TypedLocalObjectReference", "TypedLocalObjectReference", 1) + `,`, + `PodGroupTemplates:` + repeatedStringForPodGroupTemplates + `,`, + `CompositePodGroupTemplates:` + repeatedStringForCompositePodGroupTemplates + `,`, + `}`, + }, "") + return s +} +func valueToStringGenerated(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { return "nil" } - s := strings.Join([]string{`&PriorityClass{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `GlobalDefault:` + fmt.Sprintf("%v", this.GlobalDefault) + `,`, - `Description:` + fmt.Sprintf("%v", this.Description) + `,`, - `PreemptionPolicy:` + valueToStringGenerated(this.PreemptionPolicy) + `,`, - `}`, - }, "") - return s + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *AllCompositeDisruptionMode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AllCompositeDisruptionMode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AllCompositeDisruptionMode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AllDisruptionMode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AllDisruptionMode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AllDisruptionMode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BasicSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BasicSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BasicSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompositeBasicSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CompositeBasicSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompositeBasicSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompositeDisruptionMode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CompositeDisruptionMode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompositeDisruptionMode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Single", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Single == nil { + m.Single = &SingleCompositeDisruptionMode{} + } + if err := m.Single.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field All", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.All == nil { + m.All = &AllCompositeDisruptionMode{} + } + if err := m.All.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompositeGangSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CompositeGangSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompositeGangSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinGroupCount", wireType) + } + m.MinGroupCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinGroupCount |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompositePodGroupSchedulingConstraints) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CompositePodGroupSchedulingConstraints: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompositePodGroupSchedulingConstraints: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Topology", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Topology = append(m.Topology, TopologyConstraint{}) + if err := m.Topology[len(m.Topology)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompositePodGroupSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CompositePodGroupSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompositePodGroupSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Basic", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Basic == nil { + m.Basic = &CompositeBasicSchedulingPolicy{} + } + if err := m.Basic.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Gang", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Gang == nil { + m.Gang = &CompositeGangSchedulingPolicy{} + } + if err := m.Gang.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompositePodGroupTemplate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CompositePodGroupTemplate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompositePodGroupTemplate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingPolicy", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SchedulingPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingConstraints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SchedulingConstraints == nil { + m.SchedulingConstraints = &CompositePodGroupSchedulingConstraints{} + } + if err := m.SchedulingConstraints.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisruptionMode", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DisruptionMode == nil { + m.DisruptionMode = &CompositeDisruptionMode{} + } + if err := m.DisruptionMode.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PriorityClassName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PriorityClassName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Priority = &v + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PreemptionPolicy", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := PreemptionPolicy(dAtA[iNdEx:postIndex]) + m.PreemptionPolicy = &s + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PodGroupTemplates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PodGroupTemplates = append(m.PodGroupTemplates, PodGroupTemplate{}) + if err := m.PodGroupTemplates[len(m.PodGroupTemplates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompositePodGroupTemplates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CompositePodGroupTemplates = append(m.CompositePodGroupTemplates, CompositePodGroupTemplate{}) + if err := m.CompositePodGroupTemplates[len(m.CompositePodGroupTemplates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DisruptionMode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DisruptionMode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DisruptionMode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Single", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Single == nil { + m.Single = &SingleDisruptionMode{} + } + if err := m.Single.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field All", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.All == nil { + m.All = &AllDisruptionMode{} + } + if err := m.All.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GangSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GangSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GangSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCount", wireType) + } + m.MinCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinCount |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroup) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroup: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, PodGroup{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupResourceClaim) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupResourceClaim: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupResourceClaim: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ResourceClaimName = &s + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimTemplateName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ResourceClaimTemplateName = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupResourceClaimStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupResourceClaimStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupResourceClaimStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ResourceClaimName = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupSchedulingConstraints) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupSchedulingConstraints: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupSchedulingConstraints: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Topology", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Topology = append(m.Topology, TopologyConstraint{}) + if err := m.Topology[len(m.Topology)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Basic", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Basic == nil { + m.Basic = &BasicSchedulingPolicy{} + } + if err := m.Basic.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Gang", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Gang == nil { + m.Gang = &GangSchedulingPolicy{} + } + if err := m.Gang.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParentCompositePodGroupName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ParentCompositePodGroupName = &s + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WorkloadRef", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.WorkloadRef == nil { + m.WorkloadRef = &WorkloadReference{} + } + if err := m.WorkloadRef.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingPolicy", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SchedulingPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingConstraints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SchedulingConstraints == nil { + m.SchedulingConstraints = &PodGroupSchedulingConstraints{} + } + if err := m.SchedulingConstraints.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaims", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceClaims = append(m.ResourceClaims, PodGroupResourceClaim{}) + if err := m.ResourceClaims[len(m.ResourceClaims)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisruptionMode", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DisruptionMode == nil { + m.DisruptionMode = &DisruptionMode{} + } + if err := m.DisruptionMode.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PriorityClassName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PriorityClassName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Priority = &v + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PreemptionPolicy", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := PreemptionPolicy(dAtA[iNdEx:postIndex]) + m.PreemptionPolicy = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Conditions = append(m.Conditions, v1.Condition{}) + if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimStatuses", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceClaimStatuses = append(m.ResourceClaimStatuses, PodGroupResourceClaimStatus{}) + if err := m.ResourceClaimStatuses[len(m.ResourceClaimStatuses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupTemplate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupTemplate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupTemplate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingPolicy", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SchedulingPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingConstraints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SchedulingConstraints == nil { + m.SchedulingConstraints = &PodGroupSchedulingConstraints{} + } + if err := m.SchedulingConstraints.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaims", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceClaims = append(m.ResourceClaims, PodGroupResourceClaim{}) + if err := m.ResourceClaims[len(m.ResourceClaims)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisruptionMode", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DisruptionMode == nil { + m.DisruptionMode = &DisruptionMode{} + } + if err := m.DisruptionMode.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PriorityClassName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PriorityClassName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Priority = &v + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PreemptionPolicy", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := PreemptionPolicy(dAtA[iNdEx:postIndex]) + m.PreemptionPolicy = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PriorityClass) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PriorityClass: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PriorityClass: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalDefault", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.GlobalDefault = bool(v != 0) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PreemptionPolicy", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := k8s_io_api_core_v1.PreemptionPolicy(dAtA[iNdEx:postIndex]) + m.PreemptionPolicy = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PriorityClassList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PriorityClassList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PriorityClassList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, PriorityClass{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SingleCompositeDisruptionMode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SingleCompositeDisruptionMode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SingleCompositeDisruptionMode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } -func (this *PriorityClassList) String() string { - if this == nil { - return "nil" +func (m *SingleDisruptionMode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SingleDisruptionMode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SingleDisruptionMode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } } - repeatedStringForItems := "[]PriorityClass{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "PriorityClass", "PriorityClass", 1), `&`, ``, 1) + "," + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TopologyConstraint) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TopologyConstraint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TopologyConstraint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TypedLocalObjectReference) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TypedLocalObjectReference: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TypedLocalObjectReference: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field APIGroup", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.APIGroup = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Kind = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } } - repeatedStringForItems += "}" - s := strings.Join([]string{`&PriorityClassList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" + + if iNdEx > l { + return io.ErrUnexpectedEOF } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) + return nil } -func (m *PriorityClass) Unmarshal(dAtA []byte) error { +func (m *Workload) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -252,10 +5660,10 @@ func (m *PriorityClass) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PriorityClass: wiretype end group for non-group") + return fmt.Errorf("proto: Workload: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PriorityClass: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Workload: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -292,10 +5700,10 @@ func (m *PriorityClass) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) } - m.Value = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -305,16 +5713,80 @@ func (m *PriorityClass) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Value |= int32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GlobalDefault", wireType) + if msglen < 0 { + return ErrInvalidLengthGenerated } - var v int + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -324,15 +5796,112 @@ func (m *PriorityClass) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - m.GlobalDefault = bool(v != 0) - case 4: + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, Workload{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadReference) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadReference: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadReference: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WorkloadName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -360,11 +5929,11 @@ func (m *PriorityClass) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Description = string(dAtA[iNdEx:postIndex]) + m.WorkloadName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PreemptionPolicy", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TemplateName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -392,8 +5961,7 @@ func (m *PriorityClass) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := k8s_io_api_core_v1.PreemptionPolicy(dAtA[iNdEx:postIndex]) - m.PreemptionPolicy = &s + m.TemplateName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -416,7 +5984,7 @@ func (m *PriorityClass) Unmarshal(dAtA []byte) error { } return nil } -func (m *PriorityClassList) Unmarshal(dAtA []byte) error { +func (m *WorkloadSpec) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -439,15 +6007,15 @@ func (m *PriorityClassList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PriorityClassList: wiretype end group for non-group") + return fmt.Errorf("proto: WorkloadSpec: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PriorityClassList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: WorkloadSpec: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ControllerRef", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -474,13 +6042,16 @@ func (m *PriorityClassList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.ControllerRef == nil { + m.ControllerRef = &TypedLocalObjectReference{} + } + if err := m.ControllerRef.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PodGroupTemplates", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -507,8 +6078,42 @@ func (m *PriorityClassList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Items = append(m.Items, PriorityClass{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.PodGroupTemplates = append(m.PodGroupTemplates, PodGroupTemplate{}) + if err := m.PodGroupTemplates[len(m.PodGroupTemplates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompositePodGroupTemplates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CompositePodGroupTemplates = append(m.CompositePodGroupTemplates, CompositePodGroupTemplate{}) + if err := m.CompositePodGroupTemplates[len(m.CompositePodGroupTemplates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/vendor/k8s.io/api/scheduling/v1beta1/generated.proto b/vendor/k8s.io/api/scheduling/v1beta1/generated.proto index 0e701be549..656841e41d 100644 --- a/vendor/k8s.io/api/scheduling/v1beta1/generated.proto +++ b/vendor/k8s.io/api/scheduling/v1beta1/generated.proto @@ -29,11 +29,651 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; // Package-wide variables from generator "generated". option go_package = "k8s.io/api/scheduling/v1beta1"; +// AllCompositeDisruptionMode means that children of a CompositePodGroup can only be +// disrupted or preempted together. +message AllCompositeDisruptionMode { +} + +// AllDisruptionMode specifies that children can only be disrupted together. +message AllDisruptionMode { +} + +// BasicSchedulingPolicy indicates that standard Kubernetes +// scheduling behavior should be used. +message BasicSchedulingPolicy { +} + +// CompositeBasicSchedulingPolicy indicates that the groups belonging to the composite group +// should be scheduled independently. +message CompositeBasicSchedulingPolicy { +} + +// CompositeDisruptionMode defines how individual entities within a composite pod group can be disrupted. +// Exactly one mode must be set. +// +// +union +message CompositeDisruptionMode { + // single specifies that children groups can be disrupted independently from each other. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional SingleCompositeDisruptionMode single = 1; + + // all specifies that all children groups can only be disrupted together. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional AllCompositeDisruptionMode all = 2; +} + +// CompositeGangSchedulingPolicy indicates that the groups belonging to the composite group +// should be scheduled using all-or-nothing semantics. +message CompositeGangSchedulingPolicy { + // minGroupCount is the minimum number of child groups that must be schedulable + // or scheduled at the same time for the scheduler to admit the entire group. + // It must be a positive integer. + // + // +required + // +k8s:required + // +k8s:minimum=1 + optional int32 minGroupCount = 1; +} + +// CompositePodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a CompositePodGroup. +message CompositePodGroupSchedulingConstraints { + // topology defines the topology constraints for the composite pod group. + // Currently only a single topology constraint can be specified. This may change in the future. + // + // +optional + // +k8s:optional + // +k8s:maxItems=1 + // +listType=atomic + // +k8s:listType=atomic + repeated TopologyConstraint topology = 1; +} + +// CompositePodGroupSchedulingPolicy defines the scheduling configuration for a CompositePodGroup. +// Exactly one policy must be set. +// +// +union +message CompositePodGroupSchedulingPolicy { + // basic specifies that the groups of this composite group should be scheduled independently. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + // +k8s:unionMember + optional CompositeBasicSchedulingPolicy basic = 1; + + // gang specifies that the groups of this composite group should be scheduled using + // all-or-nothing semantics. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:update=NoSet + // +k8s:update=NoUnset + optional CompositeGangSchedulingPolicy gang = 2; +} + +// CompositePodGroupTemplate represents a template for a CompositePodGroup with a scheduling policy. +message CompositePodGroupTemplate { + // name is a unique identifier for the CompositePodGroupTemplate within the Workload. + // It must be a DNS label. This field is required. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + optional string name = 1; + + // schedulingPolicy defines the scheduling policy for this template. + // + // +required + optional CompositePodGroupSchedulingPolicy schedulingPolicy = 2; + + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this CompositePodGroupTemplate. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + optional CompositePodGroupSchedulingConstraints schedulingConstraints = 3; + + // disruptionMode defines the mode in which a given CompositePodGroup can be disrupted. + // One of Single, All. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + optional CompositeDisruptionMode disruptionMode = 4; + + // priorityClassName indicates the priority that should be considered when scheduling + // a composite pod group created from this template. If no priority class is specified, + // admission control can set this to the global default priority class if it exists. + // Otherwise, composite pod groups created from this template will have the priority set + // to zero. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + // +k8s:immutable + optional string priorityClassName = 5; + + // priority is the value of priority of composite pod groups created from this template. + // Various system components use this field to find the priority of the composite pod group. + // When Priority Admission Controller is enabled, it prevents users from setting this field. + // The admission controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:maximum=1000000000 # HighestUserDefinablePriority + // +k8s:immutable + optional int32 priority = 6; + + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + // + // +featureGate=PodGroupPreemptionPolicy + // +optional + // +k8s:immutable + // +k8s:ifDisabled("PodGroupPreemptionPolicy")=+k8s:forbidden + // +k8s:ifEnabled("PodGroupPreemptionPolicy")=+k8s:optional + optional string preemptionPolicy = 7; + + // podGroupTemplates is the list of templates for children PodGroups. + // The maximum number of templates is 8. At least one entry in CompositePodGroupTemplates + // or PodGroupTemplates must be set. + // + // +optional + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=8 + // +k8s:update=NoAddItem + // +k8s:update=NoRemoveItem + repeated PodGroupTemplate podGroupTemplates = 8; + + // compositePodGroupTemplates is the list of templates for children CompositePodGroups. + // The maximum number of templates is 8. At least one entry in CompositePodGroupTemplates + // or PodGroupTemplates must be set. + // + // +optional + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=8 + // +k8s:update=NoAddItem + // +k8s:update=NoRemoveItem + repeated CompositePodGroupTemplate compositePodGroupTemplates = 9; +} + +// DisruptionMode defines how individual entities within a group can be disrupted. +// Exactly one mode can be set. +// +// +union +message DisruptionMode { + // single specifies that children can be disrupted independently from each other. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional SingleDisruptionMode single = 1; + + // all specifies that all children can only be disrupted together. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional AllDisruptionMode all = 2; +} + +// GangSchedulingPolicy defines the parameters for gang scheduling. +message GangSchedulingPolicy { + // minCount is the minimum number of pods that must be schedulable or scheduled + // at the same time for the scheduler to admit the entire group. + // It must be a positive integer. This field is mutable to support workload scaling. + // + // Note that the scheduler operates on an eventually consistent model. Updates + // to minCount may not be immediately reflected in scheduling decisions due to + // propagation delays. If minCount is updated while a scheduling cycle is in + // progress for that group, the new value may not take effect until the next + // cycle. Moreover, minCount is only enforced during scheduling, meaning that + // modifications to this field do not affect already-scheduled pods, applying + // only to those evaluated in future cycles. + // + // +required + // +k8s:required + // +k8s:minimum=1 + optional int32 minCount = 1; +} + +// PodGroup represents a runtime instance of pods grouped together. +// PodGroups are created by workload controllers (Job, LWS, JobSet, etc...) from +// Workload.podGroupTemplates. +// PodGroup API enablement is toggled by the GenericWorkload feature gate. +message PodGroup { + // metadata is the standard object metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // spec defines the desired state of the PodGroup. + // + // +required + optional PodGroupSpec spec = 2; + + // status represents the current observed state of the PodGroup. + // + // +optional + optional PodGroupStatus status = 3; +} + +// PodGroupList contains a list of PodGroup resources. +message PodGroupList { + // Standard list metadata. + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // Items is the list of PodGroups. + repeated PodGroup items = 2; +} + +// PodGroupResourceClaim references exactly one ResourceClaim, either directly +// or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim +// for the PodGroup. +// +// It adds a name to it that uniquely identifies the ResourceClaim inside the PodGroup. +// Pods that need access to the ResourceClaim define a matching reference in its +// own Spec.ResourceClaims. The Pod's claim must match all fields of the +// PodGroup's claim exactly. +message PodGroupResourceClaim { + // name uniquely identifies this resource claim inside the PodGroup. + // This must be a DNS_LABEL. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + optional string name = 1; + + // resourceClaimName is the name of a ResourceClaim object in the same + // namespace as this PodGroup. The ResourceClaim will be reserved for the + // PodGroup instead of its individual pods. + // + // Exactly one of ResourceClaimName and ResourceClaimTemplateName must + // be set. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:format=k8s-long-name + optional string resourceClaimName = 2; + + // resourceClaimTemplateName is the name of a ResourceClaimTemplate + // object in the same namespace as this PodGroup. + // + // The template will be used to create a new ResourceClaim, which will + // be bound to this PodGroup. When this PodGroup is deleted, the ResourceClaim + // will also be deleted. The PodGroup name and resource name, along with a + // generated component, will be used to form a unique name for the + // ResourceClaim, which will be recorded in podgroup.status.resourceClaimStatuses. + // + // This field is immutable and no changes will be made to the + // corresponding ResourceClaim by the control plane after creating the + // ResourceClaim. + // + // Exactly one of ResourceClaimName and ResourceClaimTemplateName must + // be set. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:format=k8s-long-name + optional string resourceClaimTemplateName = 3; +} + +// PodGroupResourceClaimStatus is stored in the PodGroupStatus for each +// PodGroupResourceClaim which references a ResourceClaimTemplate. It stores the +// generated name for the corresponding ResourceClaim. +message PodGroupResourceClaimStatus { + // name uniquely identifies this resource claim inside the PodGroup. This + // must match the name of an entry in podgroup.spec.resourceClaims, which + // implies that the string must be a DNS_LABEL. + // + // +required + optional string name = 1; + + // resourceClaimName is the name of the ResourceClaim that was generated for + // the PodGroup in the namespace of the PodGroup. If this is unset, then + // generating a ResourceClaim was not necessary. The + // podgroup.spec.resourceClaims entry can be ignored in this case. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + optional string resourceClaimName = 2; +} + +// PodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a PodGroup. +message PodGroupSchedulingConstraints { + // topology defines the topology constraints for the pod group. + // Currently only a single topology constraint can be specified. This may change in the future. + // + // +optional + // +k8s:optional + // +k8s:maxItems=1 + // +listType=atomic + // +k8s:listType=atomic + repeated TopologyConstraint topology = 1; +} + +// PodGroupSchedulingPolicy defines the scheduling configuration for a PodGroup. +// Exactly one policy must be set. The policy is chosen at creation time by setting either the +// Basic or Gang field. The PodGroup may not change policy after creation. +// Fields within chosen policy may be updated after creation when their individual fields allow it. +// +// +union +message PodGroupSchedulingPolicy { + // basic specifies that the pods in this group should be scheduled using + // standard Kubernetes scheduling behavior. Setting this field at group creation time + // opts this group to basic scheduling; this field cannot be changed afterward. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:immutable + optional BasicSchedulingPolicy basic = 1; + + // gang specifies that the pods in this group should be scheduled using + // all-or-nothing semantics. Setting this field at group creation time + // opts this group to gang scheduling; this field cannot be set or unset afterward. + // The minCount field within Gang scheduling policy remains mutable after group creation. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:update=NoSet + // +k8s:update=NoUnset + optional GangSchedulingPolicy gang = 2; +} + +// PodGroupSpec defines the desired state of a PodGroup. +message PodGroupSpec { + // parentCompositePodGroupName contains the name of the parent composite pod group + // within the same namespace as this pod group. + // If it's nil, then this pod group is a root of a workload's hierarchy. + // This field is used only when the CompositePodGroup feature gate is enabled. + // This field is immutable. + // + // +featureGate=CompositePodGroup + // +optional + // +k8s:ifDisabled(CompositePodGroup)=+k8s:forbidden + // +k8s:ifEnabled(CompositePodGroup)=+k8s:optional + // +k8s:immutable + // +k8s:format=k8s-long-name + // +k8s:alpha(since: "1.37")=+k8s:dependentRequired("workloadRef") + optional string parentCompositePodGroupName = 1; + + // workloadRef references an optional PodGroup template within the Workload + // object that was used to create the PodGroup. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + optional WorkloadReference workloadRef = 2; + + // schedulingPolicy defines the scheduling policy for this instance of the PodGroup. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // + // +required + optional PodGroupSchedulingPolicy schedulingPolicy = 3; + + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroup. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // This field is immutable. + // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. + // + // +featureGate=TopologyAwareWorkloadScheduling + // +optional + // +k8s:ifDisabled(TopologyAwareWorkloadScheduling)=+k8s:forbidden + // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:optional + // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:immutable + optional PodGroupSchedulingConstraints schedulingConstraints = 4; + + // resourceClaims defines which ResourceClaims may be shared among Pods in + // the group. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // + // This is a beta-level field and requires that the + // DRAWorkloadResourceClaims feature gate is enabled. + // + // This field is immutable. + // + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +k8s:immutable + // +featureGate=DRAWorkloadResourceClaims + repeated PodGroupResourceClaim resourceClaims = 5; + + // disruptionMode defines the mode in which a given PodGroup can be disrupted. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // One of Single, All. Defaults to Single if unset. + // This field is immutable. + // + // +default={"single": {}} + // +optional + // +k8s:optional + // +k8s:immutable + optional DisruptionMode disruptionMode = 6; + + // priorityClassName defines the priority that should be considered when scheduling this pod group. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // Otherwise, it is validated and resolved similarly to the PriorityClassName on PodGroupTemplate + // (i.e. if no priority class is specified, admission control can set this to the global default + // priority class if it exists. Otherwise, the pod group's priority will be zero). + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + // +k8s:format=k8s-long-name + optional string priorityClassName = 7; + + // priority is the value of priority of this pod group. Various system components + // use this field to find the priority of the pod group. When Priority Admission + // Controller is enabled, it prevents users from setting this field. The admission + // controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + // +k8s:maximum=1000000000 # HighestUserDefinablePriority + optional int32 priority = 8; + + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. + // When Priority Admission Controller is enabled, it populates this field from PriorityClassName, + // and defaults to PreemptLowerPriority if value is unset in PriorityClass. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + // + // +featureGate=PodGroupPreemptionPolicy + // +optional + // +k8s:immutable + // +k8s:ifDisabled("PodGroupPreemptionPolicy")=+k8s:forbidden + // +k8s:ifEnabled("PodGroupPreemptionPolicy")=+k8s:optional + optional string preemptionPolicy = 9; +} + +// PodGroupStatus represents information about the status of a pod group. +message PodGroupStatus { + // conditions represent the latest observations of the PodGroup's state. + // + // Known condition types: + // - "PodGroupInitiallyScheduled": Indicates whether the scheduling requirement has been satisfied. + // Once this condition transitions to True, it serves as a terminal state and will never revert to False, + // even if pods are subsequently evicted and group constraints are no longer met. + // - "DisruptionTarget": Indicates whether the PodGroup is about to be terminated + // due to disruption such as preemption. + // + // Known reasons for the PodGroupInitiallyScheduled condition: + // - "Unschedulable": The PodGroup cannot be scheduled due to resource constraints, + // affinity/anti-affinity rules, or insufficient capacity for the gang. + // - "SchedulerError": The PodGroup cannot be scheduled due to some internal error + // that happened during scheduling, for example due to nodeAffinity parsing errors. + // + // Known reasons for the DisruptionTarget condition: + // - "PreemptionByScheduler": The PodGroup was preempted by the scheduler to make room for + // higher-priority PodGroups or Pods. + // + // +optional + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1; + + // resourceClaimStatuses is status of resource claims. + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +featureGate=DRAWorkloadResourceClaims + repeated PodGroupResourceClaimStatus resourceClaimStatuses = 2; +} + +// PodGroupTemplate represents a template for a set of pods with a scheduling policy. +message PodGroupTemplate { + // name is a unique identifier for the PodGroupTemplate within the Workload. + // It must be a DNS label. This field is immutable. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + optional string name = 1; + + // schedulingPolicy defines the scheduling policy for this PodGroupTemplate. + // + // +required + optional PodGroupSchedulingPolicy schedulingPolicy = 2; + + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroupTemplate. + // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. + // This field is immutable. + // + // +featureGate=TopologyAwareWorkloadScheduling + // +optional + // +k8s:ifDisabled(TopologyAwareWorkloadScheduling)=+k8s:forbidden + // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:optional + // +k8s:immutable + optional PodGroupSchedulingConstraints schedulingConstraints = 3; + + // resourceClaims defines which ResourceClaims may be shared among Pods in + // the group. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // + // This is a beta-level field and requires that the + // DRAWorkloadResourceClaims feature gate is enabled. + // + // This field is immutable. + // + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +featureGate=DRAWorkloadResourceClaims + // +k8s:immutable + repeated PodGroupResourceClaim resourceClaims = 4; + + // disruptionMode defines the mode in which a given PodGroup can be disrupted. + // One of Single, All. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + optional DisruptionMode disruptionMode = 5; + + // priorityClassName indicates the priority that should be considered when scheduling + // a pod group created from this template. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + // +k8s:immutable + optional string priorityClassName = 6; + + // priority is the value of priority of pod groups created from this template. Various + // system components use this field to find the priority of the pod group. + // The higher the value, the higher the priority. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:maximum=1000000000 # HighestUserDefinablePriority + // +k8s:immutable + optional int32 priority = 7; + + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + // + // +featureGate=PodGroupPreemptionPolicy + // +optional + // +k8s:immutable + // +k8s:ifDisabled("PodGroupPreemptionPolicy")=+k8s:forbidden + // +k8s:ifEnabled("PodGroupPreemptionPolicy")=+k8s:optional + optional string preemptionPolicy = 8; +} + // DEPRECATED - This group version of PriorityClass is deprecated by scheduling.k8s.io/v1/PriorityClass. // PriorityClass defines mapping from a priority class name to the priority // integer value. The value can be any valid integer. message PriorityClass { - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -74,3 +714,155 @@ message PriorityClassList { repeated PriorityClass items = 2; } +// SingleCompositeDisruptionMode means that individual children of a CompositePodGroup +// can be disrupted or preempted independently. +message SingleCompositeDisruptionMode { +} + +// SingleDisruptionMode specifies that children can be disrupted independently. +message SingleDisruptionMode { +} + +// TopologyConstraint defines a topology constraint for a PodGroup. +message TopologyConstraint { + // key specifies the key of the node label representing the topology domain. + // All pods within the PodGroup must be colocated within the same domain instance. + // Different PodGroups can land on different domain instances even if they derive from the same PodGroupTemplate. + // Examples: "topology.kubernetes.io/rack" + // + // +required + // +k8s:required + // +k8s:format=k8s-label-key + optional string key = 1; +} + +// TypedLocalObjectReference allows to reference typed object inside the same namespace. +message TypedLocalObjectReference { + // apiGroup is the group for the resource being referenced. + // If apiGroup is empty, the specified Kind must be in the core API group. + // For any other third-party types, setting apiGroup is required. + // It must be a DNS subdomain. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + optional string apiGroup = 1; + + // kind is the type of resource being referenced. + // It must be a path segment name. + // + // +required + // +k8s:required + // +k8s:format=k8s-path-segment-name + optional string kind = 2; + + // name is the name of resource being referenced. + // It must be a path segment name. + // + // +required + // +k8s:required + // +k8s:format=k8s-path-segment-name + optional string name = 3; +} + +// Workload allows for expressing scheduling constraints that should be used +// when managing the lifecycle of workloads from the scheduling perspective, +// including scheduling, preemption, eviction and other phases. +// Workload API enablement is toggled by the GenericWorkload feature gate. +message Workload { + // metadata is the standard object metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // spec defines the desired behavior of a Workload. + // + // +required + optional WorkloadSpec spec = 2; +} + +// WorkloadList contains a list of Workload resources. +message WorkloadList { + // metadata is the standard list metadata. + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // items is the list of Workloads. + repeated Workload items = 2; +} + +// WorkloadReference references the Workload object together with the template +// that was used to create a particular PodGroup. +message WorkloadReference { + // workloadName is the name of the Workload object that contains a template + // that was used when creating a pod group. It must + // be a DNS name. + // This field is required. + // + // +required + // +k8s:required + // +k8s:format=k8s-long-name + optional string workloadName = 1; + + // templateName is the name of a template within the Workload object that + // was used to create a pod group. It must be a DNS label. + // This field is required. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + optional string templateName = 2; +} + +// WorkloadSpec defines the desired state of a Workload. +message WorkloadSpec { + // controllerRef is an optional reference to the controlling object, such as a + // Deployment or Job. This field is intended for use by tools like CLIs + // to provide a link back to the original workload definition. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + optional TypedLocalObjectReference controllerRef = 1; + + // podGroupTemplates is the list of templates that make up the Workload. + // The maximum number of templates is 8. Templates cannot be added or removed after the workload is created. + // Existing templates may still be updated where their individual fields allow it. + // Exactly one of CompositePodGroupTemplates and PodGroupTemplates must be set. + // + // +optional + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:unionMember + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=8 + // +k8s:update=NoAddItem + // +k8s:update=NoRemoveItem + repeated PodGroupTemplate podGroupTemplates = 2; + + // compositePodGroupTemplates is the list of CompositePodGroup templates that make up the Workload. + // The maximum number of templates is 8. This field is immutable. + // Exactly one of CompositePodGroupTemplates and PodGroupTemplates must be set. + // + // This field is used only when the CompositePodGroup feature gate is enabled. + // + // +featureGate=CompositePodGroup + // +optional + // +listType=map + // +listMapKey=name + // +k8s:ifDisabled("CompositePodGroup")=+k8s:forbidden + // +k8s:ifEnabled("CompositePodGroup")=+k8s:optional + // +k8s:unionMember + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=8 + // +k8s:update=NoAddItem + // +k8s:update=NoRemoveItem + repeated CompositePodGroupTemplate compositePodGroupTemplates = 3; +} + diff --git a/vendor/k8s.io/api/scheduling/v1beta1/register.go b/vendor/k8s.io/api/scheduling/v1beta1/register.go index fb26557bbb..c2e75d9071 100644 --- a/vendor/k8s.io/api/scheduling/v1beta1/register.go +++ b/vendor/k8s.io/api/scheduling/v1beta1/register.go @@ -46,6 +46,10 @@ func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &PriorityClass{}, &PriorityClassList{}, + &Workload{}, + &WorkloadList{}, + &PodGroup{}, + &PodGroupList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/vendor/k8s.io/api/scheduling/v1beta1/types.go b/vendor/k8s.io/api/scheduling/v1beta1/types.go index 8a7a2058f0..57eeac9486 100644 --- a/vendor/k8s.io/api/scheduling/v1beta1/types.go +++ b/vendor/k8s.io/api/scheduling/v1beta1/types.go @@ -33,8 +33,8 @@ import ( // PriorityClass defines mapping from a priority class name to the priority // integer value. The value can be any valid integer. type PriorityClass struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -72,7 +72,7 @@ type PriorityClass struct { // PriorityClassList is a collection of priority classes. type PriorityClassList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -81,3 +81,869 @@ type PriorityClassList struct { // items is the list of PriorityClasses Items []PriorityClass `json:"items" protobuf:"bytes,2,rep,name=items"` } + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.37 + +// Workload allows for expressing scheduling constraints that should be used +// when managing the lifecycle of workloads from the scheduling perspective, +// including scheduling, preemption, eviction and other phases. +// Workload API enablement is toggled by the GenericWorkload feature gate. +type Workload struct { + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // spec defines the desired behavior of a Workload. + // + // +required + Spec WorkloadSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.37 + +// WorkloadList contains a list of Workload resources. +type WorkloadList struct { + metav1.TypeMeta `json:""` + // metadata is the standard list metadata. + // + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // items is the list of Workloads. + Items []Workload `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +const ( + // WorkloadMaxPodGroupTemplates is the maximum number of pod group templates per Workload. + WorkloadMaxPodGroupTemplates = 8 + // WorkloadMaxTreeDepth is the maximum allowed depth for a tree of (composite) pod group templates in a Workload. + WorkloadMaxTreeDepth = 4 +) + +// WorkloadSpec defines the desired state of a Workload. +type WorkloadSpec struct { + // controllerRef is an optional reference to the controlling object, such as a + // Deployment or Job. This field is intended for use by tools like CLIs + // to provide a link back to the original workload definition. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + ControllerRef *TypedLocalObjectReference `json:"controllerRef,omitempty" protobuf:"bytes,1,opt,name=controllerRef"` + + // podGroupTemplates is the list of templates that make up the Workload. + // The maximum number of templates is 8. Templates cannot be added or removed after the workload is created. + // Existing templates may still be updated where their individual fields allow it. + // Exactly one of CompositePodGroupTemplates and PodGroupTemplates must be set. + // + // +optional + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:unionMember + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=8 + // +k8s:update=NoAddItem + // +k8s:update=NoRemoveItem + PodGroupTemplates []PodGroupTemplate `json:"podGroupTemplates" protobuf:"bytes,2,rep,name=podGroupTemplates"` + + // compositePodGroupTemplates is the list of CompositePodGroup templates that make up the Workload. + // The maximum number of templates is 8. This field is immutable. + // Exactly one of CompositePodGroupTemplates and PodGroupTemplates must be set. + // + // This field is used only when the CompositePodGroup feature gate is enabled. + // + // +featureGate=CompositePodGroup + // +optional + // +listType=map + // +listMapKey=name + // +k8s:ifDisabled("CompositePodGroup")=+k8s:forbidden + // +k8s:ifEnabled("CompositePodGroup")=+k8s:optional + // +k8s:unionMember + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=8 + // +k8s:update=NoAddItem + // +k8s:update=NoRemoveItem + CompositePodGroupTemplates []CompositePodGroupTemplate `json:"compositePodGroupTemplates,omitempty" protobuf:"bytes,3,rep,name=compositePodGroupTemplates"` +} + +// TypedLocalObjectReference allows to reference typed object inside the same namespace. +type TypedLocalObjectReference struct { + // apiGroup is the group for the resource being referenced. + // If apiGroup is empty, the specified Kind must be in the core API group. + // For any other third-party types, setting apiGroup is required. + // It must be a DNS subdomain. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + APIGroup string `json:"apiGroup,omitempty" protobuf:"bytes,1,opt,name=apiGroup"` + // kind is the type of resource being referenced. + // It must be a path segment name. + // + // +required + // +k8s:required + // +k8s:format=k8s-path-segment-name + Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` + // name is the name of resource being referenced. + // It must be a path segment name. + // + // +required + // +k8s:required + // +k8s:format=k8s-path-segment-name + Name string `json:"name" protobuf:"bytes,3,opt,name=name"` +} + +// MaxPodGroupResourceClaims is the maximum number of resource claims for a +// PodGroup or a Workload's PodGroupTemplate. +const MaxPodGroupResourceClaims = 4 + +// PodGroupTemplate represents a template for a set of pods with a scheduling policy. +type PodGroupTemplate struct { + // name is a unique identifier for the PodGroupTemplate within the Workload. + // It must be a DNS label. This field is immutable. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + + // schedulingPolicy defines the scheduling policy for this PodGroupTemplate. + // + // +required + SchedulingPolicy PodGroupSchedulingPolicy `json:"schedulingPolicy" protobuf:"bytes,2,opt,name=schedulingPolicy"` + + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroupTemplate. + // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. + // This field is immutable. + // + // +featureGate=TopologyAwareWorkloadScheduling + // +optional + // +k8s:ifDisabled(TopologyAwareWorkloadScheduling)=+k8s:forbidden + // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:optional + // +k8s:immutable + SchedulingConstraints *PodGroupSchedulingConstraints `json:"schedulingConstraints" protobuf:"bytes,3,opt,name=schedulingConstraints"` + + // resourceClaims defines which ResourceClaims may be shared among Pods in + // the group. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // + // This is a beta-level field and requires that the + // DRAWorkloadResourceClaims feature gate is enabled. + // + // This field is immutable. + // + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +featureGate=DRAWorkloadResourceClaims + // +k8s:immutable + ResourceClaims []PodGroupResourceClaim `json:"resourceClaims,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name" protobuf:"bytes,4,rep,name=resourceClaims"` + + // disruptionMode defines the mode in which a given PodGroup can be disrupted. + // One of Single, All. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + DisruptionMode *DisruptionMode `json:"disruptionMode,omitempty" protobuf:"bytes,5,opt,name=disruptionMode"` + + // priorityClassName indicates the priority that should be considered when scheduling + // a pod group created from this template. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + // +k8s:immutable + PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,6,opt,name=priorityClassName"` + + // priority is the value of priority of pod groups created from this template. Various + // system components use this field to find the priority of the pod group. + // The higher the value, the higher the priority. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:maximum=1000000000 # HighestUserDefinablePriority + // +k8s:immutable + Priority *int32 `json:"priority,omitempty" protobuf:"varint,7,opt,name=priority"` + + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + // + // +featureGate=PodGroupPreemptionPolicy + // +optional + // +k8s:immutable + // +k8s:ifDisabled("PodGroupPreemptionPolicy")=+k8s:forbidden + // +k8s:ifEnabled("PodGroupPreemptionPolicy")=+k8s:optional + PreemptionPolicy *PreemptionPolicy `json:"preemptionPolicy,omitempty" protobuf:"bytes,8,opt,name=preemptionPolicy"` +} + +// CompositePodGroupTemplate represents a template for a CompositePodGroup with a scheduling policy. +type CompositePodGroupTemplate struct { + // name is a unique identifier for the CompositePodGroupTemplate within the Workload. + // It must be a DNS label. This field is required. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + + // schedulingPolicy defines the scheduling policy for this template. + // + // +required + SchedulingPolicy CompositePodGroupSchedulingPolicy `json:"schedulingPolicy" protobuf:"bytes,2,opt,name=schedulingPolicy"` + + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this CompositePodGroupTemplate. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + SchedulingConstraints *CompositePodGroupSchedulingConstraints `json:"schedulingConstraints,omitempty" protobuf:"bytes,3,opt,name=schedulingConstraints"` + + // disruptionMode defines the mode in which a given CompositePodGroup can be disrupted. + // One of Single, All. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + DisruptionMode *CompositeDisruptionMode `json:"disruptionMode,omitempty" protobuf:"bytes,4,opt,name=disruptionMode"` + + // priorityClassName indicates the priority that should be considered when scheduling + // a composite pod group created from this template. If no priority class is specified, + // admission control can set this to the global default priority class if it exists. + // Otherwise, composite pod groups created from this template will have the priority set + // to zero. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + // +k8s:immutable + PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,5,opt,name=priorityClassName"` + + // priority is the value of priority of composite pod groups created from this template. + // Various system components use this field to find the priority of the composite pod group. + // When Priority Admission Controller is enabled, it prevents users from setting this field. + // The admission controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:maximum=1000000000 # HighestUserDefinablePriority + // +k8s:immutable + Priority *int32 `json:"priority,omitempty" protobuf:"varint,6,opt,name=priority"` + + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + // + // +featureGate=PodGroupPreemptionPolicy + // +optional + // +k8s:immutable + // +k8s:ifDisabled("PodGroupPreemptionPolicy")=+k8s:forbidden + // +k8s:ifEnabled("PodGroupPreemptionPolicy")=+k8s:optional + PreemptionPolicy *PreemptionPolicy `json:"preemptionPolicy,omitempty" protobuf:"bytes,7,opt,name=preemptionPolicy"` + + // podGroupTemplates is the list of templates for children PodGroups. + // The maximum number of templates is 8. At least one entry in CompositePodGroupTemplates + // or PodGroupTemplates must be set. + // + // +optional + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=8 + // +k8s:update=NoAddItem + // +k8s:update=NoRemoveItem + PodGroupTemplates []PodGroupTemplate `json:"podGroupTemplates,omitempty" protobuf:"bytes,8,rep,name=podGroupTemplates"` + + // compositePodGroupTemplates is the list of templates for children CompositePodGroups. + // The maximum number of templates is 8. At least one entry in CompositePodGroupTemplates + // or PodGroupTemplates must be set. + // + // +optional + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=8 + // +k8s:update=NoAddItem + // +k8s:update=NoRemoveItem + CompositePodGroupTemplates []CompositePodGroupTemplate `json:"compositePodGroupTemplates,omitempty" protobuf:"bytes,9,rep,name=compositePodGroupTemplates"` +} + +// PodGroupSchedulingPolicy defines the scheduling configuration for a PodGroup. +// Exactly one policy must be set. The policy is chosen at creation time by setting either the +// Basic or Gang field. The PodGroup may not change policy after creation. +// Fields within chosen policy may be updated after creation when their individual fields allow it. +// +// +union +type PodGroupSchedulingPolicy struct { + // basic specifies that the pods in this group should be scheduled using + // standard Kubernetes scheduling behavior. Setting this field at group creation time + // opts this group to basic scheduling; this field cannot be changed afterward. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:immutable + Basic *BasicSchedulingPolicy `json:"basic,omitempty" protobuf:"bytes,1,opt,name=basic"` + + // gang specifies that the pods in this group should be scheduled using + // all-or-nothing semantics. Setting this field at group creation time + // opts this group to gang scheduling; this field cannot be set or unset afterward. + // The minCount field within Gang scheduling policy remains mutable after group creation. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:update=NoSet + // +k8s:update=NoUnset + Gang *GangSchedulingPolicy `json:"gang,omitempty" protobuf:"bytes,2,opt,name=gang"` +} + +// BasicSchedulingPolicy indicates that standard Kubernetes +// scheduling behavior should be used. +type BasicSchedulingPolicy struct { + // This is intentionally empty. Its presence indicates that the basic + // scheduling policy should be applied. In the future, new fields may appear, + // describing such constraints on a pod group level without "all or nothing" + // (gang) scheduling. +} + +// GangSchedulingPolicy defines the parameters for gang scheduling. +type GangSchedulingPolicy struct { + // minCount is the minimum number of pods that must be schedulable or scheduled + // at the same time for the scheduler to admit the entire group. + // It must be a positive integer. This field is mutable to support workload scaling. + // + // Note that the scheduler operates on an eventually consistent model. Updates + // to minCount may not be immediately reflected in scheduling decisions due to + // propagation delays. If minCount is updated while a scheduling cycle is in + // progress for that group, the new value may not take effect until the next + // cycle. Moreover, minCount is only enforced during scheduling, meaning that + // modifications to this field do not affect already-scheduled pods, applying + // only to those evaluated in future cycles. + // + // +required + // +k8s:required + // +k8s:minimum=1 + MinCount int32 `json:"minCount" protobuf:"varint,1,opt,name=minCount"` +} + +// PodGroupResourceClaim references exactly one ResourceClaim, either directly +// or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim +// for the PodGroup. +// +// It adds a name to it that uniquely identifies the ResourceClaim inside the PodGroup. +// Pods that need access to the ResourceClaim define a matching reference in its +// own Spec.ResourceClaims. The Pod's claim must match all fields of the +// PodGroup's claim exactly. +type PodGroupResourceClaim struct { + // name uniquely identifies this resource claim inside the PodGroup. + // This must be a DNS_LABEL. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + + // resourceClaimName is the name of a ResourceClaim object in the same + // namespace as this PodGroup. The ResourceClaim will be reserved for the + // PodGroup instead of its individual pods. + // + // Exactly one of ResourceClaimName and ResourceClaimTemplateName must + // be set. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:format=k8s-long-name + ResourceClaimName *string `json:"resourceClaimName,omitempty" protobuf:"bytes,2,opt,name=resourceClaimName"` + + // resourceClaimTemplateName is the name of a ResourceClaimTemplate + // object in the same namespace as this PodGroup. + // + // The template will be used to create a new ResourceClaim, which will + // be bound to this PodGroup. When this PodGroup is deleted, the ResourceClaim + // will also be deleted. The PodGroup name and resource name, along with a + // generated component, will be used to form a unique name for the + // ResourceClaim, which will be recorded in podgroup.status.resourceClaimStatuses. + // + // This field is immutable and no changes will be made to the + // corresponding ResourceClaim by the control plane after creating the + // ResourceClaim. + // + // Exactly one of ResourceClaimName and ResourceClaimTemplateName must + // be set. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:format=k8s-long-name + ResourceClaimTemplateName *string `json:"resourceClaimTemplateName,omitempty" protobuf:"bytes,3,opt,name=resourceClaimTemplateName"` +} + +// DisruptionMode defines how individual entities within a group can be disrupted. +// Exactly one mode can be set. +// +// +union +type DisruptionMode struct { + // single specifies that children can be disrupted independently from each other. + // + // +optional + // +k8s:optional + // +k8s:unionMember + Single *SingleDisruptionMode `json:"single,omitempty" protobuf:"bytes,1,opt,name=single"` + + // all specifies that all children can only be disrupted together. + // + // +optional + // +k8s:optional + // +k8s:unionMember + All *AllDisruptionMode `json:"all,omitempty" protobuf:"bytes,2,opt,name=all"` +} + +// SingleDisruptionMode specifies that children can be disrupted independently. +type SingleDisruptionMode struct { + // Intentionally empty now. +} + +// AllDisruptionMode specifies that children can only be disrupted together. +type AllDisruptionMode struct { + // Intentionally empty now. +} + +// PreemptionPolicy describes a policy for if/when to preempt a pod. +// +enum +// +k8s:enum +type PreemptionPolicy string + +const ( + // PreemptLowerPriority means that pod can preempt other pods with lower priority. + PreemptLowerPriority PreemptionPolicy = "PreemptLowerPriority" + // PreemptNever means that pod never preempts other pods with lower priority. + PreemptNever PreemptionPolicy = "Never" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.37 +// +k8s:supportsSubresource="/status" + +// PodGroup represents a runtime instance of pods grouped together. +// PodGroups are created by workload controllers (Job, LWS, JobSet, etc...) from +// Workload.podGroupTemplates. +// PodGroup API enablement is toggled by the GenericWorkload feature gate. +type PodGroup struct { + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // spec defines the desired state of the PodGroup. + // + // +required + Spec PodGroupSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` + + // status represents the current observed state of the PodGroup. + // + // +optional + Status PodGroupStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.37 + +// PodGroupList contains a list of PodGroup resources. +type PodGroupList struct { + metav1.TypeMeta `json:""` + // Standard list metadata. + // + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Items is the list of PodGroups. + Items []PodGroup `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// PodGroupSpec defines the desired state of a PodGroup. +type PodGroupSpec struct { + // parentCompositePodGroupName contains the name of the parent composite pod group + // within the same namespace as this pod group. + // If it's nil, then this pod group is a root of a workload's hierarchy. + // This field is used only when the CompositePodGroup feature gate is enabled. + // This field is immutable. + // + // +featureGate=CompositePodGroup + // +optional + // +k8s:ifDisabled(CompositePodGroup)=+k8s:forbidden + // +k8s:ifEnabled(CompositePodGroup)=+k8s:optional + // +k8s:immutable + // +k8s:format=k8s-long-name + // +k8s:alpha(since: "1.37")=+k8s:dependentRequired("workloadRef") + ParentCompositePodGroupName *string `json:"parentCompositePodGroupName,omitempty" protobuf:"bytes,1,opt,name=parentCompositePodGroupName"` + + // workloadRef references an optional PodGroup template within the Workload + // object that was used to create the PodGroup. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + WorkloadRef *WorkloadReference `json:"workloadRef,omitempty" protobuf:"bytes,2,opt,name=workloadRef"` + + // schedulingPolicy defines the scheduling policy for this instance of the PodGroup. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // + // +required + SchedulingPolicy PodGroupSchedulingPolicy `json:"schedulingPolicy" protobuf:"bytes,3,opt,name=schedulingPolicy"` + + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroup. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // This field is immutable. + // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. + // + // +featureGate=TopologyAwareWorkloadScheduling + // +optional + // +k8s:ifDisabled(TopologyAwareWorkloadScheduling)=+k8s:forbidden + // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:optional + // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:immutable + SchedulingConstraints *PodGroupSchedulingConstraints `json:"schedulingConstraints,omitempty" protobuf:"bytes,4,opt,name=schedulingConstraints"` + + // resourceClaims defines which ResourceClaims may be shared among Pods in + // the group. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // + // This is a beta-level field and requires that the + // DRAWorkloadResourceClaims feature gate is enabled. + // + // This field is immutable. + // + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +k8s:immutable + // +featureGate=DRAWorkloadResourceClaims + ResourceClaims []PodGroupResourceClaim `json:"resourceClaims,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name" protobuf:"bytes,5,rep,name=resourceClaims"` + + // disruptionMode defines the mode in which a given PodGroup can be disrupted. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // One of Single, All. Defaults to Single if unset. + // This field is immutable. + // + // +default={"single": {}} + // +optional + // +k8s:optional + // +k8s:immutable + DisruptionMode *DisruptionMode `json:"disruptionMode,omitempty" protobuf:"bytes,6,opt,name=disruptionMode"` + + // priorityClassName defines the priority that should be considered when scheduling this pod group. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // Otherwise, it is validated and resolved similarly to the PriorityClassName on PodGroupTemplate + // (i.e. if no priority class is specified, admission control can set this to the global default + // priority class if it exists. Otherwise, the pod group's priority will be zero). + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + // +k8s:format=k8s-long-name + PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,7,opt,name=priorityClassName"` + + // priority is the value of priority of this pod group. Various system components + // use this field to find the priority of the pod group. When Priority Admission + // Controller is enabled, it prevents users from setting this field. The admission + // controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + // +k8s:maximum=1000000000 # HighestUserDefinablePriority + Priority *int32 `json:"priority,omitempty" protobuf:"varint,8,opt,name=priority"` + + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. + // When Priority Admission Controller is enabled, it populates this field from PriorityClassName, + // and defaults to PreemptLowerPriority if value is unset in PriorityClass. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + // + // +featureGate=PodGroupPreemptionPolicy + // +optional + // +k8s:immutable + // +k8s:ifDisabled("PodGroupPreemptionPolicy")=+k8s:forbidden + // +k8s:ifEnabled("PodGroupPreemptionPolicy")=+k8s:optional + PreemptionPolicy *PreemptionPolicy `json:"preemptionPolicy,omitempty" protobuf:"bytes,9,opt,name=preemptionPolicy"` +} + +// PodGroupStatus represents information about the status of a pod group. +type PodGroupStatus struct { + // conditions represent the latest observations of the PodGroup's state. + // + // Known condition types: + // - "PodGroupInitiallyScheduled": Indicates whether the scheduling requirement has been satisfied. + // Once this condition transitions to True, it serves as a terminal state and will never revert to False, + // even if pods are subsequently evicted and group constraints are no longer met. + // - "DisruptionTarget": Indicates whether the PodGroup is about to be terminated + // due to disruption such as preemption. + // + // Known reasons for the PodGroupInitiallyScheduled condition: + // - "Unschedulable": The PodGroup cannot be scheduled due to resource constraints, + // affinity/anti-affinity rules, or insufficient capacity for the gang. + // - "SchedulerError": The PodGroup cannot be scheduled due to some internal error + // that happened during scheduling, for example due to nodeAffinity parsing errors. + // + // Known reasons for the DisruptionTarget condition: + // - "PreemptionByScheduler": The PodGroup was preempted by the scheduler to make room for + // higher-priority PodGroups or Pods. + // + // +optional + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + + // resourceClaimStatuses is status of resource claims. + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +featureGate=DRAWorkloadResourceClaims + ResourceClaimStatuses []PodGroupResourceClaimStatus `json:"resourceClaimStatuses,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name" protobuf:"bytes,2,rep,name=resourceClaimStatuses"` +} + +// Well-known condition types for PodGroups. +const ( + // PodGroupInitiallyScheduled represents status of the scheduling process for this PodGroup till first success. + PodGroupInitiallyScheduled string = "PodGroupInitiallyScheduled" + // DisruptionTarget indicates the PodGroup is about to be terminated due to disruption + // such as preemption. + DisruptionTarget string = "DisruptionTarget" +) + +// Well-known condition reasons for PodGroups. +const ( + // Unschedulable reason in the PodGroupInitiallyScheduled condition indicates that the PodGroup cannot be scheduled + // due to resource constraints, affinity/anti-affinity rules, or insufficient capacity for the PodGroup. + PodGroupReasonUnschedulable string = "Unschedulable" + // SchedulerError reason in the PodGroupInitiallyScheduled condition means that some internal error happens + // during scheduling, for example due to nodeAffinity parsing errors. + PodGroupReasonSchedulerError string = "SchedulerError" + // PreemptionByScheduler reason in the DisruptionTarget condition indicates the PodGroup was preempted + // to make room for higher-priority PodGroups or Pods. + PodGroupReasonPreemptionByScheduler string = "PreemptionByScheduler" +) + +// PodGroupResourceClaimStatus is stored in the PodGroupStatus for each +// PodGroupResourceClaim which references a ResourceClaimTemplate. It stores the +// generated name for the corresponding ResourceClaim. +type PodGroupResourceClaimStatus struct { + // name uniquely identifies this resource claim inside the PodGroup. This + // must match the name of an entry in podgroup.spec.resourceClaims, which + // implies that the string must be a DNS_LABEL. + // + // +required + Name string `json:"name" protobuf:"bytes,1,name=name"` + + // resourceClaimName is the name of the ResourceClaim that was generated for + // the PodGroup in the namespace of the PodGroup. If this is unset, then + // generating a ResourceClaim was not necessary. The + // podgroup.spec.resourceClaims entry can be ignored in this case. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + ResourceClaimName *string `json:"resourceClaimName,omitempty" protobuf:"bytes,2,opt,name=resourceClaimName"` +} + +// WorkloadReference references the Workload object together with the template +// that was used to create a particular PodGroup. +type WorkloadReference struct { + // workloadName is the name of the Workload object that contains a template + // that was used when creating a pod group. It must + // be a DNS name. + // This field is required. + // + // +required + // +k8s:required + // +k8s:format=k8s-long-name + WorkloadName string `json:"workloadName" protobuf:"bytes,1,opt,name=workloadName"` + + // templateName is the name of a template within the Workload object that + // was used to create a pod group. It must be a DNS label. + // This field is required. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + TemplateName string `json:"templateName" protobuf:"bytes,2,opt,name=templateName"` +} + +// PodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a PodGroup. +type PodGroupSchedulingConstraints struct { + // topology defines the topology constraints for the pod group. + // Currently only a single topology constraint can be specified. This may change in the future. + // + // +optional + // +k8s:optional + // +k8s:maxItems=1 + // +listType=atomic + // +k8s:listType=atomic + Topology []TopologyConstraint `json:"topology,omitempty" protobuf:"bytes,1,rep,name=topology"` +} + +// TopologyConstraint defines a topology constraint for a PodGroup. +type TopologyConstraint struct { + // key specifies the key of the node label representing the topology domain. + // All pods within the PodGroup must be colocated within the same domain instance. + // Different PodGroups can land on different domain instances even if they derive from the same PodGroupTemplate. + // Examples: "topology.kubernetes.io/rack" + // + // +required + // +k8s:required + // +k8s:format=k8s-label-key + Key string `json:"key" protobuf:"bytes,1,opt,name=key"` +} + +// CompositePodGroupSchedulingPolicy defines the scheduling configuration for a CompositePodGroup. +// Exactly one policy must be set. +// +// +union +type CompositePodGroupSchedulingPolicy struct { + // basic specifies that the groups of this composite group should be scheduled independently. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + // +k8s:unionMember + Basic *CompositeBasicSchedulingPolicy `json:"basic,omitempty" protobuf:"bytes,1,opt,name=basic"` + + // gang specifies that the groups of this composite group should be scheduled using + // all-or-nothing semantics. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:update=NoSet + // +k8s:update=NoUnset + Gang *CompositeGangSchedulingPolicy `json:"gang,omitempty" protobuf:"bytes,2,opt,name=gang"` +} + +// CompositeBasicSchedulingPolicy indicates that the groups belonging to the composite group +// should be scheduled independently. +type CompositeBasicSchedulingPolicy struct { + // This is intentionally empty. Its presence indicates that the basic group + // scheduling policy should be applied. In the future, new fields may appear, + // describing such constraints on a composite pod group level without "all or + // nothing" (gang) scheduling. +} + +// CompositeGangSchedulingPolicy indicates that the groups belonging to the composite group +// should be scheduled using all-or-nothing semantics. +type CompositeGangSchedulingPolicy struct { + // minGroupCount is the minimum number of child groups that must be schedulable + // or scheduled at the same time for the scheduler to admit the entire group. + // It must be a positive integer. + // + // +required + // +k8s:required + // +k8s:minimum=1 + MinGroupCount int32 `json:"minGroupCount" protobuf:"varint,1,req,name=minGroupCount"` +} + +// CompositeDisruptionMode defines how individual entities within a composite pod group can be disrupted. +// Exactly one mode must be set. +// +// +union +type CompositeDisruptionMode struct { + // single specifies that children groups can be disrupted independently from each other. + // + // +optional + // +k8s:optional + // +k8s:unionMember + Single *SingleCompositeDisruptionMode `json:"single,omitempty" protobuf:"bytes,1,opt,name=single"` + + // all specifies that all children groups can only be disrupted together. + // + // +optional + // +k8s:optional + // +k8s:unionMember + All *AllCompositeDisruptionMode `json:"all,omitempty" protobuf:"bytes,2,opt,name=all"` +} + +// SingleCompositeDisruptionMode means that individual children of a CompositePodGroup +// can be disrupted or preempted independently. +type SingleCompositeDisruptionMode struct { + // This is intentionally empty. +} + +// AllCompositeDisruptionMode means that children of a CompositePodGroup can only be +// disrupted or preempted together. +type AllCompositeDisruptionMode struct { + // This is intentionally empty. +} + +// CompositePodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a CompositePodGroup. +type CompositePodGroupSchedulingConstraints struct { + // topology defines the topology constraints for the composite pod group. + // Currently only a single topology constraint can be specified. This may change in the future. + // + // +optional + // +k8s:optional + // +k8s:maxItems=1 + // +listType=atomic + // +k8s:listType=atomic + Topology []TopologyConstraint `json:"topology,omitempty" protobuf:"bytes,1,rep,name=topology"` +} diff --git a/vendor/k8s.io/api/scheduling/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/scheduling/v1beta1/types_swagger_doc_generated.go index f42008eb91..e514c6950a 100644 --- a/vendor/k8s.io/api/scheduling/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/scheduling/v1beta1/types_swagger_doc_generated.go @@ -27,9 +27,219 @@ package v1beta1 // Those methods can be generated by using hack/update-codegen.sh // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. +var map_AllCompositeDisruptionMode = map[string]string{ + "": "AllCompositeDisruptionMode means that children of a CompositePodGroup can only be disrupted or preempted together.", +} + +func (AllCompositeDisruptionMode) SwaggerDoc() map[string]string { + return map_AllCompositeDisruptionMode +} + +var map_AllDisruptionMode = map[string]string{ + "": "AllDisruptionMode specifies that children can only be disrupted together.", +} + +func (AllDisruptionMode) SwaggerDoc() map[string]string { + return map_AllDisruptionMode +} + +var map_BasicSchedulingPolicy = map[string]string{ + "": "BasicSchedulingPolicy indicates that standard Kubernetes scheduling behavior should be used.", +} + +func (BasicSchedulingPolicy) SwaggerDoc() map[string]string { + return map_BasicSchedulingPolicy +} + +var map_CompositeBasicSchedulingPolicy = map[string]string{ + "": "CompositeBasicSchedulingPolicy indicates that the groups belonging to the composite group should be scheduled independently.", +} + +func (CompositeBasicSchedulingPolicy) SwaggerDoc() map[string]string { + return map_CompositeBasicSchedulingPolicy +} + +var map_CompositeDisruptionMode = map[string]string{ + "": "CompositeDisruptionMode defines how individual entities within a composite pod group can be disrupted. Exactly one mode must be set.", + "single": "single specifies that children groups can be disrupted independently from each other.", + "all": "all specifies that all children groups can only be disrupted together.", +} + +func (CompositeDisruptionMode) SwaggerDoc() map[string]string { + return map_CompositeDisruptionMode +} + +var map_CompositeGangSchedulingPolicy = map[string]string{ + "": "CompositeGangSchedulingPolicy indicates that the groups belonging to the composite group should be scheduled using all-or-nothing semantics.", + "minGroupCount": "minGroupCount is the minimum number of child groups that must be schedulable or scheduled at the same time for the scheduler to admit the entire group. It must be a positive integer.", +} + +func (CompositeGangSchedulingPolicy) SwaggerDoc() map[string]string { + return map_CompositeGangSchedulingPolicy +} + +var map_CompositePodGroupSchedulingConstraints = map[string]string{ + "": "CompositePodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a CompositePodGroup.", + "topology": "topology defines the topology constraints for the composite pod group. Currently only a single topology constraint can be specified. This may change in the future.", +} + +func (CompositePodGroupSchedulingConstraints) SwaggerDoc() map[string]string { + return map_CompositePodGroupSchedulingConstraints +} + +var map_CompositePodGroupSchedulingPolicy = map[string]string{ + "": "CompositePodGroupSchedulingPolicy defines the scheduling configuration for a CompositePodGroup. Exactly one policy must be set.", + "basic": "basic specifies that the groups of this composite group should be scheduled independently. This field is immutable.", + "gang": "gang specifies that the groups of this composite group should be scheduled using all-or-nothing semantics.", +} + +func (CompositePodGroupSchedulingPolicy) SwaggerDoc() map[string]string { + return map_CompositePodGroupSchedulingPolicy +} + +var map_CompositePodGroupTemplate = map[string]string{ + "": "CompositePodGroupTemplate represents a template for a CompositePodGroup with a scheduling policy.", + "name": "name is a unique identifier for the CompositePodGroupTemplate within the Workload. It must be a DNS label. This field is required.", + "schedulingPolicy": "schedulingPolicy defines the scheduling policy for this template.", + "schedulingConstraints": "schedulingConstraints defines optional scheduling constraints (e.g. topology) for this CompositePodGroupTemplate. This field is immutable.", + "disruptionMode": "disruptionMode defines the mode in which a given CompositePodGroup can be disrupted. One of Single, All. This field is immutable.", + "priorityClassName": "priorityClassName indicates the priority that should be considered when scheduling a composite pod group created from this template. If no priority class is specified, admission control can set this to the global default priority class if it exists. Otherwise, composite pod groups created from this template will have the priority set to zero. This field is immutable.", + "priority": "priority is the value of priority of composite pod groups created from this template. Various system components use this field to find the priority of the composite pod group. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority. This field is immutable.", + "preemptionPolicy": "preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. One of Never, PreemptLowerPriority. This field is immutable. This field is available only when the PodGroupPreemptionPolicy feature gate is enabled.", + "podGroupTemplates": "podGroupTemplates is the list of templates for children PodGroups. The maximum number of templates is 8. At least one entry in CompositePodGroupTemplates or PodGroupTemplates must be set.", + "compositePodGroupTemplates": "compositePodGroupTemplates is the list of templates for children CompositePodGroups. The maximum number of templates is 8. At least one entry in CompositePodGroupTemplates or PodGroupTemplates must be set.", +} + +func (CompositePodGroupTemplate) SwaggerDoc() map[string]string { + return map_CompositePodGroupTemplate +} + +var map_DisruptionMode = map[string]string{ + "": "DisruptionMode defines how individual entities within a group can be disrupted. Exactly one mode can be set.", + "single": "single specifies that children can be disrupted independently from each other.", + "all": "all specifies that all children can only be disrupted together.", +} + +func (DisruptionMode) SwaggerDoc() map[string]string { + return map_DisruptionMode +} + +var map_GangSchedulingPolicy = map[string]string{ + "": "GangSchedulingPolicy defines the parameters for gang scheduling.", + "minCount": "minCount is the minimum number of pods that must be schedulable or scheduled at the same time for the scheduler to admit the entire group. It must be a positive integer. This field is mutable to support workload scaling.\n\nNote that the scheduler operates on an eventually consistent model. Updates to minCount may not be immediately reflected in scheduling decisions due to propagation delays. If minCount is updated while a scheduling cycle is in progress for that group, the new value may not take effect until the next cycle. Moreover, minCount is only enforced during scheduling, meaning that modifications to this field do not affect already-scheduled pods, applying only to those evaluated in future cycles.", +} + +func (GangSchedulingPolicy) SwaggerDoc() map[string]string { + return map_GangSchedulingPolicy +} + +var map_PodGroup = map[string]string{ + "": "PodGroup represents a runtime instance of pods grouped together. PodGroups are created by workload controllers (Job, LWS, JobSet, etc...) from Workload.podGroupTemplates. PodGroup API enablement is toggled by the GenericWorkload feature gate.", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec defines the desired state of the PodGroup.", + "status": "status represents the current observed state of the PodGroup.", +} + +func (PodGroup) SwaggerDoc() map[string]string { + return map_PodGroup +} + +var map_PodGroupList = map[string]string{ + "": "PodGroupList contains a list of PodGroup resources.", + "metadata": "Standard list metadata.", + "items": "Items is the list of PodGroups.", +} + +func (PodGroupList) SwaggerDoc() map[string]string { + return map_PodGroupList +} + +var map_PodGroupResourceClaim = map[string]string{ + "": "PodGroupResourceClaim references exactly one ResourceClaim, either directly or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim for the PodGroup.\n\nIt adds a name to it that uniquely identifies the ResourceClaim inside the PodGroup. Pods that need access to the ResourceClaim define a matching reference in its own Spec.ResourceClaims. The Pod's claim must match all fields of the PodGroup's claim exactly.", + "name": "name uniquely identifies this resource claim inside the PodGroup. This must be a DNS_LABEL.", + "resourceClaimName": "resourceClaimName is the name of a ResourceClaim object in the same namespace as this PodGroup. The ResourceClaim will be reserved for the PodGroup instead of its individual pods.\n\nExactly one of ResourceClaimName and ResourceClaimTemplateName must be set.", + "resourceClaimTemplateName": "resourceClaimTemplateName is the name of a ResourceClaimTemplate object in the same namespace as this PodGroup.\n\nThe template will be used to create a new ResourceClaim, which will be bound to this PodGroup. When this PodGroup is deleted, the ResourceClaim will also be deleted. The PodGroup name and resource name, along with a generated component, will be used to form a unique name for the ResourceClaim, which will be recorded in podgroup.status.resourceClaimStatuses.\n\nThis field is immutable and no changes will be made to the corresponding ResourceClaim by the control plane after creating the ResourceClaim.\n\nExactly one of ResourceClaimName and ResourceClaimTemplateName must be set.", +} + +func (PodGroupResourceClaim) SwaggerDoc() map[string]string { + return map_PodGroupResourceClaim +} + +var map_PodGroupResourceClaimStatus = map[string]string{ + "": "PodGroupResourceClaimStatus is stored in the PodGroupStatus for each PodGroupResourceClaim which references a ResourceClaimTemplate. It stores the generated name for the corresponding ResourceClaim.", + "name": "name uniquely identifies this resource claim inside the PodGroup. This must match the name of an entry in podgroup.spec.resourceClaims, which implies that the string must be a DNS_LABEL.", + "resourceClaimName": "resourceClaimName is the name of the ResourceClaim that was generated for the PodGroup in the namespace of the PodGroup. If this is unset, then generating a ResourceClaim was not necessary. The podgroup.spec.resourceClaims entry can be ignored in this case.", +} + +func (PodGroupResourceClaimStatus) SwaggerDoc() map[string]string { + return map_PodGroupResourceClaimStatus +} + +var map_PodGroupSchedulingConstraints = map[string]string{ + "": "PodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a PodGroup.", + "topology": "topology defines the topology constraints for the pod group. Currently only a single topology constraint can be specified. This may change in the future.", +} + +func (PodGroupSchedulingConstraints) SwaggerDoc() map[string]string { + return map_PodGroupSchedulingConstraints +} + +var map_PodGroupSchedulingPolicy = map[string]string{ + "": "PodGroupSchedulingPolicy defines the scheduling configuration for a PodGroup. Exactly one policy must be set. The policy is chosen at creation time by setting either the Basic or Gang field. The PodGroup may not change policy after creation. Fields within chosen policy may be updated after creation when their individual fields allow it.", + "basic": "basic specifies that the pods in this group should be scheduled using standard Kubernetes scheduling behavior. Setting this field at group creation time opts this group to basic scheduling; this field cannot be changed afterward.", + "gang": "gang specifies that the pods in this group should be scheduled using all-or-nothing semantics. Setting this field at group creation time opts this group to gang scheduling; this field cannot be set or unset afterward. The minCount field within Gang scheduling policy remains mutable after group creation.", +} + +func (PodGroupSchedulingPolicy) SwaggerDoc() map[string]string { + return map_PodGroupSchedulingPolicy +} + +var map_PodGroupSpec = map[string]string{ + "": "PodGroupSpec defines the desired state of a PodGroup.", + "parentCompositePodGroupName": "parentCompositePodGroupName contains the name of the parent composite pod group within the same namespace as this pod group. If it's nil, then this pod group is a root of a workload's hierarchy. This field is used only when the CompositePodGroup feature gate is enabled. This field is immutable.", + "workloadRef": "workloadRef references an optional PodGroup template within the Workload object that was used to create the PodGroup. This field is immutable.", + "schedulingPolicy": "schedulingPolicy defines the scheduling policy for this instance of the PodGroup. Controllers are expected to fill this field by copying it from a PodGroupTemplate.", + "schedulingConstraints": "schedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroup. Controllers are expected to fill this field by copying it from a PodGroupTemplate. This field is immutable. This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled.", + "resourceClaims": "resourceClaims defines which ResourceClaims may be shared among Pods in the group. Pods consume the devices allocated to a PodGroup's claim by defining a claim in its own Spec.ResourceClaims that matches the PodGroup's claim exactly. The claim must have the same name and refer to the same ResourceClaim or ResourceClaimTemplate.\n\nThis is a beta-level field and requires that the DRAWorkloadResourceClaims feature gate is enabled.\n\nThis field is immutable.", + "disruptionMode": "disruptionMode defines the mode in which a given PodGroup can be disrupted. Controllers are expected to fill this field by copying it from a PodGroupTemplate. One of Single, All. Defaults to Single if unset. This field is immutable.", + "priorityClassName": "priorityClassName defines the priority that should be considered when scheduling this pod group. Controllers are expected to fill this field by copying it from a PodGroupTemplate. Otherwise, it is validated and resolved similarly to the PriorityClassName on PodGroupTemplate (i.e. if no priority class is specified, admission control can set this to the global default priority class if it exists. Otherwise, the pod group's priority will be zero). This field is immutable.", + "priority": "priority is the value of priority of this pod group. Various system components use this field to find the priority of the pod group. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority. This field is immutable.", + "preemptionPolicy": "preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. When Priority Admission Controller is enabled, it populates this field from PriorityClassName, and defaults to PreemptLowerPriority if value is unset in PriorityClass. This field is immutable. This field is available only when the PodGroupPreemptionPolicy feature gate is enabled.", +} + +func (PodGroupSpec) SwaggerDoc() map[string]string { + return map_PodGroupSpec +} + +var map_PodGroupStatus = map[string]string{ + "": "PodGroupStatus represents information about the status of a pod group.", + "conditions": "conditions represent the latest observations of the PodGroup's state.\n\nKnown condition types: - \"PodGroupInitiallyScheduled\": Indicates whether the scheduling requirement has been satisfied. Once this condition transitions to True, it serves as a terminal state and will never revert to False, even if pods are subsequently evicted and group constraints are no longer met. - \"DisruptionTarget\": Indicates whether the PodGroup is about to be terminated\n due to disruption such as preemption.\n\nKnown reasons for the PodGroupInitiallyScheduled condition: - \"Unschedulable\": The PodGroup cannot be scheduled due to resource constraints,\n affinity/anti-affinity rules, or insufficient capacity for the gang.\n- \"SchedulerError\": The PodGroup cannot be scheduled due to some internal error\n that happened during scheduling, for example due to nodeAffinity parsing errors.\n\nKnown reasons for the DisruptionTarget condition: - \"PreemptionByScheduler\": The PodGroup was preempted by the scheduler to make room for\n higher-priority PodGroups or Pods.", + "resourceClaimStatuses": "resourceClaimStatuses is status of resource claims.", +} + +func (PodGroupStatus) SwaggerDoc() map[string]string { + return map_PodGroupStatus +} + +var map_PodGroupTemplate = map[string]string{ + "": "PodGroupTemplate represents a template for a set of pods with a scheduling policy.", + "name": "name is a unique identifier for the PodGroupTemplate within the Workload. It must be a DNS label. This field is immutable.", + "schedulingPolicy": "schedulingPolicy defines the scheduling policy for this PodGroupTemplate.", + "schedulingConstraints": "schedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroupTemplate. This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. This field is immutable.", + "resourceClaims": "resourceClaims defines which ResourceClaims may be shared among Pods in the group. Pods consume the devices allocated to a PodGroup's claim by defining a claim in its own Spec.ResourceClaims that matches the PodGroup's claim exactly. The claim must have the same name and refer to the same ResourceClaim or ResourceClaimTemplate.\n\nThis is a beta-level field and requires that the DRAWorkloadResourceClaims feature gate is enabled.\n\nThis field is immutable.", + "disruptionMode": "disruptionMode defines the mode in which a given PodGroup can be disrupted. One of Single, All. This field is immutable.", + "priorityClassName": "priorityClassName indicates the priority that should be considered when scheduling a pod group created from this template. This field is immutable.", + "priority": "priority is the value of priority of pod groups created from this template. Various system components use this field to find the priority of the pod group. The higher the value, the higher the priority. This field is immutable.", + "preemptionPolicy": "preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. One of Never, PreemptLowerPriority. This field is immutable. This field is available only when the PodGroupPreemptionPolicy feature gate is enabled.", +} + +func (PodGroupTemplate) SwaggerDoc() map[string]string { + return map_PodGroupTemplate +} + var map_PriorityClass = map[string]string{ "": "DEPRECATED - This group version of PriorityClass is deprecated by scheduling.k8s.io/v1/PriorityClass. PriorityClass defines mapping from a priority class name to the priority integer value. The value can be any valid integer.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "value": "value represents the integer value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.", "globalDefault": "globalDefault specifies whether this PriorityClass should be considered as the default priority for pods that do not have any priority class. Only one PriorityClass can be marked as `globalDefault`. However, if more than one PriorityClasses exists with their `globalDefault` field set to true, the smallest value of such global default PriorityClasses will be used as the default priority.", "description": "description is an arbitrary string that usually provides guidelines on when this priority class should be used.", @@ -50,4 +260,81 @@ func (PriorityClassList) SwaggerDoc() map[string]string { return map_PriorityClassList } +var map_SingleCompositeDisruptionMode = map[string]string{ + "": "SingleCompositeDisruptionMode means that individual children of a CompositePodGroup can be disrupted or preempted independently.", +} + +func (SingleCompositeDisruptionMode) SwaggerDoc() map[string]string { + return map_SingleCompositeDisruptionMode +} + +var map_SingleDisruptionMode = map[string]string{ + "": "SingleDisruptionMode specifies that children can be disrupted independently.", +} + +func (SingleDisruptionMode) SwaggerDoc() map[string]string { + return map_SingleDisruptionMode +} + +var map_TopologyConstraint = map[string]string{ + "": "TopologyConstraint defines a topology constraint for a PodGroup.", + "key": "key specifies the key of the node label representing the topology domain. All pods within the PodGroup must be colocated within the same domain instance. Different PodGroups can land on different domain instances even if they derive from the same PodGroupTemplate. Examples: \"topology.kubernetes.io/rack\"", +} + +func (TopologyConstraint) SwaggerDoc() map[string]string { + return map_TopologyConstraint +} + +var map_TypedLocalObjectReference = map[string]string{ + "": "TypedLocalObjectReference allows to reference typed object inside the same namespace.", + "apiGroup": "apiGroup is the group for the resource being referenced. If apiGroup is empty, the specified Kind must be in the core API group. For any other third-party types, setting apiGroup is required. It must be a DNS subdomain.", + "kind": "kind is the type of resource being referenced. It must be a path segment name.", + "name": "name is the name of resource being referenced. It must be a path segment name.", +} + +func (TypedLocalObjectReference) SwaggerDoc() map[string]string { + return map_TypedLocalObjectReference +} + +var map_Workload = map[string]string{ + "": "Workload allows for expressing scheduling constraints that should be used when managing the lifecycle of workloads from the scheduling perspective, including scheduling, preemption, eviction and other phases. Workload API enablement is toggled by the GenericWorkload feature gate.", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec defines the desired behavior of a Workload.", +} + +func (Workload) SwaggerDoc() map[string]string { + return map_Workload +} + +var map_WorkloadList = map[string]string{ + "": "WorkloadList contains a list of Workload resources.", + "metadata": "metadata is the standard list metadata.", + "items": "items is the list of Workloads.", +} + +func (WorkloadList) SwaggerDoc() map[string]string { + return map_WorkloadList +} + +var map_WorkloadReference = map[string]string{ + "": "WorkloadReference references the Workload object together with the template that was used to create a particular PodGroup.", + "workloadName": "workloadName is the name of the Workload object that contains a template that was used when creating a pod group. It must be a DNS name. This field is required.", + "templateName": "templateName is the name of a template within the Workload object that was used to create a pod group. It must be a DNS label. This field is required.", +} + +func (WorkloadReference) SwaggerDoc() map[string]string { + return map_WorkloadReference +} + +var map_WorkloadSpec = map[string]string{ + "": "WorkloadSpec defines the desired state of a Workload.", + "controllerRef": "controllerRef is an optional reference to the controlling object, such as a Deployment or Job. This field is intended for use by tools like CLIs to provide a link back to the original workload definition. This field is immutable.", + "podGroupTemplates": "podGroupTemplates is the list of templates that make up the Workload. The maximum number of templates is 8. Templates cannot be added or removed after the workload is created. Existing templates may still be updated where their individual fields allow it. Exactly one of CompositePodGroupTemplates and PodGroupTemplates must be set.", + "compositePodGroupTemplates": "compositePodGroupTemplates is the list of CompositePodGroup templates that make up the Workload. The maximum number of templates is 8. This field is immutable. Exactly one of CompositePodGroupTemplates and PodGroupTemplates must be set.\n\nThis field is used only when the CompositePodGroup feature gate is enabled.", +} + +func (WorkloadSpec) SwaggerDoc() map[string]string { + return map_WorkloadSpec +} + // AUTO-GENERATED FUNCTIONS END HERE diff --git a/vendor/k8s.io/api/scheduling/v1beta1/zz_generated.deepcopy.go b/vendor/k8s.io/api/scheduling/v1beta1/zz_generated.deepcopy.go index ff38c9854f..aacc643ad0 100644 --- a/vendor/k8s.io/api/scheduling/v1beta1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/scheduling/v1beta1/zz_generated.deepcopy.go @@ -22,10 +22,540 @@ limitations under the License. package v1beta1 import ( - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AllCompositeDisruptionMode) DeepCopyInto(out *AllCompositeDisruptionMode) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AllCompositeDisruptionMode. +func (in *AllCompositeDisruptionMode) DeepCopy() *AllCompositeDisruptionMode { + if in == nil { + return nil + } + out := new(AllCompositeDisruptionMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AllDisruptionMode) DeepCopyInto(out *AllDisruptionMode) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AllDisruptionMode. +func (in *AllDisruptionMode) DeepCopy() *AllDisruptionMode { + if in == nil { + return nil + } + out := new(AllDisruptionMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BasicSchedulingPolicy) DeepCopyInto(out *BasicSchedulingPolicy) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BasicSchedulingPolicy. +func (in *BasicSchedulingPolicy) DeepCopy() *BasicSchedulingPolicy { + if in == nil { + return nil + } + out := new(BasicSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CompositeBasicSchedulingPolicy) DeepCopyInto(out *CompositeBasicSchedulingPolicy) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositeBasicSchedulingPolicy. +func (in *CompositeBasicSchedulingPolicy) DeepCopy() *CompositeBasicSchedulingPolicy { + if in == nil { + return nil + } + out := new(CompositeBasicSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CompositeDisruptionMode) DeepCopyInto(out *CompositeDisruptionMode) { + *out = *in + if in.Single != nil { + in, out := &in.Single, &out.Single + *out = new(SingleCompositeDisruptionMode) + **out = **in + } + if in.All != nil { + in, out := &in.All, &out.All + *out = new(AllCompositeDisruptionMode) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositeDisruptionMode. +func (in *CompositeDisruptionMode) DeepCopy() *CompositeDisruptionMode { + if in == nil { + return nil + } + out := new(CompositeDisruptionMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CompositeGangSchedulingPolicy) DeepCopyInto(out *CompositeGangSchedulingPolicy) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositeGangSchedulingPolicy. +func (in *CompositeGangSchedulingPolicy) DeepCopy() *CompositeGangSchedulingPolicy { + if in == nil { + return nil + } + out := new(CompositeGangSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CompositePodGroupSchedulingConstraints) DeepCopyInto(out *CompositePodGroupSchedulingConstraints) { + *out = *in + if in.Topology != nil { + in, out := &in.Topology, &out.Topology + *out = make([]TopologyConstraint, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositePodGroupSchedulingConstraints. +func (in *CompositePodGroupSchedulingConstraints) DeepCopy() *CompositePodGroupSchedulingConstraints { + if in == nil { + return nil + } + out := new(CompositePodGroupSchedulingConstraints) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CompositePodGroupSchedulingPolicy) DeepCopyInto(out *CompositePodGroupSchedulingPolicy) { + *out = *in + if in.Basic != nil { + in, out := &in.Basic, &out.Basic + *out = new(CompositeBasicSchedulingPolicy) + **out = **in + } + if in.Gang != nil { + in, out := &in.Gang, &out.Gang + *out = new(CompositeGangSchedulingPolicy) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositePodGroupSchedulingPolicy. +func (in *CompositePodGroupSchedulingPolicy) DeepCopy() *CompositePodGroupSchedulingPolicy { + if in == nil { + return nil + } + out := new(CompositePodGroupSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CompositePodGroupTemplate) DeepCopyInto(out *CompositePodGroupTemplate) { + *out = *in + in.SchedulingPolicy.DeepCopyInto(&out.SchedulingPolicy) + if in.SchedulingConstraints != nil { + in, out := &in.SchedulingConstraints, &out.SchedulingConstraints + *out = new(CompositePodGroupSchedulingConstraints) + (*in).DeepCopyInto(*out) + } + if in.DisruptionMode != nil { + in, out := &in.DisruptionMode, &out.DisruptionMode + *out = new(CompositeDisruptionMode) + (*in).DeepCopyInto(*out) + } + if in.Priority != nil { + in, out := &in.Priority, &out.Priority + *out = new(int32) + **out = **in + } + if in.PreemptionPolicy != nil { + in, out := &in.PreemptionPolicy, &out.PreemptionPolicy + *out = new(PreemptionPolicy) + **out = **in + } + if in.PodGroupTemplates != nil { + in, out := &in.PodGroupTemplates, &out.PodGroupTemplates + *out = make([]PodGroupTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.CompositePodGroupTemplates != nil { + in, out := &in.CompositePodGroupTemplates, &out.CompositePodGroupTemplates + *out = make([]CompositePodGroupTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositePodGroupTemplate. +func (in *CompositePodGroupTemplate) DeepCopy() *CompositePodGroupTemplate { + if in == nil { + return nil + } + out := new(CompositePodGroupTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DisruptionMode) DeepCopyInto(out *DisruptionMode) { + *out = *in + if in.Single != nil { + in, out := &in.Single, &out.Single + *out = new(SingleDisruptionMode) + **out = **in + } + if in.All != nil { + in, out := &in.All, &out.All + *out = new(AllDisruptionMode) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DisruptionMode. +func (in *DisruptionMode) DeepCopy() *DisruptionMode { + if in == nil { + return nil + } + out := new(DisruptionMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GangSchedulingPolicy) DeepCopyInto(out *GangSchedulingPolicy) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GangSchedulingPolicy. +func (in *GangSchedulingPolicy) DeepCopy() *GangSchedulingPolicy { + if in == nil { + return nil + } + out := new(GangSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroup) DeepCopyInto(out *PodGroup) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroup. +func (in *PodGroup) DeepCopy() *PodGroup { + if in == nil { + return nil + } + out := new(PodGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PodGroup) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupList) DeepCopyInto(out *PodGroupList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]PodGroup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupList. +func (in *PodGroupList) DeepCopy() *PodGroupList { + if in == nil { + return nil + } + out := new(PodGroupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PodGroupList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupResourceClaim) DeepCopyInto(out *PodGroupResourceClaim) { + *out = *in + if in.ResourceClaimName != nil { + in, out := &in.ResourceClaimName, &out.ResourceClaimName + *out = new(string) + **out = **in + } + if in.ResourceClaimTemplateName != nil { + in, out := &in.ResourceClaimTemplateName, &out.ResourceClaimTemplateName + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupResourceClaim. +func (in *PodGroupResourceClaim) DeepCopy() *PodGroupResourceClaim { + if in == nil { + return nil + } + out := new(PodGroupResourceClaim) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupResourceClaimStatus) DeepCopyInto(out *PodGroupResourceClaimStatus) { + *out = *in + if in.ResourceClaimName != nil { + in, out := &in.ResourceClaimName, &out.ResourceClaimName + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupResourceClaimStatus. +func (in *PodGroupResourceClaimStatus) DeepCopy() *PodGroupResourceClaimStatus { + if in == nil { + return nil + } + out := new(PodGroupResourceClaimStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupSchedulingConstraints) DeepCopyInto(out *PodGroupSchedulingConstraints) { + *out = *in + if in.Topology != nil { + in, out := &in.Topology, &out.Topology + *out = make([]TopologyConstraint, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupSchedulingConstraints. +func (in *PodGroupSchedulingConstraints) DeepCopy() *PodGroupSchedulingConstraints { + if in == nil { + return nil + } + out := new(PodGroupSchedulingConstraints) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupSchedulingPolicy) DeepCopyInto(out *PodGroupSchedulingPolicy) { + *out = *in + if in.Basic != nil { + in, out := &in.Basic, &out.Basic + *out = new(BasicSchedulingPolicy) + **out = **in + } + if in.Gang != nil { + in, out := &in.Gang, &out.Gang + *out = new(GangSchedulingPolicy) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupSchedulingPolicy. +func (in *PodGroupSchedulingPolicy) DeepCopy() *PodGroupSchedulingPolicy { + if in == nil { + return nil + } + out := new(PodGroupSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupSpec) DeepCopyInto(out *PodGroupSpec) { + *out = *in + if in.ParentCompositePodGroupName != nil { + in, out := &in.ParentCompositePodGroupName, &out.ParentCompositePodGroupName + *out = new(string) + **out = **in + } + if in.WorkloadRef != nil { + in, out := &in.WorkloadRef, &out.WorkloadRef + *out = new(WorkloadReference) + **out = **in + } + in.SchedulingPolicy.DeepCopyInto(&out.SchedulingPolicy) + if in.SchedulingConstraints != nil { + in, out := &in.SchedulingConstraints, &out.SchedulingConstraints + *out = new(PodGroupSchedulingConstraints) + (*in).DeepCopyInto(*out) + } + if in.ResourceClaims != nil { + in, out := &in.ResourceClaims, &out.ResourceClaims + *out = make([]PodGroupResourceClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DisruptionMode != nil { + in, out := &in.DisruptionMode, &out.DisruptionMode + *out = new(DisruptionMode) + (*in).DeepCopyInto(*out) + } + if in.Priority != nil { + in, out := &in.Priority, &out.Priority + *out = new(int32) + **out = **in + } + if in.PreemptionPolicy != nil { + in, out := &in.PreemptionPolicy, &out.PreemptionPolicy + *out = new(PreemptionPolicy) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupSpec. +func (in *PodGroupSpec) DeepCopy() *PodGroupSpec { + if in == nil { + return nil + } + out := new(PodGroupSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupStatus) DeepCopyInto(out *PodGroupStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ResourceClaimStatuses != nil { + in, out := &in.ResourceClaimStatuses, &out.ResourceClaimStatuses + *out = make([]PodGroupResourceClaimStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupStatus. +func (in *PodGroupStatus) DeepCopy() *PodGroupStatus { + if in == nil { + return nil + } + out := new(PodGroupStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupTemplate) DeepCopyInto(out *PodGroupTemplate) { + *out = *in + in.SchedulingPolicy.DeepCopyInto(&out.SchedulingPolicy) + if in.SchedulingConstraints != nil { + in, out := &in.SchedulingConstraints, &out.SchedulingConstraints + *out = new(PodGroupSchedulingConstraints) + (*in).DeepCopyInto(*out) + } + if in.ResourceClaims != nil { + in, out := &in.ResourceClaims, &out.ResourceClaims + *out = make([]PodGroupResourceClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DisruptionMode != nil { + in, out := &in.DisruptionMode, &out.DisruptionMode + *out = new(DisruptionMode) + (*in).DeepCopyInto(*out) + } + if in.Priority != nil { + in, out := &in.Priority, &out.Priority + *out = new(int32) + **out = **in + } + if in.PreemptionPolicy != nil { + in, out := &in.PreemptionPolicy, &out.PreemptionPolicy + *out = new(PreemptionPolicy) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupTemplate. +func (in *PodGroupTemplate) DeepCopy() *PodGroupTemplate { + if in == nil { + return nil + } + out := new(PodGroupTemplate) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PriorityClass) DeepCopyInto(out *PriorityClass) { *out = *in @@ -33,7 +563,7 @@ func (in *PriorityClass) DeepCopyInto(out *PriorityClass) { in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) if in.PreemptionPolicy != nil { in, out := &in.PreemptionPolicy, &out.PreemptionPolicy - *out = new(v1.PreemptionPolicy) + *out = new(corev1.PreemptionPolicy) **out = **in } return @@ -89,3 +619,178 @@ func (in *PriorityClassList) DeepCopyObject() runtime.Object { } return nil } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SingleCompositeDisruptionMode) DeepCopyInto(out *SingleCompositeDisruptionMode) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SingleCompositeDisruptionMode. +func (in *SingleCompositeDisruptionMode) DeepCopy() *SingleCompositeDisruptionMode { + if in == nil { + return nil + } + out := new(SingleCompositeDisruptionMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SingleDisruptionMode) DeepCopyInto(out *SingleDisruptionMode) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SingleDisruptionMode. +func (in *SingleDisruptionMode) DeepCopy() *SingleDisruptionMode { + if in == nil { + return nil + } + out := new(SingleDisruptionMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TopologyConstraint) DeepCopyInto(out *TopologyConstraint) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TopologyConstraint. +func (in *TopologyConstraint) DeepCopy() *TopologyConstraint { + if in == nil { + return nil + } + out := new(TopologyConstraint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TypedLocalObjectReference) DeepCopyInto(out *TypedLocalObjectReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TypedLocalObjectReference. +func (in *TypedLocalObjectReference) DeepCopy() *TypedLocalObjectReference { + if in == nil { + return nil + } + out := new(TypedLocalObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Workload) DeepCopyInto(out *Workload) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Workload. +func (in *Workload) DeepCopy() *Workload { + if in == nil { + return nil + } + out := new(Workload) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Workload) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadList) DeepCopyInto(out *WorkloadList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Workload, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadList. +func (in *WorkloadList) DeepCopy() *WorkloadList { + if in == nil { + return nil + } + out := new(WorkloadList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *WorkloadList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadReference) DeepCopyInto(out *WorkloadReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadReference. +func (in *WorkloadReference) DeepCopy() *WorkloadReference { + if in == nil { + return nil + } + out := new(WorkloadReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadSpec) DeepCopyInto(out *WorkloadSpec) { + *out = *in + if in.ControllerRef != nil { + in, out := &in.ControllerRef, &out.ControllerRef + *out = new(TypedLocalObjectReference) + **out = **in + } + if in.PodGroupTemplates != nil { + in, out := &in.PodGroupTemplates, &out.PodGroupTemplates + *out = make([]PodGroupTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.CompositePodGroupTemplates != nil { + in, out := &in.CompositePodGroupTemplates, &out.CompositePodGroupTemplates + *out = make([]CompositePodGroupTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadSpec. +func (in *WorkloadSpec) DeepCopy() *WorkloadSpec { + if in == nil { + return nil + } + out := new(WorkloadSpec) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/k8s.io/api/scheduling/v1beta1/zz_generated.model_name.go b/vendor/k8s.io/api/scheduling/v1beta1/zz_generated.model_name.go index 16f40100cc..be01a4c3eb 100644 --- a/vendor/k8s.io/api/scheduling/v1beta1/zz_generated.model_name.go +++ b/vendor/k8s.io/api/scheduling/v1beta1/zz_generated.model_name.go @@ -21,6 +21,106 @@ limitations under the License. package v1beta1 +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in AllCompositeDisruptionMode) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.AllCompositeDisruptionMode" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in AllDisruptionMode) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.AllDisruptionMode" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in BasicSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.BasicSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in CompositeBasicSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.CompositeBasicSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in CompositeDisruptionMode) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.CompositeDisruptionMode" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in CompositeGangSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.CompositeGangSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in CompositePodGroupSchedulingConstraints) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.CompositePodGroupSchedulingConstraints" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in CompositePodGroupSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.CompositePodGroupSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in CompositePodGroupTemplate) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.CompositePodGroupTemplate" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in DisruptionMode) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.DisruptionMode" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in GangSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.GangSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroup) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.PodGroup" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupList) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.PodGroupList" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupResourceClaim) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.PodGroupResourceClaim" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupResourceClaimStatus) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.PodGroupResourceClaimStatus" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupSchedulingConstraints) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.PodGroupSchedulingConstraints" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.PodGroupSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupSpec) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.PodGroupSpec" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupStatus) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.PodGroupStatus" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupTemplate) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.PodGroupTemplate" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in PriorityClass) OpenAPIModelName() string { return "io.k8s.api.scheduling.v1beta1.PriorityClass" @@ -30,3 +130,43 @@ func (in PriorityClass) OpenAPIModelName() string { func (in PriorityClassList) OpenAPIModelName() string { return "io.k8s.api.scheduling.v1beta1.PriorityClassList" } + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in SingleCompositeDisruptionMode) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.SingleCompositeDisruptionMode" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in SingleDisruptionMode) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.SingleDisruptionMode" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in TopologyConstraint) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.TopologyConstraint" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in TypedLocalObjectReference) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.TypedLocalObjectReference" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in Workload) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.Workload" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadList) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.WorkloadList" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadReference) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.WorkloadReference" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadSpec) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1beta1.WorkloadSpec" +} diff --git a/vendor/k8s.io/api/scheduling/v1beta1/zz_generated.prerelease-lifecycle.go b/vendor/k8s.io/api/scheduling/v1beta1/zz_generated.prerelease-lifecycle.go index 15aefb1085..25f1136129 100644 --- a/vendor/k8s.io/api/scheduling/v1beta1/zz_generated.prerelease-lifecycle.go +++ b/vendor/k8s.io/api/scheduling/v1beta1/zz_generated.prerelease-lifecycle.go @@ -25,6 +25,42 @@ import ( schema "k8s.io/apimachinery/pkg/runtime/schema" ) +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *PodGroup) APILifecycleIntroduced() (major, minor int) { + return 1, 37 +} + +// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. +func (in *PodGroup) APILifecycleDeprecated() (major, minor int) { + return 1, 40 +} + +// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. +func (in *PodGroup) APILifecycleRemoved() (major, minor int) { + return 1, 43 +} + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *PodGroupList) APILifecycleIntroduced() (major, minor int) { + return 1, 37 +} + +// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. +func (in *PodGroupList) APILifecycleDeprecated() (major, minor int) { + return 1, 40 +} + +// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. +func (in *PodGroupList) APILifecycleRemoved() (major, minor int) { + return 1, 43 +} + // APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. func (in *PriorityClass) APILifecycleIntroduced() (major, minor int) { @@ -72,3 +108,39 @@ func (in *PriorityClassList) APILifecycleReplacement() schema.GroupVersionKind { func (in *PriorityClassList) APILifecycleRemoved() (major, minor int) { return 1, 22 } + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *Workload) APILifecycleIntroduced() (major, minor int) { + return 1, 37 +} + +// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. +func (in *Workload) APILifecycleDeprecated() (major, minor int) { + return 1, 40 +} + +// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. +func (in *Workload) APILifecycleRemoved() (major, minor int) { + return 1, 43 +} + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *WorkloadList) APILifecycleIntroduced() (major, minor int) { + return 1, 37 +} + +// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. +func (in *WorkloadList) APILifecycleDeprecated() (major, minor int) { + return 1, 40 +} + +// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. +func (in *WorkloadList) APILifecycleRemoved() (major, minor int) { + return 1, 43 +} diff --git a/vendor/k8s.io/api/storage/v1/generated.pb.go b/vendor/k8s.io/api/storage/v1/generated.pb.go index 5fc7d55a5b..4a6e5222f2 100644 --- a/vendor/k8s.io/api/storage/v1/generated.pb.go +++ b/vendor/k8s.io/api/storage/v1/generated.pb.go @@ -49,6 +49,8 @@ func (m *CSINodeList) Reset() { *m = CSINodeList{} } func (m *CSINodeSpec) Reset() { *m = CSINodeSpec{} } +func (m *CSINodeStatus) Reset() { *m = CSINodeStatus{} } + func (m *CSIStorageCapacity) Reset() { *m = CSIStorageCapacity{} } func (m *CSIStorageCapacityList) Reset() { *m = CSIStorageCapacityList{} } @@ -57,6 +59,10 @@ func (m *StorageClass) Reset() { *m = StorageClass{} } func (m *StorageClassList) Reset() { *m = StorageClassList{} } +func (m *StorageHealth) Reset() { *m = StorageHealth{} } + +func (m *StorageHealthCondition) Reset() { *m = StorageHealthCondition{} } + func (m *TokenRequest) Reset() { *m = TokenRequest{} } func (m *VolumeAttachment) Reset() { *m = VolumeAttachment{} } @@ -315,6 +321,16 @@ func (m *CSINode) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a { size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -476,6 +492,43 @@ func (m *CSINodeSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *CSINodeStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CSINodeStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CSINodeStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.StorageHealth) > 0 { + for iNdEx := len(m.StorageHealth) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.StorageHealth[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *CSIStorageCapacity) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -753,6 +806,110 @@ func (m *StorageClassList) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *StorageHealth) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StorageHealth) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StorageHealth) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.HealthConditions) > 0 { + for iNdEx := len(m.HealthConditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.HealthConditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StorageHealthCondition) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StorageHealthCondition) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StorageHealthCondition) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.LastTransitionTime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + if m.VolumeMode != nil { + i -= len(*m.VolumeMode) + copy(dAtA[i:], *m.VolumeMode) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.VolumeMode))) + i-- + dAtA[i] = 0x2a + } + if m.AccessMode != nil { + i -= len(*m.AccessMode) + copy(dAtA[i:], *m.AccessMode) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.AccessMode))) + i-- + dAtA[i] = 0x22 + } + i -= len(m.Message) + copy(dAtA[i:], m.Message) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Message))) + i-- + dAtA[i] = 0x1a + i -= len(m.Reason) + copy(dAtA[i:], m.Reason) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Reason))) + i-- + dAtA[i] = 0x12 + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Status))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *TokenRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1330,6 +1487,8 @@ func (m *CSINode) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) l = m.Spec.Size() n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) return n } @@ -1388,6 +1547,21 @@ func (m *CSINodeSpec) Size() (n int) { return n } +func (m *CSINodeStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.StorageHealth) > 0 { + for _, e := range m.StorageHealth { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + func (m *CSIStorageCapacity) Size() (n int) { if m == nil { return 0 @@ -1491,6 +1665,48 @@ func (m *StorageClassList) Size() (n int) { return n } +func (m *StorageHealth) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if len(m.HealthConditions) > 0 { + for _, e := range m.HealthConditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *StorageHealthCondition) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Status) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Reason) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Message) + n += 1 + l + sovGenerated(uint64(l)) + if m.AccessMode != nil { + l = len(*m.AccessMode) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.VolumeMode != nil { + l = len(*m.VolumeMode) + n += 1 + l + sovGenerated(uint64(l)) + } + l = m.LastTransitionTime.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + func (m *TokenRequest) Size() (n int) { if m == nil { return 0 @@ -1726,6 +1942,7 @@ func (this *CSINode) String() string { s := strings.Join([]string{`&CSINode{`, `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "CSINodeSpec", "CSINodeSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "CSINodeStatus", "CSINodeStatus", 1), `&`, ``, 1) + `,`, `}`, }, "") return s @@ -1774,6 +1991,21 @@ func (this *CSINodeSpec) String() string { }, "") return s } +func (this *CSINodeStatus) String() string { + if this == nil { + return "nil" + } + repeatedStringForStorageHealth := "[]StorageHealth{" + for _, f := range this.StorageHealth { + repeatedStringForStorageHealth += strings.Replace(strings.Replace(f.String(), "StorageHealth", "StorageHealth", 1), `&`, ``, 1) + "," + } + repeatedStringForStorageHealth += "}" + s := strings.Join([]string{`&CSINodeStatus{`, + `StorageHealth:` + repeatedStringForStorageHealth + `,`, + `}`, + }, "") + return s +} func (this *CSIStorageCapacity) String() string { if this == nil { return "nil" @@ -1852,6 +2084,37 @@ func (this *StorageClassList) String() string { }, "") return s } +func (this *StorageHealth) String() string { + if this == nil { + return "nil" + } + repeatedStringForHealthConditions := "[]StorageHealthCondition{" + for _, f := range this.HealthConditions { + repeatedStringForHealthConditions += strings.Replace(strings.Replace(f.String(), "StorageHealthCondition", "StorageHealthCondition", 1), `&`, ``, 1) + "," + } + repeatedStringForHealthConditions += "}" + s := strings.Join([]string{`&StorageHealth{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `HealthConditions:` + repeatedStringForHealthConditions + `,`, + `}`, + }, "") + return s +} +func (this *StorageHealthCondition) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StorageHealthCondition{`, + `Status:` + fmt.Sprintf("%v", this.Status) + `,`, + `Reason:` + fmt.Sprintf("%v", this.Reason) + `,`, + `Message:` + fmt.Sprintf("%v", this.Message) + `,`, + `AccessMode:` + valueToStringGenerated(this.AccessMode) + `,`, + `VolumeMode:` + valueToStringGenerated(this.VolumeMode) + `,`, + `LastTransitionTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastTransitionTime), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} func (this *TokenRequest) String() string { if this == nil { return "nil" @@ -2649,6 +2912,39 @@ func (m *CSINode) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -3053,7 +3349,7 @@ func (m *CSINodeSpec) Unmarshal(dAtA []byte) error { } return nil } -func (m *CSIStorageCapacity) Unmarshal(dAtA []byte) error { +func (m *CSINodeStatus) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3076,15 +3372,15 @@ func (m *CSIStorageCapacity) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CSIStorageCapacity: wiretype end group for non-group") + return fmt.Errorf("proto: CSINodeStatus: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CSIStorageCapacity: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CSINodeStatus: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StorageHealth", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3111,30 +3407,114 @@ func (m *CSIStorageCapacity) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.StorageHealth = append(m.StorageHealth, StorageHealth{}) + if err := m.StorageHealth[len(m.StorageHealth)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeTopology", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err } - if msglen < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CSIStorageCapacity) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CSIStorageCapacity: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CSIStorageCapacity: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeTopology", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen @@ -3905,6 +4285,367 @@ func (m *StorageClassList) Unmarshal(dAtA []byte) error { } return nil } +func (m *StorageHealth) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StorageHealth: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StorageHealth: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HealthConditions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HealthConditions = append(m.HealthConditions, StorageHealthCondition{}) + if err := m.HealthConditions[len(m.HealthConditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StorageHealthCondition) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StorageHealthCondition: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StorageHealthCondition: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Status = StorageHealthStatusType(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Reason = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Message = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccessMode", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := k8s_io_api_core_v1.PersistentVolumeAccessMode(dAtA[iNdEx:postIndex]) + m.AccessMode = &s + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VolumeMode", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := k8s_io_api_core_v1.PersistentVolumeMode(dAtA[iNdEx:postIndex]) + m.VolumeMode = &s + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastTransitionTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LastTransitionTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *TokenRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/vendor/k8s.io/api/storage/v1/generated.proto b/vendor/k8s.io/api/storage/v1/generated.proto index d6bc969bb3..dc3855e235 100644 --- a/vendor/k8s.io/api/storage/v1/generated.proto +++ b/vendor/k8s.io/api/storage/v1/generated.proto @@ -36,7 +36,7 @@ option go_package = "k8s.io/api/storage/v1"; // Kubelet uses this object to determine whether pod information needs to be passed on mount. // CSIDriver objects are non-namespaced. message CSIDriver { - // Standard object metadata. + // metadata is the standard object metadata. // metadata.Name indicates the name of the CSI driver that this object // refers to; it MUST be the same name returned by the CSI GetPluginName() // call for that driver. @@ -124,6 +124,8 @@ message CSIDriverSpec { // // +optional // +listType=set + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:immutable repeated string volumeLifecycleModes = 3; // storageCapacity indicates that the CSI volume driver wants pod scheduling to consider the storage @@ -250,7 +252,7 @@ message CSIDriverSpec { // +optional optional bool serviceAccountTokenInSecrets = 10; - // PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod + // preventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod // scheduling if the CSI driver on the node is missing. // // Enabling this option will prevent the scheduler (or any other @@ -265,7 +267,7 @@ message CSIDriverSpec { // newly created node may be rejected by the scheduler because of missing CSI driver // information from the node. // - // This is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled. + // This is a beta feature and requires the VolumeLimitScaling feature gate to be enabled. // Default is "false". // +featureGate=VolumeLimitScaling // +optional @@ -282,12 +284,16 @@ message CSIDriverSpec { // enough that it doesn't create this object. // CSINode has an OwnerReference that points to the corresponding node object. message CSINode { - // Standard object's metadata. + // metadata is the standard object metadata. // metadata.name must be the Kubernetes node name. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec is the specification of CSINode optional CSINodeSpec spec = 2; + + // status contains health and status information for the node's storage. + // +optional + optional CSINodeStatus status = 3; } // CSINodeDriver holds information about the specification of one CSI driver installed on a node @@ -350,6 +356,18 @@ message CSINodeSpec { repeated CSINodeDriver drivers = 1; } +// CSINodeStatus contains health and status information for storage on a node. +message CSINodeStatus { + // storageHealth contains backend health reports for CSI drivers registered on the node. + // +optional + // +listType=map + // +listMapKey=name + // +patchMergeKey=name + // +patchStrategy=merge + // +featureGate=CSIVolumeHealth + repeated StorageHealth storageHealth = 1; +} + // CSIStorageCapacity stores the result of one CSI GetCapacity call. // For a given StorageClass, this describes the available capacity in a // particular topology segment. This can be used when considering where to @@ -375,7 +393,7 @@ message CSINodeSpec { // the scheduler assumes that capacity is insufficient and tries some other // node. message CSIStorageCapacity { - // Standard object's metadata. + // metadata is the standard object metadata. // The name has no particular meaning. It must be a DNS subdomain (dots allowed, 253 characters). // To ensure that there are no conflicts with other CSI drivers on the cluster, // the recommendation is to use csisc-, a generated name, or a reverse-domain name @@ -448,29 +466,29 @@ message CSIStorageCapacityList { // StorageClasses are non-namespaced; the name of the storage class // according to etcd is in ObjectMeta.Name. message StorageClass { - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // provisioner indicates the type of the provisioner. // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:immutable optional string provisioner = 2; // parameters holds the parameters for the provisioner that should // create volumes of this storage class. // +optional - // +k8s:alpha(since: "1.36")=+k8s:immutable - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:optional map parameters = 3; // reclaimPolicy controls the reclaimPolicy for dynamically provisioned PersistentVolumes of this storage class. // Defaults to Delete. // +optional - // +k8s:alpha(since: "1.36")=+k8s:immutable - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:optional optional string reclaimPolicy = 4; // mountOptions controls the mountOptions for dynamically provisioned PersistentVolumes of this storage class. @@ -488,8 +506,8 @@ message StorageClass { // provisioned and bound. When unset, VolumeBindingImmediate is used. // This field is only honored by servers that enable the VolumeScheduling feature. // +optional - // +k8s:alpha(since: "1.36")=+k8s:immutable - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:optional optional string volumeBindingMode = 7; // allowedTopologies restrict the node topologies where volumes can be dynamically provisioned. @@ -512,6 +530,50 @@ message StorageClassList { repeated StorageClass items = 2; } +// StorageHealth contains storage backend health reported by a CSI driver on a node. +message StorageHealth { + // name is the CSI driver name, matching CSINodeDriver.name. + // +required + optional string name = 1; + + // healthConditions are the adverse storage backend conditions reported by the CSI driver. + // At most 16 conditions may be reported. + // +optional + // +listType=atomic + repeated StorageHealthCondition healthConditions = 2; +} + +// StorageHealthCondition represents an adverse health condition reported +// by a CSI driver for its storage backend on a node. +message StorageHealthCondition { + // status is the health status category. + // One of "StorageUnreachable", "StorageDegraded". + // +required + optional string status = 1; + + // reason is a brief CamelCase machine-parseable reason. + // Maximum permitted length of a reason is 256 characters. + // +required + optional string reason = 2; + + // message is a human-readable description. + // +optional + // Maximum permitted length of a message is 1024 characters. + optional string message = 3; + + // accessMode is the access mode affected. Nil means all access modes are affected. + // +optional + optional string accessMode = 4; + + // volumeMode is the volume mode affected. Nil means both are affected. + // +optional + optional string volumeMode = 5; + + // lastTransitionTime is when this condition first appeared at its current state. + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 6; +} + // TokenRequest contains parameters of a service account token. message TokenRequest { // audience is the intended audience of the token in "TokenRequestSpec". @@ -530,14 +592,14 @@ message TokenRequest { // // VolumeAttachment objects are non-namespaced. message VolumeAttachment { - // Standard object metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec represents specification of the desired attach/detach volume behavior. // Populated by the Kubernetes system. - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:immutable // +required optional VolumeAttachmentSpec spec = 2; @@ -583,9 +645,9 @@ message VolumeAttachmentSpec { // attacher indicates the name of the volume driver that MUST handle this // request. This is the name returned by GetPluginName(). // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format="k8s-long-name-caseless" - // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format="k8s-long-name-caseless" + // +k8s:beta(since: "1.37")=+k8s:maxLength=63 optional string attacher = 1; // source represents the volume that should be attached. @@ -627,12 +689,12 @@ message VolumeAttachmentStatus { // defined by the CSI driver. The class can be specified during dynamic provisioning // of PersistentVolumeClaims, and changed in the PersistentVolumeClaim spec after provisioning. message VolumeAttributesClass { - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Name of the CSI driver + // driverName is the name of the CSI driver // This field is immutable. optional string driverName = 2; diff --git a/vendor/k8s.io/api/storage/v1/types.go b/vendor/k8s.io/api/storage/v1/types.go index c65ebed4ec..f5499b8106 100644 --- a/vendor/k8s.io/api/storage/v1/types.go +++ b/vendor/k8s.io/api/storage/v1/types.go @@ -33,31 +33,31 @@ import ( // StorageClasses are non-namespaced; the name of the storage class // according to etcd is in ObjectMeta.Name. type StorageClass struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // provisioner indicates the type of the provisioner. // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:immutable Provisioner string `json:"provisioner" protobuf:"bytes,2,opt,name=provisioner"` // parameters holds the parameters for the provisioner that should // create volumes of this storage class. // +optional - // +k8s:alpha(since: "1.36")=+k8s:immutable - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:optional Parameters map[string]string `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"` // reclaimPolicy controls the reclaimPolicy for dynamically provisioned PersistentVolumes of this storage class. // Defaults to Delete. // +optional - // +k8s:alpha(since: "1.36")=+k8s:immutable - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:optional ReclaimPolicy *v1.PersistentVolumeReclaimPolicy `json:"reclaimPolicy,omitempty" protobuf:"bytes,4,opt,name=reclaimPolicy,casttype=k8s.io/api/core/v1.PersistentVolumeReclaimPolicy"` // mountOptions controls the mountOptions for dynamically provisioned PersistentVolumes of this storage class. @@ -75,8 +75,8 @@ type StorageClass struct { // provisioned and bound. When unset, VolumeBindingImmediate is used. // This field is only honored by servers that enable the VolumeScheduling feature. // +optional - // +k8s:alpha(since: "1.36")=+k8s:immutable - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:optional VolumeBindingMode *VolumeBindingMode `json:"volumeBindingMode,omitempty" protobuf:"bytes,7,opt,name=volumeBindingMode"` // allowedTopologies restrict the node topologies where volumes can be dynamically provisioned. @@ -93,7 +93,7 @@ type StorageClass struct { // StorageClassList is a collection of storage classes. type StorageClassList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -131,16 +131,16 @@ const ( // // VolumeAttachment objects are non-namespaced. type VolumeAttachment struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec represents specification of the desired attach/detach volume behavior. // Populated by the Kubernetes system. - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:immutable // +required Spec VolumeAttachmentSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` @@ -156,7 +156,7 @@ type VolumeAttachment struct { // VolumeAttachmentList is a collection of VolumeAttachment objects. type VolumeAttachmentList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -172,9 +172,9 @@ type VolumeAttachmentSpec struct { // attacher indicates the name of the volume driver that MUST handle this // request. This is the name returned by GetPluginName(). // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format="k8s-long-name-caseless" - // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format="k8s-long-name-caseless" + // +k8s:beta(since: "1.37")=+k8s:maxLength=63 Attacher string `json:"attacher" protobuf:"bytes,1,opt,name=attacher"` // source represents the volume that should be attached. @@ -263,9 +263,9 @@ type VolumeError struct { // Kubelet uses this object to determine whether pod information needs to be passed on mount. // CSIDriver objects are non-namespaced. type CSIDriver struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object metadata. + // metadata is the standard object metadata. // metadata.Name indicates the name of the CSI driver that this object // refers to; it MUST be the same name returned by the CSI GetPluginName() // call for that driver. @@ -284,7 +284,7 @@ type CSIDriver struct { // CSIDriverList is a collection of CSIDriver objects. type CSIDriverList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -358,6 +358,8 @@ type CSIDriverSpec struct { // // +optional // +listType=set + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:immutable VolumeLifecycleModes []VolumeLifecycleMode `json:"volumeLifecycleModes,omitempty" protobuf:"bytes,3,opt,name=volumeLifecycleModes"` // storageCapacity indicates that the CSI volume driver wants pod scheduling to consider the storage @@ -484,7 +486,7 @@ type CSIDriverSpec struct { // +optional ServiceAccountTokenInSecrets *bool `json:"serviceAccountTokenInSecrets,omitempty" protobuf:"varint,10,opt,name=serviceAccountTokenInSecrets"` - // PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod + // preventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod // scheduling if the CSI driver on the node is missing. // // Enabling this option will prevent the scheduler (or any other @@ -499,7 +501,7 @@ type CSIDriverSpec struct { // newly created node may be rejected by the scheduler because of missing CSI driver // information from the node. // - // This is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled. + // This is a beta feature and requires the VolumeLimitScaling feature gate to be enabled. // Default is "false". // +featureGate=VolumeLimitScaling // +optional @@ -580,6 +582,7 @@ const ( // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.17 +// +k8s:supportsSubresource="/status" // CSINode holds information about all CSI drivers installed on a node. // CSI drivers do not need to create the CSINode object directly. As long as @@ -591,14 +594,18 @@ const ( // enough that it doesn't create this object. // CSINode has an OwnerReference that points to the corresponding node object. type CSINode struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object's metadata. + // metadata is the standard object metadata. // metadata.name must be the Kubernetes node name. metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec is the specification of CSINode Spec CSINodeSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` + + // status contains health and status information for the node's storage. + // +optional + Status CSINodeStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } // CSINodeSpec holds information about the specification of all CSI drivers installed on a node @@ -660,12 +667,73 @@ type VolumeNodeResources struct { Count *int32 `json:"count,omitempty" protobuf:"varint,1,opt,name=count"` } +// StorageHealthStatusType describes the health status category of a storage backend. +// +enum +type StorageHealthStatusType string + +const ( + // StorageUnreachable indicates the storage backend is unreachable. + StorageUnreachable StorageHealthStatusType = "StorageUnreachable" + // StorageDegraded indicates the storage backend is functioning with reduced capability. + StorageDegraded StorageHealthStatusType = "StorageDegraded" +) + +// StorageHealthCondition represents an adverse health condition reported +// by a CSI driver for its storage backend on a node. +type StorageHealthCondition struct { + // status is the health status category. + // One of "StorageUnreachable", "StorageDegraded". + // +required + Status StorageHealthStatusType `json:"status" protobuf:"bytes,1,opt,name=status,casttype=StorageHealthStatusType"` + // reason is a brief CamelCase machine-parseable reason. + // Maximum permitted length of a reason is 256 characters. + // +required + Reason string `json:"reason" protobuf:"bytes,2,opt,name=reason"` + // message is a human-readable description. + // +optional + // Maximum permitted length of a message is 1024 characters. + Message string `json:"message,omitempty" protobuf:"bytes,3,opt,name=message"` + // accessMode is the access mode affected. Nil means all access modes are affected. + // +optional + AccessMode *v1.PersistentVolumeAccessMode `json:"accessMode,omitempty" protobuf:"bytes,4,opt,name=accessMode,casttype=k8s.io/api/core/v1.PersistentVolumeAccessMode"` + // volumeMode is the volume mode affected. Nil means both are affected. + // +optional + VolumeMode *v1.PersistentVolumeMode `json:"volumeMode,omitempty" protobuf:"bytes,5,opt,name=volumeMode,casttype=k8s.io/api/core/v1.PersistentVolumeMode"` + // lastTransitionTime is when this condition first appeared at its current state. + // +optional + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,6,opt,name=lastTransitionTime"` +} + +// StorageHealth contains storage backend health reported by a CSI driver on a node. +type StorageHealth struct { + // name is the CSI driver name, matching CSINodeDriver.name. + // +required + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + // healthConditions are the adverse storage backend conditions reported by the CSI driver. + // At most 16 conditions may be reported. + // +optional + // +listType=atomic + HealthConditions []StorageHealthCondition `json:"healthConditions,omitempty" protobuf:"bytes,2,rep,name=healthConditions"` +} + +// CSINodeStatus contains health and status information for storage on a node. +type CSINodeStatus struct { + // storageHealth contains backend health reports for CSI drivers registered on the node. + // +optional + // +listType=map + // +listMapKey=name + // +patchMergeKey=name + // +patchStrategy=merge + // +featureGate=CSIVolumeHealth + StorageHealth []StorageHealth `json:"storageHealth,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,1,rep,name=storageHealth"` +} + // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.17 // CSINodeList is a collection of CSINode objects. type CSINodeList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -705,9 +773,9 @@ type CSINodeList struct { // the scheduler assumes that capacity is insufficient and tries some other // node. type CSIStorageCapacity struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object's metadata. + // metadata is the standard object metadata. // The name has no particular meaning. It must be a DNS subdomain (dots allowed, 253 characters). // To ensure that there are no conflicts with other CSI drivers on the cluster, // the recommendation is to use csisc-, a generated name, or a reverse-domain name @@ -768,7 +836,7 @@ type CSIStorageCapacity struct { // CSIStorageCapacityList is a collection of CSIStorageCapacity objects. type CSIStorageCapacityList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -788,14 +856,14 @@ type CSIStorageCapacityList struct { // defined by the CSI driver. The class can be specified during dynamic provisioning // of PersistentVolumeClaims, and changed in the PersistentVolumeClaim spec after provisioning. type VolumeAttributesClass struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Name of the CSI driver + // driverName is the name of the CSI driver // This field is immutable. DriverName string `json:"driverName" protobuf:"bytes,2,opt,name=driverName"` @@ -820,7 +888,7 @@ type VolumeAttributesClass struct { // VolumeAttributesClassList is a collection of VolumeAttributesClass objects. type VolumeAttributesClassList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata diff --git a/vendor/k8s.io/api/storage/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/storage/v1/types_swagger_doc_generated.go index 47a7e92492..62a910422f 100644 --- a/vendor/k8s.io/api/storage/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/storage/v1/types_swagger_doc_generated.go @@ -29,7 +29,7 @@ package v1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_CSIDriver = map[string]string{ "": "CSIDriver captures information about a Container Storage Interface (CSI) volume driver deployed on the cluster. Kubernetes attach detach controller uses this object to determine whether attach is required. Kubelet uses this object to determine whether pod information needs to be passed on mount. CSIDriver objects are non-namespaced.", - "metadata": "Standard object metadata. metadata.Name indicates the name of the CSI driver that this object refers to; it MUST be the same name returned by the CSI GetPluginName() call for that driver. The driver name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), dots (.), and alphanumerics between. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. metadata.Name indicates the name of the CSI driver that this object refers to; it MUST be the same name returned by the CSI GetPluginName() call for that driver. The driver name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), dots (.), and alphanumerics between. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec represents the specification of the CSI Driver.", } @@ -59,7 +59,7 @@ var map_CSIDriverSpec = map[string]string{ "seLinuxMount": "seLinuxMount specifies if the CSI driver supports \"-o context\" mount option.\n\nWhen \"true\", the CSI driver must ensure that all volumes provided by this CSI driver can be mounted separately with different `-o context` options. This is typical for storage backends that provide volumes as filesystems on block devices or as independent shared volumes. Kubernetes will call NodeStage / NodePublish with \"-o context=xyz\" mount option when mounting a ReadWriteOncePod volume used in Pod that has explicitly set SELinux context. In the future, it may be expanded to other volume AccessModes. In any case, Kubernetes will ensure that the volume is mounted only with a single SELinux context.\n\nWhen \"false\", Kubernetes won't pass any special SELinux mount options to the driver. This is typical for volumes that represent subdirectories of a bigger shared filesystem.\n\nDefault is \"false\".", "nodeAllocatableUpdatePeriodSeconds": "nodeAllocatableUpdatePeriodSeconds specifies the interval between periodic updates of the CSINode allocatable capacity for this driver. When set, both periodic updates and updates triggered by capacity-related failures are enabled. If not set, no updates occur (neither periodic nor upon detecting capacity-related failures), and the allocatable.count remains static. The minimum allowed value for this field is 10 seconds.\n\nThis feature requires the MutableCSINodeAllocatableCount feature gate to be enabled.\n\nThis field is mutable.", "serviceAccountTokenInSecrets": "serviceAccountTokenInSecrets is an opt-in for CSI drivers to indicate that service account tokens should be passed via the Secrets field in NodePublishVolumeRequest instead of the VolumeContext field. The CSI specification provides a dedicated Secrets field for sensitive information like tokens, which is the appropriate mechanism for handling credentials. This addresses security concerns where sensitive tokens were being logged as part of volume context.\n\nWhen \"true\", kubelet will pass the tokens only in the Secrets field with the key \"csi.storage.k8s.io/serviceAccount.tokens\". The CSI driver must be updated to read tokens from the Secrets field instead of VolumeContext.\n\nWhen \"false\" or not set, kubelet will pass the tokens in VolumeContext with the key \"csi.storage.k8s.io/serviceAccount.tokens\" (existing behavior). This maintains backward compatibility with existing CSI drivers.\n\nThis field can only be set when TokenRequests is configured. The API server will reject CSIDriver specs that set this field without TokenRequests.\n\nDefault behavior if unset is to pass tokens in the VolumeContext field.", - "preventPodSchedulingIfMissing": "PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod scheduling if the CSI driver on the node is missing.\n\nEnabling this option will prevent the scheduler (or any other component which embeds default scheduler such as cluster-autoscaler) from scheduling pods to nodes where CSI driver is not installed.\n\nFor components(such as cluster-autoscaler) that embed the scheduler and run pod placement simulations using scheduler plugins, they MUST be aware of CSI driver registration information via CSINode object. They must create simulated CSINode objects in addition to Node objects during scheduling simulation, otherwise if PreventPodSchedulingIfMissing is enabled globally for CSIDriver object, any newly created node may be rejected by the scheduler because of missing CSI driver information from the node.\n\nThis is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled. Default is \"false\".", + "preventPodSchedulingIfMissing": "preventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod scheduling if the CSI driver on the node is missing.\n\nEnabling this option will prevent the scheduler (or any other component which embeds default scheduler such as cluster-autoscaler) from scheduling pods to nodes where CSI driver is not installed.\n\nFor components(such as cluster-autoscaler) that embed the scheduler and run pod placement simulations using scheduler plugins, they MUST be aware of CSI driver registration information via CSINode object. They must create simulated CSINode objects in addition to Node objects during scheduling simulation, otherwise if PreventPodSchedulingIfMissing is enabled globally for CSIDriver object, any newly created node may be rejected by the scheduler because of missing CSI driver information from the node.\n\nThis is a beta feature and requires the VolumeLimitScaling feature gate to be enabled. Default is \"false\".", } func (CSIDriverSpec) SwaggerDoc() map[string]string { @@ -68,8 +68,9 @@ func (CSIDriverSpec) SwaggerDoc() map[string]string { var map_CSINode = map[string]string{ "": "CSINode holds information about all CSI drivers installed on a node. CSI drivers do not need to create the CSINode object directly. As long as they use the node-driver-registrar sidecar container, the kubelet will automatically populate the CSINode object for the CSI driver as part of kubelet plugin registration. CSINode has the same name as a node. If the object is missing, it means either there are no CSI Drivers available on the node, or the Kubelet version is low enough that it doesn't create this object. CSINode has an OwnerReference that points to the corresponding node object.", - "metadata": "Standard object's metadata. metadata.name must be the Kubernetes node name.", + "metadata": "metadata is the standard object metadata. metadata.name must be the Kubernetes node name.", "spec": "spec is the specification of CSINode", + "status": "status contains health and status information for the node's storage.", } func (CSINode) SwaggerDoc() map[string]string { @@ -107,9 +108,18 @@ func (CSINodeSpec) SwaggerDoc() map[string]string { return map_CSINodeSpec } +var map_CSINodeStatus = map[string]string{ + "": "CSINodeStatus contains health and status information for storage on a node.", + "storageHealth": "storageHealth contains backend health reports for CSI drivers registered on the node.", +} + +func (CSINodeStatus) SwaggerDoc() map[string]string { + return map_CSINodeStatus +} + var map_CSIStorageCapacity = map[string]string{ "": "CSIStorageCapacity stores the result of one CSI GetCapacity call. For a given StorageClass, this describes the available capacity in a particular topology segment. This can be used when considering where to instantiate new PersistentVolumes.\n\nFor example this can express things like: - StorageClass \"standard\" has \"1234 GiB\" available in \"topology.kubernetes.io/zone=us-east1\" - StorageClass \"localssd\" has \"10 GiB\" available in \"kubernetes.io/hostname=knode-abc123\"\n\nThe following three cases all imply that no capacity is available for a certain combination: - no object exists with suitable topology and storage class name - such an object exists, but the capacity is unset - such an object exists, but the capacity is zero\n\nThe producer of these objects can decide which approach is more suitable.\n\nThey are consumed by the kube-scheduler when a CSI driver opts into capacity-aware scheduling with CSIDriverSpec.StorageCapacity. The scheduler compares the MaximumVolumeSize against the requested size of pending volumes to filter out unsuitable nodes. If MaximumVolumeSize is unset, it falls back to a comparison against the less precise Capacity. If that is also unset, the scheduler assumes that capacity is insufficient and tries some other node.", - "metadata": "Standard object's metadata. The name has no particular meaning. It must be a DNS subdomain (dots allowed, 253 characters). To ensure that there are no conflicts with other CSI drivers on the cluster, the recommendation is to use csisc-, a generated name, or a reverse-domain name which ends with the unique CSI driver name.\n\nObjects are namespaced.\n\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. The name has no particular meaning. It must be a DNS subdomain (dots allowed, 253 characters). To ensure that there are no conflicts with other CSI drivers on the cluster, the recommendation is to use csisc-, a generated name, or a reverse-domain name which ends with the unique CSI driver name.\n\nObjects are namespaced.\n\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "nodeTopology": "nodeTopology defines which nodes have access to the storage for which capacity was reported. If not set, the storage is not accessible from any node in the cluster. If empty, the storage is accessible from all nodes. This field is immutable.", "storageClassName": "storageClassName represents the name of the StorageClass that the reported capacity applies to. It must meet the same requirements as the name of a StorageClass object (non-empty, DNS subdomain). If that object no longer exists, the CSIStorageCapacity object is obsolete and should be removed by its creator. This field is immutable.", "capacity": "capacity is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields.\n\nThe semantic is currently (CSI spec 1.2) defined as: The available capacity, in bytes, of the storage that can be used to provision volumes. If not set, that information is currently unavailable.", @@ -132,7 +142,7 @@ func (CSIStorageCapacityList) SwaggerDoc() map[string]string { var map_StorageClass = map[string]string{ "": "StorageClass describes the parameters for a class of storage for which PersistentVolumes can be dynamically provisioned.\n\nStorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "provisioner": "provisioner indicates the type of the provisioner.", "parameters": "parameters holds the parameters for the provisioner that should create volumes of this storage class.", "reclaimPolicy": "reclaimPolicy controls the reclaimPolicy for dynamically provisioned PersistentVolumes of this storage class. Defaults to Delete.", @@ -156,6 +166,30 @@ func (StorageClassList) SwaggerDoc() map[string]string { return map_StorageClassList } +var map_StorageHealth = map[string]string{ + "": "StorageHealth contains storage backend health reported by a CSI driver on a node.", + "name": "name is the CSI driver name, matching CSINodeDriver.name.", + "healthConditions": "healthConditions are the adverse storage backend conditions reported by the CSI driver. At most 16 conditions may be reported.", +} + +func (StorageHealth) SwaggerDoc() map[string]string { + return map_StorageHealth +} + +var map_StorageHealthCondition = map[string]string{ + "": "StorageHealthCondition represents an adverse health condition reported by a CSI driver for its storage backend on a node.", + "status": "status is the health status category. One of \"StorageUnreachable\", \"StorageDegraded\".", + "reason": "reason is a brief CamelCase machine-parseable reason. Maximum permitted length of a reason is 256 characters.", + "message": "message is a human-readable description. Maximum permitted length of a message is 1024 characters.", + "accessMode": "accessMode is the access mode affected. Nil means all access modes are affected.", + "volumeMode": "volumeMode is the volume mode affected. Nil means both are affected.", + "lastTransitionTime": "lastTransitionTime is when this condition first appeared at its current state.", +} + +func (StorageHealthCondition) SwaggerDoc() map[string]string { + return map_StorageHealthCondition +} + var map_TokenRequest = map[string]string{ "": "TokenRequest contains parameters of a service account token.", "audience": "audience is the intended audience of the token in \"TokenRequestSpec\". It will default to the audiences of kube apiserver.", @@ -168,7 +202,7 @@ func (TokenRequest) SwaggerDoc() map[string]string { var map_VolumeAttachment = map[string]string{ "": "VolumeAttachment captures the intent to attach or detach the specified volume to/from the specified node.\n\nVolumeAttachment objects are non-namespaced.", - "metadata": "Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec represents specification of the desired attach/detach volume behavior. Populated by the Kubernetes system.", "status": "status represents status of the VolumeAttachment request. Populated by the entity completing the attach or detach operation, i.e. the external-attacher.", } @@ -190,6 +224,7 @@ func (VolumeAttachmentList) SwaggerDoc() map[string]string { var map_VolumeAttachmentSource = map[string]string{ "": "VolumeAttachmentSource represents a volume that should be attached. Right now only PersistentVolumes can be attached via external attacher, in the future we may allow also inline volumes in pods. Exactly one member can be set.", "persistentVolumeName": "persistentVolumeName represents the name of the persistent volume to attach.", + "inlineVolumeSpec": "inlineVolumeSpec contains all the information necessary to attach a persistent volume defined by a pod's inline VolumeSource. This field is populated only for the CSIMigration feature. It contains translated fields from a pod's inline VolumeSource to a PersistentVolumeSpec. This field is beta-level and is only honored by servers that enabled the CSIMigration feature.", } func (VolumeAttachmentSource) SwaggerDoc() map[string]string { @@ -221,8 +256,8 @@ func (VolumeAttachmentStatus) SwaggerDoc() map[string]string { var map_VolumeAttributesClass = map[string]string{ "": "VolumeAttributesClass represents a specification of mutable volume attributes defined by the CSI driver. The class can be specified during dynamic provisioning of PersistentVolumeClaims, and changed in the PersistentVolumeClaim spec after provisioning.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "driverName": "Name of the CSI driver This field is immutable.", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "driverName": "driverName is the name of the CSI driver This field is immutable.", "parameters": "parameters hold volume attributes defined by the CSI driver. These values are opaque to the Kubernetes and are passed directly to the CSI driver. The underlying storage provider supports changing these attributes on an existing volume, however the parameters field itself is immutable. To invoke a volume update, a new VolumeAttributesClass should be created with new parameters, and the PersistentVolumeClaim should be updated to reference the new VolumeAttributesClass.\n\nThis field is required and must contain at least one key/value pair. The keys cannot be empty, and the maximum number of parameters is 512, with a cumulative max size of 256K. If the CSI driver rejects invalid parameters, the target PersistentVolumeClaim will be set to an \"Infeasible\" state in the modifyVolumeStatus field.", } diff --git a/vendor/k8s.io/api/storage/v1/zz_generated.deepcopy.go b/vendor/k8s.io/api/storage/v1/zz_generated.deepcopy.go index aa3ffd0686..1df3b47555 100644 --- a/vendor/k8s.io/api/storage/v1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/storage/v1/zz_generated.deepcopy.go @@ -166,6 +166,7 @@ func (in *CSINode) DeepCopyInto(out *CSINode) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) return } @@ -269,6 +270,29 @@ func (in *CSINodeSpec) DeepCopy() *CSINodeSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CSINodeStatus) DeepCopyInto(out *CSINodeStatus) { + *out = *in + if in.StorageHealth != nil { + in, out := &in.StorageHealth, &out.StorageHealth + *out = make([]StorageHealth, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CSINodeStatus. +func (in *CSINodeStatus) DeepCopy() *CSINodeStatus { + if in == nil { + return nil + } + out := new(CSINodeStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CSIStorageCapacity) DeepCopyInto(out *CSIStorageCapacity) { *out = *in @@ -436,6 +460,56 @@ func (in *StorageClassList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageHealth) DeepCopyInto(out *StorageHealth) { + *out = *in + if in.HealthConditions != nil { + in, out := &in.HealthConditions, &out.HealthConditions + *out = make([]StorageHealthCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageHealth. +func (in *StorageHealth) DeepCopy() *StorageHealth { + if in == nil { + return nil + } + out := new(StorageHealth) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageHealthCondition) DeepCopyInto(out *StorageHealthCondition) { + *out = *in + if in.AccessMode != nil { + in, out := &in.AccessMode, &out.AccessMode + *out = new(corev1.PersistentVolumeAccessMode) + **out = **in + } + if in.VolumeMode != nil { + in, out := &in.VolumeMode, &out.VolumeMode + *out = new(corev1.PersistentVolumeMode) + **out = **in + } + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageHealthCondition. +func (in *StorageHealthCondition) DeepCopy() *StorageHealthCondition { + if in == nil { + return nil + } + out := new(StorageHealthCondition) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TokenRequest) DeepCopyInto(out *TokenRequest) { *out = *in diff --git a/vendor/k8s.io/api/storage/v1/zz_generated.model_name.go b/vendor/k8s.io/api/storage/v1/zz_generated.model_name.go index 6ef6371006..4eaabcbc31 100644 --- a/vendor/k8s.io/api/storage/v1/zz_generated.model_name.go +++ b/vendor/k8s.io/api/storage/v1/zz_generated.model_name.go @@ -56,6 +56,11 @@ func (in CSINodeSpec) OpenAPIModelName() string { return "io.k8s.api.storage.v1.CSINodeSpec" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in CSINodeStatus) OpenAPIModelName() string { + return "io.k8s.api.storage.v1.CSINodeStatus" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in CSIStorageCapacity) OpenAPIModelName() string { return "io.k8s.api.storage.v1.CSIStorageCapacity" @@ -76,6 +81,16 @@ func (in StorageClassList) OpenAPIModelName() string { return "io.k8s.api.storage.v1.StorageClassList" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in StorageHealth) OpenAPIModelName() string { + return "io.k8s.api.storage.v1.StorageHealth" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in StorageHealthCondition) OpenAPIModelName() string { + return "io.k8s.api.storage.v1.StorageHealthCondition" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in TokenRequest) OpenAPIModelName() string { return "io.k8s.api.storage.v1.TokenRequest" diff --git a/vendor/k8s.io/api/storage/v1alpha1/generated.proto b/vendor/k8s.io/api/storage/v1alpha1/generated.proto index 837d011640..dae07a7010 100644 --- a/vendor/k8s.io/api/storage/v1alpha1/generated.proto +++ b/vendor/k8s.io/api/storage/v1alpha1/generated.proto @@ -55,7 +55,7 @@ option go_package = "k8s.io/api/storage/v1alpha1"; // the scheduler assumes that capacity is insufficient and tries some other // node. message CSIStorageCapacity { - // Standard object's metadata. The name has no particular meaning. It must be + // metadata is the standard object metadata. The name has no particular meaning. It must be // be a DNS subdomain (dots allowed, 253 characters). To ensure that // there are no conflicts with other CSI drivers on the cluster, the recommendation // is to use csisc-, a generated name, or a reverse-domain name which ends @@ -127,14 +127,14 @@ message CSIStorageCapacityList { // // VolumeAttachment objects are non-namespaced. message VolumeAttachment { - // Standard object metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec represents specification of the desired attach/detach volume behavior. // Populated by the Kubernetes system. - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:immutable // +required optional VolumeAttachmentSpec spec = 2; @@ -180,9 +180,9 @@ message VolumeAttachmentSpec { // attacher indicates the name of the volume driver that MUST handle this // request. This is the name returned by GetPluginName(). // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format="k8s-long-name-caseless" - // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format="k8s-long-name-caseless" + // +k8s:beta(since: "1.37")=+k8s:maxLength=63 optional string attacher = 1; // source represents the volume that should be attached. @@ -224,12 +224,12 @@ message VolumeAttachmentStatus { // defined by the CSI driver. The class can be specified during dynamic provisioning // of PersistentVolumeClaims, and changed in the PersistentVolumeClaim spec after provisioning. message VolumeAttributesClass { - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Name of the CSI driver + // driverName is the name of the CSI driver // This field is immutable. optional string driverName = 2; diff --git a/vendor/k8s.io/api/storage/v1alpha1/types.go b/vendor/k8s.io/api/storage/v1alpha1/types.go index 286ac42aaa..655dea1984 100644 --- a/vendor/k8s.io/api/storage/v1alpha1/types.go +++ b/vendor/k8s.io/api/storage/v1alpha1/types.go @@ -35,16 +35,16 @@ import ( // // VolumeAttachment objects are non-namespaced. type VolumeAttachment struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec represents specification of the desired attach/detach volume behavior. // Populated by the Kubernetes system. - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:immutable // +required Spec VolumeAttachmentSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` @@ -62,7 +62,7 @@ type VolumeAttachment struct { // VolumeAttachmentList is a collection of VolumeAttachment objects. type VolumeAttachmentList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -78,9 +78,9 @@ type VolumeAttachmentSpec struct { // attacher indicates the name of the volume driver that MUST handle this // request. This is the name returned by GetPluginName(). // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format="k8s-long-name-caseless" - // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format="k8s-long-name-caseless" + // +k8s:beta(since: "1.37")=+k8s:maxLength=63 Attacher string `json:"attacher" protobuf:"bytes,1,opt,name=attacher"` // source represents the volume that should be attached. @@ -189,9 +189,9 @@ type VolumeError struct { // the scheduler assumes that capacity is insufficient and tries some other // node. type CSIStorageCapacity struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object's metadata. The name has no particular meaning. It must be + // metadata is the standard object metadata. The name has no particular meaning. It must be // be a DNS subdomain (dots allowed, 253 characters). To ensure that // there are no conflicts with other CSI drivers on the cluster, the recommendation // is to use csisc-, a generated name, or a reverse-domain name which ends @@ -254,7 +254,7 @@ type CSIStorageCapacity struct { // CSIStorageCapacityList is a collection of CSIStorageCapacity objects. type CSIStorageCapacityList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -276,14 +276,14 @@ type CSIStorageCapacityList struct { // defined by the CSI driver. The class can be specified during dynamic provisioning // of PersistentVolumeClaims, and changed in the PersistentVolumeClaim spec after provisioning. type VolumeAttributesClass struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Name of the CSI driver + // driverName is the name of the CSI driver // This field is immutable. DriverName string `json:"driverName" protobuf:"bytes,2,opt,name=driverName"` @@ -310,7 +310,7 @@ type VolumeAttributesClass struct { // VolumeAttributesClassList is a collection of VolumeAttributesClass objects. type VolumeAttributesClassList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata diff --git a/vendor/k8s.io/api/storage/v1alpha1/types_swagger_doc_generated.go b/vendor/k8s.io/api/storage/v1alpha1/types_swagger_doc_generated.go index 713498b372..ff86ad26e8 100644 --- a/vendor/k8s.io/api/storage/v1alpha1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/storage/v1alpha1/types_swagger_doc_generated.go @@ -29,7 +29,7 @@ package v1alpha1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_CSIStorageCapacity = map[string]string{ "": "CSIStorageCapacity stores the result of one CSI GetCapacity call. For a given StorageClass, this describes the available capacity in a particular topology segment. This can be used when considering where to instantiate new PersistentVolumes.\n\nFor example this can express things like: - StorageClass \"standard\" has \"1234 GiB\" available in \"topology.kubernetes.io/zone=us-east1\" - StorageClass \"localssd\" has \"10 GiB\" available in \"kubernetes.io/hostname=knode-abc123\"\n\nThe following three cases all imply that no capacity is available for a certain combination: - no object exists with suitable topology and storage class name - such an object exists, but the capacity is unset - such an object exists, but the capacity is zero\n\nThe producer of these objects can decide which approach is more suitable.\n\nThey are consumed by the kube-scheduler when a CSI driver opts into capacity-aware scheduling with CSIDriverSpec.StorageCapacity. The scheduler compares the MaximumVolumeSize against the requested size of pending volumes to filter out unsuitable nodes. If MaximumVolumeSize is unset, it falls back to a comparison against the less precise Capacity. If that is also unset, the scheduler assumes that capacity is insufficient and tries some other node.", - "metadata": "Standard object's metadata. The name has no particular meaning. It must be be a DNS subdomain (dots allowed, 253 characters). To ensure that there are no conflicts with other CSI drivers on the cluster, the recommendation is to use csisc-, a generated name, or a reverse-domain name which ends with the unique CSI driver name.\n\nObjects are namespaced.\n\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. The name has no particular meaning. It must be be a DNS subdomain (dots allowed, 253 characters). To ensure that there are no conflicts with other CSI drivers on the cluster, the recommendation is to use csisc-, a generated name, or a reverse-domain name which ends with the unique CSI driver name.\n\nObjects are namespaced.\n\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "nodeTopology": "nodeTopology defines which nodes have access to the storage for which capacity was reported. If not set, the storage is not accessible from any node in the cluster. If empty, the storage is accessible from all nodes. This field is immutable.", "storageClassName": "storageClassName represents the name of the StorageClass that the reported capacity applies to. It must meet the same requirements as the name of a StorageClass object (non-empty, DNS subdomain). If that object no longer exists, the CSIStorageCapacity object is obsolete and should be removed by its creator. This field is immutable.", "capacity": "capacity is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields.\n\nThe semantic is currently (CSI spec 1.2) defined as: The available capacity, in bytes, of the storage that can be used to provision volumes. If not set, that information is currently unavailable.", @@ -52,7 +52,7 @@ func (CSIStorageCapacityList) SwaggerDoc() map[string]string { var map_VolumeAttachment = map[string]string{ "": "VolumeAttachment captures the intent to attach or detach the specified volume to/from the specified node.\n\nVolumeAttachment objects are non-namespaced.", - "metadata": "Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec represents specification of the desired attach/detach volume behavior. Populated by the Kubernetes system.", "status": "status represents status of the VolumeAttachment request. Populated by the entity completing the attach or detach operation, i.e. the external-attacher.", } @@ -74,6 +74,7 @@ func (VolumeAttachmentList) SwaggerDoc() map[string]string { var map_VolumeAttachmentSource = map[string]string{ "": "VolumeAttachmentSource represents a volume that should be attached. Right now only PersistentVolumes can be attached via external attacher, in the future we may allow also inline volumes in pods. Exactly one member can be set.", "persistentVolumeName": "persistentVolumeName represents the name of the persistent volume to attach.", + "inlineVolumeSpec": "inlineVolumeSpec contains all the information necessary to attach a persistent volume defined by a pod's inline VolumeSource. This field is populated only for the CSIMigration feature. It contains translated fields from a pod's inline VolumeSource to a PersistentVolumeSpec. This field is alpha-level and is only honored by servers that enabled the CSIMigration feature.", } func (VolumeAttachmentSource) SwaggerDoc() map[string]string { @@ -105,8 +106,8 @@ func (VolumeAttachmentStatus) SwaggerDoc() map[string]string { var map_VolumeAttributesClass = map[string]string{ "": "VolumeAttributesClass represents a specification of mutable volume attributes defined by the CSI driver. The class can be specified during dynamic provisioning of PersistentVolumeClaims, and changed in the PersistentVolumeClaim spec after provisioning.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "driverName": "Name of the CSI driver This field is immutable.", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "driverName": "driverName is the name of the CSI driver This field is immutable.", "parameters": "parameters hold volume attributes defined by the CSI driver. These values are opaque to the Kubernetes and are passed directly to the CSI driver. The underlying storage provider supports changing these attributes on an existing volume, however the parameters field itself is immutable. To invoke a volume update, a new VolumeAttributesClass should be created with new parameters, and the PersistentVolumeClaim should be updated to reference the new VolumeAttributesClass.\n\nThis field is required and must contain at least one key/value pair. The keys cannot be empty, and the maximum number of parameters is 512, with a cumulative max size of 256K. If the CSI driver rejects invalid parameters, the target PersistentVolumeClaim will be set to an \"Infeasible\" state in the modifyVolumeStatus field.", } diff --git a/vendor/k8s.io/api/storage/v1beta1/generated.pb.go b/vendor/k8s.io/api/storage/v1beta1/generated.pb.go index 7fd08783aa..dff4bae5e3 100644 --- a/vendor/k8s.io/api/storage/v1beta1/generated.pb.go +++ b/vendor/k8s.io/api/storage/v1beta1/generated.pb.go @@ -49,6 +49,8 @@ func (m *CSINodeList) Reset() { *m = CSINodeList{} } func (m *CSINodeSpec) Reset() { *m = CSINodeSpec{} } +func (m *CSINodeStatus) Reset() { *m = CSINodeStatus{} } + func (m *CSIStorageCapacity) Reset() { *m = CSIStorageCapacity{} } func (m *CSIStorageCapacityList) Reset() { *m = CSIStorageCapacityList{} } @@ -57,6 +59,10 @@ func (m *StorageClass) Reset() { *m = StorageClass{} } func (m *StorageClassList) Reset() { *m = StorageClassList{} } +func (m *StorageHealth) Reset() { *m = StorageHealth{} } + +func (m *StorageHealthCondition) Reset() { *m = StorageHealthCondition{} } + func (m *TokenRequest) Reset() { *m = TokenRequest{} } func (m *VolumeAttachment) Reset() { *m = VolumeAttachment{} } @@ -315,6 +321,16 @@ func (m *CSINode) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a { size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -476,6 +492,43 @@ func (m *CSINodeSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *CSINodeStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CSINodeStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CSINodeStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.StorageHealth) > 0 { + for iNdEx := len(m.StorageHealth) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.StorageHealth[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *CSIStorageCapacity) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -753,6 +806,110 @@ func (m *StorageClassList) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *StorageHealth) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StorageHealth) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StorageHealth) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.HealthConditions) > 0 { + for iNdEx := len(m.HealthConditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.HealthConditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StorageHealthCondition) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StorageHealthCondition) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StorageHealthCondition) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.LastTransitionTime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + if m.VolumeMode != nil { + i -= len(*m.VolumeMode) + copy(dAtA[i:], *m.VolumeMode) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.VolumeMode))) + i-- + dAtA[i] = 0x2a + } + if m.AccessMode != nil { + i -= len(*m.AccessMode) + copy(dAtA[i:], *m.AccessMode) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.AccessMode))) + i-- + dAtA[i] = 0x22 + } + i -= len(m.Message) + copy(dAtA[i:], m.Message) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Message))) + i-- + dAtA[i] = 0x1a + i -= len(m.Reason) + copy(dAtA[i:], m.Reason) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Reason))) + i-- + dAtA[i] = 0x12 + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Status))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *TokenRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1330,6 +1487,8 @@ func (m *CSINode) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) l = m.Spec.Size() n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) return n } @@ -1388,6 +1547,21 @@ func (m *CSINodeSpec) Size() (n int) { return n } +func (m *CSINodeStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.StorageHealth) > 0 { + for _, e := range m.StorageHealth { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + func (m *CSIStorageCapacity) Size() (n int) { if m == nil { return 0 @@ -1491,6 +1665,48 @@ func (m *StorageClassList) Size() (n int) { return n } +func (m *StorageHealth) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if len(m.HealthConditions) > 0 { + for _, e := range m.HealthConditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *StorageHealthCondition) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Status) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Reason) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Message) + n += 1 + l + sovGenerated(uint64(l)) + if m.AccessMode != nil { + l = len(*m.AccessMode) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.VolumeMode != nil { + l = len(*m.VolumeMode) + n += 1 + l + sovGenerated(uint64(l)) + } + l = m.LastTransitionTime.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + func (m *TokenRequest) Size() (n int) { if m == nil { return 0 @@ -1726,6 +1942,7 @@ func (this *CSINode) String() string { s := strings.Join([]string{`&CSINode{`, `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "CSINodeSpec", "CSINodeSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "CSINodeStatus", "CSINodeStatus", 1), `&`, ``, 1) + `,`, `}`, }, "") return s @@ -1774,6 +1991,21 @@ func (this *CSINodeSpec) String() string { }, "") return s } +func (this *CSINodeStatus) String() string { + if this == nil { + return "nil" + } + repeatedStringForStorageHealth := "[]StorageHealth{" + for _, f := range this.StorageHealth { + repeatedStringForStorageHealth += strings.Replace(strings.Replace(f.String(), "StorageHealth", "StorageHealth", 1), `&`, ``, 1) + "," + } + repeatedStringForStorageHealth += "}" + s := strings.Join([]string{`&CSINodeStatus{`, + `StorageHealth:` + repeatedStringForStorageHealth + `,`, + `}`, + }, "") + return s +} func (this *CSIStorageCapacity) String() string { if this == nil { return "nil" @@ -1852,6 +2084,37 @@ func (this *StorageClassList) String() string { }, "") return s } +func (this *StorageHealth) String() string { + if this == nil { + return "nil" + } + repeatedStringForHealthConditions := "[]StorageHealthCondition{" + for _, f := range this.HealthConditions { + repeatedStringForHealthConditions += strings.Replace(strings.Replace(f.String(), "StorageHealthCondition", "StorageHealthCondition", 1), `&`, ``, 1) + "," + } + repeatedStringForHealthConditions += "}" + s := strings.Join([]string{`&StorageHealth{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `HealthConditions:` + repeatedStringForHealthConditions + `,`, + `}`, + }, "") + return s +} +func (this *StorageHealthCondition) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StorageHealthCondition{`, + `Status:` + fmt.Sprintf("%v", this.Status) + `,`, + `Reason:` + fmt.Sprintf("%v", this.Reason) + `,`, + `Message:` + fmt.Sprintf("%v", this.Message) + `,`, + `AccessMode:` + valueToStringGenerated(this.AccessMode) + `,`, + `VolumeMode:` + valueToStringGenerated(this.VolumeMode) + `,`, + `LastTransitionTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastTransitionTime), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} func (this *TokenRequest) String() string { if this == nil { return "nil" @@ -2649,6 +2912,39 @@ func (m *CSINode) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -3053,7 +3349,7 @@ func (m *CSINodeSpec) Unmarshal(dAtA []byte) error { } return nil } -func (m *CSIStorageCapacity) Unmarshal(dAtA []byte) error { +func (m *CSINodeStatus) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3076,15 +3372,15 @@ func (m *CSIStorageCapacity) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CSIStorageCapacity: wiretype end group for non-group") + return fmt.Errorf("proto: CSINodeStatus: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CSIStorageCapacity: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CSINodeStatus: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StorageHealth", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3111,30 +3407,114 @@ func (m *CSIStorageCapacity) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.StorageHealth = append(m.StorageHealth, StorageHealth{}) + if err := m.StorageHealth[len(m.StorageHealth)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeTopology", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err } - if msglen < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CSIStorageCapacity) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CSIStorageCapacity: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CSIStorageCapacity: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeTopology", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen @@ -3905,6 +4285,367 @@ func (m *StorageClassList) Unmarshal(dAtA []byte) error { } return nil } +func (m *StorageHealth) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StorageHealth: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StorageHealth: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HealthConditions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HealthConditions = append(m.HealthConditions, StorageHealthCondition{}) + if err := m.HealthConditions[len(m.HealthConditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StorageHealthCondition) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StorageHealthCondition: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StorageHealthCondition: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Status = StorageHealthStatusType(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Reason = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Message = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccessMode", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := k8s_io_api_core_v1.PersistentVolumeAccessMode(dAtA[iNdEx:postIndex]) + m.AccessMode = &s + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VolumeMode", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := k8s_io_api_core_v1.PersistentVolumeMode(dAtA[iNdEx:postIndex]) + m.VolumeMode = &s + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastTransitionTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LastTransitionTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *TokenRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/vendor/k8s.io/api/storage/v1beta1/generated.proto b/vendor/k8s.io/api/storage/v1beta1/generated.proto index 3cae755fb4..6c85957063 100644 --- a/vendor/k8s.io/api/storage/v1beta1/generated.proto +++ b/vendor/k8s.io/api/storage/v1beta1/generated.proto @@ -39,7 +39,7 @@ option go_package = "k8s.io/api/storage/v1beta1"; // Kubelet uses this object to determine whether pod information needs to be passed on mount. // CSIDriver objects are non-namespaced. message CSIDriver { - // Standard object metadata. + // metadata is the standard object metadata. // metadata.Name indicates the name of the CSI driver that this object // refers to; it MUST be the same name returned by the CSI GetPluginName() // call for that driver. @@ -127,6 +127,8 @@ message CSIDriverSpec { // // +optional // +listType=atomic + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:immutable repeated string volumeLifecycleModes = 3; // storageCapacity indicates that the CSI volume driver wants pod scheduling to consider the storage @@ -252,7 +254,7 @@ message CSIDriverSpec { // +optional optional bool serviceAccountTokenInSecrets = 10; - // PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod + // preventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod // scheduling if the CSI driver on the node is missing. // // Enabling this option will prevent the scheduler (or any other @@ -267,7 +269,7 @@ message CSIDriverSpec { // newly created node may be rejected by the scheduler because of missing CSI driver // information from the node. // - // This is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled. + // This is a beta feature and requires the VolumeLimitScaling feature gate to be enabled. // Default is "false". // +featureGate=VolumeLimitScaling // +optional @@ -286,11 +288,16 @@ message CSIDriverSpec { // enough that it doesn't create this object. // CSINode has an OwnerReference that points to the corresponding node object. message CSINode { + // metadata is the standard object metadata. // metadata.name must be the Kubernetes node name. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec is the specification of CSINode optional CSINodeSpec spec = 2; + + // status contains health and status information for the node's storage. + // +optional + optional CSINodeStatus status = 3; } // CSINodeDriver holds information about the specification of one CSI driver installed on a node @@ -352,6 +359,18 @@ message CSINodeSpec { repeated CSINodeDriver drivers = 1; } +// CSINodeStatus contains health and status information for storage on a node. +message CSINodeStatus { + // storageHealth contains backend health reports for CSI drivers registered on the node. + // +optional + // +listType=map + // +listMapKey=name + // +patchMergeKey=name + // +patchStrategy=merge + // +featureGate=CSIVolumeHealth + repeated StorageHealth storageHealth = 1; +} + // CSIStorageCapacity stores the result of one CSI GetCapacity call. // For a given StorageClass, this describes the available capacity in a // particular topology segment. This can be used when considering where to @@ -377,7 +396,7 @@ message CSINodeSpec { // the scheduler assumes that capacity is insufficient and tries some other // node. message CSIStorageCapacity { - // Standard object's metadata. The name has no particular meaning. It must be + // metadata is the standard object metadata. The name has no particular meaning. It must be // be a DNS subdomain (dots allowed, 253 characters). To ensure that // there are no conflicts with other CSI drivers on the cluster, the recommendation // is to use csisc-, a generated name, or a reverse-domain name which ends @@ -450,29 +469,29 @@ message CSIStorageCapacityList { // StorageClasses are non-namespaced; the name of the storage class // according to etcd is in ObjectMeta.Name. message StorageClass { - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // provisioner indicates the type of the provisioner. // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:immutable optional string provisioner = 2; // parameters holds the parameters for the provisioner that should // create volumes of this storage class. // +optional - // +k8s:alpha(since: "1.36")=+k8s:immutable - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:optional map parameters = 3; // reclaimPolicy controls the reclaimPolicy for dynamically provisioned PersistentVolumes of this storage class. // Defaults to Delete. // +optional - // +k8s:alpha(since: "1.36")=+k8s:immutable - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:optional optional string reclaimPolicy = 4; // mountOptions controls the mountOptions for dynamically provisioned PersistentVolumes of this storage class. @@ -490,8 +509,8 @@ message StorageClass { // provisioned and bound. When unset, VolumeBindingImmediate is used. // This field is only honored by servers that enable the VolumeScheduling feature. // +optional - // +k8s:alpha(since: "1.36")=+k8s:immutable - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:optional optional string volumeBindingMode = 7; // allowedTopologies restrict the node topologies where volumes can be dynamically provisioned. @@ -514,6 +533,50 @@ message StorageClassList { repeated StorageClass items = 2; } +// StorageHealth contains storage backend health reported by a CSI driver on a node. +message StorageHealth { + // name is the CSI driver name, matching CSINodeDriver.name. + // +required + optional string name = 1; + + // healthConditions are the adverse storage backend conditions reported by the CSI driver. + // At most 16 conditions may be reported. + // +optional + // +listType=atomic + repeated StorageHealthCondition healthConditions = 2; +} + +// StorageHealthCondition represents an adverse health condition reported +// by a CSI driver for its storage backend on a node. +message StorageHealthCondition { + // status is the health status category. + // One of "StorageUnreachable", "StorageDegraded". + // +required + optional string status = 1; + + // reason is a brief CamelCase machine-parseable reason. + // +required + // Maximum permitted length of a reason is 256 characters. + optional string reason = 2; + + // message is a human-readable description. + // +optional + // Maximum permitted length of a message is 1024 characters. + optional string message = 3; + + // accessMode is the access mode affected. Nil means all access modes are affected. + // +optional + optional string accessMode = 4; + + // volumeMode is the volume mode affected. Nil means both are affected. + // +optional + optional string volumeMode = 5; + + // lastTransitionTime is when this condition first appeared at its current state. + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 6; +} + // TokenRequest contains parameters of a service account token. message TokenRequest { // audience is the intended audience of the token in "TokenRequestSpec". @@ -532,14 +595,14 @@ message TokenRequest { // // VolumeAttachment objects are non-namespaced. message VolumeAttachment { - // Standard object metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec represents specification of the desired attach/detach volume behavior. // Populated by the Kubernetes system. - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:immutable // +required optional VolumeAttachmentSpec spec = 2; @@ -585,9 +648,9 @@ message VolumeAttachmentSpec { // attacher indicates the name of the volume driver that MUST handle this // request. This is the name returned by GetPluginName(). // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format="k8s-long-name-caseless" - // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format="k8s-long-name-caseless" + // +k8s:beta(since: "1.37")=+k8s:maxLength=63 optional string attacher = 1; // source represents the volume that should be attached. @@ -629,12 +692,12 @@ message VolumeAttachmentStatus { // defined by the CSI driver. The class can be specified during dynamic provisioning // of PersistentVolumeClaims, and changed in the PersistentVolumeClaim spec after provisioning. message VolumeAttributesClass { - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Name of the CSI driver + // driverName is the name of the CSI driver // This field is immutable. optional string driverName = 2; diff --git a/vendor/k8s.io/api/storage/v1beta1/types.go b/vendor/k8s.io/api/storage/v1beta1/types.go index 0c33e218e7..3a05ad4b36 100644 --- a/vendor/k8s.io/api/storage/v1beta1/types.go +++ b/vendor/k8s.io/api/storage/v1beta1/types.go @@ -35,31 +35,31 @@ import ( // StorageClasses are non-namespaced; the name of the storage class // according to etcd is in ObjectMeta.Name. type StorageClass struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // provisioner indicates the type of the provisioner. // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:immutable Provisioner string `json:"provisioner" protobuf:"bytes,2,opt,name=provisioner"` // parameters holds the parameters for the provisioner that should // create volumes of this storage class. // +optional - // +k8s:alpha(since: "1.36")=+k8s:immutable - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:optional Parameters map[string]string `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"` // reclaimPolicy controls the reclaimPolicy for dynamically provisioned PersistentVolumes of this storage class. // Defaults to Delete. // +optional - // +k8s:alpha(since: "1.36")=+k8s:immutable - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:optional ReclaimPolicy *v1.PersistentVolumeReclaimPolicy `json:"reclaimPolicy,omitempty" protobuf:"bytes,4,opt,name=reclaimPolicy,casttype=k8s.io/api/core/v1.PersistentVolumeReclaimPolicy"` // mountOptions controls the mountOptions for dynamically provisioned PersistentVolumes of this storage class. @@ -77,8 +77,8 @@ type StorageClass struct { // provisioned and bound. When unset, VolumeBindingImmediate is used. // This field is only honored by servers that enable the VolumeScheduling feature. // +optional - // +k8s:alpha(since: "1.36")=+k8s:immutable - // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:beta(since: "1.37")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:optional VolumeBindingMode *VolumeBindingMode `json:"volumeBindingMode,omitempty" protobuf:"bytes,7,opt,name=volumeBindingMode"` // allowedTopologies restrict the node topologies where volumes can be dynamically provisioned. @@ -97,7 +97,7 @@ type StorageClass struct { // StorageClassList is a collection of storage classes. type StorageClassList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -136,16 +136,16 @@ const ( // // VolumeAttachment objects are non-namespaced. type VolumeAttachment struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec represents specification of the desired attach/detach volume behavior. // Populated by the Kubernetes system. - // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:beta(since: "1.37")=+k8s:immutable // +required Spec VolumeAttachmentSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` @@ -163,7 +163,7 @@ type VolumeAttachment struct { // VolumeAttachmentList is a collection of VolumeAttachment objects. type VolumeAttachmentList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -179,9 +179,9 @@ type VolumeAttachmentSpec struct { // attacher indicates the name of the volume driver that MUST handle this // request. This is the name returned by GetPluginName(). // +required - // +k8s:alpha(since: "1.36")=+k8s:required - // +k8s:alpha(since: "1.36")=+k8s:format="k8s-long-name-caseless" - // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 + // +k8s:beta(since: "1.37")=+k8s:required + // +k8s:beta(since: "1.37")=+k8s:format="k8s-long-name-caseless" + // +k8s:beta(since: "1.37")=+k8s:maxLength=63 Attacher string `json:"attacher" protobuf:"bytes,1,opt,name=attacher"` // source represents the volume that should be attached. @@ -275,9 +275,9 @@ type VolumeError struct { // Kubelet uses this object to determine whether pod information needs to be passed on mount. // CSIDriver objects are non-namespaced. type CSIDriver struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object metadata. + // metadata is the standard object metadata. // metadata.Name indicates the name of the CSI driver that this object // refers to; it MUST be the same name returned by the CSI GetPluginName() // call for that driver. @@ -298,7 +298,7 @@ type CSIDriver struct { // CSIDriverList is a collection of CSIDriver objects. type CSIDriverList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -372,6 +372,8 @@ type CSIDriverSpec struct { // // +optional // +listType=atomic + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:immutable VolumeLifecycleModes []VolumeLifecycleMode `json:"volumeLifecycleModes,omitempty" protobuf:"bytes,3,opt,name=volumeLifecycleModes"` // storageCapacity indicates that the CSI volume driver wants pod scheduling to consider the storage @@ -497,7 +499,7 @@ type CSIDriverSpec struct { // +optional ServiceAccountTokenInSecrets *bool `json:"serviceAccountTokenInSecrets,omitempty" protobuf:"varint,10,opt,name=serviceAccountTokenInSecrets"` - // PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod + // preventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod // scheduling if the CSI driver on the node is missing. // // Enabling this option will prevent the scheduler (or any other @@ -512,7 +514,7 @@ type CSIDriverSpec struct { // newly created node may be rejected by the scheduler because of missing CSI driver // information from the node. // - // This is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled. + // This is a beta feature and requires the VolumeLimitScaling feature gate to be enabled. // Default is "false". // +featureGate=VolumeLimitScaling // +optional @@ -591,6 +593,7 @@ const ( // +k8s:prerelease-lifecycle-gen:deprecated=1.17 // +k8s:prerelease-lifecycle-gen:removed=1.22 // +k8s:prerelease-lifecycle-gen:replacement=storage.k8s.io,v1,CSINode +// +k8s:supportsSubresource="/status" // DEPRECATED - This group version of CSINode is deprecated by storage/v1/CSINode. // See the release notes for more information. @@ -604,13 +607,18 @@ const ( // enough that it doesn't create this object. // CSINode has an OwnerReference that points to the corresponding node object. type CSINode struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` + // metadata is the standard object metadata. // metadata.name must be the Kubernetes node name. metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec is the specification of CSINode Spec CSINodeSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` + + // status contains health and status information for the node's storage. + // +optional + Status CSINodeStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } // CSINodeSpec holds information about the specification of all CSI drivers installed on a node @@ -671,6 +679,67 @@ type VolumeNodeResources struct { Count *int32 `json:"count,omitempty" protobuf:"varint,1,opt,name=count"` } +// StorageHealthStatusType describes the health status category of a storage backend. +// +enum +type StorageHealthStatusType string + +const ( + // StorageUnreachable indicates the storage backend is unreachable. + StorageUnreachable StorageHealthStatusType = "StorageUnreachable" + // StorageDegraded indicates the storage backend is functioning with reduced capability. + StorageDegraded StorageHealthStatusType = "StorageDegraded" +) + +// StorageHealthCondition represents an adverse health condition reported +// by a CSI driver for its storage backend on a node. +type StorageHealthCondition struct { + // status is the health status category. + // One of "StorageUnreachable", "StorageDegraded". + // +required + Status StorageHealthStatusType `json:"status" protobuf:"bytes,1,opt,name=status,casttype=StorageHealthStatusType"` + // reason is a brief CamelCase machine-parseable reason. + // +required + // Maximum permitted length of a reason is 256 characters. + Reason string `json:"reason" protobuf:"bytes,2,opt,name=reason"` + // message is a human-readable description. + // +optional + // Maximum permitted length of a message is 1024 characters. + Message string `json:"message,omitempty" protobuf:"bytes,3,opt,name=message"` + // accessMode is the access mode affected. Nil means all access modes are affected. + // +optional + AccessMode *v1.PersistentVolumeAccessMode `json:"accessMode,omitempty" protobuf:"bytes,4,opt,name=accessMode,casttype=k8s.io/api/core/v1.PersistentVolumeAccessMode"` + // volumeMode is the volume mode affected. Nil means both are affected. + // +optional + VolumeMode *v1.PersistentVolumeMode `json:"volumeMode,omitempty" protobuf:"bytes,5,opt,name=volumeMode,casttype=k8s.io/api/core/v1.PersistentVolumeMode"` + // lastTransitionTime is when this condition first appeared at its current state. + // +optional + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,6,opt,name=lastTransitionTime"` +} + +// StorageHealth contains storage backend health reported by a CSI driver on a node. +type StorageHealth struct { + // name is the CSI driver name, matching CSINodeDriver.name. + // +required + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + // healthConditions are the adverse storage backend conditions reported by the CSI driver. + // At most 16 conditions may be reported. + // +optional + // +listType=atomic + HealthConditions []StorageHealthCondition `json:"healthConditions,omitempty" protobuf:"bytes,2,rep,name=healthConditions"` +} + +// CSINodeStatus contains health and status information for storage on a node. +type CSINodeStatus struct { + // storageHealth contains backend health reports for CSI drivers registered on the node. + // +optional + // +listType=map + // +listMapKey=name + // +patchMergeKey=name + // +patchStrategy=merge + // +featureGate=CSIVolumeHealth + StorageHealth []StorageHealth `json:"storageHealth,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,1,rep,name=storageHealth"` +} + // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.14 // +k8s:prerelease-lifecycle-gen:deprecated=1.17 @@ -679,7 +748,7 @@ type VolumeNodeResources struct { // CSINodeList is a collection of CSINode objects. type CSINodeList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -721,9 +790,9 @@ type CSINodeList struct { // the scheduler assumes that capacity is insufficient and tries some other // node. type CSIStorageCapacity struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object's metadata. The name has no particular meaning. It must be + // metadata is the standard object metadata. The name has no particular meaning. It must be // be a DNS subdomain (dots allowed, 253 characters). To ensure that // there are no conflicts with other CSI drivers on the cluster, the recommendation // is to use csisc-, a generated name, or a reverse-domain name which ends @@ -786,7 +855,7 @@ type CSIStorageCapacity struct { // CSIStorageCapacityList is a collection of CSIStorageCapacity objects. type CSIStorageCapacityList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -808,14 +877,14 @@ type CSIStorageCapacityList struct { // defined by the CSI driver. The class can be specified during dynamic provisioning // of PersistentVolumeClaims, and changed in the PersistentVolumeClaim spec after provisioning. type VolumeAttributesClass struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` - // Standard object's metadata. + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Name of the CSI driver + // driverName is the name of the CSI driver // This field is immutable. DriverName string `json:"driverName" protobuf:"bytes,2,opt,name=driverName"` @@ -842,7 +911,7 @@ type VolumeAttributesClass struct { // VolumeAttributesClassList is a collection of VolumeAttributesClass objects. type VolumeAttributesClassList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata diff --git a/vendor/k8s.io/api/storage/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/storage/v1beta1/types_swagger_doc_generated.go index 80b68839b4..8a12d1f8c0 100644 --- a/vendor/k8s.io/api/storage/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/storage/v1beta1/types_swagger_doc_generated.go @@ -29,7 +29,7 @@ package v1beta1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_CSIDriver = map[string]string{ "": "CSIDriver captures information about a Container Storage Interface (CSI) volume driver deployed on the cluster. CSI drivers do not need to create the CSIDriver object directly. Instead they may use the cluster-driver-registrar sidecar container. When deployed with a CSI driver it automatically creates a CSIDriver object representing the driver. Kubernetes attach detach controller uses this object to determine whether attach is required. Kubelet uses this object to determine whether pod information needs to be passed on mount. CSIDriver objects are non-namespaced.", - "metadata": "Standard object metadata. metadata.Name indicates the name of the CSI driver that this object refers to; it MUST be the same name returned by the CSI GetPluginName() call for that driver. The driver name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), dots (.), and alphanumerics between. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. metadata.Name indicates the name of the CSI driver that this object refers to; it MUST be the same name returned by the CSI GetPluginName() call for that driver. The driver name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), dots (.), and alphanumerics between. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec represents the specification of the CSI Driver.", } @@ -59,7 +59,7 @@ var map_CSIDriverSpec = map[string]string{ "seLinuxMount": "seLinuxMount specifies if the CSI driver supports \"-o context\" mount option.\n\nWhen \"true\", the CSI driver must ensure that all volumes provided by this CSI driver can be mounted separately with different `-o context` options. This is typical for storage backends that provide volumes as filesystems on block devices or as independent shared volumes. Kubernetes will call NodeStage / NodePublish with \"-o context=xyz\" mount option when mounting a ReadWriteOncePod volume used in Pod that has explicitly set SELinux context. In the future, it may be expanded to other volume AccessModes. In any case, Kubernetes will ensure that the volume is mounted only with a single SELinux context.\n\nWhen \"false\", Kubernetes won't pass any special SELinux mount options to the driver. This is typical for volumes that represent subdirectories of a bigger shared filesystem.\n\nDefault is \"false\".", "nodeAllocatableUpdatePeriodSeconds": "nodeAllocatableUpdatePeriodSeconds specifies the interval between periodic updates of the CSINode allocatable capacity for this driver. When set, both periodic updates and updates triggered by capacity-related failures are enabled. If not set, no updates occur (neither periodic nor upon detecting capacity-related failures), and the allocatable.count remains static. The minimum allowed value for this field is 10 seconds.\n\nThis is a beta feature and requires the MutableCSINodeAllocatableCount feature gate to be enabled.\n\nThis field is mutable.", "serviceAccountTokenInSecrets": "serviceAccountTokenInSecrets is an opt-in for CSI drivers to indicate that service account tokens should be passed via the Secrets field in NodePublishVolumeRequest instead of the VolumeContext field. The CSI specification provides a dedicated Secrets field for sensitive information like tokens, which is the appropriate mechanism for handling credentials. This addresses security concerns where sensitive tokens were being logged as part of volume context.\n\nWhen \"true\", kubelet will pass the tokens only in the Secrets field with the key \"csi.storage.k8s.io/serviceAccount.tokens\". The CSI driver must be updated to read tokens from the Secrets field instead of VolumeContext.\n\nWhen \"false\" or not set, kubelet will pass the tokens in VolumeContext with the key \"csi.storage.k8s.io/serviceAccount.tokens\" (existing behavior). This maintains backward compatibility with existing CSI drivers.\n\nThis field can only be set when TokenRequests is configured. The API server will reject CSIDriver specs that set this field without TokenRequests.\n\nDefault behavior if unset is to pass tokens in the VolumeContext field.", - "preventPodSchedulingIfMissing": "PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod scheduling if the CSI driver on the node is missing.\n\nEnabling this option will prevent the scheduler (or any other component which embeds default scheduler such as cluster-autoscaler) from scheduling pods to nodes where CSI driver is not installed.\n\nFor components(such as cluster-autoscaler) that embed the scheduler and run pod placement simulations using scheduler plugins, they MUST be aware of CSI driver registration information via CSINode object. They must create simulated CSINode objects in addition to Node objects during scheduling simulation, otherwise if PreventPodSchedulingIfMissing is enabled globally for CSIDriver object, any newly created node may be rejected by the scheduler because of missing CSI driver information from the node.\n\nThis is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled. Default is \"false\".", + "preventPodSchedulingIfMissing": "preventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod scheduling if the CSI driver on the node is missing.\n\nEnabling this option will prevent the scheduler (or any other component which embeds default scheduler such as cluster-autoscaler) from scheduling pods to nodes where CSI driver is not installed.\n\nFor components(such as cluster-autoscaler) that embed the scheduler and run pod placement simulations using scheduler plugins, they MUST be aware of CSI driver registration information via CSINode object. They must create simulated CSINode objects in addition to Node objects during scheduling simulation, otherwise if PreventPodSchedulingIfMissing is enabled globally for CSIDriver object, any newly created node may be rejected by the scheduler because of missing CSI driver information from the node.\n\nThis is a beta feature and requires the VolumeLimitScaling feature gate to be enabled. Default is \"false\".", } func (CSIDriverSpec) SwaggerDoc() map[string]string { @@ -68,8 +68,9 @@ func (CSIDriverSpec) SwaggerDoc() map[string]string { var map_CSINode = map[string]string{ "": "DEPRECATED - This group version of CSINode is deprecated by storage/v1/CSINode. See the release notes for more information. CSINode holds information about all CSI drivers installed on a node. CSI drivers do not need to create the CSINode object directly. As long as they use the node-driver-registrar sidecar container, the kubelet will automatically populate the CSINode object for the CSI driver as part of kubelet plugin registration. CSINode has the same name as a node. If the object is missing, it means either there are no CSI Drivers available on the node, or the Kubelet version is low enough that it doesn't create this object. CSINode has an OwnerReference that points to the corresponding node object.", - "metadata": "metadata.name must be the Kubernetes node name.", + "metadata": "metadata is the standard object metadata. metadata.name must be the Kubernetes node name.", "spec": "spec is the specification of CSINode", + "status": "status contains health and status information for the node's storage.", } func (CSINode) SwaggerDoc() map[string]string { @@ -107,9 +108,18 @@ func (CSINodeSpec) SwaggerDoc() map[string]string { return map_CSINodeSpec } +var map_CSINodeStatus = map[string]string{ + "": "CSINodeStatus contains health and status information for storage on a node.", + "storageHealth": "storageHealth contains backend health reports for CSI drivers registered on the node.", +} + +func (CSINodeStatus) SwaggerDoc() map[string]string { + return map_CSINodeStatus +} + var map_CSIStorageCapacity = map[string]string{ "": "CSIStorageCapacity stores the result of one CSI GetCapacity call. For a given StorageClass, this describes the available capacity in a particular topology segment. This can be used when considering where to instantiate new PersistentVolumes.\n\nFor example this can express things like: - StorageClass \"standard\" has \"1234 GiB\" available in \"topology.kubernetes.io/zone=us-east1\" - StorageClass \"localssd\" has \"10 GiB\" available in \"kubernetes.io/hostname=knode-abc123\"\n\nThe following three cases all imply that no capacity is available for a certain combination: - no object exists with suitable topology and storage class name - such an object exists, but the capacity is unset - such an object exists, but the capacity is zero\n\nThe producer of these objects can decide which approach is more suitable.\n\nThey are consumed by the kube-scheduler when a CSI driver opts into capacity-aware scheduling with CSIDriverSpec.StorageCapacity. The scheduler compares the MaximumVolumeSize against the requested size of pending volumes to filter out unsuitable nodes. If MaximumVolumeSize is unset, it falls back to a comparison against the less precise Capacity. If that is also unset, the scheduler assumes that capacity is insufficient and tries some other node.", - "metadata": "Standard object's metadata. The name has no particular meaning. It must be be a DNS subdomain (dots allowed, 253 characters). To ensure that there are no conflicts with other CSI drivers on the cluster, the recommendation is to use csisc-, a generated name, or a reverse-domain name which ends with the unique CSI driver name.\n\nObjects are namespaced.\n\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. The name has no particular meaning. It must be be a DNS subdomain (dots allowed, 253 characters). To ensure that there are no conflicts with other CSI drivers on the cluster, the recommendation is to use csisc-, a generated name, or a reverse-domain name which ends with the unique CSI driver name.\n\nObjects are namespaced.\n\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "nodeTopology": "nodeTopology defines which nodes have access to the storage for which capacity was reported. If not set, the storage is not accessible from any node in the cluster. If empty, the storage is accessible from all nodes. This field is immutable.", "storageClassName": "storageClassName represents the name of the StorageClass that the reported capacity applies to. It must meet the same requirements as the name of a StorageClass object (non-empty, DNS subdomain). If that object no longer exists, the CSIStorageCapacity object is obsolete and should be removed by its creator. This field is immutable.", "capacity": "capacity is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields.\n\nThe semantic is currently (CSI spec 1.2) defined as: The available capacity, in bytes, of the storage that can be used to provision volumes. If not set, that information is currently unavailable.", @@ -132,7 +142,7 @@ func (CSIStorageCapacityList) SwaggerDoc() map[string]string { var map_StorageClass = map[string]string{ "": "StorageClass describes the parameters for a class of storage for which PersistentVolumes can be dynamically provisioned.\n\nStorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "provisioner": "provisioner indicates the type of the provisioner.", "parameters": "parameters holds the parameters for the provisioner that should create volumes of this storage class.", "reclaimPolicy": "reclaimPolicy controls the reclaimPolicy for dynamically provisioned PersistentVolumes of this storage class. Defaults to Delete.", @@ -156,6 +166,30 @@ func (StorageClassList) SwaggerDoc() map[string]string { return map_StorageClassList } +var map_StorageHealth = map[string]string{ + "": "StorageHealth contains storage backend health reported by a CSI driver on a node.", + "name": "name is the CSI driver name, matching CSINodeDriver.name.", + "healthConditions": "healthConditions are the adverse storage backend conditions reported by the CSI driver. At most 16 conditions may be reported.", +} + +func (StorageHealth) SwaggerDoc() map[string]string { + return map_StorageHealth +} + +var map_StorageHealthCondition = map[string]string{ + "": "StorageHealthCondition represents an adverse health condition reported by a CSI driver for its storage backend on a node.", + "status": "status is the health status category. One of \"StorageUnreachable\", \"StorageDegraded\".", + "reason": "reason is a brief CamelCase machine-parseable reason. Maximum permitted length of a reason is 256 characters.", + "message": "message is a human-readable description. Maximum permitted length of a message is 1024 characters.", + "accessMode": "accessMode is the access mode affected. Nil means all access modes are affected.", + "volumeMode": "volumeMode is the volume mode affected. Nil means both are affected.", + "lastTransitionTime": "lastTransitionTime is when this condition first appeared at its current state.", +} + +func (StorageHealthCondition) SwaggerDoc() map[string]string { + return map_StorageHealthCondition +} + var map_TokenRequest = map[string]string{ "": "TokenRequest contains parameters of a service account token.", "audience": "audience is the intended audience of the token in \"TokenRequestSpec\". It will default to the audiences of kube apiserver.", @@ -168,7 +202,7 @@ func (TokenRequest) SwaggerDoc() map[string]string { var map_VolumeAttachment = map[string]string{ "": "VolumeAttachment captures the intent to attach or detach the specified volume to/from the specified node.\n\nVolumeAttachment objects are non-namespaced.", - "metadata": "Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "spec": "spec represents specification of the desired attach/detach volume behavior. Populated by the Kubernetes system.", "status": "status represents status of the VolumeAttachment request. Populated by the entity completing the attach or detach operation, i.e. the external-attacher.", } @@ -190,6 +224,7 @@ func (VolumeAttachmentList) SwaggerDoc() map[string]string { var map_VolumeAttachmentSource = map[string]string{ "": "VolumeAttachmentSource represents a volume that should be attached. Right now only PersistentVolumes can be attached via external attacher, in the future we may allow also inline volumes in pods. Exactly one member can be set.", "persistentVolumeName": "persistentVolumeName represents the name of the persistent volume to attach.", + "inlineVolumeSpec": "inlineVolumeSpec contains all the information necessary to attach a persistent volume defined by a pod's inline VolumeSource. This field is populated only for the CSIMigration feature. It contains translated fields from a pod's inline VolumeSource to a PersistentVolumeSpec. This field is beta-level and is only honored by servers that enabled the CSIMigration feature.", } func (VolumeAttachmentSource) SwaggerDoc() map[string]string { @@ -221,8 +256,8 @@ func (VolumeAttachmentStatus) SwaggerDoc() map[string]string { var map_VolumeAttributesClass = map[string]string{ "": "VolumeAttributesClass represents a specification of mutable volume attributes defined by the CSI driver. The class can be specified during dynamic provisioning of PersistentVolumeClaims, and changed in the PersistentVolumeClaim spec after provisioning.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "driverName": "Name of the CSI driver This field is immutable.", + "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "driverName": "driverName is the name of the CSI driver This field is immutable.", "parameters": "parameters hold volume attributes defined by the CSI driver. These values are opaque to the Kubernetes and are passed directly to the CSI driver. The underlying storage provider supports changing these attributes on an existing volume, however the parameters field itself is immutable. To invoke a volume update, a new VolumeAttributesClass should be created with new parameters, and the PersistentVolumeClaim should be updated to reference the new VolumeAttributesClass.\n\nThis field is required and must contain at least one key/value pair. The keys cannot be empty, and the maximum number of parameters is 512, with a cumulative max size of 256K. If the CSI driver rejects invalid parameters, the target PersistentVolumeClaim will be set to an \"Infeasible\" state in the modifyVolumeStatus field.", } diff --git a/vendor/k8s.io/api/storage/v1beta1/zz_generated.deepcopy.go b/vendor/k8s.io/api/storage/v1beta1/zz_generated.deepcopy.go index ca28e0340c..88b0581780 100644 --- a/vendor/k8s.io/api/storage/v1beta1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/storage/v1beta1/zz_generated.deepcopy.go @@ -166,6 +166,7 @@ func (in *CSINode) DeepCopyInto(out *CSINode) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) return } @@ -269,6 +270,29 @@ func (in *CSINodeSpec) DeepCopy() *CSINodeSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CSINodeStatus) DeepCopyInto(out *CSINodeStatus) { + *out = *in + if in.StorageHealth != nil { + in, out := &in.StorageHealth, &out.StorageHealth + *out = make([]StorageHealth, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CSINodeStatus. +func (in *CSINodeStatus) DeepCopy() *CSINodeStatus { + if in == nil { + return nil + } + out := new(CSINodeStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CSIStorageCapacity) DeepCopyInto(out *CSIStorageCapacity) { *out = *in @@ -436,6 +460,56 @@ func (in *StorageClassList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageHealth) DeepCopyInto(out *StorageHealth) { + *out = *in + if in.HealthConditions != nil { + in, out := &in.HealthConditions, &out.HealthConditions + *out = make([]StorageHealthCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageHealth. +func (in *StorageHealth) DeepCopy() *StorageHealth { + if in == nil { + return nil + } + out := new(StorageHealth) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageHealthCondition) DeepCopyInto(out *StorageHealthCondition) { + *out = *in + if in.AccessMode != nil { + in, out := &in.AccessMode, &out.AccessMode + *out = new(corev1.PersistentVolumeAccessMode) + **out = **in + } + if in.VolumeMode != nil { + in, out := &in.VolumeMode, &out.VolumeMode + *out = new(corev1.PersistentVolumeMode) + **out = **in + } + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageHealthCondition. +func (in *StorageHealthCondition) DeepCopy() *StorageHealthCondition { + if in == nil { + return nil + } + out := new(StorageHealthCondition) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TokenRequest) DeepCopyInto(out *TokenRequest) { *out = *in diff --git a/vendor/k8s.io/api/storage/v1beta1/zz_generated.model_name.go b/vendor/k8s.io/api/storage/v1beta1/zz_generated.model_name.go index 8453d86b22..fe654676ba 100644 --- a/vendor/k8s.io/api/storage/v1beta1/zz_generated.model_name.go +++ b/vendor/k8s.io/api/storage/v1beta1/zz_generated.model_name.go @@ -56,6 +56,11 @@ func (in CSINodeSpec) OpenAPIModelName() string { return "io.k8s.api.storage.v1beta1.CSINodeSpec" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in CSINodeStatus) OpenAPIModelName() string { + return "io.k8s.api.storage.v1beta1.CSINodeStatus" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in CSIStorageCapacity) OpenAPIModelName() string { return "io.k8s.api.storage.v1beta1.CSIStorageCapacity" @@ -76,6 +81,16 @@ func (in StorageClassList) OpenAPIModelName() string { return "io.k8s.api.storage.v1beta1.StorageClassList" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in StorageHealth) OpenAPIModelName() string { + return "io.k8s.api.storage.v1beta1.StorageHealth" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in StorageHealthCondition) OpenAPIModelName() string { + return "io.k8s.api.storage.v1beta1.StorageHealthCondition" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in TokenRequest) OpenAPIModelName() string { return "io.k8s.api.storage.v1beta1.TokenRequest" diff --git a/vendor/k8s.io/api/storagemigration/v1/doc.go b/vendor/k8s.io/api/storagemigration/v1/doc.go new file mode 100644 index 0000000000..4c122fa5ca --- /dev/null +++ b/vendor/k8s.io/api/storagemigration/v1/doc.go @@ -0,0 +1,25 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +k8s:deepcopy-gen=package +// +k8s:protobuf-gen=package +// +k8s:openapi-gen=true +// +k8s:prerelease-lifecycle-gen=true +// +k8s:openapi-model-package=io.k8s.api.storagemigration.v1 + +// +groupName=storagemigration.k8s.io + +package v1 diff --git a/vendor/k8s.io/api/storagemigration/v1/generated.pb.go b/vendor/k8s.io/api/storagemigration/v1/generated.pb.go new file mode 100644 index 0000000000..9f4e58652b --- /dev/null +++ b/vendor/k8s.io/api/storagemigration/v1/generated.pb.go @@ -0,0 +1,904 @@ +/* +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 protoc-gen-gogo. DO NOT EDIT. +// source: k8s.io/api/storagemigration/v1/generated.proto + +package v1 + +import ( + fmt "fmt" + + io "io" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + math_bits "math/bits" + reflect "reflect" + strings "strings" +) + +func (m *StorageVersionMigration) Reset() { *m = StorageVersionMigration{} } + +func (m *StorageVersionMigrationList) Reset() { *m = StorageVersionMigrationList{} } + +func (m *StorageVersionMigrationSpec) Reset() { *m = StorageVersionMigrationSpec{} } + +func (m *StorageVersionMigrationStatus) Reset() { *m = StorageVersionMigrationStatus{} } + +func (m *StorageVersionMigration) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StorageVersionMigration) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StorageVersionMigration) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StorageVersionMigrationList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StorageVersionMigrationList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StorageVersionMigrationList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StorageVersionMigrationSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StorageVersionMigrationSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StorageVersionMigrationSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Resource.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StorageVersionMigrationStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StorageVersionMigrationStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StorageVersionMigrationStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.ResourceVersion) + copy(dAtA[i:], m.ResourceVersion) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.ResourceVersion))) + i-- + dAtA[i] = 0x12 + if len(m.Conditions) > 0 { + for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { + offset -= sovGenerated(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StorageVersionMigration) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *StorageVersionMigrationList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *StorageVersionMigrationSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Resource.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *StorageVersionMigrationStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Conditions) > 0 { + for _, e := range m.Conditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + l = len(m.ResourceVersion) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func sovGenerated(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenerated(x uint64) (n int) { + return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *StorageVersionMigration) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StorageVersionMigration{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "StorageVersionMigrationSpec", "StorageVersionMigrationSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "StorageVersionMigrationStatus", "StorageVersionMigrationStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *StorageVersionMigrationList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]StorageVersionMigration{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "StorageVersionMigration", "StorageVersionMigration", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&StorageVersionMigrationList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *StorageVersionMigrationSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StorageVersionMigrationSpec{`, + `Resource:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Resource), "GroupResource", "v1.GroupResource", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *StorageVersionMigrationStatus) String() string { + if this == nil { + return "nil" + } + repeatedStringForConditions := "[]Condition{" + for _, f := range this.Conditions { + repeatedStringForConditions += fmt.Sprintf("%v", f) + "," + } + repeatedStringForConditions += "}" + s := strings.Join([]string{`&StorageVersionMigrationStatus{`, + `Conditions:` + repeatedStringForConditions + `,`, + `ResourceVersion:` + fmt.Sprintf("%v", this.ResourceVersion) + `,`, + `}`, + }, "") + return s +} +func valueToStringGenerated(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *StorageVersionMigration) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StorageVersionMigration: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StorageVersionMigration: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StorageVersionMigrationList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StorageVersionMigrationList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StorageVersionMigrationList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, StorageVersionMigration{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StorageVersionMigrationSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StorageVersionMigrationSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StorageVersionMigrationSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Resource", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Resource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StorageVersionMigrationStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StorageVersionMigrationStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StorageVersionMigrationStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Conditions = append(m.Conditions, v1.Condition{}) + if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceVersion", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceVersion = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenerated(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenerated + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenerated + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenerated + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") +) diff --git a/vendor/k8s.io/api/storagemigration/v1/generated.proto b/vendor/k8s.io/api/storagemigration/v1/generated.proto new file mode 100644 index 0000000000..ada3c15113 --- /dev/null +++ b/vendor/k8s.io/api/storagemigration/v1/generated.proto @@ -0,0 +1,86 @@ +/* +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. +*/ + + +// This file was autogenerated by go-to-protobuf. Do not edit it manually! + +syntax = "proto2"; + +package k8s.io.api.storagemigration.v1; + +import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; + +// Package-wide variables from generator "generated". +option go_package = "k8s.io/api/storagemigration/v1"; + +// StorageVersionMigration represents a migration of stored data to the latest +// storage version. +// +k8s:supportsSubresource="/status" +message StorageVersionMigration { + // Standard object metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // Specification of the migration. + // +optional + optional StorageVersionMigrationSpec spec = 2; + + // Status of the migration. + // +optional + optional StorageVersionMigrationStatus status = 3; +} + +// StorageVersionMigrationList is a collection of storage version migrations. +message StorageVersionMigrationList { + // Standard list metadata + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // Items is the list of StorageVersionMigration + repeated StorageVersionMigration items = 2; +} + +// Spec of the storage version migration. +message StorageVersionMigrationSpec { + // The resource that is being migrated. The migrator sends requests to + // the endpoint serving the resource. + // Immutable. + optional .k8s.io.apimachinery.pkg.apis.meta.v1.GroupResource resource = 1; +} + +// Status of the storage version migration. +message StorageVersionMigrationStatus { + // The latest available observations of the migration's current state. + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1; + + // ResourceVersion to compare with the GC cache for performing the migration. + // This is the current resource version of given group, version and resource when + // kube-controller-manager first observes this StorageVersionMigration resource. + optional string resourceVersion = 2; +} + diff --git a/vendor/k8s.io/api/storagemigration/v1/register.go b/vendor/k8s.io/api/storagemigration/v1/register.go new file mode 100644 index 0000000000..d03db0c4db --- /dev/null +++ b/vendor/k8s.io/api/storagemigration/v1/register.go @@ -0,0 +1,58 @@ +/* +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. +*/ + +package v1 + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// GroupName is the group name use in this package +const GroupName = "storagemigration.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} + +// Kind takes an unqualified kind and returns a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +// Adds the list of known types to the given scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &StorageVersionMigration{}, + &StorageVersionMigrationList{}, + ) + + // Add the watch version that applies + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/k8s.io/api/storagemigration/v1/types.go b/vendor/k8s.io/api/storagemigration/v1/types.go new file mode 100644 index 0000000000..cead674391 --- /dev/null +++ b/vendor/k8s.io/api/storagemigration/v1/types.go @@ -0,0 +1,95 @@ +/* +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. +*/ + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.37 + +// StorageVersionMigration represents a migration of stored data to the latest +// storage version. +// +k8s:supportsSubresource="/status" +type StorageVersionMigration struct { + metav1.TypeMeta `json:""` + // Standard object metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + // Specification of the migration. + // +optional + Spec StorageVersionMigrationSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + // Status of the migration. + // +optional + Status StorageVersionMigrationStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// Spec of the storage version migration. +type StorageVersionMigrationSpec struct { + // The resource that is being migrated. The migrator sends requests to + // the endpoint serving the resource. + // Immutable. + Resource metav1.GroupResource `json:"resource" protobuf:"bytes,1,opt,name=resource"` +} + +type MigrationConditionType string + +const ( + // Indicates that the migration is running. + MigrationRunning MigrationConditionType = "Running" + // Indicates that the migration has completed successfully. + MigrationSucceeded MigrationConditionType = "Succeeded" + // Indicates that the migration has failed. + MigrationFailed MigrationConditionType = "Failed" +) + +// Status of the storage version migration. +type StorageVersionMigrationStatus struct { + // The latest available observations of the migration's current state. + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + // ResourceVersion to compare with the GC cache for performing the migration. + // This is the current resource version of given group, version and resource when + // kube-controller-manager first observes this StorageVersionMigration resource. + ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,2,opt,name=resourceVersion"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.37 + +// StorageVersionMigrationList is a collection of storage version migrations. +type StorageVersionMigrationList struct { + metav1.TypeMeta `json:""` + + // Standard list metadata + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + // Items is the list of StorageVersionMigration + Items []StorageVersionMigration `json:"items" protobuf:"bytes,2,rep,name=items"` +} diff --git a/vendor/k8s.io/api/storagemigration/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/storagemigration/v1/types_swagger_doc_generated.go new file mode 100644 index 0000000000..a9ff380d84 --- /dev/null +++ b/vendor/k8s.io/api/storagemigration/v1/types_swagger_doc_generated.go @@ -0,0 +1,70 @@ +/* +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. +*/ + +package v1 + +// This file contains a collection of methods that can be used from go-restful to +// generate Swagger API documentation for its models. Please read this PR for more +// information on the implementation: https://github.com/emicklei/go-restful/pull/215 +// +// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if +// they are on one line! For multiple line or blocks that you want to ignore use ---. +// Any context after a --- is ignored. +// +// Those methods can be generated by using hack/update-codegen.sh + +// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. +var map_StorageVersionMigration = map[string]string{ + "": "StorageVersionMigration represents a migration of stored data to the latest storage version.", + "metadata": "Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "Specification of the migration.", + "status": "Status of the migration.", +} + +func (StorageVersionMigration) SwaggerDoc() map[string]string { + return map_StorageVersionMigration +} + +var map_StorageVersionMigrationList = map[string]string{ + "": "StorageVersionMigrationList is a collection of storage version migrations.", + "metadata": "Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "items": "Items is the list of StorageVersionMigration", +} + +func (StorageVersionMigrationList) SwaggerDoc() map[string]string { + return map_StorageVersionMigrationList +} + +var map_StorageVersionMigrationSpec = map[string]string{ + "": "Spec of the storage version migration.", + "resource": "The resource that is being migrated. The migrator sends requests to the endpoint serving the resource. Immutable.", +} + +func (StorageVersionMigrationSpec) SwaggerDoc() map[string]string { + return map_StorageVersionMigrationSpec +} + +var map_StorageVersionMigrationStatus = map[string]string{ + "": "Status of the storage version migration.", + "conditions": "The latest available observations of the migration's current state.", + "resourceVersion": "ResourceVersion to compare with the GC cache for performing the migration. This is the current resource version of given group, version and resource when kube-controller-manager first observes this StorageVersionMigration resource.", +} + +func (StorageVersionMigrationStatus) SwaggerDoc() map[string]string { + return map_StorageVersionMigrationStatus +} + +// AUTO-GENERATED FUNCTIONS END HERE diff --git a/vendor/k8s.io/api/storagemigration/v1/zz_generated.deepcopy.go b/vendor/k8s.io/api/storagemigration/v1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..10ef04a084 --- /dev/null +++ b/vendor/k8s.io/api/storagemigration/v1/zz_generated.deepcopy.go @@ -0,0 +1,128 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageVersionMigration) DeepCopyInto(out *StorageVersionMigration) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageVersionMigration. +func (in *StorageVersionMigration) DeepCopy() *StorageVersionMigration { + if in == nil { + return nil + } + out := new(StorageVersionMigration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *StorageVersionMigration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageVersionMigrationList) DeepCopyInto(out *StorageVersionMigrationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]StorageVersionMigration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageVersionMigrationList. +func (in *StorageVersionMigrationList) DeepCopy() *StorageVersionMigrationList { + if in == nil { + return nil + } + out := new(StorageVersionMigrationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *StorageVersionMigrationList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageVersionMigrationSpec) DeepCopyInto(out *StorageVersionMigrationSpec) { + *out = *in + out.Resource = in.Resource + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageVersionMigrationSpec. +func (in *StorageVersionMigrationSpec) DeepCopy() *StorageVersionMigrationSpec { + if in == nil { + return nil + } + out := new(StorageVersionMigrationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageVersionMigrationStatus) DeepCopyInto(out *StorageVersionMigrationStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageVersionMigrationStatus. +func (in *StorageVersionMigrationStatus) DeepCopy() *StorageVersionMigrationStatus { + if in == nil { + return nil + } + out := new(StorageVersionMigrationStatus) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/k8s.io/api/storagemigration/v1/zz_generated.model_name.go b/vendor/k8s.io/api/storagemigration/v1/zz_generated.model_name.go new file mode 100644 index 0000000000..3c5ff9ded5 --- /dev/null +++ b/vendor/k8s.io/api/storagemigration/v1/zz_generated.model_name.go @@ -0,0 +1,42 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by openapi-gen. DO NOT EDIT. + +package v1 + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in StorageVersionMigration) OpenAPIModelName() string { + return "io.k8s.api.storagemigration.v1.StorageVersionMigration" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in StorageVersionMigrationList) OpenAPIModelName() string { + return "io.k8s.api.storagemigration.v1.StorageVersionMigrationList" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in StorageVersionMigrationSpec) OpenAPIModelName() string { + return "io.k8s.api.storagemigration.v1.StorageVersionMigrationSpec" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in StorageVersionMigrationStatus) OpenAPIModelName() string { + return "io.k8s.api.storagemigration.v1.StorageVersionMigrationStatus" +} diff --git a/vendor/k8s.io/api/storagemigration/v1/zz_generated.prerelease-lifecycle.go b/vendor/k8s.io/api/storagemigration/v1/zz_generated.prerelease-lifecycle.go new file mode 100644 index 0000000000..64eaaeddee --- /dev/null +++ b/vendor/k8s.io/api/storagemigration/v1/zz_generated.prerelease-lifecycle.go @@ -0,0 +1,34 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by prerelease-lifecycle-gen. DO NOT EDIT. + +package v1 + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *StorageVersionMigration) APILifecycleIntroduced() (major, minor int) { + return 1, 37 +} + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *StorageVersionMigrationList) APILifecycleIntroduced() (major, minor int) { + return 1, 37 +} diff --git a/vendor/k8s.io/api/storagemigration/v1beta1/generated.proto b/vendor/k8s.io/api/storagemigration/v1beta1/generated.proto index d7d08d88c7..21fc7eab6c 100644 --- a/vendor/k8s.io/api/storagemigration/v1beta1/generated.proto +++ b/vendor/k8s.io/api/storagemigration/v1beta1/generated.proto @@ -30,6 +30,7 @@ option go_package = "k8s.io/api/storagemigration/v1beta1"; // StorageVersionMigration represents a migration of stored data to the latest // storage version. +// +k8s:supportsSubresource="/status" message StorageVersionMigration { // Standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -72,6 +73,9 @@ message StorageVersionMigrationStatus { // +listType=map // +listMapKey=type // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1; // ResourceVersion to compare with the GC cache for performing the migration. diff --git a/vendor/k8s.io/api/storagemigration/v1beta1/types.go b/vendor/k8s.io/api/storagemigration/v1beta1/types.go index 9655f737ae..bbbbe9f54d 100644 --- a/vendor/k8s.io/api/storagemigration/v1beta1/types.go +++ b/vendor/k8s.io/api/storagemigration/v1beta1/types.go @@ -24,11 +24,14 @@ import ( // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.35 +// +k8s:prerelease-lifecycle-gen:deprecated=1.37 +// +k8s:prerelease-lifecycle-gen:replacement=storagemigration.k8s.io,v1,StorageVersionMigration // StorageVersionMigration represents a migration of stored data to the latest // storage version. +// +k8s:supportsSubresource="/status" type StorageVersionMigration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -68,6 +71,9 @@ type StorageVersionMigrationStatus struct { // +listType=map // +listMapKey=type // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:listType=map + // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` // ResourceVersion to compare with the GC cache for performing the migration. // This is the current resource version of given group, version and resource when @@ -77,10 +83,12 @@ type StorageVersionMigrationStatus struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.35 +// +k8s:prerelease-lifecycle-gen:deprecated=1.37 +// +k8s:prerelease-lifecycle-gen:replacement=storagemigration.k8s.io,v1,StorageVersionMigrationList // StorageVersionMigrationList is a collection of storage version migrations. type StorageVersionMigrationList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata diff --git a/vendor/k8s.io/api/storagemigration/v1beta1/zz_generated.prerelease-lifecycle.go b/vendor/k8s.io/api/storagemigration/v1beta1/zz_generated.prerelease-lifecycle.go index f52614f7d3..5962412fbb 100644 --- a/vendor/k8s.io/api/storagemigration/v1beta1/zz_generated.prerelease-lifecycle.go +++ b/vendor/k8s.io/api/storagemigration/v1beta1/zz_generated.prerelease-lifecycle.go @@ -21,6 +21,10 @@ limitations under the License. package v1beta1 +import ( + schema "k8s.io/apimachinery/pkg/runtime/schema" +) + // APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. func (in *StorageVersionMigration) APILifecycleIntroduced() (major, minor int) { @@ -30,13 +34,19 @@ func (in *StorageVersionMigration) APILifecycleIntroduced() (major, minor int) { // APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. func (in *StorageVersionMigration) APILifecycleDeprecated() (major, minor int) { - return 1, 38 + return 1, 37 +} + +// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type. +// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=,," tags in types.go. +func (in *StorageVersionMigration) APILifecycleReplacement() schema.GroupVersionKind { + return schema.GroupVersionKind{Group: "storagemigration.k8s.io", Version: "v1", Kind: "StorageVersionMigration"} } // APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. func (in *StorageVersionMigration) APILifecycleRemoved() (major, minor int) { - return 1, 41 + return 1, 40 } // APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. @@ -48,11 +58,17 @@ func (in *StorageVersionMigrationList) APILifecycleIntroduced() (major, minor in // APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. func (in *StorageVersionMigrationList) APILifecycleDeprecated() (major, minor int) { - return 1, 38 + return 1, 37 +} + +// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type. +// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=,," tags in types.go. +func (in *StorageVersionMigrationList) APILifecycleReplacement() schema.GroupVersionKind { + return schema.GroupVersionKind{Group: "storagemigration.k8s.io", Version: "v1", Kind: "StorageVersionMigrationList"} } // APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. func (in *StorageVersionMigrationList) APILifecycleRemoved() (major, minor int) { - return 1, 41 + return 1, 40 } diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/types.go b/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/types.go index b3a8ce7ef4..c0e968886a 100644 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/types.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/types.go @@ -402,7 +402,7 @@ const CustomResourceCleanupFinalizer = "customresourcecleanup.apiextensions.k8s. // CustomResourceDefinition represents a resource that should be exposed on the API server. Its name MUST be in the format // <.spec.name>.<.spec.group>. type CustomResourceDefinition struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -420,7 +420,7 @@ type CustomResourceDefinition struct { // CustomResourceDefinitionList is a list of CustomResourceDefinition objects. type CustomResourceDefinitionList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -489,7 +489,7 @@ type CustomResourceSubresourceScale struct { // ConversionReview describes a conversion request/response. type ConversionReview struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // request describes the attributes for the conversion request. // +optional Request *ConversionRequest `json:"request,omitempty" protobuf:"bytes,1,opt,name=request"` diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/zz_generated.conversion.go b/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/zz_generated.conversion.go index 4d02c8df03..29639388da 100644 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/zz_generated.conversion.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/zz_generated.conversion.go @@ -276,12 +276,7 @@ func RegisterConversions(s *runtime.Scheme) error { } func autoConvert_v1_CustomResourceColumnDefinition_To_apiextensions_CustomResourceColumnDefinition(in *CustomResourceColumnDefinition, out *apiextensions.CustomResourceColumnDefinition, s conversion.Scope) error { - out.Name = in.Name - out.Type = in.Type - out.Format = in.Format - out.Description = in.Description - out.Priority = in.Priority - out.JSONPath = in.JSONPath + *out = *(*apiextensions.CustomResourceColumnDefinition)(unsafe.Pointer(in)) return nil } @@ -291,12 +286,7 @@ func Convert_v1_CustomResourceColumnDefinition_To_apiextensions_CustomResourceCo } func autoConvert_apiextensions_CustomResourceColumnDefinition_To_v1_CustomResourceColumnDefinition(in *apiextensions.CustomResourceColumnDefinition, out *CustomResourceColumnDefinition, s conversion.Scope) error { - out.Name = in.Name - out.Type = in.Type - out.Format = in.Format - out.Description = in.Description - out.Priority = in.Priority - out.JSONPath = in.JSONPath + *out = *(*CustomResourceColumnDefinition)(unsafe.Pointer(in)) return nil } @@ -351,12 +341,7 @@ func Convert_apiextensions_CustomResourceDefinition_To_v1_CustomResourceDefiniti } func autoConvert_v1_CustomResourceDefinitionCondition_To_apiextensions_CustomResourceDefinitionCondition(in *CustomResourceDefinitionCondition, out *apiextensions.CustomResourceDefinitionCondition, s conversion.Scope) error { - out.Type = apiextensions.CustomResourceDefinitionConditionType(in.Type) - out.Status = apiextensions.ConditionStatus(in.Status) - out.LastTransitionTime = in.LastTransitionTime - out.Reason = in.Reason - out.Message = in.Message - out.ObservedGeneration = in.ObservedGeneration + *out = *(*apiextensions.CustomResourceDefinitionCondition)(unsafe.Pointer(in)) return nil } @@ -366,12 +351,7 @@ func Convert_v1_CustomResourceDefinitionCondition_To_apiextensions_CustomResourc } func autoConvert_apiextensions_CustomResourceDefinitionCondition_To_v1_CustomResourceDefinitionCondition(in *apiextensions.CustomResourceDefinitionCondition, out *CustomResourceDefinitionCondition, s conversion.Scope) error { - out.Type = CustomResourceDefinitionConditionType(in.Type) - out.Status = ConditionStatus(in.Status) - out.LastTransitionTime = in.LastTransitionTime - out.Reason = in.Reason - out.Message = in.Message - out.ObservedGeneration = in.ObservedGeneration + *out = *(*CustomResourceDefinitionCondition)(unsafe.Pointer(in)) return nil } @@ -423,12 +403,7 @@ func Convert_apiextensions_CustomResourceDefinitionList_To_v1_CustomResourceDefi } func autoConvert_v1_CustomResourceDefinitionNames_To_apiextensions_CustomResourceDefinitionNames(in *CustomResourceDefinitionNames, out *apiextensions.CustomResourceDefinitionNames, s conversion.Scope) error { - out.Plural = in.Plural - out.Singular = in.Singular - out.ShortNames = *(*[]string)(unsafe.Pointer(&in.ShortNames)) - out.Kind = in.Kind - out.ListKind = in.ListKind - out.Categories = *(*[]string)(unsafe.Pointer(&in.Categories)) + *out = *(*apiextensions.CustomResourceDefinitionNames)(unsafe.Pointer(in)) return nil } @@ -438,12 +413,7 @@ func Convert_v1_CustomResourceDefinitionNames_To_apiextensions_CustomResourceDef } func autoConvert_apiextensions_CustomResourceDefinitionNames_To_v1_CustomResourceDefinitionNames(in *apiextensions.CustomResourceDefinitionNames, out *CustomResourceDefinitionNames, s conversion.Scope) error { - out.Plural = in.Plural - out.Singular = in.Singular - out.ShortNames = *(*[]string)(unsafe.Pointer(&in.ShortNames)) - out.Kind = in.Kind - out.ListKind = in.ListKind - out.Categories = *(*[]string)(unsafe.Pointer(&in.Categories)) + *out = *(*CustomResourceDefinitionNames)(unsafe.Pointer(in)) return nil } @@ -522,12 +492,7 @@ func autoConvert_apiextensions_CustomResourceDefinitionSpec_To_v1_CustomResource } func autoConvert_v1_CustomResourceDefinitionStatus_To_apiextensions_CustomResourceDefinitionStatus(in *CustomResourceDefinitionStatus, out *apiextensions.CustomResourceDefinitionStatus, s conversion.Scope) error { - out.Conditions = *(*[]apiextensions.CustomResourceDefinitionCondition)(unsafe.Pointer(&in.Conditions)) - if err := Convert_v1_CustomResourceDefinitionNames_To_apiextensions_CustomResourceDefinitionNames(&in.AcceptedNames, &out.AcceptedNames, s); err != nil { - return err - } - out.StoredVersions = *(*[]string)(unsafe.Pointer(&in.StoredVersions)) - out.ObservedGeneration = in.ObservedGeneration + *out = *(*apiextensions.CustomResourceDefinitionStatus)(unsafe.Pointer(in)) return nil } @@ -537,12 +502,7 @@ func Convert_v1_CustomResourceDefinitionStatus_To_apiextensions_CustomResourceDe } func autoConvert_apiextensions_CustomResourceDefinitionStatus_To_v1_CustomResourceDefinitionStatus(in *apiextensions.CustomResourceDefinitionStatus, out *CustomResourceDefinitionStatus, s conversion.Scope) error { - out.Conditions = *(*[]CustomResourceDefinitionCondition)(unsafe.Pointer(&in.Conditions)) - if err := Convert_apiextensions_CustomResourceDefinitionNames_To_v1_CustomResourceDefinitionNames(&in.AcceptedNames, &out.AcceptedNames, s); err != nil { - return err - } - out.StoredVersions = *(*[]string)(unsafe.Pointer(&in.StoredVersions)) - out.ObservedGeneration = in.ObservedGeneration + *out = *(*CustomResourceDefinitionStatus)(unsafe.Pointer(in)) return nil } @@ -604,9 +564,7 @@ func Convert_apiextensions_CustomResourceDefinitionVersion_To_v1_CustomResourceD } func autoConvert_v1_CustomResourceSubresourceScale_To_apiextensions_CustomResourceSubresourceScale(in *CustomResourceSubresourceScale, out *apiextensions.CustomResourceSubresourceScale, s conversion.Scope) error { - out.SpecReplicasPath = in.SpecReplicasPath - out.StatusReplicasPath = in.StatusReplicasPath - out.LabelSelectorPath = (*string)(unsafe.Pointer(in.LabelSelectorPath)) + *out = *(*apiextensions.CustomResourceSubresourceScale)(unsafe.Pointer(in)) return nil } @@ -616,9 +574,7 @@ func Convert_v1_CustomResourceSubresourceScale_To_apiextensions_CustomResourceSu } func autoConvert_apiextensions_CustomResourceSubresourceScale_To_v1_CustomResourceSubresourceScale(in *apiextensions.CustomResourceSubresourceScale, out *CustomResourceSubresourceScale, s conversion.Scope) error { - out.SpecReplicasPath = in.SpecReplicasPath - out.StatusReplicasPath = in.StatusReplicasPath - out.LabelSelectorPath = (*string)(unsafe.Pointer(in.LabelSelectorPath)) + *out = *(*CustomResourceSubresourceScale)(unsafe.Pointer(in)) return nil } @@ -628,6 +584,7 @@ func Convert_apiextensions_CustomResourceSubresourceScale_To_v1_CustomResourceSu } func autoConvert_v1_CustomResourceSubresourceStatus_To_apiextensions_CustomResourceSubresourceStatus(in *CustomResourceSubresourceStatus, out *apiextensions.CustomResourceSubresourceStatus, s conversion.Scope) error { + *out = *(*apiextensions.CustomResourceSubresourceStatus)(unsafe.Pointer(in)) return nil } @@ -637,6 +594,7 @@ func Convert_v1_CustomResourceSubresourceStatus_To_apiextensions_CustomResourceS } func autoConvert_apiextensions_CustomResourceSubresourceStatus_To_v1_CustomResourceSubresourceStatus(in *apiextensions.CustomResourceSubresourceStatus, out *CustomResourceSubresourceStatus, s conversion.Scope) error { + *out = *(*CustomResourceSubresourceStatus)(unsafe.Pointer(in)) return nil } @@ -646,8 +604,7 @@ func Convert_apiextensions_CustomResourceSubresourceStatus_To_v1_CustomResourceS } func autoConvert_v1_CustomResourceSubresources_To_apiextensions_CustomResourceSubresources(in *CustomResourceSubresources, out *apiextensions.CustomResourceSubresources, s conversion.Scope) error { - out.Status = (*apiextensions.CustomResourceSubresourceStatus)(unsafe.Pointer(in.Status)) - out.Scale = (*apiextensions.CustomResourceSubresourceScale)(unsafe.Pointer(in.Scale)) + *out = *(*apiextensions.CustomResourceSubresources)(unsafe.Pointer(in)) return nil } @@ -657,8 +614,7 @@ func Convert_v1_CustomResourceSubresources_To_apiextensions_CustomResourceSubres } func autoConvert_apiextensions_CustomResourceSubresources_To_v1_CustomResourceSubresources(in *apiextensions.CustomResourceSubresources, out *CustomResourceSubresources, s conversion.Scope) error { - out.Status = (*CustomResourceSubresourceStatus)(unsafe.Pointer(in.Status)) - out.Scale = (*CustomResourceSubresourceScale)(unsafe.Pointer(in.Scale)) + *out = *(*CustomResourceSubresources)(unsafe.Pointer(in)) return nil } @@ -704,8 +660,7 @@ func Convert_apiextensions_CustomResourceValidation_To_v1_CustomResourceValidati } func autoConvert_v1_ExternalDocumentation_To_apiextensions_ExternalDocumentation(in *ExternalDocumentation, out *apiextensions.ExternalDocumentation, s conversion.Scope) error { - out.Description = in.Description - out.URL = in.URL + *out = *(*apiextensions.ExternalDocumentation)(unsafe.Pointer(in)) return nil } @@ -715,8 +670,7 @@ func Convert_v1_ExternalDocumentation_To_apiextensions_ExternalDocumentation(in } func autoConvert_apiextensions_ExternalDocumentation_To_v1_ExternalDocumentation(in *apiextensions.ExternalDocumentation, out *ExternalDocumentation, s conversion.Scope) error { - out.Description = in.Description - out.URL = in.URL + *out = *(*ExternalDocumentation)(unsafe.Pointer(in)) return nil } @@ -1243,7 +1197,7 @@ func Convert_apiextensions_JSONSchemaPropsOrStringArray_To_v1_JSONSchemaPropsOrS } func autoConvert_v1_SelectableField_To_apiextensions_SelectableField(in *SelectableField, out *apiextensions.SelectableField, s conversion.Scope) error { - out.JSONPath = in.JSONPath + *out = *(*apiextensions.SelectableField)(unsafe.Pointer(in)) return nil } @@ -1253,7 +1207,7 @@ func Convert_v1_SelectableField_To_apiextensions_SelectableField(in *SelectableF } func autoConvert_apiextensions_SelectableField_To_v1_SelectableField(in *apiextensions.SelectableField, out *SelectableField, s conversion.Scope) error { - out.JSONPath = in.JSONPath + *out = *(*SelectableField)(unsafe.Pointer(in)) return nil } @@ -1293,12 +1247,7 @@ func Convert_apiextensions_ServiceReference_To_v1_ServiceReference(in *apiextens } func autoConvert_v1_ValidationRule_To_apiextensions_ValidationRule(in *ValidationRule, out *apiextensions.ValidationRule, s conversion.Scope) error { - out.Rule = in.Rule - out.Message = in.Message - out.MessageExpression = in.MessageExpression - out.Reason = (*apiextensions.FieldValueErrorReason)(unsafe.Pointer(in.Reason)) - out.FieldPath = in.FieldPath - out.OptionalOldSelf = (*bool)(unsafe.Pointer(in.OptionalOldSelf)) + *out = *(*apiextensions.ValidationRule)(unsafe.Pointer(in)) return nil } @@ -1308,12 +1257,7 @@ func Convert_v1_ValidationRule_To_apiextensions_ValidationRule(in *ValidationRul } func autoConvert_apiextensions_ValidationRule_To_v1_ValidationRule(in *apiextensions.ValidationRule, out *ValidationRule, s conversion.Scope) error { - out.Rule = in.Rule - out.Message = in.Message - out.MessageExpression = in.MessageExpression - out.Reason = (*FieldValueErrorReason)(unsafe.Pointer(in.Reason)) - out.FieldPath = in.FieldPath - out.OptionalOldSelf = (*bool)(unsafe.Pointer(in.OptionalOldSelf)) + *out = *(*ValidationRule)(unsafe.Pointer(in)) return nil } diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/types.go b/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/types.go index fb844903ed..e92c715a7a 100644 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/types.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/types.go @@ -442,7 +442,7 @@ const CustomResourceCleanupFinalizer = "customresourcecleanup.apiextensions.k8s. // <.spec.name>.<.spec.group>. // Deprecated in v1.16, planned for removal in v1.22. Use apiextensions.k8s.io/v1 CustomResourceDefinition instead. type CustomResourceDefinition struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional @@ -463,7 +463,7 @@ type CustomResourceDefinition struct { // CustomResourceDefinitionList is a list of CustomResourceDefinition objects. type CustomResourceDefinitionList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -536,7 +536,7 @@ type CustomResourceSubresourceScale struct { // ConversionReview describes a conversion request/response. type ConversionReview struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // request describes the attributes for the conversion request. // +optional Request *ConversionRequest `json:"request,omitempty" protobuf:"bytes,1,opt,name=request"` diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/zz_generated.conversion.go b/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/zz_generated.conversion.go index 5e388dc69b..85e1836c16 100644 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/zz_generated.conversion.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/zz_generated.conversion.go @@ -271,12 +271,7 @@ func RegisterConversions(s *runtime.Scheme) error { } func autoConvert_v1beta1_CustomResourceColumnDefinition_To_apiextensions_CustomResourceColumnDefinition(in *CustomResourceColumnDefinition, out *apiextensions.CustomResourceColumnDefinition, s conversion.Scope) error { - out.Name = in.Name - out.Type = in.Type - out.Format = in.Format - out.Description = in.Description - out.Priority = in.Priority - out.JSONPath = in.JSONPath + *out = *(*apiextensions.CustomResourceColumnDefinition)(unsafe.Pointer(in)) return nil } @@ -286,12 +281,7 @@ func Convert_v1beta1_CustomResourceColumnDefinition_To_apiextensions_CustomResou } func autoConvert_apiextensions_CustomResourceColumnDefinition_To_v1beta1_CustomResourceColumnDefinition(in *apiextensions.CustomResourceColumnDefinition, out *CustomResourceColumnDefinition, s conversion.Scope) error { - out.Name = in.Name - out.Type = in.Type - out.Format = in.Format - out.Description = in.Description - out.Priority = in.Priority - out.JSONPath = in.JSONPath + *out = *(*CustomResourceColumnDefinition)(unsafe.Pointer(in)) return nil } @@ -373,12 +363,7 @@ func Convert_apiextensions_CustomResourceDefinition_To_v1beta1_CustomResourceDef } func autoConvert_v1beta1_CustomResourceDefinitionCondition_To_apiextensions_CustomResourceDefinitionCondition(in *CustomResourceDefinitionCondition, out *apiextensions.CustomResourceDefinitionCondition, s conversion.Scope) error { - out.Type = apiextensions.CustomResourceDefinitionConditionType(in.Type) - out.Status = apiextensions.ConditionStatus(in.Status) - out.LastTransitionTime = in.LastTransitionTime - out.Reason = in.Reason - out.Message = in.Message - out.ObservedGeneration = in.ObservedGeneration + *out = *(*apiextensions.CustomResourceDefinitionCondition)(unsafe.Pointer(in)) return nil } @@ -388,12 +373,7 @@ func Convert_v1beta1_CustomResourceDefinitionCondition_To_apiextensions_CustomRe } func autoConvert_apiextensions_CustomResourceDefinitionCondition_To_v1beta1_CustomResourceDefinitionCondition(in *apiextensions.CustomResourceDefinitionCondition, out *CustomResourceDefinitionCondition, s conversion.Scope) error { - out.Type = CustomResourceDefinitionConditionType(in.Type) - out.Status = ConditionStatus(in.Status) - out.LastTransitionTime = in.LastTransitionTime - out.Reason = in.Reason - out.Message = in.Message - out.ObservedGeneration = in.ObservedGeneration + *out = *(*CustomResourceDefinitionCondition)(unsafe.Pointer(in)) return nil } @@ -445,12 +425,7 @@ func Convert_apiextensions_CustomResourceDefinitionList_To_v1beta1_CustomResourc } func autoConvert_v1beta1_CustomResourceDefinitionNames_To_apiextensions_CustomResourceDefinitionNames(in *CustomResourceDefinitionNames, out *apiextensions.CustomResourceDefinitionNames, s conversion.Scope) error { - out.Plural = in.Plural - out.Singular = in.Singular - out.ShortNames = *(*[]string)(unsafe.Pointer(&in.ShortNames)) - out.Kind = in.Kind - out.ListKind = in.ListKind - out.Categories = *(*[]string)(unsafe.Pointer(&in.Categories)) + *out = *(*apiextensions.CustomResourceDefinitionNames)(unsafe.Pointer(in)) return nil } @@ -460,12 +435,7 @@ func Convert_v1beta1_CustomResourceDefinitionNames_To_apiextensions_CustomResour } func autoConvert_apiextensions_CustomResourceDefinitionNames_To_v1beta1_CustomResourceDefinitionNames(in *apiextensions.CustomResourceDefinitionNames, out *CustomResourceDefinitionNames, s conversion.Scope) error { - out.Plural = in.Plural - out.Singular = in.Singular - out.ShortNames = *(*[]string)(unsafe.Pointer(&in.ShortNames)) - out.Kind = in.Kind - out.ListKind = in.ListKind - out.Categories = *(*[]string)(unsafe.Pointer(&in.Categories)) + *out = *(*CustomResourceDefinitionNames)(unsafe.Pointer(in)) return nil } @@ -571,12 +541,7 @@ func Convert_apiextensions_CustomResourceDefinitionSpec_To_v1beta1_CustomResourc } func autoConvert_v1beta1_CustomResourceDefinitionStatus_To_apiextensions_CustomResourceDefinitionStatus(in *CustomResourceDefinitionStatus, out *apiextensions.CustomResourceDefinitionStatus, s conversion.Scope) error { - out.Conditions = *(*[]apiextensions.CustomResourceDefinitionCondition)(unsafe.Pointer(&in.Conditions)) - if err := Convert_v1beta1_CustomResourceDefinitionNames_To_apiextensions_CustomResourceDefinitionNames(&in.AcceptedNames, &out.AcceptedNames, s); err != nil { - return err - } - out.StoredVersions = *(*[]string)(unsafe.Pointer(&in.StoredVersions)) - out.ObservedGeneration = in.ObservedGeneration + *out = *(*apiextensions.CustomResourceDefinitionStatus)(unsafe.Pointer(in)) return nil } @@ -586,12 +551,7 @@ func Convert_v1beta1_CustomResourceDefinitionStatus_To_apiextensions_CustomResou } func autoConvert_apiextensions_CustomResourceDefinitionStatus_To_v1beta1_CustomResourceDefinitionStatus(in *apiextensions.CustomResourceDefinitionStatus, out *CustomResourceDefinitionStatus, s conversion.Scope) error { - out.Conditions = *(*[]CustomResourceDefinitionCondition)(unsafe.Pointer(&in.Conditions)) - if err := Convert_apiextensions_CustomResourceDefinitionNames_To_v1beta1_CustomResourceDefinitionNames(&in.AcceptedNames, &out.AcceptedNames, s); err != nil { - return err - } - out.StoredVersions = *(*[]string)(unsafe.Pointer(&in.StoredVersions)) - out.ObservedGeneration = in.ObservedGeneration + *out = *(*CustomResourceDefinitionStatus)(unsafe.Pointer(in)) return nil } @@ -653,9 +613,7 @@ func Convert_apiextensions_CustomResourceDefinitionVersion_To_v1beta1_CustomReso } func autoConvert_v1beta1_CustomResourceSubresourceScale_To_apiextensions_CustomResourceSubresourceScale(in *CustomResourceSubresourceScale, out *apiextensions.CustomResourceSubresourceScale, s conversion.Scope) error { - out.SpecReplicasPath = in.SpecReplicasPath - out.StatusReplicasPath = in.StatusReplicasPath - out.LabelSelectorPath = (*string)(unsafe.Pointer(in.LabelSelectorPath)) + *out = *(*apiextensions.CustomResourceSubresourceScale)(unsafe.Pointer(in)) return nil } @@ -665,9 +623,7 @@ func Convert_v1beta1_CustomResourceSubresourceScale_To_apiextensions_CustomResou } func autoConvert_apiextensions_CustomResourceSubresourceScale_To_v1beta1_CustomResourceSubresourceScale(in *apiextensions.CustomResourceSubresourceScale, out *CustomResourceSubresourceScale, s conversion.Scope) error { - out.SpecReplicasPath = in.SpecReplicasPath - out.StatusReplicasPath = in.StatusReplicasPath - out.LabelSelectorPath = (*string)(unsafe.Pointer(in.LabelSelectorPath)) + *out = *(*CustomResourceSubresourceScale)(unsafe.Pointer(in)) return nil } @@ -677,6 +633,7 @@ func Convert_apiextensions_CustomResourceSubresourceScale_To_v1beta1_CustomResou } func autoConvert_v1beta1_CustomResourceSubresourceStatus_To_apiextensions_CustomResourceSubresourceStatus(in *CustomResourceSubresourceStatus, out *apiextensions.CustomResourceSubresourceStatus, s conversion.Scope) error { + *out = *(*apiextensions.CustomResourceSubresourceStatus)(unsafe.Pointer(in)) return nil } @@ -686,6 +643,7 @@ func Convert_v1beta1_CustomResourceSubresourceStatus_To_apiextensions_CustomReso } func autoConvert_apiextensions_CustomResourceSubresourceStatus_To_v1beta1_CustomResourceSubresourceStatus(in *apiextensions.CustomResourceSubresourceStatus, out *CustomResourceSubresourceStatus, s conversion.Scope) error { + *out = *(*CustomResourceSubresourceStatus)(unsafe.Pointer(in)) return nil } @@ -695,8 +653,7 @@ func Convert_apiextensions_CustomResourceSubresourceStatus_To_v1beta1_CustomReso } func autoConvert_v1beta1_CustomResourceSubresources_To_apiextensions_CustomResourceSubresources(in *CustomResourceSubresources, out *apiextensions.CustomResourceSubresources, s conversion.Scope) error { - out.Status = (*apiextensions.CustomResourceSubresourceStatus)(unsafe.Pointer(in.Status)) - out.Scale = (*apiextensions.CustomResourceSubresourceScale)(unsafe.Pointer(in.Scale)) + *out = *(*apiextensions.CustomResourceSubresources)(unsafe.Pointer(in)) return nil } @@ -706,8 +663,7 @@ func Convert_v1beta1_CustomResourceSubresources_To_apiextensions_CustomResourceS } func autoConvert_apiextensions_CustomResourceSubresources_To_v1beta1_CustomResourceSubresources(in *apiextensions.CustomResourceSubresources, out *CustomResourceSubresources, s conversion.Scope) error { - out.Status = (*CustomResourceSubresourceStatus)(unsafe.Pointer(in.Status)) - out.Scale = (*CustomResourceSubresourceScale)(unsafe.Pointer(in.Scale)) + *out = *(*CustomResourceSubresources)(unsafe.Pointer(in)) return nil } @@ -753,8 +709,7 @@ func Convert_apiextensions_CustomResourceValidation_To_v1beta1_CustomResourceVal } func autoConvert_v1beta1_ExternalDocumentation_To_apiextensions_ExternalDocumentation(in *ExternalDocumentation, out *apiextensions.ExternalDocumentation, s conversion.Scope) error { - out.Description = in.Description - out.URL = in.URL + *out = *(*apiextensions.ExternalDocumentation)(unsafe.Pointer(in)) return nil } @@ -764,8 +719,7 @@ func Convert_v1beta1_ExternalDocumentation_To_apiextensions_ExternalDocumentatio } func autoConvert_apiextensions_ExternalDocumentation_To_v1beta1_ExternalDocumentation(in *apiextensions.ExternalDocumentation, out *ExternalDocumentation, s conversion.Scope) error { - out.Description = in.Description - out.URL = in.URL + *out = *(*ExternalDocumentation)(unsafe.Pointer(in)) return nil } @@ -1292,7 +1246,7 @@ func Convert_apiextensions_JSONSchemaPropsOrStringArray_To_v1beta1_JSONSchemaPro } func autoConvert_v1beta1_SelectableField_To_apiextensions_SelectableField(in *SelectableField, out *apiextensions.SelectableField, s conversion.Scope) error { - out.JSONPath = in.JSONPath + *out = *(*apiextensions.SelectableField)(unsafe.Pointer(in)) return nil } @@ -1302,7 +1256,7 @@ func Convert_v1beta1_SelectableField_To_apiextensions_SelectableField(in *Select } func autoConvert_apiextensions_SelectableField_To_v1beta1_SelectableField(in *apiextensions.SelectableField, out *SelectableField, s conversion.Scope) error { - out.JSONPath = in.JSONPath + *out = *(*SelectableField)(unsafe.Pointer(in)) return nil } @@ -1342,12 +1296,7 @@ func Convert_apiextensions_ServiceReference_To_v1beta1_ServiceReference(in *apie } func autoConvert_v1beta1_ValidationRule_To_apiextensions_ValidationRule(in *ValidationRule, out *apiextensions.ValidationRule, s conversion.Scope) error { - out.Rule = in.Rule - out.Message = in.Message - out.MessageExpression = in.MessageExpression - out.Reason = (*apiextensions.FieldValueErrorReason)(unsafe.Pointer(in.Reason)) - out.FieldPath = in.FieldPath - out.OptionalOldSelf = (*bool)(unsafe.Pointer(in.OptionalOldSelf)) + *out = *(*apiextensions.ValidationRule)(unsafe.Pointer(in)) return nil } @@ -1357,12 +1306,7 @@ func Convert_v1beta1_ValidationRule_To_apiextensions_ValidationRule(in *Validati } func autoConvert_apiextensions_ValidationRule_To_v1beta1_ValidationRule(in *apiextensions.ValidationRule, out *ValidationRule, s conversion.Scope) error { - out.Rule = in.Rule - out.Message = in.Message - out.MessageExpression = in.MessageExpression - out.Reason = (*FieldValueErrorReason)(unsafe.Pointer(in.Reason)) - out.FieldPath = in.FieldPath - out.OptionalOldSelf = (*bool)(unsafe.Pointer(in.OptionalOldSelf)) + *out = *(*ValidationRule)(unsafe.Pointer(in)) return nil } diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/validation/validation.go b/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/validation/validation.go index 89051e2af7..0775833f38 100644 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/validation/validation.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/validation/validation.go @@ -38,6 +38,7 @@ import ( structuraldefaulting "k8s.io/apiextensions-apiserver/pkg/apiserver/schema/defaulting" apiservervalidation "k8s.io/apiextensions-apiserver/pkg/apiserver/validation" apiequality "k8s.io/apimachinery/pkg/api/equality" + "k8s.io/apimachinery/pkg/api/operation" genericvalidation "k8s.io/apimachinery/pkg/api/validation" "k8s.io/apimachinery/pkg/util/sets" utilvalidation "k8s.io/apimachinery/pkg/util/validation" @@ -45,6 +46,8 @@ import ( celconfig "k8s.io/apiserver/pkg/apis/cel" apiservercel "k8s.io/apiserver/pkg/cel" "k8s.io/apiserver/pkg/cel/environment" + "k8s.io/apiserver/pkg/features" + utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/apiserver/pkg/util/webhook" ) @@ -71,7 +74,6 @@ var supportedValidationReason = sets.NewString( ) // ValidateCustomResourceDefinition statically validates -// context is passed for supporting context cancellation during cel validation when validating defaults func ValidateCustomResourceDefinition(ctx context.Context, obj *apiextensions.CustomResourceDefinition) field.ErrorList { nameValidationFn := func(name string, prefix bool) []string { ret := genericvalidation.NameIsDNSSubdomain(name, prefix) @@ -97,7 +99,7 @@ func ValidateCustomResourceDefinition(ctx context.Context, obj *apiextensions.Cu allowInvalidCABundle: true, } - allErrs := genericvalidation.ValidateObjectMeta(&obj.ObjectMeta, false, nameValidationFn, field.NewPath("metadata")) + allErrs := genericvalidation.ValidateObjectMetaDeclaratively(ctx, operation.Create, &obj.ObjectMeta, nil, false, nameValidationFn, field.NewPath("metadata"), utilfeature.DefaultFeatureGate.Enabled(features.DeclarativeValidationBeta)) allErrs = append(allErrs, validateCustomResourceDefinitionSpec(ctx, &obj.Spec, opts, field.NewPath("spec"))...) allErrs = append(allErrs, ValidateCustomResourceDefinitionStatus(&obj.Status, field.NewPath("status"))...) allErrs = append(allErrs, ValidateCustomResourceDefinitionStoredVersions(obj.Status.StoredVersions, obj.Spec.Versions, field.NewPath("status").Child("storedVersions"))...) @@ -248,7 +250,7 @@ func ValidateCustomResourceDefinitionUpdate(ctx context.Context, obj, oldObj *ap } func validateCustomResourceDefinitionUpdate(ctx context.Context, obj, oldObj *apiextensions.CustomResourceDefinition, opts validationOptions) field.ErrorList { - allErrs := genericvalidation.ValidateObjectMetaUpdate(&obj.ObjectMeta, &oldObj.ObjectMeta, field.NewPath("metadata")) + allErrs := genericvalidation.ValidateObjectMetaDeclaratively(ctx, operation.Update, &obj.ObjectMeta, &oldObj.ObjectMeta, false, nil, field.NewPath("metadata"), utilfeature.DefaultFeatureGate.Enabled(features.DeclarativeValidationBeta)) allErrs = append(allErrs, validateCustomResourceDefinitionSpecUpdate(ctx, &obj.Spec, &oldObj.Spec, opts, field.NewPath("spec"))...) allErrs = append(allErrs, ValidateCustomResourceDefinitionStatus(&obj.Status, field.NewPath("status"))...) allErrs = append(allErrs, ValidateCustomResourceDefinitionStoredVersions(obj.Status.StoredVersions, obj.Spec.Versions, field.NewPath("status").Child("storedVersions"))...) @@ -284,9 +286,9 @@ func ValidateCustomResourceDefinitionStoredVersions(storedVersions []string, ver return allErrs } -// ValidateUpdateCustomResourceDefinitionStatus statically validates -func ValidateUpdateCustomResourceDefinitionStatus(obj, oldObj *apiextensions.CustomResourceDefinition) field.ErrorList { - allErrs := genericvalidation.ValidateObjectMetaUpdate(&obj.ObjectMeta, &oldObj.ObjectMeta, field.NewPath("metadata")) +// ValidateUpdateCustomResourceDefinitionStatus statically validates custom resource definition status update. +func ValidateUpdateCustomResourceDefinitionStatus(ctx context.Context, obj, oldObj *apiextensions.CustomResourceDefinition) field.ErrorList { + allErrs := genericvalidation.ValidateObjectMetaDeclaratively(ctx, operation.Update, &obj.ObjectMeta, &oldObj.ObjectMeta, false, nil, field.NewPath("metadata"), utilfeature.DefaultFeatureGate.Enabled(features.DeclarativeValidationBeta)) allErrs = append(allErrs, ValidateCustomResourceDefinitionStatus(&obj.Status, field.NewPath("status"))...) return allErrs } diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel/model/schemas.go b/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel/model/schemas.go index f1c5ad9e9b..1a548e2c6b 100644 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel/model/schemas.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel/model/schemas.go @@ -17,6 +17,7 @@ limitations under the License. package model import ( + apimachineryvalidation "k8s.io/apimachinery/pkg/util/validation" apiservercel "k8s.io/apiserver/pkg/cel" "k8s.io/apiserver/pkg/cel/common" @@ -62,14 +63,32 @@ func WithTypeAndObjectMeta(s *schema.Structural) *schema.Structural { stringType := schema.Structural{Generic: schema.Generic{Type: "string"}} props["kind"] = stringType props["apiVersion"] = stringType + metadataProps := s.Properties["metadata"].Properties props["metadata"] = schema.Structural{ Generic: schema.Generic{Type: "object"}, Properties: map[string]schema.Structural{ - "name": stringType, - "generateName": stringType, + "name": cappedLengthStringType(metadataProps["name"], nameMaxLength), + "generateName": cappedLengthStringType(metadataProps["generateName"], nameMaxLength-1), // The generated suffix is at least 1 byte }, } result.Properties = props return result } + +// nameMaxLength is the default maxLength applied to metadata.name. +const nameMaxLength = int64(apimachineryvalidation.DNS1123SubdomainMaxLength) + +// cappedLengthStringType returns a string type whose max length is capped at maxLength, +// using the existing schema's maxLength instead when it is shorter. +func cappedLengthStringType(existing schema.Structural, maxLength int64) schema.Structural { + if existing.ValueValidation != nil && existing.ValueValidation.MaxLength != nil { + if *existing.ValueValidation.MaxLength < maxLength { + maxLength = *existing.ValueValidation.MaxLength + } + } + return schema.Structural{ + Generic: schema.Generic{Type: "string"}, + ValueValidation: &schema.ValueValidation{MaxLength: &maxLength}, + } +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/defaulting/validation.go b/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/defaulting/validation.go index e529d5a3eb..830df17be9 100644 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/defaulting/validation.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/defaulting/validation.go @@ -87,7 +87,7 @@ func validate(ctx context.Context, pth *field.Path, s *structuralschema.Structur // check ObjectMeta/TypeMeta and everything else if err := schemaobjectmeta.Coerce(nil, obj, rootSchema, true, false); err != nil { allErrs = append(allErrs, field.Invalid(pth.Child("default"), s.Default.Object, fmt.Sprintf("must result in valid metadata: %v", err))) - } else if errs := schemaobjectmeta.Validate(nil, obj, rootSchema, true); len(errs) > 0 { + } else if errs := schemaobjectmeta.Validate(ctx, nil, obj, rootSchema, true); len(errs) > 0 { allErrs = append(allErrs, field.Invalid(pth.Child("default"), s.Default.Object, fmt.Sprintf("must result in valid metadata: %v", errs.ToAggregate()))) } else if errs := apiservervalidation.ValidateCustomResource(pth.Child("default"), s.Default.Object, validator); len(errs) > 0 { allErrs = append(allErrs, errs...) @@ -131,7 +131,7 @@ func validate(ctx context.Context, pth *field.Path, s *structuralschema.Structur // check ObjectMeta/TypeMeta and everything else if err := schemaobjectmeta.Coerce(pth.Child("default"), s.Default.Object, s, s.XEmbeddedResource, false); err != nil { allErrs = append(allErrs, err) - } else if errs := schemaobjectmeta.Validate(pth.Child("default"), s.Default.Object, s, s.XEmbeddedResource); len(errs) > 0 { + } else if errs := schemaobjectmeta.Validate(ctx, pth.Child("default"), s.Default.Object, s, s.XEmbeddedResource); len(errs) > 0 { allErrs = append(allErrs, errs...) } else if errs := apiservervalidation.ValidateCustomResource(pth.Child("default"), s.Default.Object, validator); len(errs) > 0 { allErrs = append(allErrs, errs...) diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/objectmeta/validation.go b/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/objectmeta/validation.go index ce4a6036d3..b0999261e7 100644 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/objectmeta/validation.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/objectmeta/validation.go @@ -17,19 +17,23 @@ limitations under the License. package objectmeta import ( + "context" "strings" structuralschema "k8s.io/apiextensions-apiserver/pkg/apiserver/schema" + "k8s.io/apimachinery/pkg/api/operation" "k8s.io/apimachinery/pkg/api/validate/content" metavalidation "k8s.io/apimachinery/pkg/api/validation" "k8s.io/apimachinery/pkg/runtime/schema" utilvalidation "k8s.io/apimachinery/pkg/util/validation" "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/apiserver/pkg/features" + utilfeature "k8s.io/apiserver/pkg/util/feature" ) // Validate validates embedded ObjectMeta and TypeMeta. // It also validate those at the root if isResourceRoot is true. -func Validate(pth *field.Path, obj interface{}, s *structuralschema.Structural, isResourceRoot bool) field.ErrorList { +func Validate(ctx context.Context, pth *field.Path, obj interface{}, s *structuralschema.Structural, isResourceRoot bool) field.ErrorList { if isResourceRoot { if s == nil { s = &structuralschema.Structural{} @@ -40,10 +44,10 @@ func Validate(pth *field.Path, obj interface{}, s *structuralschema.Structural, s = &clone } } - return validate(pth, obj, s) + return validate(ctx, pth, obj, s) } -func validate(pth *field.Path, x interface{}, s *structuralschema.Structural) field.ErrorList { +func validate(ctx context.Context, pth *field.Path, x interface{}, s *structuralschema.Structural) field.ErrorList { if s == nil { return nil } @@ -53,20 +57,20 @@ func validate(pth *field.Path, x interface{}, s *structuralschema.Structural) fi switch x := x.(type) { case map[string]interface{}: if s.XEmbeddedResource { - allErrs = append(allErrs, validateEmbeddedResource(pth, x, s)...) + allErrs = append(allErrs, validateEmbeddedResource(ctx, pth, x, s)...) } for k, v := range x { prop, ok := s.Properties[k] if ok { - allErrs = append(allErrs, validate(pth.Child(k), v, &prop)...) + allErrs = append(allErrs, validate(ctx, pth.Child(k), v, &prop)...) } else if s.AdditionalProperties != nil { - allErrs = append(allErrs, validate(pth.Key(k), v, s.AdditionalProperties.Structural)...) + allErrs = append(allErrs, validate(ctx, pth.Key(k), v, s.AdditionalProperties.Structural)...) } } case []interface{}: for i, v := range x { - allErrs = append(allErrs, validate(pth.Index(i), v, s.Items)...) + allErrs = append(allErrs, validate(ctx, pth.Index(i), v, s.Items)...) } default: // scalars, do nothing @@ -82,7 +86,7 @@ func validatePathSegment(name string, prefix bool) []string { return content.IsPathSegmentName(name) } -func validateEmbeddedResource(pth *field.Path, x map[string]interface{}, s *structuralschema.Structural) field.ErrorList { +func validateEmbeddedResource(ctx context.Context, pth *field.Path, x map[string]interface{}, s *structuralschema.Structural) field.ErrorList { var allErrs field.ErrorList // require apiVersion and kind, but not metadata @@ -119,7 +123,7 @@ func validateEmbeddedResource(pth *field.Path, x map[string]interface{}, s *stru if len(meta.Name) == 0 { meta.Name = "fakename" // we have to set something to avoid an error } - allErrs = append(allErrs, metavalidation.ValidateObjectMeta(meta, len(meta.Namespace) > 0, validatePathSegment, pth.Child("metadata"))...) + allErrs = append(allErrs, metavalidation.ValidateObjectMetaDeclaratively(ctx, operation.Create, meta, nil, len(meta.Namespace) > 0, validatePathSegment, pth.Child("metadata"), utilfeature.DefaultFeatureGate.Enabled(features.DeclarativeValidationBeta))...) } } } diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver/validation/metrics.go b/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver/validation/metrics.go index 7dcc7938e0..b5920af68f 100644 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver/validation/metrics.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver/validation/metrics.go @@ -17,6 +17,7 @@ limitations under the License. package validation import ( + "sync" "time" "k8s.io/component-base/metrics" @@ -45,8 +46,15 @@ var Metrics ValidationMetrics = &validationMetrics{ }), } -func init() { - legacyregistry.MustRegister(Metrics.(*validationMetrics).RatchetingTime) +var registerMetricsOnce sync.Once + +// RegisterMetrics registers the validation metrics with the legacy registry. It is invoked when the validation +// metrics are installed into the handler chain (rather than from an init() function), so that metric feature gates +// such as NativeHistograms have been applied before these histogram metrics are created. +func RegisterMetrics() { + registerMetricsOnce.Do(func() { + legacyregistry.MustRegister(Metrics.(*validationMetrics).RatchetingTime) + }) } type validationMetrics struct { diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinition.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinition.go index 4884c25237..0fd3d5369d 100644 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinition.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinition.go @@ -19,8 +19,11 @@ limitations under the License. package v1 import ( + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + internal "k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/internal" apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" metav1 "k8s.io/client-go/applyconfigurations/meta/v1" ) @@ -30,7 +33,7 @@ import ( // CustomResourceDefinition represents a resource that should be exposed on the API server. Its name MUST be in the format // <.spec.name>.<.spec.group>. type CustomResourceDefinitionApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` @@ -50,6 +53,46 @@ func CustomResourceDefinition(name string) *CustomResourceDefinitionApplyConfigu return b } +// ExtractCustomResourceDefinitionFrom extracts the applied configuration owned by fieldManager from +// customResourceDefinition for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// customResourceDefinition must be a unmodified CustomResourceDefinition API object that was retrieved from the Kubernetes API. +// ExtractCustomResourceDefinitionFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractCustomResourceDefinitionFrom(customResourceDefinition *apiextensionsv1.CustomResourceDefinition, fieldManager string, subresource string) (*CustomResourceDefinitionApplyConfiguration, error) { + b := &CustomResourceDefinitionApplyConfiguration{} + err := managedfields.ExtractInto(customResourceDefinition, internal.Parser().Type("io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinition"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(customResourceDefinition.Name) + + b.WithKind("CustomResourceDefinition") + b.WithAPIVersion("apiextensions.k8s.io/v1") + return b, nil +} + +// ExtractCustomResourceDefinition extracts the applied configuration owned by fieldManager from +// customResourceDefinition. If no managedFields are found in customResourceDefinition for fieldManager, a +// CustomResourceDefinitionApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// customResourceDefinition must be a unmodified CustomResourceDefinition API object that was retrieved from the Kubernetes API. +// ExtractCustomResourceDefinition provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractCustomResourceDefinition(customResourceDefinition *apiextensionsv1.CustomResourceDefinition, fieldManager string) (*CustomResourceDefinitionApplyConfiguration, error) { + return ExtractCustomResourceDefinitionFrom(customResourceDefinition, fieldManager, "") +} + +// ExtractCustomResourceDefinitionStatus extracts the applied configuration owned by fieldManager from +// customResourceDefinition for the status subresource. +func ExtractCustomResourceDefinitionStatus(customResourceDefinition *apiextensionsv1.CustomResourceDefinition, fieldManager string) (*CustomResourceDefinitionApplyConfiguration, error) { + return ExtractCustomResourceDefinitionFrom(customResourceDefinition, fieldManager, "status") +} + func (b CustomResourceDefinitionApplyConfiguration) IsApplyConfiguration() {} // WithKind sets the Kind field in the declarative configuration to the given value diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinition.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinition.go index 4838dafcb6..19a7711af1 100644 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinition.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinition.go @@ -19,8 +19,11 @@ limitations under the License. package v1beta1 import ( + apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + internal "k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/internal" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) @@ -31,7 +34,7 @@ import ( // <.spec.name>.<.spec.group>. // Deprecated in v1.16, planned for removal in v1.22. Use apiextensions.k8s.io/v1 CustomResourceDefinition instead. type CustomResourceDefinitionApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` @@ -51,6 +54,46 @@ func CustomResourceDefinition(name string) *CustomResourceDefinitionApplyConfigu return b } +// ExtractCustomResourceDefinitionFrom extracts the applied configuration owned by fieldManager from +// customResourceDefinition for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// customResourceDefinition must be a unmodified CustomResourceDefinition API object that was retrieved from the Kubernetes API. +// ExtractCustomResourceDefinitionFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractCustomResourceDefinitionFrom(customResourceDefinition *apiextensionsv1beta1.CustomResourceDefinition, fieldManager string, subresource string) (*CustomResourceDefinitionApplyConfiguration, error) { + b := &CustomResourceDefinitionApplyConfiguration{} + err := managedfields.ExtractInto(customResourceDefinition, internal.Parser().Type("io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinition"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(customResourceDefinition.Name) + + b.WithKind("CustomResourceDefinition") + b.WithAPIVersion("apiextensions.k8s.io/v1beta1") + return b, nil +} + +// ExtractCustomResourceDefinition extracts the applied configuration owned by fieldManager from +// customResourceDefinition. If no managedFields are found in customResourceDefinition for fieldManager, a +// CustomResourceDefinitionApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// customResourceDefinition must be a unmodified CustomResourceDefinition API object that was retrieved from the Kubernetes API. +// ExtractCustomResourceDefinition provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractCustomResourceDefinition(customResourceDefinition *apiextensionsv1beta1.CustomResourceDefinition, fieldManager string) (*CustomResourceDefinitionApplyConfiguration, error) { + return ExtractCustomResourceDefinitionFrom(customResourceDefinition, fieldManager, "") +} + +// ExtractCustomResourceDefinitionStatus extracts the applied configuration owned by fieldManager from +// customResourceDefinition for the status subresource. +func ExtractCustomResourceDefinitionStatus(customResourceDefinition *apiextensionsv1beta1.CustomResourceDefinition, fieldManager string) (*CustomResourceDefinitionApplyConfiguration, error) { + return ExtractCustomResourceDefinitionFrom(customResourceDefinition, fieldManager, "status") +} + func (b CustomResourceDefinitionApplyConfiguration) IsApplyConfiguration() {} // WithKind sets the Kind field in the declarative configuration to the given value diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/internal/internal.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/internal/internal.go index c482faa5c2..04927b8351 100644 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/internal/internal.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/internal/internal.go @@ -39,6 +39,1194 @@ func Parser() *typed.Parser { var parserOnce sync.Once var parser *typed.Parser var schemaYAML = typed.YAMLObject(`types: +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceColumnDefinition + map: + fields: + - name: description + type: + scalar: string + - name: format + type: + scalar: string + - name: jsonPath + type: + scalar: string + default: "" + - name: name + type: + scalar: string + default: "" + - name: priority + type: + scalar: numeric + - name: type + type: + scalar: string + default: "" +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceConversion + map: + fields: + - name: strategy + type: + scalar: string + default: "" + - name: webhook + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.WebhookConversion +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinition + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionSpec + default: {} + - name: status + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionStatus + default: {} +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionCondition + map: + fields: + - name: lastTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: message + type: + scalar: string + - name: observedGeneration + type: + scalar: numeric + - name: reason + type: + scalar: string + - name: status + type: + scalar: string + default: "" + - name: type + type: + scalar: string + default: "" +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionNames + map: + fields: + - name: categories + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: kind + type: + scalar: string + default: "" + - name: listKind + type: + scalar: string + - name: plural + type: + scalar: string + default: "" + - name: shortNames + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: singular + type: + scalar: string +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionSpec + map: + fields: + - name: conversion + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceConversion + - name: group + type: + scalar: string + default: "" + - name: names + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionNames + default: {} + - name: preserveUnknownFields + type: + scalar: boolean + - name: scope + type: + scalar: string + default: "" + - name: versions + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionVersion + elementRelationship: atomic +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionStatus + map: + fields: + - name: acceptedNames + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionNames + default: {} + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionCondition + elementRelationship: associative + keys: + - type + - name: observedGeneration + type: + scalar: numeric + - name: storedVersions + type: + list: + elementType: + scalar: string + elementRelationship: atomic +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionVersion + map: + fields: + - name: additionalPrinterColumns + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceColumnDefinition + elementRelationship: atomic + - name: deprecated + type: + scalar: boolean + - name: deprecationWarning + type: + scalar: string + - name: name + type: + scalar: string + default: "" + - name: schema + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceValidation + - name: selectableFields + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.SelectableField + elementRelationship: atomic + - name: served + type: + scalar: boolean + default: false + - name: storage + type: + scalar: boolean + default: false + - name: subresources + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceSubresources +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceSubresourceScale + map: + fields: + - name: labelSelectorPath + type: + scalar: string + - name: specReplicasPath + type: + scalar: string + default: "" + - name: statusReplicasPath + type: + scalar: string + default: "" +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceSubresourceStatus + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceSubresources + map: + fields: + - name: scale + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceSubresourceScale + - name: status + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceSubresourceStatus +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceValidation + map: + fields: + - name: openAPIV3Schema + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaProps +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.ExternalDocumentation + map: + fields: + - name: description + type: + scalar: string + - name: url + type: + scalar: string +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSON + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaProps + map: + fields: + - name: $ref + type: + scalar: string + - name: $schema + type: + scalar: string + - name: additionalItems + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrBool + - name: additionalProperties + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrBool + - name: allOf + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaProps + elementRelationship: atomic + - name: anyOf + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaProps + elementRelationship: atomic + - name: default + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSON + - name: definitions + type: + map: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaProps + - name: dependencies + type: + map: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrStringArray + - name: description + type: + scalar: string + - name: enum + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSON + elementRelationship: atomic + - name: example + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSON + - name: exclusiveMaximum + type: + scalar: boolean + - name: exclusiveMinimum + type: + scalar: boolean + - name: externalDocs + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.ExternalDocumentation + - name: format + type: + scalar: string + - name: id + type: + scalar: string + - name: items + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrArray + - name: maxItems + type: + scalar: numeric + - name: maxLength + type: + scalar: numeric + - name: maxProperties + type: + scalar: numeric + - name: maximum + type: + scalar: numeric + - name: minItems + type: + scalar: numeric + - name: minLength + type: + scalar: numeric + - name: minProperties + type: + scalar: numeric + - name: minimum + type: + scalar: numeric + - name: multipleOf + type: + scalar: numeric + - name: not + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaProps + - name: nullable + type: + scalar: boolean + - name: oneOf + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaProps + elementRelationship: atomic + - name: pattern + type: + scalar: string + - name: patternProperties + type: + map: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaProps + - name: properties + type: + map: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaProps + - name: required + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: title + type: + scalar: string + - name: type + type: + scalar: string + - name: uniqueItems + type: + scalar: boolean + - name: x-kubernetes-embedded-resource + type: + scalar: boolean + - name: x-kubernetes-int-or-string + type: + scalar: boolean + - name: x-kubernetes-list-map-keys + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: x-kubernetes-list-type + type: + scalar: string + - name: x-kubernetes-map-type + type: + scalar: string + - name: x-kubernetes-preserve-unknown-fields + type: + scalar: boolean + - name: x-kubernetes-validations + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.ValidationRule + elementRelationship: associative + keys: + - rule +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrArray + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrBool + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrStringArray + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.SelectableField + map: + fields: + - name: jsonPath + type: + scalar: string + default: "" +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.ServiceReference + map: + fields: + - name: name + type: + scalar: string + default: "" + - name: namespace + type: + scalar: string + default: "" + - name: path + type: + scalar: string + - name: port + type: + scalar: numeric +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.ValidationRule + map: + fields: + - name: fieldPath + type: + scalar: string + - name: message + type: + scalar: string + - name: messageExpression + type: + scalar: string + - name: optionalOldSelf + type: + scalar: boolean + - name: reason + type: + scalar: string + - name: rule + type: + scalar: string + default: "" +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.WebhookClientConfig + map: + fields: + - name: caBundle + type: + scalar: string + - name: service + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.ServiceReference + - name: url + type: + scalar: string +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.WebhookConversion + map: + fields: + - name: clientConfig + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.WebhookClientConfig + - name: conversionReviewVersions + type: + list: + elementType: + scalar: string + elementRelationship: atomic +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceColumnDefinition + map: + fields: + - name: JSONPath + type: + scalar: string + default: "" + - name: description + type: + scalar: string + - name: format + type: + scalar: string + - name: name + type: + scalar: string + default: "" + - name: priority + type: + scalar: numeric + - name: type + type: + scalar: string + default: "" +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceConversion + map: + fields: + - name: conversionReviewVersions + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: strategy + type: + scalar: string + default: "" + - name: webhookClientConfig + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.WebhookClientConfig +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinition + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinitionSpec + default: {} + - name: status + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinitionStatus + default: {} +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinitionCondition + map: + fields: + - name: lastTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: message + type: + scalar: string + - name: observedGeneration + type: + scalar: numeric + - name: reason + type: + scalar: string + - name: status + type: + scalar: string + default: "" + - name: type + type: + scalar: string + default: "" +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinitionNames + map: + fields: + - name: categories + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: kind + type: + scalar: string + default: "" + - name: listKind + type: + scalar: string + - name: plural + type: + scalar: string + default: "" + - name: shortNames + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: singular + type: + scalar: string +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinitionSpec + map: + fields: + - name: additionalPrinterColumns + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceColumnDefinition + elementRelationship: atomic + - name: conversion + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceConversion + - name: group + type: + scalar: string + default: "" + - name: names + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinitionNames + default: {} + - name: preserveUnknownFields + type: + scalar: boolean + - name: scope + type: + scalar: string + default: "" + - name: selectableFields + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.SelectableField + elementRelationship: atomic + - name: subresources + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceSubresources + - name: validation + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceValidation + - name: version + type: + scalar: string + - name: versions + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinitionVersion + elementRelationship: atomic +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinitionStatus + map: + fields: + - name: acceptedNames + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinitionNames + default: {} + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinitionCondition + elementRelationship: associative + keys: + - type + - name: observedGeneration + type: + scalar: numeric + - name: storedVersions + type: + list: + elementType: + scalar: string + elementRelationship: atomic +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinitionVersion + map: + fields: + - name: additionalPrinterColumns + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceColumnDefinition + elementRelationship: atomic + - name: deprecated + type: + scalar: boolean + - name: deprecationWarning + type: + scalar: string + - name: name + type: + scalar: string + default: "" + - name: schema + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceValidation + - name: selectableFields + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.SelectableField + elementRelationship: atomic + - name: served + type: + scalar: boolean + default: false + - name: storage + type: + scalar: boolean + default: false + - name: subresources + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceSubresources +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceSubresourceScale + map: + fields: + - name: labelSelectorPath + type: + scalar: string + - name: specReplicasPath + type: + scalar: string + default: "" + - name: statusReplicasPath + type: + scalar: string + default: "" +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceSubresourceStatus + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceSubresources + map: + fields: + - name: scale + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceSubresourceScale + - name: status + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceSubresourceStatus +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceValidation + map: + fields: + - name: openAPIV3Schema + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.ExternalDocumentation + map: + fields: + - name: description + type: + scalar: string + - name: url + type: + scalar: string +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSON + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps + map: + fields: + - name: $ref + type: + scalar: string + - name: $schema + type: + scalar: string + - name: additionalItems + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrBool + - name: additionalProperties + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrBool + - name: allOf + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps + elementRelationship: atomic + - name: anyOf + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps + elementRelationship: atomic + - name: default + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSON + - name: definitions + type: + map: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps + - name: dependencies + type: + map: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrStringArray + - name: description + type: + scalar: string + - name: enum + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSON + elementRelationship: atomic + - name: example + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSON + - name: exclusiveMaximum + type: + scalar: boolean + - name: exclusiveMinimum + type: + scalar: boolean + - name: externalDocs + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.ExternalDocumentation + - name: format + type: + scalar: string + - name: id + type: + scalar: string + - name: items + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrArray + - name: maxItems + type: + scalar: numeric + - name: maxLength + type: + scalar: numeric + - name: maxProperties + type: + scalar: numeric + - name: maximum + type: + scalar: numeric + - name: minItems + type: + scalar: numeric + - name: minLength + type: + scalar: numeric + - name: minProperties + type: + scalar: numeric + - name: minimum + type: + scalar: numeric + - name: multipleOf + type: + scalar: numeric + - name: not + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps + - name: nullable + type: + scalar: boolean + - name: oneOf + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps + elementRelationship: atomic + - name: pattern + type: + scalar: string + - name: patternProperties + type: + map: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps + - name: properties + type: + map: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps + - name: required + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: title + type: + scalar: string + - name: type + type: + scalar: string + - name: uniqueItems + type: + scalar: boolean + - name: x-kubernetes-embedded-resource + type: + scalar: boolean + - name: x-kubernetes-int-or-string + type: + scalar: boolean + - name: x-kubernetes-list-map-keys + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: x-kubernetes-list-type + type: + scalar: string + - name: x-kubernetes-map-type + type: + scalar: string + - name: x-kubernetes-preserve-unknown-fields + type: + scalar: boolean + - name: x-kubernetes-validations + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.ValidationRule + elementRelationship: associative + keys: + - rule +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrArray + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrBool + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrStringArray + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.SelectableField + map: + fields: + - name: jsonPath + type: + scalar: string + default: "" +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.ServiceReference + map: + fields: + - name: name + type: + scalar: string + default: "" + - name: namespace + type: + scalar: string + default: "" + - name: path + type: + scalar: string + - name: port + type: + scalar: numeric +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.ValidationRule + map: + fields: + - name: fieldPath + type: + scalar: string + - name: message + type: + scalar: string + - name: messageExpression + type: + scalar: string + - name: optionalOldSelf + type: + scalar: boolean + - name: reason + type: + scalar: string + - name: rule + type: + scalar: string + default: "" +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.WebhookClientConfig + map: + fields: + - name: caBundle + type: + scalar: string + - name: service + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.ServiceReference + - name: url + type: + scalar: string +- name: io.k8s.apimachinery.pkg.apis.meta.v1.FieldsV1 + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.apimachinery.pkg.apis.meta.v1.ManagedFieldsEntry + map: + fields: + - name: apiVersion + type: + scalar: string + - name: fieldsType + type: + scalar: string + - name: fieldsV1 + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.FieldsV1 + - name: manager + type: + scalar: string + - name: operation + type: + scalar: string + - name: subresource + type: + scalar: string + - name: time + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time +- name: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + map: + fields: + - name: annotations + type: + map: + elementType: + scalar: string + - name: creationTimestamp + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: deletionGracePeriodSeconds + type: + scalar: numeric + - name: deletionTimestamp + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: finalizers + type: + list: + elementType: + scalar: string + elementRelationship: associative + - name: generateName + type: + scalar: string + - name: generation + type: + scalar: numeric + - name: labels + type: + map: + elementType: + scalar: string + - name: managedFields + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ManagedFieldsEntry + elementRelationship: atomic + - name: name + type: + scalar: string + - name: namespace + type: + scalar: string + - name: ownerReferences + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.OwnerReference + elementRelationship: associative + keys: + - uid + - name: resourceVersion + type: + scalar: string + - name: selfLink + type: + scalar: string + - name: uid + type: + scalar: string +- name: io.k8s.apimachinery.pkg.apis.meta.v1.OwnerReference + map: + fields: + - name: apiVersion + type: + scalar: string + default: "" + - name: blockOwnerDeletion + type: + scalar: boolean + - name: controller + type: + scalar: boolean + - name: kind + type: + scalar: string + default: "" + - name: name + type: + scalar: string + default: "" + - name: uid + type: + scalar: string + default: "" + elementRelationship: atomic +- name: io.k8s.apimachinery.pkg.apis.meta.v1.Time + scalar: untyped - name: __untyped_atomic_ scalar: untyped list: diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/clientset.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/clientset.go index 93dd79d63f..8e13f11bb7 100644 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/clientset.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/clientset.go @@ -30,7 +30,7 @@ import ( ) type Interface interface { - Discovery() discovery.DiscoveryInterface + Discovery() discovery.DiscoveryInterfaces ApiextensionsV1() apiextensionsv1.ApiextensionsV1Interface ApiextensionsV1beta1() apiextensionsv1beta1.ApiextensionsV1beta1Interface } @@ -53,7 +53,7 @@ func (c *Clientset) ApiextensionsV1beta1() apiextensionsv1beta1.ApiextensionsV1b } // Discovery retrieves the DiscoveryClient -func (c *Clientset) Discovery() discovery.DiscoveryInterface { +func (c *Clientset) Discovery() discovery.DiscoveryInterfaces { if c == nil { return nil } diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/fake/clientset_generated.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/fake/clientset_generated.go index 052739600a..b76c1d1013 100644 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/fake/clientset_generated.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/fake/clientset_generated.go @@ -74,7 +74,7 @@ type Clientset struct { tracker testing.ObjectTracker } -func (c *Clientset) Discovery() discovery.DiscoveryInterface { +func (c *Clientset) Discovery() discovery.DiscoveryInterfaces { return c.discovery } diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/interfaces.go b/vendor/k8s.io/apimachinery/pkg/api/meta/interfaces.go index a35ce3bd0a..628187eeeb 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/meta/interfaces.go +++ b/vendor/k8s.io/apimachinery/pkg/api/meta/interfaces.go @@ -17,6 +17,8 @@ limitations under the License. package meta import ( + "context" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" @@ -109,7 +111,9 @@ type RESTMapping struct { // to API groups. In other words, kinds and resources should not be assumed to be // unique across groups. // -// TODO: split into sub-interfaces +// RESTMapperWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use RESTMapperWithContext instead. type RESTMapper interface { // KindFor takes a partial resource and returns the single match. Returns an error if there are multiple matches KindFor(resource schema.GroupVersionResource) (schema.GroupVersionKind, error) @@ -133,11 +137,114 @@ type RESTMapper interface { ResourceSingularizer(resource string) (singular string, err error) } +// RESTMapperWithContext allows clients to map resources to kind, and map kind and version +// to interfaces for manipulating those objects. It is primarily intended for +// consumers of Kubernetes compatible REST APIs as defined in docs/devel/api-conventions.md. +// +// The Kubernetes API provides versioned resources and object kinds which are scoped +// to API groups. In other words, kinds and resources should not be assumed to be +// unique across groups. +type RESTMapperWithContext interface { + // KindFor takes a partial resource and returns the single match. Returns an error if there are multiple matches + KindForWithContext(ctx context.Context, resource schema.GroupVersionResource) (schema.GroupVersionKind, error) + + // KindsFor takes a partial resource and returns the list of potential kinds in priority order + KindsForWithContext(ctx context.Context, resource schema.GroupVersionResource) ([]schema.GroupVersionKind, error) + + // ResourceFor takes a partial resource and returns the single match. Returns an error if there are multiple matches + ResourceForWithContext(ctx context.Context, input schema.GroupVersionResource) (schema.GroupVersionResource, error) + + // ResourcesFor takes a partial resource and returns the list of potential resource in priority order + ResourcesForWithContext(ctx context.Context, input schema.GroupVersionResource) ([]schema.GroupVersionResource, error) + + // RESTMapping identifies a preferred resource mapping for the provided group kind. + RESTMappingWithContext(ctx context.Context, gk schema.GroupKind, versions ...string) (*RESTMapping, error) + // RESTMappings returns all resource mappings for the provided group kind if no + // version search is provided. Otherwise identifies a preferred resource mapping for + // the provided version(s). + RESTMappingsWithContext(ctx context.Context, gk schema.GroupKind, versions ...string) ([]*RESTMapping, error) + + ResourceSingularizerWithContext(ctx context.Context, resource string) (singular string, err error) +} + +func ToRESTMapperWithContext(m RESTMapper) RESTMapperWithContext { + if m == nil { + return nil + } + if m, ok := m.(RESTMapperWithContext); ok { + return m + } + return &restMapperWrapper{ + delegate: m, + } +} + +type restMapperWrapper struct { + delegate RESTMapper +} + +func (m *restMapperWrapper) KindForWithContext(ctx context.Context, resource schema.GroupVersionResource) (schema.GroupVersionKind, error) { + return m.delegate.KindFor(resource) +} +func (m *restMapperWrapper) KindsForWithContext(ctx context.Context, resource schema.GroupVersionResource) ([]schema.GroupVersionKind, error) { + return m.delegate.KindsFor(resource) +} +func (m *restMapperWrapper) ResourceForWithContext(ctx context.Context, input schema.GroupVersionResource) (schema.GroupVersionResource, error) { + return m.delegate.ResourceFor(input) +} +func (m *restMapperWrapper) ResourcesForWithContext(ctx context.Context, input schema.GroupVersionResource) ([]schema.GroupVersionResource, error) { + return m.delegate.ResourcesFor(input) +} +func (m *restMapperWrapper) RESTMappingWithContext(ctx context.Context, gk schema.GroupKind, versions ...string) (*RESTMapping, error) { + return m.delegate.RESTMapping(gk, versions...) +} +func (m *restMapperWrapper) RESTMappingsWithContext(ctx context.Context, gk schema.GroupKind, versions ...string) ([]*RESTMapping, error) { + return m.delegate.RESTMappings(gk, versions...) +} +func (m *restMapperWrapper) ResourceSingularizerWithContext(ctx context.Context, resource string) (singular string, err error) { + return m.delegate.ResourceSingularizer(resource) +} + // ResettableRESTMapper is a RESTMapper which is capable of resetting itself // from discovery. // All rest mappers that delegate to other rest mappers must implement this interface and dynamically // check if the delegate mapper supports the Reset() operation. +// +// ResettableRESTMapperWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ResettableRESTMapperWithContext instead. type ResettableRESTMapper interface { RESTMapper Reset() } + +// ResettableRESTMapperWithContext is a RESTMapper which is capable of resetting itself +// from discovery. +// All rest mappers that delegate to other rest mappers must implement this interface and dynamically +// check if the delegate mapper supports the ResetWithContext() operation. +type ResettableRESTMapperWithContext interface { + RESTMapperWithContext + ResetWithContext(ctx context.Context) +} + +func ToResettableRESTMapperWithContext(m ResettableRESTMapper) ResettableRESTMapperWithContext { + if m == nil { + return nil + } + if m, ok := m.(ResettableRESTMapperWithContext); ok { + return m + } + return &resettableRESTMapperWrapper{ + RESTMapperWithContext: ToRESTMapperWithContext(m), + delegate: m, + } +} + +type resettableRESTMapperWrapper struct { + RESTMapperWithContext + delegate ResettableRESTMapper +} + +func (m *resettableRESTMapperWrapper) ResetWithContext(ctx context.Context) { + m.delegate.Reset() +} diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/meta.go b/vendor/k8s.io/apimachinery/pkg/api/meta/meta.go index 2551f07f5c..4bf24da522 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/meta/meta.go +++ b/vendor/k8s.io/apimachinery/pkg/api/meta/meta.go @@ -600,6 +600,7 @@ func (a genericAccessor) GetOwnerReferences() []metav1.OwnerReference { var ret []metav1.OwnerReference s := a.ownerReferences if s.Kind() != reflect.Pointer || s.Elem().Kind() != reflect.Slice { + //nolint:logcheck // Should not happen. klog.Errorf("expect %v to be a pointer to slice", s) return ret } @@ -608,6 +609,7 @@ func (a genericAccessor) GetOwnerReferences() []metav1.OwnerReference { ret = make([]metav1.OwnerReference, s.Len(), s.Len()+1) for i := 0; i < s.Len(); i++ { if err := extractFromOwnerReference(s.Index(i), &ret[i]); err != nil { + //nolint:logcheck // Should not happen. klog.Errorf("extractFromOwnerReference failed: %v", err) return ret } @@ -618,12 +620,14 @@ func (a genericAccessor) GetOwnerReferences() []metav1.OwnerReference { func (a genericAccessor) SetOwnerReferences(references []metav1.OwnerReference) { s := a.ownerReferences if s.Kind() != reflect.Pointer || s.Elem().Kind() != reflect.Slice { + //nolint:logcheck // Should not happen. klog.Errorf("expect %v to be a pointer to slice", s) } s = s.Elem() newReferences := reflect.MakeSlice(s.Type(), len(references), len(references)) for i := 0; i < len(references); i++ { if err := setOwnerReference(newReferences.Index(i), &references[i]); err != nil { + //nolint:logcheck // Should not happen. klog.Errorf("setOwnerReference failed: %v", err) return } diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/multirestmapper.go b/vendor/k8s.io/apimachinery/pkg/api/meta/multirestmapper.go index b7e9712505..2b2c143ce7 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/meta/multirestmapper.go +++ b/vendor/k8s.io/apimachinery/pkg/api/meta/multirestmapper.go @@ -17,6 +17,7 @@ limitations under the License. package meta import ( + "context" "fmt" "strings" @@ -25,13 +26,31 @@ import ( ) var ( - _ ResettableRESTMapper = MultiRESTMapper{} + _ ResettableRESTMapper = MultiRESTMapper{} + _ fmt.Stringer = MultiRESTMapper{} + _ ResettableRESTMapperWithContext = MultiRESTMapperWithContext{} + _ fmt.Stringer = MultiRESTMapperWithContext{} ) // MultiRESTMapper is a wrapper for multiple RESTMappers. +// +// MultiRESTMapperWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use MultiRESTMapperWithContext instead. type MultiRESTMapper []RESTMapper +// MultiRESTMapperWithContext is a wrapper for multiple RESTMapperWithContext instances. +type MultiRESTMapperWithContext []RESTMapperWithContext + func (m MultiRESTMapper) String() string { + return stringifyMapper("MultiRESTMapper", m) +} + +func (m MultiRESTMapperWithContext) String() string { + return stringifyMapper("MultiRESTMapperWithContext", m) +} + +func stringifyMapper[T any](typeName string, m []T) string { nested := make([]string, 0, len(m)) for _, t := range m { currString := fmt.Sprintf("%v", t) @@ -39,14 +58,93 @@ func (m MultiRESTMapper) String() string { nested = append(nested, strings.Join(splitStrings, "\n\t")) } - return fmt.Sprintf("MultiRESTMapper{\n\t%s\n}", strings.Join(nested, "\n\t")) + return fmt.Sprintf("%s{\n\t%s\n}", typeName, strings.Join(nested, "\n\t")) +} + +func ToMultiRESTMapperWithContext(m MultiRESTMapper) MultiRESTMapperWithContext { + if m == nil { + return nil + } + mc := make(MultiRESTMapperWithContext, len(m)) + for i, m := range m { + mc[i] = ToRESTMapperWithContext(m) + } + return mc } // ResourceSingularizer converts a REST resource name from plural to singular (e.g., from pods to pod) // This implementation supports multiple REST schemas and return the first match. +// +// MultiRESTMapperWithContext.ResourceSingularizerWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use MultiRESTMapperWithContext.ResourceSingularizerWithContext instead. func (m MultiRESTMapper) ResourceSingularizer(resource string) (singular string, err error) { + return ToMultiRESTMapperWithContext(m).ResourceSingularizerWithContext(context.Background(), resource) +} + +// MultiRESTMapperWithContext.ResourcesForWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use MultiRESTMapperWithContext.ResourcesForWithContext instead. +func (m MultiRESTMapper) ResourcesFor(resource schema.GroupVersionResource) ([]schema.GroupVersionResource, error) { + return ToMultiRESTMapperWithContext(m).ResourcesForWithContext(context.Background(), resource) +} + +// MultiRESTMapperWithContext.KindsForWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use MultiRESTMapperWithContext.KindsForWithContext instead. +func (m MultiRESTMapper) KindsFor(resource schema.GroupVersionResource) (gvk []schema.GroupVersionKind, err error) { + return ToMultiRESTMapperWithContext(m).KindsForWithContext(context.Background(), resource) +} + +// MultiRESTMapperWithContext.ResourceForWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use MultiRESTMapperWithContext.ResourceForWithContext instead. +func (m MultiRESTMapper) ResourceFor(resource schema.GroupVersionResource) (schema.GroupVersionResource, error) { + return ToMultiRESTMapperWithContext(m).ResourceForWithContext(context.Background(), resource) +} + +// MultiRESTMapperWithContext.KindForWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use MultiRESTMapperWithContext.KindForWithContext instead. +func (m MultiRESTMapper) KindFor(resource schema.GroupVersionResource) (schema.GroupVersionKind, error) { + return ToMultiRESTMapperWithContext(m).KindForWithContext(context.Background(), resource) +} + +// RESTMapping provides the REST mapping for the resource based on the +// kind and version. This implementation supports multiple REST schemas and +// return the first match. +// +// MultiRESTMapperWithContext.RESTMappingWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use MultiRESTMapperWithContext.RESTMappingWithContext instead. +func (m MultiRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (*RESTMapping, error) { + return ToMultiRESTMapperWithContext(m).RESTMappingWithContext(context.Background(), gk, versions...) +} + +// RESTMappings returns all possible RESTMappings for the provided group kind, or an error +// if the type is not recognized. +// +// MultiRESTMapperWithContext.RESTMappingsWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use MultiRESTMapperWithContext.RESTMappingsWithContext instead. +func (m MultiRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) ([]*RESTMapping, error) { + return ToMultiRESTMapperWithContext(m).RESTMappingsWithContext(context.Background(), gk, versions...) +} + +// MultiRESTMapperWithContext.Reset is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use MultiRESTMapperWithContext.Reset instead. +func (m MultiRESTMapper) Reset() { for _, t := range m { - singular, err = t.ResourceSingularizer(resource) + MaybeResetRESTMapper(t) + } +} + +// ResourceSingularizer converts a REST resource name from plural to singular (e.g., from pods to pod) +// This implementation supports multiple REST schemas and return the first match. +func (m MultiRESTMapperWithContext) ResourceSingularizerWithContext(ctx context.Context, resource string) (singular string, err error) { + for _, t := range m { + singular, err = t.ResourceSingularizerWithContext(ctx, resource) if err == nil { return } @@ -54,10 +152,10 @@ func (m MultiRESTMapper) ResourceSingularizer(resource string) (singular string, return } -func (m MultiRESTMapper) ResourcesFor(resource schema.GroupVersionResource) ([]schema.GroupVersionResource, error) { +func (m MultiRESTMapperWithContext) ResourcesForWithContext(ctx context.Context, resource schema.GroupVersionResource) ([]schema.GroupVersionResource, error) { allGVRs := []schema.GroupVersionResource{} for _, t := range m { - gvrs, err := t.ResourcesFor(resource) + gvrs, err := t.ResourcesForWithContext(ctx, resource) // ignore "no match" errors, but any other error percolates back up if IsNoMatchError(err) { continue @@ -89,10 +187,10 @@ func (m MultiRESTMapper) ResourcesFor(resource schema.GroupVersionResource) ([]s return allGVRs, nil } -func (m MultiRESTMapper) KindsFor(resource schema.GroupVersionResource) (gvk []schema.GroupVersionKind, err error) { +func (m MultiRESTMapperWithContext) KindsForWithContext(ctx context.Context, resource schema.GroupVersionResource) (gvk []schema.GroupVersionKind, err error) { allGVKs := []schema.GroupVersionKind{} for _, t := range m { - gvks, err := t.KindsFor(resource) + gvks, err := t.KindsForWithContext(ctx, resource) // ignore "no match" errors, but any other error percolates back up if IsNoMatchError(err) { continue @@ -124,8 +222,8 @@ func (m MultiRESTMapper) KindsFor(resource schema.GroupVersionResource) (gvk []s return allGVKs, nil } -func (m MultiRESTMapper) ResourceFor(resource schema.GroupVersionResource) (schema.GroupVersionResource, error) { - resources, err := m.ResourcesFor(resource) +func (m MultiRESTMapperWithContext) ResourceForWithContext(ctx context.Context, resource schema.GroupVersionResource) (schema.GroupVersionResource, error) { + resources, err := m.ResourcesForWithContext(ctx, resource) if err != nil { return schema.GroupVersionResource{}, err } @@ -136,8 +234,8 @@ func (m MultiRESTMapper) ResourceFor(resource schema.GroupVersionResource) (sche return schema.GroupVersionResource{}, &AmbiguousResourceError{PartialResource: resource, MatchingResources: resources} } -func (m MultiRESTMapper) KindFor(resource schema.GroupVersionResource) (schema.GroupVersionKind, error) { - kinds, err := m.KindsFor(resource) +func (m MultiRESTMapperWithContext) KindForWithContext(ctx context.Context, resource schema.GroupVersionResource) (schema.GroupVersionKind, error) { + kinds, err := m.KindsForWithContext(ctx, resource) if err != nil { return schema.GroupVersionKind{}, err } @@ -151,12 +249,12 @@ func (m MultiRESTMapper) KindFor(resource schema.GroupVersionResource) (schema.G // RESTMapping provides the REST mapping for the resource based on the // kind and version. This implementation supports multiple REST schemas and // return the first match. -func (m MultiRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (*RESTMapping, error) { +func (m MultiRESTMapperWithContext) RESTMappingWithContext(ctx context.Context, gk schema.GroupKind, versions ...string) (*RESTMapping, error) { allMappings := []*RESTMapping{} errors := []error{} for _, t := range m { - currMapping, err := t.RESTMapping(gk, versions...) + currMapping, err := t.RESTMappingWithContext(ctx, gk, versions...) // ignore "no match" errors, but any other error percolates back up if IsNoMatchError(err) { continue @@ -188,12 +286,12 @@ func (m MultiRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (* // RESTMappings returns all possible RESTMappings for the provided group kind, or an error // if the type is not recognized. -func (m MultiRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) ([]*RESTMapping, error) { +func (m MultiRESTMapperWithContext) RESTMappingsWithContext(ctx context.Context, gk schema.GroupKind, versions ...string) ([]*RESTMapping, error) { var allMappings []*RESTMapping var errors []error for _, t := range m { - currMappings, err := t.RESTMappings(gk, versions...) + currMappings, err := t.RESTMappingsWithContext(ctx, gk, versions...) // ignore "no match" errors, but any other error percolates back up if IsNoMatchError(err) { continue @@ -213,8 +311,8 @@ func (m MultiRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) ( return allMappings, nil } -func (m MultiRESTMapper) Reset() { +func (m MultiRESTMapperWithContext) ResetWithContext(ctx context.Context) { for _, t := range m { - MaybeResetRESTMapper(t) + MaybeResetRESTMapperWithContext(ctx, t) } } diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/priority.go b/vendor/k8s.io/apimachinery/pkg/api/meta/priority.go index 4f097c9c90..d152e7e322 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/meta/priority.go +++ b/vendor/k8s.io/apimachinery/pkg/api/meta/priority.go @@ -17,6 +17,7 @@ limitations under the License. package meta import ( + "context" "fmt" "k8s.io/apimachinery/pkg/runtime/schema" @@ -30,11 +31,17 @@ const ( ) var ( - _ ResettableRESTMapper = PriorityRESTMapper{} + _ ResettableRESTMapper = PriorityRESTMapper{} + _ ResettableRESTMapperWithContext = PriorityRESTMapperWithContext{} + _ fmt.Stringer = PriorityRESTMapperWithContext{} ) // PriorityRESTMapper is a wrapper for automatically choosing a particular Resource or Kind // when multiple matches are possible +// +// PriorityRESTMapperWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use PriorityRESTMapperWithContext instead. type PriorityRESTMapper struct { // Delegate is the RESTMapper to use to locate all the Kind and Resource matches Delegate RESTMapper @@ -56,9 +63,100 @@ func (m PriorityRESTMapper) String() string { return fmt.Sprintf("PriorityRESTMapper{\n\t%v\n\t%v\n\t%v\n}", m.ResourcePriority, m.KindPriority, m.Delegate) } +// PriorityRESTMapperWithContext is a wrapper for automatically choosing a particular Resource or Kind +// when multiple matches are possible +type PriorityRESTMapperWithContext struct { + // Delegate is the RESTMapperWithContext to use to locate all the Kind and Resource matches + Delegate RESTMapperWithContext + + // ResourcePriority is a list of priority patterns to apply to matching resources. + // The list of all matching resources is narrowed based on the patterns until only one remains. + // A pattern with no matches is skipped. A pattern with more than one match uses its + // matches as the list to continue matching against. + ResourcePriority []schema.GroupVersionResource + + // KindPriority is a list of priority patterns to apply to matching kinds. + // The list of all matching kinds is narrowed based on the patterns until only one remains. + // A pattern with no matches is skipped. A pattern with more than one match uses its + // matches as the list to continue matching against. + KindPriority []schema.GroupVersionKind +} + +func (m PriorityRESTMapperWithContext) String() string { + return fmt.Sprintf("PriorityRESTMapperWithContext{\n\t%v\n\t%v\n\t%v\n}", m.ResourcePriority, m.KindPriority, m.Delegate) +} + +func ToPriorityRESTMapperWithContext(m PriorityRESTMapper) PriorityRESTMapperWithContext { + return PriorityRESTMapperWithContext{ + Delegate: ToRESTMapperWithContext(m.Delegate), + ResourcePriority: m.ResourcePriority, + KindPriority: m.KindPriority, + } +} + // ResourceFor finds all resources, then passes them through the ResourcePriority patterns to find a single matching hit. +// +// PriorityRESTMapperWithContext.ResourceForWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use PriorityRESTMapperWithContext.ResourceForWithContext instead. func (m PriorityRESTMapper) ResourceFor(partiallySpecifiedResource schema.GroupVersionResource) (schema.GroupVersionResource, error) { - originalGVRs, originalErr := m.Delegate.ResourcesFor(partiallySpecifiedResource) + return ToPriorityRESTMapperWithContext(m).ResourceForWithContext(context.Background(), partiallySpecifiedResource) +} + +// KindFor finds all kinds, then passes them through the KindPriority patterns to find a single matching hit. +// +// PriorityRESTMapperWithContext.KindForWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use PriorityRESTMapperWithContext.KindForWithContext instead. +func (m PriorityRESTMapper) KindFor(partiallySpecifiedResource schema.GroupVersionResource) (schema.GroupVersionKind, error) { + return ToPriorityRESTMapperWithContext(m).KindForWithContext(context.Background(), partiallySpecifiedResource) +} + +// PriorityRESTMapperWithContext.RESTMappingWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use PriorityRESTMapperWithContext.RESTMappingWithContext instead. +func (m PriorityRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (mapping *RESTMapping, err error) { + return ToPriorityRESTMapperWithContext(m).RESTMappingWithContext(context.Background(), gk, versions...) +} + +// PriorityRESTMapperWithContext.RESTMappingsWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use PriorityRESTMapperWithContext.RESTMappingsWithContext instead. +func (m PriorityRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) ([]*RESTMapping, error) { + return m.Delegate.RESTMappings(gk, versions...) +} + +// PriorityRESTMapperWithContext.ResourceSingularizerWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use PriorityRESTMapperWithContext.ResourceSingularizerWithContext instead. +func (m PriorityRESTMapper) ResourceSingularizer(resource string) (singular string, err error) { + return m.Delegate.ResourceSingularizer(resource) +} + +// PriorityRESTMapperWithContext.ResourcesForWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use PriorityRESTMapperWithContext.ResourcesForWithContext instead. +func (m PriorityRESTMapper) ResourcesFor(partiallySpecifiedResource schema.GroupVersionResource) ([]schema.GroupVersionResource, error) { + return m.Delegate.ResourcesFor(partiallySpecifiedResource) +} + +// PriorityRESTMapperWithContext.KindsForWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use PriorityRESTMapperWithContext.KindsForWithContext instead. +func (m PriorityRESTMapper) KindsFor(partiallySpecifiedResource schema.GroupVersionResource) (gvk []schema.GroupVersionKind, err error) { + return m.Delegate.KindsFor(partiallySpecifiedResource) +} + +// PriorityRESTMapperWithContext.ResetWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use PriorityRESTMapperWithContext.ResetWithContext instead. +func (m PriorityRESTMapper) Reset() { + MaybeResetRESTMapper(m.Delegate) +} + +// ResourceFor finds all resources, then passes them through the ResourcePriority patterns to find a single matching hit. +func (m PriorityRESTMapperWithContext) ResourceForWithContext(ctx context.Context, partiallySpecifiedResource schema.GroupVersionResource) (schema.GroupVersionResource, error) { + originalGVRs, originalErr := m.Delegate.ResourcesForWithContext(ctx, partiallySpecifiedResource) if originalErr != nil && len(originalGVRs) == 0 { return schema.GroupVersionResource{}, originalErr } @@ -93,8 +191,8 @@ func (m PriorityRESTMapper) ResourceFor(partiallySpecifiedResource schema.GroupV } // KindFor finds all kinds, then passes them through the KindPriority patterns to find a single matching hit. -func (m PriorityRESTMapper) KindFor(partiallySpecifiedResource schema.GroupVersionResource) (schema.GroupVersionKind, error) { - originalGVKs, originalErr := m.Delegate.KindsFor(partiallySpecifiedResource) +func (m PriorityRESTMapperWithContext) KindForWithContext(ctx context.Context, partiallySpecifiedResource schema.GroupVersionResource) (schema.GroupVersionKind, error) { + originalGVKs, originalErr := m.Delegate.KindsForWithContext(ctx, partiallySpecifiedResource) if originalErr != nil && len(originalGVKs) == 0 { return schema.GroupVersionKind{}, originalErr } @@ -156,8 +254,8 @@ func kindMatches(pattern schema.GroupVersionKind, kind schema.GroupVersionKind) return true } -func (m PriorityRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (mapping *RESTMapping, err error) { - mappings, originalErr := m.Delegate.RESTMappings(gk, versions...) +func (m PriorityRESTMapperWithContext) RESTMappingWithContext(ctx context.Context, gk schema.GroupKind, versions ...string) (mapping *RESTMapping, err error) { + mappings, originalErr := m.Delegate.RESTMappingsWithContext(ctx, gk, versions...) if originalErr != nil && len(mappings) == 0 { return nil, originalErr } @@ -209,22 +307,22 @@ func (m PriorityRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) return nil, &AmbiguousKindError{PartialKind: gk.WithVersion(""), MatchingKinds: kinds} } -func (m PriorityRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) ([]*RESTMapping, error) { - return m.Delegate.RESTMappings(gk, versions...) +func (m PriorityRESTMapperWithContext) RESTMappingsWithContext(ctx context.Context, gk schema.GroupKind, versions ...string) ([]*RESTMapping, error) { + return m.Delegate.RESTMappingsWithContext(ctx, gk, versions...) } -func (m PriorityRESTMapper) ResourceSingularizer(resource string) (singular string, err error) { - return m.Delegate.ResourceSingularizer(resource) +func (m PriorityRESTMapperWithContext) ResourceSingularizerWithContext(ctx context.Context, resource string) (singular string, err error) { + return m.Delegate.ResourceSingularizerWithContext(ctx, resource) } -func (m PriorityRESTMapper) ResourcesFor(partiallySpecifiedResource schema.GroupVersionResource) ([]schema.GroupVersionResource, error) { - return m.Delegate.ResourcesFor(partiallySpecifiedResource) +func (m PriorityRESTMapperWithContext) ResourcesForWithContext(ctx context.Context, partiallySpecifiedResource schema.GroupVersionResource) ([]schema.GroupVersionResource, error) { + return m.Delegate.ResourcesForWithContext(ctx, partiallySpecifiedResource) } -func (m PriorityRESTMapper) KindsFor(partiallySpecifiedResource schema.GroupVersionResource) (gvk []schema.GroupVersionKind, err error) { - return m.Delegate.KindsFor(partiallySpecifiedResource) +func (m PriorityRESTMapperWithContext) KindsForWithContext(ctx context.Context, partiallySpecifiedResource schema.GroupVersionResource) (gvk []schema.GroupVersionKind, err error) { + return m.Delegate.KindsForWithContext(ctx, partiallySpecifiedResource) } -func (m PriorityRESTMapper) Reset() { - MaybeResetRESTMapper(m.Delegate) +func (m PriorityRESTMapperWithContext) ResetWithContext(ctx context.Context) { + MaybeResetRESTMapperWithContext(ctx, m.Delegate) } diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/restmapper.go b/vendor/k8s.io/apimachinery/pkg/api/meta/restmapper.go index 91cb98cae4..d64db33d41 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/meta/restmapper.go +++ b/vendor/k8s.io/apimachinery/pkg/api/meta/restmapper.go @@ -18,6 +18,7 @@ limitations under the License. package meta import ( + "context" "fmt" "sort" "strings" @@ -72,6 +73,8 @@ func (m *DefaultRESTMapper) String() string { } var _ RESTMapper = &DefaultRESTMapper{} +var _ RESTMapperWithContext = &DefaultRESTMapper{} +var _ fmt.Stringer = &DefaultRESTMapper{} // NewDefaultRESTMapper initializes a mapping between Kind and APIVersion // to a resource name and back based on the objects in a runtime.Scheme @@ -179,6 +182,10 @@ func (m *DefaultRESTMapper) ResourceSingularizer(resourceType string) (string, e return singular.Resource, nil } +func (m *DefaultRESTMapper) ResourceSingularizerWithContext(_ context.Context, resourceType string) (string, error) { + return m.ResourceSingularizer(resourceType) +} + // coerceResourceForMatching makes the resource lower case and converts internal versions to unspecified (legacy behavior) func coerceResourceForMatching(resource schema.GroupVersionResource) schema.GroupVersionResource { resource.Resource = strings.ToLower(resource.Resource) @@ -276,6 +283,10 @@ func (m *DefaultRESTMapper) ResourcesFor(input schema.GroupVersionResource) ([]s return ret, nil } +func (m *DefaultRESTMapper) ResourcesForWithContext(_ context.Context, input schema.GroupVersionResource) ([]schema.GroupVersionResource, error) { + return m.ResourcesFor(input) +} + func (m *DefaultRESTMapper) ResourceFor(resource schema.GroupVersionResource) (schema.GroupVersionResource, error) { resources, err := m.ResourcesFor(resource) if err != nil { @@ -288,6 +299,10 @@ func (m *DefaultRESTMapper) ResourceFor(resource schema.GroupVersionResource) (s return schema.GroupVersionResource{}, &AmbiguousResourceError{PartialResource: resource, MatchingResources: resources} } +func (m *DefaultRESTMapper) ResourceForWithContext(_ context.Context, resource schema.GroupVersionResource) (schema.GroupVersionResource, error) { + return m.ResourceFor(resource) +} + func (m *DefaultRESTMapper) KindsFor(input schema.GroupVersionResource) ([]schema.GroupVersionKind, error) { resource := coerceResourceForMatching(input) @@ -355,6 +370,10 @@ func (m *DefaultRESTMapper) KindsFor(input schema.GroupVersionResource) ([]schem return ret, nil } +func (m *DefaultRESTMapper) KindsForWithContext(_ context.Context, input schema.GroupVersionResource) ([]schema.GroupVersionKind, error) { + return m.KindsFor(input) +} + func (m *DefaultRESTMapper) KindFor(resource schema.GroupVersionResource) (schema.GroupVersionKind, error) { kinds, err := m.KindsFor(resource) if err != nil { @@ -367,6 +386,10 @@ func (m *DefaultRESTMapper) KindFor(resource schema.GroupVersionResource) (schem return schema.GroupVersionKind{}, &AmbiguousResourceError{PartialResource: resource, MatchingKinds: kinds} } +func (m *DefaultRESTMapper) KindForWithContext(_ context.Context, resource schema.GroupVersionResource) (schema.GroupVersionKind, error) { + return m.KindFor(resource) +} + type kindByPreferredGroupVersion struct { list []schema.GroupVersionKind sortOrder []schema.GroupVersion @@ -461,6 +484,10 @@ func (m *DefaultRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) return mappings[0], nil } +func (m *DefaultRESTMapper) RESTMappingWithContext(_ context.Context, gk schema.GroupKind, versions ...string) (*RESTMapping, error) { + return m.RESTMapping(gk, versions...) +} + // RESTMappings returns the RESTMappings for the provided group kind. If a version search order // is not provided, the search order provided to DefaultRESTMapper will be used. func (m *DefaultRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) ([]*RESTMapping, error) { @@ -520,10 +547,33 @@ func (m *DefaultRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string return mappings, nil } -// MaybeResetRESTMapper calls Reset() on the mapper if it is a ResettableRESTMapper. +func (m *DefaultRESTMapper) RESTMappingsWithContext(_ context.Context, gk schema.GroupKind, versions ...string) ([]*RESTMapping, error) { + return m.RESTMappings(gk, versions...) +} + +// MaybeResetRESTMapper calls Reset() on the mapper if it is a ResettableRESTMapper or +// ResetWithContext() if it is a ResettableRESTMapperWithContext. +// +// MaybeResetRESTMapperWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use MaybeResetRESTMapperWithContext instead. func MaybeResetRESTMapper(mapper RESTMapper) { - m, ok := mapper.(ResettableRESTMapper) - if ok { + maybeReset(context.Background(), mapper) +} + +// MaybeResetRESTMapperWithContext calls Reset() on the mapper if it is a ResettableRESTMapper or +// ResetWithContext() if it is a ResettableRESTMapperWithContext. +func MaybeResetRESTMapperWithContext(ctx context.Context, mapper RESTMapperWithContext) { + maybeReset(ctx, mapper) +} + +func maybeReset(ctx context.Context, mapper any) { + if m, ok := mapper.(ResettableRESTMapperWithContext); ok { + m.ResetWithContext(ctx) + return + } + if m, ok := mapper.(ResettableRESTMapper); ok { m.Reset() + return } } diff --git a/vendor/k8s.io/apimachinery/pkg/api/operation/operation.go b/vendor/k8s.io/apimachinery/pkg/api/operation/operation.go index 86b6ddf37c..cccc7e60c2 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/operation/operation.go +++ b/vendor/k8s.io/apimachinery/pkg/api/operation/operation.go @@ -17,7 +17,6 @@ limitations under the License. package operation import ( - "slices" "strings" ) @@ -31,28 +30,27 @@ type Operation struct { // those into a single "Update" category. Type Type - // Options declare the options enabled for validation. + // Options are the validation options in effect for this operation, mapping option + // name to whether it is enabled. Option names typically match feature gates, but an + // option may be enabled even when its feature gate is off — e.g. when the feature is + // already in use by the object being updated. Set by the resource strategy and + // read-only during validation. // - // Options should be set according to a resource validation strategy before validation - // is performed, and must be treated as read-only during validation. - // - // Options are identified by string names. Option string names may match the name of a feature - // gate, in which case the presence of the name in the set indicates that the feature is - // considered enabled for the resource being validated. Note that a resource may have a - // feature enabled even when the feature gate is disabled. This can happen when feature is - // already in-use by a resource, often because the feature gate was enabled when the - // resource first began using the feature. - // - // Unset options are disabled/false. - Options []string + // Every option a validation tag references must be defined here by the strategy; an + // option that is not defined is a programming error (see HasOption). + Options map[string]bool // Request provides information about the request being validated. Request Request } -// HasOption returns true if the given string is in the Options slice. -func (o Operation) HasOption(option string) bool { - return slices.Contains(o.Options, option) +// HasOption returns whether the named option is enabled and whether it was defined by +// the strategy. Every option a validation tag references must be defined; callers treat +// an undefined option as an internal error (see validate.IfOption) rather than silently +// as disabled. +func (o Operation) HasOption(option string) (enabled, defined bool) { + enabled, defined = o.Options[option] + return } // Request provides information about the request being validated. diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go b/vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go index f3cd600604..e6b1f1b535 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go +++ b/vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go @@ -878,3 +878,14 @@ func (q *QuantityValue) Set(s string) error { func (q QuantityValue) Type() string { return "quantity" } + +// QuantityPtrEqual compares two Quantity pointers and returns true if they are both nil or point to equal quantities. +func QuantityPtrEqual(a, b *Quantity) bool { + if a == nil && b == nil { + return true + } + if a == nil || b == nil { + return false + } + return a.Equal(*b) +} diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/content/kube.go b/vendor/k8s.io/apimachinery/pkg/api/validate/content/kube.go index 44e82eefd3..608073f708 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/validate/content/kube.go +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/content/kube.go @@ -99,3 +99,19 @@ func prefixEach(msgs []string, prefix string) []string { } return msgs } + +// IsPrefixedLabelKey tests whether the value passed is a valid label key with +// a domain prefix. This allows "example.com/key" but not "key". +// If the value is not valid, a list of error strings is returned. Otherwise, +// an empty list (or nil) is returned. +func IsPrefixedLabelKey(value string) []string { + if errs := IsLabelKey(value); len(errs) > 0 { + return errs + } + + segments := strings.Split(value, "/") + if len(segments) != 2 { + return []string{"must include a prefix (e.g. 'example.com/key')"} + } + return nil +} diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/dependentrequired.go b/vendor/k8s.io/apimachinery/pkg/api/validate/dependentrequired.go new file mode 100644 index 0000000000..69222c9752 --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/dependentrequired.go @@ -0,0 +1,83 @@ +/* +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. +*/ + +package validate + +import ( + "context" + "fmt" + + "k8s.io/apimachinery/pkg/api/operation" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +// DependentRequired verifies that when triggerIsSet(obj) is true, dependentIsSet(obj) +// is also true; otherwise reports an error at fldPath.Child(dependentName). +// On Update, the check is skipped if neither side's set-ness changed from oldObj, +// so unrelated updates can proceed past a pre-existing violation. +func DependentRequired[T any](_ context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *T, + triggerName string, triggerIsSet ExtractorFn[*T, bool], + dependentName string, dependentIsSet ExtractorFn[*T, bool], +) field.ErrorList { + if obj == nil { + return nil + } + if op.Type == operation.Update && oldObj != nil { + if triggerIsSet(obj) == triggerIsSet(oldObj) && dependentIsSet(obj) == dependentIsSet(oldObj) { + return nil + } + } + if !triggerIsSet(obj) { + return nil + } + if dependentIsSet(obj) { + return nil + } + return field.ErrorList{ + field.Required(fldPath.Child(dependentName), + fmt.Sprintf("must be set when %s is set", triggerName)). + WithOrigin("dependentRequired"), + } +} + +// DependentForbidden verifies that when triggerIsSet(obj) is true, dependentIsSet(obj) +// is false; otherwise reports an error at fldPath.Child(dependentName). +// On Update, the check is skipped if neither side's set-ness changed from oldObj, +// so unrelated updates can proceed past a pre-existing violation. +func DependentForbidden[T any](_ context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *T, + triggerName string, triggerIsSet ExtractorFn[*T, bool], + dependentName string, dependentIsSet ExtractorFn[*T, bool], +) field.ErrorList { + if obj == nil { + return nil + } + if op.Type == operation.Update && oldObj != nil { + if triggerIsSet(obj) == triggerIsSet(oldObj) && dependentIsSet(obj) == dependentIsSet(oldObj) { + return nil + } + } + if !triggerIsSet(obj) { + return nil + } + if !dependentIsSet(obj) { + return nil + } + return field.ErrorList{ + field.Forbidden(fldPath.Child(dependentName), + fmt.Sprintf("may not be set when %s is set", triggerName)). + WithOrigin("dependentForbidden"), + } +} diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/discriminator.go b/vendor/k8s.io/apimachinery/pkg/api/validate/discriminator.go index 787ae6b0b7..6f4b3cddda 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/validate/discriminator.go +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/discriminator.go @@ -35,6 +35,9 @@ type DiscriminatedRule[Tfield any, Tdisc comparable] struct { // // It performs ratcheting: if the operation is an Update, and neither the discriminator // nor the value (checked via equiv) have changed, validation is skipped. +// +// The equiv function can be called with nil arguments in the case of nilable +// fields. func Discriminated[Tfield any, Tdisc comparable, Tstruct any](ctx context.Context, op operation.Operation, structPath *field.Path, obj, oldObj *Tstruct, fieldName string, getMemberValue func(*Tstruct) Tfield, getDiscriminator func(*Tstruct) Tdisc, equiv MatchFunc[Tfield], defaultValidation ValidateFunc[Tfield], rules []DiscriminatedRule[Tfield, Tdisc], diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/each.go b/vendor/k8s.io/apimachinery/pkg/api/validate/each.go index c815d6d913..2930c21836 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/validate/each.go +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/each.go @@ -18,6 +18,7 @@ package validate import ( "context" + "slices" "sort" "k8s.io/apimachinery/pkg/api/equality" @@ -29,22 +30,29 @@ import ( // according to some criteria, and returns true if they match. type MatchFunc[T any] func(T, T) bool -// EachSliceVal performs validation on each element of newSlice using the provided validation function. +// EachValSliceVal performs validation on each element of a slice of values +// using the provided validation function. // -// For update operations, the match function finds corresponding values in oldSlice for each -// value in newSlice. This comparison can be either full or partial (e.g., matching only -// specific struct fields that serve as a unique identifier). If match is nil, validation -// proceeds without considering old values, and the equiv function is not used. +// For update operations, the match function finds corresponding values in +// oldSlice for each value in newSlice. This comparison can be either full or +// partial (e.g., matching only specific struct fields that serve as a unique +// identifier). If match is nil, validation proceeds without considering old +// values, and the equiv function is not used. // -// For update operations, the equiv function checks if a new value is equivalent to its -// corresponding old value, enabling validation ratcheting. If equiv is nil but match is -// provided, the match function is assumed to perform full value comparison. +// For update operations, the equiv function checks if a new value is +// equivalent to its corresponding old value, enabling validation ratcheting. +// If equiv is nil but match is provided, the match function is assumed to +// perform full value comparison. +// +// The match and equiv functions will never be called with nil arguments. // // Note: The slice element type must be non-nilable. -func EachSliceVal[T any](ctx context.Context, op operation.Operation, fldPath *field.Path, newSlice, oldSlice []T, - match, equiv MatchFunc[T], validator ValidateFunc[*T]) field.ErrorList { +func EachValSliceVal[T any](ctx context.Context, op operation.Operation, fldPath *field.Path, newSlice, oldSlice []T, + match, equiv MatchFunc[*T], validator ValidateFunc[*T]) field.ErrorList { var errs field.ErrorList - for i, val := range newSlice { + for i := range newSlice { + val := &newSlice[i] + var old *T if match != nil && len(oldSlice) > 0 { old = lookup(oldSlice, val, match) @@ -55,33 +63,90 @@ func EachSliceVal[T any](ctx context.Context, op operation.Operation, fldPath *f // 2. The equiv function confirms the values are equivalent (either directly or semantically) // // The equiv function provides equality comparison when match uses partial comparison. - if op.Type == operation.Update && old != nil && (equiv == nil || equiv(val, *old)) { + if op.Type == operation.Update && old != nil && (equiv == nil || equiv(val, old)) { + continue + } + errs = append(errs, validator(ctx, op, fldPath.Index(i), val, old)...) + } + return errs +} + +// EachPtrSliceVal performs validation on each element of a slice of pointers +// using the provided validation function. +// +// For update operations, the match function finds corresponding values in +// oldSlice for each value in newSlice. This comparison can be either full or +// partial (e.g., matching only specific struct fields that serve as a unique +// identifier). If match is nil, validation proceeds without considering old +// values, and the equiv function is not used. +// +// For update operations, the equiv function checks if a new value is +// equivalent to its corresponding old value, enabling validation ratcheting. +// If equiv is nil but match is provided, the match function is assumed to +// perform full value comparison. +// +// The match and equiv functions will never be called with nil arguments. +func EachPtrSliceVal[T any](ctx context.Context, op operation.Operation, fldPath *field.Path, newSlice, oldSlice []*T, + match, equiv MatchFunc[*T], validator ValidateFunc[*T]) field.ErrorList { + var errs field.ErrorList + for i := range newSlice { + val := newSlice[i] + if val == nil { + // Ignore nil items; they are supposed to have been checked by PtrSliceNoNils. + continue + } + + var old *T + if match != nil && len(oldSlice) > 0 { + old = lookupPointer(oldSlice, val, match) + } + if op.Type == operation.Update && old != nil && (equiv == nil || equiv(val, old)) { continue } - errs = append(errs, validator(ctx, op, fldPath.Index(i), &val, old)...) + errs = append(errs, validator(ctx, op, fldPath.Index(i), val, old)...) } return errs } // lookup returns a pointer to the first element in the list that matches the // target, according to the provided comparison function, or else nil. -func lookup[T any](list []T, target T, match MatchFunc[T]) *T { +func lookup[T any](list []T, target *T, match MatchFunc[*T]) *T { for i := range list { - if match(list[i], target) { + if match(&list[i], target) { return &list[i] } } return nil } +// lookupPointer returns the first non-nil element in the list that matches the +// target, according to the provided comparison function, or else nil. +// Nil elements in the list are skipped. +func lookupPointer[T any](list []*T, target *T, match MatchFunc[*T]) *T { + for i := range list { + if list[i] == nil { + // We can't really do anything about nil entries in the old list, + // just skip them. + continue + } + if match(list[i], target) { + return list[i] + } + } + return nil +} + // EachMapVal validates each value in newMap using the specified validation // function, passing the corresponding old value from oldMap if the key exists in oldMap. // For update operations, it implements validation ratcheting by skipping validation // when the old value exists and the equiv function confirms the values are equivalent. // The value-type of the map is assumed to not be nilable. +// +// The equiv function will never be called with nil arguments. +// // If equiv is nil, value-based ratcheting is disabled and all values will be validated. func EachMapVal[K ~string, V any](ctx context.Context, op operation.Operation, fldPath *field.Path, newMap, oldMap map[K]V, - equiv MatchFunc[V], validator ValidateFunc[*V]) field.ErrorList { + equiv MatchFunc[*V], validator ValidateFunc[*V]) field.ErrorList { var errs field.ErrorList for key, val := range newMap { var old *V @@ -90,7 +155,7 @@ func EachMapVal[K ~string, V any](ctx context.Context, op operation.Operation, f } // If the operation is an update, for validation ratcheting, skip re-validating if the old // value is found and the equiv function confirms the values are equivalent. - if op.Type == operation.Update && old != nil && equiv != nil && equiv(val, *old) { + if op.Type == operation.Update && old != nil && equiv != nil && equiv(&val, old) { continue } errs = append(errs, validator(ctx, op, fldPath.Key(string(key)), &val, old)...) @@ -119,19 +184,20 @@ func EachMapKey[K ~string, T any](ctx context.Context, op operation.Operation, f return errs } -// Unique verifies that each element of newSlice is unique, according to the -// match function. It compares every element of the slice with every other -// element and returns errors for non-unique items. -func Unique[T any](_ context.Context, _ operation.Operation, fldPath *field.Path, newSlice, _ []T, match MatchFunc[T]) field.ErrorList { +// ValSliceUnique verifies that each element of a slice of values is unique, +// according to the match function. It compares every element of the slice with +// every other element and returns errors for non-unique items. +// +// The match function will never be called with nil arguments. +func ValSliceUnique[T any](_ context.Context, _ operation.Operation, fldPath *field.Path, newSlice, _ []T, match MatchFunc[*T]) field.ErrorList { var dups []int - for i, val := range newSlice { + for i := range newSlice { for j := i + 1; j < len(newSlice); j++ { - other := newSlice[j] - if match(val, other) { + if match(&newSlice[i], &newSlice[j]) { if dups == nil { dups = make([]int, 0, len(newSlice)) } - if lookup(dups, j, func(a, b int) bool { return a == b }) == nil { + if !slices.Contains(dups, j) { dups = append(dups, j) } } @@ -152,6 +218,42 @@ func Unique[T any](_ context.Context, _ operation.Operation, fldPath *field.Path return errs } +// PtrSliceUnique verifies that each element of a slice of pointers is unique, +// according to the match function. It compares every element of the slice with +// every other element and returns errors for non-unique items. +// +// The match function will never be called with nil arguments. +func PtrSliceUnique[T any](_ context.Context, _ operation.Operation, fldPath *field.Path, newSlice, _ []*T, match MatchFunc[*T]) field.ErrorList { + var errs field.ErrorList + var dups []int + for i := range newSlice { + if newSlice[i] == nil { + // Ignore nil items; they are supposed to have been checked by PtrSliceNoNils. + continue + } + for j := i + 1; j < len(newSlice); j++ { + if newSlice[j] == nil { + continue + } + if match(newSlice[i], newSlice[j]) { + if dups == nil { + dups = make([]int, 0, len(newSlice)) + } + if !slices.Contains(dups, j) { + dups = append(dups, j) + } + } + } + } + + sort.Ints(dups) + for _, i := range dups { + var val any = newSlice[i] + errs = append(errs, field.Duplicate(fldPath.Index(i), val)) + } + return errs +} + // SemanticDeepEqual is a MatchFunc that uses equality.Semantic.DeepEqual to // compare two values. // This wrapper is needed because MatchFunc requires a function that takes two @@ -163,19 +265,12 @@ func SemanticDeepEqual[T any](a, b T) bool { return equality.Semantic.DeepEqual(a, b) } -// DirectEqual is a MatchFunc that uses the == operator to compare two values. -// It can be used by any other function that needs to compare two values -// directly. -func DirectEqual[T comparable](a, b T) bool { - return a == b -} - -// DirectEqualPtr is a MatchFunc that dereferences two pointers and uses the == +// DirectEqual is a MatchFunc that dereferences two pointers and uses the == // operator to compare the values. If both pointers are nil, it returns true. // If one pointer is nil and the other is not, it returns false. // It can be used by any other function that needs to compare two pointees // directly. -func DirectEqualPtr[T comparable](a, b *T) bool { +func DirectEqual[T comparable](a, b *T) bool { if a == b { return true } @@ -184,3 +279,14 @@ func DirectEqualPtr[T comparable](a, b *T) bool { } return *a == *b } + +// PtrSliceNoNils returns a Required error for each nil element in a slice of +// pointers. +func PtrSliceNoNils[T any](_ context.Context, _ operation.Operation, fldPath *field.Path, newSlice, _ []*T) (errs field.ErrorList) { + for i := range newSlice { + if newSlice[i] == nil { + errs = append(errs, field.Required(fldPath.Index(i), "")) + } + } + return +} diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/enum.go b/vendor/k8s.io/apimachinery/pkg/api/validate/enum.go index 6e5bcf373b..4d8e2c0aa8 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/validate/enum.go +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/enum.go @@ -18,6 +18,7 @@ package validate import ( "context" + "fmt" "slices" "k8s.io/apimachinery/pkg/api/operation" @@ -32,24 +33,36 @@ func Enum[T ~string](_ context.Context, op operation.Operation, fldPath *field.P if value == nil { return nil } - if !validValues.Has(*value) || isExcluded(op, exclusions, *value) { - return field.ErrorList{field.NotSupported[T](fldPath, *value, supportedValues(op, validValues, exclusions))} + excluded, err := isExcluded(op, exclusions, *value) + if err != nil { + return field.ErrorList{field.InternalError(fldPath, err)} + } + if !validValues.Has(*value) || excluded { + supported, err := supportedValues(op, validValues, exclusions) + if err != nil { + return field.ErrorList{field.InternalError(fldPath, err)} + } + return field.ErrorList{field.NotSupported[T](fldPath, *value, supported)} } return nil } // supportedValues returns a sorted list of supported values. // Excluded enum values are not included in the list. -func supportedValues[T ~string](op operation.Operation, values sets.Set[T], exclusions []EnumExclusion[T]) []T { +func supportedValues[T ~string](op operation.Operation, values sets.Set[T], exclusions []EnumExclusion[T]) ([]T, error) { res := make([]T, 0, len(values)) for key := range values { - if isExcluded(op, exclusions, key) { + excluded, err := isExcluded(op, exclusions, key) + if err != nil { + return nil, err + } + if excluded { continue } res = append(res, key) } slices.Sort(res) - return res + return res, nil } // EnumExclusion represents a single enum exclusion rule. @@ -64,11 +77,15 @@ type EnumExclusion[T ~string] struct { Option string } -func isExcluded[T ~string](op operation.Operation, exclusions []EnumExclusion[T], value T) bool { +func isExcluded[T ~string](op operation.Operation, exclusions []EnumExclusion[T], value T) (bool, error) { for _, rule := range exclusions { - if rule.Value == value && rule.ExcludeWhen == op.HasOption(rule.Option) { - return true + on, defined := op.HasOption(rule.Option) + if !defined { + return false, fmt.Errorf("undefined validation option %q", rule.Option) + } + if rule.Value == value && rule.ExcludeWhen == on { + return true, nil } } - return false + return false, nil } diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/errors.go b/vendor/k8s.io/apimachinery/pkg/api/validate/errors.go new file mode 100644 index 0000000000..a9dc4b01c0 --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/errors.go @@ -0,0 +1,96 @@ +/* +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. +*/ + +package validate + +import ( + "context" + "errors" + + "k8s.io/apimachinery/pkg/util/validation/field" +) + +type allDeclarativeEnforcedKeyType struct{} + +var allDeclarativeEnforcedKey = allDeclarativeEnforcedKeyType{} + +// WithAllDeclarativeEnforcedForTest returns a copy of parent context with allDeclarativeEnforcedKey set to true. +// This is used for testing to expose all declarative validation errors and filter all handwritten validation errors +// that are covered by declarative validation, regardless of the feature gate or maturity level. +// +// NOTE: This function is intended for testing purposes only and should not be used in production code. +func WithAllDeclarativeEnforcedForTest(ctx context.Context) context.Context { + return context.WithValue(ctx, allDeclarativeEnforcedKey, true) +} + +// AllDeclarativeEnforced returns true if the context contains allDeclarativeEnforcedKey set to true. +func AllDeclarativeEnforced(ctx context.Context) bool { + if ctx == nil { + return false + } + return ctx.Value(allDeclarativeEnforcedKey) == true +} + +// FilterCoveredHandwrittenErrors removes a CoveredByDeclarative handwritten error when a matching enforced +// beta declarative error exists (matched by type, field, and origin). In AllDeclarativeEnforced +// (testing-only) mode every covered handwritten error is removed. +func FilterCoveredHandwrittenErrors(ctx context.Context, imperativeErrs, enforcedDeclarativeErrs field.ErrorList, betaEnabled bool, rules ...field.NormalizationRule) field.ErrorList { + matcher := field.ErrorMatcher{}.ByType().ByOrigin().RequireOriginWhenInvalid().ByFieldNormalized(rules) + allDeclarativeEnforced := AllDeclarativeEnforced(ctx) + return imperativeErrs.Filter(func(e error) bool { + var fe *field.Error + if !errors.As(e, &fe) || !fe.CoveredByDeclarative { + return false + } + if allDeclarativeEnforced { + return true + } + for _, dErr := range enforcedDeclarativeErrs { + if dErr.IsBeta() && matcher.Matches(fe, dErr) { + return true + } + } + return false + }) +} + +// FilterEnforcedDeclarativeErrors collects the declarative errors that are enforced (i.e. surfaced to the user) in the +// current mode. A declarative error is enforced when any of the following holds: +// - AllDeclarativeEnforced is set (testing): every declarative error is enforced. +// - It is an internal error: always enforced, regardless of lifecycle. +// - It is a beta error and BetaEnabled is true. +// - It is a standard (unprefixed) error: always enforced. +// +// Alpha errors are never enforced; they remain shadowed by handwritten validation. +func FilterEnforcedDeclarativeErrors(ctx context.Context, declarativeErrs field.ErrorList, betaEnabled bool) field.ErrorList { + enforcedDeclarativeErrs := make(field.ErrorList, 0, len(declarativeErrs)) + allDeclarativeEnforced := AllDeclarativeEnforced(ctx) + for _, dvErr := range declarativeErrs { + switch { + case allDeclarativeEnforced: + enforcedDeclarativeErrs = append(enforcedDeclarativeErrs, dvErr) + case dvErr.Type == field.ErrorTypeInternal: + enforcedDeclarativeErrs = append(enforcedDeclarativeErrs, dvErr) + case dvErr.IsBeta(): + if betaEnabled { + enforcedDeclarativeErrs = append(enforcedDeclarativeErrs, dvErr) + } + case !dvErr.IsAlpha(): + enforcedDeclarativeErrs = append(enforcedDeclarativeErrs, dvErr) // Standard + } + } + return enforcedDeclarativeErrs +} diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/item.go b/vendor/k8s.io/apimachinery/pkg/api/validate/item.go index aba417fa1d..4ddb2860c5 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/validate/item.go +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/item.go @@ -23,36 +23,39 @@ import ( "k8s.io/apimachinery/pkg/util/validation/field" ) -// MatchItemFn takes a pointer to an item and returns true if it matches the criteria. -type MatchItemFn[T any] func(*T) bool +// MatchItemFunc takes an item and returns true if it matches the criteria. +type MatchItemFunc[T any] func(T) bool -// SliceItem finds the first item in newList that satisfies the match function, -// and if found, also looks for a matching item in oldList. If the value of the -// item is the same as the previous value, as per the equiv function, then no -// validation is performed. Otherwise, it invokes 'itemValidator' on these items. +// ValSliceItem finds the first item in a list of values which satisfies the +// match function, and if found, also looks for a matching item in oldList. If +// the value of the item is the same as the previous value, as per the equiv +// function, then no validation is performed. Otherwise, it invokes +// 'itemValidator' on these items. // // This function processes only the *first* matching item found in newList. It // assumes that the match functions targets a unique identifier (primary key) // and will match at most one element per list. If this assumption is violated, // changes in list order can lead this function to have inconsistent behavior. // +// The match and equiv functions will never be called with nil arguments. +// // The fldPath passed to itemValidator is indexed to the matched item's // position in newList. // // This function does not validate items that were removed (present in oldList // but not in newList). -func SliceItem[TList ~[]TItem, TItem any]( +func ValSliceItem[TList ~[]TItem, TItem any]( ctx context.Context, op operation.Operation, fldPath *field.Path, newList, oldList TList, - matches MatchItemFn[TItem], - equiv MatchFunc[TItem], + match MatchItemFunc[*TItem], + equiv MatchFunc[*TItem], itemValidator func(ctx context.Context, op operation.Operation, fldPath *field.Path, newObj, oldObj *TItem) field.ErrorList, ) field.ErrorList { var matchedNew, matchedOld *TItem var newIndex int for i := range newList { - if matches(&newList[i]) { + if match(&newList[i]) { matchedNew = &newList[i] newIndex = i break @@ -63,13 +66,73 @@ func SliceItem[TList ~[]TItem, TItem any]( } for i := range oldList { - if matches(&oldList[i]) { + if match(&oldList[i]) { matchedOld = &oldList[i] break } } - if op.Type == operation.Update && matchedOld != nil && equiv(*matchedNew, *matchedOld) { + if op.Type == operation.Update && matchedOld != nil && equiv(matchedNew, matchedOld) { + return nil + } + + return itemValidator(ctx, op, fldPath.Index(newIndex), matchedNew, matchedOld) +} + +// PtrSliceItem finds the first item in a list of pointers which satisfies the +// match function, and if found, also looks for a matching item in oldList. If +// the value of the item is the same as the previous value, as per the equiv +// function, then no validation is performed. Otherwise, it invokes +// 'itemValidator' on these items. +// +// This function processes only the *first* matching item found in newList. It +// assumes that the match functions targets a unique identifier (primary key) +// and will match at most one element per list. If this assumption is violated, +// changes in list order can lead this function to have inconsistent behavior. +// +// The match and equiv functions will never be called with nil arguments. +// +// The fldPath passed to itemValidator is indexed to the matched item's +// position in newList. +// +// This function does not validate items that were removed (present in oldList +// but not in newList). +func PtrSliceItem[TList ~[]*TItem, TItem any]( + ctx context.Context, op operation.Operation, fldPath *field.Path, + newList, oldList TList, + match MatchItemFunc[*TItem], + equiv MatchFunc[*TItem], + itemValidator func(ctx context.Context, op operation.Operation, fldPath *field.Path, newObj, oldObj *TItem) field.ErrorList, +) field.ErrorList { + var matchedNew, matchedOld *TItem + var newIndex int + + for i := range newList { + if newList[i] == nil { + // Ignore nil items; they are supposed to have been checked by PtrSliceNoNils. + continue + } + if match(newList[i]) { + matchedNew = newList[i] + newIndex = i + break + } + } + if matchedNew == nil { + return nil + } + + for i := range oldList { + if oldList[i] == nil { + continue + } + if match(oldList[i]) { + matchedOld = oldList[i] + break + } + } + + if op.Type == operation.Update && matchedOld != nil && equiv(matchedNew, matchedOld) { return nil } diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/limits.go b/vendor/k8s.io/apimachinery/pkg/api/validate/limits.go index dcc7f518d8..768546f6bc 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/validate/limits.go +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/limits.go @@ -78,6 +78,18 @@ func MaxItems[T any](_ context.Context, _ operation.Operation, fldPath *field.Pa return nil } +// MaxProperties verifies that the specified map has no more than max keys. +func MaxProperties[K comparable, V any](_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ map[K]V, max int) field.ErrorList { + if value == nil { + return nil + } + + if len(value) > max { + return field.ErrorList{field.TooMany(fldPath, len(value), max).WithOrigin("maxProperties")} + } + return nil +} + // MinItems verifies that the specified slice is not shorter than min items. func MinItems[T any](_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ []T, min int) field.ErrorList { if len(value) < min { @@ -86,6 +98,14 @@ func MinItems[T any](_ context.Context, _ operation.Operation, fldPath *field.Pa return nil } +// MinProperties verifies that the specified map is not shorter than min properties. +func MinProperties[K comparable, V any](_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ map[K]V, min int) field.ErrorList { + if len(value) < min { + return field.ErrorList{field.TooFew(fldPath, len(value), min).WithOrigin("minProperties")} + } + return nil +} + // Minimum verifies that the specified value is greater than or equal to min. func Minimum[T constraints.Integer](_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *T, min T) field.ErrorList { if value == nil { diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/monotonic.go b/vendor/k8s.io/apimachinery/pkg/api/validate/monotonic.go new file mode 100644 index 0000000000..f0526c9ffe --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/monotonic.go @@ -0,0 +1,43 @@ +/* +Copyright 2025 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package validate + +import ( + "context" + "fmt" + + "k8s.io/apimachinery/pkg/api/operation" + "k8s.io/apimachinery/pkg/api/validate/constraints" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +// Monotonic validates that an integer value has not decreased on update. +func Monotonic[T constraints.Integer](_ context.Context, op operation.Operation, fldPath *field.Path, value, oldValue *T) field.ErrorList { + if op.Type != operation.Update { + return nil + } + + if value == nil || oldValue == nil { + return nil + } + + if *value < *oldValue { + return field.ErrorList{field.Invalid(fldPath, *value, fmt.Sprintf("may not be decreased from %v", *oldValue)).WithOrigin("monotonic")} + } + + return nil +} diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/options.go b/vendor/k8s.io/apimachinery/pkg/api/validate/options.go index 44236550b7..143be3b64a 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/validate/options.go +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/options.go @@ -18,6 +18,7 @@ package validate import ( "context" + "fmt" "k8s.io/apimachinery/pkg/api/operation" "k8s.io/apimachinery/pkg/util/validation/field" @@ -25,10 +26,14 @@ import ( // IfOption conditionally evaluates a validation function. If the option and enabled are both true the validator // is called. If the option and enabled are both false the validator is called. Otherwise, the validator is not called. -func IfOption[T any](ctx context.Context, op operation.Operation, fldPath *field.Path, value, oldValue *T, - optionName string, enabled bool, validator func(context.Context, operation.Operation, *field.Path, *T, *T) field.ErrorList, +func IfOption[T any](ctx context.Context, op operation.Operation, fldPath *field.Path, value, oldValue T, + optionName string, enabled bool, validator func(context.Context, operation.Operation, *field.Path, T, T) field.ErrorList, ) field.ErrorList { - if op.HasOption(optionName) == enabled { + on, defined := op.HasOption(optionName) + if !defined { + return field.ErrorList{field.InternalError(fldPath, fmt.Errorf("undefined validation option %q", optionName))} + } + if on == enabled { return validator(ctx, op, fldPath, value, oldValue) } return nil diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/strfmt.go b/vendor/k8s.io/apimachinery/pkg/api/validate/strfmt.go index 190fa8dbe9..893f55d777 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/validate/strfmt.go +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/strfmt.go @@ -97,6 +97,28 @@ func LabelKey[T ~string](_ context.Context, op operation.Operation, fldPath *fie return allErrs } +// PrefixedLabelKey verifies that the specified value is a valid label key with +// a domain prefix. +// A prefixed label key is composed of a prefix and a name, separated by a '/'. +// The name part is required and must: +// - be 63 characters or less +// - begin and end with an alphanumeric character ([a-z0-9A-Z]) +// - contain only alphanumeric characters, dashes (-), underscores (_), or dots (.) +// +// The prefix must: +// - be a DNS subdomain +// - be no more than 253 characters +func PrefixedLabelKey[T ~string](_ context.Context, op operation.Operation, fldPath *field.Path, value, _ *T) field.ErrorList { + if value == nil { + return nil + } + var allErrs field.ErrorList + for _, msg := range content.IsPrefixedLabelKey((string)(*value)) { + allErrs = append(allErrs, field.Invalid(fldPath, *value, msg).WithOrigin("format=k8s-prefixed-label-key")) + } + return allErrs +} + // LongNameCaseless verifies that the specified value is a valid "long name" // (sometimes known as a "DNS subdomain"), but is case-insensitive. // - must not be empty diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/subfield.go b/vendor/k8s.io/apimachinery/pkg/api/validate/subfield.go index 896f3c3f36..7aa48d3304 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/validate/subfield.go +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/subfield.go @@ -31,6 +31,9 @@ type GetFieldFunc[Tstruct any, Tfield any] func(*Tstruct) Tfield // the value of the subfield is the same as the previous value, as per the // equiv function, then no validation is performed. // +// The equiv function can be called with nil arguments in the case of nilable +// fields. +// // The fldPath passed to the validator includes the subfield name. func Subfield[Tstruct any, Tfield any]( ctx context.Context, op operation.Operation, fldPath *field.Path, diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/update.go b/vendor/k8s.io/apimachinery/pkg/api/validate/update.go index e67ee28ded..c258e6d112 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/validate/update.go +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/update.go @@ -18,6 +18,8 @@ package validate import ( "context" + "fmt" + "slices" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/operation" @@ -34,11 +36,16 @@ const ( NoUnset // NoModify prevents value changes but allows set/unset transitions NoModify + // NoAddItem prevents adding items to a slice or map + NoAddItem + // NoRemoveItem prevents removing items from a slice or map + NoRemoveItem ) // UpdateValueByCompare verifies update constraints for comparable value types. func UpdateValueByCompare[T comparable](_ context.Context, op operation.Operation, fldPath *field.Path, value, oldValue *T, constraints ...UpdateConstraint) field.ErrorList { - if op.Type != operation.Update { + // nil oldValue means no prior value to compare against (eg: a new item at +k8s:eachVal scope) -> no transition to check. + if op.Type != operation.Update || oldValue == nil { return nil } @@ -101,7 +108,8 @@ func UpdatePointer[T any](_ context.Context, op operation.Operation, fldPath *fi // UpdateValueByReflect verifies update constraints for non-comparable value types using reflection. func UpdateValueByReflect[T any](_ context.Context, op operation.Operation, fldPath *field.Path, value, oldValue *T, constraints ...UpdateConstraint) field.ErrorList { - if op.Type != operation.Update { + // nil oldValue means no prior value to compare against (eg: a new item at +k8s:eachVal scope) -> no transition to check. + if op.Type != operation.Update || oldValue == nil { return nil } @@ -136,7 +144,8 @@ func UpdateValueByReflect[T any](_ context.Context, op operation.Operation, fldP // UpdateStruct verifies update constraints for non-pointer struct types. // Non-pointer structs are always considered "set" and never "unset". func UpdateStruct[T any](_ context.Context, op operation.Operation, fldPath *field.Path, value, oldValue *T, constraints ...UpdateConstraint) field.ErrorList { - if op.Type != operation.Update { + // nil oldValue means no prior value to compare against (eg: a new item at +k8s:eachVal scope) -> no transition to check. + if op.Type != operation.Update || oldValue == nil { return nil } @@ -158,3 +167,142 @@ func UpdateStruct[T any](_ context.Context, op operation.Operation, fldPath *fie return errs } + +// ValSliceUpdate verifies update constraints for slices of values. +// NoAddItem and NoRemoveItem use the match function to find corresponding +// elements between value and oldValue. NoSet and NoUnset treat len == 0 as +// "unset". +// +// The match function will never be called with nil arguments. +func ValSliceUpdate[T any](_ context.Context, op operation.Operation, fldPath *field.Path, value, oldValue []T, match MatchFunc[*T], constraints ...UpdateConstraint) field.ErrorList { + if op.Type != operation.Update { + return nil + } + + if match == nil && (slices.Contains(constraints, NoAddItem) || slices.Contains(constraints, NoRemoveItem)) { + return field.ErrorList{field.InternalError(fldPath, fmt.Errorf("ValSliceUpdate: NoAddItem/NoRemoveItem require a non-nil match function"))} + } + + var errs field.ErrorList + + for _, constraint := range constraints { + switch constraint { + case NoSet: + if len(oldValue) == 0 && len(value) > 0 { + errs = append(errs, field.Invalid(fldPath, nil, "field cannot be set once created").WithOrigin("update")) + } + case NoUnset: + if len(oldValue) > 0 && len(value) == 0 { + errs = append(errs, field.Invalid(fldPath, nil, "field cannot be cleared once set").WithOrigin("update")) + } + case NoAddItem: + for i := range value { + newItem := &value[i] + if lookup(oldValue, newItem, match) == nil { + errs = append(errs, field.Forbidden(fldPath.Index(i), "item may not be added").WithOrigin("update")) + } + } + case NoRemoveItem: + for i := range oldValue { + oldItem := &oldValue[i] + if lookup(value, oldItem, match) == nil { + errs = append(errs, field.Forbidden(fldPath, "item may not be removed").WithOrigin("update")) + } + } + } + } + + return errs +} + +// PtrSliceUpdate verifies update constraints for slices of pointers. +// NoAddItem and NoRemoveItem use the match function to find corresponding +// elements between value and oldValue. NoSet and NoUnset treat len == 0 as +// "unset". +// +// The match function will never be called with nil arguments. +func PtrSliceUpdate[T any](ctx context.Context, op operation.Operation, fldPath *field.Path, value, oldValue []*T, match MatchFunc[*T], constraints ...UpdateConstraint) field.ErrorList { + if op.Type != operation.Update { + return nil + } + + if match == nil && (slices.Contains(constraints, NoAddItem) || slices.Contains(constraints, NoRemoveItem)) { + return field.ErrorList{field.InternalError(fldPath, fmt.Errorf("PtrSliceUpdate: NoAddItem/NoRemoveItem require a non-nil match function"))} + } + + var errs field.ErrorList + + for _, constraint := range constraints { + switch constraint { + case NoSet: + if len(oldValue) == 0 && len(value) > 0 { + errs = append(errs, field.Invalid(fldPath, nil, "field cannot be set once created").WithOrigin("update")) + } + case NoUnset: + if len(oldValue) > 0 && len(value) == 0 { + errs = append(errs, field.Invalid(fldPath, nil, "field cannot be cleared once set").WithOrigin("update")) + } + case NoAddItem: + for i := range value { + newItem := value[i] + if newItem == nil { + // Ignore nil items; they are supposed to have been checked by PtrSliceNoNils. + continue + } + if lookupPointer(oldValue, newItem, match) == nil { + errs = append(errs, field.Forbidden(fldPath.Index(i), "item may not be added").WithOrigin("update")) + } + } + case NoRemoveItem: + for i := range oldValue { + oldItem := oldValue[i] + if oldItem == nil { + continue + } + if lookupPointer(value, oldItem, match) == nil { + errs = append(errs, field.Forbidden(fldPath, "item may not be removed").WithOrigin("update")) + } + } + } + } + + return errs +} + +// UpdateMap verifies update constraints for map types. +// NoAddItem and NoRemoveItem compare keys between value and oldValue. NoSet +// and NoUnset treat len == 0 as "unset". +func UpdateMap[K comparable, V any](_ context.Context, op operation.Operation, fldPath *field.Path, value, oldValue map[K]V, constraints ...UpdateConstraint) field.ErrorList { + if op.Type != operation.Update { + return nil + } + + var errs field.ErrorList + + for _, constraint := range constraints { + switch constraint { + case NoSet: + if len(oldValue) == 0 && len(value) > 0 { + errs = append(errs, field.Invalid(fldPath, nil, "field cannot be set once created").WithOrigin("update")) + } + case NoUnset: + if len(oldValue) > 0 && len(value) == 0 { + errs = append(errs, field.Invalid(fldPath, nil, "field cannot be cleared once set").WithOrigin("update")) + } + case NoAddItem: + for k := range value { + if _, ok := oldValue[k]; !ok { + errs = append(errs, field.Forbidden(fldPath.Key(fmt.Sprintf("%v", k)), "item may not be added").WithOrigin("update")) + } + } + case NoRemoveItem: + for k := range oldValue { + if _, ok := value[k]; !ok { + errs = append(errs, field.Forbidden(fldPath.Key(fmt.Sprintf("%v", k)), "item may not be removed").WithOrigin("update")) + } + } + } + } + + return errs +} diff --git a/vendor/k8s.io/apimachinery/pkg/api/validation/objectmeta.go b/vendor/k8s.io/apimachinery/pkg/api/validation/objectmeta.go index 9a4f378483..ff86973fbd 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/validation/objectmeta.go +++ b/vendor/k8s.io/apimachinery/pkg/api/validation/objectmeta.go @@ -17,11 +17,14 @@ limitations under the License. package validation import ( + "context" "fmt" "strings" apiequality "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/api/operation" + "k8s.io/apimachinery/pkg/api/validate" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1validation "k8s.io/apimachinery/pkg/apis/meta/v1/validation" "k8s.io/apimachinery/pkg/runtime/schema" @@ -68,20 +71,23 @@ func ValidateAnnotationsSize(annotations map[string]string) error { func validateOwnerReference(ownerReference metav1.OwnerReference, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} - gvk := schema.FromAPIVersionAndKind(ownerReference.APIVersion, ownerReference.Kind) + gv, err := schema.ParseGroupVersion(ownerReference.APIVersion) // gvk.Group is empty for the legacy group. - if len(gvk.Version) == 0 { - allErrs = append(allErrs, field.Invalid(fldPath.Child("apiVersion"), ownerReference.APIVersion, "version must not be empty")) + if len(ownerReference.APIVersion) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("apiVersion"), "must not be empty").MarkCoveredByDeclarative()) + } else if err != nil || len(gv.Version) == 0 { + allErrs = append(allErrs, field.Invalid(fldPath.Child("apiVersion"), ownerReference.APIVersion, "must be / or ")) } - if len(gvk.Kind) == 0 { - allErrs = append(allErrs, field.Invalid(fldPath.Child("kind"), ownerReference.Kind, "must not be empty")) + if len(ownerReference.Kind) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("kind"), "must not be empty").MarkCoveredByDeclarative()) } if len(ownerReference.Name) == 0 { - allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), ownerReference.Name, "must not be empty")) + allErrs = append(allErrs, field.Required(fldPath.Child("name"), "must not be empty").MarkCoveredByDeclarative()) } if len(ownerReference.UID) == 0 { - allErrs = append(allErrs, field.Invalid(fldPath.Child("uid"), ownerReference.UID, "must not be empty")) + allErrs = append(allErrs, field.Required(fldPath.Child("uid"), "must not be empty").MarkCoveredByDeclarative()) } + gvk := gv.WithKind(ownerReference.Kind) if _, ok := BannedOwners[gvk]; ok { allErrs = append(allErrs, field.Invalid(fldPath, ownerReference, fmt.Sprintf("%s is disallowed from being an owner", gvk))) } @@ -92,8 +98,8 @@ func validateOwnerReference(ownerReference metav1.OwnerReference, fldPath *field func ValidateOwnerReferences(ownerReferences []metav1.OwnerReference, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} firstControllerName := "" - for _, ref := range ownerReferences { - allErrs = append(allErrs, validateOwnerReference(ref, fldPath)...) + for idx, ref := range ownerReferences { + allErrs = append(allErrs, validateOwnerReference(ref, fldPath.Index(idx))...) if ref.Controller != nil && *ref.Controller { curControllerName := ref.Kind + "/" + ref.Name if firstControllerName != "" { @@ -136,6 +142,25 @@ func ValidateImmutableField(newVal, oldVal interface{}, fldPath *field.Path) fie return allErrs } +// ValidateObjectMetaDeclaratively validates an ObjectMeta instance declaratively and deduplicates handwritten errors. +// betaEnabled controls whether declarative validation rules at the Beta stability level are enforced. +// NOTE: This method should be used in the types for which declarative validation is not enabled yet or cannot be enabled. The types +// for which declarative validation is enabled and valdiation code is generated must use ValidateObjectMeta and ValidateObjectMetaUpdate. +func ValidateObjectMetaDeclaratively(ctx context.Context, op operation.Type, obj, oldObj *metav1.ObjectMeta, requiresNamespace bool, nameFn ValidateNameFunc, fldPath *field.Path, betaEnabled bool) field.ErrorList { + var errs field.ErrorList + switch op { + case operation.Create: + errs = ValidateObjectMeta(obj, requiresNamespace, nameFn, fldPath) + case operation.Update: + errs = ValidateObjectMetaUpdate(obj, oldObj, fldPath) + } + dvErrs := v1validation.Validate_ObjectMeta(ctx, operation.Operation{Type: op}, fldPath, obj, oldObj) + enforcedDVErrs := validate.FilterEnforcedDeclarativeErrors(ctx, dvErrs, betaEnabled) + errs = errs.MarkFromImperative() + errs = validate.FilterCoveredHandwrittenErrors(ctx, errs, enforcedDVErrs, betaEnabled) + return append(errs, enforcedDVErrs...) +} + // ValidateObjectMeta validates an object's metadata on creation. It expects that name generation has already // been performed. func ValidateObjectMeta(objMeta *metav1.ObjectMeta, requiresNamespace bool, nameFn ValidateNameFunc, fldPath *field.Path) field.ErrorList { @@ -262,12 +287,12 @@ func validateObjectMetaAccessorWithOptsCommon(meta metav1.Object, isNamespaced b } } - allErrs = append(allErrs, ValidateNonnegativeField(meta.GetGeneration(), fldPath.Child("generation"))...) + allErrs = append(allErrs, ValidateNonnegativeField(meta.GetGeneration(), fldPath.Child("generation")).MarkCoveredByDeclarative()...) allErrs = append(allErrs, v1validation.ValidateLabels(meta.GetLabels(), fldPath.Child("labels"))...) allErrs = append(allErrs, ValidateAnnotations(meta.GetAnnotations(), fldPath.Child("annotations"))...) allErrs = append(allErrs, ValidateOwnerReferences(meta.GetOwnerReferences(), fldPath.Child("ownerReferences"))...) allErrs = append(allErrs, ValidateFinalizers(meta.GetFinalizers(), fldPath.Child("finalizers"))...) - allErrs = append(allErrs, v1validation.ValidateManagedFields(meta.GetManagedFields(), fldPath.Child("managedFields"))...) + allErrs = append(allErrs, v1validation.ValidateManagedFields(meta.GetManagedFields(), fldPath.Child("managedFields"), v1validation.CoveredByDeclarative)...) return allErrs } @@ -323,21 +348,22 @@ func ValidateObjectMetaAccessorUpdate(newMeta, oldMeta metav1.Object, fldPath *f } // Generation shouldn't be decremented + allErrs = append(allErrs, ValidateNonnegativeField(newMeta.GetGeneration(), fldPath.Child("generation")).MarkCoveredByDeclarative()...) if newMeta.GetGeneration() < oldMeta.GetGeneration() { allErrs = append(allErrs, field.Invalid(fldPath.Child("generation"), newMeta.GetGeneration(), "must not be decremented")) } allErrs = append(allErrs, ValidateImmutableField(newMeta.GetName(), oldMeta.GetName(), fldPath.Child("name"))...) allErrs = append(allErrs, ValidateImmutableField(newMeta.GetNamespace(), oldMeta.GetNamespace(), fldPath.Child("namespace"))...) - allErrs = append(allErrs, ValidateImmutableField(newMeta.GetUID(), oldMeta.GetUID(), fldPath.Child("uid"))...) - allErrs = append(allErrs, ValidateImmutableField(newMeta.GetCreationTimestamp(), oldMeta.GetCreationTimestamp(), fldPath.Child("creationTimestamp"))...) - allErrs = append(allErrs, ValidateImmutableField(newMeta.GetDeletionTimestamp(), oldMeta.GetDeletionTimestamp(), fldPath.Child("deletionTimestamp"))...) - allErrs = append(allErrs, ValidateImmutableField(newMeta.GetDeletionGracePeriodSeconds(), oldMeta.GetDeletionGracePeriodSeconds(), fldPath.Child("deletionGracePeriodSeconds"))...) + allErrs = append(allErrs, ValidateImmutableField(newMeta.GetUID(), oldMeta.GetUID(), fldPath.Child("uid")).WithOrigin("immutable").MarkCoveredByDeclarative()...) + allErrs = append(allErrs, ValidateImmutableField(newMeta.GetCreationTimestamp(), oldMeta.GetCreationTimestamp(), fldPath.Child("creationTimestamp")).WithOrigin("immutable").MarkCoveredByDeclarative()...) + allErrs = append(allErrs, ValidateImmutableField(newMeta.GetDeletionTimestamp(), oldMeta.GetDeletionTimestamp(), fldPath.Child("deletionTimestamp")).WithOrigin("immutable").MarkCoveredByDeclarative()...) + allErrs = append(allErrs, ValidateImmutableField(newMeta.GetDeletionGracePeriodSeconds(), oldMeta.GetDeletionGracePeriodSeconds(), fldPath.Child("deletionGracePeriodSeconds")).WithOrigin("immutable").MarkCoveredByDeclarative()...) allErrs = append(allErrs, v1validation.ValidateLabels(newMeta.GetLabels(), fldPath.Child("labels"))...) allErrs = append(allErrs, ValidateAnnotations(newMeta.GetAnnotations(), fldPath.Child("annotations"))...) allErrs = append(allErrs, ValidateOwnerReferences(newMeta.GetOwnerReferences(), fldPath.Child("ownerReferences"))...) - allErrs = append(allErrs, v1validation.ValidateManagedFields(newMeta.GetManagedFields(), fldPath.Child("managedFields"))...) + allErrs = append(allErrs, v1validation.ValidateManagedFields(newMeta.GetManagedFields(), fldPath.Child("managedFields"), v1validation.CoveredByDeclarative)...) return allErrs } diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto index d03a733141..afc9b250fa 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto @@ -179,6 +179,9 @@ message ApplyOptions { // // +patchStrategy=merge // // +listType=map // // +listMapKey=type +// // +k8s:alpha(since: "1.37")=+k8s:optional +// // +k8s:alpha(since: "1.37")=+k8s:listType=map +// // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type // Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` // // // other fields @@ -193,12 +196,14 @@ message Condition { // +kubebuilder:validation:Required // +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_.]*)?[A-Za-z0-9])$` // +kubebuilder:validation:MaxLength=316 + // +k8s:alpha(since: "1.37")=+k8s:required optional string type = 1; // status of the condition, one of True, False, Unknown. // +required // +kubebuilder:validation:Required // +kubebuilder:validation:Enum=True;False;Unknown + // +k8s:alpha(since: "1.37")=+k8s:required optional string status = 2; // observedGeneration represents the .metadata.generation that the condition was set based upon. @@ -206,6 +211,8 @@ message Condition { // with respect to the current state of the instance. // +optional // +kubebuilder:validation:Minimum=0 + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:minimum=0 optional int64 observedGeneration = 3; // lastTransitionTime is the last time the condition transitioned from one status to another. @@ -214,6 +221,7 @@ message Condition { // +kubebuilder:validation:Required // +kubebuilder:validation:Type=string // +kubebuilder:validation:Format=date-time + // +k8s:alpha(since: "1.37")=+k8s:customValidation optional Time lastTransitionTime = 4; // reason contains a programmatic identifier indicating the reason for the condition's last transition. @@ -226,6 +234,8 @@ message Condition { // +kubebuilder:validation:MaxLength=1024 // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:Pattern=`^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$` + // +k8s:alpha(since: "1.37")=+k8s:required + // +k8s:alpha(since: "1.37")=+k8s:maxBytes=1024 optional string reason = 5; // message is a human readable message indicating details about the transition. @@ -700,6 +710,7 @@ message ManagedFieldsEntry { // Operation is the type of operation which lead to this ManagedFieldsEntry being created. // The only valid values for this field are 'Apply' and 'Update'. + // +k8s:alpha(since: "1.37")=+k8s:required optional string operation = 2; // APIVersion defines the version of this resource that this field set @@ -802,6 +813,8 @@ message ObjectMeta { // Read-only. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:immutable optional string uid = 5; // An opaque value that represents the internal version of this object that can @@ -820,6 +833,8 @@ message ObjectMeta { // A sequence number representing a specific generation of the desired state. // Populated by the system. Read-only. // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:minimum=0 optional int64 generation = 7; // CreationTimestamp is a timestamp representing the server time when this object was @@ -831,6 +846,7 @@ message ObjectMeta { // Null for lists. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable optional Time creationTimestamp = 8; // DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This @@ -852,6 +868,8 @@ message ObjectMeta { // Read-only. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:immutable optional Time deletionTimestamp = 9; // Number of seconds allowed for this object to gracefully terminate before @@ -859,6 +877,8 @@ message ObjectMeta { // May only be shortened. // Read-only. // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:immutable optional int64 deletionGracePeriodSeconds = 10; // Map of string keys and values that can be used to organize and categorize @@ -884,6 +904,7 @@ message ObjectMeta { // +patchStrategy=merge // +listType=map // +listMapKey=uid + // +k8s:alpha(since:"1.37")=+k8s:optional repeated OwnerReference ownerReferences = 13; // Must be empty before the object is deleted from the registry. Each entry @@ -914,6 +935,7 @@ message ObjectMeta { // // +optional // +listType=atomic + // +k8s:alpha(since: "1.37")=+k8s:optional repeated ManagedFieldsEntry managedFields = 17; } @@ -923,18 +945,22 @@ message ObjectMeta { // +structType=atomic message OwnerReference { // API version of the referent. + // +k8s:alpha(since:"1.37")=+k8s:required optional string apiVersion = 5; // Kind of the referent. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + // +k8s:alpha(since:"1.37")=+k8s:required optional string kind = 1; // Name of the referent. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + // +k8s:alpha(since:"1.37")=+k8s:required optional string name = 3; // UID of the referent. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + // +k8s:alpha(since:"1.37")=+k8s:required optional string uid = 4; // If true, this reference points to the managing controller. @@ -960,6 +986,7 @@ message PartialObjectMetadata { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType optional ObjectMeta metadata = 1; } diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go index c8b87f20c8..f88212e15e 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go @@ -176,6 +176,8 @@ type ObjectMeta struct { // Read-only. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:immutable UID types.UID `json:"uid,omitempty" protobuf:"bytes,5,opt,name=uid,casttype=k8s.io/kubernetes/pkg/types.UID"` // An opaque value that represents the internal version of this object that can @@ -194,6 +196,8 @@ type ObjectMeta struct { // A sequence number representing a specific generation of the desired state. // Populated by the system. Read-only. // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:minimum=0 Generation int64 `json:"generation,omitempty" protobuf:"varint,7,opt,name=generation"` // CreationTimestamp is a timestamp representing the server time when this object was @@ -205,6 +209,7 @@ type ObjectMeta struct { // Null for lists. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:alpha(since: "1.37")=+k8s:immutable CreationTimestamp Time `json:"creationTimestamp,omitempty,omitzero" protobuf:"bytes,8,opt,name=creationTimestamp"` // DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This @@ -226,6 +231,8 @@ type ObjectMeta struct { // Read-only. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:immutable DeletionTimestamp *Time `json:"deletionTimestamp,omitempty" protobuf:"bytes,9,opt,name=deletionTimestamp"` // Number of seconds allowed for this object to gracefully terminate before @@ -233,6 +240,8 @@ type ObjectMeta struct { // May only be shortened. // Read-only. // +optional + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:immutable DeletionGracePeriodSeconds *int64 `json:"deletionGracePeriodSeconds,omitempty" protobuf:"varint,10,opt,name=deletionGracePeriodSeconds"` // Map of string keys and values that can be used to organize and categorize @@ -258,6 +267,7 @@ type ObjectMeta struct { // +patchStrategy=merge // +listType=map // +listMapKey=uid + // +k8s:alpha(since:"1.37")=+k8s:optional OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" patchStrategy:"merge" patchMergeKey:"uid" protobuf:"bytes,13,rep,name=ownerReferences"` // Must be empty before the object is deleted from the registry. Each entry @@ -292,6 +302,7 @@ type ObjectMeta struct { // // +optional // +listType=atomic + // +k8s:alpha(since: "1.37")=+k8s:optional ManagedFields []ManagedFieldsEntry `json:"managedFields,omitempty" protobuf:"bytes,17,rep,name=managedFields"` } @@ -314,15 +325,19 @@ const ( // +structType=atomic type OwnerReference struct { // API version of the referent. + // +k8s:alpha(since:"1.37")=+k8s:required APIVersion string `json:"apiVersion" protobuf:"bytes,5,opt,name=apiVersion"` // Kind of the referent. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + // +k8s:alpha(since:"1.37")=+k8s:required Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"` // Name of the referent. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + // +k8s:alpha(since:"1.37")=+k8s:required Name string `json:"name" protobuf:"bytes,3,opt,name=name"` // UID of the referent. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + // +k8s:alpha(since:"1.37")=+k8s:required UID types.UID `json:"uid" protobuf:"bytes,4,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"` // If true, this reference points to the managing controller. // +optional @@ -344,7 +359,7 @@ type OwnerReference struct { // ListOptions is the query options to a standard REST list call. type ListOptions struct { - TypeMeta `json:",inline"` + TypeMeta `json:""` // A selector to restrict the list of returned objects by their labels. // Defaults to everything. @@ -517,7 +532,7 @@ const ( // GetOptions is the standard query options to the standard REST get call. type GetOptions struct { - TypeMeta `json:",inline"` + TypeMeta `json:""` // resourceVersion sets a constraint on what resource versions a request may be served from. // See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for // details. @@ -557,7 +572,7 @@ const ( // DeleteOptions may be provided when deleting an API object. type DeleteOptions struct { - TypeMeta `json:",inline"` + TypeMeta `json:""` // The duration in seconds before the object should be deleted. Value must be non-negative integer. // The value zero indicates delete immediately. If this value is nil, the default grace period for the @@ -629,7 +644,7 @@ const ( // CreateOptions may be provided when creating an API object. type CreateOptions struct { - TypeMeta `json:",inline"` + TypeMeta `json:""` // When present, indicates that modifications should not be // persisted. An invalid or unrecognized dryRun directive will @@ -674,7 +689,7 @@ type CreateOptions struct { // PatchOptions may be provided when patching an API object. // PatchOptions is meant to be a superset of UpdateOptions. type PatchOptions struct { - TypeMeta `json:",inline"` + TypeMeta `json:""` // When present, indicates that modifications should not be // persisted. An invalid or unrecognized dryRun directive will @@ -726,7 +741,7 @@ type PatchOptions struct { // ApplyOptions is equivalent to PatchOptions. It is provided as a convenience with documentation // that speaks specifically to how the options fields relate to apply. type ApplyOptions struct { - TypeMeta `json:",inline"` + TypeMeta `json:""` // When present, indicates that modifications should not be // persisted. An invalid or unrecognized dryRun directive will @@ -759,7 +774,7 @@ func (o ApplyOptions) ToPatchOptions() PatchOptions { // UpdateOptions may be provided when updating an API object. // All fields in UpdateOptions should also be present in PatchOptions. type UpdateOptions struct { - TypeMeta `json:",inline"` + TypeMeta `json:""` // When present, indicates that modifications should not be // persisted. An invalid or unrecognized dryRun directive will @@ -811,7 +826,7 @@ type Preconditions struct { // Status is a return value for calls that don't return other objects. type Status struct { - TypeMeta `json:",inline"` + TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -1131,7 +1146,7 @@ const ( // List holds a list of objects, which may not be known by the server. type List struct { - TypeMeta `json:",inline"` + TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -1147,7 +1162,7 @@ type List struct { // +protobuf.options.(gogoproto.goproto_stringer)=false // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type APIVersions struct { - TypeMeta `json:",inline"` + TypeMeta `json:""` // versions are the api versions that are available. // +listType=atomic Versions []string `json:"versions" protobuf:"bytes,1,rep,name=versions"` @@ -1167,7 +1182,7 @@ type APIVersions struct { // APIGroupList is a list of APIGroup, to allow clients to discover the API at // /apis. type APIGroupList struct { - TypeMeta `json:",inline"` + TypeMeta `json:""` // groups is a list of APIGroup. // +listType=atomic Groups []APIGroup `json:"groups" protobuf:"bytes,1,rep,name=groups"` @@ -1178,7 +1193,7 @@ type APIGroupList struct { // APIGroup contains the name, the supported versions, and the preferred version // of a group. type APIGroup struct { - TypeMeta `json:",inline"` + TypeMeta `json:""` // name is the name of the group. Name string `json:"name" protobuf:"bytes,1,opt,name=name"` // versions are the versions supported in this group. @@ -1273,7 +1288,7 @@ func (vs Verbs) String() string { // resources supported in a specific group and version, and if the resource // is namespaced. type APIResourceList struct { - TypeMeta `json:",inline"` + TypeMeta `json:""` // groupVersion is the group and version this APIResourceList is for. GroupVersion string `json:"groupVersion" protobuf:"bytes,1,opt,name=groupVersion"` // resources contains the name of the resources and if they are namespaced. @@ -1394,6 +1409,7 @@ type ManagedFieldsEntry struct { Manager string `json:"manager,omitempty" protobuf:"bytes,1,opt,name=manager"` // Operation is the type of operation which lead to this ManagedFieldsEntry being created. // The only valid values for this field are 'Apply' and 'Update'. + // +k8s:alpha(since: "1.37")=+k8s:required Operation ManagedFieldsOperationType `json:"operation,omitempty" protobuf:"bytes,2,opt,name=operation,casttype=ManagedFieldsOperationType"` // APIVersion defines the version of this resource that this field set // applies to. The format is "group/version" just like the top-level @@ -1429,6 +1445,7 @@ type ManagedFieldsEntry struct { } // ManagedFieldsOperationType is the type of operation which lead to a ManagedFieldsEntry being created. +// +k8s:alpha(since: "1.37")=+k8s:enum type ManagedFieldsOperationType string const ( @@ -1446,7 +1463,7 @@ const ( // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +protobuf=false type Table struct { - TypeMeta `json:",inline"` + TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -1537,6 +1554,7 @@ const ( RowCompleted RowConditionType = "Completed" ) +// +k8s:alpha(since: "1.37")=+k8s:enum type ConditionStatus string // These are valid condition statuses. "ConditionTrue" means a resource is in the condition. @@ -1565,7 +1583,7 @@ const ( // +k8s:conversion-gen:explicit-from=net/url.Values // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type TableOptions struct { - TypeMeta `json:",inline"` + TypeMeta `json:""` // NoHeaders is only exposed for internal callers. It is not included in our OpenAPI definitions // and may be removed as a field in a future release. @@ -1582,17 +1600,18 @@ type TableOptions struct { // to get access to a particular ObjectMeta schema without knowing the details of the version. // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type PartialObjectMetadata struct { - TypeMeta `json:",inline"` + TypeMeta `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional + // +k8s:opaqueType ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` } // PartialObjectMetadataList contains a list of objects containing only their metadata // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type PartialObjectMetadataList struct { - TypeMeta `json:",inline"` + TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional @@ -1613,6 +1632,9 @@ type PartialObjectMetadataList struct { // // +patchStrategy=merge // // +listType=map // // +listMapKey=type +// // +k8s:alpha(since: "1.37")=+k8s:optional +// // +k8s:alpha(since: "1.37")=+k8s:listType=map +// // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type // Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` // // // other fields @@ -1627,17 +1649,21 @@ type Condition struct { // +kubebuilder:validation:Required // +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_.]*)?[A-Za-z0-9])$` // +kubebuilder:validation:MaxLength=316 + // +k8s:alpha(since: "1.37")=+k8s:required Type string `json:"type" protobuf:"bytes,1,opt,name=type"` // status of the condition, one of True, False, Unknown. // +required // +kubebuilder:validation:Required // +kubebuilder:validation:Enum=True;False;Unknown + // +k8s:alpha(since: "1.37")=+k8s:required Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status"` // observedGeneration represents the .metadata.generation that the condition was set based upon. // For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date // with respect to the current state of the instance. // +optional // +kubebuilder:validation:Minimum=0 + // +k8s:alpha(since: "1.37")=+k8s:optional + // +k8s:alpha(since: "1.37")=+k8s:minimum=0 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"` // lastTransitionTime is the last time the condition transitioned from one status to another. // This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. @@ -1645,6 +1671,7 @@ type Condition struct { // +kubebuilder:validation:Required // +kubebuilder:validation:Type=string // +kubebuilder:validation:Format=date-time + // +k8s:alpha(since: "1.37")=+k8s:customValidation LastTransitionTime Time `json:"lastTransitionTime" protobuf:"bytes,4,opt,name=lastTransitionTime"` // reason contains a programmatic identifier indicating the reason for the condition's last transition. // Producers of specific condition types may define expected values and meanings for this field, @@ -1656,6 +1683,8 @@ type Condition struct { // +kubebuilder:validation:MaxLength=1024 // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:Pattern=`^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$` + // +k8s:alpha(since: "1.37")=+k8s:required + // +k8s:alpha(since: "1.37")=+k8s:maxBytes=1024 Reason string `json:"reason" protobuf:"bytes,5,opt,name=reason"` // message is a human readable message indicating details about the transition. // This may be an empty string. diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go index 59f43b7bff..592445d9c8 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go @@ -523,6 +523,7 @@ func NewJSONFallbackEncoder(encoder runtime.Encoder) runtime.Encoder { } identifier, err := gojson.Marshal(result) if err != nil { + //nolint:logcheck // Should not be reached. klog.Fatalf("Failed marshaling identifier for jsonFallbackEncoder: %v", err) } return &jsonFallbackEncoder{ diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/doc.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/doc.go new file mode 100644 index 0000000000..3b9cb30f2a --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/doc.go @@ -0,0 +1,21 @@ +/* +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. +*/ + +// +k8s:validation-gen=TypesWithField=TypeMeta +// +k8s:validation-gen-input=k8s.io/apimachinery/pkg/apis/meta/v1 + +// Package validation holds generated validations for meta/v1 types. +package validation diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go index d0ca20013a..b9ec344270 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go @@ -17,10 +17,12 @@ limitations under the License. package validation import ( + "context" "fmt" "regexp" "unicode" + "k8s.io/apimachinery/pkg/api/operation" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" @@ -266,14 +268,39 @@ func ValidateTableOptions(opts *metav1.TableOptions) field.ErrorList { const MaxSubresourceNameLength = 256 -func ValidateManagedFields(fieldsList []metav1.ManagedFieldsEntry, fldPath *field.Path) field.ErrorList { +// ManagedFieldsValidationOption specifies options for validating managed fields. +type ManagedFieldsValidationOption int + +const ( + // CoveredByDeclarative indicates whether errors should be marked as covered by declarative validation. + CoveredByDeclarative ManagedFieldsValidationOption = iota + 1 +) + +// ValidateManagedFields validates a list of managed fields. +func ValidateManagedFields(fieldsList []metav1.ManagedFieldsEntry, fldPath *field.Path, opts ...ManagedFieldsValidationOption) field.ErrorList { + coveredByDeclarative := false + for _, opt := range opts { + if opt == CoveredByDeclarative { + coveredByDeclarative = true + } + } var allErrs field.ErrorList for i, fields := range fieldsList { fldPath := fldPath.Index(i) switch fields.Operation { + case "": + err := field.Required(fldPath.Child("operation"), "must not be empty") + if coveredByDeclarative { + err = err.MarkCoveredByDeclarative() + } + allErrs = append(allErrs, err) case metav1.ManagedFieldsOperationApply, metav1.ManagedFieldsOperationUpdate: default: - allErrs = append(allErrs, field.Invalid(fldPath.Child("operation"), fields.Operation, "must be `Apply` or `Update`")) + err := field.NotSupported(fldPath.Child("operation"), fields.Operation, []metav1.ManagedFieldsOperationType{metav1.ManagedFieldsOperationApply, metav1.ManagedFieldsOperationUpdate}) + if coveredByDeclarative { + err = err.MarkCoveredByDeclarative() + } + allErrs = append(allErrs, err) } if len(fields.FieldsType) > 0 && fields.FieldsType != "FieldsV1" { allErrs = append(allErrs, field.Invalid(fldPath.Child("fieldsType"), fields.FieldsType, "must be `FieldsV1`")) @@ -293,7 +320,7 @@ func ValidateConditions(conditions []metav1.Condition, fldPath *field.Path) fiel conditionTypeToFirstIndex := map[string]int{} for i, condition := range conditions { if _, ok := conditionTypeToFirstIndex[condition.Type]; ok { - allErrs = append(allErrs, field.Duplicate(fldPath.Index(i).Child("type"), condition.Type)) + allErrs = append(allErrs, field.Duplicate(fldPath.Index(i), condition.Type).MarkCoveredByDeclarative()) } else { conditionTypeToFirstIndex[condition.Type] = i } @@ -316,29 +343,35 @@ func ValidateCondition(condition metav1.Condition, fldPath *field.Path) field.Er var allErrs field.ErrorList // type is set and is a valid format - allErrs = append(allErrs, ValidateLabelName(condition.Type, fldPath.Child("type"))...) + if len(condition.Type) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("type"), "is required").MarkCoveredByDeclarative()) + } else { + allErrs = append(allErrs, ValidateLabelName(condition.Type, fldPath.Child("type"))...) + } // status is set and is an accepted value - if !validConditionStatuses.Has(string(condition.Status)) { - allErrs = append(allErrs, field.NotSupported(fldPath.Child("status"), condition.Status, validConditionStatuses.List())) + if len(condition.Status) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("status"), "").MarkCoveredByDeclarative()) + } else if !validConditionStatuses.Has(string(condition.Status)) { + allErrs = append(allErrs, field.NotSupported(fldPath.Child("status"), condition.Status, validConditionStatuses.List()).MarkCoveredByDeclarative()) } if condition.ObservedGeneration < 0 { - allErrs = append(allErrs, field.Invalid(fldPath.Child("observedGeneration"), condition.ObservedGeneration, "must be greater than or equal to zero")) + allErrs = append(allErrs, field.Invalid(fldPath.Child("observedGeneration"), condition.ObservedGeneration, "must be greater than or equal to zero").WithOrigin("minimum").MarkCoveredByDeclarative()) } if condition.LastTransitionTime.IsZero() { - allErrs = append(allErrs, field.Required(fldPath.Child("lastTransitionTime"), "")) + allErrs = append(allErrs, field.Required(fldPath.Child("lastTransitionTime"), "").MarkCoveredByDeclarative()) } if len(condition.Reason) == 0 { - allErrs = append(allErrs, field.Required(fldPath.Child("reason"), "")) + allErrs = append(allErrs, field.Required(fldPath.Child("reason"), "").MarkCoveredByDeclarative()) } else { - for _, currErr := range isValidConditionReason(condition.Reason) { + for _, currErr := range IsValidConditionReason(condition.Reason) { allErrs = append(allErrs, field.Invalid(fldPath.Child("reason"), condition.Reason, currErr)) } if len(condition.Reason) > maxReasonLen { - allErrs = append(allErrs, field.TooLong(fldPath.Child("reason"), "" /*unused*/, maxReasonLen)) + allErrs = append(allErrs, field.TooLong(fldPath.Child("reason"), "" /*unused*/, maxReasonLen).WithOrigin("maxBytes").MarkCoveredByDeclarative()) } } @@ -354,8 +387,9 @@ const conditionReasonErrMsg string = "a condition reason must start with alphabe var conditionReasonRegexp = regexp.MustCompile("^" + conditionReasonFmt + "$") -// isValidConditionReason tests for a string that conforms to rules for condition reasons. This checks the format, but not the length. -func isValidConditionReason(value string) []string { +// IsValidConditionReason tests for a string that conforms to rules for condition +// reasons. This checks the format, but not the length. +func IsValidConditionReason(value string) []string { if !conditionReasonRegexp.MatchString(value) { return []string{validation.RegexError(conditionReasonErrMsg, conditionReasonFmt, "my_name", "MY_NAME", "MyName", "ReasonA,ReasonB", "ReasonA:ReasonB")} } @@ -370,9 +404,6 @@ func ValidateIgnoreStoreReadError(fldPath *field.Path, options *metav1.DeleteOpt return allErrs } - if len(options.DryRun) > 0 { - allErrs = append(allErrs, field.Invalid(fldPath, true, "cannot be set together with .dryRun")) - } if options.PropagationPolicy != nil { allErrs = append(allErrs, field.Invalid(fldPath, true, "cannot be set together with .propagationPolicy")) } @@ -389,3 +420,14 @@ func ValidateIgnoreStoreReadError(fldPath *field.Path, options *metav1.DeleteOpt return allErrs } + +// ValidateCustom_Condition_LastTransitionTime is wired into the generated +// declarative validation by +k8s:customValidation on Condition.LastTransitionTime. +// It enforces that the field is set, mirroring the handwritten check in +// ValidateCondition. +func ValidateCustom_Condition_LastTransitionTime(ctx context.Context, op operation.Operation, fldPath *field.Path, value, oldValue *metav1.Time) field.ErrorList { + if value.IsZero() { + return field.ErrorList{field.Required(fldPath, "")} + } + return nil +} diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/zz_generated.validations.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/zz_generated.validations.go new file mode 100644 index 0000000000..f79373a26d --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/zz_generated.validations.go @@ -0,0 +1,638 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by validation-gen. DO NOT EDIT. + +package validation + +import ( + context "context" + + equality "k8s.io/apimachinery/pkg/api/equality" + operation "k8s.io/apimachinery/pkg/api/operation" + safe "k8s.io/apimachinery/pkg/api/safe" + validate "k8s.io/apimachinery/pkg/api/validate" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + sets "k8s.io/apimachinery/pkg/util/sets" + field "k8s.io/apimachinery/pkg/util/validation/field" +) + +// Validate_Condition validates an instance of Condition according +// to declarative validation rules in the API schema. +func Validate_Condition( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *v1.Condition) (errs field.ErrorList) { + + { // field v1.Condition.Type + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.Condition) *string { + return &oldObj.Type + }) + errs = append(errs, fn(fldPath.Child("type"), &obj.Type, oldVal, oldObj != nil)...) + } + + { // field v1.Condition.Status + fn := func( + fldPath *field.Path, + obj, oldObj *v1.ConditionStatus, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_ConditionStatus(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.Condition) *v1.ConditionStatus { + return &oldObj.Status + }) + errs = append(errs, fn(fldPath.Child("status"), &obj.Status, oldVal, oldObj != nil)...) + } + + { // field v1.Condition.ObservedGeneration + fn := func( + fldPath *field.Path, + obj, oldObj *int64, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.Minimum(ctx, op, fldPath, obj, oldObj, 0).MarkAlpha(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.Condition) *int64 { + return &oldObj.ObservedGeneration + }) + errs = append(errs, fn(fldPath.Child("observedGeneration"), &obj.ObservedGeneration, oldVal, oldObj != nil)...) + } + + { // field v1.Condition.LastTransitionTime + fn := func( + fldPath *field.Path, + obj, oldObj *v1.Time, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + // custom validation + if e := ValidateCustom_Condition_LastTransitionTime(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.Condition) *v1.Time { + return &oldObj.LastTransitionTime + }) + errs = append(errs, fn(fldPath.Child("lastTransitionTime"), &obj.LastTransitionTime, oldVal, oldObj != nil)...) + } + + { // field v1.Condition.Reason + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.MaxBytes(ctx, op, fldPath, obj, oldObj, 1024).MarkAlpha(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.Condition) *string { + return &oldObj.Reason + }) + errs = append(errs, fn(fldPath.Child("reason"), &obj.Reason, oldVal, oldObj != nil)...) + } + + // field v1.Condition.Message has no validation + return errs +} + +var symbolsForConditionStatus = sets.New(v1.ConditionFalse, v1.ConditionTrue, v1.ConditionUnknown) + +// Validate_ConditionStatus validates an instance of ConditionStatus according +// to declarative validation rules in the API schema. +func Validate_ConditionStatus( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *v1.ConditionStatus) (errs field.ErrorList) { + + if e := validate.Enum(ctx, op, fldPath, obj, oldObj, symbolsForConditionStatus, nil).MarkAlpha(); len(e) != 0 { + errs = append(errs, e...) + } + + return errs +} + +// Validate_ManagedFieldsEntry validates an instance of ManagedFieldsEntry according +// to declarative validation rules in the API schema. +func Validate_ManagedFieldsEntry( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *v1.ManagedFieldsEntry) (errs field.ErrorList) { + + // field v1.ManagedFieldsEntry.Manager has no validation + + { // field v1.ManagedFieldsEntry.Operation + fn := func( + fldPath *field.Path, + obj, oldObj *v1.ManagedFieldsOperationType, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_ManagedFieldsOperationType(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.ManagedFieldsEntry) *v1.ManagedFieldsOperationType { + return &oldObj.Operation + }) + errs = append(errs, fn(fldPath.Child("operation"), &obj.Operation, oldVal, oldObj != nil)...) + } + + // field v1.ManagedFieldsEntry.APIVersion has no validation + // field v1.ManagedFieldsEntry.Time has no validation + // field v1.ManagedFieldsEntry.FieldsType has no validation + // field v1.ManagedFieldsEntry.FieldsV1 has no validation + // field v1.ManagedFieldsEntry.Subresource has no validation + return errs +} + +var symbolsForManagedFieldsOperationType = sets.New(v1.ManagedFieldsOperationApply, v1.ManagedFieldsOperationUpdate) + +// Validate_ManagedFieldsOperationType validates an instance of ManagedFieldsOperationType according +// to declarative validation rules in the API schema. +func Validate_ManagedFieldsOperationType( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *v1.ManagedFieldsOperationType) (errs field.ErrorList) { + + if e := validate.Enum(ctx, op, fldPath, obj, oldObj, symbolsForManagedFieldsOperationType, nil).MarkAlpha(); len(e) != 0 { + errs = append(errs, e...) + } + + return errs +} + +// Validate_ObjectMeta validates an instance of ObjectMeta according +// to declarative validation rules in the API schema. +func Validate_ObjectMeta( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *v1.ObjectMeta) (errs field.ErrorList) { + + // field v1.ObjectMeta.Name has no validation + // field v1.ObjectMeta.GenerateName has no validation + // field v1.ObjectMeta.Namespace has no validation + // field v1.ObjectMeta.SelfLink has no validation + + { // field v1.ObjectMeta.UID + fn := func( + fldPath *field.Path, + obj, oldObj *types.UID, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.ObjectMeta) *types.UID { + return &oldObj.UID + }) + errs = append(errs, fn(fldPath.Child("uid"), &obj.UID, oldVal, oldObj != nil)...) + } + + // field v1.ObjectMeta.ResourceVersion has no validation + + { // field v1.ObjectMeta.Generation + fn := func( + fldPath *field.Path, + obj, oldObj *int64, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.Minimum(ctx, op, fldPath, obj, oldObj, 0).MarkAlpha(); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.ObjectMeta) *int64 { + return &oldObj.Generation + }) + errs = append(errs, fn(fldPath.Child("generation"), &obj.Generation, oldVal, oldObj != nil)...) + } + + { // field v1.ObjectMeta.CreationTimestamp + fn := func( + fldPath *field.Path, + obj, oldObj *v1.Time, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.ObjectMeta) *v1.Time { + return &oldObj.CreationTimestamp + }) + errs = append(errs, fn(fldPath.Child("creationTimestamp"), &obj.CreationTimestamp, oldVal, oldObj != nil)...) + } + + { // field v1.ObjectMeta.DeletionTimestamp + fn := func( + fldPath *field.Path, + obj, oldObj *v1.Time, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.ObjectMeta) *v1.Time { + return oldObj.DeletionTimestamp + }) + errs = append(errs, fn(fldPath.Child("deletionTimestamp"), obj.DeletionTimestamp, oldVal, oldObj != nil)...) + } + + { // field v1.ObjectMeta.DeletionGracePeriodSeconds + fn := func( + fldPath *field.Path, + obj, oldObj *int64, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.ObjectMeta) *int64 { + return oldObj.DeletionGracePeriodSeconds + }) + errs = append(errs, fn(fldPath.Child("deletionGracePeriodSeconds"), obj.DeletionGracePeriodSeconds, oldVal, oldObj != nil)...) + } + + // field v1.ObjectMeta.Labels has no validation + // field v1.ObjectMeta.Annotations has no validation + + { // field v1.ObjectMeta.OwnerReferences + fn := func( + fldPath *field.Path, + obj, oldObj []v1.OwnerReference, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_OwnerReference); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.ObjectMeta) []v1.OwnerReference { + return oldObj.OwnerReferences + }) + errs = append(errs, fn(fldPath.Child("ownerReferences"), obj.OwnerReferences, oldVal, oldObj != nil)...) + } + + // field v1.ObjectMeta.Finalizers has no validation + + { // field v1.ObjectMeta.ManagedFields + fn := func( + fldPath *field.Path, + obj, oldObj []v1.ManagedFieldsEntry, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_ManagedFieldsEntry); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.ObjectMeta) []v1.ManagedFieldsEntry { + return oldObj.ManagedFields + }) + errs = append(errs, fn(fldPath.Child("managedFields"), obj.ManagedFields, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_OwnerReference validates an instance of OwnerReference according +// to declarative validation rules in the API schema. +func Validate_OwnerReference( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *v1.OwnerReference) (errs field.ErrorList) { + + { // field v1.OwnerReference.APIVersion + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.OwnerReference) *string { + return &oldObj.APIVersion + }) + errs = append(errs, fn(fldPath.Child("apiVersion"), &obj.APIVersion, oldVal, oldObj != nil)...) + } + + { // field v1.OwnerReference.Kind + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.OwnerReference) *string { + return &oldObj.Kind + }) + errs = append(errs, fn(fldPath.Child("kind"), &obj.Kind, oldVal, oldObj != nil)...) + } + + { // field v1.OwnerReference.Name + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.OwnerReference) *string { + return &oldObj.Name + }) + errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...) + } + + { // field v1.OwnerReference.UID + fn := func( + fldPath *field.Path, + obj, oldObj *types.UID, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.OwnerReference) *types.UID { + return &oldObj.UID + }) + errs = append(errs, fn(fldPath.Child("uid"), &obj.UID, oldVal, oldObj != nil)...) + } + + // field v1.OwnerReference.Controller has no validation + // field v1.OwnerReference.BlockOwnerDeletion has no validation + return errs +} diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types.go index 68f261cc14..1cda0840ac 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types.go @@ -62,7 +62,7 @@ type PartialObjectMetadata = v1.PartialObjectMetadata // PartialObjectMetadataList contains a list of objects containing only their metadata. // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type PartialObjectMetadataList struct { - v1.TypeMeta `json:",inline"` + v1.TypeMeta `json:""` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional diff --git a/vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go b/vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go index b0a9246d97..5eb25e2e80 100644 --- a/vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go +++ b/vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go @@ -34,8 +34,8 @@ type Unmarshaler interface { } func jsonTag(field reflect.StructField) (string, bool) { - structTag := field.Tag.Get("json") - if len(structTag) == 0 { + structTag, exists := field.Tag.Lookup("json") + if !exists || len(structTag) == 0 { return "", false } parts := strings.Split(structTag, ",") diff --git a/vendor/k8s.io/apimachinery/pkg/labels/selector.go b/vendor/k8s.io/apimachinery/pkg/labels/selector.go index 031dcd21be..f31a890f2b 100644 --- a/vendor/k8s.io/apimachinery/pkg/labels/selector.go +++ b/vendor/k8s.io/apimachinery/pkg/labels/selector.go @@ -269,13 +269,15 @@ func (r *Requirement) Matches(ls Labels) bool { } lsValue, err := strconv.ParseInt(val, 10, 64) if err != nil { - klog.V(10).Infof("ParseInt failed for value %+v in label %+v, %+v", val, ls, err) + //nolint:logcheck // Extending the API is not worth it for contextual, structured logging of this. + klog.V(10).InfoS("ParseInt failed", "value", val, "label", ls, "err", err) return false } // There should be only one strValue in r.strValues, and can be converted to an integer. if len(r.strValues) != 1 { - klog.V(10).Infof("Invalid values count %+v of requirement %#v, for 'Gt', 'Lt' operators, exactly one value is required", len(r.strValues), r) + //nolint:logcheck // Extending the API is not worth it for contextual, structured logging of this. + klog.V(10).InfoS("Invalid values count: for 'Gt', 'Lt' operators, exactly one value is required", "count", len(r.strValues), "requirement", r) return false } @@ -283,7 +285,8 @@ func (r *Requirement) Matches(ls Labels) bool { for i := range r.strValues { rValue, err = strconv.ParseInt(r.strValues[i], 10, 64) if err != nil { - klog.V(10).Infof("ParseInt failed for value %+v in requirement %#v, for 'Gt', 'Lt' operators, the value must be an integer", r.strValues[i], r) + //nolint:logcheck // Extending the API is not worth it for contextual, structured logging of this. + klog.V(10).InfoS("ParseInt failed: for 'Gt', 'Lt' operators, the value must be an integer", "value", r.strValues[i], "requirement", r, "err", err) return false } } diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/codec.go b/vendor/k8s.io/apimachinery/pkg/runtime/codec.go index 73f85286c2..654835b3ed 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/codec.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/codec.go @@ -226,6 +226,7 @@ func identifier(e Encoder) Identifier { } identifier, err := json.Marshal(result) if err != nil { + //nolint:logcheck // Should not be reached. klog.Fatalf("Failed marshaling identifier for base64Serializer: %v", err) } return Identifier(identifier) @@ -390,6 +391,7 @@ func (v multiGroupVersioner) Identifier() string { } identifier, err := json.Marshal(result) if err != nil { + //nolint:logcheck // Should not be reached. klog.Fatalf("Failed marshaling Identifier for %#v: %v", v, err) } return string(identifier) diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/conversion.go b/vendor/k8s.io/apimachinery/pkg/runtime/conversion.go index d04d701f37..7cef382de2 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/conversion.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/conversion.go @@ -20,7 +20,6 @@ package runtime import ( "fmt" - "reflect" "strconv" "strings" @@ -41,18 +40,6 @@ func DefaultMetaV1FieldSelectorConversion(label, value string) (string, string, } } -// JSONKeyMapper uses the struct tags on a conversion to determine the key value for -// the other side. Use when mapping from a map[string]* to a struct or vice versa. -func JSONKeyMapper(key string, sourceTag, destTag reflect.StructTag) (string, string) { - if s := destTag.Get("json"); len(s) > 0 { - return strings.SplitN(s, ",", 2)[0], key - } - if s := sourceTag.Get("json"); len(s) > 0 { - return key, strings.SplitN(s, ",", 2)[0] - } - return key, key -} - func Convert_Slice_string_To_string(in *[]string, out *string, s conversion.Scope) error { if len(*in) == 0 { *out = "" diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/converter.go b/vendor/k8s.io/apimachinery/pkg/runtime/converter.go index b1a300959b..5aa118f58f 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/converter.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/converter.go @@ -251,9 +251,11 @@ func (c *unstructuredConverter) FromUnstructuredWithValidation(u map[string]inte newObj := reflect.New(t.Elem()).Interface() newErr := fromUnstructuredViaJSON(u, newObj) if (err != nil) != (newErr != nil) { + //nolint:logcheck // Should not be reached. klog.Fatalf("FromUnstructured unexpected error for %v: error: %v", u, err) } if err == nil && !c.comparison.DeepEqual(obj, newObj) { + //nolint:logcheck // Should not be reached. klog.Fatalf("FromUnstructured mismatch\nobj1: %#v\nobj2: %#v", obj, newObj) } } @@ -376,8 +378,8 @@ func fieldInfoFromField(structType reflect.Type, field int) *fieldInfo { // Cache miss - we need to compute the field name. info := &fieldInfo{} typeField := structType.Field(field) - jsonTag := typeField.Tag.Get("json") - if len(jsonTag) == 0 { + jsonTag, exists := typeField.Tag.Lookup("json") + if !exists || len(jsonTag) == 0 { if !typeField.Anonymous { // match stdlib behavior for naming fields that don't specify a json tag name info.name = typeField.Name @@ -385,7 +387,10 @@ func fieldInfoFromField(structType reflect.Type, field int) *fieldInfo { } else { items := strings.Split(jsonTag, ",") info.name = items[0] - if len(info.name) == 0 && !typeField.Anonymous { + if isInlinedFromTag(typeField, items[0], items[1:]) { + // match stdlib behavior when controlled by tag + info.name = "" + } else if len(info.name) == 0 && !typeField.Anonymous { // match stdlib behavior for naming fields that don't specify a json tag name info.name = typeField.Name } @@ -596,9 +601,11 @@ func (c *unstructuredConverter) ToUnstructured(obj interface{}) (map[string]inte newUnstr := map[string]interface{}{} newErr := toUnstructuredViaJSON(obj, &newUnstr) if (err != nil) != (newErr != nil) { + //nolint:logcheck // Should not be reached. klog.Fatalf("ToUnstructured unexpected error for %v: error: %v; newErr: %v", obj, err, newErr) } if err == nil && !c.comparison.DeepEqual(u, newUnstr) { + //nolint:logcheck // Should not be reached. klog.Fatalf("ToUnstructured mismatch\nobj1: %#v\nobj2: %#v", u, newUnstr) } } @@ -680,11 +687,11 @@ func toUnstructured(sv, dv reflect.Value) error { dv.Set(reflect.ValueOf(sv.Int())) return nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - uVal := sv.Uint() - if uVal > math.MaxInt64 { - return fmt.Errorf("unsigned value %d does not fit into int64 (overflow)", uVal) + val, err := uintToUnstructuredHelper(sv.Uint()) + if err != nil { + return err } - dv.Set(reflect.ValueOf(int64(uVal))) + dv.Set(reflect.ValueOf(val)) return nil case reflect.Float32, reflect.Float64: dv.Set(reflect.ValueOf(sv.Float())) @@ -846,7 +853,11 @@ func structToUnstructured(sv, dv reflect.Value) error { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: realMap[fieldInfo.name] = fv.Int() case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - realMap[fieldInfo.name] = fv.Uint() + val, err := uintToUnstructuredHelper(fv.Uint()) + if err != nil { + return err + } + realMap[fieldInfo.name] = val case reflect.Float32, reflect.Float64: realMap[fieldInfo.name] = fv.Float() default: @@ -867,3 +878,10 @@ func interfaceToUnstructured(sv, dv reflect.Value) error { } return toUnstructured(sv.Elem(), dv) } + +func uintToUnstructuredHelper(uVal uint64) (int64, error) { + if uVal > math.MaxInt64 { + return 0, fmt.Errorf("unsigned value %d does not fit into int64 (overflow)", uVal) + } + return int64(uVal), nil +} diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/fieldinfo_126.go b/vendor/k8s.io/apimachinery/pkg/runtime/fieldinfo_126.go new file mode 100644 index 0000000000..686ff6abb3 --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/runtime/fieldinfo_126.go @@ -0,0 +1,26 @@ +//go:build !go1.27 + +/* +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. +*/ + +package runtime + +import "reflect" + +func isInlinedFromTag(fieldType reflect.StructField, tagName string, tagDirectives []string) bool { + // go <1.27 doesn't honor ",inline" + return false +} diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/fieldinfo_127.go b/vendor/k8s.io/apimachinery/pkg/runtime/fieldinfo_127.go new file mode 100644 index 0000000000..abaa79a2db --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/runtime/fieldinfo_127.go @@ -0,0 +1,33 @@ +//go:build go1.27 + +/* +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. +*/ + +package runtime + +import ( + "reflect" +) + +func isInlinedFromTag(field reflect.StructField, tagName string, tagDirectives []string) bool { + fieldType := field.Type + if fieldType.Kind() == reflect.Pointer && fieldType.Name() == "" { + // optionally unwrap a single level + fieldType = fieldType.Elem() + } + // TODO: when switching to direct use of json/v2, error on non-struct embedding and use of embed with other directives + return fieldType.Kind() == reflect.Struct && tagName == "" && len(tagDirectives) == 1 && tagDirectives[0] == "embed" +} diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto b/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto index 5f06cc5743..93d187d94a 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto +++ b/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto @@ -33,7 +33,7 @@ option go_package = "k8s.io/apimachinery/pkg/runtime"; // // Internal package: // // type MyAPIObject struct { -// runtime.TypeMeta `json:",inline"` +// runtime.TypeMeta `json:""` // MyPlugin runtime.Object `json:"myPlugin"` // } // @@ -44,7 +44,7 @@ option go_package = "k8s.io/apimachinery/pkg/runtime"; // // External package: // // type MyAPIObject struct { -// runtime.TypeMeta `json:",inline"` +// runtime.TypeMeta `json:""` // MyPlugin runtime.RawExtension `json:"myPlugin"` // } // @@ -85,7 +85,7 @@ message RawExtension { // like this: // // type MyAwesomeAPIObject struct { -// runtime.TypeMeta `json:",inline"` +// runtime.TypeMeta `json:""` // ... // other fields // } // diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/helper.go b/vendor/k8s.io/apimachinery/pkg/runtime/helper.go index 395dfdbd02..242a349865 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/helper.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/helper.go @@ -285,20 +285,26 @@ func (e *encoderWithAllocator) Identifier() Identifier { return e.encoder.Identifier() } +// The legacy discovery endpoint requires that its response Encoder implement Serializer. +// https://github.com/kubernetes/kubernetes/blob/4a1340bfd58fdb3846d4342c101e0bcb574fbfb1/staging/src/k8s.io/apiserver/pkg/endpoints/discovery/util.go#L101-L107 +var _ Serializer = nondeterministicEncoderToEncoderAdapter{} + type nondeterministicEncoderToEncoderAdapter struct { NondeterministicEncoder + + Decoder } func (e nondeterministicEncoderToEncoderAdapter) Encode(obj Object, w io.Writer) error { return e.EncodeNondeterministic(obj, w) } -// UseNondeterministicEncoding returns an Encoder that encodes objects using the provided Encoder's -// EncodeNondeterministic method if it implements NondeterministicEncoder, otherwise it returns the -// provided Encoder as-is. -func UseNondeterministicEncoding(encoder Encoder) Encoder { - if nondeterministic, ok := encoder.(NondeterministicEncoder); ok { - return nondeterministicEncoderToEncoderAdapter{nondeterministic} +// UseNondeterministicEncoding returns an Encoder that encodes objects using the provided +// Serializer's EncodeNondeterministic method if it implements NondeterministicEncoder, otherwise it +// returns the provided Serializer as-is. +func UseNondeterministicEncoding(serializer Serializer) Encoder { + if nondeterministic, ok := serializer.(NondeterministicEncoder); ok { + return nondeterministicEncoderToEncoderAdapter{NondeterministicEncoder: nondeterministic, Decoder: serializer} } - return encoder + return serializer } diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go b/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go index e2fbeabdd0..80662e55c4 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go @@ -370,7 +370,7 @@ func (s *Scheme) AddValidationFunc(srcType Object, fn func(ctx context.Context, // Validate validates the provided Object according to the generated declarative validation code. // WARNING: This does not validate all objects! The handwritten validation code in validation.go // is not run when this is called. Only the generated zz_generated.validations.go validation code is run. -func (s *Scheme) Validate(ctx context.Context, options []string, object Object, subresources ...string) field.ErrorList { +func (s *Scheme) Validate(ctx context.Context, options map[string]bool, object Object, subresources ...string) field.ErrorList { if fn, ok := s.validationFuncs[reflect.TypeOf(object)]; ok { return fn(ctx, operation.Operation{Type: operation.Create, Request: operation.Request{Subresources: subresources}, Options: options}, object, nil) } @@ -380,13 +380,21 @@ func (s *Scheme) Validate(ctx context.Context, options []string, object Object, // ValidateUpdate validates the provided object and oldObject according to the generated declarative validation code. // WARNING: This does not validate all objects! The handwritten validation code in validation.go // is not run when this is called. Only the generated zz_generated.validations.go validation code is run. -func (s *Scheme) ValidateUpdate(ctx context.Context, options []string, object, oldObject Object, subresources ...string) field.ErrorList { +func (s *Scheme) ValidateUpdate(ctx context.Context, options map[string]bool, object, oldObject Object, subresources ...string) field.ErrorList { if fn, ok := s.validationFuncs[reflect.TypeOf(object)]; ok { return fn(ctx, operation.Operation{Type: operation.Update, Request: operation.Request{Subresources: subresources}, Options: options}, object, oldObject) } return nil } +// HasValidationFunc reports whether a validation function is registered for the +// object's type. Unlike Validate, it distinguishes "no function registered" from +// "function ran and found no errors", which both yield a nil error list. +func (s *Scheme) HasValidationFunc(obj Object) bool { + _, ok := s.validationFuncs[reflect.TypeOf(obj)] + return ok +} + // Convert will attempt to convert in into out. Both must be pointers. For easy // testing of conversion functions. Returns an error if the conversion isn't // possible. You can call this with types that haven't been registered (for example, diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/cbor.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/cbor.go index 118579ec35..e5730e3c50 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/cbor.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/cbor.go @@ -68,8 +68,9 @@ type Serializer interface { var _ Serializer = &serializer{} type options struct { - strict bool - transcode bool + strict bool + transcode bool + streamingCollectionsEncoding bool } type Option func(*options) @@ -92,6 +93,13 @@ func Transcode(s bool) Option { } } +// StreamingCollectionsEncoding is used for testing purposes only. +func StreamingCollectionsEncoding(s bool) Option { + return func(opts *options) { + opts.streamingCollectionsEncoding = s + } +} + type serializer struct { metaFactory metaFactory creater runtime.ObjectCreater @@ -114,6 +122,7 @@ func newSerializer(metaFactory metaFactory, creater runtime.ObjectCreater, typer typer: typer, } s.options.transcode = true + s.options.streamingCollectionsEncoding = true for _, o := range options { o(&s.options) } @@ -147,15 +156,25 @@ func (s *serializer) EncodeNondeterministic(obj runtime.Object, w io.Writer) err } func (s *serializer) encode(mode modes.EncMode, obj runtime.Object, w io.Writer) error { + if _, err := w.Write(selfDescribedCBOR); err != nil { + return err + } + + if s.options.streamingCollectionsEncoding { + ok, err := streamEncodeCollections(obj, w, mode) + if err != nil { + return err + } + if ok { + return nil + } + } + var v interface{} = obj if u, ok := obj.(runtime.Unstructured); ok { v = u.UnstructuredContent() } - if _, err := w.Write(selfDescribedCBOR); err != nil { - return err - } - return mode.MarshalTo(v, w) } diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/collections.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/collections.go new file mode 100644 index 0000000000..5aa0fb7ca4 --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/collections.go @@ -0,0 +1,328 @@ +/* +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. +*/ + +package cbor + +import ( + "encoding/json" + "fmt" + "io" + "maps" + "math/rand" + "reflect" + "slices" + "sort" + + "k8s.io/apimachinery/pkg/conversion" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes" + + "github.com/fxamacker/cbor/v2" +) + +func streamEncodeCollections(obj runtime.Object, w io.Writer, mode modes.EncMode) (bool, error) { + list, ok := obj.(*unstructured.UnstructuredList) + if ok { + return true, streamingEncodeUnstructuredList(w, list, mode) + } + if _, ok := obj.(cbor.Marshaler); ok { + return false, nil + } + if _, ok := obj.(json.Marshaler); ok { + return false, nil + } + typeMeta, listMeta, items, err := getListMeta(obj) + if err == nil { + return true, streamingEncodeList(w, typeMeta, listMeta, items, mode) + } + return false, nil +} + +// getListMeta implements list extraction logic for cbor stream serialization. +func getListMeta(list runtime.Object) (metav1.TypeMeta, metav1.ListMeta, []interface{}, error) { + listValue, err := conversion.EnforcePtr(list) + if err != nil { + return metav1.TypeMeta{}, metav1.ListMeta{}, nil, err + } + listType := listValue.Type() + if listType.NumField() != 3 { + return metav1.TypeMeta{}, metav1.ListMeta{}, nil, fmt.Errorf("expected ListType to have 3 fields") + } + // The streaming encoder reproduces the field names and layout implied by the + // json struct tags (kind, apiVersion, metadata, items). The CBOR encoder, + // however, gives a "cbor" struct tag precedence over "json", so a cbor tag on + // any of these fields could rename a key, change its options (e.g. keyasint), + // or un-inline the embedded TypeMeta -- diverging from the streamed output. + // Refuse to stream such a type and fall back to the general encoder, which + // honors the cbor tag correctly. + for i := 0; i < listType.NumField(); i++ { + if _, ok := listType.Field(i).Tag.Lookup("cbor"); ok { + return metav1.TypeMeta{}, metav1.ListMeta{}, nil, fmt.Errorf("expected list field %d to have no cbor tag", i) + } + } + // TypeMeta + typeMeta, ok := listValue.Field(0).Interface().(metav1.TypeMeta) + if !ok { + return metav1.TypeMeta{}, metav1.ListMeta{}, nil, fmt.Errorf("expected TypeMeta field to have TypeMeta type") + } + if !listType.Field(0).Anonymous { + return metav1.TypeMeta{}, metav1.ListMeta{}, nil, fmt.Errorf(`expected TypeMeta json field tag to be embedded`) + } + if jsonTag, jsonTagExists := listType.Field(0).Tag.Lookup("json"); !jsonTagExists { + return metav1.TypeMeta{}, metav1.ListMeta{}, nil, fmt.Errorf(`expected TypeMeta json field tag`) + } else if jsonTag != "" && jsonTag != ",inline" { + return metav1.TypeMeta{}, metav1.ListMeta{}, nil, fmt.Errorf(`expected TypeMeta json field tag to be "" or ",inline"`) + } + // ListMeta + listMeta, ok := listValue.Field(1).Interface().(metav1.ListMeta) + if !ok { + return metav1.TypeMeta{}, metav1.ListMeta{}, nil, fmt.Errorf("expected ListMeta field to have ListMeta type") + } + if listType.Field(1).Tag.Get("json") != "metadata,omitempty" { + return metav1.TypeMeta{}, metav1.ListMeta{}, nil, fmt.Errorf(`expected ListMeta json field tag to be "metadata,omitempty"`) + } + // Items + if listType.Field(2).Tag.Get("json") != "items" { + return metav1.TypeMeta{}, metav1.ListMeta{}, nil, fmt.Errorf(`expected Items json field tag to be "items"`) + } + items, err := getListItems(listValue.Field(2)) + if err != nil { + return metav1.TypeMeta{}, metav1.ListMeta{}, nil, err + } + return typeMeta, listMeta, items, nil +} + +// getListItems returns the elements of a list's Items field as addressable +// values. Marshaling each element directly (rather than routing through +// meta.ExtractList) preserves the element's own type and custom marshaler, so +// that e.g. a metav1.List whose Items are runtime.RawExtension holding CBOR +// bytes are encoded verbatim by runtime.RawExtension.MarshalCBOR instead of +// being flattened into a runtime.Unknown (which has no MarshalCBOR and would be +// misencoded as a struct or fail JSON transcoding). +// +// A nil Items slice returns a nil result, distinct from an empty non-nil slice, +// so the encoder can emit CBOR null rather than an empty array. +func getListItems(itemsValue reflect.Value) ([]interface{}, error) { + if itemsValue.Kind() != reflect.Slice { + return nil, fmt.Errorf("expected Items field to be a slice, got %s", itemsValue.Kind()) + } + if itemsValue.IsNil() { + return nil, nil + } + items := make([]interface{}, itemsValue.Len()) + for i := range items { + items[i] = itemsValue.Index(i).Addr().Interface() + } + return items, nil +} + +type cborMapEntry struct { + key string + write func() error +} + +func streamingEncodeList(w io.Writer, typeMeta metav1.TypeMeta, listMeta metav1.ListMeta, items []interface{}, mode modes.EncMode) error { + var entries []cborMapEntry + + if typeMeta.Kind != "" { + entries = append(entries, cborMapEntry{ + key: "kind", + write: func() error { + return encodeKeyValuePair(w, "kind", typeMeta.Kind, mode) + }, + }) + } + entries = append(entries, cborMapEntry{ + key: "items", + write: func() error { + if err := mode.MarshalTo("items", w); err != nil { + return err + } + if items == nil { + _, err := w.Write([]byte{0xf6}) // CBOR null + return err + } + if err := writeArrayHead(w, len(items)); err != nil { + return err + } + for _, item := range items { + if err := mode.MarshalTo(item, w); err != nil { + return err + } + } + return nil + }, + }) + entries = append(entries, cborMapEntry{ + key: "metadata", + write: func() error { + return encodeKeyValuePair(w, "metadata", listMeta, mode) + }, + }) + if typeMeta.APIVersion != "" { + entries = append(entries, cborMapEntry{ + key: "apiVersion", + write: func() error { + return encodeKeyValuePair(w, "apiVersion", typeMeta.APIVersion, mode) + }, + }) + } + + // entries is built in a fixed order (kind, items, metadata, apiVersion). + // Unlike streamingEncodeUnstructuredList, whose keys come in Go's randomized + // map-iteration order, there is no inherent randomness here, so for + // nondeterministic modes (SortFastShuffle) we rotate the encoding for-loop + // by a random initial offset. + start := 0 + if !mode.IsDeterministic() && len(entries) > 0 { + start = rand.Intn(len(entries)) + } + + if err := writeMapHead(w, len(entries)); err != nil { + return err + } + + for i := 0; i < len(entries); i++ { + entry := entries[(start+i)%len(entries)] + if err := entry.write(); err != nil { + return err + } + } + return nil +} + +func streamingEncodeUnstructuredList(w io.Writer, list *unstructured.UnstructuredList, mode modes.EncMode) error { + keys := slices.Collect(maps.Keys(list.Object)) + if _, exists := list.Object["items"]; !exists { + keys = append(keys, "items") + } + // keys starts in Go's randomized map-iteration order. For deterministic + // modes (SortBytewiseLexical) we sort it: shorter lengths come first, then + // lexicographic by content. For nondeterministic modes (SortFastShuffle) we + // leave the map-iteration order as-is, which already varies from call to + // call (analogous to what SortFastShuffle does for structs), so no explicit + // shuffling is needed. + if mode.IsDeterministic() { + sort.Slice(keys, func(i, j int) bool { + if len(keys[i]) != len(keys[j]) { + return len(keys[i]) < len(keys[j]) + } + return keys[i] < keys[j] + }) + } + + if err := writeMapHead(w, len(keys)); err != nil { + return err + } + + for _, key := range keys { + if err := mode.MarshalTo(key, w); err != nil { + return err + } + if key == "items" { + if err := writeArrayHead(w, len(list.Items)); err != nil { + return err + } + for _, item := range list.Items { + if err := mode.MarshalTo(item.Object, w); err != nil { + return err + } + } + } else { + if err := mode.MarshalTo(list.Object[key], w); err != nil { + return err + } + } + } + return nil +} + +func encodeKeyValuePair(w io.Writer, key string, value interface{}, mode modes.EncMode) error { + if err := mode.MarshalTo(key, w); err != nil { + return err + } + if err := mode.MarshalTo(value, w); err != nil { + return err + } + return nil +} + +// CBOR major type prefix bytes (the type in the high 3 bits, additional info +// zeroed), following RFC 8949 Section 3.1. +const ( + cborTypeArray byte = 0x80 // major type 4 + cborTypeMap byte = 0xa0 // major type 5 +) + +// writeMapHead writes a CBOR map header for a map with n entries. +func writeMapHead(w io.Writer, n int) error { + return writeCollectionHead(w, cborTypeMap, int64(n)) +} + +// writeArrayHead writes a CBOR array header for an array with n elements. +func writeArrayHead(w io.Writer, n int) error { + return writeCollectionHead(w, cborTypeArray, int64(n)) +} + +// writeCollectionHead writes a CBOR collection (array or map) header encoding +// the number of elements n, following RFC 8949 Section 3 additional info rules: +// +// - base: the prefix byte for the collection type. +// For maps: cborTypeMap (0xa0), for arrays: cborTypeArray (0x80). +// +// The extended form prefixes are derived from base using bitwise OR: +// - base|24: 1-byte length follows (additional info 24) +// - base|25: 2-byte length follows (additional info 25) +// - base|26: 4-byte length follows (additional info 26) +// - base|27: 8-byte length follows (additional info 27) +// +// Encoding table (map example, base=0xa0): +// +// n <= 23: 1 byte — 0xa0|n +// n <= 0xFF: 2 bytes — 0xb8 (0xa0|24), n +// n <= 0xFFFF: 3 bytes — 0xb9 (0xa0|25), n>>8, n +// n <= 0xFFFFFFFF: 5 bytes — 0xba (0xa0|26), n>>24..n +// n > 0xFFFFFFFF: 9 bytes — 0xbb (0xa0|27), n>>56..n +func writeCollectionHead(w io.Writer, base byte, n int64) error { + switch { + case n <= 23: + // Additional info 0–23: length is encoded directly in the low 5 bits. + _, err := w.Write([]byte{base + byte(n)}) + return err + case n <= 0xFF: + // Additional info 24: one additional byte carries the length. + _, err := w.Write([]byte{base | 24, byte(n)}) + return err + case n <= 0xFFFF: + // Additional info 25: two additional bytes carry the length (big-endian). + _, err := w.Write([]byte{base | 25, byte(n >> 8), byte(n)}) + return err + case n <= 0xFFFFFFFF: + // Additional info 26: four additional bytes carry the length (big-endian). + _, err := w.Write([]byte{base | 26, byte(n >> 24), byte(n >> 16), byte(n >> 8), byte(n)}) + return err + default: + // Additional info 27: eight additional bytes carry the length (big-endian). + _, err := w.Write([]byte{ + base | 27, byte(n >> 56), byte(n >> 48), byte(n >> 40), byte(n >> 32), byte(n >> 24), byte(n >> 16), + byte(n >> 8), byte(n), + }) + return err + } +} diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/encode.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/encode.go index 815dbe6660..3287dfd31c 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/encode.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/encode.go @@ -107,6 +107,7 @@ var encode = EncMode{ } return encode }(), + deterministic: true, } var Encode = EncMode{ @@ -122,6 +123,7 @@ var Encode = EncMode{ } return em }(), + deterministic: true, } var EncodeNondeterministic = EncMode{ @@ -134,16 +136,22 @@ var EncodeNondeterministic = EncMode{ } return em }(), + deterministic: false, } type EncMode struct { - delegate cbor.UserBufferEncMode + delegate cbor.UserBufferEncMode + deterministic bool } func (em EncMode) options() cbor.EncOptions { return em.delegate.EncOptions() } +func (em EncMode) IsDeterministic() bool { + return em.deterministic +} + func (em EncMode) MarshalTo(v interface{}, w io.Writer) error { if buf, ok := w.(*buffer); ok { return em.delegate.MarshalToBuffer(v, &buf.Buffer) diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/collections.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/collections.go index 075163ddd8..3fa6012dde 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/collections.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/collections.go @@ -17,11 +17,10 @@ limitations under the License. package json import ( + "bytes" "encoding/json" "fmt" "io" - "maps" - "slices" "sort" "k8s.io/apimachinery/pkg/api/meta" @@ -35,14 +34,14 @@ import ( func streamEncodeCollections(obj runtime.Object, w io.Writer) (bool, error) { list, ok := obj.(*unstructured.UnstructuredList) if ok { - return true, streamingEncodeUnstructuredList(w, list) + return true, newStreamEncoder(w).encodeUnstructuredList(list) } if _, ok := obj.(json.Marshaler); ok { return false, nil } typeMeta, listMeta, items, err := getListMeta(obj) if err == nil { - return true, streamingEncodeList(w, typeMeta, listMeta, items) + return true, newStreamEncoder(w).encodeList(typeMeta, listMeta, items) } return false, nil } @@ -67,8 +66,13 @@ func getListMeta(list runtime.Object) (metav1.TypeMeta, metav1.ListMeta, []runti if !ok { return metav1.TypeMeta{}, metav1.ListMeta{}, nil, fmt.Errorf("expected TypeMeta field to have TypeMeta type") } - if listType.Field(0).Tag.Get("json") != ",inline" { - return metav1.TypeMeta{}, metav1.ListMeta{}, nil, fmt.Errorf(`expected TypeMeta json field tag to be ",inline"`) + if !listType.Field(0).Anonymous { + return metav1.TypeMeta{}, metav1.ListMeta{}, nil, fmt.Errorf(`expected TypeMeta json field tag to be embedded`) + } + if jsonTag, jsonTagExists := listType.Field(0).Tag.Lookup("json"); !jsonTagExists { + return metav1.TypeMeta{}, metav1.ListMeta{}, nil, fmt.Errorf(`expected TypeMeta json field tag`) + } else if jsonTag != "" && jsonTag != ",inline" { + return metav1.TypeMeta{}, metav1.ListMeta{}, nil, fmt.Errorf(`expected TypeMeta json field tag to be "" or ",inline"`) } // ListMeta listMeta, ok := listValue.Field(1).Interface().(metav1.ListMeta) @@ -89,45 +93,59 @@ func getListMeta(list runtime.Object) (metav1.TypeMeta, metav1.ListMeta, []runti return typeMeta, listMeta, items, nil } -func streamingEncodeList(w io.Writer, typeMeta metav1.TypeMeta, listMeta metav1.ListMeta, items []runtime.Object) error { +// streamEncoder encodes JSON values to w, reusing an internal buffer across +// values to avoid the fresh output allocation json.Marshal makes per call. +type streamEncoder struct { + w io.Writer + buf bytes.Buffer + json *json.Encoder +} + +func newStreamEncoder(w io.Writer) *streamEncoder { + e := &streamEncoder{w: w} + e.json = json.NewEncoder(&e.buf) + return e +} + +func (e *streamEncoder) encodeList(typeMeta metav1.TypeMeta, listMeta metav1.ListMeta, items []runtime.Object) error { // Start - if _, err := w.Write([]byte(`{`)); err != nil { + if _, err := e.w.Write([]byte(`{`)); err != nil { return err } // TypeMeta if typeMeta.Kind != "" { - if err := encodeKeyValuePair(w, "kind", typeMeta.Kind, []byte(",")); err != nil { + if err := e.encodeKeyValuePair("kind", typeMeta.Kind, []byte(",")); err != nil { return err } } if typeMeta.APIVersion != "" { - if err := encodeKeyValuePair(w, "apiVersion", typeMeta.APIVersion, []byte(",")); err != nil { + if err := e.encodeKeyValuePair("apiVersion", typeMeta.APIVersion, []byte(",")); err != nil { return err } } // ListMeta - if err := encodeKeyValuePair(w, "metadata", listMeta, []byte(",")); err != nil { + if err := e.encodeKeyValuePair("metadata", listMeta, []byte(",")); err != nil { return err } // Items - if err := encodeItemsObjectSlice(w, items); err != nil { + if err := e.encodeItemsObjectSlice(items); err != nil { return err } // End - _, err := w.Write([]byte("}\n")) + _, err := e.w.Write([]byte("}\n")) return err } -func encodeItemsObjectSlice(w io.Writer, items []runtime.Object) (err error) { +func (e *streamEncoder) encodeItemsObjectSlice(items []runtime.Object) (err error) { if items == nil { - err := encodeKeyValuePair(w, "items", nil, nil) + err := e.encodeKeyValuePair("items", nil, nil) return err } - _, err = w.Write([]byte(`"items":[`)) + _, err = e.w.Write([]byte(`"items":[`)) if err != nil { return err } @@ -136,24 +154,27 @@ func encodeItemsObjectSlice(w io.Writer, items []runtime.Object) (err error) { if i == len(items)-1 { suffix = nil } - err := encodeValue(w, item, suffix) + err := e.encodeValue(item, suffix) if err != nil { return err } } - _, err = w.Write([]byte("]")) + _, err = e.w.Write([]byte("]")) if err != nil { return err } return err } -func streamingEncodeUnstructuredList(w io.Writer, list *unstructured.UnstructuredList) error { - _, err := w.Write([]byte(`{`)) +func (e *streamEncoder) encodeUnstructuredList(list *unstructured.UnstructuredList) error { + _, err := e.w.Write([]byte(`{`)) if err != nil { return err } - keys := slices.Collect(maps.Keys(list.Object)) + keys := make([]string, 0, len(list.Object)+1) + for key := range list.Object { + keys = append(keys, key) + } if _, exists := list.Object["items"]; !exists { keys = append(keys, "items") } @@ -165,20 +186,20 @@ func streamingEncodeUnstructuredList(w io.Writer, list *unstructured.Unstructure suffix = nil } if key == "items" { - err = encodeItemsUnstructuredSlice(w, list.Items, suffix) + err = e.encodeItemsUnstructuredSlice(list.Items, suffix) } else { - err = encodeKeyValuePair(w, key, list.Object[key], suffix) + err = e.encodeKeyValuePair(key, list.Object[key], suffix) } if err != nil { return err } } - _, err = w.Write([]byte("}\n")) + _, err = e.w.Write([]byte("}\n")) return err } -func encodeItemsUnstructuredSlice(w io.Writer, items []unstructured.Unstructured, suffix []byte) (err error) { - _, err = w.Write([]byte(`"items":[`)) +func (e *streamEncoder) encodeItemsUnstructuredSlice(items []unstructured.Unstructured, suffix []byte) (err error) { + _, err = e.w.Write([]byte(`"items":[`)) if err != nil { return err } @@ -187,44 +208,42 @@ func encodeItemsUnstructuredSlice(w io.Writer, items []unstructured.Unstructured if i == len(items)-1 { comma = nil } - err := encodeValue(w, item.Object, comma) + err := e.encodeValue(item.Object, comma) if err != nil { return err } } - _, err = w.Write([]byte("]")) + _, err = e.w.Write([]byte("]")) if err != nil { return err } if len(suffix) > 0 { - _, err = w.Write(suffix) + _, err = e.w.Write(suffix) } return err } -func encodeKeyValuePair(w io.Writer, key string, value any, suffix []byte) (err error) { - err = encodeValue(w, key, []byte(":")) +func (e *streamEncoder) encodeKeyValuePair(key string, value any, suffix []byte) (err error) { + err = e.encodeValue(key, []byte(":")) if err != nil { return err } - err = encodeValue(w, value, suffix) + err = e.encodeValue(value, suffix) if err != nil { return err } return err } -func encodeValue(w io.Writer, value any, suffix []byte) error { - data, err := json.Marshal(value) - if err != nil { - return err - } - _, err = w.Write(data) - if err != nil { +func (e *streamEncoder) encodeValue(value any, suffix []byte) error { + e.buf.Reset() + if err := e.json.Encode(value); err != nil { return err } - if len(suffix) > 0 { - _, err = w.Write(suffix) - } + // Encode appends a newline after the value; replace it with the suffix to + // keep the output identical to json.Marshal's. + e.buf.Truncate(e.buf.Len() - 1) + e.buf.Write(suffix) + _, err := e.w.Write(e.buf.Bytes()) return err } diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go index 24f66a1017..52c814172f 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go @@ -70,6 +70,7 @@ func identifier(options SerializerOptions) runtime.Identifier { } identifier, err := json.Marshal(result) if err != nil { + //nolint:logcheck // Should not be reached. klog.Fatalf("Failed marshaling identifier for json Serializer: %v", err) } return runtime.Identifier(identifier) diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/collections.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/collections.go index afac03e9da..8db8932fbb 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/collections.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/collections.go @@ -17,6 +17,7 @@ limitations under the License. package protobuf import ( + "encoding/binary" "errors" "io" "math/bits" @@ -134,15 +135,17 @@ func streamingEncodeUnknownList(w io.Writer, unk runtime.Unknown, listData strea } func streamingEncodeList(w io.Writer, listData streamingListData, memAlloc runtime.MemoryAllocator) (size int, err error) { + // headerScratch escapes via w.Write, so allocate it once per call instead of once per item. + headerScratch := make([]byte, 1+binary.MaxVarintLen64) // ListMeta; 0xa = (1 << 3) | 2; field number: 1, type: 2 (LEN). https://protobuf.dev/programming-guides/encoding/#structure - n, err := doEncodeWithHeader(&listData.listMeta, w, 0xa, listData.listMetaSize, memAlloc) + n, err := doEncodeWithHeader(&listData.listMeta, w, 0xa, listData.listMetaSize, headerScratch, memAlloc) size += n if err != nil { return size, err } // Items; 0x12 = (2 << 3) | 2; field number: 2, type: 2 (LEN). https://protobuf.dev/programming-guides/encoding/#structure for i, item := range listData.items { - n, err := doEncodeWithHeader(item, w, 0x12, listData.itemsSizes[i], memAlloc) + n, err := doEncodeWithHeader(item, w, 0x12, listData.itemsSizes[i], headerScratch, memAlloc) size += n if err != nil { return size, err @@ -151,12 +154,6 @@ func streamingEncodeList(w io.Writer, listData streamingListData, memAlloc runti return size, nil } -func writeVarintGenerated(w io.Writer, v int) (int, error) { - buf := make([]byte, sovGenerated(uint64(v))) - encodeVarintGenerated(buf, len(buf), uint64(v)) - return w.Write(buf) -} - // sovGenerated is copied from `generated.pb.go` returns size of varint. func sovGenerated(v uint64) int { return (bits.Len64(v|1) + 6) / 7 diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/protobuf.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/protobuf.go index 67a2d12474..93ad95cef3 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/protobuf.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/protobuf.go @@ -199,6 +199,7 @@ func (s *Serializer) encode(obj runtime.Object, w io.Writer, memAlloc runtime.Me func (s *Serializer) doEncode(obj runtime.Object, w io.Writer, memAlloc runtime.MemoryAllocator) error { if memAlloc == nil { + //nolint:logcheck // Should not be reached in normal operations. klog.Error("a mandatory memory allocator wasn't provided, this might have a negative impact on performance, check invocations of EncodeWithAllocator method, falling back on runtime.SimpleAllocator") memAlloc = &runtime.SimpleAllocator{} } @@ -470,15 +471,12 @@ func (s *RawSerializer) doEncode(obj runtime.Object, w io.Writer, memAlloc runti return err } -func doEncodeWithHeader(obj any, w io.Writer, field byte, precomputedSize int, memAlloc runtime.MemoryAllocator) (size int, err error) { - // Field identifier - n, err := w.Write([]byte{field}) - size += n - if err != nil { - return size, err - } - // Size - n, err = writeVarintGenerated(w, precomputedSize) +func doEncodeWithHeader(obj any, w io.Writer, field byte, precomputedSize int, headerScratch []byte, memAlloc runtime.MemoryAllocator) (size int, err error) { + // Field identifier and size + header := headerScratch[:1+sovGenerated(uint64(precomputedSize))] + header[0] = field + encodeVarintGenerated(header, len(header), uint64(precomputedSize)) + n, err := w.Write(header) size += n if err != nil { return size, err @@ -500,6 +498,7 @@ func doEncodeWithHeader(obj any, w io.Writer, field byte, precomputedSize int, m // precomputedObjSize should not include header bytes (field identifier, size). func doEncode(obj any, w io.Writer, precomputedObjSize *int, memAlloc runtime.MemoryAllocator) (int, error) { if memAlloc == nil { + //nolint:logcheck // Should not be reached in normal operations. klog.Error("a mandatory memory allocator wasn't provided, this might have a negative impact on performance, check invocations of EncodeWithAllocator method, falling back on runtime.SimpleAllocator") memAlloc = &runtime.SimpleAllocator{} } diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go index 25f955ed75..6c86d5e15c 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go @@ -116,6 +116,7 @@ func identifier(encodeGV runtime.GroupVersioner, encoder runtime.Encoder) runtim } identifier, err := json.Marshal(result) if err != nil { + //nolint:logcheck // Should not be reached. klog.Fatalf("Failed marshaling identifier for codec: %v", err) } identifiersMap.Store(result, runtime.Identifier(identifier)) @@ -222,6 +223,7 @@ func (c *codec) doEncode(obj runtime.Object, w io.Writer, memAlloc runtime.Memor return encoder.EncodeWithAllocator(obj, w, memAlloc) } } else { + //nolint:logcheck // Extending the API is not worth it for contextual, structured logging of this. klog.V(6).Infof("a memory allocator was provided but the encoder %s doesn't implement the runtime.EncoderWithAllocator, using regular encoder.Encode method", c.encoder.Identifier()) } } diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/swagger_doc_generator.go b/vendor/k8s.io/apimachinery/pkg/runtime/swagger_doc_generator.go index 5bc642bc8e..0d5a3e709d 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/swagger_doc_generator.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/swagger_doc_generator.go @@ -25,7 +25,10 @@ import ( "go/token" "io" "reflect" + "strconv" "strings" + + "k8s.io/apimachinery/pkg/util/errors" ) // Pair of strings. We keed the name of fields and the doc @@ -94,23 +97,29 @@ func fmtRawDoc(rawDoc string) string { // fieldName returns the name of the field as it should appear in JSON format // "-" indicates that this field is not part of the JSON representation -func fieldName(field *ast.Field) string { +func fieldName(field *ast.Field) (string, error) { jsonTag := "" if field.Tag != nil { - jsonTag = reflect.StructTag(field.Tag.Value[1 : len(field.Tag.Value)-1]).Get("json") // Delete first and last quotation - if strings.Contains(jsonTag, "inline") { - return "-" + var jsonTagExists bool + tagValue, err := strconv.Unquote(field.Tag.Value) + if err != nil { + return "", err + } + jsonTag, jsonTagExists = reflect.StructTag(tagValue).Lookup("json") // Delete first and last quotation + // field is embedded, json tag is declared and has an empty name + if field.Names == nil && jsonTagExists && (jsonTag == "" || strings.HasPrefix(jsonTag, ",")) { + return "-", nil } } jsonTag = strings.Split(jsonTag, ",")[0] // This can return "-" if jsonTag == "" { if field.Names != nil { - return field.Names[0].Name + return field.Names[0].Name, nil } - return field.Type.(*ast.Ident).Name + return field.Type.(*ast.Ident).Name, nil } - return jsonTag + return jsonTag, nil } // A buffer of lines that will be written. @@ -171,8 +180,9 @@ func writeMapBody(b *buffer, kubeType []Pair, indent int) { // array. Each type is again represented as an array (we have to use arrays as we // need to be sure for the order of the fields). This function returns fields and // struct definitions that have no documentation as {name, ""}. -func ParseDocumentationFrom(src string) []KubeTypes { +func ParseDocumentationFrom(src string) ([]KubeTypes, error) { var docForTypes []KubeTypes + var errs []error pkg := astFrom(src) @@ -182,7 +192,9 @@ func ParseDocumentationFrom(src string) []KubeTypes { ks = append(ks, Pair{kubType.Name, fmtRawDoc(kubType.Doc)}) for _, field := range structType.Fields.List { - if n := fieldName(field); n != "-" { + if n, err := fieldName(field); err != nil { + errs = append(errs, err) + } else if n != "-" { fieldDoc := fmtRawDoc(field.Doc.Text()) ks = append(ks, Pair{n, fieldDoc}) } @@ -191,7 +203,7 @@ func ParseDocumentationFrom(src string) []KubeTypes { } } - return docForTypes + return docForTypes, errors.NewAggregate(errs) } // WriteSwaggerDocFunc writes a declaration of a function as a string. This function is used in diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/types.go b/vendor/k8s.io/apimachinery/pkg/runtime/types.go index ca7b7cc2d4..6cded88997 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/types.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/types.go @@ -23,7 +23,7 @@ package runtime // like this: // // type MyAwesomeAPIObject struct { -// runtime.TypeMeta `json:",inline"` +// runtime.TypeMeta `json:""` // ... // other fields // } // @@ -59,7 +59,7 @@ const ( // // Internal package: // // type MyAPIObject struct { -// runtime.TypeMeta `json:",inline"` +// runtime.TypeMeta `json:""` // MyPlugin runtime.Object `json:"myPlugin"` // } // @@ -70,7 +70,7 @@ const ( // // External package: // // type MyAPIObject struct { -// runtime.TypeMeta `json:",inline"` +// runtime.TypeMeta `json:""` // MyPlugin runtime.RawExtension `json:"myPlugin"` // } // @@ -121,7 +121,7 @@ type RawExtension struct { // +protobuf=true // +k8s:openapi-gen=true type Unknown struct { - TypeMeta `json:",inline" protobuf:"bytes,1,opt,name=typeMeta"` + TypeMeta `json:"" protobuf:"bytes,1,opt,name=typeMeta"` // Raw will hold the complete serialized object which couldn't be matched // with a registered type. Most likely, nothing should be done with this // except for passing it through the system. diff --git a/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go b/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go index f372ae589c..b0ca3803e4 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go +++ b/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go @@ -59,6 +59,7 @@ const ( // Deprecated: use FromInt32 instead. func FromInt(val int) IntOrString { if val > math.MaxInt32 || val < math.MinInt32 { + //nolint:logcheck // Should not be reached. klog.Errorf("value: %d overflows int32\n%s\n", val, debug.Stack()) } return IntOrString{Type: Int, IntVal: int32(val)} diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fieldmanager.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fieldmanager.go index ac8d4279d6..2e2db65561 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fieldmanager.go +++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fieldmanager.go @@ -140,24 +140,28 @@ func (f *FieldManager) Update(liveObj, newObj runtime.Object, manager string) (o } // UpdateNoErrors is the same as Update, but it will not return -// errors. If an error happens, the object is returned with -// managedFields cleared. +// errors. If an error happens, we preserve the managedFields from +// liveObj. func (f *FieldManager) UpdateNoErrors(liveObj, newObj runtime.Object, manager string) runtime.Object { obj, err := f.Update(liveObj, newObj, manager) if err != nil { - atMostEverySecond.Do(func() { - ns, name := "unknown", "unknown" - if accessor, err := meta.Accessor(newObj); err == nil { - ns = accessor.GetNamespace() - name = accessor.GetName() + // Preserve the managedFields from the live object rather than + // stripping them entirely, to avoid silent data loss when the + // managedFields update fails (e.g. due to an unavailable + // conversion webhook). + // Note: meta.Accessor for liveObj and newObj below never return an error in this code branch, + // because if they would f.Update above would return "newObj, nil". Accordingly, the case + // where one of the accessors returns an error is not handled here. + if liveAccessor, aErr := meta.Accessor(liveObj); aErr == nil { + if newAccessor, aErr := meta.Accessor(newObj); aErr == nil { + atMostEverySecond.Do(func() { + //nolint:logcheck // Should not be reached. + klog.ErrorS(err, "[SHOULD NOT HAPPEN] failed to update managedFields (restored previous managedFields from live object)", "versionKind", + newObj.GetObjectKind().GroupVersionKind(), "namespace", newAccessor.GetNamespace(), "name", newAccessor.GetName()) + }) + newAccessor.SetManagedFields(liveAccessor.GetManagedFields()) } - - klog.ErrorS(err, "[SHOULD NOT HAPPEN] failed to update managedFields", "versionKind", - newObj.GetObjectKind().GroupVersionKind(), "namespace", ns, "name", name) - }) - // Explicitly remove managedFields on failure, so that - // we can't have garbage in it. - RemoveObjectManagedFields(newObj) + } return newObj } return obj diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/typeconverter.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/typeconverter.go index cbefc2eba0..40cc90da78 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/typeconverter.go +++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/typeconverter.go @@ -109,6 +109,24 @@ func valueToObject(val value.Value) (runtime.Object, error) { } } +// GroupVersionOfTypedValue returns the extracted GroupVersion from the TypeMeta +// fields of a TypedValue, or return false if no TypeMeta fields are found. +func GroupVersionOfTypedValue(object *typed.TypedValue) (schema.GroupVersion, bool) { + val := object.AsValue() + if val == nil || !val.IsMap() { + return schema.GroupVersion{}, false + } + apiVersion, ok := val.AsMap().Get("apiVersion") + if !ok || !apiVersion.IsString() { + return schema.GroupVersion{}, false + } + groupVersion, err := schema.ParseGroupVersion(apiVersion.AsString()) + if err != nil { + return schema.GroupVersion{}, false + } + return groupVersion, true +} + func indexModels( typeParser *typed.Parser, openAPISchemas map[string]*spec.Schema, diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/versionconverter.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/versionconverter.go index 86695e0c0b..917bdcd75f 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/versionconverter.go +++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/versionconverter.go @@ -63,24 +63,23 @@ func newCRDVersionConverter(t TypeConverter, o runtime.ObjectConvertor, h schema // Convert implements sigs.k8s.io/structured-merge-diff/merge.Converter func (v *versionConverter) Convert(object *typed.TypedValue, version fieldpath.APIVersion) (*typed.TypedValue, error) { - // Convert the smd typed value to a kubernetes object. - objectToConvert, err := v.typeConverter.TypedToObject(object) - if err != nil { - return object, err - } - - // Parse the target groupVersion. groupVersion, err := schema.ParseGroupVersion(string(version)) if err != nil { return object, err } // If attempting to convert to the same version as we already have, just return it. - fromVersion := objectToConvert.GetObjectKind().GroupVersionKind().GroupVersion() - if fromVersion == groupVersion { + if typedVersion, ok := GroupVersionOfTypedValue(object); ok && typedVersion == groupVersion { return object, nil } + // Convert the smd typed value to a kubernetes object. + objectToConvert, err := v.typeConverter.TypedToObject(object) + if err != nil { + return object, err + } + fromVersion := objectToConvert.GetObjectKind().GroupVersionKind().GroupVersion() + // Convert to internal internalObject, err := v.objectConvertor.ConvertToVersion(objectToConvert, v.hubGetter(fromVersion)) if err != nil { diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/field/error_matcher.go b/vendor/k8s.io/apimachinery/pkg/util/validation/field/error_matcher.go index 1eeb71ff53..1a18b27666 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/validation/field/error_matcher.go +++ b/vendor/k8s.io/apimachinery/pkg/util/validation/field/error_matcher.go @@ -46,35 +46,57 @@ type ErrorMatcher struct { requireOriginWhenInvalid bool matchValidationStabilityLevel bool matchSource bool + matchAncestorShortCircuit bool + matchShortCircuit bool // normalizationRules holds the pre-compiled regex patterns for path normalization. normalizationRules []NormalizationRule } +// isChildPath returns true if child is a descendant path of parent. +// It avoids false positives like "spec.containers" being a child of "spec.container" +// by explicitly checking for '.' or '[' path separators. +func isChildPath(parent, child string) bool { + // "" as parent path not supported. It can un-intentionally match with any path. + // theoretically system errors can be matched with any path errors. + if len(parent) == 0 { + return false + } + if len(child) <= len(parent) { + return false + } + if child[:len(parent)] != parent { + return false + } + sep := child[len(parent)] + return sep == '.' || sep == '[' +} + // Matches returns true if the two Error objects match according to the // configured criteria. When field normalization is configured, only the // "got" error's field path is normalized (to bring older API versions up // to the internal/latest format), while "want" is assumed to already be // in the canonical internal API format. func (m ErrorMatcher) Matches(want, got *Error) bool { - if m.matchType && want.Type != got.Type { - return false + gotField := got.Field + if want.Field != gotField { + gotField = m.normalizePath(gotField) } - if m.matchField { - // Try direct match first (common case) - if want.Field != got.Field { - // Fields don't match, try normalization if rules are configured. - // Only normalize "got" - it may be from an older API version that - // needs to be brought up to the internal/latest format that "want" - // is already in. - if want.Field != m.normalizePath(got.Field) { - return false - } + if m.matchAncestorShortCircuit { + if got.ShortCircuit && (isChildPath(gotField, want.Field) || isChildPath(got.Field, want.Field)) { + return true } } + if m.matchType && want.Type != got.Type { + return false + } + if m.matchField && want.Field != gotField { + return false + } if m.matchValue && !reflect.DeepEqual(want.BadValue, got.BadValue) { return false } + if m.matchOrigin { if want.Origin != got.Origin { return false @@ -91,10 +113,12 @@ func (m ErrorMatcher) Matches(want, got *Error) bool { if m.matchValidationStabilityLevel && want.ValidationStabilityLevel != got.ValidationStabilityLevel { return false } - if m.matchSource && want.FromImperative != got.FromImperative { return false } + if m.matchShortCircuit && want.ShortCircuit != got.ShortCircuit { + return false + } return true } @@ -124,47 +148,51 @@ func (m ErrorMatcher) Render(e *Error) string { if m.matchType { comma() - buf.WriteString(fmt.Sprintf("Type=%q", e.Type)) + fmt.Fprintf(&buf, "Type=%q", e.Type) } if m.matchField { comma() if normalized := m.normalizePath(e.Field); normalized != e.Field { - buf.WriteString(fmt.Sprintf("Field=%q (aka %q)", normalized, e.Field)) + fmt.Fprintf(&buf, "Field=%q (aka %q)", normalized, e.Field) } else { - buf.WriteString(fmt.Sprintf("Field=%q", e.Field)) + fmt.Fprintf(&buf, "Field=%q", e.Field) } } if m.matchValue { comma() if s, ok := e.BadValue.(string); ok { - buf.WriteString(fmt.Sprintf("Value=%q", s)) + fmt.Fprintf(&buf, "Value=%q", s) } else { rv := reflect.ValueOf(e.BadValue) if rv.Kind() == reflect.Pointer && !rv.IsNil() { rv = rv.Elem() } if rv.IsValid() && rv.CanInterface() { - buf.WriteString(fmt.Sprintf("Value=%v", rv.Interface())) + fmt.Fprintf(&buf, "Value=%v", rv.Interface()) } else { - buf.WriteString(fmt.Sprintf("Value=%v", e.BadValue)) + fmt.Fprintf(&buf, "Value=%v", e.BadValue) } } } if m.matchOrigin || m.requireOriginWhenInvalid && e.Type == ErrorTypeInvalid { comma() - buf.WriteString(fmt.Sprintf("Origin=%q", e.Origin)) + fmt.Fprintf(&buf, "Origin=%q", e.Origin) } if m.matchDetail != nil { comma() - buf.WriteString(fmt.Sprintf("Detail=%q", e.Detail)) + fmt.Fprintf(&buf, "Detail=%q", e.Detail) } if m.matchValidationStabilityLevel { comma() - buf.WriteString(fmt.Sprintf("ValidationStabilityLevel=%s", e.ValidationStabilityLevel)) + fmt.Fprintf(&buf, "ValidationStabilityLevel=%s", e.ValidationStabilityLevel) } if m.matchSource { comma() - buf.WriteString(fmt.Sprintf("FromImperative=%t", e.FromImperative)) + fmt.Fprintf(&buf, "FromImperative=%t", e.FromImperative) + } + if m.matchShortCircuit { + comma() + fmt.Fprintf(&buf, "ShortCircuit=%t", e.ShortCircuit) } return "{" + buf.String() + "}" } @@ -249,6 +277,18 @@ func (m ErrorMatcher) BySource() ErrorMatcher { return m } +// MatchAncestorShortCircuit returns a derived ErrorMatcher which also matches when the "got" error short-circuited at an ancestor of the "want" error's field path. +func (m ErrorMatcher) MatchAncestorShortCircuit() ErrorMatcher { + m.matchAncestorShortCircuit = true + return m +} + +// MatchShortCircuit returns a derived ErrorMatcher which also matches by the ShortCircuit value. +func (m ErrorMatcher) MatchShortCircuit() ErrorMatcher { + m.matchShortCircuit = true + return m +} + // ByValidationStabilityLevel returns a derived ErrorMatcher which also matches by the validation stability level // value of field errors. func (m ErrorMatcher) ByValidationStabilityLevel() ErrorMatcher { @@ -300,9 +340,13 @@ type TestIntf interface { // "want" error can match multiple "got" errors, and they will all be consumed. // The only exception to this is if the matcher got multiple identical (in every way, // even those not being matched on) errors, which is likely to indicate a bug. +// This doesn't support matchAncestorShortCircuit as it it not needed to be used in the tests. func (m ErrorMatcher) Test(tb TestIntf, want, got ErrorList) { tb.Helper() + if m.matchAncestorShortCircuit { + tb.Errorf("matchAncestorShortCircuit is not supported for test") + } exactly := m.Exactly() // makes a copy // If we ever find an EXACT duplicate error, it's almost certainly a bug diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go b/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go index 9357fb306c..0d00acb42d 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go +++ b/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go @@ -59,6 +59,12 @@ type Error struct { // FromImperative denotes these errors are originating from the hand written validations. FromImperative bool + // ShortCircuit denotes that this error prevents further validation of the current field's children. + ShortCircuit bool + + // ShortCircuitedInDeclarative denotes this error is covered by declarative validation. But not returned by declarative validation due to a short circuiting behavior for the current input. + ShortCircuitedInDeclarative bool + // ValidationStabilityLevel denotes the validation stability level of the declarative validation from this error is returned. This should be used in the declarative validations only. ValidationStabilityLevel ValidationStabilityLevel } @@ -545,6 +551,12 @@ func (e *Error) MarkAlpha() *Error { return e } +// MarkShortCircuitedInDV marks that this error is not returned by declarative validations, because DV returns before running the current validation. Handwritten validations still return it. +func (e *Error) MarkShortCircuitedInDV() *Error { + e.ShortCircuitedInDeclarative = true + return e +} + // MarkAlpha marks the errors as alpha validation errors. func (list ErrorList) MarkAlpha() ErrorList { for _, err := range list { @@ -579,6 +591,14 @@ func (list ErrorList) MarkFromImperative() ErrorList { return list } +// MarkShortCircuit marks the errors as short-circuit errors. +func (list ErrorList) MarkShortCircuit() ErrorList { + for _, err := range list { + err.ShortCircuit = true + } + return list +} + // RemoveCoveredByDeclarative returns a new ErrorList containing only the errors that should not be covered by declarative validation. func (list ErrorList) RemoveCoveredByDeclarative() ErrorList { newList := ErrorList{} diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/ip.go b/vendor/k8s.io/apimachinery/pkg/util/validation/ip.go index 869fb0aad0..95f4e6218f 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/validation/ip.go +++ b/vendor/k8s.io/apimachinery/pkg/util/validation/ip.go @@ -105,6 +105,7 @@ func IsValidIP(fldPath *field.Path, value string) field.ErrorList { func GetWarningsForIP(fldPath *field.Path, value string) []string { ip := netutils.ParseIPSloppy(value) if ip == nil { + //nolint:logcheck // Should not be reached. klog.ErrorS(nil, "GetWarningsForIP called on value that was not validated with IsValidIPForLegacyField", "field", fldPath, "value", value) return nil } @@ -211,6 +212,7 @@ func IsValidCIDR(fldPath *field.Path, value string) field.ErrorList { func GetWarningsForCIDR(fldPath *field.Path, value string) []string { ip, ipnet, err := netutils.ParseCIDRSloppy(value) if err != nil { + //nolint:logcheck // Should not be reached. klog.ErrorS(err, "GetWarningsForCIDR called on value that was not validated with IsValidCIDRForLegacyField", "field", fldPath, "value", value) return nil } diff --git a/vendor/k8s.io/apiserver/pkg/admission/configuration/mutating_webhook_manager.go b/vendor/k8s.io/apiserver/pkg/admission/configuration/mutating_webhook_manager.go index 3ecc00b74c..09546d7092 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/configuration/mutating_webhook_manager.go +++ b/vendor/k8s.io/apiserver/pkg/admission/configuration/mutating_webhook_manager.go @@ -23,7 +23,9 @@ import ( v1 "k8s.io/api/admissionregistration/v1" "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime/schema" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apiserver/pkg/admission/plugin/webhook" "k8s.io/apiserver/pkg/admission/plugin/webhook/generic" "k8s.io/client-go/informers" @@ -46,15 +48,17 @@ type mutatingWebhookConfigurationManager struct { // This function is defined as field instead of a struct method to allow injection // during tests createMutatingWebhookAccessor mutatingWebhookAccessorCreator + excludedWebhookResources sets.Set[schema.GroupResource] } var _ generic.Source = &mutatingWebhookConfigurationManager{} -func NewMutatingWebhookConfigurationManager(f informers.SharedInformerFactory) generic.Source { +func NewMutatingWebhookConfigurationManager(f informers.SharedInformerFactory, excludedWebhookResources sets.Set[schema.GroupResource]) generic.Source { informer := f.Admissionregistration().V1().MutatingWebhookConfigurations() manager := &mutatingWebhookConfigurationManager{ lister: informer.Lister(), createMutatingWebhookAccessor: webhook.NewMutatingWebhookAccessor, + excludedWebhookResources: excludedWebhookResources, } manager.lazy.Evaluate = manager.getConfiguration @@ -133,6 +137,8 @@ func (m *mutatingWebhookConfigurationManager) getMutatingWebhookConfigurations(c continue } + logExcludedResourcesForMutatingWebhook(c.Name, c.Webhooks, m.excludedWebhookResources) + // webhook names are not validated for uniqueness, so we check for duplicates and // add a int suffix to distinguish between them names := map[string]int{} diff --git a/vendor/k8s.io/apiserver/pkg/admission/configuration/validating_webhook_manager.go b/vendor/k8s.io/apiserver/pkg/admission/configuration/validating_webhook_manager.go index b423321177..2c57ecf6dd 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/configuration/validating_webhook_manager.go +++ b/vendor/k8s.io/apiserver/pkg/admission/configuration/validating_webhook_manager.go @@ -23,7 +23,9 @@ import ( v1 "k8s.io/api/admissionregistration/v1" "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime/schema" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apiserver/pkg/admission/plugin/webhook" "k8s.io/apiserver/pkg/admission/plugin/webhook/generic" "k8s.io/client-go/informers" @@ -46,15 +48,17 @@ type validatingWebhookConfigurationManager struct { // This function is defined as field instead of a struct method to allow injection // during tests createValidatingWebhookAccessor validatingWebhookAccessorCreator + excludedWebhookResources sets.Set[schema.GroupResource] } var _ generic.Source = &validatingWebhookConfigurationManager{} -func NewValidatingWebhookConfigurationManager(f informers.SharedInformerFactory) generic.Source { +func NewValidatingWebhookConfigurationManager(f informers.SharedInformerFactory, excludedWebhookResources sets.Set[schema.GroupResource]) generic.Source { informer := f.Admissionregistration().V1().ValidatingWebhookConfigurations() manager := &validatingWebhookConfigurationManager{ lister: informer.Lister(), createValidatingWebhookAccessor: webhook.NewValidatingWebhookAccessor, + excludedWebhookResources: excludedWebhookResources, } manager.lazy.Evaluate = manager.getConfiguration @@ -130,6 +134,8 @@ func (v *validatingWebhookConfigurationManager) getValidatingWebhookConfiguratio continue } + logExcludedResourcesForValidatingWebhook(c.Name, c.Webhooks, v.excludedWebhookResources) + // webhook names are not validated for uniqueness, so we check for duplicates and // add a int suffix to distinguish between them names := map[string]int{} diff --git a/vendor/k8s.io/apiserver/pkg/admission/configuration/warning.go b/vendor/k8s.io/apiserver/pkg/admission/configuration/warning.go new file mode 100644 index 0000000000..7fc7333579 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/configuration/warning.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package configuration + +import ( + "slices" + + v1 "k8s.io/api/admissionregistration/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/klog/v2" +) + +// logExcludedResourcesForValidatingWebhook logs an advisory for a ValidatingWebhookConfiguration whose rules name resources excluded from admission webhooks. +// It is a no-op when excludedWebhookResources is empty. +func logExcludedResourcesForValidatingWebhook(name string, webhooks []v1.ValidatingWebhook, excludedWebhookResources sets.Set[schema.GroupResource]) { + if excludedWebhookResources.Len() == 0 { + return + } + var rules []v1.RuleWithOperations + for _, w := range webhooks { + rules = append(rules, w.Rules...) + } + logExcludedWebhookResources("ValidatingWebhookConfiguration", name, rules, excludedWebhookResources) +} + +// logExcludedResourcesForMutatingWebhook logs an advisory for a MutatingWebhookConfiguration whose rules name resources excluded from admission webhooks. +// It is a no-op when excludedWebhookResources is empty. +func logExcludedResourcesForMutatingWebhook(name string, webhooks []v1.MutatingWebhook, excludedWebhookResources sets.Set[schema.GroupResource]) { + if excludedWebhookResources.Len() == 0 { + return + } + var rules []v1.RuleWithOperations + for _, w := range webhooks { + rules = append(rules, w.Rules...) + } + logExcludedWebhookResources("MutatingWebhookConfiguration", name, rules, excludedWebhookResources) +} + +func logExcludedWebhookResources(kind, name string, rules []v1.RuleWithOperations, excludedWebhookResources sets.Set[schema.GroupResource]) { + excluded := sets.New[schema.GroupResource]() + for _, r := range rules { + excluded.Insert(excludedResourcesNamedByRule(r.APIGroups, r.Resources, excludedWebhookResources)...) + } + if excluded.Len() == 0 { + return + } + resources := make([]string, 0, excluded.Len()) + for gr := range excluded { + resources = append(resources, gr.String()) + } + slices.Sort(resources) + klog.InfoS("Admission webhook configuration names resources that are excluded from admission webhooks; the matching rules will have no effect", + "kind", kind, "name", name, "excludedResources", resources) +} + +// excludedResourcesNamedByRule returns the excluded GroupResources a rule explicitly names. +// A rule that uses a wildcard ("*") in apiGroups or resources is not flagged because its intent +// toward the excluded resource is ambiguous. apiVersions are not considered because all versions +// of an excluded resource are excluded. +func excludedResourcesNamedByRule(apiGroups, resources []string, excludedWebhookResources sets.Set[schema.GroupResource]) []schema.GroupResource { + if slices.Contains(apiGroups, "*") || slices.Contains(resources, "*") { + return nil + } + var matched []schema.GroupResource + for _, group := range apiGroups { + for _, resource := range resources { + gr := schema.GroupResource{Group: group, Resource: resource} + if excludedWebhookResources.Has(gr) { + matched = append(matched, gr) + } + } + } + return matched +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/conversion.go b/vendor/k8s.io/apiserver/pkg/admission/conversion.go index a2b313a983..90a76a90c9 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/conversion.go +++ b/vendor/k8s.io/apiserver/pkg/admission/conversion.go @@ -17,8 +17,14 @@ limitations under the License. package admission import ( + "reflect" + + "github.com/google/cel-go/common/types" + "github.com/google/cel-go/common/types/ref" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apiserver/pkg/cel/common" ) // VersionedAttributes is a wrapper around the original admission attributes, adding versioned @@ -26,22 +32,29 @@ import ( type VersionedAttributes struct { // Attributes holds the original admission attributes Attributes - // VersionedOldObject holds Attributes.OldObject (if non-nil), converted to VersionedKind. + // VersionedOldObject holds Attributes.OldObject (if non-nil), converted to VersionedKind and encapsulated in a LazyObject. // It must never be mutated. - VersionedOldObject runtime.Object - // VersionedObject holds Attributes.Object (if non-nil), converted to VersionedKind. + VersionedOldObject LazyObject + // VersionedObject holds Attributes.Object (if non-nil), converted to VersionedKind and encapsulated in a LazyObject. // If mutated, Dirty must be set to true by the mutator. - VersionedObject runtime.Object + VersionedObject LazyObject + // VersionedKind holds the fully qualified kind VersionedKind schema.GroupVersionKind - // Dirty indicates VersionedObject has been modified since being converted from Attributes.Object + // Dirty indicates the inner object in VersionedObject has been modified since being converted from Attributes.Object Dirty bool } +// UpdateObject updates the VersionedObject and clears the cached CEL representation. +func (v *VersionedAttributes) UpdateObject(obj runtime.Object) { + v.Dirty = true + v.VersionedObject.Set(obj) +} + // GetObject overrides the Attributes.GetObject() func (v *VersionedAttributes) GetObject() runtime.Object { - if v.VersionedObject != nil { - return v.VersionedObject + if v.VersionedObject.object != nil { + return v.VersionedObject.object } return v.Attributes.GetObject() } @@ -78,22 +91,74 @@ func NewVersionedAttributes(attr Attributes, gvk schema.GroupVersionKind, o Obje if err != nil { return nil, err } - versionedAttr.VersionedOldObject = out + versionedAttr.VersionedOldObject.Set(out) } if obj := attr.GetObject(); obj != nil { out, err := ConvertToGVK(obj, gvk, o) if err != nil { return nil, err } - versionedAttr.VersionedObject = out + versionedAttr.VersionedObject.Set(out) } + return versionedAttr, nil } +// LazyObject encapsulates a versioned runtime.Object and its lazily-evaluated Common Expression Language (CEL) representation. +type LazyObject struct { + object runtime.Object + // UseSchemalessTypeRef indicates whether to use SchemalessTypedToVal (reflection-based lazy ref.Val) + // instead of converting to an unstructured representation with DefaultTypeAdapter. + // + // Deprecated: This field is temporary and will be removed when schemaless becomes the default. + UseSchemalessTypeRef bool + celVal ref.Val +} + +// NewLazyObject returns a new LazyObject wrapping the provided runtime.Object. +func NewLazyObject(obj runtime.Object) LazyObject { + return LazyObject{object: obj} +} + +// Object returns the underlying runtime.Object. +func (l *LazyObject) Object() runtime.Object { + return l.object +} + +func (l *LazyObject) Set(obj runtime.Object) { + l.object = obj + l.celVal = nil +} + +func (l *LazyObject) CELValue() (ref.Val, error) { + if l.celVal != nil { + return l.celVal, nil + } + if l.object == nil { + return nil, nil + } + if u, ok := l.object.(*unstructured.Unstructured); ok { + l.celVal = types.DefaultTypeAdapter.NativeToValue(u.Object) + return l.celVal, nil + } + // TODO: use SchemalessTypeRef always. + if l.UseSchemalessTypeRef { + l.celVal = common.SchemalessTypedToVal(l.object) + return l.celVal, nil + } + + u, err := ConvertObjectToUnstructured(l.object) + if err != nil { + return nil, err + } + l.celVal = types.DefaultTypeAdapter.NativeToValue(u.Object) + return l.celVal, nil +} + // ConvertVersionedAttributes converts VersionedObject and VersionedOldObject to the specified kind, if needed. // If attr.VersionedKind already matches the requested kind, no conversion is performed. // If conversion is required: -// * attr.VersionedObject is used as the source for the new object if Dirty=true (and is round-tripped through attr.Attributes.Object, clearing Dirty in the process) +// * attr.VersionedObject.Object() is used as the source for the new object if Dirty=true (and is round-tripped through attr.Attributes.Object, clearing Dirty in the process) // * attr.Attributes.Object is used as the source for the new object if Dirty=false // * attr.Attributes.OldObject is used as the source for the old object func ConvertVersionedAttributes(attr *VersionedAttributes, gvk schema.GroupVersionKind, o ObjectInterfaces) error { @@ -108,13 +173,13 @@ func ConvertVersionedAttributes(attr *VersionedAttributes, gvk schema.GroupVersi if err != nil { return err } - attr.VersionedOldObject = out + attr.VersionedOldObject.Set(out) } - if attr.VersionedObject != nil { + if attr.VersionedObject.object != nil { // convert the existing versioned object to internal if attr.Dirty { - err := o.GetObjectConvertor().Convert(attr.VersionedObject, attr.Attributes.GetObject(), nil) + err := o.GetObjectConvertor().Convert(attr.VersionedObject.object, attr.Attributes.GetObject(), nil) if err != nil { return err } @@ -125,7 +190,7 @@ func ConvertVersionedAttributes(attr *VersionedAttributes, gvk schema.GroupVersi if err != nil { return err } - attr.VersionedObject = out + attr.VersionedObject.Set(out) } // Remember we converted to this version @@ -134,3 +199,15 @@ func ConvertVersionedAttributes(attr *VersionedAttributes, gvk schema.GroupVersi return nil } + +// ConvertObjectToUnstructured converts an object to an unstructured representation. +func ConvertObjectToUnstructured(obj interface{}) (*unstructured.Unstructured, error) { + if obj == nil || reflect.ValueOf(obj).IsNil() { + return &unstructured.Unstructured{Object: nil}, nil + } + ret, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj) + if err != nil { + return nil, err + } + return &unstructured.Unstructured{Object: ret}, nil +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/initializer/initializer.go b/vendor/k8s.io/apiserver/pkg/admission/initializer/initializer.go index b788029689..a1d7ace4a5 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/initializer/initializer.go +++ b/vendor/k8s.io/apiserver/pkg/admission/initializer/initializer.go @@ -91,6 +91,9 @@ func (i pluginInitializer) Initialize(plugin admission.Interface) { wants.SetExternalKubeInformerFactory(i.externalInformers) } + if wants, ok := plugin.(WantsUnconditionalAuthorizer); ok { + wants.SetUnconditionalAuthorizer(i.authorizer) + } if wants, ok := plugin.(WantsAuthorizer); ok { wants.SetAuthorizer(i.authorizer) } diff --git a/vendor/k8s.io/apiserver/pkg/admission/initializer/interfaces.go b/vendor/k8s.io/apiserver/pkg/admission/initializer/interfaces.go index cd3da1a619..55f8067907 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/initializer/interfaces.go +++ b/vendor/k8s.io/apiserver/pkg/admission/initializer/interfaces.go @@ -43,7 +43,13 @@ type WantsExternalKubeInformerFactory interface { admission.InitializationValidator } -// WantsAuthorizer defines a function which sets Authorizer for admission plugins that need it. +// WantsUnconditionalAuthorizer defines a function which sets a narrower, conditions-unaware UnconditionalAuthorizer for admission plugins that need it. +type WantsUnconditionalAuthorizer interface { + SetUnconditionalAuthorizer(authorizer.UnconditionalAuthorizer) + admission.InitializationValidator +} + +// WantsAuthorizer defines a function which sets a standard, possibly conditions-aware Authorizer for admission plugins that need it. type WantsAuthorizer interface { SetAuthorizer(authorizer.Authorizer) admission.InitializationValidator diff --git a/vendor/k8s.io/apiserver/pkg/admission/interfaces.go b/vendor/k8s.io/apiserver/pkg/admission/interfaces.go index ba979c973f..06d71c38e7 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/interfaces.go +++ b/vendor/k8s.io/apiserver/pkg/admission/interfaces.go @@ -24,6 +24,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" auditinternal "k8s.io/apiserver/pkg/apis/audit" "k8s.io/apiserver/pkg/authentication/user" + "k8s.io/apiserver/pkg/authorization/authorizer" ) // Attributes is an interface used by AdmissionController to get information about a request @@ -144,7 +145,8 @@ type ValidationInterface interface { } // Operation is the type of resource operation being checked for admission control -type Operation string +// This type is sourced from the authorizer package to avoid import cycles. +type Operation = authorizer.AdmissionOperation // Operation constants const ( diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/authorizer/caching_authorizer.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/authorizer/caching_authorizer.go index 5dffd97236..2294401f25 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/authorizer/caching_authorizer.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/authorizer/caching_authorizer.go @@ -34,15 +34,18 @@ type authzResult struct { err error } +// For now, secondary authorization checks in admission only support unconditional authorization +var _ = authorizer.UnconditionalAuthorizer(&cachingAuthorizer{}) + type cachingAuthorizer struct { - authorizer authorizer.Authorizer + authorizer authorizer.UnconditionalAuthorizer decisions map[string]authzResult } // NewCachingAuthorizer returns an authorizer that caches decisions for the duration // of the authorizers use. Intended to be used for short-lived operations such as // the handling of a request in the admission chain, and then discarded. -func NewCachingAuthorizer(in authorizer.Authorizer) authorizer.Authorizer { +func NewCachingAuthorizer(in authorizer.UnconditionalAuthorizer) authorizer.UnconditionalAuthorizer { return &cachingAuthorizer{ authorizer: in, decisions: make(map[string]authzResult), diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/cel/activation.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/cel/activation.go index 9771ae9ae4..45299eeaa9 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/cel/activation.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/cel/activation.go @@ -19,34 +19,62 @@ package cel import ( "context" "fmt" - "github.com/google/cel-go/interpreter" "math" "time" + "github.com/google/cel-go/interpreter" + admissionv1 "k8s.io/api/admission/v1" v1 "k8s.io/api/core/v1" "k8s.io/apiserver/pkg/admission" "k8s.io/apiserver/pkg/cel" + "k8s.io/apiserver/pkg/cel/common" "k8s.io/apiserver/pkg/cel/library" ) +// activationOptions holds options for newActivation. +type activationOptions struct { + useSchemalessTypeRef bool +} + +// activationOption defines a functional option for newActivation. +type activationOption func(*activationOptions) + +// useSchemalessTypeRef returns an activationOption that configures the activation to use SchemalessTypeRef on the versioned attributes. +func useSchemalessTypeRef() activationOption { + return func(o *activationOptions) { + o.useSchemalessTypeRef = true + } +} + // newActivation creates an activation for CEL admission plugins from the given request, admission chain and // variable binding information. -func newActivation(compositionCtx CompositionContext, versionedAttr *admission.VersionedAttributes, request *admissionv1.AdmissionRequest, inputs OptionalVariableBindings, namespace *v1.Namespace) (*evaluationActivation, error) { - oldObjectVal, err := objectToResolveVal(versionedAttr.VersionedOldObject) +func newActivation(compositionCtx CompositionContext, versionedAttr *admission.VersionedAttributes, request *admissionv1.AdmissionRequest, inputs OptionalVariableBindings, namespace *v1.Namespace, options ...activationOption) (*evaluationActivation, error) { + opts := &activationOptions{} + for _, o := range options { + o(opts) + } + if opts.useSchemalessTypeRef && versionedAttr != nil { + // SA1019: admission.LazyObject.UseSchemalessTypeRef is deprecated: This field is temporary and will be removed when schemaless becomes the default. + //nolint:staticcheck + versionedAttr.VersionedObject.UseSchemalessTypeRef = true + //nolint:staticcheck + versionedAttr.VersionedOldObject.UseSchemalessTypeRef = true + } + + celOldObjVal, err := versionedAttr.VersionedOldObject.CELValue() if err != nil { return nil, fmt.Errorf("failed to prepare oldObject variable for evaluation: %w", err) } - objectVal, err := objectToResolveVal(versionedAttr.VersionedObject) + + celObjVal, err := versionedAttr.VersionedObject.CELValue() if err != nil { return nil, fmt.Errorf("failed to prepare object variable for evaluation: %w", err) } + var paramsVal, authorizerVal, requestResourceAuthorizerVal any if inputs.VersionedParams != nil { - paramsVal, err = objectToResolveVal(inputs.VersionedParams) - if err != nil { - return nil, fmt.Errorf("failed to prepare params variable for evaluation: %w", err) - } + paramsVal = common.SchemalessTypedToVal(inputs.VersionedParams) } if inputs.Authorizer != nil { @@ -54,19 +82,13 @@ func newActivation(compositionCtx CompositionContext, versionedAttr *admission.V requestResourceAuthorizerVal = library.NewResourceAuthorizerVal(versionedAttr.GetUserInfo(), inputs.Authorizer, versionedAttr) } - requestVal, err := convertObjectToUnstructured(request) - if err != nil { - return nil, fmt.Errorf("failed to prepare request variable for evaluation: %w", err) - } - namespaceVal, err := objectToResolveVal(namespace) - if err != nil { - return nil, fmt.Errorf("failed to prepare namespace variable for evaluation: %w", err) - } + requestVal := common.SchemalessTypedToVal(request) + namespaceVal := common.SchemalessTypedToVal(namespace) va := &evaluationActivation{ - object: objectVal, - oldObject: oldObjectVal, + object: celObjVal, + oldObject: celOldObjVal, params: paramsVal, - request: requestVal.Object, + request: requestVal, namespace: namespaceVal, authorizer: authorizerVal, requestResourceAuthorizer: requestResourceAuthorizerVal, diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/cel/condition.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/cel/condition.go index f28401f3e1..18150cee93 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/cel/condition.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/cel/condition.go @@ -18,13 +18,11 @@ package cel import ( "context" - "reflect" admissionv1 "k8s.io/api/admission/v1" authenticationv1 "k8s.io/api/authentication/v1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apiserver/pkg/admission" "k8s.io/apiserver/pkg/cel/environment" @@ -62,40 +60,22 @@ func NewCondition(compilationResults []CompilationResult) ConditionEvaluator { } } -func convertObjectToUnstructured(obj interface{}) (*unstructured.Unstructured, error) { - if obj == nil || reflect.ValueOf(obj).IsNil() { - return &unstructured.Unstructured{Object: nil}, nil - } - ret, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj) - if err != nil { - return nil, err - } - return &unstructured.Unstructured{Object: ret}, nil -} - -func objectToResolveVal(r runtime.Object) (interface{}, error) { - if r == nil || reflect.ValueOf(r).IsNil() { - return nil, nil - } - v, err := convertObjectToUnstructured(r) - if err != nil { - return nil, err - } - return v.Object, nil -} - // ForInput evaluates the compiled CEL expressions converting them into CELEvaluations // errors per evaluation are returned on the Evaluation object // runtimeCELCostBudget was added for testing purpose only. Callers should always use const RuntimeCELCostBudget from k8s.io/apiserver/pkg/apis/cel/config.go as input. func (c *condition) ForInput(ctx context.Context, versionedAttr *admission.VersionedAttributes, request *admissionv1.AdmissionRequest, inputs OptionalVariableBindings, namespace *v1.Namespace, runtimeCELCostBudget int64) ([]EvaluationResult, int64, error) { // TODO: replace unstructured with ref.Val for CEL variables when native type support is available evaluations := make([]EvaluationResult, len(c.compilationResults)) + if len(c.compilationResults) == 0 { + return evaluations, runtimeCELCostBudget, nil + } + var err error // if this activation supports composition, we will need the compositionCtx. It may be nil. compositionCtx, _ := ctx.(CompositionContext) - activation, err := newActivation(compositionCtx, versionedAttr, request, inputs, namespace) + activation, err := newActivation(compositionCtx, versionedAttr, request, inputs, namespace, useSchemalessTypeRef()) if err != nil { return nil, -1, err } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/cel/interface.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/cel/interface.go index 55faa34ec6..a293eb3898 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/cel/interface.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/cel/interface.go @@ -80,7 +80,7 @@ type OptionalVariableBindings struct { // Authorizer provides the authorizer used for the "authorizer" and // "authorizer.requestResource" variable bindings. If the expression was compiled with // OptionalVariableDeclarations.HasAuthorizer set to true this must be non-nil. - Authorizer authorizer.Authorizer + Authorizer authorizer.UnconditionalAuthorizer } // ConditionEvaluator contains the result of compiling a CEL expression diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/namespace/lifecycle/admission.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/namespace/lifecycle/admission.go index 12654e2718..34faf8f580 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/namespace/lifecycle/admission.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/namespace/lifecycle/admission.go @@ -102,6 +102,11 @@ func (l *Lifecycle) Admit(ctx context.Context, a admission.Attributes, o admissi return nil } + // always allow updates to other resources + if a.GetOperation() == admission.Update { + return nil + } + // always allow access review checks. Returning status about the namespace would be leaking information if isAccessReview(a) { return nil diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/types.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/types.go index 967b6ca3f9..11a27e9399 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/types.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/types.go @@ -22,7 +22,7 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" // ValidatingAdmissionPolicyConfiguration provides configuration for the validating admission policy controller. type ValidatingAdmissionPolicyConfiguration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // StaticManifestsDir is the path to a directory containing static // ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding @@ -39,7 +39,7 @@ type ValidatingAdmissionPolicyConfiguration struct { // MutatingAdmissionPolicyConfiguration provides configuration for the mutating admission policy controller. type MutatingAdmissionPolicyConfiguration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // StaticManifestsDir is the path to a directory containing static // MutatingAdmissionPolicy and MutatingAdmissionPolicyBinding diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/zz_generated.model_name.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/zz_generated.model_name.go new file mode 100644 index 0000000000..00cc875d30 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/zz_generated.model_name.go @@ -0,0 +1,32 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by openapi-gen. DO NOT EDIT. + +package v1 + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in MutatingAdmissionPolicyConfiguration) OpenAPIModelName() string { + return "io.k8s.apiserver.pkg.admission.plugin.policy.config.apis.policyconfig.v1.MutatingAdmissionPolicyConfiguration" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in ValidatingAdmissionPolicyConfiguration) OpenAPIModelName() string { + return "io.k8s.apiserver.pkg.admission.plugin.policy.config.apis.policyconfig.v1.ValidatingAdmissionPolicyConfiguration" +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/plugin.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/plugin.go index 20771583ce..70eae90aab 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/plugin.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/plugin.go @@ -40,7 +40,7 @@ import ( // H is the Hook type generated by the source and consumed by the dispatcher. // !TODO: Just pass in a Plugin[H] with accessors to all this information type apiSourceFactory[H any] func(informers.SharedInformerFactory, kubernetes.Interface, dynamic.Interface, meta.RESTMapper) Source[H] -type dispatcherFactory[H any] func(authorizer.Authorizer, *matching.Matcher, kubernetes.Interface) Dispatcher[H] +type dispatcherFactory[H any] func(authorizer.UnconditionalAuthorizer, *matching.Matcher, kubernetes.Interface) Dispatcher[H] // ReloadableSource extends HookSource with a method to run a reload loop // that watches for configuration changes and blocks until the context is canceled. @@ -102,7 +102,7 @@ type Plugin[H any] struct { // excluded from ALL policy evaluation, including static policies. excludedResources sets.Set[schema.GroupResource] stopCh <-chan struct{} - authorizer authorizer.Authorizer + authorizer authorizer.UnconditionalAuthorizer enabled bool } @@ -113,7 +113,7 @@ var ( _ initializer.WantsDynamicClient = &Plugin[any]{} _ initializer.WantsDrainedNotification = &Plugin[any]{} _ initializer.WantsAPIServerID = &Plugin[any]{} - _ initializer.WantsAuthorizer = &Plugin[any]{} + _ initializer.WantsUnconditionalAuthorizer = &Plugin[any]{} _ initializer.WantsExcludedAdmissionResources = &Plugin[any]{} _ admission.InitializationValidator = &Plugin[any]{} ) @@ -155,7 +155,7 @@ func (c *Plugin[H]) SetDrainedNotification(stopCh <-chan struct{}) { c.stopCh = stopCh } -func (c *Plugin[H]) SetAuthorizer(authorizer authorizer.Authorizer) { +func (c *Plugin[H]) SetUnconditionalAuthorizer(authorizer authorizer.UnconditionalAuthorizer) { c.authorizer = authorizer } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/policy_dispatcher.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/policy_dispatcher.go index 62214a3092..1847ec63ee 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/policy_dispatcher.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/policy_dispatcher.go @@ -22,17 +22,20 @@ import ( "fmt" "time" - "k8s.io/api/admissionregistration/v1" + v1 "k8s.io/api/admissionregistration/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apiserver/pkg/admission" "k8s.io/apiserver/pkg/admission/plugin/policy/matching" webhookgeneric "k8s.io/apiserver/pkg/admission/plugin/webhook/generic" + "k8s.io/client-go/dynamic" "k8s.io/client-go/informers" + clientgoscheme "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/tools/cache" ) @@ -174,6 +177,8 @@ func (d *policyDispatcher[P, B, E]) Dispatch(ctx context.Context, a admission.At hook.ParamScope, bindingAccessor.GetParamRef(), a.GetNamespace(), + hook.DynamicClient, + hook.RESTMapper, ) if err != nil { // There was an error collecting params for this binding. @@ -264,12 +269,17 @@ func (d *policyDispatcher[P, B, E]) Dispatch(ctx context.Context, a admission.At // Returns params to use to evaluate a policy-binding with given param // configuration. If the policy-binding has no param configuration, it // returns a single-element list with a nil param. +// +// The dynamicClient and restMapper parameters enable direct API fallback when +// the informer cache hasn't received the watch event for a newly created param yet. func CollectParams( paramKind *v1.ParamKind, paramInformer informers.GenericInformer, paramScope meta.RESTScope, paramRef *v1.ParamRef, namespace string, + dynamicClient dynamic.Interface, + restMapper meta.RESTMapper, ) ([]runtime.Object, error) { // If definition has paramKind, paramRef is required in binding. // If definition has no paramKind, paramRef set in binding will be ignored. @@ -331,7 +341,20 @@ func CollectParams( return nil, fmt.Errorf("paramRef.name and paramRef.selector are mutually exclusive") } - switch param, err := paramStore.Get(paramRef.Name); { + // First attempt: try to get the param from the informer cache (fast path) + param, err := paramStore.Get(paramRef.Name) + + // If cache returns NotFound and we have a client, try direct API call as fallback. + // This handles the race condition where resources (ConfigMap, Policy, Binding, and Param) + // are created in quick succession. The informer cache may have completed its initial + // sync (checked by WaitForCacheSync above), but newly created params might not have + // propagated to the cache yet. The direct API call ensures we get the correct answer + // without timing-dependent retry logic. + if apierrors.IsNotFound(err) && dynamicClient != nil && restMapper != nil && paramKind != nil { + param, err = getParamDirectly(dynamicClient, restMapper, paramKind, paramRef, namespace, paramScope) + } + + switch { case err == nil: params = []runtime.Object{param} case apierrors.IsNotFound(err): @@ -381,6 +404,80 @@ func CollectParams( return params, nil } +// getParamDirectly performs a direct API call to retrieve a param when the informer +// cache doesn't have it yet. This handles the race condition where a param resource +// is created but the watch event hasn't propagated to the informer cache. +func getParamDirectly( + dynamicClient dynamic.Interface, + restMapper meta.RESTMapper, + paramKind *v1.ParamKind, + paramRef *v1.ParamRef, + namespace string, + paramScope meta.RESTScope, +) (runtime.Object, error) { + // Convert GVK to GVR using the RESTMapper + gv, err := schema.ParseGroupVersion(paramKind.APIVersion) + if err != nil { + return nil, fmt.Errorf("invalid paramKind APIVersion %q: %w", paramKind.APIVersion, err) + } + gvk := gv.WithKind(paramKind.Kind) + + mapping, err := restMapper.RESTMapping(gvk.GroupKind(), gvk.Version) + if err != nil { + // An unknown paramKind (CRD not registered or deleted) is reported as + // NotFound so the caller routes it through ParameterNotFoundAction + // instead of failing the admission request as an internal error. + if meta.IsNoMatchError(err) { + return nil, apierrors.NewNotFound(schema.GroupResource{Group: gvk.Group, Resource: gvk.Kind}, paramRef.Name) + } + return nil, fmt.Errorf("failed to find REST mapping for %v: %w", gvk, err) + } + + // Determine the namespace for the Get request + var targetNamespace string + if paramScope.Name() == meta.RESTScopeNameNamespace { + if len(paramRef.Namespace) > 0 { + targetNamespace = paramRef.Namespace + } else { + targetNamespace = namespace + } + } + + // Perform the direct API call with a timeout + ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second) + defer cancel() + + var resourceClient dynamic.ResourceInterface + if targetNamespace != "" { + resourceClient = dynamicClient.Resource(mapping.Resource).Namespace(targetNamespace) + } else { + resourceClient = dynamicClient.Resource(mapping.Resource) + } + + param, err := resourceClient.Get(ctx, paramRef.Name, metav1.GetOptions{}) + if err != nil { + return nil, err + } + return convertParamToInformerRepresentation(gvk, param) +} + +// convertParamToInformerRepresentation makes a get response object look like an informer object by +// representing it as unstructured and without TypeMeta. This ensures that CEL expressions +// receive param objects identically regardless of if the object was received via the informer +// or if an informer cache miss resulted in a get request to fetch the object. +func convertParamToInformerRepresentation(gvk schema.GroupVersionKind, param *unstructured.Unstructured) (runtime.Object, error) { + typed, err := clientgoscheme.Scheme.New(gvk) + if err != nil { + // The kind has no typed representation, so its informer also serves unstructured objects. + return param, nil + } + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(param.UnstructuredContent(), typed); err != nil { + return nil, fmt.Errorf("failed to convert param %v to typed object: %w", gvk, err) + } + typed.GetObjectKind().SetGroupVersionKind(schema.GroupVersionKind{}) + return typed, nil +} + var _ webhookgeneric.VersionedAttributeAccessor = &versionedAttributeAccessor{} type versionedAttributeAccessor struct { diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/policy_source.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/policy_source.go index 09e4895e93..0b7d8a168c 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/policy_source.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/policy_source.go @@ -99,6 +99,11 @@ type PolicyHook[P runtime.Object, B runtime.Object, E Evaluator] struct { ParamInformer informers.GenericInformer ParamScope meta.RESTScope + // DynamicClient is used for direct API calls to handle cache misses + DynamicClient dynamic.Interface + // RESTMapper is used to resolve GVK to GVR for direct API calls + RESTMapper meta.RESTMapper + Evaluator E ConfigurationError error } @@ -352,6 +357,8 @@ func (s *policySource[P, B, E]) calculatePolicyData() ([]PolicyHook[P, B, E], er Evaluator: s.compilePolicyLocked(policySpec), ParamInformer: paramInformer, ParamScope: paramScope, + DynamicClient: s.dynamicClient, + RESTMapper: s.restMapper, ConfigurationError: configurationError, }) diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/policy_test_context.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/policy_test_context.go index 5a98902864..4870230cdb 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/policy_test_context.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/policy_test_context.go @@ -57,10 +57,11 @@ type Logger interface { // PolicyTestContext is everything you need to unit test a policy plugin type PolicyTestContext[P runtime.Object, B runtime.Object, E Evaluator] struct { context.Context - Logger Logger - Plugin *Plugin[PolicyHook[P, B, E]] - Source Source[PolicyHook[P, B, E]] - Start func() error + Logger Logger + Plugin *Plugin[PolicyHook[P, B, E]] + Source Source[PolicyHook[P, B, E]] + Start func() error + DynamicClient dynamic.Interface scheme *runtime.Scheme restMapper *meta.DefaultRESTMapper @@ -225,10 +226,11 @@ func NewPolicyTestContext[P, B runtime.Object, E Evaluator]( } res := &PolicyTestContext[P, B, E]{ - Logger: logger, - Context: testContext, - Plugin: plugin, - Source: source, + Logger: logger, + Context: testContext, + Plugin: plugin, + Source: source, + DynamicClient: dynamicClient, restMapper: fakeRestMapper, scheme: policySourceTestScheme, @@ -642,3 +644,13 @@ type fakeAuthorizer struct{} func (f fakeAuthorizer) Authorize(ctx context.Context, a authorizer.Attributes) (authorizer.Decision, string, error) { return authorizer.DecisionAllow, "", nil } + +// ConditionsAwareAuthorize is not conditions-aware, converts the Authorize decision. +func (f fakeAuthorizer) ConditionsAwareAuthorize(ctx context.Context, a authorizer.Attributes) authorizer.ConditionsAwareDecision { + return authorizer.ConditionsAwareDecisionFromParts(f.Authorize(ctx, a)) +} + +// EvaluateConditions is not supported by this authorizer. +func (fakeAuthorizer) EvaluateConditions(_ context.Context, _ authorizer.ConditionsAwareDecision, _ authorizer.ConditionsData) (authorizer.Decision, string, error) { + return authorizer.DecisionDeny, "", authorizer.ErrorConditionEvaluationNotSupported +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/dispatcher.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/dispatcher.go index e5b10c7f6d..0a9a126b3c 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/dispatcher.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/dispatcher.go @@ -43,7 +43,7 @@ import ( "k8s.io/apiserver/pkg/authorization/authorizer" ) -func NewDispatcher(a authorizer.Authorizer, m *matching.Matcher, tcm patch.TypeConverterManager) generic.Dispatcher[PolicyHook] { +func NewDispatcher(a authorizer.UnconditionalAuthorizer, m *matching.Matcher, tcm patch.TypeConverterManager) generic.Dispatcher[PolicyHook] { res := &dispatcher{ matcher: m, authz: a, @@ -60,7 +60,7 @@ func NewDispatcher(a authorizer.Authorizer, m *matching.Matcher, tcm patch.TypeC type dispatcher struct { matcher *matching.Matcher - authz authorizer.Authorizer + authz authorizer.UnconditionalAuthorizer typeConverterManager patch.TypeConverterManager generic.Dispatcher[PolicyHook] } @@ -177,12 +177,12 @@ func (d *dispatcher) dispatchInvocations( continue } - objectBeforeMutations := versionedAttr.VersionedObject + objectBeforeMutations := versionedAttr.VersionedObject.Object() // Mutations for a single invocation of a MutatingAdmissionPolicy are evaluated // in order. for mutationIndex := range invocation.Policy.Spec.Mutations { lastVersionedAttr = versionedAttr - if versionedAttr.VersionedObject == nil { // Do not call patchers if there is no object to patch. + if versionedAttr.VersionedObject.Object() == nil { // Do not call patchers if there is no object to patch. continue } @@ -205,7 +205,7 @@ func (d *dispatcher) dispatchInvocations( celmetrics.Metrics.ObserveAdmission(ctx, elapsed, invocation.Policy.Name, invocation.Binding.Name, celmetrics.MutationNoError) } } - if !apiequality.Semantic.DeepEqual(objectBeforeMutations, versionedAttr.VersionedObject) { + if !apiequality.Semantic.DeepEqual(objectBeforeMutations, versionedAttr.VersionedObject.Object()) { // The mutation has changed the object. Prepare to reinvoke all previous mutations that are eligible for re-invocation. policyReinvokeCtx.RequireReinvokingPreviouslyInvokedPlugins() reinvokeCtx.SetShouldReinvoke() @@ -215,10 +215,10 @@ func (d *dispatcher) dispatchInvocations( } } - if lastVersionedAttr != nil && lastVersionedAttr.VersionedObject != nil && lastVersionedAttr.Dirty { + if lastVersionedAttr != nil && lastVersionedAttr.VersionedObject.Object() != nil && lastVersionedAttr.Dirty { policyReinvokeCtx.RequireReinvokingPreviouslyInvokedPlugins() reinvokeCtx.SetShouldReinvoke() - if err := o.GetObjectConvertor().Convert(lastVersionedAttr.VersionedObject, lastVersionedAttr.Attributes.GetObject(), nil); err != nil { + if err := o.GetObjectConvertor().Convert(lastVersionedAttr.VersionedObject.Object(), lastVersionedAttr.Attributes.GetObject(), nil); err != nil { return nil, k8serrors.NewInternalError(fmt.Errorf("failed to convert object: %w", err)) } } @@ -261,7 +261,7 @@ func (d *dispatcher) dispatchOne( return err } - switch versionedAttributes.VersionedObject.(type) { + switch versionedAttributes.VersionedObject.Object().(type) { case *unstructured.Unstructured: // No conversion needed before defaulting for the patch object if the admitted object is unstructured. default: @@ -272,9 +272,7 @@ func (d *dispatcher) dispatchOne( } } o.GetObjectDefaulter().Default(newVersionedObject) - - versionedAttributes.Dirty = true - versionedAttributes.VersionedObject = newVersionedObject + versionedAttributes.UpdateObject(newVersionedObject) return nil } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/patch/json_patch.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/patch/json_patch.go index 26f73dd341..439473d839 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/patch/json_patch.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/patch/json_patch.go @@ -85,7 +85,7 @@ func (e *jsonPatcher) Patch(ctx context.Context, r Request, runtimeCELCostBudget } o := r.ObjectInterfaces jsonSerializer := json.NewSerializerWithOptions(json.DefaultMetaFactory, o.GetObjectCreater(), o.GetObjectTyper(), json.SerializerOptions{Pretty: false, Strict: true}) - objJS, err := runtime.Encode(jsonSerializer, r.VersionedAttributes.VersionedObject) + objJS, err := runtime.Encode(jsonSerializer, r.VersionedAttributes.VersionedObject.Object()) if err != nil { return nil, fmt.Errorf("failed to create JSON patch: %w", err) } @@ -93,13 +93,13 @@ func (e *jsonPatcher) Patch(ctx context.Context, r Request, runtimeCELCostBudget if err != nil { if errors.Is(err, jsonpatch.ErrTestFailed) { // If a json patch fails a test operation, the patch must not be applied - return r.VersionedAttributes.VersionedObject, nil + return r.VersionedAttributes.VersionedObject.Object(), nil } return nil, fmt.Errorf("JSON Patch: %w", err) } var newVersionedObject runtime.Object - if _, ok := r.VersionedAttributes.VersionedObject.(*unstructured.Unstructured); ok { + if _, ok := r.VersionedAttributes.VersionedObject.Object().(*unstructured.Unstructured); ok { newVersionedObject = &unstructured.Unstructured{} } else { newVersionedObject, err = o.GetObjectCreater().New(r.VersionedAttributes.VersionedKind) diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/patch/smd.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/patch/smd.go index 7135aca3a2..7dcc241483 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/patch/smd.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/patch/smd.go @@ -107,8 +107,8 @@ func (e *applyConfigPatcher) Patch(ctx context.Context, r Request, runtimeCELCos } patchObject := unstructured.Unstructured{Object: value} - patchObject.SetGroupVersionKind(r.VersionedAttributes.VersionedObject.GetObjectKind().GroupVersionKind()) - patched, err := ApplyStructuredMergeDiff(r.TypeConverter, r.VersionedAttributes.VersionedObject, &patchObject) + patchObject.SetGroupVersionKind(r.VersionedAttributes.VersionedObject.Object().GetObjectKind().GroupVersionKind()) + patched, err := ApplyStructuredMergeDiff(r.TypeConverter, r.VersionedAttributes.VersionedObject.Object(), &patchObject) if err != nil { return nil, fmt.Errorf("error applying patch: %w", err) } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/plugin.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/plugin.go index 01dd230dea..77d8d3efeb 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/plugin.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/plugin.go @@ -74,7 +74,7 @@ type MutationEvaluationFunc func( namespace *corev1.Namespace, typeConverter managedfields.TypeConverter, runtimeCELCostBudget int64, - authorizer authorizer.Authorizer, + authorizer authorizer.UnconditionalAuthorizer, ) (runtime.Object, error) type PolicyEvaluator struct { @@ -147,7 +147,7 @@ func NewPlugin(configFile io.Reader) (*Plugin, error) { restMapper, ) }, - func(a authorizer.Authorizer, m *matching.Matcher, client kubernetes.Interface) generic.Dispatcher[PolicyHook] { + func(a authorizer.UnconditionalAuthorizer, m *matching.Matcher, client kubernetes.Interface) generic.Dispatcher[PolicyHook] { return NewDispatcher(a, m, patch.NewTypeConverterManager(nil, client.Discovery().OpenAPIV3())) }, ) diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/dispatcher.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/dispatcher.go index 0b5474b756..12d8432c21 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/dispatcher.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/dispatcher.go @@ -41,13 +41,13 @@ import ( type dispatcher struct { matcher generic.PolicyMatcher - authz authorizer.Authorizer + authz authorizer.UnconditionalAuthorizer } var _ generic.Dispatcher[PolicyHook] = &dispatcher{} func NewDispatcher( - authorizer authorizer.Authorizer, + authorizer authorizer.UnconditionalAuthorizer, matcher generic.PolicyMatcher, ) generic.Dispatcher[PolicyHook] { return &dispatcher{ @@ -70,8 +70,8 @@ func (c *dispatcher) Start(ctx context.Context) error { // Dispatch implements generic.Dispatcher. func (c *dispatcher) Dispatch(ctx context.Context, a admission.Attributes, o admission.ObjectInterfaces, hooks []PolicyHook) error { - var deniedDecisions []policyDecisionWithMetadata + var validationFailures []ValidationFailureValue addConfigError := func(err error, definition *admissionregistrationv1.ValidatingAdmissionPolicy, binding *admissionregistrationv1.ValidatingAdmissionPolicyBinding) { // we always default the FailurePolicy if it is unset and validate it in API level @@ -115,14 +115,9 @@ func (c *dispatcher) Dispatch(ctx context.Context, a admission.Attributes, o adm } authz := admissionauthorizer.NewCachingAuthorizer(c.authz) + versionedAttrs := map[schema.GroupVersionKind]*admission.VersionedAttributes{} for _, hook := range hooks { - // versionedAttributes will be set to non-nil inside of the loop, but - // is scoped outside of the param loop so we only convert once. We defer - // conversion so that it is only performed when we know a policy matches, - // saving the cost of converting non-matching requests. - var versionedAttr *admission.VersionedAttributes - definition := hook.Policy matches, matchResource, matchKind, err := c.matcher.DefinitionMatches(a, o, NewValidatingAdmissionPolicyAccessor(definition)) if err != nil { @@ -159,12 +154,17 @@ func (c *dispatcher) Dispatch(ctx context.Context, a admission.Attributes, o adm hook.ParamScope, binding.Spec.ParamRef, a.GetNamespace(), + hook.DynamicClient, + hook.RESTMapper, ) if err != nil { addConfigError(err, definition, binding) continue - } else if versionedAttr == nil && len(params) > 0 { + } + + versionedAttr := versionedAttrs[matchKind] + if versionedAttr == nil && len(params) > 0 { // As optimization versionedAttr creation is deferred until // first use. Since > 0 params, we will validate va, err := admission.NewVersionedAttributes(a, matchKind, o) @@ -174,6 +174,7 @@ func (c *dispatcher) Dispatch(ctx context.Context, a admission.Attributes, o adm continue } versionedAttr = va + versionedAttrs[matchKind] = va } var validationResults []ValidateResult @@ -241,7 +242,13 @@ func (c *dispatcher) Dispatch(ctx context.Context, a admission.Attributes, o adm }) celmetrics.Metrics.ObserveRejection(ctx, decision.Elapsed, definition.Name, binding.Name, ErrorType(&decision)) case admissionregistrationv1.Audit: - publishValidationFailureAnnotation(binding, i, decision, versionedAttr) + validationFailures = append(validationFailures, ValidationFailureValue{ + ExpressionIndex: i, + Message: decision.Message, + ValidationActions: binding.Spec.ValidationActions, + Binding: binding.Name, + Policy: binding.Spec.PolicyName, + }) celmetrics.Metrics.ObserveAudit(ctx, decision.Elapsed, definition.Name, binding.Name, ErrorType(&decision)) case admissionregistrationv1.Warn: warning.AddWarning(ctx, "", fmt.Sprintf("Validation failed for ValidatingAdmissionPolicy '%s' with binding '%s': %s", definition.Name, binding.Name, decision.Message)) @@ -286,6 +293,10 @@ func (c *dispatcher) Dispatch(ctx context.Context, a admission.Attributes, o adm auditAnnotationCollector.publish(definition.Name, a) } + if len(validationFailures) > 0 { + publishValidationFailureAnnotations(a, validationFailures) + } + if len(deniedDecisions) > 0 { // TODO: refactor admission.NewForbidden so the name extraction is reusable but the code/reason is customizable var message string @@ -308,23 +319,38 @@ func (c *dispatcher) Dispatch(ctx context.Context, a admission.Attributes, o adm return nil } -func publishValidationFailureAnnotation(binding *admissionregistrationv1.ValidatingAdmissionPolicyBinding, expressionIndex int, decision PolicyDecision, attributes admission.Attributes) { +// maxValidationFailures is the maximum number of validation failures to include in the audit annotation +// to prevent audit logs resource exhaustion. +// The expected size of 50 validation failures is ~10KB. +const maxValidationFailures = 50 + +func publishValidationFailureAnnotations(attributes admission.Attributes, failures []ValidationFailureValue) { + if len(failures) == 0 { + return + } + if len(failures) > maxValidationFailures { + klog.Warningf("Validation failures count %d for resource %s exceeds limit of %d; truncating audit annotation", len(failures), attributes.GetResource().String(), maxValidationFailures) + failures = failures[:maxValidationFailures] + } + key := "validation.policy.admission.k8s.io/validation_failure" - // Marshal to a list of failures since, in the future, we may need to support multiple failures - valueJSON, err := utiljson.Marshal([]ValidationFailureValue{{ - ExpressionIndex: expressionIndex, - Message: decision.Message, - ValidationActions: binding.Spec.ValidationActions, - Binding: binding.Name, - Policy: binding.Spec.PolicyName, - }}) + valueJSON, err := utiljson.Marshal(failures) if err != nil { - klog.Warningf("Failed to set admission audit annotation %s for ValidatingAdmissionPolicy %s and ValidatingAdmissionPolicyBinding %s: %v", key, binding.Spec.PolicyName, binding.Name, err) + klog.Warningf("Failed to marshal admission audit validation failures for key %s for ValidatingAdmissionPolicies and ValidatingAdmissionPolicyBindings %s: %v", key, formatPoliciesBindings(failures), err) + return } value := string(valueJSON) if err := attributes.AddAnnotation(key, value); err != nil { - klog.Warningf("Failed to set admission audit annotation %s to %s for ValidatingAdmissionPolicy %s and ValidatingAdmissionPolicyBinding %s: %v", key, value, binding.Spec.PolicyName, binding.Name, err) + klog.Warningf("Failed to set admission audit annotation %s to %s for ValidatingAdmissionPolicies and ValidatingAdmissionPolicyBindings %s: %v", key, value, formatPoliciesBindings(failures), err) + } +} + +func formatPoliciesBindings(failures []ValidationFailureValue) string { + var policiesBindings []string + for _, failure := range failures { + policiesBindings = append(policiesBindings, fmt.Sprintf("%s/%s", failure.Policy, failure.Binding)) } + return strings.Join(policiesBindings, ", ") } const maxAuditAnnotationValueLength = 10 * 1024 diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/interface.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/interface.go index fd8015e7ce..2f1ab4499a 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/interface.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/interface.go @@ -91,7 +91,7 @@ type ValidateResult struct { type Validator interface { // Validate is used to take cel evaluations and convert into decisions // runtimeCELCostBudget was added for testing purpose only. Callers should always use const RuntimeCELCostBudget from k8s.io/apiserver/pkg/apis/cel/config.go as input. - Validate(ctx context.Context, matchedResource schema.GroupVersionResource, versionedAttr *admission.VersionedAttributes, versionedParams runtime.Object, namespace *corev1.Namespace, runtimeCELCostBudget int64, authz authorizer.Authorizer) ValidateResult + Validate(ctx context.Context, matchedResource schema.GroupVersionResource, versionedAttr *admission.VersionedAttributes, versionedParams runtime.Object, namespace *corev1.Namespace, runtimeCELCostBudget int64, authz authorizer.UnconditionalAuthorizer) ValidateResult // CompileError returns any error from CEL compilation, or nil if compilation succeeded. CompileError() error } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/plugin.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/plugin.go index 348ecde2d0..dea37777cf 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/plugin.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/plugin.go @@ -129,7 +129,7 @@ func NewPlugin(configFile io.Reader) (*Plugin, error) { restMapper, ) }, - func(a authorizer.Authorizer, m *matching.Matcher, client kubernetes.Interface) generic.Dispatcher[PolicyHook] { + func(a authorizer.UnconditionalAuthorizer, m *matching.Matcher, client kubernetes.Interface) generic.Dispatcher[PolicyHook] { return NewDispatcher(a, generic.NewPolicyMatcher(m)) }, ), diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/validator.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/validator.go index 2144795fd8..1bff116734 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/validator.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/validator.go @@ -82,7 +82,7 @@ func (v *validator) CompileError() error { // Validate takes a list of Evaluation and a failure policy and converts them into actionable PolicyDecisions // runtimeCELCostBudget was added for testing purpose only. Callers should always use const RuntimeCELCostBudget from k8s.io/apiserver/pkg/apis/cel/config.go as input. -func (v *validator) Validate(ctx context.Context, matchedResource schema.GroupVersionResource, versionedAttr *admission.VersionedAttributes, versionedParams runtime.Object, namespace *corev1.Namespace, runtimeCELCostBudget int64, authz authorizer.Authorizer) ValidateResult { +func (v *validator) Validate(ctx context.Context, matchedResource schema.GroupVersionResource, versionedAttr *admission.VersionedAttributes, versionedParams runtime.Object, namespace *corev1.Namespace, runtimeCELCostBudget int64, authz authorizer.UnconditionalAuthorizer) ValidateResult { var f v1.FailurePolicyType if v.failPolicy == nil { f = v1.Fail diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1/types.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1/types.go index be09205348..4fdd0ddcbe 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1/types.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1/types.go @@ -22,7 +22,7 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" // WebhookAdmission provides configuration for the webhook admission controller. type WebhookAdmission struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // KubeConfigFile is the path to the kubeconfig file. KubeConfigFile string `json:"kubeConfigFile"` diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1/zz_generated.model_name.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1/zz_generated.model_name.go new file mode 100644 index 0000000000..e50bb3ece2 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1/zz_generated.model_name.go @@ -0,0 +1,27 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by openapi-gen. DO NOT EDIT. + +package v1 + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WebhookAdmission) OpenAPIModelName() string { + return "io.k8s.apiserver.pkg.admission.plugin.webhook.config.apis.webhookadmission.v1.WebhookAdmission" +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/generic/webhook.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/generic/webhook.go index cef27b2330..46907bf339 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/generic/webhook.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/generic/webhook.go @@ -30,6 +30,7 @@ import ( v1 "k8s.io/api/admissionregistration/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apiserver/pkg/admission" genericadmissioninit "k8s.io/apiserver/pkg/admission/initializer" admissionmetrics "k8s.io/apiserver/pkg/admission/metrics" @@ -45,6 +46,7 @@ import ( "k8s.io/client-go/informers" coreinformers "k8s.io/client-go/informers/core/v1" clientset "k8s.io/client-go/kubernetes" + "k8s.io/component-base/featuregate" ) // Webhook is an abstract admission plugin with all the infrastructure to define Admit or Validate on-top. @@ -52,6 +54,7 @@ type Webhook struct { *admission.Handler // Factories for creating webhook sources. + apiSourceInformers informers.SharedInformerFactory apiSourceFactory sourceFactory staticSourceFactory StaticSourceFactory @@ -76,20 +79,30 @@ type Webhook struct { objectMatcher *object.Matcher dispatcher Dispatcher filterCompiler cel.ConditionCompiler - authorizer authorizer.Authorizer + authorizer authorizer.UnconditionalAuthorizer // Lifecycle. stopCh <-chan struct{} + + // excludedAdmissionResources are virtual resources (auth/authz reviews) that admission + // webhooks must not intercept when excludeVirtualResources is set. It is populated from + // the authoritative exclusion list via SetExcludedAdmissionResources. + excludedAdmissionResources sets.Set[schema.GroupResource] + // excludeVirtualResources caches whether the ExcludeAdmissionWebhookVirtualResources + // feature is enabled, set once via InspectFeatureGates to avoid a gate lookup per request. + excludeVirtualResources bool } var ( - _ genericadmissioninit.WantsExternalKubeClientSet = &Webhook{} - _ genericadmissioninit.WantsDrainedNotification = &Webhook{} - _ genericadmissioninit.WantsAPIServerID = &Webhook{} - _ admission.Interface = &Webhook{} + _ genericadmissioninit.WantsExternalKubeClientSet = &Webhook{} + _ genericadmissioninit.WantsDrainedNotification = &Webhook{} + _ genericadmissioninit.WantsAPIServerID = &Webhook{} + _ genericadmissioninit.WantsExcludedAdmissionResources = &Webhook{} + _ genericadmissioninit.WantsFeatures = &Webhook{} + _ admission.Interface = &Webhook{} ) -type sourceFactory func(f informers.SharedInformerFactory) Source +type sourceFactory func(f informers.SharedInformerFactory, excludedWebhookResources sets.Set[schema.GroupResource]) Source type dispatcherFactory func(cm *webhookutil.ClientManager) Dispatcher // ReloadableSource extends Source with a method to run a reload loop @@ -132,14 +145,15 @@ func NewWebhook(handler *admission.Handler, configFile io.Reader, sourceFactory cm.SetServiceResolver(webhookutil.NewDefaultServiceResolver()) return &Webhook{ - Handler: handler, - apiSourceFactory: sourceFactory, - staticManifestsDir: cfg.StaticManifestsDir, - clientManager: &cm, - namespaceMatcher: &namespace.Matcher{}, - objectMatcher: &object.Matcher{}, - dispatcher: dispatcherFactory(&cm), - filterCompiler: cel.NewConditionCompiler(environment.MustBaseEnvSet(environment.DefaultCompatibilityVersion())), + Handler: handler, + apiSourceFactory: sourceFactory, + staticManifestsDir: cfg.StaticManifestsDir, + clientManager: &cm, + namespaceMatcher: &namespace.Matcher{}, + objectMatcher: &object.Matcher{}, + dispatcher: dispatcherFactory(&cm), + filterCompiler: cel.NewConditionCompiler(environment.MustBaseEnvSet(environment.DefaultCompatibilityVersion())), + excludedAdmissionResources: sets.New[schema.GroupResource](), }, nil } @@ -179,6 +193,18 @@ func (a *Webhook) SetDrainedNotification(stopCh <-chan struct{}) { a.stopCh = stopCh } +// SetExcludedAdmissionResources implements the WantsExcludedAdmissionResources interface. +func (a *Webhook) SetExcludedAdmissionResources(excludedResources []schema.GroupResource) { + a.excludedAdmissionResources.Insert(excludedResources...) +} + +// InspectFeatureGates implements the WantsFeatures interface. It caches whether the +// ExcludeAdmissionWebhookVirtualResources feature is enabled so Dispatch avoids a gate +// lookup on every request. +func (a *Webhook) InspectFeatureGates(featureGates featuregate.FeatureGate) { + a.excludeVirtualResources = featureGates.Enabled(features.ExcludeAdmissionWebhookVirtualResources) +} + // SetExternalKubeClientSet implements the WantsExternalKubeInformerFactory interface. // It sets external ClientSet for admission plugins that need it func (a *Webhook) SetExternalKubeClientSet(client clientset.Interface) { @@ -191,21 +217,33 @@ func (a *Webhook) SetExternalKubeInformerFactory(f informers.SharedInformerFacto a.namespaceMatcher.NamespaceLister = namespaceInformer.Lister() a.namespaceInformer = namespaceInformer - // Create the API-based source (stored for later use in ValidateInitialization) - a.apiSource = a.apiSourceFactory(f) + // Stored for constructing apiSource in ValidateInitialization (after all initializers have + // run, so the excluded resource set is available). Reset apiSource so that re-setting the + // informer factory rebuilds it from the new factory. + a.apiSourceInformers = f + a.apiSource = nil } -func (a *Webhook) SetAuthorizer(authorizer authorizer.Authorizer) { +func (a *Webhook) SetUnconditionalAuthorizer(authorizer authorizer.UnconditionalAuthorizer) { a.authorizer = authorizer } // ValidateInitialization implements the InitializationValidator interface. -// Static source creation happens here (after all initializers have run) because -// SetManifestLoaders may be called after SetExternalKubeInformerFactory. +// API and static source creation happens here (after all initializers have run) because +// initialization setter order is not guaranteed. func (a *Webhook) ValidateInitialization() error { + // Construct apiSource if needed if a.apiSource == nil { - return fmt.Errorf("kubernetes client is not properly setup") + if a.apiSourceInformers == nil { + return fmt.Errorf("kubernetes client is not properly setup") + } + if a.excludeVirtualResources { + a.apiSource = a.apiSourceFactory(a.apiSourceInformers, a.excludedAdmissionResources) + } else { + a.apiSource = a.apiSourceFactory(a.apiSourceInformers, nil) + } } + if err := a.namespaceMatcher.Validate(); err != nil { return fmt.Errorf("namespaceMatcher is not properly setup: %v", err) } @@ -353,12 +391,31 @@ type attrWithResourceOverride struct { func (a *attrWithResourceOverride) GetResource() schema.GroupVersionResource { return a.resource } +// isExcludedFromAllHooks returns true for non-persisted virtual resources (auth/authz reviews) +// that must not be intercepted by any webhook, static or REST-based. It returns false (no-op) +// when the ExcludeAdmissionWebhookVirtualResources feature is disabled. +func (a *Webhook) isExcludedFromAllHooks(gr schema.GroupResource) bool { + return a.excludeVirtualResources && a.excludedAdmissionResources.Has(gr) +} + +// isExcludedFromAPIHooks returns true for admission configuration resources (webhook +// configurations and admission policies/bindings) that are excluded from API-based webhooks to +// prevent circular dependencies, but may still be evaluated by static (manifest-based) webhooks. +func (a *Webhook) isExcludedFromAPIHooks(attr admission.Attributes) bool { + return rules.IsExemptAdmissionConfigurationResource(attr) +} + // Dispatch is called by the downstream Validate or Admit methods. func (a *Webhook) Dispatch(ctx context.Context, attr admission.Attributes, o admission.ObjectInterfaces) error { - if rules.IsExemptAdmissionConfigurationResource(attr) { - // Admission config resources are excluded from API-based webhooks to - // prevent circular dependencies. However, static (manifest-based) webhooks - // are safe to evaluate since they don't have self-referential concerns. + if a.isExcludedFromAllHooks(attr.GetResource().GroupResource()) { + // Virtual auth/authz resources are excluded from all webhooks (static and REST-based) + // so that admission cannot wedge a cluster out of its own auth path. + return nil + } + if a.isExcludedFromAPIHooks(attr) { + // Admission config resources are excluded from API-based webhooks to prevent circular + // dependencies. However, static (manifest-based) webhooks are safe to evaluate since + // they don't have self-referential concerns. if a.staticSource != nil { if !a.staticSource.HasSynced() { return admission.NewForbidden(attr, fmt.Errorf("not yet ready to handle request")) diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/matchconditions/interface.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/matchconditions/interface.go index 094a019d1f..991d01357a 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/matchconditions/interface.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/matchconditions/interface.go @@ -33,5 +33,5 @@ type MatchResult struct { // Matcher contains logic for converting Evaluations to bool of matches or does not match type Matcher interface { // Match is used to take cel evaluations and convert into decisions - Match(ctx context.Context, versionedAttr *admission.VersionedAttributes, versionedParams runtime.Object, authz authorizer.Authorizer) MatchResult + Match(ctx context.Context, versionedAttr *admission.VersionedAttributes, versionedParams runtime.Object, authz authorizer.UnconditionalAuthorizer) MatchResult } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/matchconditions/matcher.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/matchconditions/matcher.go index b9b4c9169e..c8bde3d7d5 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/matchconditions/matcher.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/matchconditions/matcher.go @@ -77,7 +77,7 @@ func NewMatcher(filter celplugin.ConditionEvaluator, failPolicy *v1.FailurePolic } } -func (m *matcher) Match(ctx context.Context, versionedAttr *admission.VersionedAttributes, versionedParams runtime.Object, authz authorizer.Authorizer) MatchResult { +func (m *matcher) Match(ctx context.Context, versionedAttr *admission.VersionedAttributes, versionedParams runtime.Object, authz authorizer.UnconditionalAuthorizer) MatchResult { t := time.Now() evalResults, _, err := m.filter.ForInput(ctx, versionedAttr, celplugin.CreateAdmissionRequest(versionedAttr.Attributes, metav1.GroupVersionResource(versionedAttr.GetResource()), metav1.GroupVersionKind(versionedAttr.VersionedKind)), celplugin.OptionalVariableBindings{ VersionedParams: versionedParams, diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/dispatcher.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/dispatcher.go index cb241caae7..17b3172dd3 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/dispatcher.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/dispatcher.go @@ -232,8 +232,8 @@ func (a *mutatingDispatcher) Dispatch(ctx context.Context, attr admission.Attrib } // convert versionedAttr.VersionedObject to the internal version in the underlying admission.Attributes - if v.versionedAttr != nil && v.versionedAttr.VersionedObject != nil && v.versionedAttr.Dirty { - return o.GetObjectConvertor().Convert(v.versionedAttr.VersionedObject, v.versionedAttr.Attributes.GetObject(), nil) + if v.versionedAttr != nil && v.versionedAttr.VersionedObject.Object() != nil && v.versionedAttr.Dirty { + return o.GetObjectConvertor().Convert(v.versionedAttr.VersionedObject.Object(), v.versionedAttr.Attributes.GetObject(), nil) } return nil @@ -343,7 +343,7 @@ func (a *mutatingDispatcher) callAttrMutatingHook(ctx context.Context, h *admiss } // if a non-empty patch was provided, and we have no object we can apply it to (e.g. a DELETE admission operation), error - if attr.VersionedObject == nil { + if attr.VersionedObject.Object() == nil { return false, apierrors.NewInternalError(fmt.Errorf("admission webhook %q attempted to modify the object, which is not supported for this operation", h.Name)) } @@ -352,7 +352,7 @@ func (a *mutatingDispatcher) callAttrMutatingHook(ctx context.Context, h *admiss switch result.PatchType { // VerifyAdmissionResponse normalizes to v1 patch types, regardless of the AdmissionReview version used case admissionv1.PatchTypeJSONPatch: - objJS, err := runtime.Encode(jsonSerializer, attr.VersionedObject) + objJS, err := runtime.Encode(jsonSerializer, attr.VersionedObject.Object()) if err != nil { return false, apierrors.NewInternalError(err) } @@ -365,7 +365,7 @@ func (a *mutatingDispatcher) callAttrMutatingHook(ctx context.Context, h *admiss } var newVersionedObject runtime.Object - if _, ok := attr.VersionedObject.(*unstructured.Unstructured); ok { + if _, ok := attr.VersionedObject.Object().(*unstructured.Unstructured); ok { // Custom Resources don't have corresponding Go struct's. // They are represented as Unstructured. newVersionedObject = &unstructured.Unstructured{} @@ -382,12 +382,11 @@ func (a *mutatingDispatcher) callAttrMutatingHook(ctx context.Context, h *admiss return false, apierrors.NewInternalError(err) } - changed = !apiequality.Semantic.DeepEqual(attr.VersionedObject, newVersionedObject) + changed = !apiequality.Semantic.DeepEqual(attr.VersionedObject.Object(), newVersionedObject) span.AddEvent("Patch applied") annotator.addPatchAnnotation(patchObj, result.PatchType) - attr.Dirty = true - attr.VersionedObject = newVersionedObject - o.GetObjectDefaulter().Default(attr.VersionedObject) + attr.UpdateObject(newVersionedObject) + o.GetObjectDefaulter().Default(attr.VersionedObject.Object()) return changed, nil } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/request/admissionreview.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/request/admissionreview.go index 91b070a3e7..a0276b93d8 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/request/admissionreview.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/request/admissionreview.go @@ -204,10 +204,10 @@ func CreateV1AdmissionReview(uid types.UID, versionedAttributes *admission.Versi Operation: admissionv1.Operation(attr.GetOperation()), UserInfo: userInfo, Object: runtime.RawExtension{ - Object: versionedAttributes.VersionedObject, + Object: versionedAttributes.VersionedObject.Object(), }, OldObject: runtime.RawExtension{ - Object: versionedAttributes.VersionedOldObject, + Object: versionedAttributes.VersionedOldObject.Object(), }, DryRun: &dryRun, Options: runtime.RawExtension{ @@ -270,10 +270,10 @@ func CreateV1beta1AdmissionReview(uid types.UID, versionedAttributes *admission. Operation: admissionv1beta1.Operation(attr.GetOperation()), UserInfo: userInfo, Object: runtime.RawExtension{ - Object: versionedAttributes.VersionedObject, + Object: versionedAttributes.VersionedObject.Object(), }, OldObject: runtime.RawExtension{ - Object: versionedAttributes.VersionedOldObject, + Object: versionedAttributes.VersionedOldObject.Object(), }, DryRun: &dryRun, Options: runtime.RawExtension{ diff --git a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1/types.go b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1/types.go index ecfe482629..317d215347 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1/types.go +++ b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1/types.go @@ -26,7 +26,7 @@ import ( // AdmissionConfiguration provides versioned configuration for admission controllers. type AdmissionConfiguration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Plugins allows specifying a configuration per admission control plugin. // +optional @@ -54,7 +54,7 @@ type AdmissionPluginConfiguration struct { // AuthenticationConfiguration provides versioned configuration for authentication. type AuthenticationConfiguration struct { - metav1.TypeMeta + metav1.TypeMeta `json:""` // jwt is a list of authenticator to authenticate Kubernetes users using // JWT compliant tokens. The authenticator will attempt to parse a raw ID token, @@ -419,7 +419,7 @@ type UserValidationRule struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type AuthorizationConfiguration struct { - metav1.TypeMeta + metav1.TypeMeta `json:""` // Authorizers is an ordered list of authorizers to // authorize requests against. @@ -558,8 +558,8 @@ type WebhookMatchCondition struct { // TracingConfiguration provides versioned configuration for tracing clients. type TracingConfiguration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Embed the component config tracing configuration struct - tracingapi.TracingConfiguration `json:",inline"` + tracingapi.TracingConfiguration `json:""` } diff --git a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1/zz_generated.conversion.go b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1/zz_generated.conversion.go index 325739c7c0..ff3c709fff 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1/zz_generated.conversion.go +++ b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1/zz_generated.conversion.go @@ -311,7 +311,7 @@ func RegisterConversions(s *runtime.Scheme) error { } func autoConvert_v1_AESConfiguration_To_apiserver_AESConfiguration(in *AESConfiguration, out *apiserver.AESConfiguration, s conversion.Scope) error { - out.Keys = *(*[]apiserver.Key)(unsafe.Pointer(&in.Keys)) + *out = *(*apiserver.AESConfiguration)(unsafe.Pointer(in)) return nil } @@ -321,7 +321,7 @@ func Convert_v1_AESConfiguration_To_apiserver_AESConfiguration(in *AESConfigurat } func autoConvert_apiserver_AESConfiguration_To_v1_AESConfiguration(in *apiserver.AESConfiguration, out *AESConfiguration, s conversion.Scope) error { - out.Keys = *(*[]Key)(unsafe.Pointer(&in.Keys)) + *out = *(*AESConfiguration)(unsafe.Pointer(in)) return nil } @@ -351,9 +351,7 @@ func Convert_apiserver_AdmissionConfiguration_To_v1_AdmissionConfiguration(in *a } func autoConvert_v1_AdmissionPluginConfiguration_To_apiserver_AdmissionPluginConfiguration(in *AdmissionPluginConfiguration, out *apiserver.AdmissionPluginConfiguration, s conversion.Scope) error { - out.Name = in.Name - out.Path = in.Path - out.Configuration = (*runtime.Unknown)(unsafe.Pointer(in.Configuration)) + *out = *(*apiserver.AdmissionPluginConfiguration)(unsafe.Pointer(in)) return nil } @@ -363,9 +361,7 @@ func Convert_v1_AdmissionPluginConfiguration_To_apiserver_AdmissionPluginConfigu } func autoConvert_apiserver_AdmissionPluginConfiguration_To_v1_AdmissionPluginConfiguration(in *apiserver.AdmissionPluginConfiguration, out *AdmissionPluginConfiguration, s conversion.Scope) error { - out.Name = in.Name - out.Path = in.Path - out.Configuration = (*runtime.Unknown)(unsafe.Pointer(in.Configuration)) + *out = *(*AdmissionPluginConfiguration)(unsafe.Pointer(in)) return nil } @@ -375,7 +371,7 @@ func Convert_apiserver_AdmissionPluginConfiguration_To_v1_AdmissionPluginConfigu } func autoConvert_v1_AnonymousAuthCondition_To_apiserver_AnonymousAuthCondition(in *AnonymousAuthCondition, out *apiserver.AnonymousAuthCondition, s conversion.Scope) error { - out.Path = in.Path + *out = *(*apiserver.AnonymousAuthCondition)(unsafe.Pointer(in)) return nil } @@ -385,7 +381,7 @@ func Convert_v1_AnonymousAuthCondition_To_apiserver_AnonymousAuthCondition(in *A } func autoConvert_apiserver_AnonymousAuthCondition_To_v1_AnonymousAuthCondition(in *apiserver.AnonymousAuthCondition, out *AnonymousAuthCondition, s conversion.Scope) error { - out.Path = in.Path + *out = *(*AnonymousAuthCondition)(unsafe.Pointer(in)) return nil } @@ -395,8 +391,7 @@ func Convert_apiserver_AnonymousAuthCondition_To_v1_AnonymousAuthCondition(in *a } func autoConvert_v1_AnonymousAuthConfig_To_apiserver_AnonymousAuthConfig(in *AnonymousAuthConfig, out *apiserver.AnonymousAuthConfig, s conversion.Scope) error { - out.Enabled = in.Enabled - out.Conditions = *(*[]apiserver.AnonymousAuthCondition)(unsafe.Pointer(&in.Conditions)) + *out = *(*apiserver.AnonymousAuthConfig)(unsafe.Pointer(in)) return nil } @@ -406,8 +401,7 @@ func Convert_v1_AnonymousAuthConfig_To_apiserver_AnonymousAuthConfig(in *Anonymo } func autoConvert_apiserver_AnonymousAuthConfig_To_v1_AnonymousAuthConfig(in *apiserver.AnonymousAuthConfig, out *AnonymousAuthConfig, s conversion.Scope) error { - out.Enabled = in.Enabled - out.Conditions = *(*[]AnonymousAuthCondition)(unsafe.Pointer(&in.Conditions)) + *out = *(*AnonymousAuthConfig)(unsafe.Pointer(in)) return nil } @@ -539,16 +533,7 @@ func Convert_apiserver_AuthorizerConfiguration_To_v1_AuthorizerConfiguration(in } func autoConvert_v1_ClaimMappings_To_apiserver_ClaimMappings(in *ClaimMappings, out *apiserver.ClaimMappings, s conversion.Scope) error { - if err := Convert_v1_PrefixedClaimOrExpression_To_apiserver_PrefixedClaimOrExpression(&in.Username, &out.Username, s); err != nil { - return err - } - if err := Convert_v1_PrefixedClaimOrExpression_To_apiserver_PrefixedClaimOrExpression(&in.Groups, &out.Groups, s); err != nil { - return err - } - if err := Convert_v1_ClaimOrExpression_To_apiserver_ClaimOrExpression(&in.UID, &out.UID, s); err != nil { - return err - } - out.Extra = *(*[]apiserver.ExtraMapping)(unsafe.Pointer(&in.Extra)) + *out = *(*apiserver.ClaimMappings)(unsafe.Pointer(in)) return nil } @@ -558,16 +543,7 @@ func Convert_v1_ClaimMappings_To_apiserver_ClaimMappings(in *ClaimMappings, out } func autoConvert_apiserver_ClaimMappings_To_v1_ClaimMappings(in *apiserver.ClaimMappings, out *ClaimMappings, s conversion.Scope) error { - if err := Convert_apiserver_PrefixedClaimOrExpression_To_v1_PrefixedClaimOrExpression(&in.Username, &out.Username, s); err != nil { - return err - } - if err := Convert_apiserver_PrefixedClaimOrExpression_To_v1_PrefixedClaimOrExpression(&in.Groups, &out.Groups, s); err != nil { - return err - } - if err := Convert_apiserver_ClaimOrExpression_To_v1_ClaimOrExpression(&in.UID, &out.UID, s); err != nil { - return err - } - out.Extra = *(*[]ExtraMapping)(unsafe.Pointer(&in.Extra)) + *out = *(*ClaimMappings)(unsafe.Pointer(in)) return nil } @@ -577,8 +553,7 @@ func Convert_apiserver_ClaimMappings_To_v1_ClaimMappings(in *apiserver.ClaimMapp } func autoConvert_v1_ClaimOrExpression_To_apiserver_ClaimOrExpression(in *ClaimOrExpression, out *apiserver.ClaimOrExpression, s conversion.Scope) error { - out.Claim = in.Claim - out.Expression = in.Expression + *out = *(*apiserver.ClaimOrExpression)(unsafe.Pointer(in)) return nil } @@ -588,8 +563,7 @@ func Convert_v1_ClaimOrExpression_To_apiserver_ClaimOrExpression(in *ClaimOrExpr } func autoConvert_apiserver_ClaimOrExpression_To_v1_ClaimOrExpression(in *apiserver.ClaimOrExpression, out *ClaimOrExpression, s conversion.Scope) error { - out.Claim = in.Claim - out.Expression = in.Expression + *out = *(*ClaimOrExpression)(unsafe.Pointer(in)) return nil } @@ -599,10 +573,7 @@ func Convert_apiserver_ClaimOrExpression_To_v1_ClaimOrExpression(in *apiserver.C } func autoConvert_v1_ClaimValidationRule_To_apiserver_ClaimValidationRule(in *ClaimValidationRule, out *apiserver.ClaimValidationRule, s conversion.Scope) error { - out.Claim = in.Claim - out.RequiredValue = in.RequiredValue - out.Expression = in.Expression - out.Message = in.Message + *out = *(*apiserver.ClaimValidationRule)(unsafe.Pointer(in)) return nil } @@ -612,10 +583,7 @@ func Convert_v1_ClaimValidationRule_To_apiserver_ClaimValidationRule(in *ClaimVa } func autoConvert_apiserver_ClaimValidationRule_To_v1_ClaimValidationRule(in *apiserver.ClaimValidationRule, out *ClaimValidationRule, s conversion.Scope) error { - out.Claim = in.Claim - out.RequiredValue = in.RequiredValue - out.Expression = in.Expression - out.Message = in.Message + *out = *(*ClaimValidationRule)(unsafe.Pointer(in)) return nil } @@ -645,8 +613,7 @@ func Convert_apiserver_EncryptionConfiguration_To_v1_EncryptionConfiguration(in } func autoConvert_v1_ExtraMapping_To_apiserver_ExtraMapping(in *ExtraMapping, out *apiserver.ExtraMapping, s conversion.Scope) error { - out.Key = in.Key - out.ValueExpression = in.ValueExpression + *out = *(*apiserver.ExtraMapping)(unsafe.Pointer(in)) return nil } @@ -656,8 +623,7 @@ func Convert_v1_ExtraMapping_To_apiserver_ExtraMapping(in *ExtraMapping, out *ap } func autoConvert_apiserver_ExtraMapping_To_v1_ExtraMapping(in *apiserver.ExtraMapping, out *ExtraMapping, s conversion.Scope) error { - out.Key = in.Key - out.ValueExpression = in.ValueExpression + *out = *(*ExtraMapping)(unsafe.Pointer(in)) return nil } @@ -667,6 +633,7 @@ func Convert_apiserver_ExtraMapping_To_v1_ExtraMapping(in *apiserver.ExtraMappin } func autoConvert_v1_IdentityConfiguration_To_apiserver_IdentityConfiguration(in *IdentityConfiguration, out *apiserver.IdentityConfiguration, s conversion.Scope) error { + *out = *(*apiserver.IdentityConfiguration)(unsafe.Pointer(in)) return nil } @@ -676,6 +643,7 @@ func Convert_v1_IdentityConfiguration_To_apiserver_IdentityConfiguration(in *Ide } func autoConvert_apiserver_IdentityConfiguration_To_v1_IdentityConfiguration(in *apiserver.IdentityConfiguration, out *IdentityConfiguration, s conversion.Scope) error { + *out = *(*IdentityConfiguration)(unsafe.Pointer(in)) return nil } @@ -753,11 +721,7 @@ func Convert_apiserver_JWTAuthenticator_To_v1_JWTAuthenticator(in *apiserver.JWT } func autoConvert_v1_KMSConfiguration_To_apiserver_KMSConfiguration(in *KMSConfiguration, out *apiserver.KMSConfiguration, s conversion.Scope) error { - out.APIVersion = in.APIVersion - out.Name = in.Name - out.CacheSize = (*int32)(unsafe.Pointer(in.CacheSize)) - out.Endpoint = in.Endpoint - out.Timeout = (*metav1.Duration)(unsafe.Pointer(in.Timeout)) + *out = *(*apiserver.KMSConfiguration)(unsafe.Pointer(in)) return nil } @@ -767,11 +731,7 @@ func Convert_v1_KMSConfiguration_To_apiserver_KMSConfiguration(in *KMSConfigurat } func autoConvert_apiserver_KMSConfiguration_To_v1_KMSConfiguration(in *apiserver.KMSConfiguration, out *KMSConfiguration, s conversion.Scope) error { - out.APIVersion = in.APIVersion - out.Name = in.Name - out.CacheSize = (*int32)(unsafe.Pointer(in.CacheSize)) - out.Endpoint = in.Endpoint - out.Timeout = (*metav1.Duration)(unsafe.Pointer(in.Timeout)) + *out = *(*KMSConfiguration)(unsafe.Pointer(in)) return nil } @@ -781,8 +741,7 @@ func Convert_apiserver_KMSConfiguration_To_v1_KMSConfiguration(in *apiserver.KMS } func autoConvert_v1_Key_To_apiserver_Key(in *Key, out *apiserver.Key, s conversion.Scope) error { - out.Name = in.Name - out.Secret = in.Secret + *out = *(*apiserver.Key)(unsafe.Pointer(in)) return nil } @@ -792,8 +751,7 @@ func Convert_v1_Key_To_apiserver_Key(in *Key, out *apiserver.Key, s conversion.S } func autoConvert_apiserver_Key_To_v1_Key(in *apiserver.Key, out *Key, s conversion.Scope) error { - out.Name = in.Name - out.Secret = in.Secret + *out = *(*Key)(unsafe.Pointer(in)) return nil } @@ -803,9 +761,7 @@ func Convert_apiserver_Key_To_v1_Key(in *apiserver.Key, out *Key, s conversion.S } func autoConvert_v1_PrefixedClaimOrExpression_To_apiserver_PrefixedClaimOrExpression(in *PrefixedClaimOrExpression, out *apiserver.PrefixedClaimOrExpression, s conversion.Scope) error { - out.Claim = in.Claim - out.Prefix = (*string)(unsafe.Pointer(in.Prefix)) - out.Expression = in.Expression + *out = *(*apiserver.PrefixedClaimOrExpression)(unsafe.Pointer(in)) return nil } @@ -815,9 +771,7 @@ func Convert_v1_PrefixedClaimOrExpression_To_apiserver_PrefixedClaimOrExpression } func autoConvert_apiserver_PrefixedClaimOrExpression_To_v1_PrefixedClaimOrExpression(in *apiserver.PrefixedClaimOrExpression, out *PrefixedClaimOrExpression, s conversion.Scope) error { - out.Claim = in.Claim - out.Prefix = (*string)(unsafe.Pointer(in.Prefix)) - out.Expression = in.Expression + *out = *(*PrefixedClaimOrExpression)(unsafe.Pointer(in)) return nil } @@ -827,11 +781,7 @@ func Convert_apiserver_PrefixedClaimOrExpression_To_v1_PrefixedClaimOrExpression } func autoConvert_v1_ProviderConfiguration_To_apiserver_ProviderConfiguration(in *ProviderConfiguration, out *apiserver.ProviderConfiguration, s conversion.Scope) error { - out.AESGCM = (*apiserver.AESConfiguration)(unsafe.Pointer(in.AESGCM)) - out.AESCBC = (*apiserver.AESConfiguration)(unsafe.Pointer(in.AESCBC)) - out.Secretbox = (*apiserver.SecretboxConfiguration)(unsafe.Pointer(in.Secretbox)) - out.Identity = (*apiserver.IdentityConfiguration)(unsafe.Pointer(in.Identity)) - out.KMS = (*apiserver.KMSConfiguration)(unsafe.Pointer(in.KMS)) + *out = *(*apiserver.ProviderConfiguration)(unsafe.Pointer(in)) return nil } @@ -841,11 +791,7 @@ func Convert_v1_ProviderConfiguration_To_apiserver_ProviderConfiguration(in *Pro } func autoConvert_apiserver_ProviderConfiguration_To_v1_ProviderConfiguration(in *apiserver.ProviderConfiguration, out *ProviderConfiguration, s conversion.Scope) error { - out.AESGCM = (*AESConfiguration)(unsafe.Pointer(in.AESGCM)) - out.AESCBC = (*AESConfiguration)(unsafe.Pointer(in.AESCBC)) - out.Secretbox = (*SecretboxConfiguration)(unsafe.Pointer(in.Secretbox)) - out.Identity = (*IdentityConfiguration)(unsafe.Pointer(in.Identity)) - out.KMS = (*KMSConfiguration)(unsafe.Pointer(in.KMS)) + *out = *(*ProviderConfiguration)(unsafe.Pointer(in)) return nil } @@ -855,8 +801,7 @@ func Convert_apiserver_ProviderConfiguration_To_v1_ProviderConfiguration(in *api } func autoConvert_v1_ResourceConfiguration_To_apiserver_ResourceConfiguration(in *ResourceConfiguration, out *apiserver.ResourceConfiguration, s conversion.Scope) error { - out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources)) - out.Providers = *(*[]apiserver.ProviderConfiguration)(unsafe.Pointer(&in.Providers)) + *out = *(*apiserver.ResourceConfiguration)(unsafe.Pointer(in)) return nil } @@ -866,8 +811,7 @@ func Convert_v1_ResourceConfiguration_To_apiserver_ResourceConfiguration(in *Res } func autoConvert_apiserver_ResourceConfiguration_To_v1_ResourceConfiguration(in *apiserver.ResourceConfiguration, out *ResourceConfiguration, s conversion.Scope) error { - out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources)) - out.Providers = *(*[]ProviderConfiguration)(unsafe.Pointer(&in.Providers)) + *out = *(*ResourceConfiguration)(unsafe.Pointer(in)) return nil } @@ -877,7 +821,7 @@ func Convert_apiserver_ResourceConfiguration_To_v1_ResourceConfiguration(in *api } func autoConvert_v1_SecretboxConfiguration_To_apiserver_SecretboxConfiguration(in *SecretboxConfiguration, out *apiserver.SecretboxConfiguration, s conversion.Scope) error { - out.Keys = *(*[]apiserver.Key)(unsafe.Pointer(&in.Keys)) + *out = *(*apiserver.SecretboxConfiguration)(unsafe.Pointer(in)) return nil } @@ -887,7 +831,7 @@ func Convert_v1_SecretboxConfiguration_To_apiserver_SecretboxConfiguration(in *S } func autoConvert_apiserver_SecretboxConfiguration_To_v1_SecretboxConfiguration(in *apiserver.SecretboxConfiguration, out *SecretboxConfiguration, s conversion.Scope) error { - out.Keys = *(*[]Key)(unsafe.Pointer(&in.Keys)) + *out = *(*SecretboxConfiguration)(unsafe.Pointer(in)) return nil } @@ -917,8 +861,7 @@ func Convert_apiserver_TracingConfiguration_To_v1_TracingConfiguration(in *apise } func autoConvert_v1_UserValidationRule_To_apiserver_UserValidationRule(in *UserValidationRule, out *apiserver.UserValidationRule, s conversion.Scope) error { - out.Expression = in.Expression - out.Message = in.Message + *out = *(*apiserver.UserValidationRule)(unsafe.Pointer(in)) return nil } @@ -928,8 +871,7 @@ func Convert_v1_UserValidationRule_To_apiserver_UserValidationRule(in *UserValid } func autoConvert_apiserver_UserValidationRule_To_v1_UserValidationRule(in *apiserver.UserValidationRule, out *UserValidationRule, s conversion.Scope) error { - out.Expression = in.Expression - out.Message = in.Message + *out = *(*UserValidationRule)(unsafe.Pointer(in)) return nil } @@ -989,8 +931,7 @@ func Convert_apiserver_WebhookConfiguration_To_v1_WebhookConfiguration(in *apise } func autoConvert_v1_WebhookConnectionInfo_To_apiserver_WebhookConnectionInfo(in *WebhookConnectionInfo, out *apiserver.WebhookConnectionInfo, s conversion.Scope) error { - out.Type = in.Type - out.KubeConfigFile = (*string)(unsafe.Pointer(in.KubeConfigFile)) + *out = *(*apiserver.WebhookConnectionInfo)(unsafe.Pointer(in)) return nil } @@ -1000,8 +941,7 @@ func Convert_v1_WebhookConnectionInfo_To_apiserver_WebhookConnectionInfo(in *Web } func autoConvert_apiserver_WebhookConnectionInfo_To_v1_WebhookConnectionInfo(in *apiserver.WebhookConnectionInfo, out *WebhookConnectionInfo, s conversion.Scope) error { - out.Type = in.Type - out.KubeConfigFile = (*string)(unsafe.Pointer(in.KubeConfigFile)) + *out = *(*WebhookConnectionInfo)(unsafe.Pointer(in)) return nil } @@ -1011,7 +951,7 @@ func Convert_apiserver_WebhookConnectionInfo_To_v1_WebhookConnectionInfo(in *api } func autoConvert_v1_WebhookMatchCondition_To_apiserver_WebhookMatchCondition(in *WebhookMatchCondition, out *apiserver.WebhookMatchCondition, s conversion.Scope) error { - out.Expression = in.Expression + *out = *(*apiserver.WebhookMatchCondition)(unsafe.Pointer(in)) return nil } @@ -1021,7 +961,7 @@ func Convert_v1_WebhookMatchCondition_To_apiserver_WebhookMatchCondition(in *Web } func autoConvert_apiserver_WebhookMatchCondition_To_v1_WebhookMatchCondition(in *apiserver.WebhookMatchCondition, out *WebhookMatchCondition, s conversion.Scope) error { - out.Expression = in.Expression + *out = *(*WebhookMatchCondition)(unsafe.Pointer(in)) return nil } diff --git a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/types.go b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/types.go index 1e20c697b5..e42a86bc92 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/types.go +++ b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/types.go @@ -26,7 +26,7 @@ import ( // AdmissionConfiguration provides versioned configuration for admission controllers. type AdmissionConfiguration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Plugins allows specifying a configuration per admission control plugin. // +optional @@ -54,7 +54,7 @@ type AdmissionPluginConfiguration struct { // EgressSelectorConfiguration provides versioned configuration for egress selector clients. type EgressSelectorConfiguration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // connectionServices contains a list of egress selection client configurations EgressSelections []EgressSelection `json:"egressSelections"` @@ -157,17 +157,17 @@ type TLSConfig struct { // TracingConfiguration provides versioned configuration for tracing clients. type TracingConfiguration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Embed the component config tracing configuration struct - tracingapi.TracingConfiguration `json:",inline"` + tracingapi.TracingConfiguration `json:""` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // AuthenticationConfiguration provides versioned configuration for authentication. type AuthenticationConfiguration struct { - metav1.TypeMeta + metav1.TypeMeta `json:""` // jwt is a list of authenticator to authenticate Kubernetes users using // JWT compliant tokens. The authenticator will attempt to parse a raw ID token, @@ -532,7 +532,7 @@ type UserValidationRule struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type AuthorizationConfiguration struct { - metav1.TypeMeta + metav1.TypeMeta `json:""` // Authorizers is an ordered list of authorizers to // authorize requests against. diff --git a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/zz_generated.conversion.go b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/zz_generated.conversion.go index 4ea0297895..e310e250bb 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/zz_generated.conversion.go +++ b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/zz_generated.conversion.go @@ -321,9 +321,7 @@ func Convert_apiserver_AdmissionConfiguration_To_v1alpha1_AdmissionConfiguration } func autoConvert_v1alpha1_AdmissionPluginConfiguration_To_apiserver_AdmissionPluginConfiguration(in *AdmissionPluginConfiguration, out *apiserver.AdmissionPluginConfiguration, s conversion.Scope) error { - out.Name = in.Name - out.Path = in.Path - out.Configuration = (*runtime.Unknown)(unsafe.Pointer(in.Configuration)) + *out = *(*apiserver.AdmissionPluginConfiguration)(unsafe.Pointer(in)) return nil } @@ -333,9 +331,7 @@ func Convert_v1alpha1_AdmissionPluginConfiguration_To_apiserver_AdmissionPluginC } func autoConvert_apiserver_AdmissionPluginConfiguration_To_v1alpha1_AdmissionPluginConfiguration(in *apiserver.AdmissionPluginConfiguration, out *AdmissionPluginConfiguration, s conversion.Scope) error { - out.Name = in.Name - out.Path = in.Path - out.Configuration = (*runtime.Unknown)(unsafe.Pointer(in.Configuration)) + *out = *(*AdmissionPluginConfiguration)(unsafe.Pointer(in)) return nil } @@ -345,7 +341,7 @@ func Convert_apiserver_AdmissionPluginConfiguration_To_v1alpha1_AdmissionPluginC } func autoConvert_v1alpha1_AnonymousAuthCondition_To_apiserver_AnonymousAuthCondition(in *AnonymousAuthCondition, out *apiserver.AnonymousAuthCondition, s conversion.Scope) error { - out.Path = in.Path + *out = *(*apiserver.AnonymousAuthCondition)(unsafe.Pointer(in)) return nil } @@ -355,7 +351,7 @@ func Convert_v1alpha1_AnonymousAuthCondition_To_apiserver_AnonymousAuthCondition } func autoConvert_apiserver_AnonymousAuthCondition_To_v1alpha1_AnonymousAuthCondition(in *apiserver.AnonymousAuthCondition, out *AnonymousAuthCondition, s conversion.Scope) error { - out.Path = in.Path + *out = *(*AnonymousAuthCondition)(unsafe.Pointer(in)) return nil } @@ -365,8 +361,7 @@ func Convert_apiserver_AnonymousAuthCondition_To_v1alpha1_AnonymousAuthCondition } func autoConvert_v1alpha1_AnonymousAuthConfig_To_apiserver_AnonymousAuthConfig(in *AnonymousAuthConfig, out *apiserver.AnonymousAuthConfig, s conversion.Scope) error { - out.Enabled = in.Enabled - out.Conditions = *(*[]apiserver.AnonymousAuthCondition)(unsafe.Pointer(&in.Conditions)) + *out = *(*apiserver.AnonymousAuthConfig)(unsafe.Pointer(in)) return nil } @@ -376,8 +371,7 @@ func Convert_v1alpha1_AnonymousAuthConfig_To_apiserver_AnonymousAuthConfig(in *A } func autoConvert_apiserver_AnonymousAuthConfig_To_v1alpha1_AnonymousAuthConfig(in *apiserver.AnonymousAuthConfig, out *AnonymousAuthConfig, s conversion.Scope) error { - out.Enabled = in.Enabled - out.Conditions = *(*[]AnonymousAuthCondition)(unsafe.Pointer(&in.Conditions)) + *out = *(*AnonymousAuthConfig)(unsafe.Pointer(in)) return nil } @@ -509,16 +503,7 @@ func Convert_apiserver_AuthorizerConfiguration_To_v1alpha1_AuthorizerConfigurati } func autoConvert_v1alpha1_ClaimMappings_To_apiserver_ClaimMappings(in *ClaimMappings, out *apiserver.ClaimMappings, s conversion.Scope) error { - if err := Convert_v1alpha1_PrefixedClaimOrExpression_To_apiserver_PrefixedClaimOrExpression(&in.Username, &out.Username, s); err != nil { - return err - } - if err := Convert_v1alpha1_PrefixedClaimOrExpression_To_apiserver_PrefixedClaimOrExpression(&in.Groups, &out.Groups, s); err != nil { - return err - } - if err := Convert_v1alpha1_ClaimOrExpression_To_apiserver_ClaimOrExpression(&in.UID, &out.UID, s); err != nil { - return err - } - out.Extra = *(*[]apiserver.ExtraMapping)(unsafe.Pointer(&in.Extra)) + *out = *(*apiserver.ClaimMappings)(unsafe.Pointer(in)) return nil } @@ -528,16 +513,7 @@ func Convert_v1alpha1_ClaimMappings_To_apiserver_ClaimMappings(in *ClaimMappings } func autoConvert_apiserver_ClaimMappings_To_v1alpha1_ClaimMappings(in *apiserver.ClaimMappings, out *ClaimMappings, s conversion.Scope) error { - if err := Convert_apiserver_PrefixedClaimOrExpression_To_v1alpha1_PrefixedClaimOrExpression(&in.Username, &out.Username, s); err != nil { - return err - } - if err := Convert_apiserver_PrefixedClaimOrExpression_To_v1alpha1_PrefixedClaimOrExpression(&in.Groups, &out.Groups, s); err != nil { - return err - } - if err := Convert_apiserver_ClaimOrExpression_To_v1alpha1_ClaimOrExpression(&in.UID, &out.UID, s); err != nil { - return err - } - out.Extra = *(*[]ExtraMapping)(unsafe.Pointer(&in.Extra)) + *out = *(*ClaimMappings)(unsafe.Pointer(in)) return nil } @@ -547,8 +523,7 @@ func Convert_apiserver_ClaimMappings_To_v1alpha1_ClaimMappings(in *apiserver.Cla } func autoConvert_v1alpha1_ClaimOrExpression_To_apiserver_ClaimOrExpression(in *ClaimOrExpression, out *apiserver.ClaimOrExpression, s conversion.Scope) error { - out.Claim = in.Claim - out.Expression = in.Expression + *out = *(*apiserver.ClaimOrExpression)(unsafe.Pointer(in)) return nil } @@ -558,8 +533,7 @@ func Convert_v1alpha1_ClaimOrExpression_To_apiserver_ClaimOrExpression(in *Claim } func autoConvert_apiserver_ClaimOrExpression_To_v1alpha1_ClaimOrExpression(in *apiserver.ClaimOrExpression, out *ClaimOrExpression, s conversion.Scope) error { - out.Claim = in.Claim - out.Expression = in.Expression + *out = *(*ClaimOrExpression)(unsafe.Pointer(in)) return nil } @@ -569,10 +543,7 @@ func Convert_apiserver_ClaimOrExpression_To_v1alpha1_ClaimOrExpression(in *apise } func autoConvert_v1alpha1_ClaimValidationRule_To_apiserver_ClaimValidationRule(in *ClaimValidationRule, out *apiserver.ClaimValidationRule, s conversion.Scope) error { - out.Claim = in.Claim - out.RequiredValue = in.RequiredValue - out.Expression = in.Expression - out.Message = in.Message + *out = *(*apiserver.ClaimValidationRule)(unsafe.Pointer(in)) return nil } @@ -582,10 +553,7 @@ func Convert_v1alpha1_ClaimValidationRule_To_apiserver_ClaimValidationRule(in *C } func autoConvert_apiserver_ClaimValidationRule_To_v1alpha1_ClaimValidationRule(in *apiserver.ClaimValidationRule, out *ClaimValidationRule, s conversion.Scope) error { - out.Claim = in.Claim - out.RequiredValue = in.RequiredValue - out.Expression = in.Expression - out.Message = in.Message + *out = *(*ClaimValidationRule)(unsafe.Pointer(in)) return nil } @@ -595,8 +563,7 @@ func Convert_apiserver_ClaimValidationRule_To_v1alpha1_ClaimValidationRule(in *a } func autoConvert_v1alpha1_Connection_To_apiserver_Connection(in *Connection, out *apiserver.Connection, s conversion.Scope) error { - out.ProxyProtocol = apiserver.ProtocolType(in.ProxyProtocol) - out.Transport = (*apiserver.Transport)(unsafe.Pointer(in.Transport)) + *out = *(*apiserver.Connection)(unsafe.Pointer(in)) return nil } @@ -606,8 +573,7 @@ func Convert_v1alpha1_Connection_To_apiserver_Connection(in *Connection, out *ap } func autoConvert_apiserver_Connection_To_v1alpha1_Connection(in *apiserver.Connection, out *Connection, s conversion.Scope) error { - out.ProxyProtocol = ProtocolType(in.ProxyProtocol) - out.Transport = (*Transport)(unsafe.Pointer(in.Transport)) + *out = *(*Connection)(unsafe.Pointer(in)) return nil } @@ -678,8 +644,7 @@ func Convert_apiserver_EgressSelectorConfiguration_To_v1alpha1_EgressSelectorCon } func autoConvert_v1alpha1_ExtraMapping_To_apiserver_ExtraMapping(in *ExtraMapping, out *apiserver.ExtraMapping, s conversion.Scope) error { - out.Key = in.Key - out.ValueExpression = in.ValueExpression + *out = *(*apiserver.ExtraMapping)(unsafe.Pointer(in)) return nil } @@ -689,8 +654,7 @@ func Convert_v1alpha1_ExtraMapping_To_apiserver_ExtraMapping(in *ExtraMapping, o } func autoConvert_apiserver_ExtraMapping_To_v1alpha1_ExtraMapping(in *apiserver.ExtraMapping, out *ExtraMapping, s conversion.Scope) error { - out.Key = in.Key - out.ValueExpression = in.ValueExpression + *out = *(*ExtraMapping)(unsafe.Pointer(in)) return nil } @@ -768,9 +732,7 @@ func Convert_apiserver_JWTAuthenticator_To_v1alpha1_JWTAuthenticator(in *apiserv } func autoConvert_v1alpha1_PrefixedClaimOrExpression_To_apiserver_PrefixedClaimOrExpression(in *PrefixedClaimOrExpression, out *apiserver.PrefixedClaimOrExpression, s conversion.Scope) error { - out.Claim = in.Claim - out.Prefix = (*string)(unsafe.Pointer(in.Prefix)) - out.Expression = in.Expression + *out = *(*apiserver.PrefixedClaimOrExpression)(unsafe.Pointer(in)) return nil } @@ -780,9 +742,7 @@ func Convert_v1alpha1_PrefixedClaimOrExpression_To_apiserver_PrefixedClaimOrExpr } func autoConvert_apiserver_PrefixedClaimOrExpression_To_v1alpha1_PrefixedClaimOrExpression(in *apiserver.PrefixedClaimOrExpression, out *PrefixedClaimOrExpression, s conversion.Scope) error { - out.Claim = in.Claim - out.Prefix = (*string)(unsafe.Pointer(in.Prefix)) - out.Expression = in.Expression + *out = *(*PrefixedClaimOrExpression)(unsafe.Pointer(in)) return nil } @@ -792,8 +752,7 @@ func Convert_apiserver_PrefixedClaimOrExpression_To_v1alpha1_PrefixedClaimOrExpr } func autoConvert_v1alpha1_TCPTransport_To_apiserver_TCPTransport(in *TCPTransport, out *apiserver.TCPTransport, s conversion.Scope) error { - out.URL = in.URL - out.TLSConfig = (*apiserver.TLSConfig)(unsafe.Pointer(in.TLSConfig)) + *out = *(*apiserver.TCPTransport)(unsafe.Pointer(in)) return nil } @@ -803,8 +762,7 @@ func Convert_v1alpha1_TCPTransport_To_apiserver_TCPTransport(in *TCPTransport, o } func autoConvert_apiserver_TCPTransport_To_v1alpha1_TCPTransport(in *apiserver.TCPTransport, out *TCPTransport, s conversion.Scope) error { - out.URL = in.URL - out.TLSConfig = (*TLSConfig)(unsafe.Pointer(in.TLSConfig)) + *out = *(*TCPTransport)(unsafe.Pointer(in)) return nil } @@ -814,10 +772,7 @@ func Convert_apiserver_TCPTransport_To_v1alpha1_TCPTransport(in *apiserver.TCPTr } func autoConvert_v1alpha1_TLSConfig_To_apiserver_TLSConfig(in *TLSConfig, out *apiserver.TLSConfig, s conversion.Scope) error { - out.CABundle = in.CABundle - out.ClientKey = in.ClientKey - out.ClientCert = in.ClientCert - out.TLSServerName = in.TLSServerName + *out = *(*apiserver.TLSConfig)(unsafe.Pointer(in)) return nil } @@ -827,10 +782,7 @@ func Convert_v1alpha1_TLSConfig_To_apiserver_TLSConfig(in *TLSConfig, out *apise } func autoConvert_apiserver_TLSConfig_To_v1alpha1_TLSConfig(in *apiserver.TLSConfig, out *TLSConfig, s conversion.Scope) error { - out.CABundle = in.CABundle - out.ClientKey = in.ClientKey - out.ClientCert = in.ClientCert - out.TLSServerName = in.TLSServerName + *out = *(*TLSConfig)(unsafe.Pointer(in)) return nil } @@ -860,8 +812,7 @@ func Convert_apiserver_TracingConfiguration_To_v1alpha1_TracingConfiguration(in } func autoConvert_v1alpha1_Transport_To_apiserver_Transport(in *Transport, out *apiserver.Transport, s conversion.Scope) error { - out.TCP = (*apiserver.TCPTransport)(unsafe.Pointer(in.TCP)) - out.UDS = (*apiserver.UDSTransport)(unsafe.Pointer(in.UDS)) + *out = *(*apiserver.Transport)(unsafe.Pointer(in)) return nil } @@ -871,8 +822,7 @@ func Convert_v1alpha1_Transport_To_apiserver_Transport(in *Transport, out *apise } func autoConvert_apiserver_Transport_To_v1alpha1_Transport(in *apiserver.Transport, out *Transport, s conversion.Scope) error { - out.TCP = (*TCPTransport)(unsafe.Pointer(in.TCP)) - out.UDS = (*UDSTransport)(unsafe.Pointer(in.UDS)) + *out = *(*Transport)(unsafe.Pointer(in)) return nil } @@ -882,7 +832,7 @@ func Convert_apiserver_Transport_To_v1alpha1_Transport(in *apiserver.Transport, } func autoConvert_v1alpha1_UDSTransport_To_apiserver_UDSTransport(in *UDSTransport, out *apiserver.UDSTransport, s conversion.Scope) error { - out.UDSName = in.UDSName + *out = *(*apiserver.UDSTransport)(unsafe.Pointer(in)) return nil } @@ -892,7 +842,7 @@ func Convert_v1alpha1_UDSTransport_To_apiserver_UDSTransport(in *UDSTransport, o } func autoConvert_apiserver_UDSTransport_To_v1alpha1_UDSTransport(in *apiserver.UDSTransport, out *UDSTransport, s conversion.Scope) error { - out.UDSName = in.UDSName + *out = *(*UDSTransport)(unsafe.Pointer(in)) return nil } @@ -902,8 +852,7 @@ func Convert_apiserver_UDSTransport_To_v1alpha1_UDSTransport(in *apiserver.UDSTr } func autoConvert_v1alpha1_UserValidationRule_To_apiserver_UserValidationRule(in *UserValidationRule, out *apiserver.UserValidationRule, s conversion.Scope) error { - out.Expression = in.Expression - out.Message = in.Message + *out = *(*apiserver.UserValidationRule)(unsafe.Pointer(in)) return nil } @@ -913,8 +862,7 @@ func Convert_v1alpha1_UserValidationRule_To_apiserver_UserValidationRule(in *Use } func autoConvert_apiserver_UserValidationRule_To_v1alpha1_UserValidationRule(in *apiserver.UserValidationRule, out *UserValidationRule, s conversion.Scope) error { - out.Expression = in.Expression - out.Message = in.Message + *out = *(*UserValidationRule)(unsafe.Pointer(in)) return nil } @@ -974,8 +922,7 @@ func Convert_apiserver_WebhookConfiguration_To_v1alpha1_WebhookConfiguration(in } func autoConvert_v1alpha1_WebhookConnectionInfo_To_apiserver_WebhookConnectionInfo(in *WebhookConnectionInfo, out *apiserver.WebhookConnectionInfo, s conversion.Scope) error { - out.Type = in.Type - out.KubeConfigFile = (*string)(unsafe.Pointer(in.KubeConfigFile)) + *out = *(*apiserver.WebhookConnectionInfo)(unsafe.Pointer(in)) return nil } @@ -985,8 +932,7 @@ func Convert_v1alpha1_WebhookConnectionInfo_To_apiserver_WebhookConnectionInfo(i } func autoConvert_apiserver_WebhookConnectionInfo_To_v1alpha1_WebhookConnectionInfo(in *apiserver.WebhookConnectionInfo, out *WebhookConnectionInfo, s conversion.Scope) error { - out.Type = in.Type - out.KubeConfigFile = (*string)(unsafe.Pointer(in.KubeConfigFile)) + *out = *(*WebhookConnectionInfo)(unsafe.Pointer(in)) return nil } @@ -996,7 +942,7 @@ func Convert_apiserver_WebhookConnectionInfo_To_v1alpha1_WebhookConnectionInfo(i } func autoConvert_v1alpha1_WebhookMatchCondition_To_apiserver_WebhookMatchCondition(in *WebhookMatchCondition, out *apiserver.WebhookMatchCondition, s conversion.Scope) error { - out.Expression = in.Expression + *out = *(*apiserver.WebhookMatchCondition)(unsafe.Pointer(in)) return nil } @@ -1006,7 +952,7 @@ func Convert_v1alpha1_WebhookMatchCondition_To_apiserver_WebhookMatchCondition(i } func autoConvert_apiserver_WebhookMatchCondition_To_v1alpha1_WebhookMatchCondition(in *apiserver.WebhookMatchCondition, out *WebhookMatchCondition, s conversion.Scope) error { - out.Expression = in.Expression + *out = *(*WebhookMatchCondition)(unsafe.Pointer(in)) return nil } diff --git a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1beta1/types.go b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1beta1/types.go index 44bfbbd3c1..6d154d8c3b 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1beta1/types.go +++ b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1beta1/types.go @@ -25,7 +25,7 @@ import ( // EgressSelectorConfiguration provides versioned configuration for egress selector clients. type EgressSelectorConfiguration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // connectionServices contains a list of egress selection client configurations EgressSelections []EgressSelection `json:"egressSelections"` @@ -128,17 +128,17 @@ type TLSConfig struct { // TracingConfiguration provides versioned configuration for tracing clients. type TracingConfiguration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Embed the component config tracing configuration struct - tracingapi.TracingConfiguration `json:",inline"` + tracingapi.TracingConfiguration `json:""` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // AuthenticationConfiguration provides versioned configuration for authentication. type AuthenticationConfiguration struct { - metav1.TypeMeta + metav1.TypeMeta `json:""` // jwt is a list of authenticator to authenticate Kubernetes users using // JWT compliant tokens. The authenticator will attempt to parse a raw ID token, @@ -503,7 +503,7 @@ type UserValidationRule struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type AuthorizationConfiguration struct { - metav1.TypeMeta + metav1.TypeMeta `json:""` // Authorizers is an ordered list of authorizers to // authorize requests against. diff --git a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1beta1/zz_generated.conversion.go b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1beta1/zz_generated.conversion.go index 04323e2082..373285734b 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1beta1/zz_generated.conversion.go +++ b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1beta1/zz_generated.conversion.go @@ -281,7 +281,7 @@ func RegisterConversions(s *runtime.Scheme) error { } func autoConvert_v1beta1_AnonymousAuthCondition_To_apiserver_AnonymousAuthCondition(in *AnonymousAuthCondition, out *apiserver.AnonymousAuthCondition, s conversion.Scope) error { - out.Path = in.Path + *out = *(*apiserver.AnonymousAuthCondition)(unsafe.Pointer(in)) return nil } @@ -291,7 +291,7 @@ func Convert_v1beta1_AnonymousAuthCondition_To_apiserver_AnonymousAuthCondition( } func autoConvert_apiserver_AnonymousAuthCondition_To_v1beta1_AnonymousAuthCondition(in *apiserver.AnonymousAuthCondition, out *AnonymousAuthCondition, s conversion.Scope) error { - out.Path = in.Path + *out = *(*AnonymousAuthCondition)(unsafe.Pointer(in)) return nil } @@ -301,8 +301,7 @@ func Convert_apiserver_AnonymousAuthCondition_To_v1beta1_AnonymousAuthCondition( } func autoConvert_v1beta1_AnonymousAuthConfig_To_apiserver_AnonymousAuthConfig(in *AnonymousAuthConfig, out *apiserver.AnonymousAuthConfig, s conversion.Scope) error { - out.Enabled = in.Enabled - out.Conditions = *(*[]apiserver.AnonymousAuthCondition)(unsafe.Pointer(&in.Conditions)) + *out = *(*apiserver.AnonymousAuthConfig)(unsafe.Pointer(in)) return nil } @@ -312,8 +311,7 @@ func Convert_v1beta1_AnonymousAuthConfig_To_apiserver_AnonymousAuthConfig(in *An } func autoConvert_apiserver_AnonymousAuthConfig_To_v1beta1_AnonymousAuthConfig(in *apiserver.AnonymousAuthConfig, out *AnonymousAuthConfig, s conversion.Scope) error { - out.Enabled = in.Enabled - out.Conditions = *(*[]AnonymousAuthCondition)(unsafe.Pointer(&in.Conditions)) + *out = *(*AnonymousAuthConfig)(unsafe.Pointer(in)) return nil } @@ -445,16 +443,7 @@ func Convert_apiserver_AuthorizerConfiguration_To_v1beta1_AuthorizerConfiguratio } func autoConvert_v1beta1_ClaimMappings_To_apiserver_ClaimMappings(in *ClaimMappings, out *apiserver.ClaimMappings, s conversion.Scope) error { - if err := Convert_v1beta1_PrefixedClaimOrExpression_To_apiserver_PrefixedClaimOrExpression(&in.Username, &out.Username, s); err != nil { - return err - } - if err := Convert_v1beta1_PrefixedClaimOrExpression_To_apiserver_PrefixedClaimOrExpression(&in.Groups, &out.Groups, s); err != nil { - return err - } - if err := Convert_v1beta1_ClaimOrExpression_To_apiserver_ClaimOrExpression(&in.UID, &out.UID, s); err != nil { - return err - } - out.Extra = *(*[]apiserver.ExtraMapping)(unsafe.Pointer(&in.Extra)) + *out = *(*apiserver.ClaimMappings)(unsafe.Pointer(in)) return nil } @@ -464,16 +453,7 @@ func Convert_v1beta1_ClaimMappings_To_apiserver_ClaimMappings(in *ClaimMappings, } func autoConvert_apiserver_ClaimMappings_To_v1beta1_ClaimMappings(in *apiserver.ClaimMappings, out *ClaimMappings, s conversion.Scope) error { - if err := Convert_apiserver_PrefixedClaimOrExpression_To_v1beta1_PrefixedClaimOrExpression(&in.Username, &out.Username, s); err != nil { - return err - } - if err := Convert_apiserver_PrefixedClaimOrExpression_To_v1beta1_PrefixedClaimOrExpression(&in.Groups, &out.Groups, s); err != nil { - return err - } - if err := Convert_apiserver_ClaimOrExpression_To_v1beta1_ClaimOrExpression(&in.UID, &out.UID, s); err != nil { - return err - } - out.Extra = *(*[]ExtraMapping)(unsafe.Pointer(&in.Extra)) + *out = *(*ClaimMappings)(unsafe.Pointer(in)) return nil } @@ -483,8 +463,7 @@ func Convert_apiserver_ClaimMappings_To_v1beta1_ClaimMappings(in *apiserver.Clai } func autoConvert_v1beta1_ClaimOrExpression_To_apiserver_ClaimOrExpression(in *ClaimOrExpression, out *apiserver.ClaimOrExpression, s conversion.Scope) error { - out.Claim = in.Claim - out.Expression = in.Expression + *out = *(*apiserver.ClaimOrExpression)(unsafe.Pointer(in)) return nil } @@ -494,8 +473,7 @@ func Convert_v1beta1_ClaimOrExpression_To_apiserver_ClaimOrExpression(in *ClaimO } func autoConvert_apiserver_ClaimOrExpression_To_v1beta1_ClaimOrExpression(in *apiserver.ClaimOrExpression, out *ClaimOrExpression, s conversion.Scope) error { - out.Claim = in.Claim - out.Expression = in.Expression + *out = *(*ClaimOrExpression)(unsafe.Pointer(in)) return nil } @@ -505,10 +483,7 @@ func Convert_apiserver_ClaimOrExpression_To_v1beta1_ClaimOrExpression(in *apiser } func autoConvert_v1beta1_ClaimValidationRule_To_apiserver_ClaimValidationRule(in *ClaimValidationRule, out *apiserver.ClaimValidationRule, s conversion.Scope) error { - out.Claim = in.Claim - out.RequiredValue = in.RequiredValue - out.Expression = in.Expression - out.Message = in.Message + *out = *(*apiserver.ClaimValidationRule)(unsafe.Pointer(in)) return nil } @@ -518,10 +493,7 @@ func Convert_v1beta1_ClaimValidationRule_To_apiserver_ClaimValidationRule(in *Cl } func autoConvert_apiserver_ClaimValidationRule_To_v1beta1_ClaimValidationRule(in *apiserver.ClaimValidationRule, out *ClaimValidationRule, s conversion.Scope) error { - out.Claim = in.Claim - out.RequiredValue = in.RequiredValue - out.Expression = in.Expression - out.Message = in.Message + *out = *(*ClaimValidationRule)(unsafe.Pointer(in)) return nil } @@ -531,8 +503,7 @@ func Convert_apiserver_ClaimValidationRule_To_v1beta1_ClaimValidationRule(in *ap } func autoConvert_v1beta1_Connection_To_apiserver_Connection(in *Connection, out *apiserver.Connection, s conversion.Scope) error { - out.ProxyProtocol = apiserver.ProtocolType(in.ProxyProtocol) - out.Transport = (*apiserver.Transport)(unsafe.Pointer(in.Transport)) + *out = *(*apiserver.Connection)(unsafe.Pointer(in)) return nil } @@ -542,8 +513,7 @@ func Convert_v1beta1_Connection_To_apiserver_Connection(in *Connection, out *api } func autoConvert_apiserver_Connection_To_v1beta1_Connection(in *apiserver.Connection, out *Connection, s conversion.Scope) error { - out.ProxyProtocol = ProtocolType(in.ProxyProtocol) - out.Transport = (*Transport)(unsafe.Pointer(in.Transport)) + *out = *(*Connection)(unsafe.Pointer(in)) return nil } @@ -614,8 +584,7 @@ func Convert_apiserver_EgressSelectorConfiguration_To_v1beta1_EgressSelectorConf } func autoConvert_v1beta1_ExtraMapping_To_apiserver_ExtraMapping(in *ExtraMapping, out *apiserver.ExtraMapping, s conversion.Scope) error { - out.Key = in.Key - out.ValueExpression = in.ValueExpression + *out = *(*apiserver.ExtraMapping)(unsafe.Pointer(in)) return nil } @@ -625,8 +594,7 @@ func Convert_v1beta1_ExtraMapping_To_apiserver_ExtraMapping(in *ExtraMapping, ou } func autoConvert_apiserver_ExtraMapping_To_v1beta1_ExtraMapping(in *apiserver.ExtraMapping, out *ExtraMapping, s conversion.Scope) error { - out.Key = in.Key - out.ValueExpression = in.ValueExpression + *out = *(*ExtraMapping)(unsafe.Pointer(in)) return nil } @@ -704,9 +672,7 @@ func Convert_apiserver_JWTAuthenticator_To_v1beta1_JWTAuthenticator(in *apiserve } func autoConvert_v1beta1_PrefixedClaimOrExpression_To_apiserver_PrefixedClaimOrExpression(in *PrefixedClaimOrExpression, out *apiserver.PrefixedClaimOrExpression, s conversion.Scope) error { - out.Claim = in.Claim - out.Prefix = (*string)(unsafe.Pointer(in.Prefix)) - out.Expression = in.Expression + *out = *(*apiserver.PrefixedClaimOrExpression)(unsafe.Pointer(in)) return nil } @@ -716,9 +682,7 @@ func Convert_v1beta1_PrefixedClaimOrExpression_To_apiserver_PrefixedClaimOrExpre } func autoConvert_apiserver_PrefixedClaimOrExpression_To_v1beta1_PrefixedClaimOrExpression(in *apiserver.PrefixedClaimOrExpression, out *PrefixedClaimOrExpression, s conversion.Scope) error { - out.Claim = in.Claim - out.Prefix = (*string)(unsafe.Pointer(in.Prefix)) - out.Expression = in.Expression + *out = *(*PrefixedClaimOrExpression)(unsafe.Pointer(in)) return nil } @@ -728,8 +692,7 @@ func Convert_apiserver_PrefixedClaimOrExpression_To_v1beta1_PrefixedClaimOrExpre } func autoConvert_v1beta1_TCPTransport_To_apiserver_TCPTransport(in *TCPTransport, out *apiserver.TCPTransport, s conversion.Scope) error { - out.URL = in.URL - out.TLSConfig = (*apiserver.TLSConfig)(unsafe.Pointer(in.TLSConfig)) + *out = *(*apiserver.TCPTransport)(unsafe.Pointer(in)) return nil } @@ -739,8 +702,7 @@ func Convert_v1beta1_TCPTransport_To_apiserver_TCPTransport(in *TCPTransport, ou } func autoConvert_apiserver_TCPTransport_To_v1beta1_TCPTransport(in *apiserver.TCPTransport, out *TCPTransport, s conversion.Scope) error { - out.URL = in.URL - out.TLSConfig = (*TLSConfig)(unsafe.Pointer(in.TLSConfig)) + *out = *(*TCPTransport)(unsafe.Pointer(in)) return nil } @@ -750,10 +712,7 @@ func Convert_apiserver_TCPTransport_To_v1beta1_TCPTransport(in *apiserver.TCPTra } func autoConvert_v1beta1_TLSConfig_To_apiserver_TLSConfig(in *TLSConfig, out *apiserver.TLSConfig, s conversion.Scope) error { - out.CABundle = in.CABundle - out.ClientKey = in.ClientKey - out.ClientCert = in.ClientCert - out.TLSServerName = in.TLSServerName + *out = *(*apiserver.TLSConfig)(unsafe.Pointer(in)) return nil } @@ -763,10 +722,7 @@ func Convert_v1beta1_TLSConfig_To_apiserver_TLSConfig(in *TLSConfig, out *apiser } func autoConvert_apiserver_TLSConfig_To_v1beta1_TLSConfig(in *apiserver.TLSConfig, out *TLSConfig, s conversion.Scope) error { - out.CABundle = in.CABundle - out.ClientKey = in.ClientKey - out.ClientCert = in.ClientCert - out.TLSServerName = in.TLSServerName + *out = *(*TLSConfig)(unsafe.Pointer(in)) return nil } @@ -796,8 +752,7 @@ func Convert_apiserver_TracingConfiguration_To_v1beta1_TracingConfiguration(in * } func autoConvert_v1beta1_Transport_To_apiserver_Transport(in *Transport, out *apiserver.Transport, s conversion.Scope) error { - out.TCP = (*apiserver.TCPTransport)(unsafe.Pointer(in.TCP)) - out.UDS = (*apiserver.UDSTransport)(unsafe.Pointer(in.UDS)) + *out = *(*apiserver.Transport)(unsafe.Pointer(in)) return nil } @@ -807,8 +762,7 @@ func Convert_v1beta1_Transport_To_apiserver_Transport(in *Transport, out *apiser } func autoConvert_apiserver_Transport_To_v1beta1_Transport(in *apiserver.Transport, out *Transport, s conversion.Scope) error { - out.TCP = (*TCPTransport)(unsafe.Pointer(in.TCP)) - out.UDS = (*UDSTransport)(unsafe.Pointer(in.UDS)) + *out = *(*Transport)(unsafe.Pointer(in)) return nil } @@ -818,7 +772,7 @@ func Convert_apiserver_Transport_To_v1beta1_Transport(in *apiserver.Transport, o } func autoConvert_v1beta1_UDSTransport_To_apiserver_UDSTransport(in *UDSTransport, out *apiserver.UDSTransport, s conversion.Scope) error { - out.UDSName = in.UDSName + *out = *(*apiserver.UDSTransport)(unsafe.Pointer(in)) return nil } @@ -828,7 +782,7 @@ func Convert_v1beta1_UDSTransport_To_apiserver_UDSTransport(in *UDSTransport, ou } func autoConvert_apiserver_UDSTransport_To_v1beta1_UDSTransport(in *apiserver.UDSTransport, out *UDSTransport, s conversion.Scope) error { - out.UDSName = in.UDSName + *out = *(*UDSTransport)(unsafe.Pointer(in)) return nil } @@ -838,8 +792,7 @@ func Convert_apiserver_UDSTransport_To_v1beta1_UDSTransport(in *apiserver.UDSTra } func autoConvert_v1beta1_UserValidationRule_To_apiserver_UserValidationRule(in *UserValidationRule, out *apiserver.UserValidationRule, s conversion.Scope) error { - out.Expression = in.Expression - out.Message = in.Message + *out = *(*apiserver.UserValidationRule)(unsafe.Pointer(in)) return nil } @@ -849,8 +802,7 @@ func Convert_v1beta1_UserValidationRule_To_apiserver_UserValidationRule(in *User } func autoConvert_apiserver_UserValidationRule_To_v1beta1_UserValidationRule(in *apiserver.UserValidationRule, out *UserValidationRule, s conversion.Scope) error { - out.Expression = in.Expression - out.Message = in.Message + *out = *(*UserValidationRule)(unsafe.Pointer(in)) return nil } @@ -910,8 +862,7 @@ func Convert_apiserver_WebhookConfiguration_To_v1beta1_WebhookConfiguration(in * } func autoConvert_v1beta1_WebhookConnectionInfo_To_apiserver_WebhookConnectionInfo(in *WebhookConnectionInfo, out *apiserver.WebhookConnectionInfo, s conversion.Scope) error { - out.Type = in.Type - out.KubeConfigFile = (*string)(unsafe.Pointer(in.KubeConfigFile)) + *out = *(*apiserver.WebhookConnectionInfo)(unsafe.Pointer(in)) return nil } @@ -921,8 +872,7 @@ func Convert_v1beta1_WebhookConnectionInfo_To_apiserver_WebhookConnectionInfo(in } func autoConvert_apiserver_WebhookConnectionInfo_To_v1beta1_WebhookConnectionInfo(in *apiserver.WebhookConnectionInfo, out *WebhookConnectionInfo, s conversion.Scope) error { - out.Type = in.Type - out.KubeConfigFile = (*string)(unsafe.Pointer(in.KubeConfigFile)) + *out = *(*WebhookConnectionInfo)(unsafe.Pointer(in)) return nil } @@ -932,7 +882,7 @@ func Convert_apiserver_WebhookConnectionInfo_To_v1beta1_WebhookConnectionInfo(in } func autoConvert_v1beta1_WebhookMatchCondition_To_apiserver_WebhookMatchCondition(in *WebhookMatchCondition, out *apiserver.WebhookMatchCondition, s conversion.Scope) error { - out.Expression = in.Expression + *out = *(*apiserver.WebhookMatchCondition)(unsafe.Pointer(in)) return nil } @@ -942,7 +892,7 @@ func Convert_v1beta1_WebhookMatchCondition_To_apiserver_WebhookMatchCondition(in } func autoConvert_apiserver_WebhookMatchCondition_To_v1beta1_WebhookMatchCondition(in *apiserver.WebhookMatchCondition, out *WebhookMatchCondition, s conversion.Scope) error { - out.Expression = in.Expression + *out = *(*WebhookMatchCondition)(unsafe.Pointer(in)) return nil } diff --git a/vendor/k8s.io/apiserver/pkg/apis/apiserver/validation/validation.go b/vendor/k8s.io/apiserver/pkg/apis/apiserver/validation/validation.go index a5eeaef60f..47ad5b30f3 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/apiserver/validation/validation.go +++ b/vendor/k8s.io/apiserver/pkg/apis/apiserver/validation/validation.go @@ -61,7 +61,7 @@ func ValidateAuthenticationConfiguration(compiler authenticationcel.Compiler, c seenDiscoveryURLs := sets.New[string]() for i, a := range c.JWT { fldPath := root.Index(i) - _, errs := validateJWTAuthenticator(compiler, a, fldPath, sets.New(disallowedIssuers...), utilfeature.DefaultFeatureGate.Enabled(features.StructuredAuthenticationConfiguration), utilfeature.DefaultFeatureGate.Enabled(features.StructuredAuthenticationConfigurationEgressSelector)) + _, errs := validateJWTAuthenticator(compiler, a, fldPath, sets.New(disallowedIssuers...), utilfeature.DefaultFeatureGate.Enabled(features.StructuredAuthenticationConfigurationEgressSelector)) allErrs = append(allErrs, errs...) if seenIssuers.Has(a.Issuer.URL) { @@ -78,9 +78,6 @@ func ValidateAuthenticationConfiguration(compiler authenticationcel.Compiler, c } if c.Anonymous != nil { - if !utilfeature.DefaultFeatureGate.Enabled(features.AnonymousAuthConfigurableEndpoints) { - allErrs = append(allErrs, field.Forbidden(field.NewPath("anonymous"), "anonymous is not supported when AnonymousAuthConfigurableEndpoints feature gate is disabled")) - } if !c.Anonymous.Enabled && len(c.Anonymous.Conditions) > 0 { allErrs = append(allErrs, field.Invalid(field.NewPath("anonymous", "conditions"), c.Anonymous.Conditions, "enabled should be set to true when conditions are defined")) } @@ -93,18 +90,18 @@ func ValidateAuthenticationConfiguration(compiler authenticationcel.Compiler, c // CEL expressions for claim mappings and validation rules. // This is exported for use in oidc package. func CompileAndValidateJWTAuthenticator(compiler authenticationcel.Compiler, authenticator api.JWTAuthenticator, disallowedIssuers []string) (authenticationcel.CELMapper, field.ErrorList) { - return validateJWTAuthenticator(compiler, authenticator, nil, sets.New(disallowedIssuers...), utilfeature.DefaultFeatureGate.Enabled(features.StructuredAuthenticationConfiguration), utilfeature.DefaultFeatureGate.Enabled(features.StructuredAuthenticationConfigurationEgressSelector)) + return validateJWTAuthenticator(compiler, authenticator, nil, sets.New(disallowedIssuers...), utilfeature.DefaultFeatureGate.Enabled(features.StructuredAuthenticationConfigurationEgressSelector)) } -func validateJWTAuthenticator(compiler authenticationcel.Compiler, authenticator api.JWTAuthenticator, fldPath *field.Path, disallowedIssuers sets.Set[string], structuredAuthnFeatureEnabled, structuredAuthnEgressSelectorFeatureEnabled bool) (authenticationcel.CELMapper, field.ErrorList) { +func validateJWTAuthenticator(compiler authenticationcel.Compiler, authenticator api.JWTAuthenticator, fldPath *field.Path, disallowedIssuers sets.Set[string], structuredAuthnEgressSelectorFeatureEnabled bool) (authenticationcel.CELMapper, field.ErrorList) { var allErrs field.ErrorList state := &validationState{} - allErrs = append(allErrs, validateIssuer(authenticator.Issuer, disallowedIssuers, fldPath.Child("issuer"), structuredAuthnFeatureEnabled, structuredAuthnEgressSelectorFeatureEnabled)...) - allErrs = append(allErrs, validateClaimValidationRules(compiler, state, authenticator.ClaimValidationRules, fldPath.Child("claimValidationRules"), structuredAuthnFeatureEnabled)...) - allErrs = append(allErrs, validateClaimMappings(compiler, state, authenticator.ClaimMappings, fldPath.Child("claimMappings"), structuredAuthnFeatureEnabled)...) - allErrs = append(allErrs, validateUserValidationRules(compiler, state, authenticator.UserValidationRules, fldPath.Child("userValidationRules"), structuredAuthnFeatureEnabled)...) + allErrs = append(allErrs, validateIssuer(authenticator.Issuer, disallowedIssuers, fldPath.Child("issuer"), structuredAuthnEgressSelectorFeatureEnabled)...) + allErrs = append(allErrs, validateClaimValidationRules(compiler, state, authenticator.ClaimValidationRules, fldPath.Child("claimValidationRules"))...) + allErrs = append(allErrs, validateClaimMappings(compiler, state, authenticator.ClaimMappings, fldPath.Child("claimMappings"))...) + allErrs = append(allErrs, validateUserValidationRules(compiler, state, authenticator.UserValidationRules, fldPath.Child("userValidationRules"))...) return state.mapper, allErrs } @@ -115,14 +112,14 @@ type validationState struct { usesEmailVerifiedClaim bool } -func validateIssuer(issuer api.Issuer, disallowedIssuers sets.Set[string], fldPath *field.Path, structuredAuthnFeatureEnabled, structuredAuthnEgressSelectorFeatureEnabled bool) field.ErrorList { +func validateIssuer(issuer api.Issuer, disallowedIssuers sets.Set[string], fldPath *field.Path, structuredAuthnEgressSelectorFeatureEnabled bool) field.ErrorList { var allErrs field.ErrorList allErrs = append(allErrs, validateIssuerURL(issuer.URL, disallowedIssuers, fldPath.Child("url"))...) - allErrs = append(allErrs, validateIssuerDiscoveryURL(issuer.URL, issuer.DiscoveryURL, fldPath.Child("discoveryURL"), structuredAuthnFeatureEnabled)...) - allErrs = append(allErrs, validateAudiences(issuer.Audiences, issuer.AudienceMatchPolicy, fldPath.Child("audiences"), fldPath.Child("audienceMatchPolicy"), structuredAuthnFeatureEnabled)...) + allErrs = append(allErrs, validateIssuerDiscoveryURL(issuer.URL, issuer.DiscoveryURL, fldPath.Child("discoveryURL"))...) + allErrs = append(allErrs, validateAudiences(issuer.Audiences, issuer.AudienceMatchPolicy, fldPath.Child("audiences"), fldPath.Child("audienceMatchPolicy"))...) allErrs = append(allErrs, validateCertificateAuthority(issuer.CertificateAuthority, fldPath.Child("certificateAuthority"))...) - allErrs = append(allErrs, validateEgressSelector(issuer.EgressSelectorType, fldPath.Child("egressSelectorType"), structuredAuthnFeatureEnabled, structuredAuthnEgressSelectorFeatureEnabled)...) + allErrs = append(allErrs, validateEgressSelector(issuer.EgressSelectorType, fldPath.Child("egressSelectorType"), structuredAuthnEgressSelectorFeatureEnabled)...) return allErrs } @@ -135,17 +132,13 @@ func validateIssuerURL(issuerURL string, disallowedIssuers sets.Set[string], fld return validateURL(issuerURL, disallowedIssuers, fldPath) } -func validateIssuerDiscoveryURL(issuerURL, issuerDiscoveryURL string, fldPath *field.Path, structuredAuthnFeatureEnabled bool) field.ErrorList { +func validateIssuerDiscoveryURL(issuerURL, issuerDiscoveryURL string, fldPath *field.Path) field.ErrorList { var allErrs field.ErrorList if len(issuerDiscoveryURL) == 0 { return nil } - if !structuredAuthnFeatureEnabled { - allErrs = append(allErrs, field.Invalid(fldPath, issuerDiscoveryURL, "discoveryURL is not supported when StructuredAuthenticationConfiguration feature gate is disabled")) - } - if len(issuerURL) > 0 && strings.TrimRight(issuerURL, "/") == strings.TrimRight(issuerDiscoveryURL, "/") { allErrs = append(allErrs, field.Invalid(fldPath, issuerDiscoveryURL, "discoveryURL must be different from URL")) } @@ -183,7 +176,7 @@ func validateURL(issuerURL string, disallowedIssuers sets.Set[string], fldPath * return allErrs } -func validateAudiences(audiences []string, audienceMatchPolicy api.AudienceMatchPolicyType, fldPath, audienceMatchPolicyFldPath *field.Path, structuredAuthnFeatureEnabled bool) field.ErrorList { +func validateAudiences(audiences []string, audienceMatchPolicy api.AudienceMatchPolicyType, fldPath, audienceMatchPolicyFldPath *field.Path) field.ErrorList { var allErrs field.ErrorList if len(audiences) == 0 { @@ -191,10 +184,6 @@ func validateAudiences(audiences []string, audienceMatchPolicy api.AudienceMatch return allErrs } - if len(audiences) > 1 && !structuredAuthnFeatureEnabled { - allErrs = append(allErrs, field.Invalid(fldPath, audiences, "multiple audiences are not supported when StructuredAuthenticationConfiguration feature gate is disabled")) - } - seenAudiences := sets.NewString() for i, audience := range audiences { fldPath := fldPath.Index(i) @@ -231,17 +220,13 @@ func validateCertificateAuthority(certificateAuthority string, fldPath *field.Pa return allErrs } -func validateEgressSelector(selectorType api.EgressSelectorType, fldPath *field.Path, structuredAuthnFeatureEnabled, structuredAuthnEgressSelectorFeatureEnabled bool) field.ErrorList { +func validateEgressSelector(selectorType api.EgressSelectorType, fldPath *field.Path, structuredAuthnEgressSelectorFeatureEnabled bool) field.ErrorList { var allErrs field.ErrorList if len(selectorType) == 0 { return allErrs } - if !structuredAuthnFeatureEnabled { - allErrs = append(allErrs, field.Invalid(fldPath, selectorType, "egress selector is not supported when StructuredAuthenticationConfiguration feature gate is disabled")) - } - if !structuredAuthnEgressSelectorFeatureEnabled { allErrs = append(allErrs, field.Invalid(fldPath, selectorType, "egress selector is not supported when StructuredAuthenticationConfigurationEgressSelector feature gate is disabled")) } @@ -256,7 +241,7 @@ func validateEgressSelector(selectorType api.EgressSelectorType, fldPath *field. return allErrs } -func validateClaimValidationRules(compiler authenticationcel.Compiler, state *validationState, rules []api.ClaimValidationRule, fldPath *field.Path, structuredAuthnFeatureEnabled bool) field.ErrorList { +func validateClaimValidationRules(compiler authenticationcel.Compiler, state *validationState, rules []api.ClaimValidationRule, fldPath *field.Path) field.ErrorList { var allErrs field.ErrorList seenClaims := sets.NewString() @@ -266,10 +251,6 @@ func validateClaimValidationRules(compiler authenticationcel.Compiler, state *va for i, rule := range rules { fldPath := fldPath.Index(i) - if len(rule.Expression) > 0 && !structuredAuthnFeatureEnabled { - allErrs = append(allErrs, field.Invalid(fldPath.Child("expression"), rule.Expression, "not supported when StructuredAuthenticationConfiguration feature gate is disabled")) - } - switch { case len(rule.Claim) > 0 && len(rule.Expression) > 0: allErrs = append(allErrs, field.Invalid(fldPath, rule.Claim, "claim and expression can't both be set")) @@ -308,7 +289,7 @@ func validateClaimValidationRules(compiler authenticationcel.Compiler, state *va } } - if structuredAuthnFeatureEnabled && len(compilationResults) > 0 { + if len(compilationResults) > 0 { state.mapper.ClaimValidationRules = authenticationcel.NewClaimsMapper(compilationResults) state.usesEmailVerifiedClaim = state.usesEmailVerifiedClaim || anyUsesEmailVerifiedClaim(compilationResults) } @@ -316,28 +297,13 @@ func validateClaimValidationRules(compiler authenticationcel.Compiler, state *va return allErrs } -func validateClaimMappings(compiler authenticationcel.Compiler, state *validationState, m api.ClaimMappings, fldPath *field.Path, structuredAuthnFeatureEnabled bool) field.ErrorList { +func validateClaimMappings(compiler authenticationcel.Compiler, state *validationState, m api.ClaimMappings, fldPath *field.Path) field.ErrorList { var allErrs field.ErrorList - if !structuredAuthnFeatureEnabled { - if len(m.Username.Expression) > 0 { - allErrs = append(allErrs, field.Invalid(fldPath.Child("username").Child("expression"), m.Username.Expression, "not supported when StructuredAuthenticationConfiguration feature gate is disabled")) - } - if len(m.Groups.Expression) > 0 { - allErrs = append(allErrs, field.Invalid(fldPath.Child("groups").Child("expression"), m.Groups.Expression, "not supported when StructuredAuthenticationConfiguration feature gate is disabled")) - } - if len(m.UID.Claim) > 0 || len(m.UID.Expression) > 0 { - allErrs = append(allErrs, field.Invalid(fldPath.Child("uid"), "", "claim mapping is not supported when StructuredAuthenticationConfiguration feature gate is disabled")) - } - if len(m.Extra) > 0 { - allErrs = append(allErrs, field.Invalid(fldPath.Child("extra"), "", "claim mapping is not supported when StructuredAuthenticationConfiguration feature gate is disabled")) - } - } - compilationResult, err := validatePrefixClaimOrExpression(compiler, m.Username, fldPath.Child("username"), true) if err != nil { allErrs = append(allErrs, err...) - } else if compilationResult != nil && structuredAuthnFeatureEnabled { + } else if compilationResult != nil { state.usesEmailClaim = state.usesEmailClaim || usesEmailClaim(compilationResult.AST) state.usesEmailVerifiedClaim = state.usesEmailVerifiedClaim || usesEmailVerifiedClaim(compilationResult.AST) state.mapper.Username = authenticationcel.NewClaimsMapper([]authenticationcel.CompilationResult{*compilationResult}) @@ -346,7 +312,7 @@ func validateClaimMappings(compiler authenticationcel.Compiler, state *validatio compilationResult, err = validatePrefixClaimOrExpression(compiler, m.Groups, fldPath.Child("groups"), false) if err != nil { allErrs = append(allErrs, err...) - } else if compilationResult != nil && structuredAuthnFeatureEnabled { + } else if compilationResult != nil { state.mapper.Groups = authenticationcel.NewClaimsMapper([]authenticationcel.CompilationResult{*compilationResult}) } @@ -360,7 +326,7 @@ func validateClaimMappings(compiler authenticationcel.Compiler, state *validatio if err != nil { allErrs = append(allErrs, err) - } else if structuredAuthnFeatureEnabled && compilationResult != nil { + } else if compilationResult != nil { state.mapper.UID = authenticationcel.NewClaimsMapper([]authenticationcel.CompilationResult{*compilationResult}) } } @@ -409,12 +375,12 @@ func validateClaimMappings(compiler authenticationcel.Compiler, state *validatio } } - if structuredAuthnFeatureEnabled && len(extraCompilationResults) > 0 { + if len(extraCompilationResults) > 0 { state.mapper.Extra = authenticationcel.NewClaimsMapper(extraCompilationResults) state.usesEmailVerifiedClaim = state.usesEmailVerifiedClaim || anyUsesEmailVerifiedClaim(extraCompilationResults) } - if structuredAuthnFeatureEnabled && state.usesEmailClaim && !state.usesEmailVerifiedClaim { + if state.usesEmailClaim && !state.usesEmailVerifiedClaim { allErrs = append(allErrs, field.Invalid(fldPath.Child("username", "expression"), m.Username.Expression, "claims.email_verified must be used in claimMappings.username.expression or claimMappings.extra[*].valueExpression or claimValidationRules[*].expression when claims.email is used in claimMappings.username.expression")) } @@ -577,14 +543,10 @@ func validatePrefixClaimOrExpression(compiler authenticationcel.Compiler, mappin return compilationResult, allErrs } -func validateUserValidationRules(compiler authenticationcel.Compiler, state *validationState, rules []api.UserValidationRule, fldPath *field.Path, structuredAuthnFeatureEnabled bool) field.ErrorList { +func validateUserValidationRules(compiler authenticationcel.Compiler, state *validationState, rules []api.UserValidationRule, fldPath *field.Path) field.ErrorList { var allErrs field.ErrorList var compilationResults []authenticationcel.CompilationResult - if len(rules) > 0 && !structuredAuthnFeatureEnabled { - allErrs = append(allErrs, field.Invalid(fldPath, "", "user validation rules are not supported when StructuredAuthenticationConfiguration feature gate is disabled")) - } - seenExpressions := sets.NewString() for i, rule := range rules { fldPath := fldPath.Index(i) @@ -615,7 +577,7 @@ func validateUserValidationRules(compiler authenticationcel.Compiler, state *val } } - if structuredAuthnFeatureEnabled && len(compilationResults) > 0 { + if len(compilationResults) > 0 { state.mapper.UserValidationRules = authenticationcel.NewUserMapper(compilationResults) } diff --git a/vendor/k8s.io/apiserver/pkg/apis/audit/v1/types.go b/vendor/k8s.io/apiserver/pkg/apis/audit/v1/types.go index 8c6dc676af..80a7175ca1 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/audit/v1/types.go +++ b/vendor/k8s.io/apiserver/pkg/apis/audit/v1/types.go @@ -70,7 +70,7 @@ const ( // Event captures all the information that can be included in an API audit log. type Event struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // AuditLevel at which event was generated Level Level `json:"level" protobuf:"bytes,1,opt,name=level,casttype=Level"` @@ -156,7 +156,7 @@ type AuthenticationMetadata struct { // EventList is a list of audit Events. type EventList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -168,7 +168,7 @@ type EventList struct { // Policy defines the configuration of audit logging, and the rules for how different request // categories are logged. type Policy struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // ObjectMeta is included for interoperability with API infrastructure. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -200,7 +200,7 @@ type Policy struct { // PolicyList is a list of audit Policies. type PolicyList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/vendor/k8s.io/apiserver/pkg/apis/audit/v1/zz_generated.conversion.go b/vendor/k8s.io/apiserver/pkg/apis/audit/v1/zz_generated.conversion.go index 904d9c12bc..57205fbaf4 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/audit/v1/zz_generated.conversion.go +++ b/vendor/k8s.io/apiserver/pkg/apis/audit/v1/zz_generated.conversion.go @@ -123,7 +123,7 @@ func RegisterConversions(s *runtime.Scheme) error { } func autoConvert_v1_AuthenticationMetadata_To_audit_AuthenticationMetadata(in *AuthenticationMetadata, out *audit.AuthenticationMetadata, s conversion.Scope) error { - out.ImpersonationConstraint = in.ImpersonationConstraint + *out = *(*audit.AuthenticationMetadata)(unsafe.Pointer(in)) return nil } @@ -133,7 +133,7 @@ func Convert_v1_AuthenticationMetadata_To_audit_AuthenticationMetadata(in *Authe } func autoConvert_audit_AuthenticationMetadata_To_v1_AuthenticationMetadata(in *audit.AuthenticationMetadata, out *AuthenticationMetadata, s conversion.Scope) error { - out.ImpersonationConstraint = in.ImpersonationConstraint + *out = *(*AuthenticationMetadata)(unsafe.Pointer(in)) return nil } @@ -217,9 +217,7 @@ func Convert_audit_EventList_To_v1_EventList(in *audit.EventList, out *EventList } func autoConvert_v1_GroupResources_To_audit_GroupResources(in *GroupResources, out *audit.GroupResources, s conversion.Scope) error { - out.Group = in.Group - out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources)) - out.ResourceNames = *(*[]string)(unsafe.Pointer(&in.ResourceNames)) + *out = *(*audit.GroupResources)(unsafe.Pointer(in)) return nil } @@ -229,9 +227,7 @@ func Convert_v1_GroupResources_To_audit_GroupResources(in *GroupResources, out * } func autoConvert_audit_GroupResources_To_v1_GroupResources(in *audit.GroupResources, out *GroupResources, s conversion.Scope) error { - out.Group = in.Group - out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources)) - out.ResourceNames = *(*[]string)(unsafe.Pointer(&in.ResourceNames)) + *out = *(*GroupResources)(unsafe.Pointer(in)) return nil } @@ -241,14 +237,7 @@ func Convert_audit_GroupResources_To_v1_GroupResources(in *audit.GroupResources, } func autoConvert_v1_ObjectReference_To_audit_ObjectReference(in *ObjectReference, out *audit.ObjectReference, s conversion.Scope) error { - out.Resource = in.Resource - out.Namespace = in.Namespace - out.Name = in.Name - out.UID = types.UID(in.UID) - out.APIGroup = in.APIGroup - out.APIVersion = in.APIVersion - out.ResourceVersion = in.ResourceVersion - out.Subresource = in.Subresource + *out = *(*audit.ObjectReference)(unsafe.Pointer(in)) return nil } @@ -258,14 +247,7 @@ func Convert_v1_ObjectReference_To_audit_ObjectReference(in *ObjectReference, ou } func autoConvert_audit_ObjectReference_To_v1_ObjectReference(in *audit.ObjectReference, out *ObjectReference, s conversion.Scope) error { - out.Resource = in.Resource - out.Namespace = in.Namespace - out.Name = in.Name - out.UID = types.UID(in.UID) - out.APIGroup = in.APIGroup - out.APIVersion = in.APIVersion - out.ResourceVersion = in.ResourceVersion - out.Subresource = in.Subresource + *out = *(*ObjectReference)(unsafe.Pointer(in)) return nil } @@ -323,15 +305,7 @@ func Convert_audit_PolicyList_To_v1_PolicyList(in *audit.PolicyList, out *Policy } func autoConvert_v1_PolicyRule_To_audit_PolicyRule(in *PolicyRule, out *audit.PolicyRule, s conversion.Scope) error { - out.Level = audit.Level(in.Level) - out.Users = *(*[]string)(unsafe.Pointer(&in.Users)) - out.UserGroups = *(*[]string)(unsafe.Pointer(&in.UserGroups)) - out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs)) - out.Resources = *(*[]audit.GroupResources)(unsafe.Pointer(&in.Resources)) - out.Namespaces = *(*[]string)(unsafe.Pointer(&in.Namespaces)) - out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs)) - out.OmitStages = *(*[]audit.Stage)(unsafe.Pointer(&in.OmitStages)) - out.OmitManagedFields = (*bool)(unsafe.Pointer(in.OmitManagedFields)) + *out = *(*audit.PolicyRule)(unsafe.Pointer(in)) return nil } @@ -341,15 +315,7 @@ func Convert_v1_PolicyRule_To_audit_PolicyRule(in *PolicyRule, out *audit.Policy } func autoConvert_audit_PolicyRule_To_v1_PolicyRule(in *audit.PolicyRule, out *PolicyRule, s conversion.Scope) error { - out.Level = Level(in.Level) - out.Users = *(*[]string)(unsafe.Pointer(&in.Users)) - out.UserGroups = *(*[]string)(unsafe.Pointer(&in.UserGroups)) - out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs)) - out.Resources = *(*[]GroupResources)(unsafe.Pointer(&in.Resources)) - out.Namespaces = *(*[]string)(unsafe.Pointer(&in.Namespaces)) - out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs)) - out.OmitStages = *(*[]Stage)(unsafe.Pointer(&in.OmitStages)) - out.OmitManagedFields = (*bool)(unsafe.Pointer(in.OmitManagedFields)) + *out = *(*PolicyRule)(unsafe.Pointer(in)) return nil } diff --git a/vendor/k8s.io/apiserver/pkg/authentication/authenticatorfactory/delegating.go b/vendor/k8s.io/apiserver/pkg/authentication/authenticatorfactory/delegating.go index b74b8b0d49..4c7a4cb10e 100644 --- a/vendor/k8s.io/apiserver/pkg/authentication/authenticatorfactory/delegating.go +++ b/vendor/k8s.io/apiserver/pkg/authentication/authenticatorfactory/delegating.go @@ -90,6 +90,7 @@ func (c DelegatingAuthenticatorConfig) New() (authenticator.Request, *spec.Secur } if c.TokenAccessReviewClient != nil { + RegisterMetrics() if c.WebhookRetryBackoff == nil { return nil, nil, errors.New("retry backoff parameters for delegating authentication webhook has not been specified") } diff --git a/vendor/k8s.io/apiserver/pkg/authentication/authenticatorfactory/metrics.go b/vendor/k8s.io/apiserver/pkg/authentication/authenticatorfactory/metrics.go index 23e650ef58..e40cd0da2b 100644 --- a/vendor/k8s.io/apiserver/pkg/authentication/authenticatorfactory/metrics.go +++ b/vendor/k8s.io/apiserver/pkg/authentication/authenticatorfactory/metrics.go @@ -18,6 +18,7 @@ package authenticatorfactory import ( "context" + "sync" compbasemetrics "k8s.io/component-base/metrics" "k8s.io/component-base/metrics/legacyregistry" @@ -25,11 +26,17 @@ import ( type registerables []compbasemetrics.Registerable -// init registers all metrics. -func init() { - for _, metric := range metrics { - legacyregistry.MustRegister(metric) - } +var registerMetricsOnce sync.Once + +// RegisterMetrics registers the delegated authentication metrics with the legacy +// registry. Do not use an init() function because feature gates (e.g., NativeHistograms) +// must be parsed before the histogram metric is created and registered. +func RegisterMetrics() { + registerMetricsOnce.Do(func() { + for _, metric := range metrics { + legacyregistry.MustRegister(metric) + } + }) } var ( diff --git a/vendor/k8s.io/apiserver/pkg/authentication/request/x509/x509.go b/vendor/k8s.io/apiserver/pkg/authentication/request/x509/x509.go index fc827208bd..93da5b01f2 100644 --- a/vendor/k8s.io/apiserver/pkg/authentication/request/x509/x509.go +++ b/vendor/k8s.io/apiserver/pkg/authentication/request/x509/x509.go @@ -25,6 +25,7 @@ import ( "fmt" "net/http" "strings" + "sync" "time" asn1util "k8s.io/apimachinery/pkg/apis/asn1" @@ -72,8 +73,15 @@ var clientCertificateExpirationHistogram = metrics.NewHistogram( }, ) -func init() { - legacyregistry.MustRegister(clientCertificateExpirationHistogram) +var registerMetricsOnce sync.Once + +// registerMetrics registers the x509 authentication metrics with the legacy +// registry. Do not use an init() function because feature gates (e.g., NativeHistograms) +// must be parsed before the histogram metric is created and registered. +func registerMetrics() { + registerMetricsOnce.Do(func() { + legacyregistry.MustRegister(clientCertificateExpirationHistogram) + }) } // UserConversion defines an interface for extracting user info from a client certificate chain @@ -131,6 +139,7 @@ func New(opts x509.VerifyOptions, user UserConversion) *Authenticator { // NewDynamic returns a request.Authenticator that verifies client certificates using the provided // VerifyOptionFunc (which may be dynamic), and converts valid certificate chains into user.Info using the provided UserConversion func NewDynamic(verifyOptionsFn VerifyOptionFunc, user UserConversion) *Authenticator { + registerMetrics() return &Authenticator{verifyOptionsFn, user} } diff --git a/vendor/k8s.io/apiserver/pkg/authentication/serviceaccount/util.go b/vendor/k8s.io/apiserver/pkg/authentication/serviceaccount/util.go index dd11efbde5..a811d9674e 100644 --- a/vendor/k8s.io/apiserver/pkg/authentication/serviceaccount/util.go +++ b/vendor/k8s.io/apiserver/pkg/authentication/serviceaccount/util.go @@ -20,6 +20,7 @@ import ( "fmt" "strings" + authenticationv1 "k8s.io/api/authentication/v1" v1 "k8s.io/api/core/v1" apimachineryvalidation "k8s.io/apimachinery/pkg/api/validation" "k8s.io/apiserver/pkg/authentication/user" @@ -48,6 +49,28 @@ const ( // NodeUIDKey is the key used in a user's "extra" to specify the node UID of // the authenticating request. NodeUIDKey = "authentication.kubernetes.io/node-uid" + // ValidatingWebhookConfigurationNameKey is the key used in a user's + // "extra" to specify the validating webhook configuration name of + // the authenticating request. + ValidatingWebhookConfigurationNameKey = "authentication.kubernetes.io/validatingwebhookconfiguration-name" + // ValidatingWebhookConfigurationUIDKey is the key used in a user's + // "extra" to specify the validating webhook configuration UID of + // the authenticating request. + ValidatingWebhookConfigurationUIDKey = "authentication.kubernetes.io/validatingwebhookconfiguration-uid" + // MutatingWebhookConfigurationNameKey is the key used in a user's + // "extra" to specify the mutating webhook configuration name of + // the authenticating request. + MutatingWebhookConfigurationNameKey = "authentication.kubernetes.io/mutatingwebhookconfiguration-name" + // MutatingWebhookConfigurationUIDKey is the key used in a user's + // "extra" to specify the mutating webhook configuration UID of + // the authenticating request. + MutatingWebhookConfigurationUIDKey = "authentication.kubernetes.io/mutatingwebhookconfiguration-uid" + // AttestationKeyPrefix is the prefix for the user info extra key used to + // detail attestations. + AttestationKeyPrefix = "attestation.authentication.kubernetes.io/" + // AttestationAdmissionReviewAPIGroupsKey is the key used in a user's + // "extra" to specify the "admissionReviewAPIGroups" claim. + AttestationAdmissionReviewAPIGroupsKey = AttestationKeyPrefix + authenticationv1.AttestationAdmissionReviewAPIGroups ) // MakeUsername generates a username from the given namespace and ServiceAccount name. @@ -123,10 +146,13 @@ func UserInfo(namespace, name, uid string) user.Info { } type ServiceAccountInfo struct { - Name, Namespace, UID string - PodName, PodUID string - CredentialID string - NodeName, NodeUID string + Name, Namespace, UID string + PodName, PodUID string + CredentialID string + NodeName, NodeUID string + ValidatingWebhookConfigurationName, ValidatingWebhookConfigurationUID string + MutatingWebhookConfigurationName, MutatingWebhookConfigurationUID string + AttestationAdmissionReviewAPIGroups []string } func (sa *ServiceAccountInfo) UserInfo() user.Info { @@ -159,6 +185,28 @@ func (sa *ServiceAccountInfo) UserInfo() user.Info { info.Extra[NodeUIDKey] = []string{sa.NodeUID} } } + if sa.ValidatingWebhookConfigurationName != "" && sa.ValidatingWebhookConfigurationUID != "" { + if info.Extra == nil { + info.Extra = make(map[string][]string) + } + info.Extra[ValidatingWebhookConfigurationNameKey] = []string{sa.ValidatingWebhookConfigurationName} + info.Extra[ValidatingWebhookConfigurationUIDKey] = []string{sa.ValidatingWebhookConfigurationUID} + } + + if sa.MutatingWebhookConfigurationName != "" && sa.MutatingWebhookConfigurationUID != "" { + if info.Extra == nil { + info.Extra = make(map[string][]string) + } + info.Extra[MutatingWebhookConfigurationNameKey] = []string{sa.MutatingWebhookConfigurationName} + info.Extra[MutatingWebhookConfigurationUIDKey] = []string{sa.MutatingWebhookConfigurationUID} + } + + if len(sa.AttestationAdmissionReviewAPIGroups) > 0 { + if info.Extra == nil { + info.Extra = make(map[string][]string) + } + info.Extra[AttestationAdmissionReviewAPIGroupsKey] = sa.AttestationAdmissionReviewAPIGroups + } return info } diff --git a/vendor/k8s.io/apiserver/pkg/authentication/token/cache/cached_token_authenticator.go b/vendor/k8s.io/apiserver/pkg/authentication/token/cache/cached_token_authenticator.go index 9d1556e633..ebe8982c0c 100644 --- a/vendor/k8s.io/apiserver/pkg/authentication/token/cache/cached_token_authenticator.go +++ b/vendor/k8s.io/apiserver/pkg/authentication/token/cache/cached_token_authenticator.go @@ -98,6 +98,7 @@ func New(authenticator authenticator.Token, cacheErrs bool, successTTL, failureT } func newWithClock(authenticator authenticator.Token, cacheErrs bool, successTTL, failureTTL time.Duration, clock clock.Clock) authenticator.Token { + registerMetrics() randomCacheKey := make([]byte, 32) if _, err := rand.Read(randomCacheKey); err != nil { panic(err) // rand should never fail diff --git a/vendor/k8s.io/apiserver/pkg/authentication/token/cache/stats.go b/vendor/k8s.io/apiserver/pkg/authentication/token/cache/stats.go index d1b959aa5e..6c19f0fa0b 100644 --- a/vendor/k8s.io/apiserver/pkg/authentication/token/cache/stats.go +++ b/vendor/k8s.io/apiserver/pkg/authentication/token/cache/stats.go @@ -18,6 +18,7 @@ package cache import ( "context" + "sync" "time" "k8s.io/component-base/metrics" @@ -63,13 +64,20 @@ var ( ) ) -func init() { - legacyregistry.MustRegister( - requestLatency, - requestCount, - fetchCount, - activeFetchCount, - ) +var registerMetricsOnce sync.Once + +// registerMetrics registers the token cache metrics with the legacy registry. +// Do not use an init() function because feature gates (e.g., NativeHistograms) +// must be parsed before the histogram metric is created and registered. +func registerMetrics() { + registerMetricsOnce.Do(func() { + legacyregistry.MustRegister( + requestLatency, + requestCount, + fetchCount, + activeFetchCount, + ) + }) } const ( diff --git a/vendor/k8s.io/apiserver/pkg/authorization/authorizer/conditions.go b/vendor/k8s.io/apiserver/pkg/authorization/authorizer/conditions.go new file mode 100644 index 0000000000..5b00f6fa5d --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/authorization/authorizer/conditions.go @@ -0,0 +1,307 @@ +/* +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. +*/ + +package authorizer + +import ( + "fmt" + "iter" + "strings" + + utilerrors "k8s.io/apimachinery/pkg/util/errors" + "k8s.io/apimachinery/pkg/util/sets" +) + +// conditionsAwareDecisionType is a small enum-like type for keeping track of what type a ConditionsAwareDecision is. +// These values must never be exposed to users outside of this package, and should not be used for anything else than +// keeping track of what type of a ConditionsAwareDecision is. +type conditionsAwareDecisionType int + +const ( + // conditionsAwareDecisionTypeDeny represents the unconditional Deny decision. + // It is zero such that ConditionsAwareDecision{}.IsDeny() == true + conditionsAwareDecisionTypeDeny conditionsAwareDecisionType = 0 + // conditionsAwareDecisionTypeAllow represents the unconditional Allow decision. + // It has a different value from DecisionAllow to never be conflated with that. + conditionsAwareDecisionTypeAllow conditionsAwareDecisionType = 11 + // conditionsAwareDecisionTypeNoOpinion represents the unconditional NoOpinion decision. + // It has a different value from DecisionNoOpinion to never be conflated with that. + conditionsAwareDecisionTypeNoOpinion conditionsAwareDecisionType = 12 + // conditionsAwareDecisionTypeConditionsMap represents the conditional ConditionsMap decision. + conditionsAwareDecisionTypeConditionsMap conditionsAwareDecisionType = 13 + // conditionsAwareDecisionTypeUnion represents a conditional Union decision. + conditionsAwareDecisionTypeUnion conditionsAwareDecisionType = 14 +) + +// ConditionsAwareDecision models an authorization decision that is conditions-aware. +// It is an enum type of the following five variants: +// - Allow: unconditional Allow. +// - Deny: unconditional Deny. +// - NoOpinion: unconditional NoOpinion. +// - Conditional: conditional on some previously-unseen data. +// - Union: an ordered list of sub-decisions, which forms a tree of decisions. +// +// The zero value (ConditionsAwareDecision{}) is equivalent to ConditionsAwareDecisionDeny(). +// A ConditionsAwareDecision is passed by value. +// Important: A ConditionsAwareDecision is immutable after construction. +type ConditionsAwareDecision struct { + decisionType conditionsAwareDecisionType + + conditionsMap ConditionsMap + union ConditionsAwareDecisionUnion + + reason string + err error +} + +// ConditionsAwareDecisionDeny constructs a Deny decision with the given reason and error. +func ConditionsAwareDecisionDeny(reason string, err error) ConditionsAwareDecision { + return ConditionsAwareDecision{ + // conditionsAwareDecisionTypeDeny == 0 == zero value + // => ConditionsAwareDecision{} == ConditionsAwareDecisionDeny() + decisionType: conditionsAwareDecisionTypeDeny, + reason: reason, + err: err, + } +} + +// ConditionsAwareDecisionAllow constructs an Allow decision with the given reason and error. +func ConditionsAwareDecisionAllow(reason string, err error) ConditionsAwareDecision { + return ConditionsAwareDecision{ + decisionType: conditionsAwareDecisionTypeAllow, + reason: reason, + err: err, + } +} + +// ConditionsAwareDecisionNoOpinion constructs a NoOpinion decision with the given reason and error. +func ConditionsAwareDecisionNoOpinion(reason string, err error) ConditionsAwareDecision { + return ConditionsAwareDecision{ + decisionType: conditionsAwareDecisionTypeNoOpinion, + reason: reason, + err: err, + } +} + +// ConditionsAwareDecisionFromParts is meant to be used by conditions-unaware Authorizer implementations +// in order to implement ConditionsAwareAuthorize as: +// "return authorizer.ConditionsAwareDecisionFromParts(self.Authorize(ctx, a))" +func ConditionsAwareDecisionFromParts(unconditional Decision, reason string, err error) ConditionsAwareDecision { + switch unconditional { + case DecisionAllow: + return ConditionsAwareDecisionAllow(reason, err) + case DecisionNoOpinion: + return ConditionsAwareDecisionNoOpinion(reason, err) + case DecisionDeny: + return ConditionsAwareDecisionDeny(reason, err) + default: + return ConditionsAwareDecisionDeny(reason, utilerrors.NewAggregate( + []error{ + err, + fmt.Errorf("unknown unconditional decision type: %d", unconditional), + }, + )) + } +} + +// IsAllow returns true if the decision is an unconditional Allow. +func (d ConditionsAwareDecision) IsAllow() bool { + return d.decisionType == conditionsAwareDecisionTypeAllow +} + +// IsNoOpinion returns true if the decision is an unconditional NoOpinion. +func (d ConditionsAwareDecision) IsNoOpinion() bool { + return d.decisionType == conditionsAwareDecisionTypeNoOpinion +} + +// IsDeny returns true if the decision is an unconditional Deny. +func (d ConditionsAwareDecision) IsDeny() bool { + return d.decisionType == conditionsAwareDecisionTypeDeny // == 0 == zero value +} + +// IsConditionsMap returns true if the decision is a conditional response +// with a map of conditions to evaluate. +func (d ConditionsAwareDecision) IsConditionsMap() bool { + return d.decisionType == conditionsAwareDecisionTypeConditionsMap +} + +// ConditionsMap returns the ConditionsMap, which is non-empty +// if and only if IsConditionsMap is true. +func (d ConditionsAwareDecision) ConditionsMap() ConditionsMap { + return d.conditionsMap +} + +// IsUnion returns true if the decision consists of other sub-decisions +// unioned together in a tree-like structure. +func (d ConditionsAwareDecision) IsUnion() bool { + return d.decisionType == conditionsAwareDecisionTypeUnion +} + +// IsUnconditional is true if d is Allow, Deny or NoOpinion. +func (d ConditionsAwareDecision) IsUnconditional() bool { + return d.IsAllow() || d.IsDeny() || d.IsNoOpinion() +} + +// unconditionalParts turns a ConditionsAwareDecision into the +// triple that Authorize expects. If the decision is +// conditional, the returned condition is Deny if there were at least +// some Deny condition, otherwise NoOpinion. +// This function is meant to be called when IsUnconditional() == true. +// +// If the authorizer is conditions-aware, it can choose to only implement +// real business logic in the ConditionsAwareAuthorize method, and implement +// Authorize() as "return self.ConditionsAwareAuthorize(ctx, attrs).unconditionalParts()" +// +// Private for now, to not encourage callers to perform conditions-aware logic where not needed. +func (d ConditionsAwareDecision) unconditionalParts() (Decision, string, error) { + switch { + case d.IsAllow(): + return DecisionAllow, d.Reason(), d.Error() + case d.IsDeny(): + return DecisionDeny, d.Reason(), d.Error() + case d.IsNoOpinion(): + return DecisionNoOpinion, d.Reason(), d.Error() + default: + // An error is not returned here, as that could yield a HTTP response code of 500 instead of 403. + // For the use-case described above with regards to calling this function in Authorize, not returning + // an error is important, as it is valid to always fail closed, as if this happens, no unconditional + // permissions were given the requestor. + return d.FailureDecision(), "failed closed: tried to return conditional decision to conditions-unaware authorizer", nil + } +} + +// PossibleDecisions details what are the possible decision outcomes of this +// ConditionsAwareDecision. The return value is a subset of {Allow, Deny, NoOpinion}, +// but never the empty set. If the set only contains a single value, it means the +// decision is unconditional. +func (d ConditionsAwareDecision) PossibleDecisions() sets.Set[Decision] { + switch { + case d.IsAllow(): + return sets.New(DecisionAllow) + case d.IsNoOpinion(): + return sets.New(DecisionNoOpinion) + case d.IsConditionsMap(): + return d.ConditionsMap().PossibleDecisions() + case d.IsUnion(): + return d.union.PossibleDecisions() + default: // default case Deny + return sets.New(DecisionDeny) + } +} + +// FailureDecision returns either a Deny or NoOpinion decision that the caller can +// use if the caller encounters an unrecoverable error while processing a +// ConditionsAwareDecision. If this decision is or could evaluate to Deny +// this function returns DecisionDeny to the caller, in order to fail closed +// as a conservative approximation. Otherwise, NoOpinion is returned. +func (d ConditionsAwareDecision) FailureDecision() Decision { + if d.PossibleDecisions().Has(DecisionDeny) { + return DecisionDeny + } + return DecisionNoOpinion +} + +// ContainsUnconditionalAllowOrDeny returns true whether there union contains at least one +// Allow or Deny decision within the tree of decisions. +func (d ConditionsAwareDecision) ContainsUnconditionalAllowOrDeny() bool { + if d.IsAllow() || d.IsDeny() { + return true + } + if d.IsNoOpinion() || d.IsConditionsMap() { + return false + } + return d.union.ContainsUnconditionalAllowOrDeny() +} + +// UnionedDecisions returns an iterator for unioned sub-decisions. +// This iterator is non-empty if and only if IsUnion() == true. +// Sub-decisions iteration order is preserved. +func (d ConditionsAwareDecision) UnionedDecisions() iter.Seq2[string, ConditionsAwareDecision] { + return func(yield func(string, ConditionsAwareDecision) bool) { + for _, subDecision := range d.union.inner { + if !yield(subDecision.conditionalAuthorizerName, subDecision.d) { + return + } + } + } +} + +// Reason returns the reason supplied when constructing +// an unconditional decision. +// Reason is an empty string for conditional decisions. +func (d ConditionsAwareDecision) Reason() string { + return d.reason +} + +// Error returns the error supplied when constructing +// an unconditional decision. +// Error is nil for conditional decisions. +func (d ConditionsAwareDecision) Error() error { + return d.err +} + +// String returns a human-readable representation of the decision. +func (d ConditionsAwareDecision) String() string { + if d.IsUnion() { + // No need to take d.reason or d.err into account, as they are always zero for the union. + b := strings.Builder{} + b.WriteString("Union[") + for i, sub := range d.union.inner { + if i != 0 { + b.WriteString(", ") + } + b.WriteString(sub.conditionalAuthorizerName) + b.WriteString(": ") + b.WriteString(sub.d.String()) + } + b.WriteByte(']') + return b.String() + } + params := []string{} + if len(d.reason) != 0 { + params = append(params, fmt.Sprintf("reason=%q", d.reason)) + } + if d.err != nil { + params = append(params, fmt.Sprintf("err=%q", d.err.Error())) + } + paramsStr := func() string { + if len(params) == 0 { + return "" + } + return fmt.Sprintf("(%s)", strings.Join(params, ", ")) + } + if d.IsAllow() { + return fmt.Sprintf("Allow%s", paramsStr()) + } + if d.IsNoOpinion() { + return fmt.Sprintf("NoOpinion%s", paramsStr()) + } + if d.IsConditionsMap() { + if len(d.conditionsMap.denyConditions) != 0 { + params = append(params, fmt.Sprintf("denies=%d", len(d.conditionsMap.denyConditions))) + } + if len(d.conditionsMap.noOpinionConditions) != 0 { + params = append(params, fmt.Sprintf("noopinions=%d", len(d.conditionsMap.noOpinionConditions))) + } + if len(d.conditionsMap.allowConditions) != 0 { + params = append(params, fmt.Sprintf("allows=%d", len(d.conditionsMap.allowConditions))) + } + return fmt.Sprintf("ConditionsMap%s", paramsStr()) + } + // Deny is written such that if none of the other modes apply, + // IsDenied() is true. + return fmt.Sprintf("Deny%s", paramsStr()) +} diff --git a/vendor/k8s.io/apiserver/pkg/authorization/authorizer/conditionsmap.go b/vendor/k8s.io/apiserver/pkg/authorization/authorizer/conditionsmap.go new file mode 100644 index 0000000000..6552fe6542 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/authorization/authorizer/conditionsmap.go @@ -0,0 +1,236 @@ +/* +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. +*/ + +package authorizer + +import ( + "context" + "fmt" + "iter" + "slices" + "strings" + + "k8s.io/apimachinery/pkg/api/validate/content" + "k8s.io/apimachinery/pkg/util/sets" +) + +// ConditionsMap is a map of conditions, where each condition has a map-unique +// ID, is a function from ConditionsData -> bool and has Allow/Deny/NoOpinion effect. +// It must be constructed through ConditionsAwareDecisionConditionsMap. +// During construction, all conditions are validated. +type ConditionsMap struct { + // invariant: len(denyConditions) != 0 || len(allowConditions) != 0 + // + // slices are used here instead of actual maps, as the ConditionsMap does + // not need to lookup single elements. It's called a "map" as uniqueness of + // the IDs (keys) across all conditions (values) in the map is enforced. + denyConditions []Condition + noOpinionConditions []Condition + allowConditions []Condition +} + +// FailureDecision returns either a Deny or NoOpinion decision that the caller can +// use if the caller encounters an unrecoverable error while processing a +// ConditionsAwareDecision. If this decision is or could evaluate to Deny +// this function returns DecisionDeny to the caller, in order to fail closed +// as a conservative approximation. Otherwise, NoOpinion is returned. +func (c ConditionsMap) FailureDecision() Decision { + if c.PossibleDecisions().Has(DecisionDeny) { + // Note: this only happens if len(denyConditions) > 0 + return DecisionDeny + } + return DecisionNoOpinion +} + +// Length returns the number of elements in the map. +func (c ConditionsMap) Length() int { + return len(c.denyConditions) + len(c.noOpinionConditions) + len(c.allowConditions) +} + +// DenyConditions returns the Deny conditions in this map. +// The conditions are returned in the same order as they were supplied to ConditionsAwareDecisionConditionsMap. +func (c ConditionsMap) DenyConditions() iter.Seq[Condition] { + return func(yield func(Condition) bool) { + for _, cond := range c.denyConditions { + if !yield(cond) { + return + } + } + } +} + +// NoOpinionConditions returns the NoOpinion conditions in this map. +// The conditions are returned in the same order as they were supplied to ConditionsAwareDecisionConditionsMap. +func (c ConditionsMap) NoOpinionConditions() iter.Seq[Condition] { + return func(yield func(Condition) bool) { + for _, cond := range c.noOpinionConditions { + if !yield(cond) { + return + } + } + } +} + +// AllowConditions returns the Allow conditions in this map. +// The conditions are returned in the same order as they were supplied to ConditionsAwareDecisionConditionsMap. +func (c ConditionsMap) AllowConditions() iter.Seq[Condition] { + return func(yield func(Condition) bool) { + for _, cond := range c.allowConditions { + if !yield(cond) { + return + } + } + } +} + +// PossibleDecisions details what are the possible decision outcomes of this +// ConditionsAwareDecision. The return value is a subset of {Allow, Deny, NoOpinion}, +// but never the empty set. If the set only contains a single value, it means the +// decision is unconditional. +func (c ConditionsMap) PossibleDecisions() sets.Set[Decision] { + possibleDecisions := sets.New(DecisionNoOpinion) + if len(c.allowConditions) > 0 { + possibleDecisions.Insert(DecisionAllow) + } + if len(c.denyConditions) > 0 { + possibleDecisions.Insert(DecisionDeny) + } + return possibleDecisions +} + +// MaxConditionsPerMap is the maximum number of conditions allowed in a single ConditionsMap. +const MaxConditionsPerMap = 128 + +// ConditionsAwareDecisionConditionsMap creates a ConditionsMap decision. +// The conditions are grouped by their effects: Deny, NoOpinion and Allow, that function as follows: +// - Deny: If a Deny condition evaluates to true, the ConditionsMap necessarily evaluates to Deny. +// In this case, no further authorizers are consulted. +// - NoOpinion: If a NoOpinion condition evaluates to true, the given authorizer's ConditionsMap cannot +// evaluate to Allow anymore, but necessarily Deny or NoOpinion, depending on whether there are any true +// Deny conditions. However, later authorizers in the chain can still Allow or Deny. +// It is effectively a softer deny that just overrides the authorizer's own allow policies. +// - Allow: If any Allow condition evaluates to true, the ConditionsMap evaluates to Allow, +// unless any Deny/NoOpinion condition also evaluates to true (in which case the Deny/NoOpinion conditions +// have precedence). +// +// All conditions must be non-nil, this function panics if any condition is nil. +func ConditionsAwareDecisionConditionsMap(denyConditions []Condition, noOpinionConditions []Condition, allowConditions []Condition) ConditionsAwareDecision { + // if there are any Deny conditions, Deny is a possible decision, and thus should we fail closed with Deny in that case + hasDenyEffect := len(denyConditions) > 0 + makeFailClosedError := func(err error) ConditionsAwareDecision { + if hasDenyEffect { + return ConditionsAwareDecisionDeny("failed closed", err) + } + return ConditionsAwareDecisionNoOpinion("failed closed", err) + } + + // enforce minimum 1 and maximum amount of conditions per map + conditionsAmount := len(denyConditions) + len(noOpinionConditions) + len(allowConditions) + if conditionsAmount == 0 { + // Does not use makeFailClosedError, but NoOpinion directly, as in this branch there are no deny conditions, so NoOpinion is safe + return ConditionsAwareDecisionNoOpinion("no conditions", fmt.Errorf("at least one condition must be passed to ConditionsAwareDecisionConditionsMap(), got none")) + } + if conditionsAmount > MaxConditionsPerMap { + return makeFailClosedError(fmt.Errorf("too many conditions: %d exceeds maximum of %d", conditionsAmount, MaxConditionsPerMap)) + } + // short-circuit case: if no Allow or Deny conditions exist, then evaluating this ConditionsMap can never evaluate to Allow or Deny, + // but only NoOpinion, regardless of the data. Thus just fold to NoOpinion directly. + // this upholds the len(denyConditions) != 0 || len(allowConditions) != 0 invariant on the ConditionsMap. + if len(denyConditions) == 0 && len(allowConditions) == 0 { + return ConditionsAwareDecisionNoOpinion("only NoOpinion conditions always evaluate to NoOpinion", nil) + } + + seenIDs := sets.New[string]() + + if err := validateConditions(seenIDs, denyConditions); err != nil { + return makeFailClosedError(err) + } + if err := validateConditions(seenIDs, noOpinionConditions); err != nil { + return makeFailClosedError(err) + } + if err := validateConditions(seenIDs, allowConditions); err != nil { + return makeFailClosedError(err) + } + + return ConditionsAwareDecision{ + decisionType: conditionsAwareDecisionTypeConditionsMap, + conditionsMap: ConditionsMap{ + // ensure immutability of the ConditionsMap after construction by not sharing caller-owned references + denyConditions: slices.Clone(denyConditions), + noOpinionConditions: slices.Clone(noOpinionConditions), + allowConditions: slices.Clone(allowConditions), + }, + } +} + +func validateConditions(seenIDs sets.Set[string], conditions []Condition) error { + for _, condition := range conditions { + + id := condition.GetID() + if seenIDs.Has(id) { + return fmt.Errorf("duplicate condition ID %q", id) + } + seenIDs.Insert(id) + + // Validate ID as a label key. + if errs := content.IsLabelKey(id); len(errs) > 0 { + return fmt.Errorf("invalid condition ID %q: %s", id, strings.Join(errs, "; ")) + } + + // Validate type as a label key, if set. + if conditionType := condition.GetType(); len(conditionType) != 0 { + if errs := content.IsLabelKey(conditionType); len(errs) > 0 { + return fmt.Errorf("invalid condition type %q: %s", conditionType, strings.Join(errs, "; ")) + } + } + } + return nil +} + +// GenericCondition is a generic implementation of the Condition interface, +// with optional support for fast in-process conditions evaluation, by +// setting EvaluateFunc non-nil. +type GenericCondition struct { + ID string + Condition string + Type string + Description string + EvaluateFunc func(ctx context.Context, data ConditionsData) ConditionEvaluationResult +} + +var _ Condition = GenericCondition{} + +func (c GenericCondition) GetID() string { + return c.ID +} + +func (c GenericCondition) GetCondition() string { + return c.Condition +} + +func (c GenericCondition) GetType() string { + return c.Type +} + +func (c GenericCondition) GetDescription() string { + return c.Description +} +func (c GenericCondition) Evaluate(ctx context.Context, data ConditionsData) ConditionEvaluationResult { + if c.EvaluateFunc == nil { + return ConditionsEvaluationResultUnevaluatable() + } + return c.EvaluateFunc(ctx, data) +} diff --git a/vendor/k8s.io/apiserver/pkg/authorization/authorizer/conditionsunion.go b/vendor/k8s.io/apiserver/pkg/authorization/authorizer/conditionsunion.go new file mode 100644 index 0000000000..a40ad25b92 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/authorization/authorizer/conditionsunion.go @@ -0,0 +1,204 @@ +/* +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. +*/ + +package authorizer + +import ( + "errors" + "fmt" + "slices" + "strings" + + utilerrors "k8s.io/apimachinery/pkg/util/errors" + "k8s.io/apimachinery/pkg/util/sets" +) + +type namedConditionsAwareDecision struct { + conditionalAuthorizerName string + d ConditionsAwareDecision +} + +// ConditionsAwareDecisionUnion is a builder struct for a Union-typed ConditionsAwareDecision. +// ConditionsAwareDecisionUnion is not thread-safe. +type ConditionsAwareDecisionUnion struct { + // Note: Remember to register any fields added here to the deepcopy in ToDecision + inner []namedConditionsAwareDecision + errs []error + // containsUnconditionalAllowOrDeny is a memorized value of whether any of + // the conditions in inner contain an unconditional Allow or Deny leaf. + containsUnconditionalAllowOrDeny bool + // subDecisionsPossibleDecisions is a memorized union of all added decisions' + // PossibleDecisions. Important: This is NOT the same as + // ConditionsAwareDecisionUnion.PossibleDecisions, as that also + // requires extra NoOpinion handling, adding NoOpinion in the empty + // union case, and removing it if containsUnconditionalAllowOrDeny == true. + subDecisionsPossibleDecisions sets.Set[Decision] +} + +// Add adds a named sub-decision to the current Union ConditionsAwareDecision builder. +// Add is a no-op if ContainsUnconditionalAllowOrDeny() is true, as adding decisions after an Allow or +// Deny will never change the final evaluated outcome. +// An error might be returned if the name is empty or a duplicate, the bool signifies whether +// the Add was a no-op. +// Add is not thread-safe. +func (unionMap *ConditionsAwareDecisionUnion) Add(conditionalAuthorizerName string, d ConditionsAwareDecision) { + if unionMap.ContainsUnconditionalAllowOrDeny() { + return // all items after the first concrete Allow or Deny aren't anyways used in evaluation, so they are not added to inner + } + + if len(conditionalAuthorizerName) == 0 { + unionMap.errs = append(unionMap.errs, fmt.Errorf("conditionalAuthorizerName must be non-empty")) + } + if unionMap.hasConditionalAuthorizerName(conditionalAuthorizerName) { + // Note: We don't short-circuit here, as we want to see all decisions "until the end", such that we can fail closed stronger if needed. + unionMap.errs = append(unionMap.errs, fmt.Errorf("duplicate conditionalAuthorizerName %q", conditionalAuthorizerName)) + } + // Once we've seen an unconditional Allow or Deny somewhere in the chain, we can stop accepting + // other decisions, as they won't ever apply. + if d.ContainsUnconditionalAllowOrDeny() { + unionMap.containsUnconditionalAllowOrDeny = true + } + unionMap.inner = append(unionMap.inner, namedConditionsAwareDecision{conditionalAuthorizerName: conditionalAuthorizerName, d: d}) + // Memorize the possible decisions. This is sound, as ConditionsAwareDecisions are immutable after construction. + if unionMap.subDecisionsPossibleDecisions == nil { + unionMap.subDecisionsPossibleDecisions = sets.New[Decision]() + } + unionMap.subDecisionsPossibleDecisions.Insert(d.PossibleDecisions().UnsortedList()...) +} + +func (unionMap *ConditionsAwareDecisionUnion) hasConditionalAuthorizerName(conditionalAuthorizerName string) bool { + return slices.ContainsFunc(unionMap.inner, func(nd namedConditionsAwareDecision) bool { + return nd.conditionalAuthorizerName == conditionalAuthorizerName + }) +} + +// FailureDecision returns either a Deny or NoOpinion decision that the caller can +// use if the caller encounters an unrecoverable error while processing a +// ConditionsAwareDecision. If this decision is or could evaluate to Deny +// this function returns DecisionDeny to the caller, in order to fail closed +// as a conservative approximation. Otherwise, NoOpinion is returned. +// FailureDecision is not thread-safe. +func (unionMap *ConditionsAwareDecisionUnion) FailureDecision() Decision { + if unionMap.PossibleDecisions().Has(DecisionDeny) { + return DecisionDeny + } + return DecisionNoOpinion +} + +// ContainsUnconditionalAllowOrDeny returns true whether there union contains at least one +// Allow or Deny decision within the unioned decisions. +// ContainsUnconditionalAllowOrDeny is not thread-safe. +func (unionMap *ConditionsAwareDecisionUnion) ContainsUnconditionalAllowOrDeny() bool { + return unionMap.containsUnconditionalAllowOrDeny +} + +// PossibleDecisions details what are the possible decision outcomes of this +// ConditionsAwareDecisionUnion. The return value is a subset of {Allow, Deny, NoOpinion}, +// but never the empty set. +// PossibleDecisions is not thread-safe. +func (unionMap *ConditionsAwareDecisionUnion) PossibleDecisions() sets.Set[Decision] { + // Default response is NoOpinion. + // Always return a fresh set, don't allow the caller to mutate any internal state. + possibleDecisions := sets.New(DecisionNoOpinion) + // Add the memorized possible decisions after adding them. + if unionMap.subDecisionsPossibleDecisions != nil { + possibleDecisions.Insert(unionMap.subDecisionsPossibleDecisions.UnsortedList()...) + } + // When there is an Allow or Deny leaf somewhere, the default response NoOpinion won't ever be returned + if unionMap.ContainsUnconditionalAllowOrDeny() { + possibleDecisions.Delete(DecisionNoOpinion) + } + return possibleDecisions +} + +// ConditionsAwareDecisionUnion unions some amount of decisions together into a tree structure, +// where Allow/Deny/NoOpinion/ConditionsMap decisions are leafs, and Union decisions are internal +// tree nodes. +// ToDecision is not thread-safe. +func (unionMap *ConditionsAwareDecisionUnion) ToDecision() ConditionsAwareDecision { + // If we encountered any errors (e.g. duplicate authorizernames) while building the slice, + // fail closed. + if len(unionMap.errs) != 0 { + err := utilerrors.NewAggregate(unionMap.errs) + return ConditionsAwareDecisionFromParts(unionMap.FailureDecision(), "failed closed", err) + } + + // If we only have one possible outcome, consolidate to an unconditional decision without evaluation. + if possibleDecisions := unionMap.PossibleDecisions(); possibleDecisions.Len() == 1 { + onlyPossibleDecision := possibleDecisions.UnsortedList()[0] + // Collect the certainly deciding decisions' reasons and errors. When the only possible + // decision is Allow or Deny, we in principle know it's the last decision added, but + // keep the logic generic and aligned with NoOpinion, for which we aggregate together + // the reasons and errors for all of the same-type decisions. + var aggregateReasons []string + var aggregateErrors []error + for _, namedDecision := range unionMap.inner { + reasons, errs := collectReasonsAndErrors([]string{namedDecision.conditionalAuthorizerName}, namedDecision.d, onlyPossibleDecision) + aggregateReasons = append(aggregateReasons, reasons...) + aggregateErrors = append(aggregateErrors, errs...) + } + + switch onlyPossibleDecision { + case DecisionDeny: + // For example, a union of decisions with possible outcomes "[Deny, NoOpinion], [NoOpinion], [Deny], [Allow]" yields possible outcome [Deny] always, + // regardless of how the ConditionsMap in the beginning evaluates. + return ConditionsAwareDecisionDeny(strings.Join(aggregateReasons, ", "), utilerrors.NewAggregate(aggregateErrors)) + case DecisionNoOpinion: + // This happens for instance when called on the empty slice, then the only possible mode is NoOpinion + // This can only happen if there were only NoOpinions in the chain, so we can gather them here. TODO: (formally) verify this + return ConditionsAwareDecisionNoOpinion(strings.Join(aggregateReasons, ", "), utilerrors.NewAggregate(aggregateErrors)) + case DecisionAllow: + // For example, a union of decisions with possible outcomes "[Allow, NoOpinion], [NoOpinion], [Allow], [Deny]" yields possible outcome [Allow] always, + // regardless of how the ConditionsMap in the beginning evaluates. + return ConditionsAwareDecisionAllow(strings.Join(aggregateReasons, ", "), utilerrors.NewAggregate(aggregateErrors)) + default: + return ConditionsAwareDecisionDeny("failed closed", errors.New("should be unreachable: ConditionsAwareDecision should only contain Allow/Deny/NoOpinion")) + } + } + + return ConditionsAwareDecision{ + decisionType: conditionsAwareDecisionTypeUnion, + union: ConditionsAwareDecisionUnion{ + // ensure ConditionsAwareDecision immutability by not sharing any references between the builder and the result + inner: slices.Clone(unionMap.inner), + containsUnconditionalAllowOrDeny: unionMap.containsUnconditionalAllowOrDeny, + subDecisionsPossibleDecisions: unionMap.subDecisionsPossibleDecisions.Clone(), + }, + } +} + +func collectReasonsAndErrors(authorizerNamePrefix []string, condAwareDecision ConditionsAwareDecision, unconditionalDecisionToCollect Decision) (aggregateReasons []string, aggregateErrors []error) { + if (unconditionalDecisionToCollect == DecisionAllow && condAwareDecision.IsAllow()) || + (unconditionalDecisionToCollect == DecisionNoOpinion && condAwareDecision.IsNoOpinion()) || + (unconditionalDecisionToCollect == DecisionDeny && condAwareDecision.IsDeny()) { + if reason := condAwareDecision.Reason(); len(reason) != 0 { + aggregateReasons = append(aggregateReasons, fmt.Sprintf("%s: {%s}", strings.Join(authorizerNamePrefix, ": "), reason)) + } + if err := condAwareDecision.Error(); err != nil { + aggregateErrors = append(aggregateErrors, fmt.Errorf("%s: %w", strings.Join(authorizerNamePrefix, ": "), err)) + } + return + } + if condAwareDecision.IsUnion() { + for authorizerName, subDecision := range condAwareDecision.UnionedDecisions() { + reasons, errs := collectReasonsAndErrors(slices.Concat(authorizerNamePrefix, []string{authorizerName}), subDecision, unconditionalDecisionToCollect) + aggregateReasons = append(aggregateReasons, reasons...) + aggregateErrors = append(aggregateErrors, errs...) + } + return + } + return +} diff --git a/vendor/k8s.io/apiserver/pkg/authorization/authorizer/evaluate.go b/vendor/k8s.io/apiserver/pkg/authorization/authorizer/evaluate.go new file mode 100644 index 0000000000..d8371f421f --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/authorization/authorizer/evaluate.go @@ -0,0 +1,280 @@ +/* +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. +*/ + +package authorizer + +import ( + "context" + "errors" + "fmt" + "iter" + + utilerrors "k8s.io/apimachinery/pkg/util/errors" +) + +// partialConditionEvaluationResultType is a small enum for the type of ConditionEvaluationResult +type partialConditionEvaluationResultType int + +const ( + partialConditionEvaluationResultTypeUnevaluatable partialConditionEvaluationResultType = iota + partialConditionEvaluationResultTypeTrue + partialConditionEvaluationResultTypeFalse + partialConditionEvaluationResultTypeError +) + +// ConditionEvaluationResult is an enum type with four variants: +// - true and false: Evaluation was successful, and evaluated to this value +// - error: The condition could be evaluated, but errored during eval. +// - unevaluatable: The condition cannot readily be evaluated. This is the struct zero value. +type ConditionEvaluationResult struct { + resultType partialConditionEvaluationResultType + err error +} + +// ConditionEvaluationResultBoolean constructs an evaluation result with a boolean value. +func ConditionEvaluationResultBoolean(evalResult bool) ConditionEvaluationResult { + if evalResult { + return ConditionEvaluationResult{resultType: partialConditionEvaluationResultTypeTrue} + } + return ConditionEvaluationResult{resultType: partialConditionEvaluationResultTypeFalse} +} + +// ConditionEvaluationResultError indicates that the condition could be evaluated, but failed. +func ConditionEvaluationResultError(err error) ConditionEvaluationResult { + if err == nil { + return ConditionEvaluationResult{ + resultType: partialConditionEvaluationResultTypeError, + err: errors.New("unspecified evaluation error"), + } + } + return ConditionEvaluationResult{ + resultType: partialConditionEvaluationResultTypeError, + err: err, + } +} + +// ConditionsEvaluationResultUnevaluatable indicates direct conditions evaluation is not possible. +func ConditionsEvaluationResultUnevaluatable() ConditionEvaluationResult { + return ConditionEvaluationResult{ + resultType: partialConditionEvaluationResultTypeUnevaluatable, // == 0 (which matches the zero value of the struct) + } +} + +// IsTrue indicates that the conditions evaluation was successful, and evaluated to true, which means it influences the ConditionsMap decision. +func (r ConditionEvaluationResult) IsTrue() bool { + return r.resultType == partialConditionEvaluationResultTypeTrue +} + +// IsFalse indicates that the conditions evaluation was successful, but evaluated to false, and it not thus taken into account. +func (r ConditionEvaluationResult) IsFalse() bool { + return r.resultType == partialConditionEvaluationResultTypeFalse +} + +// IsError indicates whether conditions evaluation failed. +func (r ConditionEvaluationResult) IsError() bool { + return r.resultType == partialConditionEvaluationResultTypeError +} + +// Error returns the evaluation error, if any. +func (r ConditionEvaluationResult) Error() error { return r.err } + +// IsUnevaluatable is true whenever none of the other variants is, that is, the zero value. +func (r ConditionEvaluationResult) IsUnevaluatable() bool { + return r.resultType == partialConditionEvaluationResultTypeUnevaluatable +} + +// Evaluate evaluates the ConditionsMap primarily using the Conditions' own Evaluate() function, +// and secondarily using evaluateConditionFn, if set. The first matching (true) condition +// short-circuits the process, in order for the evaluation to be as efficient as possible. +func (c ConditionsMap) Evaluate(ctx context.Context, data ConditionsData, evaluateConditionFn EvaluateConditionFunc) (Decision, string, error) { + // This is a translation between the generic, private function, and the interface we want to expose to callers. + return partiallyEvaluateConditionsMapInternal(ctx, c, data, func(ctx context.Context, cond Condition, condData ConditionsData) ConditionEvaluationResult { + // Because we never return "unevaluatable", the returned ConditionsAwareDecision is always one of Allow/Deny/NoOpinion, and thus can we split it into unconditionalParts + applied, err := evaluateConditionFn(ctx, cond, condData) + if err != nil { + return ConditionEvaluationResultError(err) + } + return ConditionEvaluationResultBoolean(applied) + }).unconditionalParts() +} + +// partiallyEvaluateConditionsMapInternal evaluates the ConditionsMap primarily using the Conditions' own Evaluate() function, +// and secondarily using evaluateFunc, if set. If evaluateFunc is non-nil and never returns +// ConditionsEvaluationResultUnevaluatable, the returned decision is guaranteed to be Allow/Deny/NoOpinion. +// However, this method can also be used to evaluate a subset of the conditions (e.g. for builtin +// conditions evaluators that support a certain conditions type), returning ConditionsEvaluationResultUnevaluatable +// for conditions that the evaluator does not recognize. In the latter case, a partially evaluated, +// ConditionsMap might be returned. +func partiallyEvaluateConditionsMapInternal(ctx context.Context, c ConditionsMap, data ConditionsData, evaluateConditionFn MaybeEvaluateConditionFunc) ConditionsAwareDecision { + evalCond := func(cond Condition) ConditionEvaluationResult { + // First, try to use the condition's own evaluate function. + // Fallback to evaluateConditionFn if set and unevaluatable + result := cond.Evaluate(ctx, data) + if result.IsUnevaluatable() && evaluateConditionFn != nil { + return evaluateConditionFn(ctx, cond, data) + } + return result + } + + // General logic: Deny > NoOpinion > Allow. Within a set of same-effect conditions true > error > unevaluatable > false. + + if len(c.denyConditions) != 0 { + appliedReason, errored, unevaluated := conditionsToAppliedErroredUnevaluated( + c.DenyConditions(), evalCond, "Deny", "denied the request") + + if len(appliedReason) != 0 { + // No errors are returned here, as that would turn this into a 500 instead of 403 in the WithAuthorization HTTP filter + // TODO(luxas): We might want to change the WithAuthorization logic such that it becomes possible for an authorizer to + // surface non-critical errors also in the precence of denies. + return ConditionsAwareDecisionDeny(appliedReason, nil) + } + if len(errored) != 0 { + return ConditionsAwareDecisionDeny("one or more conditional evaluation errors occurred", utilerrors.NewAggregate(errored)) + } + if len(unevaluated) != 0 { + return ConditionsAwareDecisionConditionsMap(unevaluated, c.noOpinionConditions, c.allowConditions) + } + } + + // If we got here, all Deny conditions could be evaluated, and evaluated to false, nil + + if len(c.noOpinionConditions) != 0 { + appliedReason, errored, unevaluated := conditionsToAppliedErroredUnevaluated( + c.NoOpinionConditions(), evalCond, "NoOpinion", "evaluated to NoOpinion") + + if len(appliedReason) != 0 { + // No errors are returned here, as that would turn this into a 500 instead of 403 in the WithAuthorization HTTP filter + return ConditionsAwareDecisionNoOpinion(appliedReason, nil) + } + if len(errored) != 0 { + return ConditionsAwareDecisionNoOpinion("one or more conditional evaluation errors occurred", utilerrors.NewAggregate(errored)) + } + if len(unevaluated) != 0 { + // Note: If len(c.allowConditions) == 0, ConditionsAwareDecisionConditionsMap will fold this into an unconditional NoOpinion. + return ConditionsAwareDecisionConditionsMap(nil, unevaluated, c.allowConditions) + } + } + + // If we got here, all Deny and NoOpinion conditions could be evaluated, and evaluated to false, nil + + if len(c.allowConditions) != 0 { + appliedReason, errored, unevaluated := conditionsToAppliedErroredUnevaluated( + c.AllowConditions(), evalCond, "Allow", "allowed the request") + + if len(appliedReason) != 0 { + // Errors could technically be returned with an Allow (and be logged), but no errors are returned for + // the short-circuit true case, as the error list might be incomplete. + return ConditionsAwareDecisionAllow(appliedReason, nil) + } + if len(errored) != 0 { + return ConditionsAwareDecisionNoOpinion("one or more conditional evaluation errors occurred", utilerrors.NewAggregate(errored)) + } + if len(unevaluated) != 0 { + return ConditionsAwareDecisionConditionsMap(nil, nil, unevaluated) + } + } + + // All conditions evaluated to false. This means a simple default NoOpinion. + return ConditionsAwareDecisionNoOpinion("no conditions matched", nil) +} + +// Note: the signature is string, error, []Condition, as that is the order in which the return values should be processed +// The first true short-circuits the evaluation with a nil error, even though some potentially happened before the first +// true evaluation, as the errors list in that case wouldn't necessarily be comprehensive. +func conditionsToAppliedErroredUnevaluated(conditions iter.Seq[Condition], evalCond func(cond Condition) ConditionEvaluationResult, effect, appliedDescription string) (string, []error, []Condition) { + var errs []error + var unevaluatedConditions []Condition + for cond := range conditions { + id := cond.GetID() + evalResult := evalCond(cond) + switch { + case evalResult.IsTrue(): + reason := fmt.Sprintf("condition %q %s", id, appliedDescription) + if desc := cond.GetDescription(); len(desc) != 0 { + reason += fmt.Sprintf(" with description %q", desc) + } + // Note: nil is returned for errors here as the list is not comprehensive in the short-circuit case. + return reason, nil, nil + case evalResult.IsFalse(): + continue + case evalResult.IsUnevaluatable(): + unevaluatedConditions = append(unevaluatedConditions, cond) + continue + case evalResult.IsError(): + errs = append(errs, fmt.Errorf("condition %q with effect=%s evaluated to an error: %w", id, effect, evalResult.Error())) + continue + default: + errs = append(errs, fmt.Errorf("condition %q with effect=%s evaluated to an error: unknown evaluation result %v", id, effect, evalResult)) + continue + } + } + return "", errs, unevaluatedConditions +} + +// PartiallyEvaluateConditionsAwareDecision evaluates the ConditionsAwareDecision primarily using any conditions' own Evaluate() function, +// and secondarily/optionally using evaluateConditionFn, if set. If evaluateConditionFn is non-nil and never returns +// ConditionsEvaluationResultUnevaluatable, the returned decision is guaranteed to be Allow/Deny/NoOpinion. +// However, this method can also be used to evaluate a subset of the conditions (e.g. for builtin +// conditions evaluators that only support a certain conditions type), returning ConditionsEvaluationResultUnevaluatable +// for conditions that the evaluator does not recognize. In the latter case, a partially evaluated ConditionsAwareDecision is returned. +// When evaluating a ConditionsMap, only the first matching (true) condition short-circuits the process, +// in order for the evaluation to be as efficient as possible. +func PartiallyEvaluateConditionsAwareDecision(ctx context.Context, unevaluatedDecision ConditionsAwareDecision, data ConditionsData, evaluateConditionFn MaybeEvaluateConditionFunc) ConditionsAwareDecision { + switch { + case unevaluatedDecision.IsConditionsMap(): + // Try to evaluate or refine the leaf ConditionsMap using the builtin evaluator. + return partiallyEvaluateConditionsMapInternal(ctx, unevaluatedDecision.ConditionsMap(), data, evaluateConditionFn) + case unevaluatedDecision.IsUnion(): + var newDecisionChain ConditionsAwareDecisionUnion + // Recursively walk through the decision DAG in a depth-first manner. + // The logic in this function should be the same as in the union authorizer's ConditionsAwareAuthorize. + + collectTailAfterConditionalDecision := false + for authorizerName, unevaluatedSubDecision := range unevaluatedDecision.UnionedDecisions() { + // If collectAndShortcircuitOnly == true, a conditional decision that couldn't + // be evaluated to Allow/Deny/NoOpinion was encountered during a previous + // loop iteration. Then all latter decisions stay unevaluated. + if collectTailAfterConditionalDecision { + newDecisionChain.Add(authorizerName, unevaluatedSubDecision) + continue + } + + // When !collectTailAfterConditionalDecision: All decisions so far in newDecisionChain are NoOpinions, + // as if there existed a previous decision of type ConditionsMap or Union, collectTailAfterConditionalDecision == true, + // and if there existed an Allow or Deny earlier, the function would have returned. + + // Try evaluating or refining the leaf ConditionsMaps in this tree of decisions. + possiblyEvaluatedSubDecision := PartiallyEvaluateConditionsAwareDecision(ctx, unevaluatedSubDecision, data, evaluateConditionFn) + newDecisionChain.Add(authorizerName, possiblyEvaluatedSubDecision) + + // If there is any Allow/Deny decision leaf, no need to walk the chain further. + if possiblyEvaluatedSubDecision.ContainsUnconditionalAllowOrDeny() { + return newDecisionChain.ToDecision() + } + + // Stop partially evaluating after encountering a conditional decision + if !possiblyEvaluatedSubDecision.IsUnconditional() { + collectTailAfterConditionalDecision = true + } + } + // If we reached here, all leaf decisions were either of NoOpinion or ConditionsMap type. + // If all decisions were NoOpinions, the constructor folds into a single NoOpinion decision. + return newDecisionChain.ToDecision() + default: + // No simplification possible + return unevaluatedDecision + } +} diff --git a/vendor/k8s.io/apiserver/pkg/authorization/authorizer/interfaces.go b/vendor/k8s.io/apiserver/pkg/authorization/authorizer/interfaces.go index 09000a1a59..a4179e515e 100644 --- a/vendor/k8s.io/apiserver/pkg/authorization/authorizer/interfaces.go +++ b/vendor/k8s.io/apiserver/pkg/authorization/authorizer/interfaces.go @@ -18,16 +18,20 @@ package authorizer import ( "context" + "errors" "fmt" "net/http" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apiserver/pkg/authentication/user" ) -// Attributes is an interface used by an Authorizer to get information about a request -// that is used to make an authorization decision. +// Attributes is an interface used by an Authorizer to get information about a +// request's metadata, that is used to compute an unconditional or conditional +// authorization decision. type Attributes interface { // GetUser returns the user.Info object to authorize GetUser() user.Info @@ -77,19 +81,69 @@ type Attributes interface { GetLabelSelector() (labels.Requirements, error) } +// UnconditionalAuthorizer is a downscoped variant of Authorizer, which only gives the +// caller the ability to call the conditions-unaware Authorize method. +type UnconditionalAuthorizer interface { + Authorize(ctx context.Context, a Attributes) (authorized Decision, reason string, err error) +} + // Authorizer makes an authorization decision based on information gained by making -// zero or more calls to methods of the Attributes interface. It returns nil when an action is -// authorized, otherwise it returns an error. +// zero or more calls to methods of the Attributes interface. It might return +// an error together with any decision. It is up to the caller to decide whether +// that error is critical or not. +// +// The kube-apiserver WithAuthorization filter ignores errors when the decision is +// Allow, but returns response code 500 if an error is returned with a Deny or +// NoOpinion (instead of the usual 403). +// +// Any authorizer must implement this interface, but when passing a handle to an +// authorizer, one might choose whether to pass the Authorizer or smaller UnconditionalAuthorizer +// interface, depending on whether the receiver should be able to perform conditional +// authorization or not. type Authorizer interface { - Authorize(ctx context.Context, a Attributes) (authorized Decision, reason string, err error) + UnconditionalAuthorizer + + // ConditionsAwareAuthorize returns an unconditional, conditional, or unioned + // decision, where the error and reason is part of the Decision struct. + // + // An authorizer who is not conditions-aware MUST implement this function as + // "return authorizer.ConditionsAwareDecisionFromParts(self.Authorize(ctx, a))", + // such that conditions-aware callers to this authorizer get the same output + // as if they called Authorize. Callers are only expected to call one of + // Authorize or ConditionsAwareAuthorize, not both. + ConditionsAwareAuthorize(ctx context.Context, a Attributes) ConditionsAwareDecision + + // EvaluateConditions evaluates a conditional or unioned ConditionsAwareDecision against previously-unknown data. + // + // An authorizer who does not support conditions should fail closed and + // return authorizer.DecisionDeny, "", authorizer.ErrorConditionEvaluationNotSupported + // + // The context should only be used for timeouts/cancellation/tracing, and should not influence the + // evaluation outcome. Only the given decision and data may infuence the outcome. data must be non-nil. + EvaluateConditions(ctx context.Context, decision ConditionsAwareDecision, data ConditionsData) (authorized Decision, reason string, err error) } +// ErrorConditionEvaluationNotSupported is returned by authorizer implementations +// that do not support condition evaluation. +var ErrorConditionEvaluationNotSupported = errors.New("condition evaluation not supported") + +// AuthorizerFunc implements Authorizer +var _ Authorizer = AuthorizerFunc(nil) + type AuthorizerFunc func(ctx context.Context, a Attributes) (Decision, string, error) func (f AuthorizerFunc) Authorize(ctx context.Context, a Attributes) (Decision, string, error) { return f(ctx, a) } +func (f AuthorizerFunc) ConditionsAwareAuthorize(ctx context.Context, a Attributes) ConditionsAwareDecision { + return ConditionsAwareDecisionFromParts(f.Authorize(ctx, a)) +} + +func (f AuthorizerFunc) EvaluateConditions(_ context.Context, _ ConditionsAwareDecision, _ ConditionsData) (Decision, string, error) { + return DecisionDeny, "", ErrorConditionEvaluationNotSupported +} + // RuleResolver provides a mechanism for resolving the list of rules that apply to a given user within a namespace. type RuleResolver interface { // RulesFor get the list of cluster wide rules, the list of rules in the specific namespace, incomplete status and errors. @@ -172,6 +226,8 @@ func (a AttributesRecord) GetLabelSelector() (labels.Requirements, error) { return a.LabelSelectorRequirements, a.LabelSelectorParsingErr } +// Decision represents an final, unconditional authorization decision. +// The zero value (0) of Decision is DecisionDeny. type Decision int const ( @@ -180,7 +236,8 @@ const ( // DecisionAllow means that an authorizer decided to allow the action. DecisionAllow // DecisionNoOpinion means that an authorizer has no opinion on whether - // to allow or deny an action. + // to allow or deny an action. If there are multiple unioned authorizers, + // this means that the request can thus get allowed by some later authorizer. DecisionNoOpinion ) @@ -196,3 +253,91 @@ func (d Decision) String() string { return fmt.Sprintf("Unknown (%d)", int(d)) } } + +// Condition represents one authorization condition that is part of a ConditionsMap. +// The effect of a condition is defined by whether it is part of the Deny/NoOpinion/Allow +// conditions list in the ConditionsMap. +// +// A Condition must be immutable and thread-safe. +type Condition interface { + // GetID uniquely identifies this condition within the scope of the authorizer + // that authored it. Validated as a Kubernetes label key. + // Any domain of form *.k8s.io or *.kubernetes.io is reserved for Kubernetes use. + // Required. + GetID() string + + // GetType describes the type of the condition, if there are multiple possibilities. + // Should be formatted as a Kubernetes label key. + // Any domain of form *.k8s.io or *.kubernetes.io is reserved for Kubernetes use. + // Optional. Can be omitted if the authorizer already knows how to evaluate the condition. + GetType() string + + // GetCondition returns a string encoding of the condition to be evaluated. + // It is a pure, deterministic function from ConditionsData to a boolean (or error). + // Might or might not be human-readable. + // Optional, if the ID alone is enough for the authorizer to know how to evaluate the condition. + GetCondition() string + + // GetDescription is an optional human-friendly description that can be shown + // as an error message or for debugging. Optional. + GetDescription() string + + // Evaluate evaluates the condition to a boolean, returns an error, or returns "unevaluatable". + // If an authorizer already has a pre-compiled condition, this avoids one serialization roundtrip, + // with potentially expensive deserialization/parsing. However, if the condition underwent a + // serialize/deserialize roundtrip (e.g. when the caller is an aggregated API server), the authorizer + // might have to evaluate the condition from its serialized form using evaluateFunc in + // ConditionsMap.Evaluate. + // Evaluate must be safe to call repeatedly and concurrently. + // + // The context should only be used for timeouts/cancellation/tracing, and should not influence the + // evaluation outcome. Only the condition itself and data can infuence the outcome. + Evaluate(ctx context.Context, data ConditionsData) ConditionEvaluationResult +} + +// EvaluateConditionFunc is a function that is able to concretely evaluate a condition to a boolean or error. +type EvaluateConditionFunc func(ctx context.Context, condition Condition, data ConditionsData) (bool, error) + +// MaybeEvaluateConditionFunc allows potentially evaluating a condition, returning Unevaluatable if a truth value or error cannot be assigned. +type MaybeEvaluateConditionFunc func(ctx context.Context, condition Condition, data ConditionsData) ConditionEvaluationResult + +// AdmissionOperation represents the admission operation, +// for example CREATE, UPDATE, DELETE. The constants are +// defined in k8s.io/apiserver/pkg/admission, but the +// type is defined here, because this package is more generic +// than the admission package (thus avoiding import cycles) +type AdmissionOperation string + +// ConditionsData represents the data available for conditions +// to evaluate against. This is by design a subset of admission.Attributes. +type ConditionsData interface { + // GetName returns the name of the object as presented in the request. On a CREATE operation, the client + // may omit name and rely on the server to generate the name. If that is the case, this method will return + // the empty string + GetName() string + // GetNamespace is the namespace associated with the request (if any) + GetNamespace() string + // GetResource is the name of the resource being requested. This is not the kind. For example: pods + GetResource() schema.GroupVersionResource + // GetSubresource is the name of the subresource being requested. This is a different resource, scoped to the parent resource, but it may have a different kind. + // For instance, /pods has the resource "pods" and the kind "Pod", while /pods/foo/status has the resource "pods", the sub resource "status", and the kind "Pod" + // (because status operates on pods). The binding resource for a pod though may be /pods/foo/binding, which has resource "pods", subresource "binding", and kind "Binding". + GetSubresource() string + // GetOperation is the operation being performed + GetOperation() AdmissionOperation + // GetOperationOptions is the options for the operation being performed + GetOperationOptions() runtime.Object + // IsDryRun indicates that modifications will definitely not be persisted for this request. This is to prevent + // admission controllers with side effects and a method of reconciliation from being overwhelmed. + // However, a value of false for this does not mean that the modification will be persisted, because it + // could still be rejected by a subsequent validation step. + IsDryRun() bool + // GetObject is the object from the incoming request. Only populated for CREATE and UPDATE requests. + GetObject() runtime.Object + // GetOldObject is the existing object in storage. Only populated for UPDATE and DELETE requests. + GetOldObject() runtime.Object + // GetKind is the type of object being manipulated. For example: Pod + GetKind() schema.GroupVersionKind + // GetUserInfo is information about the requesting user + GetUserInfo() user.Info +} diff --git a/vendor/k8s.io/apiserver/pkg/authorization/authorizerfactory/builtin.go b/vendor/k8s.io/apiserver/pkg/authorization/authorizerfactory/builtin.go index b3b1f09a6f..2605db81b5 100644 --- a/vendor/k8s.io/apiserver/pkg/authorization/authorizerfactory/builtin.go +++ b/vendor/k8s.io/apiserver/pkg/authorization/authorizerfactory/builtin.go @@ -24,6 +24,9 @@ import ( "k8s.io/apiserver/pkg/authorization/authorizer" ) +var _ = authorizer.Authorizer(alwaysAllowAuthorizer{}) +var _ = authorizer.RuleResolver(alwaysAllowAuthorizer{}) + // alwaysAllowAuthorizer is an implementation of authorizer.Attributes // which always says yes to an authorization request. // It is useful in tests and when using kubernetes in an open manner. @@ -33,6 +36,16 @@ func (alwaysAllowAuthorizer) Authorize(ctx context.Context, a authorizer.Attribu return authorizer.DecisionAllow, "", nil } +// ConditionsAwareAuthorize is not conditions-aware, converts the Authorize decision. +func (a alwaysAllowAuthorizer) ConditionsAwareAuthorize(ctx context.Context, attrs authorizer.Attributes) authorizer.ConditionsAwareDecision { + return authorizer.ConditionsAwareDecisionFromParts(a.Authorize(ctx, attrs)) +} + +// EvaluateConditions is not supported by this authorizer. +func (alwaysAllowAuthorizer) EvaluateConditions(_ context.Context, _ authorizer.ConditionsAwareDecision, _ authorizer.ConditionsData) (authorizer.Decision, string, error) { + return authorizer.DecisionDeny, "", authorizer.ErrorConditionEvaluationNotSupported +} + func (alwaysAllowAuthorizer) RulesFor(ctx context.Context, user user.Info, namespace string) ([]authorizer.ResourceRuleInfo, []authorizer.NonResourceRuleInfo, bool, error) { return []authorizer.ResourceRuleInfo{ &authorizer.DefaultResourceRuleInfo{ @@ -52,6 +65,9 @@ func NewAlwaysAllowAuthorizer() *alwaysAllowAuthorizer { return new(alwaysAllowAuthorizer) } +var _ = authorizer.Authorizer(alwaysDenyAuthorizer{}) +var _ = authorizer.RuleResolver(alwaysDenyAuthorizer{}) + // alwaysDenyAuthorizer is an implementation of authorizer.Attributes // which always says no to an authorization request. // It is useful in unit tests to force an operation to be forbidden. @@ -61,6 +77,16 @@ func (alwaysDenyAuthorizer) Authorize(ctx context.Context, a authorizer.Attribut return authorizer.DecisionNoOpinion, "Everything is forbidden.", nil } +// ConditionsAwareAuthorize is not conditions-aware, converts the Authorize decision. +func (d alwaysDenyAuthorizer) ConditionsAwareAuthorize(ctx context.Context, attrs authorizer.Attributes) authorizer.ConditionsAwareDecision { + return authorizer.ConditionsAwareDecisionFromParts(d.Authorize(ctx, attrs)) +} + +// EvaluateConditions is not supported by this authorizer. +func (alwaysDenyAuthorizer) EvaluateConditions(_ context.Context, _ authorizer.ConditionsAwareDecision, _ authorizer.ConditionsData) (authorizer.Decision, string, error) { + return authorizer.DecisionDeny, "", authorizer.ErrorConditionEvaluationNotSupported +} + func (alwaysDenyAuthorizer) RulesFor(ctx context.Context, user user.Info, namespace string) ([]authorizer.ResourceRuleInfo, []authorizer.NonResourceRuleInfo, bool, error) { return []authorizer.ResourceRuleInfo{}, []authorizer.NonResourceRuleInfo{}, false, nil } @@ -69,10 +95,22 @@ func NewAlwaysDenyAuthorizer() *alwaysDenyAuthorizer { return new(alwaysDenyAuthorizer) } +var _ = authorizer.Authorizer(&privilegedGroupAuthorizer{}) + type privilegedGroupAuthorizer struct { groups []string } +// ConditionsAwareAuthorize is not conditions-aware, converts the Authorize decision. +func (r *privilegedGroupAuthorizer) ConditionsAwareAuthorize(ctx context.Context, attr authorizer.Attributes) authorizer.ConditionsAwareDecision { + return authorizer.ConditionsAwareDecisionFromParts(r.Authorize(ctx, attr)) +} + +// EvaluateConditions is not supported by this authorizer. +func (r *privilegedGroupAuthorizer) EvaluateConditions(_ context.Context, _ authorizer.ConditionsAwareDecision, _ authorizer.ConditionsData) (authorizer.Decision, string, error) { + return authorizer.DecisionDeny, "", authorizer.ErrorConditionEvaluationNotSupported +} + func (r *privilegedGroupAuthorizer) Authorize(ctx context.Context, attr authorizer.Attributes) (authorizer.Decision, string, error) { if attr.GetUser() == nil { return authorizer.DecisionNoOpinion, "Error", errors.New("no user on request.") diff --git a/vendor/k8s.io/apiserver/pkg/authorization/cel/compile.go b/vendor/k8s.io/apiserver/pkg/authorization/cel/compile.go index 04acda157b..a4602322e4 100644 --- a/vendor/k8s.io/apiserver/pkg/authorization/cel/compile.go +++ b/vendor/k8s.io/apiserver/pkg/authorization/cel/compile.go @@ -28,8 +28,6 @@ import ( "k8s.io/apimachinery/pkg/util/version" apiservercel "k8s.io/apiserver/pkg/cel" "k8s.io/apiserver/pkg/cel/environment" - genericfeatures "k8s.io/apiserver/pkg/features" - utilfeature "k8s.io/apiserver/pkg/util/feature" ) const ( @@ -229,10 +227,8 @@ func buildResourceAttributesType(field func(name string, declType *apiservercel. field("subresource", apiservercel.StringType, false), field("name", apiservercel.StringType, false), } - if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.AuthorizeWithSelectors) { - resourceAttributesFields = append(resourceAttributesFields, field("fieldSelector", buildFieldSelectorType(field, fields), false)) - resourceAttributesFields = append(resourceAttributesFields, field("labelSelector", buildLabelSelectorType(field, fields), false)) - } + resourceAttributesFields = append(resourceAttributesFields, field("fieldSelector", buildFieldSelectorType(field, fields), false)) + resourceAttributesFields = append(resourceAttributesFields, field("labelSelector", buildLabelSelectorType(field, fields), false)) return apiservercel.NewObjectType("kubernetes.ResourceAttributes", fields(resourceAttributesFields...)) } diff --git a/vendor/k8s.io/apiserver/pkg/authorization/union/union.go b/vendor/k8s.io/apiserver/pkg/authorization/union/union.go index 0e5007cfa2..fee6da5851 100644 --- a/vendor/k8s.io/apiserver/pkg/authorization/union/union.go +++ b/vendor/k8s.io/apiserver/pkg/authorization/union/union.go @@ -26,19 +26,50 @@ package union import ( "context" + "errors" + "fmt" "strings" utilerrors "k8s.io/apimachinery/pkg/util/errors" + "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apiserver/pkg/authentication/user" "k8s.io/apiserver/pkg/authorization/authorizer" ) +var _ = authorizer.Authorizer(unionAuthzHandler{}) + // unionAuthzHandler authorizer against a chain of authorizer.Authorizer -type unionAuthzHandler []authorizer.Authorizer +type unionAuthzHandler struct { + chain []NamedAuthorizer + nameToAuthorizer map[string]authorizer.Authorizer +} + +// NamedAuthorizer is a (string, Authorizer) tuple that associates each +// Authorizer with a name, that must be unique locally within one union +// authorizer. Each authorizer must be non-nil. +type NamedAuthorizer struct { + AuthorizerName string + Authorizer authorizer.Authorizer +} // New returns an authorizer that authorizes against a chain of authorizer.Authorizer objects -func New(authorizationHandlers ...authorizer.Authorizer) authorizer.Authorizer { - return unionAuthzHandler(authorizationHandlers) +func New(authorizationHandlers ...NamedAuthorizer) (authorizer.Authorizer, error) { + nameToAuthorizer := make(map[string]authorizer.Authorizer, len(authorizationHandlers)) + for _, handler := range authorizationHandlers { + if len(handler.AuthorizerName) == 0 { + return nil, fmt.Errorf("empty AuthorizerName in union.New is invalid") + } + + if _, duplicateName := nameToAuthorizer[handler.AuthorizerName]; duplicateName { + return nil, fmt.Errorf("duplicate AuthorizerName %q in union.New", handler.AuthorizerName) + } + + nameToAuthorizer[handler.AuthorizerName] = handler.Authorizer + } + return unionAuthzHandler{ + chain: authorizationHandlers, + nameToAuthorizer: nameToAuthorizer, + }, nil } // Authorizes against a chain of authorizer.Authorizer objects and returns nil if successful and returns error if unsuccessful @@ -48,14 +79,14 @@ func (authzHandler unionAuthzHandler) Authorize(ctx context.Context, a authorize reasonlist []string ) - for _, currAuthzHandler := range authzHandler { - decision, reason, err := currAuthzHandler.Authorize(ctx, a) + for _, currAuthzHandler := range authzHandler.chain { + decision, reason, err := currAuthzHandler.Authorizer.Authorize(ctx, a) if err != nil { errlist = append(errlist, err) } if len(reason) != 0 { - reasonlist = append(reasonlist, reason) + reasonlist = append(reasonlist, fmt.Sprintf("%s: %s", currAuthzHandler.AuthorizerName, reason)) } switch decision { case authorizer.DecisionAllow, authorizer.DecisionDeny: @@ -68,6 +99,100 @@ func (authzHandler unionAuthzHandler) Authorize(ctx context.Context, a authorize return authorizer.DecisionNoOpinion, strings.Join(reasonlist, "\n"), utilerrors.NewAggregate(errlist) } +// ConditionsAwareAuthorize uses the chain of sub-authorizers to authorize the request with the given attributes, +// potentially returning a Union-typed ConditionsAwareDecision if the sub-authorizer return conditional decisions. +func (authzHandler unionAuthzHandler) ConditionsAwareAuthorize(ctx context.Context, a authorizer.Attributes) authorizer.ConditionsAwareDecision { + var decisions authorizer.ConditionsAwareDecisionUnion + + for _, currAuthzHandler := range authzHandler.chain { + // Precondition: All previously seen leaf decisions were either of NoOpinion or ConditionsMap type. + + // Call the authorizer on its conditions-aware method, and add the decision to the slice, + // regardless of type. This due to that later in EvaluateConditions, the decision index + // in the slice is what correlates a decision with the authorizer that should be used + // for evaluating it (if needed). + decision := currAuthzHandler.Authorizer.ConditionsAwareAuthorize(ctx, a) + decisions.Add(currAuthzHandler.AuthorizerName, decision) + + // If there is any Allow/Deny decision leaf, no need to walk the chain further. + if decision.ContainsUnconditionalAllowOrDeny() { + return decisions.ToDecision() + } + // => all leaves are NoOpinion or ConditionsMap, continue to the next authorizer + } + + // If we reached here, all leaf decisions were either of NoOpinion or ConditionsMap type. + // If all decisions were NoOpinions, the constructor folds into a single NoOpinion decision. + return decisions.ToDecision() +} + +// EvaluateConditions evaluates a Union-typed unevaluatedDecision returned from ConditionsAwareAuthorize using the +// union authorizer's sub-authorizer chain and the provided data. +func (authzHandler unionAuthzHandler) EvaluateConditions(ctx context.Context, unevaluatedDecision authorizer.ConditionsAwareDecision, data authorizer.ConditionsData) (authorizer.Decision, string, error) { + // This should never happen, an authorizer shall only be called back on the union unevaluatedDecision that was returned from + // AuthorizeConditionsAware(). The caller should never call EvaluateConditions on an Allow/Deny/NoOpinion + if !unevaluatedDecision.IsUnion() { + return unevaluatedDecision.FailureDecision(), "failed closed", errors.New("the union authorizer can only evaluate union ConditionsAwareDecisions") + } + + // This logic directly maps 1:1 with Authorize(), now that we get unconditional responses from the evaluation process. + var ( + errlist []error + reasonlist []string + ) + + for currentAuthorizerName, unevaluatedSubDecision := range unevaluatedDecision.UnionedDecisions() { + // Precondition: All previously seen leaf decisions were or evaluated to NoOpinion, or some unrecognized mode. + + var decision authorizer.Decision + var reason string + var err error + switch { + // If we get to an Allow or Deny in the union chain, we have our answer. + case unevaluatedSubDecision.IsDeny(): + return authorizer.DecisionDeny, unevaluatedSubDecision.Reason(), unevaluatedSubDecision.Error() + case unevaluatedSubDecision.IsAllow(): + return authorizer.DecisionAllow, unevaluatedSubDecision.Reason(), unevaluatedSubDecision.Error() + // NoOpinions cannot be evaluated, but we should make sure to save the reason and error. + case unevaluatedSubDecision.IsNoOpinion(): + decision, reason, err = authorizer.DecisionNoOpinion, unevaluatedSubDecision.Reason(), unevaluatedSubDecision.Error() + // ConditionsMap or Union types are evaluated by their authorizer + case unevaluatedSubDecision.IsConditionsMap(), unevaluatedSubDecision.IsUnion(): + decision, reason, err = authzHandler.evaluateConditions(ctx, currentAuthorizerName, unevaluatedSubDecision, data) + // Guard against impossible evaluations. + if !unevaluatedSubDecision.PossibleDecisions().Has(decision) { + decision, reason, err = unevaluatedSubDecision.FailureDecision(), "failed closed", fmt.Errorf("evaluated to decision %s, but only %v were possible", decision, sets.List(unevaluatedSubDecision.PossibleDecisions())) + } + default: + return unevaluatedDecision.FailureDecision(), "failed closed", fmt.Errorf("saw unrecognized subDecision in union authorizer EvaluateConditions: %s", unevaluatedSubDecision) + } + + switch decision { + case authorizer.DecisionAllow, authorizer.DecisionDeny: + return decision, reason, err + case authorizer.DecisionNoOpinion: + // continue to the next authorizer, save the errors and reason for later + + if err != nil { + errlist = append(errlist, err) + } + if len(reason) != 0 { + reasonlist = append(reasonlist, fmt.Sprintf("%s: %s", currentAuthorizerName, reason)) + } + } + } + + return authorizer.DecisionNoOpinion, strings.Join(reasonlist, "\n"), utilerrors.NewAggregate(errlist) +} + +func (authzHandler unionAuthzHandler) evaluateConditions(ctx context.Context, authorizerName string, unevaluatedSubDecision authorizer.ConditionsAwareDecision, data authorizer.ConditionsData) (authorizer.Decision, string, error) { + authorizer, ok := authzHandler.nameToAuthorizer[authorizerName] + if !ok { + return unevaluatedSubDecision.FailureDecision(), "failed closed", fmt.Errorf("couldn't find authorizer with name: %q", authorizerName) + } + return authorizer.EvaluateConditions(ctx, unevaluatedSubDecision, data) +} + // unionAuthzRulesHandler authorizer against a chain of authorizer.RuleResolver type unionAuthzRulesHandler []authorizer.RuleResolver diff --git a/vendor/k8s.io/apiserver/pkg/cel/common/valuesreflect.go b/vendor/k8s.io/apiserver/pkg/cel/common/valuesreflect.go index 36f38b3edc..2ff920bd65 100644 --- a/vendor/k8s.io/apiserver/pkg/cel/common/valuesreflect.go +++ b/vendor/k8s.io/apiserver/pkg/cel/common/valuesreflect.go @@ -19,13 +19,16 @@ package common import ( "encoding/json" "fmt" + "reflect" + "sync" + + "sigs.k8s.io/structured-merge-diff/v6/value" + apiequality "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" - "reflect" - "sigs.k8s.io/structured-merge-diff/v6/value" - "sync" + "k8s.io/apiserver/pkg/cel" "github.com/google/cel-go/common/types" "github.com/google/cel-go/common/types/ref" @@ -105,7 +108,7 @@ func TypedToVal(val interface{}, schema Schema) ref.Val { switch listType { case "map": mapKeys := schema.XListMapKeys() - return &typedMapList{typedList: typedList, escapedKeyProps: escapeKeyProps(mapKeys)} + return &typedMapList{typedList: typedList, keyProps: mapKeys, escapedKeyProps: escapeKeyProps(mapKeys)} case "set": return &typedSetList{typedList: typedList} case "atomic": @@ -151,7 +154,8 @@ func TypedToVal(val interface{}, schema Schema) ref.Val { type typedStruct struct { value reflect.Value // Kind is required to be: reflect.Struct - // propSchema finds the schema to use for a particular map key. + // propSchema finds the schema for a given key. + // The key is an unescaped JSON name, not an escaped CEL identifier. propSchema func(key string) (Schema, bool) } @@ -198,37 +202,46 @@ func (s *typedStruct) Value() interface{} { return s.value.Interface() } -func (s *typedStruct) IsSet(field ref.Val) ref.Val { - v, found := s.lookupField(field) +// IsSet returns true if the field is set. escapedField must be a types.String containing the +// escaped CEL identifier. For example, "__if__" for JSON name "if". +func (s *typedStruct) IsSet(escapedField ref.Val) ref.Val { + v, found := s.lookupField(escapedField) if v != nil && types.IsUnknownOrError(v) { return v } return types.Bool(found) } -func (s *typedStruct) Get(key ref.Val) ref.Val { - v, found := s.lookupField(key) +// Get returns the value of a field. escapedKey must be a types.String containing the +// escaped CEL identifier. For example, "__if__" for JSON name "if". +func (s *typedStruct) Get(escapedKey ref.Val) ref.Val { + v, found := s.lookupField(escapedKey) if !found { - return types.NewErr("no such key: %v", key) + return types.NewErr("no such key: %v", escapedKey) } return v } -func (s *typedStruct) lookupField(key ref.Val) (ref.Val, bool) { - keyStr, ok := key.(types.String) +// lookupField finds a field by name. escapedKey must be a types.String containing the escaped +// CEL identifier of the field name. For example, "__if__" for JSON name "if". +func (s *typedStruct) lookupField(escapedKey ref.Val) (ref.Val, bool) { + escapedKeyStr, ok := escapedKey.(types.String) if !ok { - return types.MaybeNoSuchOverloadErr(key), true + return types.MaybeNoSuchOverloadErr(escapedKey), true + } + unescapedFieldName, ok := cel.Unescape(escapedKeyStr.Value().(string)) + if !ok { + return nil, false } - fieldName := keyStr.Value().(string) cacheEntry := value.TypeReflectEntryOf(s.value.Type()) - fieldCache, ok := cacheEntry.Fields()[fieldName] + fieldCache, ok := cacheEntry.Fields()[unescapedFieldName] if !ok { return nil, false } if e := fieldCache.GetFrom(s.value); !fieldCache.CanOmit(e) { - if propSchema, ok := s.propSchema(fieldName); ok { + if propSchema, ok := s.propSchema(unescapedFieldName); ok { v := TypedToVal(e.Interface(), propSchema) if v == types.NullValue { return nil, false @@ -273,7 +286,7 @@ func (t *typedList) Equal(other ref.Val) ref.Val { if sz != oList.Size() { return types.False } - for i := types.Int(0); i < sz; i++ { + for i := range types.Int(sz) { eq := t.Get(i).Equal(oList.Get(i)) if eq != types.True { return eq // either false or error @@ -287,7 +300,7 @@ func (t *typedList) Type() ref.Type { } func (t *typedList) Value() interface{} { - return t.value + return t.value.Interface() } func (t *typedList) Add(other ref.Val) ref.Val { @@ -295,13 +308,16 @@ func (t *typedList) Add(other ref.Val) ref.Val { if !ok { return types.MaybeNoSuchOverloadErr(other) } - resultValue := t.value + sz := t.value.Len() + otherSz, _ := oList.Size().(types.Int) + elements := make([]ref.Val, 0, sz+int(otherSz)) + for i := range sz { + elements = append(elements, t.Get(types.Int(i))) + } for it := oList.Iterator(); it.HasNext() == types.True; { - next := it.Next().Value() - resultValue = reflect.Append(resultValue, reflect.ValueOf(next)) + elements = append(elements, it.Next()) } - - return &typedList{value: resultValue, itemsSchema: t.itemsSchema} + return types.NewRefValList(types.DefaultTypeAdapter, elements) } func (t *typedList) Contains(val ref.Val) ref.Val { @@ -310,7 +326,7 @@ func (t *typedList) Contains(val ref.Val) ref.Val { } var err ref.Val sz := t.value.Len() - for i := 0; i < sz; i++ { + for i := range sz { elem := TypedToVal(t.value.Index(i).Interface(), t.itemsSchema) cmp := elem.Equal(val) b, ok := cmp.(types.Bool) @@ -342,7 +358,7 @@ func (t *typedList) Get(idx ref.Val) ref.Val { func (t *typedList) Iterator() traits.Iterator { elements := make([]ref.Val, t.value.Len()) sz := t.value.Len() - for i := 0; i < sz; i++ { + for i := range sz { elements[i] = TypedToVal(t.value.Index(i).Interface(), t.itemsSchema) } return &sliceIter{typedList: t, elements: elements} @@ -373,6 +389,10 @@ func (it *sliceIter) Next() ref.Val { type typedMapList struct { typedList + // keyProps are unescaped JSON property names + keyProps []string + + // escapedKeyProps are escaped CEL identifiers escapedKeyProps []string sync.Once // for lazy load of mapOfList since it is only needed if Equals is called @@ -383,7 +403,7 @@ func (t *typedMapList) getMap() map[interface{}]interface{} { t.Do(func() { sz := t.value.Len() t.mapOfList = make(map[interface{}]interface{}, sz) - for i := types.Int(0); i < types.Int(sz); i++ { + for i := range types.Int(sz) { v := t.Get(i) e := reflect.ValueOf(v.Value()) t.mapOfList[t.toMapKey(e)] = e.Interface() @@ -401,32 +421,50 @@ func (t *typedMapList) toMapKey(element reflect.Value) interface{} { } cacheEntry := value.TypeReflectEntryOf(element.Type()) var fieldEntries []*value.FieldCacheEntry - for i := 0; i < len(t.escapedKeyProps); i++ { - if ce, ok := cacheEntry.Fields()[t.escapedKeyProps[i]]; !ok { + for i := range len(t.keyProps) { + if ce, ok := cacheEntry.Fields()[t.keyProps[i]]; !ok { // Fields() is keyed by unescaped JSON property names. return types.NewErr("unexpected data format for element of array with x-kubernetes-list-type=map: %T", element) } else { fieldEntries = append(fieldEntries, ce) } } + getKeyValue := func(fieldEntry *value.FieldCacheEntry) interface{} { + v := fieldEntry.GetFrom(element) + for v.Kind() == reflect.Pointer { + if v.IsNil() { + return nil + } + v = v.Elem() + } + raw := v.Interface() + if raw != nil && !reflect.TypeOf(raw).Comparable() { + // %#v includes type information and quotes strings, so the + // serialized form cannot collide with a comparable raw value. + return fmt.Sprintf("%#v", raw) + } + return raw + } + // Arrays are comparable in go and may be used as map keys, but maps and slices are not. // So we can special case small numbers of key props as arrays and fall back to serialization // for larger numbers of key props if len(fieldEntries) == 1 { - return fieldEntries[0].GetFrom(element).Interface() + return getKeyValue(fieldEntries[0]) } if len(fieldEntries) == 2 { - return [2]interface{}{fieldEntries[0].GetFrom(element).Interface(), fieldEntries[1].GetFrom(element).Interface()} + return [2]interface{}{getKeyValue(fieldEntries[0]), getKeyValue(fieldEntries[1])} } if len(fieldEntries) == 3 { - return [3]interface{}{fieldEntries[0].GetFrom(element).Interface(), fieldEntries[1].GetFrom(element).Interface(), fieldEntries[3].GetFrom(element).Interface()} + return [3]interface{}{getKeyValue(fieldEntries[0]), getKeyValue(fieldEntries[1]), getKeyValue(fieldEntries[2])} } key := make([]interface{}, len(fieldEntries)) for i := range fieldEntries { - key[i] = fieldEntries[i].GetFrom(element).Interface() + key[i] = getKeyValue(fieldEntries[i]) } - return fmt.Sprintf("%v", key) + // Serialize to a string for more than 3 keys. %#v quotes strings. + return fmt.Sprintf("%#v", key) } // Equal on a map list ignores list element order. @@ -440,6 +478,7 @@ func (t *typedMapList) Equal(other ref.Val) ref.Val { return types.False } tMap := t.getMap() + seen := make(map[interface{}]struct{}, len(tMap)) for it := oMapList.Iterator(); it.HasNext() == types.True; { v := it.Next() k := t.toMapKey(reflect.ValueOf(v.Value())) @@ -451,44 +490,150 @@ func (t *typedMapList) Equal(other ref.Val) ref.Val { if eq != types.True { return eq // either false or error } + seen[k] = struct{}{} } - return types.True + return types.Bool(len(seen) == len(tMap)) } // Add for a map list `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values // are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with // non-intersecting keys are appended, retaining their partial order. func (t *typedMapList) Add(other ref.Val) ref.Val { - sliceType := t.value.Type() - elementType := sliceType.Elem() oMapList, ok := other.(traits.Lister) if !ok { return types.MaybeNoSuchOverloadErr(other) } sz := t.value.Len() - elements := reflect.MakeSlice(sliceType, sz, sz) - keyToIdx := map[interface{}]int{} - for i := 0; i < sz; i++ { - e := t.Get(types.Int(i)).Value() - re := reflect.ValueOf(e) - k := t.toMapKey(re) - keyToIdx[k] = i - elements.Index(i).Set(re.Convert(elementType)) - } - for it := oMapList.Iterator(); it.HasNext() == types.True; { - e := it.Next() - re := reflect.ValueOf(e.Value()) - k := t.toMapKey(re) + elements := make([]ref.Val, sz) + for i := range sz { + elements[i] = t.Get(types.Int(i)) + } + return addToMapList(elements, oMapList, t.escapedKeyProps) +} + +// addToMapList merges the elements of other into the given map list elements +// according to x-kubernetes-list-type=map semantics: elements of other with +// intersecting keys overwrite the matching entries of elements in place, and +// elements with non-intersecting keys are appended. elements may be mutated in +// place and may be appended to, so callers must not retain or reuse elements +// after the call. +// +// escapedKeyProps must contain the escaped CEL identifiers keys. +func addToMapList(elements []ref.Val, other traits.Lister, escapedKeyProps []string) ref.Val { + keyToIdx := make(map[interface{}]int, len(elements)) + for i, e := range elements { + keyToIdx[refValMapKey(e, escapedKeyProps)] = i + } + for it := other.Iterator(); it.HasNext() == types.True; { + v := it.Next() + k := refValMapKey(v, escapedKeyProps) if overwritePosition, ok := keyToIdx[k]; ok { - elements.Index(overwritePosition).Set(re) + elements[overwritePosition] = v } else { - elements = reflect.Append(elements, re.Convert(elementType)) + elements = append(elements, v) } } - return &typedMapList{ - typedList: typedList{value: elements, itemsSchema: t.itemsSchema}, - escapedKeyProps: t.escapedKeyProps, + return &refValMapList{ + Lister: types.NewRefValList(types.DefaultTypeAdapter, elements), + escapedKeyProps: escapedKeyProps, + } +} + +// refValMapKey returns a valid golang map key for the given element of a map list. +// escapedKeyProps must contain the escaped CEL identifiers of the keys. +func refValMapKey(element ref.Val, escapedKeyProps []string) interface{} { + get := func(escapedProp string) interface{} { + key := types.String(escapedProp) + var v ref.Val + var found bool + switch e := element.(type) { + case traits.Mapper: + v, found = e.Find(key) + case traits.Indexer: + if tester, ok := element.(traits.FieldTester); ok { + found = tester.IsSet(key) == types.True + } + if found { + v = e.Get(key) + } + } + if !found || v == nil || types.IsUnknownOrError(v) { + return nil + } + raw := v.Value() + if raw != nil && !reflect.TypeOf(raw).Comparable() { + // %#v includes type information and quotes strings, so the + // serialized form cannot collide with a comparable raw value. + return fmt.Sprintf("%#v", raw) + } + return raw + } + + if len(escapedKeyProps) == 1 { + return get(escapedKeyProps[0]) + } + if len(escapedKeyProps) == 2 { + return [2]interface{}{get(escapedKeyProps[0]), get(escapedKeyProps[1])} + } + if len(escapedKeyProps) == 3 { + return [3]interface{}{get(escapedKeyProps[0]), get(escapedKeyProps[1]), get(escapedKeyProps[2])} + } + + key := make([]interface{}, len(escapedKeyProps)) + for i, kf := range escapedKeyProps { + key[i] = get(kf) + } + // Serialize to a string for more than 3 keys. %#v quotes strings. + return fmt.Sprintf("%#v", key) +} + +type refValMapList struct { + traits.Lister + escapedKeyProps []string +} + +func (l *refValMapList) Add(other ref.Val) ref.Val { + oMapList, ok := other.(traits.Lister) + if !ok { + return types.MaybeNoSuchOverloadErr(other) + } + sz, _ := l.Size().(types.Int) + elements := make([]ref.Val, int(sz)) + for i := range types.Int(sz) { + elements[i] = l.Get(i) + } + return addToMapList(elements, oMapList, l.escapedKeyProps) +} + +func (l *refValMapList) Equal(other ref.Val) ref.Val { + oMapList, ok := other.(traits.Lister) + if !ok { + return types.MaybeNoSuchOverloadErr(other) + } + sz, _ := l.Size().(types.Int) + if sz != oMapList.Size() { + return types.False + } + keyToElement := make(map[interface{}]ref.Val, int(sz)) + for i := range types.Int(sz) { + e := l.Get(i) + keyToElement[refValMapKey(e, l.escapedKeyProps)] = e + } + seen := make(map[interface{}]struct{}, int(sz)) + for it := oMapList.Iterator(); it.HasNext() == types.True; { + v := it.Next() + k := refValMapKey(v, l.escapedKeyProps) + e, ok := keyToElement[k] + if !ok { + return types.False + } + eq := e.Equal(v) + if eq != types.True { + return eq + } + seen[k] = struct{}{} } + return types.Bool(len(seen) == len(keyToElement)) } type typedSetList struct { @@ -496,23 +641,26 @@ type typedSetList struct { sync.Once // for lazy load of setOfList since it is only needed if Equals is called set map[interface{}]struct{} + setErr ref.Val } -func (t *typedSetList) getSet() map[interface{}]struct{} { - // sets are only allowed to contain scalar elements, which are comparable in go, and can safely be used as - // golang map keys +func (t *typedSetList) getSet() (map[interface{}]struct{}, ref.Val) { t.Do(func() { sz := t.value.Len() t.set = make(map[interface{}]struct{}, sz) - for i := types.Int(0); i < types.Int(sz); i++ { - e := t.Get(i).Value() - t.set[e] = struct{}{} + for i := range types.Int(sz) { + k, err := setElementKey(t.Get(i)) + if err != nil { + t.set, t.setErr = nil, err + return + } + t.set[k] = struct{}{} } }) - return t.set + return t.set, t.setErr } -// Equal on a map list ignores list element order. +// Equal on a set list ignores list element order. func (t *typedSetList) Equal(other ref.Val) ref.Val { oSetList, ok := other.(traits.Lister) if !ok { @@ -522,45 +670,130 @@ func (t *typedSetList) Equal(other ref.Val) ref.Val { if sz != oSetList.Size() { return types.False } - tSet := t.getSet() + tSet, err := t.getSet() + if err != nil { + return err + } + seen := make(map[interface{}]struct{}, len(tSet)) for it := oSetList.Iterator(); it.HasNext() == types.True; { - next := it.Next().Value() - _, ok := tSet[next] - if !ok { + k, err := setElementKey(it.Next()) + if err != nil { + return err + } + if _, ok := tSet[k]; !ok { return types.False } + seen[k] = struct{}{} } - return types.True + return types.Bool(len(seen) == len(tSet)) } // Add for a set list `X + Y` performs a union where the array positions of all elements in `X` are preserved and // non-intersecting elements in `Y` are appended, retaining their partial order. func (t *typedSetList) Add(other ref.Val) ref.Val { - setType := t.value.Type() - elementType := setType.Elem() oSetList, ok := other.(traits.Lister) if !ok { return types.MaybeNoSuchOverloadErr(other) } sz := t.value.Len() - elements := reflect.MakeSlice(setType, sz, sz) - for i := 0; i < sz; i++ { - e := t.Get(types.Int(i)).Value() - re := reflect.ValueOf(e) - elements.Index(i).Set(re.Convert(elementType)) + elements := make([]ref.Val, sz) + for i := range sz { + elements[i] = t.Get(types.Int(i)) + } + return addToSetList(elements, oSetList) +} + +// addToSetList unions the elements of other into the given set list elements +// according to x-kubernetes-list-type=set semantics: the array positions of +// elements are preserved, and elements of other that are not already present +// are appended to maintain partial order. elements may be appended to, +// so callers must not retain or reuse elements after the call. +func addToSetList(elements []ref.Val, other traits.Lister) ref.Val { + set := make(map[interface{}]struct{}, len(elements)) + for _, e := range elements { + k, err := setElementKey(e) + if err != nil { + return err + } + set[k] = struct{}{} } - set := t.getSet() - for it := oSetList.Iterator(); it.HasNext() == types.True; { - e := it.Next().Value() - re := reflect.ValueOf(e) - if _, ok := set[e]; !ok { - set[e] = struct{}{} - elements = reflect.Append(elements, re.Convert(elementType)) + for it := other.Iterator(); it.HasNext() == types.True; { + v := it.Next() + k, err := setElementKey(v) + if err != nil { + return err + } + if _, exists := set[k]; !exists { + set[k] = struct{}{} + elements = append(elements, v) } } - return &typedSetList{ - typedList: typedList{value: elements, itemsSchema: t.itemsSchema}, + return &refValSetList{Lister: types.NewRefValList(types.DefaultTypeAdapter, elements)} +} + +// setElementKey returns a valid golang map key for the given element of a set list. +// Set elements are expected to be scalars; if the element is a non-scalar an error is returned. +func setElementKey(element ref.Val) (value interface{}, err ref.Val) { + switch element.(type) { + case traits.Lister, traits.Mapper: + return nil, types.NewErr("listSet operations are only supported on lists of scalar values") + } + raw := element.Value() + if raw != nil && !reflect.TypeOf(raw).Comparable() { + // %#v includes type information and quotes strings, so the + // serialized form cannot collide with a comparable raw value. + return fmt.Sprintf("%#v", raw), nil } + return raw, nil +} + +type refValSetList struct { + traits.Lister +} + +func (l *refValSetList) Add(other ref.Val) ref.Val { + oSetList, ok := other.(traits.Lister) + if !ok { + return types.MaybeNoSuchOverloadErr(other) + } + sz, _ := l.Size().(types.Int) + elements := make([]ref.Val, int(sz)) + for i := range sz { + elements[i] = l.Get(i) + } + return addToSetList(elements, oSetList) +} + +// Equal on a set list ignores list element order. +func (l *refValSetList) Equal(other ref.Val) ref.Val { + oSetList, ok := other.(traits.Lister) + if !ok { + return types.MaybeNoSuchOverloadErr(other) + } + sz, _ := l.Size().(types.Int) + if sz != oSetList.Size() { + return types.False + } + set := make(map[interface{}]struct{}, int(sz)) + for i := range sz { + k, err := setElementKey(l.Get(i)) + if err != nil { + return err + } + set[k] = struct{}{} + } + seen := make(map[interface{}]struct{}, len(set)) + for it := oSetList.Iterator(); it.HasNext() == types.True; { + k, err := setElementKey(it.Next()) + if err != nil { + return err + } + if _, exists := set[k]; !exists { + return types.False + } + seen[k] = struct{}{} + } + return types.Bool(len(seen) == len(set)) } type typedMap struct { @@ -572,7 +805,7 @@ type typedMap struct { func (t *typedMap) ConvertToNative(typeDesc reflect.Type) (interface{}, error) { switch typeDesc.Kind() { case reflect.Map: - return t.value, nil + return t.value.Interface(), nil default: return nil, fmt.Errorf("type conversion error from '%s' to '%s'", t.Type(), typeDesc) } @@ -617,7 +850,7 @@ func (t *typedMap) Type() ref.Type { } func (t *typedMap) Value() interface{} { - return t.value + return t.value.Interface() } func (t *typedMap) Contains(key ref.Val) ref.Val { @@ -641,6 +874,8 @@ func (t *typedMap) Size() ref.Val { return types.Int(t.value.Len()) } +// Find returns the value of the map entry for the given key, if present. The map keys +// are normal strings, not CEL identifiers, and are not escaped. func (t *typedMap) Find(key ref.Val) (ref.Val, bool) { keyStr, ok := key.(types.String) if !ok { diff --git a/vendor/k8s.io/apiserver/pkg/cel/common/valuesschemalesstyped.go b/vendor/k8s.io/apiserver/pkg/cel/common/valuesschemalesstyped.go new file mode 100644 index 0000000000..73ecdcbc6d --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/cel/common/valuesschemalesstyped.go @@ -0,0 +1,565 @@ +/* +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. +*/ + +package common + +import ( + "encoding/base64" + "fmt" + "reflect" + + "github.com/google/cel-go/common/types" + "github.com/google/cel-go/common/types/ref" + "github.com/google/cel-go/common/types/traits" + apiequality "k8s.io/apimachinery/pkg/api/equality" + "k8s.io/apimachinery/pkg/util/intstr" + "sigs.k8s.io/structured-merge-diff/v6/value" +) + +// SchemalessTypedToVal wraps a Go value as a CEL ref.Val. +// It mimics how the value would look if it were converted to an unstructured +// map using JSON serialization, but avoids the full allocation by lazily +// traversing the value via reflection and structured-merge-diff value package. +// +// It provides full functional equivalence to runtime.DefaultUnstructuredConverter.ToUnstructured. +// Any behavioral difference is a bug. The returned ref.Val utilizes internal caching +// for lazy reflection, which is not thread-safe and must only be used synchronously within a +// single CEL evaluation. +func SchemalessTypedToVal(val interface{}) ref.Val { + if val == nil { + return types.NullValue + } + + // Fast-path: immediately handle primitive types to completely bypass reflect.ValueOf overhead. + switch typedVal := val.(type) { + case bool: + return types.Bool(typedVal) + case string: + return types.String(typedVal) + case int: + return types.Int(typedVal) + case int32: + return types.Int(typedVal) + case int64: + return types.Int(typedVal) + case float32: + return types.Double(typedVal) + case float64: + return types.Double(typedVal) + case []byte: + if typedVal == nil { + return types.NullValue + } + return types.String(base64.StdEncoding.EncodeToString(typedVal)) + case intstr.IntOrString: + switch typedVal.Type { + case intstr.Int: + return types.Int(typedVal.IntVal) + case intstr.String: + return types.String(typedVal.StrVal) + } + } + + v := reflect.ValueOf(val) + if !v.IsValid() { + return types.NewErr("invalid data, got invalid reflect value: %v", v) + } + + switch v.Kind() { + case reflect.Pointer, reflect.Interface, reflect.Map, reflect.Slice: + if v.IsNil() { + return types.NullValue + } + } + + cacheEntry := value.TypeReflectEntryOf(v.Type()) + if cacheEntry.CanConvertToUnstructured() { + if !v.CanAddr() { + ptr := reflect.New(v.Type()) + ptr.Elem().Set(v) + v = ptr.Elem() + } + unstr, err := cacheEntry.ToUnstructured(v) + if err != nil { + return types.NewErr("failed to convert to unstructured: %v", err) + } + if unstr == nil { + return types.NullValue + } + return types.DefaultTypeAdapter.NativeToValue(unstr) + } + switch v.Kind() { + case reflect.Pointer: + if v.IsNil() { + return types.NullValue + } + return SchemalessTypedToVal(v.Elem().Interface()) + case reflect.Slice: + if v.Type().Elem().Kind() == reflect.Uint8 { // byte, relection return slice of Uint8 for bytes. + return types.String(base64.StdEncoding.EncodeToString(v.Bytes())) + } + return &reflectSchemalessTypedList{value: v} + case reflect.Map: + return &reflectSchemalessTypedMap{value: v} + case reflect.Struct: + return &reflectSchemalessTypedStruct{value: v} + // Match type aliases to primitives by kind + case reflect.Bool: + return types.Bool(v.Bool()) + case reflect.String: + return types.String(v.String()) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return types.Int(v.Int()) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + uVal := v.Uint() + if uVal > 9223372036854775807 { // math.MaxInt64 + return types.NewErr("unsigned value %d does not fit into int64 (overflow)", uVal) + } + return types.Int(uVal) + case reflect.Float32, reflect.Float64: + return types.Double(v.Float()) + default: + return types.NewErr("unsupported Go type for CEL: %v", v.Type()) + } +} + +var _ traits.Lister = &reflectSchemalessTypedList{} + +// reflectSchemalessTypedList wraps a Go slice/array as a lazy CEL Lister. +// fieldCache is NOT thread-safe, as CEL-Go's synchronous value evaluation contract +// guarantees that a single wrapped value is only ever accessed by a single goroutine. +type reflectSchemalessTypedList struct { + value reflect.Value + fieldCache []ref.Val +} + +func (l *reflectSchemalessTypedList) ConvertToNative(typeDesc reflect.Type) (interface{}, error) { + switch typeDesc.Kind() { + case reflect.Slice: + return l.value.Interface(), nil + default: + return nil, fmt.Errorf("type conversion error from '%s' to '%s'", l.Type(), typeDesc) + } +} + +func (l *reflectSchemalessTypedList) ConvertToType(typeValue ref.Type) ref.Val { + switch typeValue { + case types.ListType: + return l + case types.TypeType: + return types.ListType + } + return types.NewErr("type conversion error from '%s' to '%s'", l.Type(), typeValue.TypeName()) +} + +func (l *reflectSchemalessTypedList) Equal(other ref.Val) ref.Val { + otherList, ok := other.(traits.Lister) + if !ok { + return types.MaybeNoSuchOverloadErr(other) + } + sz := l.Size().(types.Int) + if sz != otherList.Size().(types.Int) { + return types.False + } + for i := range sz { + v1 := l.Get(i) + v2 := otherList.Get(i) + if v1.Equal(v2) != types.True { + return types.False + } + } + return types.True +} + +func (l *reflectSchemalessTypedList) Type() ref.Type { + return types.ListType +} + +func (l *reflectSchemalessTypedList) Value() interface{} { + return l.value.Interface() +} + +func (l *reflectSchemalessTypedList) Contains(val ref.Val) ref.Val { + sz := l.Size().(types.Int) + for i := range sz { + v := l.Get(i) + if v.Equal(val) == types.True { + return types.True + } + } + return types.False +} + +func (l *reflectSchemalessTypedList) Add(other ref.Val) ref.Val { + otherList, ok := other.(traits.Lister) + if !ok { + return types.MaybeNoSuchOverloadErr(other) + } + sz := l.value.Len() + otherSz, _ := otherList.Size().(types.Int) + elements := make([]ref.Val, 0, sz+int(otherSz)) + for i := range sz { + elements = append(elements, l.Get(types.Int(i))) + } + it := otherList.Iterator() + for it.HasNext() == types.True { + elements = append(elements, it.Next()) + } + return types.NewRefValList(types.DefaultTypeAdapter, elements) +} + +func (l *reflectSchemalessTypedList) Get(index ref.Val) ref.Val { + idx, ok := index.(types.Int) + if !ok { + return types.ValOrErr(index, "unsupported index type: %T", index) + } + if idx < 0 || int(idx) >= l.value.Len() { + return types.NewErr("index out of bounds: %d", idx) + } + i := int(idx) + if l.fieldCache == nil { + l.fieldCache = make([]ref.Val, l.value.Len()) + } + if cached := l.fieldCache[i]; cached != nil { + return cached + } + v := SchemalessTypedToVal(l.value.Index(i).Interface()) + l.fieldCache[i] = v + return v +} + +func (l *reflectSchemalessTypedList) Iterator() traits.Iterator { + return &reflectSchemalessTypedListIterator{reflectSchemalessTypedList: l, idx: 0} +} + +func (l *reflectSchemalessTypedList) Size() ref.Val { + return types.Int(l.value.Len()) +} + +type reflectSchemalessTypedListIterator struct { + *reflectSchemalessTypedList + idx int +} + +func (it *reflectSchemalessTypedListIterator) HasNext() ref.Val { + return types.Bool(it.idx < it.reflectSchemalessTypedList.value.Len()) +} + +func (it *reflectSchemalessTypedListIterator) Next() ref.Val { + if it.idx >= it.reflectSchemalessTypedList.value.Len() { + return types.NewErr("no more elements") + } + val := it.reflectSchemalessTypedList.Get(types.Int(it.idx)) + it.idx++ + return val +} + +var _ traits.Mapper = &reflectSchemalessTypedMap{} + +// reflectSchemalessTypedMap wraps a Go map as a lazy CEL Mapper. +// fieldCache is NOT thread-safe, as CEL-Go's synchronous value evaluation contract +// guarantees that a single wrapped value is only ever accessed by a single goroutine. +type reflectSchemalessTypedMap struct { + value reflect.Value + fieldCache map[string]ref.Val +} + +func (m *reflectSchemalessTypedMap) ConvertToNative(typeDesc reflect.Type) (interface{}, error) { + if m.value.Type().AssignableTo(typeDesc) { + return m.value.Interface(), nil + } + return nil, fmt.Errorf("type conversion error from '%s' to '%s'", m.Type(), typeDesc) +} + +func (m *reflectSchemalessTypedMap) ConvertToType(typeValue ref.Type) ref.Val { + switch typeValue { + case types.MapType: + return m + case types.TypeType: + return types.MapType + } + return types.NewErr("type conversion error from '%s' to '%s'", m.Type(), typeValue.TypeName()) +} + +func (m *reflectSchemalessTypedMap) Equal(other ref.Val) ref.Val { + otherMap, ok := other.(traits.Mapper) + if !ok { + return types.MaybeNoSuchOverloadErr(other) + } + if m.Size() != otherMap.Size() { + return types.False + } + it := m.Iterator() + for it.HasNext() == types.True { + key := it.Next() + v1, _ := m.Find(key) + v2, found := otherMap.Find(key) + if !found || v1.Equal(v2) != types.True { + return types.False + } + } + return types.True +} + +func (m *reflectSchemalessTypedMap) Type() ref.Type { + return types.MapType +} + +func (m *reflectSchemalessTypedMap) Value() interface{} { + return m.value.Interface() +} + +func (m *reflectSchemalessTypedMap) Contains(key ref.Val) ref.Val { + v, found := m.Find(key) + if v != nil && types.IsError(v) { + return v + } + return types.Bool(found) +} + +func (m *reflectSchemalessTypedMap) Find(key ref.Val) (ref.Val, bool) { + keyVal, ok := key.(types.String) + if !ok { + return types.ValOrErr(key, "unsupported map key type: %T", key), false + } + fieldName := string(keyVal) + if m.fieldCache != nil { + if cached, ok := m.fieldCache[fieldName]; ok { + return cached, cached != nil + } + } + + var result ref.Val + found := false + + keyType := m.value.Type().Key() + if keyType.Kind() == reflect.String { + reflectKey := reflect.ValueOf(fieldName).Convert(keyType) + val := m.value.MapIndex(reflectKey) + if val.IsValid() { + result = SchemalessTypedToVal(val.Interface()) + found = true + } + } + + if m.fieldCache == nil { + m.fieldCache = make(map[string]ref.Val) + } + m.fieldCache[fieldName] = result + return result, found +} + +func (m *reflectSchemalessTypedMap) Get(key ref.Val) ref.Val { + v, found := m.Find(key) + if !found { + if v != nil && types.IsError(v) { + return v + } + return types.ValOrErr(key, "no such key: %v", key) + } + return v +} + +func (m *reflectSchemalessTypedMap) Iterator() traits.Iterator { + return &reflectSchemalessTypedMapIterator{reflectSchemalessTypedMap: m, keys: m.value.MapKeys(), idx: 0} +} + +func (m *reflectSchemalessTypedMap) Size() ref.Val { + return types.Int(m.value.Len()) +} + +type reflectSchemalessTypedMapIterator struct { + *reflectSchemalessTypedMap + keys []reflect.Value + idx int +} + +func (it *reflectSchemalessTypedMapIterator) HasNext() ref.Val { + return types.Bool(it.idx < len(it.keys)) +} + +func (it *reflectSchemalessTypedMapIterator) Next() ref.Val { + if it.idx >= len(it.keys) { + return types.NewErr("no more elements") + } + val := types.String(it.keys[it.idx].String()) + it.idx++ + return val +} + +var _ traits.Mapper = &reflectSchemalessTypedStruct{} + +// reflectSchemalessTypedStruct wraps a Go struct as a lazy CEL Mapper. +// fieldCache is NOT thread-safe, as CEL-Go's synchronous value evaluation contract +// guarantees that a single wrapped value is only ever accessed by a single goroutine. +type reflectSchemalessTypedStruct struct { + value reflect.Value + fieldCache map[string]ref.Val +} + +func (s *reflectSchemalessTypedStruct) ConvertToNative(typeDesc reflect.Type) (interface{}, error) { + if s.value.Type().AssignableTo(typeDesc) { + return s.value.Interface(), nil + } + return nil, fmt.Errorf("type conversion error from struct type %v to %v", s.value.Type(), typeDesc) +} + +func (s *reflectSchemalessTypedStruct) ConvertToType(typeValue ref.Type) ref.Val { + switch typeValue { + case types.MapType: + return s + case types.TypeType: + return types.MapType + } + return types.NewErr("type conversion error from struct to %s", typeValue.TypeName()) +} + +func (s *reflectSchemalessTypedStruct) Equal(other ref.Val) ref.Val { + otherStruct, ok := other.(*reflectSchemalessTypedStruct) + if ok { + return types.Bool(apiequality.Semantic.DeepEqual(s.value.Interface(), otherStruct.value.Interface())) + } + otherMap, ok := other.(traits.Mapper) + if !ok { + return types.MaybeNoSuchOverloadErr(other) + } + if s.Size() != otherMap.Size() { + return types.False + } + it := s.Iterator() + for it.HasNext() == types.True { + key := it.Next() + v1, _ := s.Find(key) + v2, found := otherMap.Find(key) + if !found { + return types.False + } + eq := v1.Equal(v2) + if eq != types.True { + return eq + } + } + return types.True +} + +func (s *reflectSchemalessTypedStruct) Type() ref.Type { + return types.MapType // Unstructured behaves exactly as a Map +} + +func (s *reflectSchemalessTypedStruct) Value() interface{} { + return s.value.Interface() +} + +func (s *reflectSchemalessTypedStruct) IsSet(field ref.Val) ref.Val { + v, found := s.lookupField(field) + if v != nil && types.IsUnknownOrError(v) { + return v + } + return types.Bool(found) +} + +func (s *reflectSchemalessTypedStruct) Find(key ref.Val) (ref.Val, bool) { + return s.lookupField(key) +} + +func (s *reflectSchemalessTypedStruct) Get(key ref.Val) ref.Val { + v, found := s.lookupField(key) + if !found { + return types.ValOrErr(key, "no such key: %v", key) + } + return v +} + +func (s *reflectSchemalessTypedStruct) Contains(key ref.Val) ref.Val { + v, found := s.Find(key) + if v != nil && types.IsError(v) { + return v + } + return types.Bool(found) +} + +func (s *reflectSchemalessTypedStruct) lookupField(key ref.Val) (ref.Val, bool) { + keyStr, ok := key.(types.String) + if !ok { + return types.ValOrErr(key, "unsupported map key type: %T", key), true + } + fieldName := keyStr.Value().(string) + + if s.fieldCache != nil { + if cached, ok := s.fieldCache[fieldName]; ok { + return cached, cached != nil + } + } + + var result ref.Val + found := false + + cacheEntry := value.TypeReflectEntryOf(s.value.Type()) + fieldCache, ok := cacheEntry.Fields()[fieldName] + if ok { + if e := fieldCache.GetFrom(s.value); !fieldCache.CanOmit(e) { + result = SchemalessTypedToVal(e.Interface()) + found = true + } + } + + if s.fieldCache == nil { + s.fieldCache = make(map[string]ref.Val) + } + s.fieldCache[fieldName] = result + return result, found +} + +func (s *reflectSchemalessTypedStruct) Size() ref.Val { + cacheEntry := value.TypeReflectEntryOf(s.value.Type()) + count := 0 + for _, fieldCache := range cacheEntry.Fields() { + if e := fieldCache.GetFrom(s.value); !fieldCache.CanOmit(e) { + count++ + } + } + return types.Int(count) +} + +func (s *reflectSchemalessTypedStruct) Iterator() traits.Iterator { + cacheEntry := value.TypeReflectEntryOf(s.value.Type()) + var keys []string + for fieldName, fieldCache := range cacheEntry.Fields() { + if e := fieldCache.GetFrom(s.value); !fieldCache.CanOmit(e) { + keys = append(keys, string(fieldName)) + } + } + return &reflectSchemalessTypedStructIterator{reflectSchemalessTypedStruct: s, keys: keys, idx: 0} +} + +type reflectSchemalessTypedStructIterator struct { + *reflectSchemalessTypedStruct + keys []string + idx int +} + +func (it *reflectSchemalessTypedStructIterator) HasNext() ref.Val { + return types.Bool(it.idx < len(it.keys)) +} + +func (it *reflectSchemalessTypedStructIterator) Next() ref.Val { + if it.idx >= len(it.keys) { + return types.NewErr("no more elements") + } + val := types.String(it.keys[it.idx]) + it.idx++ + return val +} diff --git a/vendor/k8s.io/apiserver/pkg/cel/common/valuesunstructured.go b/vendor/k8s.io/apiserver/pkg/cel/common/valuesunstructured.go index 229916624d..377f885b70 100644 --- a/vendor/k8s.io/apiserver/pkg/cel/common/valuesunstructured.go +++ b/vendor/k8s.io/apiserver/pkg/cel/common/valuesunstructured.go @@ -281,7 +281,8 @@ func (t *unstructuredMapList) toMapKey(element interface{}) interface{} { for i, kf := range t.escapedKeyProps { key[i] = eObj[kf] } - return fmt.Sprintf("%v", key) + // Serialize to a string for more than 3 keys. %#v quotes strings. + return fmt.Sprintf("%#v", key) } // Equal on a map list ignores list element order. @@ -295,6 +296,7 @@ func (t *unstructuredMapList) Equal(other ref.Val) ref.Val { return types.False } tMap := t.getMap() + seen := make(map[interface{}]struct{}, len(tMap)) for it := oMapList.Iterator(); it.HasNext() == types.True; { v := it.Next() k := t.toMapKey(v.Value()) @@ -306,8 +308,9 @@ func (t *unstructuredMapList) Equal(other ref.Val) ref.Val { if eq != types.True { return eq // either false or error } + seen[k] = struct{}{} } - return types.True + return types.Bool(len(seen) == len(tMap)) } // Add for a map list `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values @@ -318,26 +321,11 @@ func (t *unstructuredMapList) Add(other ref.Val) ref.Val { if !ok { return types.MaybeNoSuchOverloadErr(other) } - elements := make([]interface{}, len(t.elements)) - keyToIdx := map[interface{}]int{} - for i, e := range t.elements { - k := t.toMapKey(e) - keyToIdx[k] = i - elements[i] = e - } - for it := oMapList.Iterator(); it.HasNext() == types.True; { - v := it.Next().Value() - k := t.toMapKey(v) - if overwritePosition, ok := keyToIdx[k]; ok { - elements[overwritePosition] = v - } else { - elements = append(elements, v) - } - } - return &unstructuredMapList{ - unstructuredList: unstructuredList{elements: elements, itemsSchema: t.itemsSchema}, - escapedKeyProps: t.escapedKeyProps, + elements := make([]ref.Val, len(t.elements)) + for i := range t.elements { + elements[i] = t.Get(types.Int(i)) } + return addToMapList(elements, oMapList, t.escapedKeyProps) } // escapeKeyProps returns identifiers with Escape applied to each. @@ -361,21 +349,25 @@ type unstructuredSetList struct { sync.Once // for lazy load of setOfList since it is only needed if Equals is called set map[interface{}]struct{} + setErr ref.Val } -func (t *unstructuredSetList) getSet() map[interface{}]struct{} { - // sets are only allowed to contain scalar elements, which are comparable in go, and can safely be used as - // golang map keys +func (t *unstructuredSetList) getSet() (map[interface{}]struct{}, ref.Val) { t.Do(func() { t.set = make(map[interface{}]struct{}, len(t.elements)) - for _, e := range t.elements { - t.set[e] = struct{}{} + for i := range t.elements { + k, err := setElementKey(t.Get(types.Int(i))) + if err != nil { + t.set, t.setErr = nil, err + return + } + t.set[k] = struct{}{} } }) - return t.set + return t.set, t.setErr } -// Equal on a map list ignores list element order. +// Equal on a set list ignores list element order. func (t *unstructuredSetList) Equal(other ref.Val) ref.Val { oSetList, ok := other.(traits.Lister) if !ok { @@ -385,15 +377,22 @@ func (t *unstructuredSetList) Equal(other ref.Val) ref.Val { if sz != oSetList.Size() { return types.False } - tSet := t.getSet() + tSet, err := t.getSet() + if err != nil { + return err + } + seen := make(map[interface{}]struct{}, len(tSet)) for it := oSetList.Iterator(); it.HasNext() == types.True; { - next := it.Next().Value() - _, ok := tSet[next] - if !ok { + k, err := setElementKey(it.Next()) + if err != nil { + return err + } + if _, ok := tSet[k]; !ok { return types.False } + seen[k] = struct{}{} } - return types.True + return types.Bool(len(seen) == len(tSet)) } // Add for a set list `X + Y` performs a union where the array positions of all elements in `X` are preserved and @@ -403,18 +402,11 @@ func (t *unstructuredSetList) Add(other ref.Val) ref.Val { if !ok { return types.MaybeNoSuchOverloadErr(other) } - elements := t.elements - set := t.getSet() - for it := oSetList.Iterator(); it.HasNext() == types.True; { - next := it.Next().Value() - if _, ok := set[next]; !ok { - set[next] = struct{}{} - elements = append(elements, next) - } - } - return &unstructuredSetList{ - unstructuredList: unstructuredList{elements: elements, itemsSchema: t.itemsSchema}, + elements := make([]ref.Val, len(t.elements)) + for i := range t.elements { + elements[i] = t.Get(types.Int(i)) } + return addToSetList(elements, oSetList) } // unstructuredList represents an unstructured data instance of an OpenAPI array with x-kubernetes-list-type=atomic (the default). @@ -489,13 +481,15 @@ func (t *unstructuredList) Add(other ref.Val) ref.Val { if !ok { return types.MaybeNoSuchOverloadErr(other) } - elements := t.elements + otherSz, _ := oList.Size().(types.Int) + elements := make([]ref.Val, 0, len(t.elements)+int(otherSz)) + for i := range t.elements { + elements = append(elements, t.Get(types.Int(i))) + } for it := oList.Iterator(); it.HasNext() == types.True; { - next := it.Next().Value() - elements = append(elements, next) + elements = append(elements, it.Next()) } - - return &unstructuredList{elements: elements, itemsSchema: t.itemsSchema} + return types.NewRefValList(types.DefaultTypeAdapter, elements) } func (t *unstructuredList) Contains(val ref.Val) ref.Val { diff --git a/vendor/k8s.io/apiserver/pkg/cel/environment/base.go b/vendor/k8s.io/apiserver/pkg/cel/environment/base.go index 91bdc6cb10..be310c5060 100644 --- a/vendor/k8s.io/apiserver/pkg/cel/environment/base.go +++ b/vendor/k8s.io/apiserver/pkg/cel/environment/base.go @@ -20,7 +20,6 @@ import ( "fmt" "strconv" "sync" - "sync/atomic" "github.com/google/cel-go/cel" "github.com/google/cel-go/checker" @@ -31,9 +30,7 @@ import ( "k8s.io/apimachinery/pkg/util/version" celconfig "k8s.io/apiserver/pkg/apis/cel" "k8s.io/apiserver/pkg/cel/library" - genericfeatures "k8s.io/apiserver/pkg/features" "k8s.io/apiserver/pkg/util/compatibility" - utilfeature "k8s.io/apiserver/pkg/util/feature" basecompatibility "k8s.io/component-base/compatibility" ) @@ -72,7 +69,6 @@ var baseOpts = []VersionedOptions{ UnversionedLib(library.URLs), UnversionedLib(library.Regex), - UnversionedLib(library.Lists), // cel-go v0.17.7 change the cost of has() from 0 to 1, but also provided the CostEstimatorOptions option to preserve the old behavior, so we enabled it at the same time we bumped our cel version to v0.17.7. // Since it is a regression fix, we apply it uniformly to all code use v0.17.7. @@ -87,6 +83,13 @@ var baseOpts = []VersionedOptions{ cel.CostTrackerOptions(interpreter.PresenceTestHasCost(false)), }, }, + { + IntroducedVersion: version.MajorMinor(1, 0), + RemovedVersion: version.MajorMinor(1, 37), + EnvOptions: []cel.EnvOption{ + library.Lists(library.ListsVersion(0)), + }, + }, { IntroducedVersion: version.MajorMinor(1, 27), EnvOptions: []cel.EnvOption{ @@ -151,18 +154,6 @@ var baseOpts = []VersionedOptions{ // Authz selectors { IntroducedVersion: version.MajorMinor(1, 31), - FeatureEnabled: func() bool { - enabled := utilfeature.DefaultFeatureGate.Enabled(genericfeatures.AuthorizeWithSelectors) - authzSelectorsLibraryInit.Do(func() { - // Record the first time feature enablement was checked for this library. - // This is checked from integration tests to ensure no cached cel envs - // are constructed before feature enablement is effectively set. - authzSelectorsLibraryEnabled.Store(enabled) - // Uncomment to debug where the first initialization is coming from if needed. - // debug.PrintStack() - }) - return enabled - }, EnvOptions: []cel.EnvOption{ UnversionedLib(library.AuthzSelectors), }, @@ -188,22 +179,15 @@ var baseOpts = []VersionedOptions{ ext.Lists(ext.ListsVersion(3)), }, }, + { + IntroducedVersion: version.MajorMinor(1, 37), + EnvOptions: []cel.EnvOption{ + library.Lists(library.ListsVersion(1)), + }, + }, StrictCostOpt, } -var ( - authzSelectorsLibraryInit sync.Once - authzSelectorsLibraryEnabled atomic.Value -) - -// AuthzSelectorsLibraryEnabled returns whether the AuthzSelectors library was enabled when it was constructed. -// If it has not been contructed yet, this returns `false, false`. -// This is solely for the benefit of the integration tests making sure feature gates get correctly parsed before AuthzSelector ever has to check for enablement. -func AuthzSelectorsLibraryEnabled() (enabled, constructed bool) { - enabled, constructed = authzSelectorsLibraryEnabled.Load().(bool) - return -} - var StrictCostOpt = VersionedOptions{ // This is to configure the cost calculation for extended libraries IntroducedVersion: version.MajorMinor(1, 0), diff --git a/vendor/k8s.io/apiserver/pkg/cel/library/authz.go b/vendor/k8s.io/apiserver/pkg/cel/library/authz.go index 77332cff8b..beefaf6454 100644 --- a/vendor/k8s.io/apiserver/pkg/cel/library/authz.go +++ b/vendor/k8s.io/apiserver/pkg/cel/library/authz.go @@ -24,8 +24,6 @@ import ( "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/labels" - genericfeatures "k8s.io/apiserver/pkg/features" - utilfeature "k8s.io/apiserver/pkg/util/feature" "github.com/google/cel-go/cel" "github.com/google/cel-go/common/types" @@ -619,11 +617,11 @@ type Resource interface { GetSubresource() string } -func NewAuthorizerVal(userInfo user.Info, authorizer authorizer.Authorizer) ref.Val { +func NewAuthorizerVal(userInfo user.Info, authorizer authorizer.UnconditionalAuthorizer) ref.Val { return authorizerVal{receiverOnlyObjectVal: receiverOnlyVal(AuthorizerType), userInfo: userInfo, authAuthorizer: authorizer} } -func NewResourceAuthorizerVal(userInfo user.Info, authorizer authorizer.Authorizer, requestResource Resource) ref.Val { +func NewResourceAuthorizerVal(userInfo user.Info, authorizer authorizer.UnconditionalAuthorizer, requestResource Resource) ref.Val { a := authorizerVal{receiverOnlyObjectVal: receiverOnlyVal(AuthorizerType), userInfo: userInfo, authAuthorizer: authorizer} resource := requestResource.GetResource() g := a.groupCheck(resource.Group) @@ -637,7 +635,7 @@ func NewResourceAuthorizerVal(userInfo user.Info, authorizer authorizer.Authoriz type authorizerVal struct { receiverOnlyObjectVal userInfo user.Info - authAuthorizer authorizer.Authorizer + authAuthorizer authorizer.UnconditionalAuthorizer } func (a authorizerVal) pathCheck(path string) pathCheckVal { @@ -708,22 +706,20 @@ func (a resourceCheckVal) Authorize(ctx context.Context, verb string) ref.Val { User: a.groupCheck.authorizer.userInfo, } - if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.AuthorizeWithSelectors) { - if len(a.fieldSelector) > 0 { - selector, err := fields.ParseSelector(a.fieldSelector) - if err != nil { - attr.FieldSelectorRequirements, attr.FieldSelectorParsingErr = nil, err - } else { - attr.FieldSelectorRequirements, attr.FieldSelectorParsingErr = selector.Requirements(), nil - } + if len(a.fieldSelector) > 0 { + selector, err := fields.ParseSelector(a.fieldSelector) + if err != nil { + attr.FieldSelectorRequirements, attr.FieldSelectorParsingErr = nil, err + } else { + attr.FieldSelectorRequirements, attr.FieldSelectorParsingErr = selector.Requirements(), nil } - if len(a.labelSelector) > 0 { - requirements, err := labels.ParseToRequirements(a.labelSelector) - if err != nil { - attr.LabelSelectorRequirements, attr.LabelSelectorParsingErr = nil, err - } else { - attr.LabelSelectorRequirements, attr.LabelSelectorParsingErr = requirements, nil - } + } + if len(a.labelSelector) > 0 { + requirements, err := labels.ParseToRequirements(a.labelSelector) + if err != nil { + attr.LabelSelectorRequirements, attr.LabelSelectorParsingErr = nil, err + } else { + attr.LabelSelectorRequirements, attr.LabelSelectorParsingErr = requirements, nil } } diff --git a/vendor/k8s.io/apiserver/pkg/cel/library/cost.go b/vendor/k8s.io/apiserver/pkg/cel/library/cost.go index 1eb68e16fa..80c3a850b3 100644 --- a/vendor/k8s.io/apiserver/pkg/cel/library/cost.go +++ b/vendor/k8s.io/apiserver/pkg/cel/library/cost.go @@ -101,7 +101,7 @@ func (l *CostEstimator) CallCost(function, overloadId string, args []ref.Val, re cost := selectorCostEstimate(checker.SizeEstimate{Min: selectorLength, Max: selectorLength}) return &cost.Max } - case "isSorted", "sum", "max", "min", "indexOf", "lastIndexOf": + case "isSorted", "sum", "max", "min", "indexOf", "lastIndexOf", "includes": var cost uint64 if len(args) > 0 { cost += traversalCost(args[0]) // these O(n) operations all cost roughly the cost of a single traversal @@ -287,7 +287,7 @@ func (l *CostEstimator) EstimateCallCost(function, overloadId string, target *ch if len(args) == 1 { return &checker.CallEstimate{CostEstimate: selectorCostEstimate(l.sizeEstimate(args[0]))} } - case "isSorted", "sum", "max", "min", "indexOf", "lastIndexOf": + case "isSorted", "sum", "max", "min", "indexOf", "lastIndexOf", "includes": if target != nil { // Charge 1 cost for comparing each element in the list elCost := checker.CostEstimate{Min: 1, Max: 1} @@ -300,7 +300,12 @@ func (l *CostEstimator) EstimateCallCost(function, overloadId string, target *ch elCost = elCost.Add(sz.MultiplyByCostFactor(common.StringTraversalCostFactor)) } return &checker.CallEstimate{CostEstimate: l.sizeEstimate(*target).MultiplyByCost(elCost)} - } else { // the target is a string, which is supported by indexOf and lastIndexOf + } else if function == "includes" { + // Since target can be a list under DynType, the worst case is a list comparison of size n, + // where each comparison costs 1. + return &checker.CallEstimate{CostEstimate: l.sizeEstimate(*target).MultiplyByCost(elCost)} + } else { + // the target is a string, which is supported by indexOf and lastIndexOf return &checker.CallEstimate{CostEstimate: l.sizeEstimate(*target).MultiplyByCostFactor(common.StringTraversalCostFactor)} } } diff --git a/vendor/k8s.io/apiserver/pkg/cel/library/lists.go b/vendor/k8s.io/apiserver/pkg/cel/library/lists.go index 1f61b1181e..e68c215e6b 100644 --- a/vendor/k8s.io/apiserver/pkg/cel/library/lists.go +++ b/vendor/k8s.io/apiserver/pkg/cel/library/lists.go @@ -18,6 +18,7 @@ package library import ( "fmt" + "math" "github.com/google/cel-go/cel" "github.com/google/cel-go/common/types" @@ -87,13 +88,45 @@ import ( // ['a', 'b', 'b', 'c'].lastIndexOf('b') // returns 2 // [1.0].indexOf(1.1) // returns -1 // [].indexOf('string') // returns -1 -func Lists() cel.EnvOption { - return cel.Lib(listsLib) +// +// includes +// +// Returns true if the target list contains the element, or if the target is equal to the element. +// +// .includes() +// +// Examples: +// +// [1, 2, 3].includes(2) // returns true +// [1, 2, 3].includes(4) // returns false +// 'model-a'.includes('model-a') // returns true +// 'model-a'.includes('model-b') // returns false +// +// ListsOption is a functional interface for configuring the lists library. +type ListsOption func(*lists) *lists + +// ListsVersion sets the version of the lists library to use. +func ListsVersion(version uint32) ListsOption { + return func(lib *lists) *lists { + lib.version = version + return lib + } } -var listsLib = &lists{} +// Lists provides a CEL function library extension of list utility functions. +func Lists(options ...ListsOption) cel.EnvOption { + l := &lists{} + for _, o := range options { + l = o(l) + } + return cel.Lib(l) +} + +var listsLib = &lists{version: math.MaxUint32} -type lists struct{} +type lists struct { + version uint32 +} func (*lists) LibraryName() string { return "kubernetes.lists" @@ -103,8 +136,45 @@ func (*lists) Types() []*cel.Type { return []*cel.Type{} } -func (*lists) declarations() map[string][]cel.FunctionOpt { - return listsLibraryDecls +func (l *lists) declarations() map[string][]cel.FunctionOpt { + decls := map[string][]cel.FunctionOpt{ + "isSorted": templatedOverloads(comparableTypes, func(name string, paramType *cel.Type) cel.FunctionOpt { + return cel.MemberOverload(fmt.Sprintf("list_%s_is_sorted_bool", name), + []*cel.Type{cel.ListType(paramType)}, cel.BoolType, cel.UnaryBinding(isSorted)) + }), + "sum": templatedOverloads(summableTypes, func(name string, paramType *cel.Type) cel.FunctionOpt { + return cel.MemberOverload(fmt.Sprintf("list_%s_sum_%s", name, name), + []*cel.Type{cel.ListType(paramType)}, paramType, cel.UnaryBinding(func(list ref.Val) ref.Val { + return sum( + func() ref.Val { + return zeroValuesOfSummableTypes[name] + })(list) + })) + }), + "max": templatedOverloads(comparableTypes, func(name string, paramType *cel.Type) cel.FunctionOpt { + return cel.MemberOverload(fmt.Sprintf("list_%s_max_%s", name, name), + []*cel.Type{cel.ListType(paramType)}, paramType, cel.UnaryBinding(max())) + }), + "min": templatedOverloads(comparableTypes, func(name string, paramType *cel.Type) cel.FunctionOpt { + return cel.MemberOverload(fmt.Sprintf("list_%s_min_%s", name, name), + []*cel.Type{cel.ListType(paramType)}, paramType, cel.UnaryBinding(min())) + }), + "indexOf": { + cel.MemberOverload("list_a_index_of_int", []*cel.Type{cel.ListType(paramA), paramA}, cel.IntType, + cel.BinaryBinding(indexOf)), + }, + "lastIndexOf": { + cel.MemberOverload("list_a_last_index_of_int", []*cel.Type{cel.ListType(paramA), paramA}, cel.IntType, + cel.BinaryBinding(lastIndexOf)), + }, + } + if l.version >= 1 { + decls["includes"] = []cel.FunctionOpt{ + cel.MemberOverload("list_includes_dyn_dyn", []*cel.Type{cel.DynType, cel.DynType}, cel.BoolType, + cel.BinaryBinding(includes)), + } + } + return decls } var paramA = cel.TypeParamType("A") @@ -141,48 +211,21 @@ var comparableTypes = []namedCELType{ {typeName: "bytes", celType: cel.BytesType}, } -// WARNING: All library additions or modifications must follow -// https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/2876-crd-validation-expression-language#function-library-updates -var listsLibraryDecls = map[string][]cel.FunctionOpt{ - "isSorted": templatedOverloads(comparableTypes, func(name string, paramType *cel.Type) cel.FunctionOpt { - return cel.MemberOverload(fmt.Sprintf("list_%s_is_sorted_bool", name), - []*cel.Type{cel.ListType(paramType)}, cel.BoolType, cel.UnaryBinding(isSorted)) - }), - "sum": templatedOverloads(summableTypes, func(name string, paramType *cel.Type) cel.FunctionOpt { - return cel.MemberOverload(fmt.Sprintf("list_%s_sum_%s", name, name), - []*cel.Type{cel.ListType(paramType)}, paramType, cel.UnaryBinding(func(list ref.Val) ref.Val { - return sum( - func() ref.Val { - return zeroValuesOfSummableTypes[name] - })(list) - })) - }), - "max": templatedOverloads(comparableTypes, func(name string, paramType *cel.Type) cel.FunctionOpt { - return cel.MemberOverload(fmt.Sprintf("list_%s_max_%s", name, name), - []*cel.Type{cel.ListType(paramType)}, paramType, cel.UnaryBinding(max())) - }), - "min": templatedOverloads(comparableTypes, func(name string, paramType *cel.Type) cel.FunctionOpt { - return cel.MemberOverload(fmt.Sprintf("list_%s_min_%s", name, name), - []*cel.Type{cel.ListType(paramType)}, paramType, cel.UnaryBinding(min())) - }), - "indexOf": { - cel.MemberOverload("list_a_index_of_int", []*cel.Type{cel.ListType(paramA), paramA}, cel.IntType, - cel.BinaryBinding(indexOf)), - }, - "lastIndexOf": { - cel.MemberOverload("list_a_last_index_of_int", []*cel.Type{cel.ListType(paramA), paramA}, cel.IntType, - cel.BinaryBinding(lastIndexOf)), - }, -} - -func (*lists) CompileOptions() []cel.EnvOption { +func (l *lists) CompileOptions() []cel.EnvOption { options := []cel.EnvOption{} - for name, overloads := range listsLibraryDecls { + for name, overloads := range l.declarations() { options = append(options, cel.Function(name, overloads...)) } return options } +// IncludesOption returns the EnvOption to register the includes function directly. +func IncludesOption() cel.EnvOption { + return cel.Function("includes", + cel.MemberOverload("list_includes_dyn_dyn", []*cel.Type{cel.DynType, cel.DynType}, cel.BoolType, + cel.BinaryBinding(includes))) +} + func (*lists) ProgramOptions() []cel.ProgramOption { return []cel.ProgramOption{} } @@ -311,6 +354,24 @@ func lastIndexOf(list ref.Val, item ref.Val) ref.Val { return types.Int(-1) } +func includes(target, arg ref.Val) ref.Val { + if list, ok := target.(traits.Lister); ok { + it := list.Iterator() + for it.HasNext() == types.True { + item := it.Next() + if item.Equal(arg) == types.True { + return types.True + } + } + return types.False + } + + if target.Equal(arg) == types.True { + return types.True + } + return types.False +} + // templatedOverloads returns overloads for each of the provided types. The template function is called with each type // name (map key) and type to construct the overloads. func templatedOverloads(types []namedCELType, template func(name string, t *cel.Type) cel.FunctionOpt) []cel.FunctionOpt { diff --git a/vendor/k8s.io/apiserver/pkg/cel/library/quantity.go b/vendor/k8s.io/apiserver/pkg/cel/library/quantity.go index f3fd8b1c50..011c383c4f 100644 --- a/vendor/k8s.io/apiserver/pkg/cel/library/quantity.go +++ b/vendor/k8s.io/apiserver/pkg/cel/library/quantity.go @@ -320,7 +320,7 @@ func quantityAdd(arg ref.Val, other ref.Val) ref.Val { return types.MaybeNoSuchOverloadErr(arg) } - copy := *q + copy := q.DeepCopy() copy.Add(*q2) return &apiservercel.Quantity{ Quantity: ©, @@ -340,7 +340,7 @@ func quantityAddInt(arg ref.Val, other ref.Val) ref.Val { q2Converted := *resource.NewQuantity(q2, resource.DecimalExponent) - copy := *q + copy := q.DeepCopy() copy.Add(q2Converted) return &apiservercel.Quantity{ Quantity: ©, @@ -358,7 +358,7 @@ func quantitySub(arg ref.Val, other ref.Val) ref.Val { return types.MaybeNoSuchOverloadErr(arg) } - copy := *q + copy := q.DeepCopy() copy.Sub(*q2) return &apiservercel.Quantity{ Quantity: ©, @@ -378,7 +378,7 @@ func quantitySubInt(arg ref.Val, other ref.Val) ref.Val { q2Converted := *resource.NewQuantity(q2, resource.DecimalExponent) - copy := *q + copy := q.DeepCopy() copy.Sub(q2Converted) return &apiservercel.Quantity{ Quantity: ©, diff --git a/vendor/k8s.io/apiserver/pkg/cel/mutation/dynamic/objects.go b/vendor/k8s.io/apiserver/pkg/cel/mutation/dynamic/objects.go index 8dd38281b0..80167b0b63 100644 --- a/vendor/k8s.io/apiserver/pkg/cel/mutation/dynamic/objects.go +++ b/vendor/k8s.io/apiserver/pkg/cel/mutation/dynamic/objects.go @@ -120,17 +120,20 @@ func (v *ObjectVal) ConvertToNative(typeDesc reflect.Type) (any, error) { } result[k] = converted } - if typeDesc == reflect.TypeOf(result) { + switch typeDesc { + case reflect.TypeFor[map[string]any](): return result, nil - } // CEL's builtin data literal values all support conversion to structpb.Value, which // can then be serialized to JSON. This is convenient for CEL expressions that return // an arbitrary JSON value, such as our MutatingAdmissionPolicy JSON Patch valueExpression // field, so we support the conversion here, for Object data literals, as well. - if typeDesc == reflect.TypeOf(&structpb.Value{}) { + case reflect.TypeFor[*structpb.Struct](): return structpb.NewStruct(result) + case reflect.TypeFor[*structpb.Value](): + return structpb.NewValue(result) + default: + return nil, fmt.Errorf("unable to convert to %v", typeDesc) } - return nil, fmt.Errorf("unable to convert to %v", typeDesc) } // ConvertToType supports type conversions between CEL value types supported by the expression language. @@ -245,5 +248,45 @@ func convertField(value ref.Val) (any, error) { } return result, nil } + if lister, ok := value.(traits.Lister); ok { + var result []any + it := lister.Iterator() + for it.HasNext() == types.True { + val := it.Next() + conv, err := convertField(val) + if err != nil { + return nil, err + } + result = append(result, conv) + } + return result, nil + } + if mapper, ok := value.(traits.Mapper); ok { + // ObjectVal handles its own fast path and returns map[string]any directly via ConvertToNative + if objVal, isObj := value.(*ObjectVal); isObj { + native, err := objVal.ConvertToNative(reflect.TypeFor[map[string]any]()) + if err != nil { + return nil, err + } + return native, nil + } + + result := make(map[string]any) + it := mapper.Iterator() + for it.HasNext() == types.True { + k := it.Next() + stringKey, ok := k.Value().(string) + if !ok { + return nil, fmt.Errorf("map key %q is of type %T, not string", k, k) + } + v := mapper.Get(k) + conv, err := convertField(v) + if err != nil { + return nil, err + } + result[stringKey] = conv + } + return result, nil + } return value.Value(), nil } diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/handler.go b/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/handler.go index 1b8e8c72e0..2168a740c4 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/handler.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/handler.go @@ -30,6 +30,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" + "k8s.io/apimachinery/pkg/runtime/serializer/cbor" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/version" apidiscoveryv2conversion "k8s.io/apiserver/pkg/apis/apidiscovery/v2" @@ -174,7 +175,11 @@ func NewResourceManager(path string) ResourceManager { // Register conversion for apidiscovery utilruntime.Must(apidiscoveryv2conversion.RegisterConversions(scheme)) - codecs := serializer.NewCodecFactory(scheme) + var opts []serializer.CodecFactoryOptionsMutator + if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.CBORServingAndStorage) { + opts = append(opts, serializer.WithSerializer(cbor.NewSerializerInfo)) + } + codecs := serializer.NewCodecFactory(scheme, opts...) rdm := &resourceDiscoveryManager{ serializer: codecs, versionPriorities: make(map[groupVersionKey]priorityInfo), diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/metrics.go b/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/metrics.go index a94cd588b2..9733ef0938 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/metrics.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/metrics.go @@ -17,8 +17,8 @@ limitations under the License. package aggregated import ( - genericfeatures "k8s.io/apiserver/pkg/features" - utilfeature "k8s.io/apiserver/pkg/util/feature" + "sync" + "k8s.io/component-base/metrics" "k8s.io/component-base/metrics/legacyregistry" ) @@ -26,7 +26,8 @@ import ( const subsystem = "aggregator_discovery" var ( - regenerationCounter = metrics.NewCounter( + registerPeerMetricsOnce sync.Once + regenerationCounter = metrics.NewCounter( &metrics.CounterOpts{ Name: "aggregation_count_total", Subsystem: subsystem, @@ -65,9 +66,12 @@ var ( func init() { legacyregistry.MustRegister(regenerationCounter) - if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.UnknownVersionInteroperabilityProxy) { +} + +func registerPeerMetrics() { + registerPeerMetricsOnce.Do(func() { legacyregistry.MustRegister(PeerAggregatedCacheHitsCounter) legacyregistry.MustRegister(PeerAggregatedCacheMissesCounter) legacyregistry.MustRegister(NoPeerDiscoveryRequestCounter) - } + }) } diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/peer_aggregated_handler.go b/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/peer_aggregated_handler.go index c7f54376c1..23d22e851a 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/peer_aggregated_handler.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/peer_aggregated_handler.go @@ -24,8 +24,11 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/serializer" + "k8s.io/apimachinery/pkg/runtime/serializer/cbor" "k8s.io/apiserver/pkg/endpoints/metrics" "k8s.io/apiserver/pkg/endpoints/request" + genericfeatures "k8s.io/apiserver/pkg/features" + utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/klog/v2" apidiscoveryv2 "k8s.io/api/apidiscovery/v2" @@ -62,7 +65,13 @@ type peerAggregatedDiscoveryHandler struct { func NewPeerAggregatedDiscoveryHandler(serverID string, localDiscoveryProvider ResourceManager, peerDiscoveryProvider PeerDiscoveryProvider, path string) PeerAggregatedResourceManager { scheme := runtime.NewScheme() utilruntime.Must(apidiscoveryv2.AddToScheme(scheme)) - codecs := serializer.NewCodecFactory(scheme) + var opts []serializer.CodecFactoryOptionsMutator + if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.CBORServingAndStorage) { + opts = append(opts, serializer.WithSerializer(cbor.NewSerializerInfo)) + } + codecs := serializer.NewCodecFactory(scheme, opts...) + + registerPeerMetrics() h := &peerAggregatedDiscoveryHandler{ serverID: serverID, diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/wrapper.go b/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/wrapper.go index dc098c81bf..cd4e107d4f 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/wrapper.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/wrapper.go @@ -22,6 +22,7 @@ import ( apidiscoveryv2 "k8s.io/api/apidiscovery/v2" apidiscoveryv2beta1 "k8s.io/api/apidiscovery/v2beta1" "k8s.io/apimachinery/pkg/runtime/serializer" + "k8s.io/apimachinery/pkg/runtime/serializer/cbor" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "github.com/emicklei/go-restful/v3" @@ -92,6 +93,10 @@ func WrapAggregatedDiscoveryToHandler(handler, aggHandler, peerAggregatedHandler scheme := runtime.NewScheme() utilruntime.Must(apidiscoveryv2.AddToScheme(scheme)) utilruntime.Must(apidiscoveryv2beta1.AddToScheme(scheme)) - codecs := serializer.NewCodecFactory(scheme) + var opts []serializer.CodecFactoryOptionsMutator + if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.CBORServingAndStorage) { + opts = append(opts, serializer.WithSerializer(cbor.NewSerializerInfo)) + } + codecs := serializer.NewCodecFactory(scheme, opts...) return &WrappedHandler{codecs, handler, aggHandler, peerAggregatedHandler} } diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/filters/authentication.go b/vendor/k8s.io/apiserver/pkg/endpoints/filters/authentication.go index 0c6427d5d1..f7b29dd82a 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/filters/authentication.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/filters/authentication.go @@ -44,6 +44,7 @@ type authenticationRecordMetricsFunc func(context.Context, *authenticator.Respon // the failed handler is used. On success, "Authorization" header is removed from the request and handler // is invoked to serve the request. func WithAuthentication(handler http.Handler, auth authenticator.Request, failed http.Handler, apiAuds authenticator.Audiences, requestHeaderConfig *authenticatorfactory.RequestHeaderConfig) http.Handler { + RegisterMetrics() return withAuthentication(handler, auth, failed, apiAuds, requestHeaderConfig, recordAuthenticationMetrics) } diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/filters/authorization.go b/vendor/k8s.io/apiserver/pkg/endpoints/filters/authorization.go index 439696d07a..80f1b4a9a9 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/filters/authorization.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/filters/authorization.go @@ -24,8 +24,6 @@ import ( "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/labels" - genericfeatures "k8s.io/apiserver/pkg/features" - utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/klog/v2" @@ -50,11 +48,12 @@ const ( type recordAuthorizationMetricsFunc func(ctx context.Context, authorized authorizer.Decision, err error, authStart time.Time, authFinish time.Time) // WithAuthorization passes all authorized requests on to handler, and returns a forbidden error otherwise. -func WithAuthorization(hhandler http.Handler, auth authorizer.Authorizer, s runtime.NegotiatedSerializer) http.Handler { +func WithAuthorization(hhandler http.Handler, auth authorizer.UnconditionalAuthorizer, s runtime.NegotiatedSerializer) http.Handler { + RegisterMetrics() return withAuthorization(hhandler, auth, s, recordAuthorizationMetrics) } -func withAuthorization(handler http.Handler, a authorizer.Authorizer, s runtime.NegotiatedSerializer, metrics recordAuthorizationMetricsFunc) http.Handler { +func withAuthorization(handler http.Handler, a authorizer.UnconditionalAuthorizer, s runtime.NegotiatedSerializer, metrics recordAuthorizationMetricsFunc) http.Handler { if a == nil { klog.Warning("Authorization is disabled") return handler @@ -123,28 +122,26 @@ func GetAuthorizerAttributes(ctx context.Context) (authorizer.Attributes, error) attribs.Namespace = requestInfo.Namespace attribs.Name = requestInfo.Name - if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.AuthorizeWithSelectors) { - // parsing here makes it easy to keep the AttributesRecord type value-only and avoids any mutex copies when - // doing shallow copies in other steps. - if len(requestInfo.FieldSelector) > 0 { - fieldSelector, err := fields.ParseSelector(requestInfo.FieldSelector) - if err != nil { - attribs.FieldSelectorRequirements, attribs.FieldSelectorParsingErr = nil, err - } else { - if requirements := fieldSelector.Requirements(); len(requirements) > 0 { - attribs.FieldSelectorRequirements, attribs.FieldSelectorParsingErr = fieldSelector.Requirements(), nil - } + // parsing here makes it easy to keep the AttributesRecord type value-only and avoids any mutex copies when + // doing shallow copies in other steps. + if len(requestInfo.FieldSelector) > 0 { + fieldSelector, err := fields.ParseSelector(requestInfo.FieldSelector) + if err != nil { + attribs.FieldSelectorRequirements, attribs.FieldSelectorParsingErr = nil, err + } else { + if requirements := fieldSelector.Requirements(); len(requirements) > 0 { + attribs.FieldSelectorRequirements, attribs.FieldSelectorParsingErr = fieldSelector.Requirements(), nil } } + } - if len(requestInfo.LabelSelector) > 0 { - labelSelector, err := labels.Parse(requestInfo.LabelSelector) - if err != nil { - attribs.LabelSelectorRequirements, attribs.LabelSelectorParsingErr = nil, err - } else { - if requirements, _ /*selectable*/ := labelSelector.Requirements(); len(requirements) > 0 { - attribs.LabelSelectorRequirements, attribs.LabelSelectorParsingErr = requirements, nil - } + if len(requestInfo.LabelSelector) > 0 { + labelSelector, err := labels.Parse(requestInfo.LabelSelector) + if err != nil { + attribs.LabelSelectorRequirements, attribs.LabelSelectorParsingErr = nil, err + } else { + if requirements, _ /*selectable*/ := labelSelector.Requirements(); len(requirements) > 0 { + attribs.LabelSelectorRequirements, attribs.LabelSelectorParsingErr = requirements, nil } } } diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/constrained_impersonation.go b/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/constrained_impersonation.go index e2a6e953d5..d652360a58 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/constrained_impersonation.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/constrained_impersonation.go @@ -43,7 +43,7 @@ import ( // At a high level, constrained impersonation uses multiple authorization checks to allow for the granular // expression of impersonation access. For example, a service account may be authorized to impersonate the // node that it is associated with but only when listing pods. See the linked KEP for further details. -func WithConstrainedImpersonation(handler http.Handler, a authorizer.Authorizer, s runtime.NegotiatedSerializer) http.Handler { +func WithConstrainedImpersonation(handler http.Handler, a authorizer.UnconditionalAuthorizer, s runtime.NegotiatedSerializer) http.Handler { metrics.RegisterMetrics() ma := &metricsAuthorizer{ @@ -188,7 +188,7 @@ type impersonationModesTracker struct { idxCache *modeIndexCache } -func newImpersonationModesTracker(a authorizer.Authorizer) *impersonationModesTracker { +func newImpersonationModesTracker(a authorizer.UnconditionalAuthorizer) *impersonationModesTracker { loggingAuthorizer := authorizer.AuthorizerFunc(func(ctx context.Context, attributes authorizer.Attributes) (authorizer.Decision, string, error) { decision, reason, err := a.Authorize(ctx, attributes) // build a detailed log of the authorization @@ -275,8 +275,11 @@ func (t *impersonationModesTracker) getImpersonatedUser(ctx context.Context, wan return nil, errors.New("all impersonation modes failed") } +// For now, constrained impersonation only supports unconditional authorization +var _ = authorizer.UnconditionalAuthorizer(&metricsAuthorizer{}) + type metricsAuthorizer struct { - delegate authorizer.Authorizer + delegate authorizer.UnconditionalAuthorizer recordAuthorizationCall func(mode, decision string, duration time.Duration) } diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/impersonation.go b/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/impersonation.go index f0f7512c72..555e5f8023 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/impersonation.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/impersonation.go @@ -26,7 +26,7 @@ import ( "k8s.io/klog/v2" authenticationv1 "k8s.io/api/authentication/v1" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apiserver/pkg/audit" @@ -39,7 +39,7 @@ import ( ) // WithImpersonation is a filter that will inspect and check requests that attempt to change the user.Info for their requests -func WithImpersonation(handler http.Handler, a authorizer.Authorizer, s runtime.NegotiatedSerializer) http.Handler { +func WithImpersonation(handler http.Handler, a authorizer.UnconditionalAuthorizer, s runtime.NegotiatedSerializer) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { impersonationRequests, err := buildImpersonationRequests(req.Header) if err != nil { diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/mode.go b/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/mode.go index cdcb02ada7..d8eaa69064 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/mode.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/mode.go @@ -57,7 +57,7 @@ type impersonationMode interface { // supports the requestor impersonating the wantedUser. It serves as a sudo authorization check for the mode. type constrainedImpersonationModeFilter func(wantedUser *user.DefaultInfo, requestor user.Info) bool -func allImpersonationModes(a authorizer.Authorizer) []impersonationMode { +func allImpersonationModes(a authorizer.UnconditionalAuthorizer) []impersonationMode { return []impersonationMode{ associatedNodeImpersonationMode(a), arbitraryNodeImpersonationMode(a), @@ -72,7 +72,7 @@ func allImpersonationModes(a authorizer.Authorizer) []impersonationMode { // impersonation attempts in a way that results in a high cache hit ratio even when the same service account // is used across different pods running on different nodes (i.e. a node agent running as a daemonset). // only the username can be specified by the requester. all other fields in user.Info are controlled by the API server. -func associatedNodeImpersonationMode(a authorizer.Authorizer) impersonationMode { +func associatedNodeImpersonationMode(a authorizer.UnconditionalAuthorizer) impersonationMode { // we wrap the authorizer so that we can override the requestor service account's extra values // and the node name used in the authorization check. this makes our authorization checks match // the exact semantics of our cache key which prevents unexpected privilege escalation on a cache @@ -174,7 +174,7 @@ func (a *associatedNodeImpersonationWantedUserInfo) GetName() string { // arbitraryNodeImpersonationMode implements constrained impersonation for nodes. // Only the username can be specified by the requester. All other fields in user.Info are controlled by the API server. -func arbitraryNodeImpersonationMode(a authorizer.Authorizer) impersonationMode { +func arbitraryNodeImpersonationMode(a authorizer.UnconditionalAuthorizer) impersonationMode { return newConstrainedImpersonationMode(a, "arbitrary-node", func(wantedUser *user.DefaultInfo, _ user.Info) bool { if !onlyUsernameSet(wantedUser) { @@ -188,7 +188,7 @@ func arbitraryNodeImpersonationMode(a authorizer.Authorizer) impersonationMode { // serviceAccountImpersonationMode implements constrained impersonation for service accounts. // Only the username can be specified by the requester. All other fields in user.Info are controlled by the API server. -func serviceAccountImpersonationMode(a authorizer.Authorizer) impersonationMode { +func serviceAccountImpersonationMode(a authorizer.UnconditionalAuthorizer) impersonationMode { return newConstrainedImpersonationMode(a, "serviceaccount", func(wantedUser *user.DefaultInfo, _ user.Info) bool { if !onlyUsernameSet(wantedUser) { @@ -202,7 +202,7 @@ func serviceAccountImpersonationMode(a authorizer.Authorizer) impersonationMode // userInfoImpersonationMode implements constrained impersonation for non-node and non-service account users. // Unlike the other constrained impersonation modes, it supports impersonating all fields of user.Info. -func userInfoImpersonationMode(a authorizer.Authorizer) impersonationMode { +func userInfoImpersonationMode(a authorizer.UnconditionalAuthorizer) impersonationMode { return newConstrainedImpersonationMode(a, "user-info", func(wantedUser *user.DefaultInfo, _ user.Info) bool { // nodes and service accounts cannot be impersonated in this mode. @@ -221,7 +221,7 @@ func userInfoImpersonationMode(a authorizer.Authorizer) impersonationMode { // legacyImpersonationMode is a complete reimplementation of the original impersonation mode that has // existed in kube since v1.3. The behavior is expected to be identical to the original implementation. -func legacyImpersonationMode(a authorizer.Authorizer) impersonationMode { +func legacyImpersonationMode(a authorizer.UnconditionalAuthorizer) impersonationMode { return &legacyImpersonationCheck{m: newImpersonationModeState(a, "impersonate", false)} } @@ -244,7 +244,7 @@ func (l *legacyImpersonationCheck) cachesForTests() (*impersonationCache, *imper return newImpersonationCache(false), l.m.cache } -func newConstrainedImpersonationMode(a authorizer.Authorizer, mode string, filter constrainedImpersonationModeFilter) impersonationMode { +func newConstrainedImpersonationMode(a authorizer.UnconditionalAuthorizer, mode string, filter constrainedImpersonationModeFilter) impersonationMode { return &constrainedImpersonationModeState{ state: newImpersonationModeState(a, "impersonate:"+mode, true), cache: newImpersonationCache(false), @@ -264,7 +264,7 @@ type constrainedImpersonationModeState struct { // skipAttributes is false, i.e. this cache depends on the request being made, not just the user being impersonated by the requestor // it is expected to have a low hit ratio because the requestor is unlikely to make the same request multiple times in a short period cache *impersonationCache - authorizer authorizer.Authorizer + authorizer authorizer.UnconditionalAuthorizer mode string filter constrainedImpersonationModeFilter } @@ -305,7 +305,7 @@ func (c *constrainedImpersonationModeState) cachesForTests() (*impersonationCach // impersonation and the impersonate verb for legacy impersonation. each field that is set in the wantedUser // results in one or more authorization checks to determine if the requestor has access to impersonate that value. type impersonationModeState struct { - authorizer authorizer.Authorizer + authorizer authorizer.UnconditionalAuthorizer verb string isConstrainedImpersonation bool @@ -318,7 +318,7 @@ type impersonationModeState struct { cache *impersonationCache } -func newImpersonationModeState(a authorizer.Authorizer, verb string, isConstrainedImpersonation bool) *impersonationModeState { +func newImpersonationModeState(a authorizer.UnconditionalAuthorizer, verb string, isConstrainedImpersonation bool) *impersonationModeState { usernameAndGroupGV := authenticationv1.SchemeGroupVersion constraint := verb if !isConstrainedImpersonation { @@ -556,7 +556,7 @@ func (i *impersonateOnAttributes) GetVerb() string { return "impersonate-on:" + i.mode + ":" + i.Attributes.GetVerb() } -func checkAuthorization(ctx context.Context, a authorizer.Authorizer, attributes authorizer.Attributes) error { +func checkAuthorization(ctx context.Context, a authorizer.UnconditionalAuthorizer, attributes authorizer.Attributes) error { authorized, reason, err := a.Authorize(ctx, attributes) // an authorizer like RBAC could encounter evaluation errors and still allow the request, so authorizer decision is checked before error here. diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/filters/metrics.go b/vendor/k8s.io/apiserver/pkg/endpoints/filters/metrics.go index a4dae3d84e..591b82d7c8 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/filters/metrics.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/filters/metrics.go @@ -19,6 +19,7 @@ package filters import ( "context" "strings" + "sync" "time" "k8s.io/apiserver/pkg/authorization/authorizer" @@ -95,12 +96,21 @@ var ( ) ) -func init() { - legacyregistry.MustRegister(authenticatedUserCounter) - legacyregistry.MustRegister(authenticatedAttemptsCounter) - legacyregistry.MustRegister(authenticationLatency) - legacyregistry.MustRegister(authorizationAttemptsCounter) - legacyregistry.MustRegister(authorizationLatency) +var registerMetricsOnce sync.Once + +// RegisterMetrics registers the authentication and authorization filter metrics +// with the legacy registry. It is invoked when the authentication/authorization +// filters are installed into the handler chain (rather than from an init() +// function), so that metric feature gates such as NativeHistograms have been +// applied before these histogram metrics are created. +func RegisterMetrics() { + registerMetricsOnce.Do(func() { + legacyregistry.MustRegister(authenticatedUserCounter) + legacyregistry.MustRegister(authenticatedAttemptsCounter) + legacyregistry.MustRegister(authenticationLatency) + legacyregistry.MustRegister(authorizationAttemptsCounter) + legacyregistry.MustRegister(authorizationLatency) + }) } func recordAuthorizationMetrics(ctx context.Context, authorized authorizer.Decision, err error, authStart time.Time, authFinish time.Time) { diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/filters/traces.go b/vendor/k8s.io/apiserver/pkg/endpoints/filters/traces.go index 9b97410b43..6e605b3fd0 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/filters/traces.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/filters/traces.go @@ -21,7 +21,6 @@ import ( "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" "k8s.io/apiserver/pkg/audit" "k8s.io/apiserver/pkg/endpoints/request" @@ -55,7 +54,7 @@ func WithTracing(handler http.Handler, tp trace.TracerProvider) http.Handler { // Workaround for https://github.com/open-telemetry/opentelemetry-go-contrib/issues/3743 span := trace.SpanFromContext(r.Context()) if r.URL != nil { - span.SetAttributes(semconv.HTTPTarget(r.URL.RequestURI())) + span.SetAttributes(attribute.Key("http.target").String(r.URL.RequestURI())) } // Add auditID attribute if available. This helps us connect traces to audit log entries span.SetAttributes(attribute.String("audit-id", audit.GetAuditIDTruncated(r.Context()))) diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/groupversion.go b/vendor/k8s.io/apiserver/pkg/endpoints/groupversion.go index 612b1a014f..f8edd75432 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/groupversion.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/groupversion.go @@ -89,7 +89,7 @@ type APIGroupVersion struct { // Authorizer determines whether a user is allowed to make a certain request. The Handler does a preliminary // authorization check using the request URI but it may be necessary to make additional checks, such as in // the create-on-update case - Authorizer authorizer.Authorizer + Authorizer authorizer.UnconditionalAuthorizer Admit admission.Interface diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/delete.go b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/delete.go index 3d0800747a..122b41386d 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/delete.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/delete.go @@ -354,7 +354,7 @@ func DeleteCollection(r rest.CollectionDeleter, checkBody bool, scope *RequestSc // authorizeUnsafeDelete ensures that the user has permission to do // 'unsafe-delete-ignore-read-errors' on the resource being deleted when // ignoreStoreReadErrorWithClusterBreakingPotential is enabled -func authorizeUnsafeDelete(ctx context.Context, attr admission.Attributes, authz authorizer.Authorizer) (err error) { +func authorizeUnsafeDelete(ctx context.Context, attr admission.Attributes, authz authorizer.UnconditionalAuthorizer) (err error) { if attr.GetOperation() != admission.Delete || attr.GetOperationOptions() == nil { return nil } @@ -389,25 +389,23 @@ func authorizeUnsafeDelete(ctx context.Context, attr admission.Attributes, authz } // TODO: can't use ResourceAttributesFrom from k8s.io/kubernetes/pkg/registry/authorization/util // due to prevent staging --> k8s.io/kubernetes dep issue - if utilfeature.DefaultFeatureGate.Enabled(features.AuthorizeWithSelectors) { - if len(requestInfo.FieldSelector) > 0 { - fieldSelector, err := fields.ParseSelector(requestInfo.FieldSelector) - if err != nil { - record.FieldSelectorRequirements, record.FieldSelectorParsingErr = nil, err - } else { - if requirements := fieldSelector.Requirements(); len(requirements) > 0 { - record.FieldSelectorRequirements, record.FieldSelectorParsingErr = fieldSelector.Requirements(), nil - } + if len(requestInfo.FieldSelector) > 0 { + fieldSelector, err := fields.ParseSelector(requestInfo.FieldSelector) + if err != nil { + record.FieldSelectorRequirements, record.FieldSelectorParsingErr = nil, err + } else { + if requirements := fieldSelector.Requirements(); len(requirements) > 0 { + record.FieldSelectorRequirements, record.FieldSelectorParsingErr = fieldSelector.Requirements(), nil } } - if len(requestInfo.LabelSelector) > 0 { - labelSelector, err := labels.Parse(requestInfo.LabelSelector) - if err != nil { - record.LabelSelectorRequirements, record.LabelSelectorParsingErr = nil, err - } else { - if requirements, _ /*selectable*/ := labelSelector.Requirements(); len(requirements) > 0 { - record.LabelSelectorRequirements, record.LabelSelectorParsingErr = requirements, nil - } + } + if len(requestInfo.LabelSelector) > 0 { + labelSelector, err := labels.Parse(requestInfo.LabelSelector) + if err != nil { + record.LabelSelectorRequirements, record.LabelSelectorParsingErr = nil, err + } else { + if requirements, _ /*selectable*/ := labelSelector.Requirements(); len(requirements) > 0 { + record.LabelSelectorRequirements, record.LabelSelectorParsingErr = requirements, nil } } } diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/get.go b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/get.go index 134e163eeb..93e5fcc93a 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/get.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/get.go @@ -256,9 +256,10 @@ func listOpts(req *http.Request, scope *RequestScope) (metainternalversion.ListO } func handleWatch(ctx context.Context, rw rest.Watcher, scope *RequestScope, req *http.Request, w http.ResponseWriter, opts metainternalversion.ListOptions, outputMediaType negotiation.MediaTypeOptions, minRequestTimeout time.Duration) error { + isWatchList := isListWatchRequest(opts) var span *tracing.Span var onWatchListComplete WatchListCompleteHook - if isListWatchRequest(opts) { + if isWatchList { ctx, span = tracing.Start(ctx, "WatchList", traceFields(req)...) onWatchListComplete = func() { span.End(500 * time.Millisecond) } req = req.WithContext(ctx) @@ -283,7 +284,7 @@ func handleWatch(ctx context.Context, rw rest.Watcher, scope *RequestScope, req if err != nil { return err } - handler, err := serveWatchHandler(watcher, scope, outputMediaType, req, w, timeout, metrics.CleanListScope(ctx, &opts), onWatchListComplete) + handler, err := serveWatchHandler(watcher, scope, outputMediaType, req, w, timeout, metrics.CleanListScope(ctx, &opts), isWatchList, onWatchListComplete) if err != nil { return err } diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/patch.go b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/patch.go index 060c7cc302..d23a897f1a 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/patch.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/patch.go @@ -18,6 +18,7 @@ package handlers import ( "context" + "encoding/json" "fmt" "net/http" "strings" @@ -130,7 +131,17 @@ func PatchResource(r rest.Patcher, scope *RequestScope, admit admission.Interfac admit = admission.WithAudit(admit) - audit.LogRequestPatch(req.Context(), patchBytes) + // Decode and convert the patch payload to JSON for storage into audit. + // the decision to reject the request for failure to decode before we record the request for audit. + // + // This guarantees that the audit event contains valid JSON, or the request is rejected. + patchForAudit, err := validateAndTranscodePatch(patchBytes, patchType) + if err != nil { + scope.err(err, w, req) + return + } + + audit.LogRequestPatch(req.Context(), patchForAudit) span.AddEvent("Recorded the audit event") var baseContentType string @@ -416,7 +427,7 @@ func (p *jsonPatcher) applyJSPatch(versionedJS []byte) (patchedJS []byte, strict return patchedJS, strictErrors, nil case types.MergePatchType: if p.validationDirective == metav1.FieldValidationStrict || p.validationDirective == metav1.FieldValidationWarn { - v := map[string]interface{}{} + v := map[string]any{} var err error strictErrors, err = kjson.UnmarshalStrict(p.patchBytes, &v) if err != nil { @@ -493,8 +504,8 @@ type applyPatcher struct { fieldManager *managedfields.FieldManager userAgent string validationDirective string - unmarshalFn func(data []byte, v interface{}) error - unmarshalStrictFn func(data []byte, v interface{}) error + unmarshalFn func(data []byte, v any) error + unmarshalStrictFn func(data []byte, v any) error } func (p *applyPatcher) applyPatchToCurrentObject(requestContext context.Context, obj runtime.Object) (runtime.Object, error) { @@ -506,9 +517,9 @@ func (p *applyPatcher) applyPatchToCurrentObject(requestContext context.Context, panic("FieldManager must be installed to run apply") } - patchObj := &unstructured.Unstructured{Object: map[string]interface{}{}} + patchObj := &unstructured.Unstructured{Object: map[string]any{}} if err := p.unmarshalFn(p.patch, &patchObj.Object); err != nil { - return nil, errors.NewBadRequest(fmt.Sprintf("error decoding YAML: %v", err)) + return nil, errors.NewBadRequest(fmt.Sprintf("error decoding patch: %v", err)) } obj, err := p.fieldManager.Apply(obj, patchObj, p.options.FieldManager, force) @@ -519,9 +530,9 @@ func (p *applyPatcher) applyPatchToCurrentObject(requestContext context.Context, // TODO: spawn something to track deciding whether a fieldValidation=Strict // fatal error should return before an error from the apply operation if p.validationDirective == metav1.FieldValidationStrict || p.validationDirective == metav1.FieldValidationWarn { - if err := p.unmarshalStrictFn(p.patch, &map[string]interface{}{}); err != nil { + if err := p.unmarshalStrictFn(p.patch, &map[string]any{}); err != nil { if p.validationDirective == metav1.FieldValidationStrict { - return nil, errors.NewBadRequest(fmt.Sprintf("error strict decoding YAML: %v", err)) + return nil, errors.NewBadRequest(fmt.Sprintf("error strict decoding patch: %v", err)) } addStrictDecodingWarnings(requestContext, []error{err}) } @@ -833,3 +844,29 @@ func patchToCreateOptions(po *metav1.PatchOptions) *metav1.CreateOptions { co.TypeMeta.SetGroupVersionKind(metav1.SchemeGroupVersion.WithKind("CreateOptions")) return co } + +func validateAndTranscodePatch(patchBytes []byte, patchType types.PatchType) ([]byte, error) { + switch patchType { + case types.ApplyCBORPatchType: + var obj any + if err := cbor.Unmarshal(patchBytes, &obj); err != nil { + return nil, errors.NewBadRequest(fmt.Sprintf("error decoding patch: %v", err)) + } + jsonBytes, err := json.Marshal(obj) + if err != nil { + return nil, errors.NewBadRequest(fmt.Sprintf("error encoding patch: %v", err)) + } + return jsonBytes, nil + case types.ApplyYAMLPatchType: + jsonBytes, err := yaml.ToJSON(patchBytes) + if err != nil { + return nil, errors.NewBadRequest(fmt.Sprintf("error encoding patch: %v", err)) + } + return jsonBytes, nil + default: + if !json.Valid(patchBytes) { + return nil, errors.NewBadRequest("invalid JSON patch") + } + return patchBytes, nil + } +} diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/compression.go b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/compression.go new file mode 100644 index 0000000000..78072ecb95 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/compression.go @@ -0,0 +1,82 @@ +/* +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. +*/ + +package responsewriters + +import ( + "compress/gzip" + "net/http" + "strings" + "sync" + + "k8s.io/apiserver/pkg/features" + utilfeature "k8s.io/apiserver/pkg/util/feature" + "k8s.io/component-base/featuregate" +) + +const ( + // gzipContentEncodingLevel is set to 1 which uses least CPU compared to higher levels, yet offers + // similar compression ratios (off by at most 1.5x, but typically within 1.1x-1.3x). For further details see - + // https://github.com/kubernetes/kubernetes/issues/112296 + gzipContentEncodingLevel = 1 +) + +// NewGzipWriterPoolOrDie returns a sync.Pool of gzip.Writers configured with gzipContentEncodingLevel. +func NewGzipWriterPoolOrDie() *sync.Pool { + return &sync.Pool{ + New: func() interface{} { + gw, err := gzip.NewWriterLevel(nil, gzipContentEncodingLevel) + if err != nil { + panic(err) + } + return gw + }, + } +} + +// responseContentEncodingSupported returns a supported client-requested content encoding for the +// provided request. It will return the empty string if no supported content encoding was +// found or if the APIResponseCompression feature gate is disabled. +func responseContentEncodingSupported(req *http.Request) string { + return ContentEncodingSupported(req, features.APIResponseCompression) +} + +// ContentEncodingSupported returns a supported client-requested content encoding for the +// provided request. It will return the empty string if no supported content encoding was +// found or if the provided feature gate is disabled. +func ContentEncodingSupported(req *http.Request, feature featuregate.Feature) string { + encoding := req.Header.Get("Accept-Encoding") + if len(encoding) == 0 { + return "" + } + if !utilfeature.DefaultFeatureGate.Enabled(feature) { + return "" + } + for len(encoding) > 0 { + var token string + if next := strings.Index(encoding, ","); next != -1 { + token = encoding[:next] + encoding = encoding[next+1:] + } else { + token = encoding + encoding = "" + } + if strings.TrimSpace(token) == "gzip" { + return "gzip" + } + } + return "" +} diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/writers.go b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/writers.go index cb782f76a3..33c4363c55 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/writers.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/writers.go @@ -24,8 +24,6 @@ import ( "io" "net/http" "strconv" - "strings" - "sync" "time" "go.opentelemetry.io/otel/attribute" @@ -104,11 +102,20 @@ func SerializeObject(mediaType string, encoder runtime.Encoder, hw http.Response w := &deferredResponseWriter{ mediaType: mediaType, statusCode: statusCode, - contentEncoding: negotiateContentEncoding(req), + contentEncoding: responseContentEncodingSupported(req), hw: hw, ctx: ctx, } + var memoryAllocator runtime.MemoryAllocator + if encoderWithAllocator, supportsAllocator := encoder.(runtime.EncoderWithAllocator); supportsAllocator { + memoryAllocator = runtime.AllocatorPool.Get().(*runtime.Allocator) + encoder = runtime.NewEncoderWithAllocator(encoderWithAllocator, memoryAllocator) + } + if memoryAllocator != nil { + defer runtime.AllocatorPool.Put(memoryAllocator) + } + err := encoder.Encode(object, w) if err == nil { err = w.Close() @@ -120,7 +127,8 @@ func SerializeObject(mediaType string, encoder runtime.Encoder, hw http.Response } // make a best effort to write the object if a failure is detected - utilruntime.HandleError(fmt.Errorf("apiserver was unable to write a JSON response: %v", err)) + utilruntime.HandleError(fmt.Errorf("apiserver was unable to write a %s response: %w", w.mediaType, err)) + w.discardBufferedResponse() status := ErrorToAPIStatus(err) candidateStatusCode := int(status.Code) // if the current status code is successful, allow the error's status code to overwrite it @@ -133,26 +141,14 @@ func SerializeObject(mediaType string, encoder runtime.Encoder, hw http.Response output = []byte(fmt.Sprintf("%s: %s", status.Reason, status.Message)) } if _, err := w.Write(output); err != nil { - utilruntime.HandleError(fmt.Errorf("apiserver was unable to write a fallback JSON response: %v", err)) + utilruntime.HandleError(fmt.Errorf("apiserver was unable to write a fallback %s response: %w", w.mediaType, err)) } w.Close() } -var gzipPool = &sync.Pool{ - New: func() interface{} { - gw, err := gzip.NewWriterLevel(nil, defaultGzipContentEncodingLevel) - if err != nil { - panic(err) - } - return gw - }, -} +var gzipPool = NewGzipWriterPoolOrDie() const ( - // defaultGzipContentEncodingLevel is set to 1 which uses least CPU compared to higher levels, yet offers - // similar compression ratios (off by at most 1.5x, but typically within 1.1x-1.3x). For further details see - - // https://github.com/kubernetes/kubernetes/issues/112296 - defaultGzipContentEncodingLevel = 1 // defaultGzipThresholdBytes is compared to the size of the first write from the stream // (usually the entire object), and if the size is smaller no gzipping will be performed // if the client requests it. @@ -162,34 +158,6 @@ const ( firstWriteStreamingThresholdBytes = 4 ) -// negotiateContentEncoding returns a supported client-requested content encoding for the -// provided request. It will return the empty string if no supported content encoding was -// found or if response compression is disabled. -func negotiateContentEncoding(req *http.Request) string { - encoding := req.Header.Get("Accept-Encoding") - if len(encoding) == 0 { - return "" - } - if !utilfeature.DefaultFeatureGate.Enabled(features.APIResponseCompression) { - return "" - } - for len(encoding) > 0 { - var token string - if next := strings.Index(encoding, ","); next != -1 { - token = encoding[:next] - encoding = encoding[next+1:] - } else { - token = encoding - encoding = "" - } - switch strings.TrimSpace(token) { - case "gzip": - return "gzip" - } - } - return "" -} - type deferredResponseWriter struct { mediaType string statusCode int @@ -245,6 +213,14 @@ func (w *deferredResponseWriter) Write(p []byte) (n int, err error) { } } +func (w *deferredResponseWriter) discardBufferedResponse() { + if w.hasWritten { + return + } + w.hasBuffered = false + w.buffer = nil +} + func (w *deferredResponseWriter) unbufferedWrite(p []byte) (n int, err error) { defer func() { w.totalBytes += n diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/rest.go b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/rest.go index 6d5a741468..e376f44089 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/rest.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/rest.go @@ -83,7 +83,7 @@ type RequestScope struct { Defaulter runtime.ObjectDefaulter Typer runtime.ObjectTyper UnsafeConvertor runtime.ObjectConvertor - Authorizer authorizer.Authorizer + Authorizer authorizer.UnconditionalAuthorizer EquivalentResourceMapper runtime.EquivalentResourceMapper diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/update.go b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/update.go index 446723234c..33944d9993 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/update.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/update.go @@ -255,7 +255,7 @@ func UpdateResource(r rest.Updater, scope *RequestScope, admit admission.Interfa } } -func withAuthorization(validate rest.ValidateObjectFunc, a authorizer.Authorizer, attributes authorizer.Attributes) rest.ValidateObjectFunc { +func withAuthorization(validate rest.ValidateObjectFunc, a authorizer.UnconditionalAuthorizer, attributes authorizer.Attributes) rest.ValidateObjectFunc { var once sync.Once var authorizerDecision authorizer.Decision var authorizerReason string diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/watch.go b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/watch.go index 9121ec3fad..9b8d18ce4f 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/watch.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/watch.go @@ -17,6 +17,7 @@ limitations under the License. package handlers import ( + "compress/gzip" "context" "fmt" "io" @@ -34,6 +35,7 @@ import ( "k8s.io/apimachinery/pkg/watch" "k8s.io/apiserver/pkg/audit" "k8s.io/apiserver/pkg/endpoints/handlers/negotiation" + "k8s.io/apiserver/pkg/endpoints/handlers/responsewriters" "k8s.io/apiserver/pkg/endpoints/metrics" apirequest "k8s.io/apiserver/pkg/endpoints/request" "k8s.io/apiserver/pkg/features" @@ -69,7 +71,7 @@ func (w *realTimeoutFactory) TimeoutCh() (<-chan time.Time, func() bool) { // serveWatchHandler returns a handle to serve a watch response. // TODO: the functionality in this method and in WatchServer.Serve is not cleanly decoupled. -func serveWatchHandler(watcher watch.Interface, scope *RequestScope, mediaTypeOptions negotiation.MediaTypeOptions, req *http.Request, w http.ResponseWriter, timeout time.Duration, metricsScope string, completeHook WatchListCompleteHook) (http.Handler, error) { +func serveWatchHandler(watcher watch.Interface, scope *RequestScope, mediaTypeOptions negotiation.MediaTypeOptions, req *http.Request, w http.ResponseWriter, timeout time.Duration, metricsScope string, isWatchListRequest bool, completeHook WatchListCompleteHook) (http.Handler, error) { options, err := optionsForTransform(mediaTypeOptions, req) if err != nil { return nil, err @@ -177,6 +179,7 @@ func serveWatchHandler(watcher watch.Interface, scope *RequestScope, mediaTypeOp ServerShuttingDownCh: serverShuttingDownCh, metricsScope: metricsScope, + isWatchListRequest: isWatchListRequest, watchListCompleteHook: completeHook, } @@ -208,6 +211,7 @@ type WatchServer struct { ServerShuttingDownCh <-chan struct{} metricsScope string + isWatchListRequest bool watchListCompleteHook WatchListCompleteHook } @@ -236,6 +240,123 @@ func (c *watchEventMetricsRecorder) RecordEvent() { c.sizeMetric.Observe(float64(c.byteCount.Swap(0))) } +// watchGzipPool is a no-op until the first Get call (https://pkg.go.dev/sync#Pool.Get). +var watchGzipPool = responsewriters.NewGzipWriterPoolOrDie() + +type watchStreamWriter interface { + io.WriteCloser + Flush() error +} + +var _ watchStreamWriter = &plainResponseWriter{} + +type plainResponseWriter struct { + w http.ResponseWriter + flusher http.Flusher +} + +func (p *plainResponseWriter) Write(b []byte) (int, error) { + return p.w.Write(b) +} + +func (p *plainResponseWriter) Flush() error { + p.flusher.Flush() + return nil +} + +// Close is a no-op because http.ResponseWriter (p.w) doesn't implement io.Closer. +func (p *plainResponseWriter) Close() error { + return nil +} + +var _ watchStreamWriter = &perFlushGzipWriter{} + +type perFlushGzipWriter struct { + delegateRW http.ResponseWriter + flusher http.Flusher + gw *gzip.Writer +} + +func (p *perFlushGzipWriter) Write(b []byte) (int, error) { + if p.gw == nil { + p.gw = watchGzipPool.Get().(*gzip.Writer) + p.gw.Reset(p.delegateRW) + } + return p.gw.Write(b) +} + +// Flush writes compressed data to the client and releases the gzip.Writer back to the pool. +func (p *perFlushGzipWriter) Flush() error { + // no writer means Write was not called, nothing to flush + if p.gw == nil { + return nil + } + if err := p.gw.Flush(); err != nil { + return err + } + err := p.Close() + p.flusher.Flush() + return err +} + +func (p *perFlushGzipWriter) Close() error { + if p.gw == nil { + return nil + } + err := p.gw.Close() + p.gw.Reset(nil) + watchGzipPool.Put(p.gw) + // prevent double-close returning the writer to the pool twice + p.gw = nil + return err +} + +var _ io.Writer = &watchResponseWriter{} + +type watchResponseWriter struct { + delegateRW http.ResponseWriter + flusher http.Flusher + contentEncoding string + isWatchListRequest bool + writer watchStreamWriter +} + +func newWatchResponseWriter(delegateRW http.ResponseWriter, flusher http.Flusher, contentEncoding string, isWatchListRequest bool) *watchResponseWriter { + return &watchResponseWriter{ + delegateRW: delegateRW, + flusher: flusher, + contentEncoding: contentEncoding, + isWatchListRequest: isWatchListRequest, + writer: &plainResponseWriter{w: delegateRW, flusher: flusher}, + } +} + +func (w *watchResponseWriter) BeginStream(mediaType string) { + w.delegateRW.Header().Set("Content-Type", mediaType) + w.delegateRW.Header().Set("Transfer-Encoding", "chunked") + if w.contentEncoding == "gzip" && w.isWatchListRequest { + w.delegateRW.Header().Set("Content-Encoding", "gzip") + w.delegateRW.Header().Add("Vary", "Accept-Encoding") + w.writer = &perFlushGzipWriter{delegateRW: w.delegateRW, flusher: w.flusher} + } + w.delegateRW.WriteHeader(http.StatusOK) + // Flush HTTP headers only + // gzip applies to the body, not headers. + w.flusher.Flush() +} + +func (w *watchResponseWriter) Write(p []byte) (int, error) { + return w.writer.Write(p) +} + +func (w *watchResponseWriter) Flush() error { + return w.writer.Flush() +} + +func (w *watchResponseWriter) Close() error { + return w.writer.Close() +} + // HandleHTTP serves a series of encoded events via HTTP with Transfer-Encoding: chunked. // or over a websocket connection. func (s *WatchServer) HandleHTTP(w http.ResponseWriter, req *http.Request) { @@ -262,7 +383,15 @@ func (s *WatchServer) HandleHTTP(w http.ResponseWriter, req *http.Request) { return } - framer := s.Framer.NewFrameWriter(w) + contentEncoding := responsewriters.ContentEncodingSupported(req, features.WatchListCompression) + rw := newWatchResponseWriter(w, flusher, contentEncoding, s.isWatchListRequest) + defer func() { + if err := rw.Close(); err != nil { + utilruntime.HandleErrorWithContext(req.Context(), err, "Failed to close watch response writer") + } + }() + + framer := s.Framer.NewFrameWriter(rw) if framer == nil { // programmer error err := fmt.Errorf("no stream framing support is available for media type %q", s.MediaType) @@ -276,10 +405,7 @@ func (s *WatchServer) HandleHTTP(w http.ResponseWriter, req *http.Request) { defer cleanup() // begin the stream - w.Header().Set("Content-Type", s.MediaType) - w.Header().Set("Transfer-Encoding", "chunked") - w.WriteHeader(http.StatusOK) - flusher.Flush() + rw.BeginStream(s.MediaType) gvr := s.Scope.Resource @@ -324,7 +450,10 @@ func (s *WatchServer) HandleHTTP(w http.ResponseWriter, req *http.Request) { recorder.RecordEvent() if len(ch) == 0 { - flusher.Flush() + if err := rw.Flush(); err != nil { + utilruntime.HandleErrorWithContext(req.Context(), err, "Failed to flush watch response") + return + } } if isWatchListLatencyRecordingRequired { // Record completion of initial listing phase for WatchList @@ -341,6 +470,11 @@ func (s *WatchServer) HandleHTTP(w http.ResponseWriter, req *http.Request) { span.End(5 * time.Second) s.watchListCompleteHook() } + // release the gzip writer back to the pool so idle watches don't hold gzip state. + if err := rw.Flush(); err != nil { + utilruntime.HandleErrorWithContext(req.Context(), err, "Failed to flush watch response after initial events") + return + } } } } diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/installer.go b/vendor/k8s.io/apiserver/pkg/endpoints/installer.go index 56c392fd05..d6cd2b7568 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/installer.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/installer.go @@ -30,6 +30,7 @@ import ( "golang.org/x/text/cases" "golang.org/x/text/language" + apidiscoveryv2 "k8s.io/api/apidiscovery/v2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/conversion" @@ -1177,7 +1178,7 @@ func AddObjectParams(ws *restful.WebService, route *restful.RouteBuilder, obj in } fallthrough default: - jsonTag := sf.Tag.Get("json") + jsonTag, _ := sf.Tag.Lookup("json") if len(jsonTag) == 0 { continue } diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/metrics/metrics.go b/vendor/k8s.io/apiserver/pkg/endpoints/metrics/metrics.go index a4da6ebe2f..a134eed9e2 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/metrics/metrics.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/metrics/metrics.go @@ -105,21 +105,6 @@ var ( }, []string{"verb", "dry_run", "group", "version", "resource", "subresource", "scope", "component"}, ) - requestSloLatencies = compbasemetrics.NewHistogramVec( - &compbasemetrics.HistogramOpts{ - Subsystem: APIServerComponent, - Name: "request_slo_duration_seconds", - Help: "Response latency distribution (not counting webhook duration and priority & fairness queue wait times) in seconds for each verb, group, version, resource, subresource, scope and component.", - // This metric is supplementary to the requestLatencies metric. - // It measures request duration excluding webhooks as they are mostly - // dependant on user configuration. - Buckets: []float64{0.05, 0.1, 0.2, 0.4, 0.6, 0.8, 1.0, 1.25, 1.5, 2, 3, - 4, 5, 6, 8, 10, 15, 20, 30, 45, 60}, - StabilityLevel: compbasemetrics.ALPHA, - DeprecatedVersion: "1.27.0", - }, - []string{"verb", "group", "version", "resource", "subresource", "scope", "component"}, - ) requestSliLatencies = compbasemetrics.NewHistogramVec( &compbasemetrics.HistogramOpts{ Subsystem: APIServerComponent, @@ -172,7 +157,7 @@ var ( Subsystem: APIServerComponent, Name: "watch_events_total", Help: "Number of events sent in watch clients", - StabilityLevel: compbasemetrics.ALPHA, + StabilityLevel: compbasemetrics.BETA, }, []string{"group", "version", "resource"}, ) @@ -182,7 +167,7 @@ var ( Name: "watch_events_sizes", Help: "Watch event size distribution in bytes", Buckets: compbasemetrics.ExponentialBuckets(1024, 2.0, 8), // 1K, 2K, 4K, 8K, ..., 128K. - StabilityLevel: compbasemetrics.ALPHA, + StabilityLevel: compbasemetrics.BETA, }, []string{"group", "version", "resource"}, ) @@ -285,10 +270,14 @@ var ( watchListLatencies = compbasemetrics.NewHistogramVec( &compbasemetrics.HistogramOpts{ - Subsystem: APIServerComponent, - Name: "watch_list_duration_seconds", - Help: "Response latency distribution in seconds for watch list requests broken by group, version, resource and scope.", - Buckets: []float64{0.05, 0.1, 0.2, 0.4, 0.6, 0.8, 1.0, 2, 4, 6, 8, 10, 15, 20, 30, 45, 60}, + Subsystem: APIServerComponent, + Name: "watch_list_duration_seconds", + Help: "Response latency distribution in seconds for watch list requests broken by group, version, resource and scope.", + // This metric is used for verifying api call latencies SLO, + // as well as tracking regressions in this aspects. + // Thus we customize buckets significantly, to empower both usecases. + Buckets: []float64{0.05, 0.1, 0.2, 0.4, 0.6, 0.8, 1.0, 1.25, 1.5, 2, 3, + 4, 5, 6, 8, 10, 15, 20, 30, 45, 60, 90, 120, 180, 300}, StabilityLevel: compbasemetrics.BETA, }, []string{"group", "version", "resource", "scope"}, @@ -299,7 +288,6 @@ var ( requestCounter, longRunningRequestsGauge, requestLatencies, - requestSloLatencies, requestSliLatencies, fieldValidationRequestLatencies, responseSizes, @@ -610,7 +598,6 @@ func MonitorRequest(req *http.Request, verb, group, version, resource, subresour if wd, ok := request.LatencyTrackersFrom(req.Context()); ok && dryRun == "" { sliLatency := elapsedSeconds - (wd.MutatingWebhookTracker.GetLatency() + wd.ValidatingWebhookTracker.GetLatency() + wd.APFQueueWaitTracker.GetLatency()).Seconds() - requestSloLatencies.WithContext(req.Context()).WithLabelValues(reportedVerb, group, version, resource, subresource, scope, component).Observe(sliLatency) requestSliLatencies.WithContext(req.Context()).WithLabelValues(reportedVerb, group, version, resource, subresource, scope, component).Observe(sliLatency) } // We are only interested in response sizes of read requests. diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/request/requestinfo.go b/vendor/k8s.io/apiserver/pkg/endpoints/request/requestinfo.go index 1cf14d892f..ea6ee3a6ea 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/request/requestinfo.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/request/requestinfo.go @@ -27,8 +27,6 @@ import ( metainternalversionscheme "k8s.io/apimachinery/pkg/apis/meta/internalversion/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" - genericfeatures "k8s.io/apiserver/pkg/features" - utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/klog/v2" ) @@ -258,19 +256,17 @@ func (r *RequestInfoFactory) NewRequestInfo(req *http.Request) (*RequestInfo, er requestInfo.Verb = "deletecollection" } - if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.AuthorizeWithSelectors) { - // Don't support selector authorization on requests that used the deprecated verb-via-path mechanism, since they don't support selectors consistently. - // There are multi-object and single-object watch endpoints, and only the multi-object one supports selectors. - if !verbViaPathPrefix && verbsWithSelectors.Has(requestInfo.Verb) { - // interestingly these are parsed above, but the current structure there means that if one (or anything) in the - // listOptions fails to decode, the field and label selectors are lost. - // therefore, do the straight query param read here. - if vals := req.URL.Query()["fieldSelector"]; len(vals) > 0 { - requestInfo.FieldSelector = vals[0] - } - if vals := req.URL.Query()["labelSelector"]; len(vals) > 0 { - requestInfo.LabelSelector = vals[0] - } + // Don't support selector authorization on requests that used the deprecated verb-via-path mechanism, since they don't support selectors consistently. + // There are multi-object and single-object watch endpoints, and only the multi-object one supports selectors. + if !verbViaPathPrefix && verbsWithSelectors.Has(requestInfo.Verb) { + // interestingly these are parsed above, but the current structure there means that if one (or anything) in the + // listOptions fails to decode, the field and label selectors are lost. + // therefore, do the straight query param read here. + if vals := req.URL.Query()["fieldSelector"]; len(vals) > 0 { + requestInfo.FieldSelector = vals[0] + } + if vals := req.URL.Query()["labelSelector"]; len(vals) > 0 { + requestInfo.LabelSelector = vals[0] } } diff --git a/vendor/k8s.io/apiserver/pkg/features/kube_features.go b/vendor/k8s.io/apiserver/pkg/features/kube_features.go index dbe776e8af..9b22ba4882 100644 --- a/vendor/k8s.io/apiserver/pkg/features/kube_features.go +++ b/vendor/k8s.io/apiserver/pkg/features/kube_features.go @@ -44,10 +44,12 @@ const ( // Assigns each kube-apiserver an ID in a cluster. APIServerIdentity featuregate.Feature = "APIServerIdentity" - // owner: @dashpole + // owner: @pmengelbert + // kep: https://kep.k8s.io/6060 // - // Add support for distributed tracing in the API Server - APIServerTracing featuregate.Feature = "APIServerTracing" + // Controls whether the apiserver supports dispensing tokens for authenticating + // the Kubernetes API Server and Aggregated API Servers to webhooks. + APIServerWebhookAuthenticationToken featuregate.Feature = "APIServerWebhookAuthenticationToken" // owner: @linxiulei // @@ -66,7 +68,7 @@ const ( // Allow user.DefaultInfo.UID to be set from x509 cert during cert auth. AllowParsingUserUIDFromCertAuth featuregate.Feature = "AllowParsingUserUIDFromCertAuth" - // owner: @stlaz @tkashem @dgrisonnet + // owner: @stlaz @tkashem @dgrisonnet @ibihim // kep: https://kep.k8s.io/3926 // // Enables the cluster admin to identify resources that fail to @@ -75,23 +77,6 @@ const ( // resources using the Kubernetes API only. AllowUnsafeMalformedObjectDeletion featuregate.Feature = "AllowUnsafeMalformedObjectDeletion" - // owner: @vinayakankugoyal - // kep: https://kep.k8s.io/4633 - // - // Allows us to enable anonymous auth for only certain apiserver endpoints. - AnonymousAuthConfigurableEndpoints featuregate.Feature = "AnonymousAuthConfigurableEndpoints" - - // owner: @deads2k - // kep: https://kep.k8s.io/4601 - // - // Allows authorization to use field and label selectors. - AuthorizeWithSelectors featuregate.Feature = "AuthorizeWithSelectors" - - // owner: @serathius - // - // Replaces watch cache hashmap implementation with a btree based one, bringing performance improvements. - BtreeWatchCache featuregate.Feature = "BtreeWatchCache" - // owner: @benluddy // kep: https://kep.k8s.io/4222 // @@ -103,11 +88,12 @@ const ( // Enables concurrent watch object decoding to avoid starving watch cache when conversion webhook is installed. ConcurrentWatchObjectDecode featuregate.Feature = "ConcurrentWatchObjectDecode" - // owner: @serathius - // kep: http://kep.k8s.io/2340 + // owner: @yedou37 // - // Allow the API server to serve consistent lists from cache - ConsistentListFromCache featuregate.Feature = "ConsistentListFromCache" + // Skip the timeout fallback to storage when a consistent LIST from cache cannot be served, + // and return a retryable response instead. + // See https://github.com/kubernetes/kubernetes/issues/138494. + ConsistentListFromCacheSkipTimeoutFallback featuregate.Feature = "ConsistentListFromCacheSkipTimeoutFallback" // owner: @enj @qiujian16 // kep: https://kep.k8s.io/5284 @@ -125,10 +111,10 @@ const ( // kep: http://kep.k8s.io/5073 // beta: v1.33 // - // Enables running declarative validation of APIs, where declared. When enabled, APIs with - // declarative validation rules will validate objects using the generated - // declarative validation code and compare the results to the regular imperative validation. - // See DeclarativeValidationBeta for more. + // When enabled, results of declarative validation are compared against handwritten + // validation and mismatches are logged as metrics. Declarative validation itself is + // always executed independent of this gate; per-tag enforcement is controlled by the + // lifecycle prefix and the DeclarativeValidationBeta gate. DeclarativeValidation featuregate.Feature = "DeclarativeValidation" // owner: @jpbetz @aaron-prindle @yongruilin @@ -141,11 +127,10 @@ const ( // In Shadow mode, declarative validation is executed and mismatches against handwritten // validation are logged as metrics, but failures do not reject requests. // Handwritten validation remains authoritative and enforced. - // Enforcement logic for resources using WithDeclarativeEnforcement(): + // Enforcement by lifecycle prefix: // - Standard tags (no prefix): Always Enforced (Bypasses this gate). // - Beta tags (+k8s:beta): Enforced when this gate is enabled (default), otherwise Shadowed. // - Alpha tags (+k8s:alpha): Always Shadowed. - // This gate has no effect if the master DeclarativeValidation feature gate is disabled. DeclarativeValidationBeta featuregate.Feature = "DeclarativeValidationBeta" // owner: @jpbetz @aaron-prindle @yongruilin @@ -168,6 +153,19 @@ const ( // Enabled cache inconsistency detection. DetectCacheInconsistency featuregate.Feature = "DetectCacheInconsistency" + // owner: @jefftree + // + // Enables the RangeStream RPC for list operations in etcd. + EtcdRangeStream featuregate.Feature = "EtcdRangeStream" + + // owner: @aramase @BenTheElder + // kep: https://kep.k8s.io/5793 + // + // Enables excluding the same set of authentication and authorization virtual resources + // from ValidatingAdmissionWebhook and MutatingAdmissionWebhook that ValidatingAdmissionPolicy + // and MutatingAdmissionPolicy already exclude. + ExcludeAdmissionWebhookVirtualResources featuregate.Feature = "ExcludeAdmissionWebhookVirtualResources" + // owner: @aramase // kep: https://kep.k8s.io/3299 // deprecated: v1.28 @@ -210,17 +208,6 @@ const ( // headers when forwarding requests to the servers serving the aggregated API. RemoteRequestHeaderUID featuregate.Feature = "RemoteRequestHeaderUID" - // owner: @wojtek-t - // - // Enables resilient watchcache initialization to avoid controlplane - // overload. - ResilientWatchCacheInitialization featuregate.Feature = "ResilientWatchCacheInitialization" - - // owner: @jpbetz - // Resource create requests using generateName are retried automatically by the apiserver - // if the generated name conflicts with an existing resource name, up to a maximum number of 7 retries. - RetryGenerateName featuregate.Feature = "RetryGenerateName" - // owner: @cici37 // // Allow watch cache to create a watch on a dedicated RPC. @@ -251,20 +238,6 @@ const ( // document. StorageVersionHash featuregate.Feature = "StorageVersionHash" - // owner: @serathius - // Allow API server JSON encoder to encode collections item by item, instead of all at once. - StreamingCollectionEncodingToJSON featuregate.Feature = "StreamingCollectionEncodingToJSON" - - // owner: @serathius - // Allow API server Protobuf encoder to encode collections item by item, instead of all at once. - StreamingCollectionEncodingToProtobuf featuregate.Feature = "StreamingCollectionEncodingToProtobuf" - - // owner: @aramase, @enj, @nabokihms - // kep: https://kep.k8s.io/3331 - // - // Enables Structured Authentication Configuration - StructuredAuthenticationConfiguration featuregate.Feature = "StructuredAuthenticationConfiguration" - // owner: @aramase, @enj, @nabokihms // kep: https://kep.k8s.io/3331 // @@ -318,6 +291,19 @@ const ( // // Allow the API server to stream individual items instead of chunking WatchList featuregate.Feature = "WatchList" + + // owner: @p0lyn0mial + // + // Enables compression for WatchList responses + WatchListCompression featuregate.Feature = "WatchListCompression" + + // owner: @aojea + // beta: v1.37 + // + // Enables using a custom resolving RoundTripper to load-balance admission + // webhook requests across service endpoints instead of caching connections + // by service name. + WebhookRoundTripLoadBalancing featuregate.Feature = "WebhookRoundTripLoadBalancing" ) func init() { @@ -342,10 +328,8 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.26"), Default: true, PreRelease: featuregate.Beta}, }, - APIServerTracing: { - {Version: version.MustParse("1.22"), Default: false, PreRelease: featuregate.Alpha}, - {Version: version.MustParse("1.27"), Default: true, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.37 + APIServerWebhookAuthenticationToken: { + {Version: version.MustParse("1.37"), Default: false, PreRelease: featuregate.Alpha}, }, APIServingWithRoutine: { @@ -364,23 +348,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate AllowUnsafeMalformedObjectDeletion: { {Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, - }, - - AnonymousAuthConfigurableEndpoints: { - {Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Alpha}, - {Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, - }, - - AuthorizeWithSelectors: { - {Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Alpha}, - {Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.37 - }, - - BtreeWatchCache: { - {Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, + {Version: version.MustParse("1.37"), Default: true, PreRelease: featuregate.Beta}, }, CBORServingAndStorage: { @@ -389,12 +357,11 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate ConcurrentWatchObjectDecode: { {Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.37"), Default: true, PreRelease: featuregate.Beta}, }, - ConsistentListFromCache: { - {Version: version.MustParse("1.28"), Default: false, PreRelease: featuregate.Alpha}, - {Version: version.MustParse("1.31"), Default: true, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, + ConsistentListFromCacheSkipTimeoutFallback: { + {Version: version.MustParse("1.37"), Default: false, PreRelease: featuregate.Alpha}, }, ConstrainedImpersonation: { @@ -419,12 +386,21 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate DeclarativeValidationTakeover: { {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Beta}, {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Deprecated}, + {Version: version.MustParse("1.37"), Default: false, PreRelease: featuregate.Deprecated, LockToDefault: true}, }, DetectCacheInconsistency: { {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.Beta}, }, + EtcdRangeStream: { + {Version: version.MustParse("1.37"), Default: true, PreRelease: featuregate.Beta}, + }, + + ExcludeAdmissionWebhookVirtualResources: { + {Version: version.MustParse("1.37"), Default: true, PreRelease: featuregate.Beta}, + }, + KMSv1: { {Version: version.MustParse("1.0"), Default: true, PreRelease: featuregate.GA}, {Version: version.MustParse("1.28"), Default: true, PreRelease: featuregate.Deprecated}, @@ -438,6 +414,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate ManifestBasedAdmissionControlConfig: { {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.37"), Default: true, PreRelease: featuregate.Beta}, }, MutatingAdmissionPolicy: { @@ -456,17 +433,6 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Beta}, }, - ResilientWatchCacheInitialization: { - {Version: version.MustParse("1.31"), Default: true, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, - }, - - RetryGenerateName: { - {Version: version.MustParse("1.30"), Default: false, PreRelease: featuregate.Alpha}, - {Version: version.MustParse("1.31"), Default: true, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.32"), Default: true, LockToDefault: true, PreRelease: featuregate.GA}, - }, - SeparateCacheWatchRPC: { {Version: version.MustParse("1.28"), Default: true, PreRelease: featuregate.Beta}, {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Deprecated}, @@ -490,22 +456,6 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.15"), Default: true, PreRelease: featuregate.Beta}, }, - StreamingCollectionEncodingToJSON: { - {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, - }, - - StreamingCollectionEncodingToProtobuf: { - {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, - }, - - StructuredAuthenticationConfiguration: { - {Version: version.MustParse("1.29"), Default: false, PreRelease: featuregate.Alpha}, - {Version: version.MustParse("1.30"), Default: true, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // GA and LockToDefault in 1.34, remove in 1.37 - }, - StructuredAuthenticationConfigurationEgressSelector: { {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.Beta}, }, @@ -531,6 +481,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate WatchCacheInitializationPostStartHook: { {Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Beta}, {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.37"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, }, WatchList: { @@ -540,4 +491,12 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Beta}, {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.Beta}, }, + + WatchListCompression: { + {Version: version.MustParse("1.37"), Default: true, PreRelease: featuregate.Beta}, + }, + + WebhookRoundTripLoadBalancing: { + {Version: version.MustParse("1.37"), Default: true, PreRelease: featuregate.Beta}, + }, } diff --git a/vendor/k8s.io/apiserver/pkg/registry/generic/registry/corrupt_obj_deleter.go b/vendor/k8s.io/apiserver/pkg/registry/generic/registry/corrupt_obj_deleter.go index 2c37b0b5d3..6b8ab4011f 100644 --- a/vendor/k8s.io/apiserver/pkg/registry/generic/registry/corrupt_obj_deleter.go +++ b/vendor/k8s.io/apiserver/pkg/registry/generic/registry/corrupt_obj_deleter.go @@ -19,17 +19,16 @@ package registry import ( "context" "errors" - "strings" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/validation/field" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" genericapirequest "k8s.io/apiserver/pkg/endpoints/request" "k8s.io/apiserver/pkg/registry/rest" "k8s.io/apiserver/pkg/storage" storeerr "k8s.io/apiserver/pkg/storage/errors" + "k8s.io/apiserver/pkg/util/dryrun" "k8s.io/klog/v2" "k8s.io/utils/ptr" @@ -38,13 +37,12 @@ import ( // the corrupt object deleter has the same interface as rest.GracefulDeleter var _ rest.GracefulDeleter = &corruptObjectDeleter{} -// NewCorruptObjectDeleter returns a deleter that can perform unsafe deletion -// of corrupt objects, it makes an attempt to perform a normal deletion flow -// first, and if the normal deletion flow fails with a corrupt object error -// then it performs the unsafe delete of the object. +// NewCorruptObjectDeleter returns a deleter that can perform unsafe deletion of corrupt +// objects. The deletion will be rejected if the object turns out to be decodable (i.e. not actually +// corrupt). // -// NOTE: it skips precondition checks, finalizer constraints, and any -// post deletion hook defined in 'AfterDelete' of the registry. +// NOTE: it skips precondition checks, finalizer constraints, and any post deletion hook defined in +// 'AfterDelete' of the registry. // // WARNING: This may break the cluster if the resource being deleted has dependencies. func NewCorruptObjectDeleter(store *Store) rest.GracefulDeleter { @@ -56,6 +54,28 @@ type corruptObjectDeleter struct { store *Store } +// errUnsafeDeleteDryRun is a sentinel error returned by the deletion validator +// on dry run requests. Calling the validation function before the delete +// transaction is a system-wide invariant: it is how delete admission runs for +// every delete in Kubernetes. No storage implementation can skip it. +// +// getState(key, expectTransformOrDecodeError=true) +// key not found -> KeyNotFoundError, validator never runs +// decodes cleanly -> InvalidObjError, validator never runs +// transform/decode fails -> validateDeletion, then OptimisticDelete +// +// Getting this error back means the object is corrupt at the latest revision +// and the delete would have gone through. +var errUnsafeDeleteDryRun = errors.New("aborting unsafe delete, dry run requested") + +// errUnsafeDeleteDryRunBypassed indicates the storage deleted the object +// without calling the deletion validator on a dry run request. This MUST +// NEVER happen with ANY storage.Interface implementation. The validator is +// the same parameter that carries delete admission for regular deletion +// requests, see Store.Delete. A backend that triggers this error has a bug +// that allows object deletion without running delete admission. +var errUnsafeDeleteDryRunBypassed = errors.New("storage deleted the object despite the dry run request") + // Delete performs an unsafe deletion of the given resource from the storage. // // NOTE: This function should NEVER be used for any normal deletion @@ -72,41 +92,18 @@ func (d *corruptObjectDeleter) Delete(ctx context.Context, name string, deleteVa if err != nil { return nil, false, err } - obj := d.store.NewFunc() qualifiedResource := d.store.qualifiedResourceFromContext(ctx) - // use the storage implementation directly, bypass the dryRun layer + // Bypass the DryRunnableStorage layer as it was never designed to + // deal with corrupt objects (its dry run simulation is Get + decode). + // The call below must always land in the etcd3 store, see Delete in + // https://github.com/kubernetes/kubernetes/blob/6a5cc912a3c2a2c241fe05abea563079bf574abd/staging/src/k8s.io/apiserver/pkg/storage/etcd3/store.go#L336-L354 storageBackend := d.store.Storage.Storage - // we leave ResourceVersion as empty in the GetOptions so the - // object is retrieved from the underlying storage directly - err = storageBackend.Get(ctx, key, storage.GetOptions{}, obj) - if err == nil || !storage.IsCorruptObject(err) { - // TODO: The Invalid error should have a field for Resource. - // After that field is added, we should fill the Resource and - // leave the Kind field empty. See the discussion in #18526. - qualifiedKind := schema.GroupKind{Group: qualifiedResource.Group, Kind: qualifiedResource.Resource} - fieldErrList := field.ErrorList{ - field.Invalid(field.NewPath("ignoreStoreReadErrorWithClusterBreakingPotential"), true, "is exclusively used to delete corrupt object(s), try again by removing this option"), - } - return nil, false, apierrors.NewInvalid(qualifiedKind, name, fieldErrList) - } - - // try normal deletion anyway, it is expected to fail - obj, deleted, err := d.store.Delete(ctx, name, deleteValidation, opts) - if err == nil { - return obj, deleted, err - } - // TODO: unfortunately we can't do storage.IsCorruptObject(err), - // conversion to API error drops the inner error chain - if !strings.Contains(err.Error(), "corrupt object") { - return obj, deleted, err - } - - // TODO: at this instant, some actor may have a) managed to recreate this - // object by doing a delete+create, or b) the underlying error has resolved - // since the last time we checked, and the object is readable now. klog.FromContext(ctx).V(1).Info("Going to perform unsafe object deletion", "object", klog.KRef(genericapirequest.NamespaceValue(ctx), name)) out := d.store.NewFunc() - storageOpts := storage.DeleteOptions{IgnoreStoreReadError: true} + // ExpectTransformOrDecodeError forces a live read from etcd and makes + // the delete fail unless the object is corrupt: not found and + // decodable objects return errors. + storageOpts := storage.DeleteOptions{ExpectTransformOrDecodeError: true} // we don't have the old object in the cache, neither can it be // retrieved from the storage and decoded into an object // successfully, so we do the following: @@ -114,15 +111,30 @@ func (d *corruptObjectDeleter) Delete(ctx context.Context, name string, deleteVa // b) skip admission validation, rest.ValidateAllObjectFunc will "admit everything" var nilPreconditions *storage.Preconditions = nil var nilCachedExistingObject runtime.Object = nil - if err := storageBackend.Delete(ctx, key, out, nilPreconditions, rest.ValidateAllObjectFunc, nilCachedExistingObject, storageOpts); err != nil { - if storage.IsNotFound(err) { - // the DELETE succeeded, but we don't have the object since it's - // not retrievable from the storage, so we send a nil object - return nil, false, nil + if dryrun.IsDryRun(opts.DryRun) { + err := storageBackend.Delete( + ctx, key, out, nilPreconditions, + func(context.Context, runtime.Object) error { return errUnsafeDeleteDryRun }, + nilCachedExistingObject, storageOpts, + ) + switch { + case errors.Is(err, errUnsafeDeleteDryRun): + // the object is corrupt at the latest revision, the + // delete would have proceeded + return nil, true, nil + case err == nil: + // Should never happen. Indicates a critical bug in the + // storage.Interface implementation, see errUnsafeDeleteDryRunBypassed + utilruntime.HandleErrorWithContext(ctx, errUnsafeDeleteDryRunBypassed, "The storage bypassed delete admission on a dry run request", "object", klog.KRef(genericapirequest.NamespaceValue(ctx), name)) + return nil, false, apierrors.NewInternalError(errUnsafeDeleteDryRunBypassed) + default: + return nil, false, storeerr.InterpretDeleteError(err, qualifiedResource, name) } + } + if err := storageBackend.Delete(ctx, key, out, nilPreconditions, rest.ValidateAllObjectFunc, nilCachedExistingObject, storageOpts); err != nil { return nil, false, storeerr.InterpretDeleteError(err, qualifiedResource, name) } - // the DELETE succeeded, but we don't have the object sine it's - // not retrievable from the storage, so we send a nil objct + // the DELETE succeeded, but we don't have the object since it's + // not retrievable from the storage, so we send a nil object return nil, true, nil } diff --git a/vendor/k8s.io/apiserver/pkg/registry/generic/registry/storage_factory.go b/vendor/k8s.io/apiserver/pkg/registry/generic/registry/storage_factory.go index d36dd263ff..b22ef3f620 100644 --- a/vendor/k8s.io/apiserver/pkg/registry/generic/registry/storage_factory.go +++ b/vendor/k8s.io/apiserver/pkg/registry/generic/registry/storage_factory.go @@ -37,7 +37,7 @@ func StorageWithCacher() generic.StorageDecorator { return func( storageConfig *storagebackend.ConfigForResource, resourcePrefix string, - keyFunc func(obj runtime.Object) (string, error), + cacheKeyFunc func(obj runtime.Object) (string, error), newFunc func() runtime.Object, newListFunc func() runtime.Object, getAttrsFunc storage.AttrFunc, @@ -59,7 +59,7 @@ func StorageWithCacher() generic.StorageDecorator { GroupResource: storageConfig.GroupResource, EventsHistoryWindow: storageConfig.EventsHistoryWindow, ResourcePrefix: resourcePrefix, - KeyFunc: keyFunc, + KeyFunc: cacheKeyFunc, NewFunc: newFunc, NewListFunc: newListFunc, GetAttrsFunc: getAttrsFunc, diff --git a/vendor/k8s.io/apiserver/pkg/registry/generic/registry/store.go b/vendor/k8s.io/apiserver/pkg/registry/generic/registry/store.go index 4fef3be397..8cceb13efe 100644 --- a/vendor/k8s.io/apiserver/pkg/registry/generic/registry/store.go +++ b/vendor/k8s.io/apiserver/pkg/registry/generic/registry/store.go @@ -307,6 +307,66 @@ func NoNamespaceKeyFunc(ctx context.Context, prefix string, name string) (string return key, nil } +type storeKeyFuncs struct { + // storageRootKeyFunc returns the resource-relative storage path prefix for + // list and watch requests, for example "/pods" or "/pods/". + storageRootKeyFunc func(ctx context.Context) string + // storageKeyFunc returns the resource-relative storage path for one object, + // for example "/pods//" or "/pods/". + storageKeyFunc func(ctx context.Context, name string) (string, error) + // cacheKeyFunc returns the resource-relative storage path for one object. + // It is passed to cache layers that receive objects instead of request + // contexts, so it derives the namespace and name from object metadata. + cacheKeyFunc func(obj runtime.Object) (string, error) +} + +func defaultStoreKeyFuncs(prefix string, isNamespaced bool) storeKeyFuncs { + if isNamespaced { + return newStoreKeyFuncs( + isNamespaced, + func(ctx context.Context) string { + return NamespaceKeyRootFunc(ctx, prefix) + }, + func(ctx context.Context, name string) (string, error) { + return NamespaceKeyFunc(ctx, prefix, name) + }, + ) + } + + return newStoreKeyFuncs( + isNamespaced, + func(ctx context.Context) string { + return prefix + }, + func(ctx context.Context, name string) (string, error) { + return NoNamespaceKeyFunc(ctx, prefix, name) + }, + ) +} + +func newStoreKeyFuncs( + isNamespaced bool, + storageRootKeyFunc func(ctx context.Context) string, + storageKeyFunc func(ctx context.Context, name string) (string, error), +) storeKeyFuncs { + return storeKeyFuncs{ + storageRootKeyFunc: storageRootKeyFunc, + storageKeyFunc: storageKeyFunc, + cacheKeyFunc: func(obj runtime.Object) (string, error) { + accessor, err := meta.Accessor(obj) + if err != nil { + return "", err + } + + ctx := genericapirequest.NewContext() + if isNamespaced { + ctx = genericapirequest.WithNamespace(ctx, accessor.GetNamespace()) + } + return storageKeyFunc(ctx, accessor.GetName()) + }, + } +} + // New implements RESTStorage.New. func (e *Store) New() runtime.Object { return e.NewFunc() @@ -452,7 +512,7 @@ const maxNameGenerationCreateAttempts = 8 // hooks). Tests which call this might want to call DeepCopy if they expect to // be able to examine the input and output objects for differences. func (e *Store) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) { - if utilfeature.DefaultFeatureGate.Enabled(features.RetryGenerateName) && needsNameGeneration(obj) { + if needsNameGeneration(obj) { return e.createWithGenerateNameRetry(ctx, obj, createValidation, options) } @@ -643,7 +703,7 @@ func (e *Store) Update(ctx context.Context, name string, objInfo rest.UpdatedObj out := e.NewFunc() // only ignore a not found error if this type allows creating on update, or we're forcing allowing create (like for server-side-apply) - ignoreNotFound := e.UpdateStrategy.AllowCreateOnUpdate() || forceAllowCreate + ignoreNotFound := e.UpdateStrategy.AllowCreateOnUpdate(ctx) || forceAllowCreate // deleteObj is only used in case a deletion is carried out var deleteObj runtime.Object err = e.Storage.GuaranteedUpdate(ctx, key, out, ignoreNotFound, storagePreconditions, func(existing runtime.Object, res storage.ResponseMeta) (runtime.Object, *uint64, error) { @@ -652,7 +712,7 @@ func (e *Store) Update(ctx context.Context, name string, objInfo rest.UpdatedObj return nil, nil, err } if existingResourceVersion == 0 { - if !e.UpdateStrategy.AllowCreateOnUpdate() && !forceAllowCreate { + if !e.UpdateStrategy.AllowCreateOnUpdate(ctx) && !forceAllowCreate { return nil, nil, apierrors.NewNotFound(qualifiedResource, name) } } @@ -671,13 +731,17 @@ func (e *Store) Update(ctx context.Context, name string, objInfo rest.UpdatedObj if err != nil { return nil, nil, err } - doUnconditionalUpdate := newResourceVersion == 0 && e.UpdateStrategy.AllowUnconditionalUpdate() + doUnconditionalUpdate := newResourceVersion == 0 && e.UpdateStrategy.AllowUnconditionalUpdate(ctx) if existingResourceVersion == 0 { // Init metadata as early as possible. if objectMeta, err := meta.Accessor(obj); err != nil { return nil, nil, err } else { + // Wipe metadata on create-via-update and create-via-apply + // requests to match create behavior. Note that this happens + // AFTER preconditions are checked. + rest.WipeObjectMetaSystemFields(objectMeta) rest.FillObjectMetaSystemFields(objectMeta) } @@ -932,12 +996,12 @@ func shouldOrphanDependents(ctx context.Context, e *Store, accessor metav1.Objec return defaultGCPolicy == rest.OrphanDependents } -// shouldDeleteDependents returns true if the finalizer for foreground deletion should be set +// shouldDeleteDependentsInForeground returns true if the finalizer for foreground deletion should be set // updated for FinalizerDeleteDependents. In the order of highest to lowest // priority, there are three factors affect whether to add/remove the // FinalizerDeleteDependents: options, existing finalizers of the object, and // e.DeleteStrategy.DefaultGarbageCollectionPolicy. -func shouldDeleteDependents(ctx context.Context, e *Store, accessor metav1.Object, options *metav1.DeleteOptions) bool { +func shouldDeleteDependentsInForeground(ctx context.Context, e *Store, accessor metav1.Object, options *metav1.DeleteOptions) bool { // Get default GC policy from this REST object type if gcStrategy, ok := e.DeleteStrategy.(rest.GarbageCollectionDeleteStrategy); ok && gcStrategy.DefaultGarbageCollectionPolicy(ctx) == rest.Unsupported { // return false to indicate that we should NOT delete in foreground @@ -986,7 +1050,7 @@ func deletionFinalizersForGarbageCollection(ctx context.Context, e *Store, acces return false, []string{} } shouldOrphan := shouldOrphanDependents(ctx, e, accessor, options) - shouldDeleteDependentInForeground := shouldDeleteDependents(ctx, e, accessor, options) + shouldDeleteInForeground := shouldDeleteDependentsInForeground(ctx, e, accessor, options) newFinalizers := []string{} // first remove both finalizers, add them back if needed. @@ -1000,7 +1064,7 @@ func deletionFinalizersForGarbageCollection(ctx context.Context, e *Store, acces if shouldOrphan { newFinalizers = append(newFinalizers, metav1.FinalizerOrphanDependents) } - if shouldDeleteDependentInForeground { + if shouldDeleteInForeground { newFinalizers = append(newFinalizers, metav1.FinalizerDeleteDependents) } @@ -1586,39 +1650,14 @@ func (e *Store) CompleteWithOptions(options *generic.StoreOptions) error { return fmt.Errorf("store for %s has an invalid prefix %q", e.DefaultQualifiedResource.String(), opts.ResourcePrefix) } - // Set the default behavior for storage key generation + var keyFuncs storeKeyFuncs if e.KeyRootFunc == nil && e.KeyFunc == nil { - if isNamespaced { - e.KeyRootFunc = func(ctx context.Context) string { - return NamespaceKeyRootFunc(ctx, prefix) - } - e.KeyFunc = func(ctx context.Context, name string) (string, error) { - return NamespaceKeyFunc(ctx, prefix, name) - } - } else { - e.KeyRootFunc = func(ctx context.Context) string { - return prefix - } - e.KeyFunc = func(ctx context.Context, name string) (string, error) { - return NoNamespaceKeyFunc(ctx, prefix, name) - } - } - } - - // We adapt the store's keyFunc so that we can use it with the StorageDecorator - // without making any assumptions about where objects are stored in etcd - keyFunc := func(obj runtime.Object) (string, error) { - accessor, err := meta.Accessor(obj) - if err != nil { - return "", err - } - - if isNamespaced { - return e.KeyFunc(genericapirequest.WithNamespace(genericapirequest.NewContext(), accessor.GetNamespace()), accessor.GetName()) - } - - return e.KeyFunc(genericapirequest.NewContext(), accessor.GetName()) + keyFuncs = defaultStoreKeyFuncs(prefix, isNamespaced) + } else { + keyFuncs = newStoreKeyFuncs(isNamespaced, e.KeyRootFunc, e.KeyFunc) } + e.KeyRootFunc = keyFuncs.storageRootKeyFunc + e.KeyFunc = keyFuncs.storageKeyFunc if e.DeleteCollectionWorkers == 0 { e.DeleteCollectionWorkers = opts.DeleteCollectionWorkers @@ -1642,7 +1681,7 @@ func (e *Store) CompleteWithOptions(options *generic.StoreOptions) error { e.Storage.Storage, e.DestroyFunc, err = opts.Decorator( opts.StorageConfig, prefix, - keyFunc, + keyFuncs.cacheKeyFunc, e.NewFunc, e.NewListFunc, attrFunc, diff --git a/vendor/k8s.io/apiserver/pkg/registry/generic/storage_decorator.go b/vendor/k8s.io/apiserver/pkg/registry/generic/storage_decorator.go index 4c2b2fc0ed..ffdc2205f3 100644 --- a/vendor/k8s.io/apiserver/pkg/registry/generic/storage_decorator.go +++ b/vendor/k8s.io/apiserver/pkg/registry/generic/storage_decorator.go @@ -25,11 +25,12 @@ import ( ) // StorageDecorator is a function signature for producing a storage.Interface -// and an associated DestroyFunc from given parameters. +// and an associated DestroyFunc from given parameters. cacheKeyFunc is used by +// cache layers to compute resource keys from objects. type StorageDecorator func( config *storagebackend.ConfigForResource, resourcePrefix string, - keyFunc func(obj runtime.Object) (string, error), + cacheKeyFunc func(obj runtime.Object) (string, error), newFunc func() runtime.Object, newListFunc func() runtime.Object, getAttrsFunc storage.AttrFunc, @@ -41,7 +42,7 @@ type StorageDecorator func( func UndecoratedStorage( config *storagebackend.ConfigForResource, resourcePrefix string, - keyFunc func(obj runtime.Object) (string, error), + cacheKeyFunc func(obj runtime.Object) (string, error), newFunc func() runtime.Object, newListFunc func() runtime.Object, getAttrsFunc storage.AttrFunc, diff --git a/vendor/k8s.io/apiserver/pkg/registry/rest/create.go b/vendor/k8s.io/apiserver/pkg/registry/rest/create.go index 87b2c9d81b..4ae9957bdd 100644 --- a/vendor/k8s.io/apiserver/pkg/registry/rest/create.go +++ b/vendor/k8s.io/apiserver/pkg/registry/rest/create.go @@ -22,6 +22,7 @@ import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/api/operation" "k8s.io/apimachinery/pkg/api/validate/content" genericvalidation "k8s.io/apimachinery/pkg/api/validation" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -126,14 +127,8 @@ func BeforeCreate(strategy RESTCreateStrategy, ctx context.Context, obj runtime. strategy.PrepareForCreate(ctx, obj) - if errs := strategy.Validate(ctx, obj); len(errs) > 0 { - return errors.NewInvalid(kind.GroupKind(), objectMeta.GetName(), errs) - } - - // Custom validation (including name validation) passed - // Now run common validation on object meta - // Do this *after* custom validation so that specific error messages are shown whenever possible - if errs := genericvalidation.ValidateObjectMetaAccessor(objectMeta, strategy.NamespaceScoped(), validatePathSegment, field.NewPath("metadata")); len(errs) > 0 { + errs := ValidateCreate(ctx, obj, strategy) + if len(errs) != 0 { return errors.NewInvalid(kind.GroupKind(), objectMeta.GetName(), errs) } @@ -146,6 +141,31 @@ func BeforeCreate(strategy RESTCreateStrategy, ctx context.Context, obj runtime. return nil } +// ValidateCreate performs common and strategy-specific validation for a create operation. +func ValidateCreate(ctx context.Context, obj runtime.Object, strategy RESTCreateStrategy) field.ErrorList { + errs := strategy.Validate(ctx, obj) + + if len(errs) == 0 { + objectMeta, err := meta.Accessor(obj) + if err != nil { + return append(errs, field.InternalError(field.NewPath("metadata"), fmt.Errorf("failed to get object metadata: %w", err))) + } + + // TODO: Replace this check with the ObjectMeta name validation (validatePathSegment) once we are sure that all other validations are covered by strategy.Validate and strategy.ValidateDeclaratively. + + // Custom validation (including name validation) passed + // Now run common validation on object meta + // Do this *after* custom validation so that specific error messages are shown whenever possible + errs = append(errs, genericvalidation.ValidateObjectMetaAccessor(objectMeta, strategy.NamespaceScoped(), validatePathSegment, field.NewPath("metadata"))...) + } + + if dv, ok := strategy.(DeclarativeValidationStrategy); ok { + errs = dv.ValidateDeclaratively(ctx, obj, nil, errs, operation.Create, dv.DeclarativeValidationConfig(ctx, obj, nil)) + } + + return errs +} + // CheckGeneratedNameError checks whether an error that occurred creating a resource is due // to generation being unable to pick a valid name. func CheckGeneratedNameError(ctx context.Context, strategy RESTCreateStrategy, err error, obj runtime.Object) error { diff --git a/vendor/k8s.io/apiserver/pkg/registry/rest/create_update.go b/vendor/k8s.io/apiserver/pkg/registry/rest/create_update.go index acef76fa63..f872f28bc9 100644 --- a/vendor/k8s.io/apiserver/pkg/registry/rest/create_update.go +++ b/vendor/k8s.io/apiserver/pkg/registry/rest/create_update.go @@ -26,10 +26,15 @@ import ( // RESTCreateUpdateStrategy is a union of RESTUpdateStrategy and RESTCreateStrategy, // and it defines the minimum validation, accepted input, and name generation // behavior to create and update an object that follows Kubernetes API conventions. +// +// The context that is passed to these methods can be used to retrieve +// information about the request with request.RequestInfoFrom(ctx) and +// to return different responses depending on the APIVersion in the +// request. type RESTCreateUpdateStrategy interface { RESTCreateStrategy // AllowCreateOnUpdate returns true if the object can be created by a PUT. - AllowCreateOnUpdate() bool + AllowCreateOnUpdate(ctx context.Context) bool // PrepareForUpdate is invoked on update before validation to normalize // the object. For example: remove fields that are not to be persisted, // sort order-insensitive list fields, etc. This should not remove fields @@ -62,7 +67,7 @@ type RESTCreateUpdateStrategy interface { // AllowUnconditionalUpdate returns true if the object can be updated // unconditionally (irrespective of the latest resource version), when // there is no resource version specified in the object. - AllowUnconditionalUpdate() bool + AllowUnconditionalUpdate(ctx context.Context) bool } // Ensure that RESTCreateUpdateStrategy extends RESTCreateStrategy diff --git a/vendor/k8s.io/apiserver/pkg/registry/rest/update.go b/vendor/k8s.io/apiserver/pkg/registry/rest/update.go index 32de351aa7..b66978ca14 100644 --- a/vendor/k8s.io/apiserver/pkg/registry/rest/update.go +++ b/vendor/k8s.io/apiserver/pkg/registry/rest/update.go @@ -22,6 +22,7 @@ import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/api/operation" genericvalidation "k8s.io/apimachinery/pkg/api/validation" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -35,12 +36,17 @@ import ( // name generation behavior to update an object that follows Kubernetes // API conventions. A resource may have many UpdateStrategies, depending on // the call pattern in use. +// +// The context that is passed to these methods can be used to retrieve +// information about the request with request.RequestInfoFrom(ctx) and +// to return different responses depending on the APIVersion in the +// request. type RESTUpdateStrategy interface { runtime.ObjectTyper // NamespaceScoped returns true if the object must be within a namespace. NamespaceScoped() bool // AllowCreateOnUpdate returns true if the object can be created by a PUT. - AllowCreateOnUpdate() bool + AllowCreateOnUpdate(ctx context.Context) bool // PrepareForUpdate is invoked on update before validation to normalize // the object. For example: remove fields that are not to be persisted, // sort order-insensitive list fields, etc. This should not remove fields @@ -79,24 +85,26 @@ type RESTUpdateStrategy interface { // AllowUnconditionalUpdate returns true if the object can be updated // unconditionally (irrespective of the latest resource version), when // there is no resource version specified in the object. - AllowUnconditionalUpdate() bool + AllowUnconditionalUpdate(ctx context.Context) bool } // TODO: add other common fields that require global validation. -func validateCommonFields(obj, old runtime.Object, strategy RESTUpdateStrategy) (field.ErrorList, error) { +func validateCommonFields(obj, old runtime.Object, strategy RESTUpdateStrategy) field.ErrorList { allErrs := field.ErrorList{} objectMeta, err := meta.Accessor(obj) if err != nil { - return nil, fmt.Errorf("failed to get new object metadata: %v", err) + allErrs = append(allErrs, field.InternalError(field.NewPath("metadata"), fmt.Errorf("failed to get new object metadata: %w", err))) + return allErrs } oldObjectMeta, err := meta.Accessor(old) if err != nil { - return nil, fmt.Errorf("failed to get old object metadata: %v", err) + allErrs = append(allErrs, field.InternalError(field.NewPath("metadata"), fmt.Errorf("failed to get old object metadata: %w", err))) + return allErrs } allErrs = append(allErrs, genericvalidation.ValidateObjectMetaAccessor(objectMeta, strategy.NamespaceScoped(), validatePathSegment, field.NewPath("metadata"))...) allErrs = append(allErrs, genericvalidation.ValidateObjectMetaAccessorUpdate(objectMeta, oldObjectMeta, field.NewPath("metadata"))...) - return allErrs, nil + return allErrs } // BeforeUpdate ensures that common operations for all resources are performed on update. It only returns @@ -143,14 +151,7 @@ func BeforeUpdate(strategy RESTUpdateStrategy, ctx context.Context, obj, old run if oldMeta.GetDeletionGracePeriodSeconds() != nil && objectMeta.GetDeletionGracePeriodSeconds() == nil { objectMeta.SetDeletionGracePeriodSeconds(oldMeta.GetDeletionGracePeriodSeconds()) } - - // Ensure some common fields, like UID, are validated for all resources. - errs, err := validateCommonFields(obj, old, strategy) - if err != nil { - return errors.NewInternalError(err) - } - - errs = append(errs, strategy.ValidateUpdate(ctx, obj, old)...) + errs := ValidateUpdate(ctx, obj, old, strategy) if len(errs) > 0 { RecordDuplicateValidationErrors(ctx, kind.GroupKind(), errs) return errors.NewInvalid(kind.GroupKind(), objectMeta.GetName(), errs) @@ -165,6 +166,20 @@ func BeforeUpdate(strategy RESTUpdateStrategy, ctx context.Context, obj, old run return nil } +// ValidateUpdate performs common and strategy-specific validation for an update operation. +func ValidateUpdate(ctx context.Context, obj runtime.Object, old runtime.Object, strategy RESTUpdateStrategy) field.ErrorList { + + // TODO: Replace this check with the ObjectMeta name validation (validatePathSegment) once we are sure that all other validations are covered by strategy.Validate and strategy.ValidateDeclaratively. + // Ensure some common fields, like UID, are validated for all resources. + errs := validateCommonFields(obj, old, strategy) + + errs = append(errs, strategy.ValidateUpdate(ctx, obj, old)...) + if dv, ok := strategy.(DeclarativeValidationStrategy); ok { + errs = dv.ValidateDeclaratively(ctx, obj, old, errs, operation.Update, dv.DeclarativeValidationConfig(ctx, obj, old)) + } + return errs +} + // TransformFunc is a function to transform and return newObj type TransformFunc func(ctx context.Context, newObj runtime.Object, oldObj runtime.Object) (transformedNewObj runtime.Object, err error) diff --git a/vendor/k8s.io/apiserver/pkg/registry/rest/validate.go b/vendor/k8s.io/apiserver/pkg/registry/rest/validate.go index f0e355e54f..0fa6281667 100644 --- a/vendor/k8s.io/apiserver/pkg/registry/rest/validate.go +++ b/vendor/k8s.io/apiserver/pkg/registry/rest/validate.go @@ -24,6 +24,7 @@ import ( "strings" "k8s.io/apimachinery/pkg/api/operation" + "k8s.io/apimachinery/pkg/api/validate" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/validation/field" @@ -34,79 +35,79 @@ import ( "k8s.io/klog/v2" ) -// ValidationConfig defines how a declarative validation request may be configured. -type ValidationConfig func(*validationConfigOption) - -// WithOptions sets the validation options. -// Options should contain any validation options that the declarative validation -// tags expect. These often correspond to feature gates. -func WithOptions(options []string) ValidationConfig { - return func(config *validationConfigOption) { - config.options = options - } +// DeclarativeValidationStrategy defines how a strategy may opt-in to declarative validation. +// +// When strategies implements ValidateDeclaratively and handwritten validation (Validate / ValidateUpdate), +// the errors of both are merged and migration checks are performed. +type DeclarativeValidationStrategy interface { + // ValidateDeclaratively runs declarative validation, merges the declarative validation errors with any + // validationErrs returned from the strategy's Validate / ValidateUpdate functions (which implement hand-written validation) + // and performs migration checks. + ValidateDeclaratively(ctx context.Context, obj, oldObj runtime.Object, validationErrs field.ErrorList, opType operation.Type, config DeclarativeValidationConfig) field.ErrorList + + // DeclarativeValidationConfig configures declarative validation for a single request. + DeclarativeValidationConfig(ctx context.Context, obj, oldObj runtime.Object) DeclarativeValidationConfig } -// WithSubresourceMapper sets the subresource mapper for validation. -// This should be used when registering validation for polymorphic subresources like /scale. -// -// For example, the deployments/scale subresource mapper might map from: +// DeclarativeValidation is an implementation of DeclarativeValidationStrategy that +// provides a convenient way for a strategy to opt-in to declarative validation. // -// group: apps, version: v1, subresource=scale +// For example: // -// to a target of: +// type podStrategy struct { +// rest.DeclarativeValidation +// names.NameGenerator +// } +// var Strategy = podStrategy{rest.DeclarativeValidation{Scheme: legacyscheme.Scheme}, names.SimpleNameGenerator} // -// group: autoscaling, version: v1, kind=Scale -// -// When set, the group version in the requestInfo of the ctx provided to a declarative validation -// request will be passed to the subresource mapper to find the group version kind of the subresource. -// Declarative validation will then convert the object to the subresource group version kind and validate it. -// -// Note that the target of the mapping contains no subresource part since the mapper is expected to -// map to the group version kind of the subresource. -func WithSubresourceMapper(subresourceMapper GroupVersionKindProvider) ValidationConfig { - return func(config *validationConfigOption) { - config.subresourceGVKMapper = subresourceMapper - } +// Once a strategy opts-in this way, any generated declarative validation code is run automatically. +type DeclarativeValidation struct { + *runtime.Scheme } -// WithNormalizationRules sets the normalization rules for validation. -func WithNormalizationRules(rules []field.NormalizationRule) ValidationConfig { - return func(config *validationConfigOption) { - config.normalizationRules = rules +func (d DeclarativeValidation) ValidateDeclaratively(ctx context.Context, obj, oldObj runtime.Object, validationErrs field.ErrorList, opType operation.Type, config DeclarativeValidationConfig) field.ErrorList { + if d.Scheme == nil { + validationErrs = append(validationErrs, field.InternalError(nil, fmt.Errorf("cannot validate declaratively without a scheme"))) + return validationErrs } + return ValidateDeclarativelyWithMigrationChecks(ctx, d.Scheme, obj, oldObj, validationErrs, opType, config) } -// WithDeclarativeEnforcement marks the validation configuration to indicate that it includes -// declarative validations that should follow the fine-grained Validation Lifecycle. -// When set, declarative validation is always executed regardless of feature gates. -// Authority is determined by individual tag prefixes (+k8s:alpha, +k8s:beta) and the -// DeclarativeValidationBeta safety switch. -func WithDeclarativeEnforcement() ValidationConfig { - return func(config *validationConfigOption) { - config.declarativeEnforcement = true - } +func (d DeclarativeValidation) DeclarativeValidationConfig(ctx context.Context, obj, oldObj runtime.Object) DeclarativeValidationConfig { + // The zero value of DeclarativeValidationConfig is the default. + return DeclarativeValidationConfig{} } -type allDeclarativeEnforcedKeyType struct{} - -var allDeclarativeEnforcedKey = allDeclarativeEnforcedKeyType{} - -// WithAllDeclarativeEnforcedForTest returns a copy of parent context with allDeclarativeEnforcedKey set to true. -// This is used for testing to expose all declarative validation errors and filter all handwritten validation errors -// that are covered by declarative validation, regardless of the feature gate or maturity level. -// -// NOTE: This function is intended for testing purposes only and should not be used in production code. -func WithAllDeclarativeEnforcedForTest(ctx context.Context) context.Context { - return context.WithValue(ctx, allDeclarativeEnforcedKey, true) +// DeclarativeValidationConfig holds configuration for declarative validation. +// Strategies that need to customize declarative validation behavior implement +// DeclarativeValidationConfigurer and return this struct. +type DeclarativeValidationConfig struct { + // Options contains the validation options that declarative validation tags expect, + // mapping option name to whether it is enabled. Every option a resource's validation + // tags reference must be defined here; an option that is not defined is reported as an + // internal error rather than treated as disabled. Option names often correspond to + // feature gates. + Options map[string]bool + + // NormalizationRules are applied to field paths when comparing + // handwritten and declarative validation errors. + NormalizationRules []field.NormalizationRule + + // SubresourceGVKMapper maps a subresource request to the GVK of the + // subresource type for polymorphic subresources like /scale. + SubresourceGVKMapper GroupVersionKindProvider + + // ShortCircuitMismatch allows a short-circuit declarative validation error for a field + // to match with any handwritten validation error on its subfields. + ShortCircuitMismatch bool } -type validationConfigOption struct { - opType operation.Type - options []string - subresourceGVKMapper GroupVersionKindProvider - validationIdentifier string - normalizationRules []field.NormalizationRule - declarativeEnforcement bool +// ValidationConfigOption is the internal configuration used by +// ValidateDeclarativelyWithMigrationChecks. It is exported for use in tests. +type ValidationConfigOption struct { + OpType operation.Type + ValidationIdentifier string + DeclarativeValidationConfig } // validateDeclaratively validates obj and oldObj against declarative @@ -121,9 +122,9 @@ type validationConfigOption struct { // Returns a field.ErrorList containing any validation errors. An internal error // is included if requestInfo is missing from the context or if version // conversion fails. -func validateDeclaratively(ctx context.Context, scheme *runtime.Scheme, obj, oldObj runtime.Object, o *validationConfigOption) field.ErrorList { +func validateDeclaratively(ctx context.Context, scheme *runtime.Scheme, obj, oldObj runtime.Object, o *ValidationConfigOption) field.ErrorList { // Find versionedGroupVersion, which identifies the API version to use for declarative validation. - versionedGroupVersion, subresources, err := requestInfo(ctx, o.subresourceGVKMapper) + versionedGroupVersion, subresources, err := requestInfo(ctx, o.SubresourceGVKMapper) if err != nil { return field.ErrorList{field.InternalError(nil, err)} } @@ -133,17 +134,17 @@ func validateDeclaratively(ctx context.Context, scheme *runtime.Scheme, obj, old } var versionedOldObj runtime.Object - switch o.opType { + switch o.OpType { case operation.Create: - return scheme.Validate(ctx, o.options, versionedObj, subresources...) + return scheme.Validate(ctx, o.Options, versionedObj, subresources...) case operation.Update: versionedOldObj, err = scheme.ConvertToVersion(oldObj, versionedGroupVersion) if err != nil { return field.ErrorList{field.InternalError(nil, fmt.Errorf("unexpected error converting to versioned type: %w", err))} } - return scheme.ValidateUpdate(ctx, o.options, versionedObj, versionedOldObj, subresources...) + return scheme.ValidateUpdate(ctx, o.Options, versionedObj, versionedOldObj, subresources...) default: - return field.ErrorList{field.InternalError(nil, fmt.Errorf("unknown operation type: %v", o.opType))} + return field.ErrorList{field.InternalError(nil, fmt.Errorf("unknown operation type: %v", o.OpType))} } } @@ -179,9 +180,9 @@ func parseSubresourcePath(subresourcePath string) ([]string, error) { // compareDeclarativeErrorsAndEmitMismatches checks for mismatches between imperative and declarative validation // and logs + emits metrics when inconsistencies are found -func compareDeclarativeErrorsAndEmitMismatches(ctx context.Context, imperativeErrs, declarativeErrs field.ErrorList, enforced bool, validationIdentifier string, normalizationRules []field.NormalizationRule) { +func compareDeclarativeErrorsAndEmitMismatches(ctx context.Context, imperativeErrs, declarativeErrs field.ErrorList, validationIdentifier string, enforced bool, opts ValidationConfigOption) { logger := klog.FromContext(ctx) - mismatchDetails := gatherDeclarativeValidationMismatches(imperativeErrs, declarativeErrs, enforced, normalizationRules) + mismatchDetails := gatherDeclarativeValidationMismatches(imperativeErrs, declarativeErrs, enforced, opts) for _, detail := range mismatchDetails { // Log information about the mismatch using contextual logger logger.Error(nil, detail) @@ -193,7 +194,7 @@ func compareDeclarativeErrorsAndEmitMismatches(ctx context.Context, imperativeEr // gatherDeclarativeValidationMismatches compares imperative and declarative validation errors // and returns detailed information about any mismatches found. Errors are compared via type, field, and origin -func gatherDeclarativeValidationMismatches(imperativeErrs, declarativeErrs field.ErrorList, enforced bool, normalizationRules []field.NormalizationRule) []string { +func gatherDeclarativeValidationMismatches(imperativeErrs, declarativeErrs field.ErrorList, enforced bool, opts ValidationConfigOption) []string { var mismatchDetails []string // short circuit here to minimize allocs for usual case of 0 validation errors if len(imperativeErrs) == 0 && len(declarativeErrs) == 0 { @@ -210,7 +211,8 @@ func gatherDeclarativeValidationMismatches(imperativeErrs, declarativeErrs field defaultRecommendation = disableBetaMsg } - fuzzyMatcher := field.ErrorMatcher{}.ByType().ByOrigin().RequireOriginWhenInvalid().ByFieldNormalized(normalizationRules) + fuzzyMatcher := field.ErrorMatcher{}.ByType().ByOrigin().RequireOriginWhenInvalid().ByFieldNormalized(opts.NormalizationRules) + fuzzyMatcherWithShortCircuit := fuzzyMatcher.MatchAncestorShortCircuit() // Dedupe imperative errors using the fuzzy matcher (type, field, and origin) as they are // not intended and come from (buggy) duplicate validation calls. @@ -231,16 +233,13 @@ func gatherDeclarativeValidationMismatches(imperativeErrs, declarativeErrs field } imperativeErrs = dedupedImperativeErrs - // Create a copy of declarative errors to track remaining ones - remaining := make(field.ErrorList, len(declarativeErrs)) - copy(remaining, declarativeErrs) + matchedDeclarative := make([]bool, len(declarativeErrs)) // Match each "covered" imperative error to declarative errors. // We use a fuzzy matching approach to find corresponding declarative errors // for each imperative error marked as CoveredByDeclarative. - // As matches are found, they're removed from the 'remaining' list. - // They are removed from `remaining` with a "1:many" mapping: for a given - // imperative error we mark as matched all matching declarative errors + // They are matched with a "many:many" mapping: an imperative error can match multiple + // declarative errors, and a declarative error can match multiple imperative errors. // This allows us to: // 1. Detect imperative errors that should have matching declarative errors but don't // 2. Identify extra declarative errors with no imperative counterpart @@ -250,14 +249,21 @@ func gatherDeclarativeValidationMismatches(imperativeErrs, declarativeErrs field continue } - tmp := make(field.ErrorList, 0, len(remaining)) matchCount := 0 - for _, dErr := range remaining { + for dIdx, dErr := range declarativeErrs { if fuzzyMatcher.Matches(iErr, dErr) { matchCount++ - } else { - tmp = append(tmp, dErr) + matchedDeclarative[dIdx] = true + } + } + // see if the error matches with a short circuited DV error. + if opts.ShortCircuitMismatch && matchCount == 0 { + for _, dErr := range declarativeErrs { + if fuzzyMatcherWithShortCircuit.Matches(iErr, dErr) { + matchCount++ + break + } } } @@ -267,7 +273,6 @@ func gatherDeclarativeValidationMismatches(imperativeErrs, declarativeErrs field if iErr.IsAlpha() { rec = authoritativeMsg } - mismatchDetails = append(mismatchDetails, fmt.Sprintf( "Unexpected difference between hand written validation and declarative validation error results, unmatched error(s) found %s. "+ @@ -277,12 +282,13 @@ func gatherDeclarativeValidationMismatches(imperativeErrs, declarativeErrs field ), ) } - - remaining = tmp } // Any remaining unmatched declarative errors are considered "extra" - for _, dErr := range remaining { + for dIdx, dErr := range declarativeErrs { + if matchedDeclarative[dIdx] { + continue + } rec := defaultRecommendation // If the declarative error is Alpha, it is never enforced (shadowed), so HV is authoritative. if dErr.IsAlpha() { @@ -302,40 +308,16 @@ func gatherDeclarativeValidationMismatches(imperativeErrs, declarativeErrs field return mismatchDetails } -// createDeclarativeValidationPanicHandler returns a function with panic recovery logic -// that will increment the panic metric and either log or append errors based on the shouldFail parameter. -func createDeclarativeValidationPanicHandler(ctx context.Context, errs *field.ErrorList, shouldFail bool, validationIdentifier string) func() { - logger := klog.FromContext(ctx) - return func() { +// runDeclarativeValidationWithRecover invokes validateDeclaratively with panic recovery. +// On panic, the panic metric is incremented and an InternalError is appended to the returned errors. +func runDeclarativeValidationWithRecover(ctx context.Context, scheme *runtime.Scheme, obj, oldObj runtime.Object, o *ValidationConfigOption) (errs field.ErrorList) { + defer func() { if r := recover(); r != nil { - // Increment the panic metric counter - validationmetrics.Metrics.IncDeclarativeValidationPanicMetric(validationIdentifier) - - const errorFmt = "panic during declarative validation: %v" - if shouldFail { - // If shouldFail is enabled, output as a validation error as authoritative validator panicked and validation should error - *errs = append(*errs, field.InternalError(nil, fmt.Errorf(errorFmt, r))) - } else { - // if shouldFail not enabled, log the panic as an error message - logger.Error(nil, fmt.Sprintf(errorFmt, r)) - } + validationmetrics.Metrics.IncDeclarativeValidationPanicMetric(o.ValidationIdentifier) + errs = append(errs, field.InternalError(nil, fmt.Errorf("panic during declarative validation: %v", r))) } - } -} - -// panicSafeValidateFunc wraps an validation function with panic recovery logic. -// The returned function will execute the wrapped function and handle any panics by -// incrementing the panic metric, and logging an error message -// if shouldFail=false, and adding a validation error if shouldFail=true. -func panicSafeValidateFunc( - validateFunc func(ctx context.Context, scheme *runtime.Scheme, obj, oldObj runtime.Object, o *validationConfigOption) field.ErrorList, - shouldFail bool, validationIdentifier string, -) func(ctx context.Context, scheme *runtime.Scheme, obj, oldObj runtime.Object, o *validationConfigOption) field.ErrorList { - return func(ctx context.Context, scheme *runtime.Scheme, obj, oldObj runtime.Object, o *validationConfigOption) (errs field.ErrorList) { - defer createDeclarativeValidationPanicHandler(ctx, &errs, shouldFail, validationIdentifier)() - - return validateFunc(ctx, scheme, obj, oldObj, o) - } + }() + return validateDeclaratively(ctx, scheme, obj, oldObj, o) } func metricIdentifier(ctx context.Context, scheme *runtime.Scheme, obj runtime.Object, opType operation.Type) (string, error) { @@ -376,22 +358,34 @@ func metricIdentifier(ctx context.Context, scheme *runtime.Scheme, obj runtime.O } // ValidateDeclarativelyWithMigrationChecks executes declarative validation and implements the Validation Lifecycle strategy. -// It manages the transition from handwritten (HV) to declarative (DV) validation by controlling enforcement: -// - Standard: Enforced if declarativeEnforcement is set. HV counterparts are expected to be deleted from source. -// - Beta: Enforced if declarativeEnforcement is set AND DeclarativeValidationBeta feature gate is enabled. -// When enforced, corresponding HV errors are filtered out. Otherwise, DV is shadowed. -// - Alpha: Always shadowed; HV remains authoritative. +// Declarative validation is always authoritative; the lifecycle prefix on each tag controls the visible behavior: +// - Standard (no prefix): Enforced. HV counterparts are expected to be deleted from source. +// - Beta (+k8s:beta): Enforced when DeclarativeValidationBeta is enabled. Otherwise shadowed (HV remains authoritative). +// - Alpha (+k8s:alpha): Always shadowed; HV remains authoritative. // -// Mismatches between HV and DV are logged if the DeclarativeValidation gate is enabled. -// Mismatch checking is limited to Alpha and Beta stages when explicit enforcement is active. +// Mismatches between HV and DV are logged when the DeclarativeValidation gate is enabled. Only Alpha and +// Beta errors are mismatch-checked, since Standard DV errors may have no HV counterpart in new APIs. +// WithAllDeclarativeEnforcedForTest returns a copy of parent context with allDeclarativeEnforcedKey set to true. +// This is used for testing to expose all declarative validation errors and filter all handwritten validation errors +// that are covered by declarative validation, regardless of the feature gate or maturity level. // -// For testing purposes, WithAllDeclarativeEnforcedForTest can be used to enforce all declarative validations -// regardless of feature gates and filter all covered handwritten validations. -func ValidateDeclarativelyWithMigrationChecks(ctx context.Context, scheme *runtime.Scheme, obj, oldObj runtime.Object, errs field.ErrorList, opType operation.Type, configOpts ...ValidationConfig) field.ErrorList { - declarativeValidationEnabled := utilfeature.DefaultFeatureGate.Enabled(features.DeclarativeValidation) - betaEnabled := utilfeature.DefaultFeatureGate.Enabled(features.DeclarativeValidationBeta) - // allDeclarativeEnforced indicates that we should check all declarative errors for testing purposes. - allDeclarativeEnforced := ctx.Value(allDeclarativeEnforcedKey) == true +// NOTE: This function is intended for testing purposes only and should not be used in production code. +func WithAllDeclarativeEnforcedForTest(ctx context.Context) context.Context { + return validate.WithAllDeclarativeEnforcedForTest(ctx) +} + +// ValidateDeclarativelyWithMigrationChecks executes declarative validation and implements the Validation Lifecycle strategy. +// Declarative validation is always authoritative; the lifecycle prefix on each tag controls the visible behavior: +// - Standard (no prefix): Enforced. HV counterparts are expected to be deleted from source. +// - Beta (+k8s:beta): Enforced when DeclarativeValidationBeta is enabled. Otherwise shadowed (HV remains authoritative). +// - Alpha (+k8s:alpha): Always shadowed; HV remains authoritative. +// +// Mismatches between HV and DV are logged when the DeclarativeValidation gate is enabled. Only Alpha and +// Beta errors are mismatch-checked, since Standard DV errors may have no HV counterpart in new APIs. +// +// For testing purposes, WithAllDeclarativeEnforcedForTest enforces all declarative validations regardless +// of lifecycle and filters all covered handwritten validations. +func ValidateDeclarativelyWithMigrationChecks(ctx context.Context, scheme *runtime.Scheme, obj, oldObj runtime.Object, errs field.ErrorList, opType operation.Type, config DeclarativeValidationConfig) field.ErrorList { // These errors must be errors returned by the handwritten validation. errs = errs.MarkFromImperative() validationIdentifier, err := metricIdentifier(ctx, scheme, obj, opType) @@ -400,95 +394,38 @@ func ValidateDeclarativelyWithMigrationChecks(ctx context.Context, scheme *runti klog.FromContext(ctx).Error(err, "failed to generate complete validation identifier for declarative validation") } - // Directly create the config and call the core validation logic. - cfg := &validationConfigOption{ - opType: opType, - validationIdentifier: validationIdentifier, - } - for _, opt := range configOpts { - opt(cfg) + cfg := &ValidationConfigOption{ + OpType: opType, + ValidationIdentifier: validationIdentifier, + DeclarativeValidationConfig: config, } - // Short-circuit if neither DeclarativeValidation is enabled nor the object is explicitly configured for declarative enforcement. - if !declarativeValidationEnabled && !cfg.declarativeEnforcement && !allDeclarativeEnforced { - return errs - } + declarativeErrs := runDeclarativeValidationWithRecover(ctx, scheme, obj, oldObj, cfg) - // Call the panic-safe wrapper with the real validation function. - // We should fail if validation is enforced. - declarativeErrs := panicSafeValidateFunc(validateDeclaratively, cfg.declarativeEnforcement, cfg.validationIdentifier)(ctx, scheme, obj, oldObj, cfg) - - if declarativeValidationEnabled { - // Log mismatches. - // When explicit strategy is used (declarativeEnforcement), Standard errors are authoritative - // and may not have handwritten counterparts (e.g., in new APIs). - // We only mismatch check Alpha and Beta errors in this mode. - mismatchCandidateErrs := declarativeErrs - if cfg.declarativeEnforcement { - mismatchCandidateErrs = nil - for _, err := range declarativeErrs { - if err.IsAlpha() || err.IsBeta() { - mismatchCandidateErrs = append(mismatchCandidateErrs, err) - } + betaEnabled := utilfeature.DefaultFeatureGate.Enabled(features.DeclarativeValidationBeta) + if utilfeature.DefaultFeatureGate.Enabled(features.DeclarativeValidation) { + // Standard errors are authoritative and may not have handwritten counterparts (e.g., in new APIs). + // Only Alpha and Beta errors are eligible for mismatch checking. + var mismatchCandidateErrs field.ErrorList + for _, err := range declarativeErrs { + if err.IsAlpha() || err.IsBeta() { + mismatchCandidateErrs = append(mismatchCandidateErrs, err) } } - - // We pass betaEnabled (and enforcement) as the takeover flag to avoid changing logic elsewhere for now. - compareDeclarativeErrorsAndEmitMismatches(ctx, errs, mismatchCandidateErrs, cfg.declarativeEnforcement && betaEnabled, validationIdentifier, cfg.normalizationRules) + compareDeclarativeErrorsAndEmitMismatches(ctx, errs, mismatchCandidateErrs, validationIdentifier, betaEnabled, *cfg) } - if !cfg.declarativeEnforcement && !allDeclarativeEnforced { - // If enforcement is not enabled, we shadow declarative errors with hand-written ones, so we return early here. - return errs - } - - // Filter HV errors - errs = filterHandwrittenErrors(errs, allDeclarativeEnforced, betaEnabled) + // Collect the declarative errors that are enforced (i.e. surfaced to the user) in the current mode. + enforcedDeclarativeErrs := validate.FilterEnforcedDeclarativeErrors(ctx, declarativeErrs, betaEnabled) + // Remove handwritten errors that are superseded by an enforced declarative counterpart. + errs = validate.FilterCoveredHandwrittenErrors(ctx, errs, enforcedDeclarativeErrs, betaEnabled, cfg.NormalizationRules...) - // Append Enforced DV errors - for _, dvErr := range declarativeErrs { - if allDeclarativeEnforced { - errs = append(errs, dvErr) - continue - } - switch { - case dvErr.Type == field.ErrorTypeInternal: - errs = append(errs, dvErr) - case dvErr.IsBeta(): - if betaEnabled { - errs = append(errs, dvErr) - } - case !dvErr.IsAlpha(): - errs = append(errs, dvErr) // Standard - } - } + // Append the enforced declarative errors. + errs = append(errs, enforcedDeclarativeErrs...) return errs } -func filterHandwrittenErrors(errs field.ErrorList, allDeclarativeEnforced, betaEnabled bool) field.ErrorList { - // We remove HV errors that are covered by declarative validation AND are enforced. - return errs.Filter(func(e error) bool { - var fe *field.Error - if !errors.As(e, &fe) || !fe.CoveredByDeclarative { - return false - } - - if allDeclarativeEnforced { - return true - } - - // Explicit Strategy - if fe.IsBeta() { - // Beta validations are enforced only if the Beta feature gate is enabled. - return betaEnabled - } - // For Standard validations, we keep the handwritten error for now to avoid losing coverage - // before it is deleted from source. Alpha validations are always shadowed (kept). - return false - }) -} - // RecordDuplicateValidationErrors increments a metric and log the error when duplicate validation errors are found. func RecordDuplicateValidationErrors(ctx context.Context, qualifiedKind schema.GroupKind, errs field.ErrorList) { logger := klog.FromContext(ctx) diff --git a/vendor/k8s.io/apiserver/pkg/server/config.go b/vendor/k8s.io/apiserver/pkg/server/config.go index f197b55cd1..2c7b970f2a 100644 --- a/vendor/k8s.io/apiserver/pkg/server/config.go +++ b/vendor/k8s.io/apiserver/pkg/server/config.go @@ -1069,9 +1069,7 @@ func DefaultBuildHandlerChain(apiHandler http.Handler, c *Config) http.Handler { // WithTracing comes after authentication so we can allow authenticated // clients to influence sampling. - if c.FeatureGate.Enabled(genericfeatures.APIServerTracing) { - handler = genericapifilters.WithTracing(handler, c.TracerProvider) - } + handler = genericapifilters.WithTracing(handler, c.TracerProvider) failedHandler = filterlatency.TrackCompleted(failedHandler) handler = filterlatency.TrackCompleted(handler) handler = genericapifilters.WithAuthentication(handler, c.Authentication.Authenticator, failedHandler, c.Authentication.APIAudiences, c.Authentication.RequestHeaderConfig) diff --git a/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1alpha1/types.go b/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1alpha1/types.go index c0ce973699..bdd81e9110 100644 --- a/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1alpha1/types.go +++ b/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1alpha1/types.go @@ -24,7 +24,7 @@ import ( // Flagz is the structured response for the /flagz endpoint. type Flagz struct { // TypeMeta is the type metadata for the object. - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/types.go b/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/types.go index 403436fdcf..cffc624320 100644 --- a/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/types.go +++ b/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/types.go @@ -24,7 +24,7 @@ import ( // Flagz is the structured response for the /flagz endpoint. type Flagz struct { // TypeMeta is the type metadata for the object. - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/apiserver/pkg/server/genericapiserver.go b/vendor/k8s.io/apiserver/pkg/server/genericapiserver.go index 715501f67c..d6cee7a29e 100644 --- a/vendor/k8s.io/apiserver/pkg/server/genericapiserver.go +++ b/vendor/k8s.io/apiserver/pkg/server/genericapiserver.go @@ -214,7 +214,7 @@ type GenericAPIServer struct { // Authorizer determines whether a user is allowed to make a certain request. The Handler does a preliminary // authorization check using the request URI but it may be necessary to make additional checks, such as in // the create-on-update case - Authorizer authorizer.Authorizer + Authorizer authorizer.UnconditionalAuthorizer // EquivalentResourceRegistry provides information about resources equivalent to a given resource, // and the kind associated with a given resource. As resources are installed, they are registered here. @@ -1017,16 +1017,13 @@ func (s *GenericAPIServer) newAPIGroupVersion(apiGroupInfo *APIGroupInfo, groupV // NewDefaultAPIGroupInfo returns an APIGroupInfo stubbed with "normal" values // exposed for easier composition from other packages func NewDefaultAPIGroupInfo(group string, scheme *runtime.Scheme, parameterCodec runtime.ParameterCodec, codecs serializer.CodecFactory) APIGroupInfo { - opts := []serializer.CodecFactoryOptionsMutator{} + opts := []serializer.CodecFactoryOptionsMutator{ + serializer.WithStreamingCollectionEncodingToJSON(), + serializer.WithStreamingCollectionEncodingToProtobuf(), + } if utilfeature.DefaultFeatureGate.Enabled(features.CBORServingAndStorage) { opts = append(opts, serializer.WithSerializer(cbor.NewSerializerInfo)) } - if utilfeature.DefaultFeatureGate.Enabled(features.StreamingCollectionEncodingToJSON) { - opts = append(opts, serializer.WithStreamingCollectionEncodingToJSON()) - } - if utilfeature.DefaultFeatureGate.Enabled(features.StreamingCollectionEncodingToProtobuf) { - opts = append(opts, serializer.WithStreamingCollectionEncodingToProtobuf()) - } if len(opts) != 0 { codecs = serializer.NewCodecFactory(scheme, opts...) } diff --git a/vendor/k8s.io/apiserver/pkg/server/httplog/httplog.go b/vendor/k8s.io/apiserver/pkg/server/httplog/httplog.go index c64f5771d8..dbe93d4225 100644 --- a/vendor/k8s.io/apiserver/pkg/server/httplog/httplog.go +++ b/vendor/k8s.io/apiserver/pkg/server/httplog/httplog.go @@ -70,9 +70,10 @@ type respLogger struct { captureErrorOutput bool - req *http.Request - userAgent string - w http.ResponseWriter + req *http.Request + userAgent string + contentType string + w http.ResponseWriter logStacktracePred StacktracePred } @@ -167,6 +168,7 @@ func newLoggedWithStartTime(req *http.Request, w http.ResponseWriter, startTime startTime: startTime, req: req, userAgent: req.UserAgent(), + contentType: req.Header.Get("Content-Type"), w: w, logStacktracePred: DefaultStacktracePred, } @@ -271,6 +273,7 @@ func (rl *respLogger) Log() { // This can cause apiserver to crash with unrecoverable fatal error. // More info about concurrent read and write for maps: https://golang.org/doc/go1.6#runtime "userAgent", rl.userAgent, + "contentType", rl.contentType, "audit-ID", auditID, "srcIP", rl.req.RemoteAddr, } diff --git a/vendor/k8s.io/apiserver/pkg/server/options/authorization.go b/vendor/k8s.io/apiserver/pkg/server/options/authorization.go index 9b2dcb3fff..5e54d558c6 100644 --- a/vendor/k8s.io/apiserver/pkg/server/options/authorization.go +++ b/vendor/k8s.io/apiserver/pkg/server/options/authorization.go @@ -175,10 +175,13 @@ func (s *DelegatingAuthorizationOptions) ApplyTo(c *server.AuthorizationInfo) er } func (s *DelegatingAuthorizationOptions) toAuthorizer(client kubernetes.Interface) (authorizer.Authorizer, error) { - var authorizers []authorizer.Authorizer + var authorizers []union.NamedAuthorizer if len(s.AlwaysAllowGroups) > 0 { - authorizers = append(authorizers, authorizerfactory.NewPrivilegedGroups(s.AlwaysAllowGroups...)) + authorizers = append(authorizers, union.NamedAuthorizer{ + AuthorizerName: "kubernetes.io/always-allow-groups", + Authorizer: authorizerfactory.NewPrivilegedGroups(s.AlwaysAllowGroups...), + }) } if len(s.AlwaysAllowPaths) > 0 { @@ -186,7 +189,10 @@ func (s *DelegatingAuthorizationOptions) toAuthorizer(client kubernetes.Interfac if err != nil { return nil, err } - authorizers = append(authorizers, a) + authorizers = append(authorizers, union.NamedAuthorizer{ + AuthorizerName: "kubernetes.io/always-allow-paths", + Authorizer: a, + }) } if client == nil { @@ -202,10 +208,13 @@ func (s *DelegatingAuthorizationOptions) toAuthorizer(client kubernetes.Interfac if err != nil { return nil, err } - authorizers = append(authorizers, delegatedAuthorizer) + authorizers = append(authorizers, union.NamedAuthorizer{ + AuthorizerName: "kubernetes.io/webhook", + Authorizer: delegatedAuthorizer, + }) } - return union.New(authorizers...), nil + return union.New(authorizers...) } func (s *DelegatingAuthorizationOptions) getClient() (kubernetes.Interface, error) { diff --git a/vendor/k8s.io/apiserver/pkg/server/options/coreapi.go b/vendor/k8s.io/apiserver/pkg/server/options/coreapi.go index 12a65517e1..d8f1fd6e37 100644 --- a/vendor/k8s.io/apiserver/pkg/server/options/coreapi.go +++ b/vendor/k8s.io/apiserver/pkg/server/options/coreapi.go @@ -21,9 +21,7 @@ import ( "time" "github.com/spf13/pflag" - "k8s.io/apiserver/pkg/features" "k8s.io/apiserver/pkg/server" - "k8s.io/apiserver/pkg/util/feature" clientgoinformers "k8s.io/client-go/informers" clientgoclientset "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" @@ -72,9 +70,7 @@ func (o *CoreAPIOptions) ApplyTo(config *server.RecommendedConfig) error { return err } } - if feature.DefaultFeatureGate.Enabled(features.APIServerTracing) { - kubeconfig.Wrap(tracing.WrapperFor(config.TracerProvider)) - } + kubeconfig.Wrap(tracing.WrapperFor(config.TracerProvider)) clientgoExternalClient, err := clientgoclientset.NewForConfig(kubeconfig) if err != nil { return fmt.Errorf("failed to create Kubernetes clientset: %v", err) diff --git a/vendor/k8s.io/apiserver/pkg/server/options/etcd.go b/vendor/k8s.io/apiserver/pkg/server/options/etcd.go index f522256936..ba704af353 100644 --- a/vendor/k8s.io/apiserver/pkg/server/options/etcd.go +++ b/vendor/k8s.io/apiserver/pkg/server/options/etcd.go @@ -23,6 +23,7 @@ import ( "sort" "strconv" "strings" + "sync" "time" "github.com/spf13/pflag" @@ -61,8 +62,6 @@ type EtcdOptions struct { // Set EnableWatchCache to false to disable all watch caches EnableWatchCache bool - // Set DefaultWatchCacheSize to zero to disable watch caches for those resources that have no explicit cache size set - DefaultWatchCacheSize int // WatchCacheSizes represents override to a given resource WatchCacheSizes []string @@ -82,7 +81,6 @@ func NewEtcdOptions(backendConfig *storagebackend.Config) *EtcdOptions { DeleteCollectionWorkers: 1, EnableGarbageCollection: true, EnableWatchCache: true, - DefaultWatchCacheSize: 100, } options.StorageConfig.CountMetricPollPeriod = time.Minute return options @@ -149,11 +147,12 @@ func (s *EtcdOptions) AddFlags(fs *pflag.FlagSet) { fs.BoolVar(&s.EnableWatchCache, "watch-cache", s.EnableWatchCache, "Enable watch caching in the apiserver") - fs.IntVar(&s.DefaultWatchCacheSize, "default-watch-cache-size", s.DefaultWatchCacheSize, + defaultWatchCacheSize := 100 + fs.IntVar(&defaultWatchCacheSize, "default-watch-cache-size", defaultWatchCacheSize, "Default watch cache size. If zero, watch cache will be disabled for resources that do not have a default watch size set.") fs.MarkDeprecated("default-watch-cache-size", - "watch caches are sized automatically and this flag will be removed in a future version") + "Watch caches are sized automatically. This flag is no-op and it will be removed in a future version.") fs.StringSliceVar(&s.WatchCacheSizes, "watch-cache-sizes", s.WatchCacheSizes, ""+ "Watch cache size settings for some resources (pods, nodes, etc.), comma separated. "+ @@ -240,32 +239,100 @@ func (s *EtcdOptions) ApplyWithStorageFactoryTo(factory serverstorage.StorageFac return err } - metrics.SetStorageMonitorGetter(monitorGetter(factory)) + monitorCache, err := newMonitorCache(factory, c.DrainedNotify()) + if err != nil { + return err + } + metrics.SetStorageMonitorGetter(monitorCache.get) c.RESTOptionsGetter = s.CreateRESTOptionsGetter(factory, c.ResourceTransformers) return nil } -func monitorGetter(factory serverstorage.StorageFactory) func() (monitors []metrics.Monitor, err error) { - return func() (monitors []metrics.Monitor, err error) { - defer func() { - if err != nil { - for _, m := range monitors { - m.Close() - } - } - }() +type monitorCache struct { + mu sync.RWMutex + initialized bool + closed bool + monitors []metrics.Monitor + factory serverstorage.StorageFactory + stopCh <-chan struct{} +} - var m metrics.Monitor - for _, cfg := range factory.Configs() { - m, err = storagefactory.CreateMonitor(cfg) - if err != nil { - return nil, err +var createMonitor = storagefactory.CreateMonitor + +func newMonitorCache(factory serverstorage.StorageFactory, stopCh <-chan struct{}) (*monitorCache, error) { + if stopCh == nil { + return nil, fmt.Errorf("stopCh is required for monitor cache cleanup") + } + cache := &monitorCache{ + factory: factory, + stopCh: stopCh, + } + return cache, nil +} + +func (c *monitorCache) get() ([]metrics.Monitor, error) { + // Fast path: check if already initialized with read lock + c.mu.RLock() + if c.closed { + c.mu.RUnlock() + return nil, fmt.Errorf("monitor cache is closed") + } + if c.initialized { + result := c.monitors + c.mu.RUnlock() + return result, nil + } + c.mu.RUnlock() + + // Slow path: initialize with write lock + return c.initialize() +} + +func (c *monitorCache) initialize() ([]metrics.Monitor, error) { + c.mu.Lock() + defer c.mu.Unlock() + + if c.closed { + return nil, fmt.Errorf("monitor cache is closed") + } + if c.initialized { + return c.monitors, nil + } + + var monitors []metrics.Monitor + for _, cfg := range c.factory.Configs() { + m, err := createMonitor(cfg) + if err != nil { + for _, already := range monitors { + already.Close() //nolint:errcheck } - monitors = append(monitors, m) + return nil, err } - return monitors, nil + monitors = append(monitors, m) + } + c.monitors = monitors + c.initialized = true + + go func() { + <-c.stopCh + c.close() + }() + + return c.monitors, nil +} + +func (c *monitorCache) close() { + c.mu.Lock() + defer c.mu.Unlock() + if c.closed { + return + } + c.closed = true + for _, m := range c.monitors { + m.Close() //nolint:errcheck } + c.monitors = nil } func (s *EtcdOptions) CreateRESTOptionsGetter(factory serverstorage.StorageFactory, resourceTransformers storagevalue.ResourceTransformers) generic.RESTOptionsGetter { diff --git a/vendor/k8s.io/apiserver/pkg/server/options/tracing.go b/vendor/k8s.io/apiserver/pkg/server/options/tracing.go index 07ea9ba048..b8b0219366 100644 --- a/vendor/k8s.io/apiserver/pkg/server/options/tracing.go +++ b/vendor/k8s.io/apiserver/pkg/server/options/tracing.go @@ -27,14 +27,13 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.41.0" "google.golang.org/grpc" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/serializer" "k8s.io/apiserver/pkg/apis/apiserver" "k8s.io/apiserver/pkg/apis/apiserver/install" - "k8s.io/apiserver/pkg/features" "k8s.io/apiserver/pkg/server" "k8s.io/apiserver/pkg/server/egressselector" "k8s.io/apiserver/pkg/util/feature" @@ -87,9 +86,6 @@ func (o *TracingOptions) ApplyTo(es *egressselector.EgressSelector, c *server.Co if o == nil || o.ConfigFile == "" { return nil } - if !feature.DefaultFeatureGate.Enabled(features.APIServerTracing) { - return fmt.Errorf("APIServerTracing feature is not enabled, but tracing config file was provided") - } traceConfig, err := ReadTracingConfiguration(o.ConfigFile) if err != nil { diff --git a/vendor/k8s.io/apiserver/pkg/server/routes/metrics.go b/vendor/k8s.io/apiserver/pkg/server/routes/metrics.go index 644020049a..60dff82520 100644 --- a/vendor/k8s.io/apiserver/pkg/server/routes/metrics.go +++ b/vendor/k8s.io/apiserver/pkg/server/routes/metrics.go @@ -22,6 +22,7 @@ import ( "k8s.io/apiserver/pkg/server/mux" cachermetrics "k8s.io/apiserver/pkg/storage/cacher/metrics" etcd3metrics "k8s.io/apiserver/pkg/storage/etcd3/metrics" + storagemetrics "k8s.io/apiserver/pkg/storage/metrics" flowcontrolmetrics "k8s.io/apiserver/pkg/util/flowcontrol/metrics" peerproxymetrics "k8s.io/apiserver/pkg/util/peerproxy/metrics" proxymetrics "k8s.io/apiserver/pkg/util/proxy/metrics" @@ -50,6 +51,7 @@ func (m MetricsWithReset) Install(c *mux.PathRecorderMux) { // register apiserver and etcd metrics func register() { apimetrics.Register() + storagemetrics.Register() cachermetrics.Register() etcd3metrics.Register() flowcontrolmetrics.Register() diff --git a/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1alpha1/types.go b/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1alpha1/types.go index ccbe05cb8f..007493938d 100644 --- a/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1alpha1/types.go +++ b/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1alpha1/types.go @@ -24,7 +24,7 @@ import ( // Statusz is a struct used for versioned statusz endpoint. type Statusz struct { // TypeMeta is the type metadata for the object. - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/types.go b/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/types.go index a8898826bb..32bd868672 100644 --- a/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/types.go +++ b/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/types.go @@ -24,7 +24,7 @@ import ( // Statusz is a struct used for versioned statusz endpoint. type Statusz struct { // TypeMeta is the type metadata for the object. - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Standard object's metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/apiserver/pkg/server/storage/resource_encoding_config.go b/vendor/k8s.io/apiserver/pkg/server/storage/resource_encoding_config.go index 9813266662..3cbf50bd72 100644 --- a/vendor/k8s.io/apiserver/pkg/server/storage/resource_encoding_config.go +++ b/vendor/k8s.io/apiserver/pkg/server/storage/resource_encoding_config.go @@ -18,6 +18,7 @@ package storage import ( "fmt" + "strings" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" @@ -155,51 +156,61 @@ func emulatedStorageVersion(binaryVersionOfResource schema.GroupVersion, example versions := scheme.VersionsForGroupKind(schema.GroupKind{Group: gvk.Group, Kind: gvk.Kind}) compatibilityVersion := effectiveVersion.MinCompatibilityVersion() + emulationVersion := effectiveVersion.EmulationVersion() + + // introducedVersion returns the release this version of the kind was + // introduced in. It returns nil when no lifecycle information is available, + // or when the current compatibility version is 0.0 (used by tests to + // exercise all APIs). + introducedVersion := func(gv schema.GroupVersion) (*apimachineryversion.Version, error) { + obj, err := scheme.New(schema.GroupVersionKind{Group: gv.Group, Version: gv.Version, Kind: gvk.Kind}) + if err != nil { + return nil, err + } + if introduced, ok := obj.(introducedInterface); ok && (compatibilityVersion.Major() > 0 || compatibilityVersion.Minor() > 0) { + major, minor := introduced.APILifecycleIntroduced() + return apimachineryversion.MajorMinor(uint(major), uint(minor)), nil + } + return nil, nil + } + // Pass 1: Find the highest-priority non-alpha version that is n-1 + // rollback safe (introduced at or before MinCompatibilityVersion). + // Alpha versions are excluded because alpha APIs have no compatibility + // guarantees, so there is no value in retaining rollback compatibility + // with them. for _, gv := range versions { - if gv.Version == runtime.APIVersionInternal { + if gv.Version == runtime.APIVersionInternal || strings.Contains(gv.Version, "alpha") { continue } - - gvk := schema.GroupVersionKind{ - Group: gv.Group, - Version: gv.Version, - Kind: gvk.Kind, + ver, err := introducedVersion(gv) + if err != nil { + return schema.GroupVersion{}, err } + if ver == nil || !ver.GreaterThan(compatibilityVersion) { + return gv, nil + } + } - exampleOfGVK, err := scheme.New(gvk) + // Pass 2: No n-1 safe non-alpha version exists. This covers alpha-only + // kinds and newly introduced betas (where the predecessor is alpha). + // Find the highest-priority version introduced at or before + // EmulationVersion. + for _, gv := range versions { + if gv.Version == runtime.APIVersionInternal { + continue + } + ver, err := introducedVersion(gv) if err != nil { return schema.GroupVersion{}, err } - - // If it was introduced after current compatibility version, don't use it - // skip the introduced check for test when current compatibility version is 0.0 to test all apis - if introduced, hasIntroduced := exampleOfGVK.(introducedInterface); hasIntroduced && (compatibilityVersion.Major() > 0 || compatibilityVersion.Minor() > 0) { - // API resource lifecycles should be relative to k8s api version - majorIntroduced, minorIntroduced := introduced.APILifecycleIntroduced() - introducedVer := apimachineryversion.MajorMinor(uint(majorIntroduced), uint(minorIntroduced)) - if introducedVer.GreaterThan(compatibilityVersion) { - continue - } + if ver == nil || !ver.GreaterThan(emulationVersion) { + return gv, nil } - - // versions is returned in priority order, so just use first result - return gvk.GroupVersion(), nil } - // Getting here means we're serving a version that is unknown to the - // min-compatibility-version server. - // - // This is only expected to happen when serving an alpha API type due - // to missing pre-release lifecycle information - // (which doesn't happen by default), or when emulation-version and - // min-compatibility-version are several versions apart so a beta or GA API - // was being served which didn't exist at all in min-compatibility-version. - // - // In the alpha case - we do not support compatibility versioning of - // alpha types and recommend users do not mix the two. - // In the skip-level case - The version of apiserver we are retaining - // compatibility with has no knowledge of the type, - // so storing it in another type is no issue. + // Getting here means every version of this kind was introduced after + // the emulation version, so the resource should not be served at this + // emulation version at all. return binaryVersionOfResource, nil } diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/cache_watcher.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/cache_watcher.go index 8711596a3c..6f4440234d 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/cache_watcher.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/cache_watcher.go @@ -22,6 +22,8 @@ import ( "sync" "time" + "k8s.io/utils/clock" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" utilruntime "k8s.io/apimachinery/pkg/util/runtime" @@ -63,6 +65,8 @@ type cacheWatcher struct { deadline time.Time allowWatchBookmarks bool groupResource schema.GroupResource + watcherMetrics *metrics.WatcherMetricsObservers + clock clock.Clock // human readable identifier that helps assigning cacheWatcher // instance with request @@ -95,8 +99,13 @@ func newCacheWatcher( deadline time.Time, allowWatchBookmarks bool, groupResource schema.GroupResource, + watcherMetrics *metrics.WatcherMetricsObservers, + clk clock.Clock, identifier string, ) *cacheWatcher { + if clk == nil { + clk = clock.RealClock{} + } return &cacheWatcher{ input: make(chan *watchCacheEvent, chanSize), result: make(chan watch.Event, chanSize), @@ -108,6 +117,8 @@ func newCacheWatcher( deadline: deadline, allowWatchBookmarks: allowWatchBookmarks, groupResource: groupResource, + watcherMetrics: watcherMetrics, + clock: clk, identifier: identifier, } } @@ -401,12 +412,13 @@ func (c *cacheWatcher) convertToWatchEvent(event *watchCacheEvent) *watch.Event } // NOTE: sendWatchCacheEvent is assumed to not modify !!! -func (c *cacheWatcher) sendWatchCacheEvent(event *watchCacheEvent) { +func (c *cacheWatcher) sendWatchCacheEvent(event *watchCacheEvent) (builtAt, sentAt time.Time) { watchEvent := c.convertToWatchEvent(event) if watchEvent == nil { // Watcher is not interested in that object. - return + return time.Time{}, time.Time{} } + builtAt = c.clock.Now() // We need to ensure that if we put event X to the c.result, all // previous events were already put into it before, no matter whether @@ -422,15 +434,17 @@ func (c *cacheWatcher) sendWatchCacheEvent(event *watchCacheEvent) { // events. select { case <-c.done: - return + return time.Time{}, time.Time{} default: } select { case c.result <- *watchEvent: c.markBookmarkAfterRvSent(event) + sentAt = c.clock.Now() case <-c.done: } + return builtAt, sentAt } func (c *cacheWatcher) processInterval(ctx context.Context, cacheInterval *watchCacheInterval, resourceVersion uint64) { @@ -536,10 +550,22 @@ func (c *cacheWatcher) process(ctx context.Context, resourceVersion uint64) { // or a bookmark event with an RV equal to resourceVersion // if we haven't sent one to the client if event.ResourceVersion > resourceVersion || (event.Type == watch.Bookmark && event.ResourceVersion == resourceVersion && !c.wasBookmarkAfterRvSent()) { - c.sendWatchCacheEvent(event) + builtAt, sentAt := c.sendWatchCacheEvent(event) + c.observeDispatchMetrics(event, builtAt, sentAt) } case <-ctx.Done(): return } } } + +func (c *cacheWatcher) observeDispatchMetrics(event *watchCacheEvent, builtAt, sentAt time.Time) { + if event.Type == watch.Bookmark || sentAt.IsZero() || event.RecordTime.IsZero() { + return + } + if !event.CacheReceived.IsZero() { + c.watcherMetrics.ObserveStage(metrics.StageStorageToCache, event.CacheReceived.Sub(event.RecordTime)) + } + c.watcherMetrics.ObserveStage(metrics.StageCacheToWatcher, sentAt.Sub(builtAt)) + c.watcherMetrics.ObserveStage(metrics.StageTotal, sentAt.Sub(event.RecordTime)) +} diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/cacher.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/cacher.go index 326ed27c80..d3aba4323b 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/cacher.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/cacher.go @@ -44,6 +44,7 @@ import ( "k8s.io/apiserver/pkg/features" "k8s.io/apiserver/pkg/storage" "k8s.io/apiserver/pkg/storage/cacher/delegator" + "k8s.io/apiserver/pkg/storage/cacher/key" "k8s.io/apiserver/pkg/storage/cacher/metrics" "k8s.io/apiserver/pkg/storage/cacher/progress" "k8s.io/apiserver/pkg/storage/cacher/store" @@ -341,6 +342,7 @@ type Cacher struct { // expiredBookmarkWatchers is a list of watchers that were expired and need to be schedule for a next bookmark event expiredBookmarkWatchers []*cacheWatcher compactor *compactor + watcherMetrics *metrics.WatcherMetricsObservers } // NewCacherFromConfig creates a new Cacher responsible for servicing WATCH and LIST requests from @@ -413,6 +415,7 @@ func NewCacherFromConfig(config Config) (*Cacher, error) { clock: config.Clock, timer: time.NewTimer(time.Duration(0)), bookmarkWatchers: newTimeBucketWatchers(config.Clock, defaultBookmarkFrequency), + watcherMetrics: metrics.NewWatcherMetricsObservers(config.GroupResource), } // Ensure that timer is stopped. @@ -441,7 +444,7 @@ func NewCacherFromConfig(config Config) (*Cacher, error) { listerWatcher := NewListerWatcher(config.Storage, resourcePrefix, config.NewListFunc, contextMetadata) reflectorName := "storage/cacher.go:" + resourcePrefix - reflector := cache.NewNamedReflector(reflectorName, listerWatcher, obj, watchCache, 0) + reflector := cache.NewNamedReflector(reflectorName, listerWatcher, nil, watchCache, 0) // Configure reflector's pager to for an appropriate pagination chunk size for fetching data from // storage. The pager falls back to full list if paginated list calls fail due to an "Expired" error. reflector.WatchListPageSize = storageWatchListPageSize @@ -484,10 +487,13 @@ func NewCacherFromConfig(config Config) (*Cacher, error) { } func (c *Cacher) startCaching(stopChannel <-chan struct{}) { + startTime := time.Now() c.watchCache.SetOnReplace(func() { c.ready.setReady() - klog.V(1).InfoS("cacher initialized", "group", c.groupResource.Group, "resource", c.groupResource.Resource) + duration := time.Since(startTime) + klog.V(1).InfoS("cacher initialized", "group", c.groupResource.Group, "resource", c.groupResource.Resource, "duration", duration) metrics.WatchCacheInitializations.WithLabelValues(c.groupResource.Group, c.groupResource.Resource).Inc() + metrics.WatchCacheInitializationDuration.WithLabelValues(c.groupResource.Group, c.groupResource.Resource).Observe(duration.Seconds()) }) var err error defer func() { @@ -498,6 +504,7 @@ func (c *Cacher) startCaching(stopChannel <-chan struct{}) { err = c.reflector.ListAndWatch(stopChannel) if err != nil { klog.Errorf("cacher (%v): unexpected ListAndWatch error: %v; reinitializing...", c.groupResource.String(), err) + metrics.WatchCacheInitializationErrors.WithLabelValues(c.groupResource.Group, c.groupResource.Resource).Inc() } } @@ -521,19 +528,9 @@ func (c *Cacher) Watch(ctx context.Context, key string, opts storage.ListOptions return nil, err } - var readyGeneration int - if utilfeature.DefaultFeatureGate.Enabled(features.ResilientWatchCacheInitialization) { - var err error - var downtime time.Duration - readyGeneration, downtime, err = c.ready.checkAndReadGeneration() - if err != nil { - return nil, errors.NewTooManyRequests(err.Error(), calculateRetryAfterForUnreadyCache(downtime)) - } - } else { - readyGeneration, err = c.ready.waitAndReadGeneration(ctx) - if err != nil { - return nil, errors.NewServiceUnavailable(err.Error()) - } + readyGeneration, downtime, err := c.ready.checkAndReadGeneration() + if err != nil { + return nil, errors.NewTooManyRequests(err.Error(), calculateRetryAfterForUnreadyCache(downtime)) } // determine the namespace and name scope of the watch, first from the request, secondarily from the field selector @@ -609,6 +606,8 @@ func (c *Cacher) Watch(ctx context.Context, key string, opts storage.ListOptions deadline, pred.AllowWatchBookmarks, c.groupResource, + c.watcherMetrics, + c.clock, identifier, ) @@ -691,6 +690,10 @@ func (c *Cacher) Watch(ctx context.Context, key string, opts storage.ListOptions } func (c *Cacher) Get(ctx context.Context, key string, opts storage.GetOptions, objPtr runtime.Object) error { + ctx, span := tracing.Start(ctx, "cacher.Get", + attribute.String("audit-id", audit.GetAuditIDTruncated(ctx)), + attribute.String("key", key), + attribute.String("resource-version", opts.ResourceVersion)) key, err := c.prepareKey(key, false) if err != nil { return err @@ -709,6 +712,8 @@ func (c *Cacher) Get(ctx context.Context, key string, opts storage.GetOptions, o if err != nil { return err } + // Get long processing is >500ms, however wait for fresh cache timeout is 3s so want to avoid traces just showing waits. + defer span.End(500 * time.Millisecond) if exists { elem, ok := obj.(*store.Element) @@ -760,16 +765,10 @@ func (c *Cacher) GetList(ctx context.Context, key string, opts storage.ListOptio attribute.Stringer("type", c.groupResource)) defer span.End(500 * time.Millisecond) - if utilfeature.DefaultFeatureGate.Enabled(features.ResilientWatchCacheInitialization) { - if downtime, err := c.ready.check(); err != nil { - // If Cacher is not initialized, reject List requests - // as described in https://kep.k8s.io/4568 - return errors.NewTooManyRequests(err.Error(), calculateRetryAfterForUnreadyCache(downtime)) - } - } else { - if err := c.ready.wait(ctx); err != nil { - return errors.NewServiceUnavailable(err.Error()) - } + if downtime, err := c.ready.check(); err != nil { + // If Cacher is not initialized, reject List requests + // as described in https://kep.k8s.io/4568 + return errors.NewTooManyRequests(err.Error(), calculateRetryAfterForUnreadyCache(downtime)) } span.AddEvent("Ready") @@ -791,45 +790,64 @@ func (c *Cacher) GetList(ctx context.Context, key string, opts storage.ListOptio return err } span.AddEvent("Listed items from cache", attribute.Int("count", len(resp.Items))) - // store pointer of eligible objects, - // Why not directly put object in the items of listObj? - // the elements in ListObject are Struct type, making slice will bring excessive memory consumption. - // so we try to delay this action as much as possible - var selectedObjects []runtime.Object var lastSelectedObjectKey string var hasMoreListItems bool limit := computeListLimit(opts) - for i, obj := range resp.Items { - elem, ok := obj.(*store.Element) - if !ok { - return fmt.Errorf("non *store.Element returned from storage: %v", obj) + if opts.Predicate.Empty() { + // Every item matches, so the result size is known upfront and items can be + // copied directly into the result list without an intermediate slice. + count := len(resp.Items) + if limit > 0 && int64(count) > limit { + count = int(limit) + hasMoreListItems = true } - shardMatch := true - if utilfeature.DefaultFeatureGate.Enabled(features.ShardedListAndWatch) { - var err error - shardMatch, err = opts.Predicate.MatchesSharding(elem.Object) - if err != nil { - return fmt.Errorf("shard matching failed: %w", err) + listVal.Set(reflect.MakeSlice(listVal.Type(), count, count)) + for i, obj := range resp.Items[:count] { + elem, ok := obj.(*store.Element) + if !ok { + return fmt.Errorf("non *store.Element returned from storage: %v", obj) } - } - if shardMatch && opts.Predicate.MatchesObjectAttributes(elem.Labels, elem.Fields) { - selectedObjects = append(selectedObjects, elem.Object) + listVal.Index(i).Set(reflect.ValueOf(elem.Object).Elem()) lastSelectedObjectKey = elem.Key } - if limit > 0 && int64(len(selectedObjects)) >= limit { - hasMoreListItems = i < len(resp.Items)-1 - break - } - } - if len(selectedObjects) == 0 { - // Ensure that we never return a nil Items pointer in the result for consistency. - listVal.Set(reflect.MakeSlice(listVal.Type(), 0, 0)) } else { - // Resize the slice appropriately, since we already know that size of result set - listVal.Set(reflect.MakeSlice(listVal.Type(), len(selectedObjects), len(selectedObjects))) - span.AddEvent("Resized result") - for i, o := range selectedObjects { - listVal.Index(i).Set(reflect.ValueOf(o).Elem()) + // store pointer of eligible objects, + // Why not directly put object in the items of listObj? + // the elements in ListObject are Struct type, making slice will bring excessive memory consumption. + // so we try to delay this action as much as possible + var selectedObjects []runtime.Object + for i, obj := range resp.Items { + elem, ok := obj.(*store.Element) + if !ok { + return fmt.Errorf("non *store.Element returned from storage: %v", obj) + } + shardMatch := true + if utilfeature.DefaultFeatureGate.Enabled(features.ShardedListAndWatch) { + var err error + shardMatch, err = opts.Predicate.MatchesSharding(elem.Object) + if err != nil { + return fmt.Errorf("shard matching failed: %w", err) + } + } + if shardMatch && opts.Predicate.MatchesObjectAttributes(elem.Labels, elem.Fields) { + selectedObjects = append(selectedObjects, elem.Object) + lastSelectedObjectKey = elem.Key + } + if limit > 0 && int64(len(selectedObjects)) >= limit { + hasMoreListItems = i < len(resp.Items)-1 + break + } + } + if len(selectedObjects) == 0 { + // Ensure that we never return a nil Items pointer in the result for consistency. + listVal.Set(reflect.MakeSlice(listVal.Type(), 0, 0)) + } else { + // Resize the slice appropriately, since we already know that size of result set + listVal.Set(reflect.MakeSlice(listVal.Type(), len(selectedObjects), len(selectedObjects))) + span.AddEvent("Resized result") + for i, o := range selectedObjects { + listVal.Index(i).Set(reflect.ValueOf(o).Elem()) + } } } span.AddEvent("Filtered items", attribute.Int("count", listVal.Len())) @@ -1182,12 +1200,12 @@ func (c *Cacher) Compact(resourceVersion string) error { if err != nil { return err } - c.watchCache.Compact(rv) + c.watchCache.storage.Compact(rv) return nil } func (c *Cacher) MarkConsistent(consistent bool) { - c.watchCache.MarkConsistent(consistent) + c.watchCache.storage.MarkConsistent(consistent) } // Stop implements the graceful termination. @@ -1224,10 +1242,10 @@ func forgetWatcher(c *Cacher, w *cacheWatcher, index int, scope namespacedName, } } -func filterWithAttrsAndPrefixFunction(key string, p storage.SelectionPredicate, groupResource schema.GroupResource) filterWithAttrsFunc { +func filterWithAttrsAndPrefixFunction(prefix string, p storage.SelectionPredicate, groupResource schema.GroupResource) filterWithAttrsFunc { isSharded := utilfeature.DefaultFeatureGate.Enabled(features.ShardedListAndWatch) && p.ShardSelector != nil && !p.ShardSelector.Empty() filterFunc := func(objKey string, label labels.Set, field fields.Set, obj runtime.Object) bool { - if !hasPathPrefix(objKey, key) { + if !key.HasPathPrefix(objKey, prefix) { return false } if isSharded { @@ -1317,13 +1335,17 @@ func (c *Cacher) waitUntilWatchCacheFreshAndForceAllEvents(ctx context.Context, // // In this very rare scenario, the worst case will be that this // request will wait for 3 seconds before it fails. - if etcdfeature.DefaultFeatureSupportChecker.Supports(storage.RequestWatchProgress) && c.watchCache.notFresh(requestedWatchRV) { - c.watchCache.waitingUntilFresh.Add() - defer c.watchCache.waitingUntilFresh.Remove() - } - err := c.watchCache.waitUntilFreshAndBlock(ctx, requestedWatchRV) + span := tracing.SpanFromContext(ctx) + consistentReadSupported := delegator.ConsistentReadSupported() + c.watchCache.RLock() + span.AddEvent("watchCache locked acquired") defer c.watchCache.RUnlock() - return err + err := c.watchCache.waitUntilFreshLocked(ctx, consistentReadSupported, requestedWatchRV) + if err != nil { + return err + } + span.AddEvent("watchCache fresh enough") + return nil } return nil } @@ -1354,10 +1376,14 @@ func (c *Cacher) setInitialEventsEndBookmarkIfRequested(cacheInterval *watchCach } func (c *Cacher) getKeys(ctx context.Context) ([]string, error) { + ctx, span := tracing.Start(ctx, "cacher.getKeys", + attribute.String("audit-id", audit.GetAuditIDTruncated(ctx))) + defer span.End(500 * time.Millisecond) rev, err := c.storage.GetCurrentResourceVersion(ctx) if err != nil { return nil, err } + span.AddEvent("GetCurrentResourceVersion succeed", attribute.Int64("resource-version", int64(rev))) return c.watchCache.WaitUntilFreshAndGetKeys(ctx, rev) } @@ -1398,7 +1424,7 @@ func newErrWatcher(err error) *errWatcher { func (c *Cacher) ShouldDelegateExactRV(resourceVersion string, recursive bool) (delegator.Result, error) { // Not Recursive is not supported unitl exact RV is implemented for WaitUntilFreshAndGet. - if !recursive || c.watchCache.snapshots == nil { + if !recursive || !c.watchCache.storage.SnapshottingEnabled() { return delegator.Result{ShouldDelegate: true}, nil } listRV, err := c.versioner.ParseResourceVersion(resourceVersion) @@ -1410,7 +1436,7 @@ func (c *Cacher) ShouldDelegateExactRV(resourceVersion string, recursive bool) ( func (c *Cacher) ShouldDelegateContinue(continueToken string, recursive bool) (delegator.Result, error) { // Not Recursive is not supported unitl exact RV is implemented for WaitUntilFreshAndGet. - if !recursive || c.watchCache.snapshots == nil { + if !recursive || !c.watchCache.storage.SnapshottingEnabled() { return delegator.Result{ShouldDelegate: true}, nil } _, continueRV, err := storage.DecodeContinue(continueToken, c.resourcePrefix) @@ -1432,7 +1458,7 @@ func (c *Cacher) shouldDelegateExactRV(rv uint64) (delegator.Result, error) { ShouldDelegate: !delegator.ConsistentReadSupported(), }, nil } - _, canServe := c.watchCache.snapshots.GetLessOrEqual(rv) + canServe := c.watchCache.storage.CanServeExactRV(rv) return delegator.Result{ ShouldDelegate: !canServe, }, nil diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/compactor.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/compactor.go index 1144dd03fe..616f5c7439 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/compactor.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/compactor.go @@ -72,7 +72,7 @@ func (c *compactor) compactIfNeeded() { if rev <= c.compactRevision { return } - c.wc.Compact(uint64(rev)) + c.wc.storage.Compact(uint64(rev)) c.compactRevision = rev } diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/consistency/checker.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/consistency/checker.go new file mode 100644 index 0000000000..25b254384e --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/consistency/checker.go @@ -0,0 +1,264 @@ +/* +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. +*/ + +package consistency + +import ( + "context" + "fmt" + "hash" + "hash/fnv" + "os" + "strconv" + "time" + + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/apiserver/pkg/storage" + "k8s.io/apiserver/pkg/storage/cacher/metrics" + "k8s.io/klog/v2" +) + +var ( + // CheckPeriod is the period of checking consistency between etcd and cache. + // 5 minutes were proposed to match the default compaction period. It's magnitute higher than + // List latency SLO (30 seconds) and timeout (1 minute). + CheckPeriod = 5 * time.Minute + // PanicOnCacheInconsistency enables the consistency checking mechanism for cache. + // Based on KUBE_WATCHCACHE_CONSISTENCY_CHECKER environment variable. + PanicOnCacheInconsistency = false + // checkerListPageSize is the checker's request chunk size of list operations. + checkerListPageSize = int64(10000) +) + +func init() { + PanicOnCacheInconsistency, _ = strconv.ParseBool(os.Getenv("KUBE_WATCHCACHE_CONSISTENCY_CHECKER")) +} + +func NewChecker(resourcePrefix string, groupResource schema.GroupResource, newListFunc func() runtime.Object, cacher cacher, etcd getLister) *Checker { + return &Checker{ + groupResource: groupResource, + resourcePrefix: resourcePrefix, + newListFunc: newListFunc, + cacher: cacher, + etcd: etcd, + } +} + +type Checker struct { + resourcePrefix string + groupResource schema.GroupResource + newListFunc func() runtime.Object + + cacher cacher + etcd getLister +} + +type cacher interface { + getLister + Ready() bool + MarkConsistent(bool) +} + +type getLister interface { + GetList(ctx context.Context, key string, opts storage.ListOptions, listObj runtime.Object) error +} + +func (c Checker) Run(stopCh <-chan struct{}) { + klog.V(3).InfoS("Cache consistency check start", "group", c.groupResource.Group, "resource", c.groupResource.Resource) + jitter := 0.5 // Period between [interval, interval * (1.0 + jitter)] + sliding := true + // wait.JitterUntilWithContext starts work immediately, so wait first. + select { + case <-time.After(wait.Jitter(CheckPeriod, jitter)): + case <-stopCh: + } + wait.JitterUntilWithContext(wait.ContextForChannel(stopCh), c.check, CheckPeriod, jitter, sliding) +} + +func (c *Checker) check(ctx context.Context) { + digests, err := c.CalculateDigests(ctx) + if err != nil { + klog.ErrorS(err, "Cache consistency check error", "group", c.groupResource.Group, "resource", c.groupResource.Resource) + metrics.StorageConsistencyCheckTotal.WithLabelValues(c.groupResource.Group, c.groupResource.Resource, "error").Inc() + return + } + if digests.CacheDigest == digests.EtcdDigest { + klog.V(3).InfoS("Cache consistency check passed", "group", c.groupResource.Group, "resource", c.groupResource.Resource, "resourceVersion", digests.ResourceVersion, "digest", digests.CacheDigest) + metrics.StorageConsistencyCheckTotal.WithLabelValues(c.groupResource.Group, c.groupResource.Resource, "success").Inc() + c.cacher.MarkConsistent(true) + return + } + klog.ErrorS(nil, "Cache consistency check failed", "group", c.groupResource.Group, "resource", c.groupResource.Resource, "resourceVersion", digests.ResourceVersion, "etcdDigest", digests.EtcdDigest, "cacheDigest", digests.CacheDigest, "diffDetail", digests.DiffDetail) + metrics.StorageConsistencyCheckTotal.WithLabelValues(c.groupResource.Group, c.groupResource.Resource, "failure").Inc() + if PanicOnCacheInconsistency { + panic(fmt.Sprintf("Cache consistency check failed, group: %q, resource: %q, resourceVersion: %q, etcdDigest: %q, cacheDigest: %q, diffDetail: %v", c.groupResource.Group, c.groupResource.Resource, digests.ResourceVersion, digests.EtcdDigest, digests.CacheDigest, digests.DiffDetail)) + } + c.cacher.MarkConsistent(false) +} + +func (c *Checker) CalculateDigests(ctx context.Context) (*Digest, error) { + if !c.cacher.Ready() { + return nil, fmt.Errorf("cache is not ready") + } + // variables for tracking the diff in consistency checker + cacheItems := []namespaceNameRV{} + var foundDiff *diffDetail + var etcdIndex int + + cacheDigest, cacheResourceVersion, err := c.calculateStoreDigest(ctx, c.cacher, "0", 0, func(obj metav1.Object) { + // collect items from cacher's list + cacheItems = append(cacheItems, namespaceNameRV{Namespace: obj.GetNamespace(), Name: obj.GetName(), RV: obj.GetResourceVersion()}) + }) + if err != nil { + return nil, fmt.Errorf("failed calculating cache digest: %w", err) + } + etcdDigest, etcdResourceVersion, err := c.calculateStoreDigest(ctx, c.etcd, cacheResourceVersion, checkerListPageSize, func(obj metav1.Object) { + // compare the item in etcd's list against cacheItems which is cacher's list + if foundDiff != nil { + return + } + etcdItem := namespaceNameRV{Namespace: obj.GetNamespace(), Name: obj.GetName(), RV: obj.GetResourceVersion()} + if len(cacheItems) <= etcdIndex { + foundDiff = &diffDetail{Index: etcdIndex, EtcdItem: &etcdItem} + cacheItems = nil // don't need it any more and nil it to allow GC to collect it + return + } + if cacheItem := cacheItems[etcdIndex]; cacheItem != etcdItem { + foundDiff = &diffDetail{Index: etcdIndex, EtcdItem: &etcdItem, CacheItem: &cacheItem} + cacheItems = nil // don't need it any more and nil it to allow GC to collect it + return + } + etcdIndex += 1 + }) + if err != nil { + return nil, fmt.Errorf("failed calculating etcd digest: %w", err) + } + if len(cacheItems) > etcdIndex { + cacheItem := cacheItems[etcdIndex] + foundDiff = &diffDetail{Index: etcdIndex, CacheItem: &cacheItem} + } + if cacheResourceVersion != etcdResourceVersion { + return nil, fmt.Errorf("etcd returned different resource version then expected, cache: %q, etcd: %q", cacheResourceVersion, etcdResourceVersion) + } + return &Digest{ + ResourceVersion: cacheResourceVersion, + CacheDigest: cacheDigest, + EtcdDigest: etcdDigest, + DiffDetail: foundDiff, + }, nil +} + +type namespaceNameRV struct { + Namespace string + Name string + RV string +} + +type diffDetail struct { + Index int + CacheItem *namespaceNameRV + EtcdItem *namespaceNameRV +} + +type Digest struct { + ResourceVersion string + CacheDigest string + EtcdDigest string + DiffDetail *diffDetail +} + +func (c *Checker) calculateStoreDigest(ctx context.Context, store getLister, resourceVersion string, limit int64, metaVisitor func(objectMeta metav1.Object)) (digest, rv string, err error) { + opts := storage.ListOptions{ + Recursive: true, + Predicate: storage.Everything, + ResourceVersion: resourceVersion, + } + opts.Predicate.Limit = limit + if resourceVersion == "0" { + opts.ResourceVersionMatch = metav1.ResourceVersionMatchNotOlderThan + } else { + opts.ResourceVersionMatch = metav1.ResourceVersionMatchExact + } + h := fnv.New64() + for { + resp := c.newListFunc() + err = store.GetList(ctx, c.resourcePrefix, opts, resp) + if err != nil { + return "", "", err + } + err = addListToDigest(h, resp, metaVisitor) + if err != nil { + return "", "", err + } + list, err := meta.ListAccessor(resp) + if err != nil { + return "", "", err + } + if resourceVersion == "0" { + resourceVersion = list.GetResourceVersion() + } + continueToken := list.GetContinue() + if continueToken == "" { + return fmt.Sprintf("%x", h.Sum64()), resourceVersion, nil + } + opts.Predicate.Continue = continueToken + opts.ResourceVersion = "" + opts.ResourceVersionMatch = "" + } +} + +func addListToDigest(h hash.Hash64, list runtime.Object, metaVisitor func(objectMeta metav1.Object)) error { + return meta.EachListItem(list, func(obj runtime.Object) error { + objectMeta, err := meta.Accessor(obj) + if err != nil { + return err + } + err = addObjectToDigest(h, objectMeta) + if err != nil { + return err + } + metaVisitor(objectMeta) + return nil + }) +} + +func addObjectToDigest(h hash.Hash64, objectMeta metav1.Object) error { + _, err := h.Write([]byte(objectMeta.GetNamespace())) + if err != nil { + return err + } + _, err = h.Write([]byte("/")) + if err != nil { + return err + } + _, err = h.Write([]byte(objectMeta.GetName())) + if err != nil { + return err + } + _, err = h.Write([]byte("/")) + if err != nil { + return err + } + _, err = h.Write([]byte(objectMeta.GetResourceVersion())) + if err != nil { + return err + } + return nil +} diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/delegator.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/delegator.go index 4e1fabfaba..25c095c548 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/delegator.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/delegator.go @@ -18,59 +18,33 @@ package cacher import ( "context" - "fmt" - "hash" - "hash/fnv" - "os" - "strconv" "sync" - "time" - "go.opentelemetry.io/otel/attribute" "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/api/meta" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/watch" - "k8s.io/apiserver/pkg/audit" "k8s.io/apiserver/pkg/features" "k8s.io/apiserver/pkg/storage" + "k8s.io/apiserver/pkg/storage/cacher/consistency" "k8s.io/apiserver/pkg/storage/cacher/delegator" "k8s.io/apiserver/pkg/storage/cacher/metrics" "k8s.io/apiserver/pkg/storage/cacher/store" utilfeature "k8s.io/apiserver/pkg/util/feature" - "k8s.io/component-base/tracing" "k8s.io/klog/v2" ) -var ( - // ConsistencyCheckPeriod is the period of checking consistency between etcd and cache. - // 5 minutes were proposed to match the default compaction period. It's magnitute higher than - // List latency SLO (30 seconds) and timeout (1 minute). - ConsistencyCheckPeriod = 5 * time.Minute - // panicOnCacheInconsistency enables the consistency checking mechanism for cache. - // Based on KUBE_WATCHCACHE_CONSISTENCY_CHECKER environment variable. - panicOnCacheInconsistency = false -) - -func init() { - panicOnCacheInconsistency, _ = strconv.ParseBool(os.Getenv("KUBE_WATCHCACHE_CONSISTENCY_CHECKER")) -} - func NewCacheDelegator(cacher *Cacher, storage storage.Interface) *CacheDelegator { d := &CacheDelegator{ cacher: cacher, storage: storage, stopCh: make(chan struct{}), } - if utilfeature.DefaultFeatureGate.Enabled(features.DetectCacheInconsistency) || panicOnCacheInconsistency { - d.checker = newConsistencyChecker(cacher.resourcePrefix, cacher.groupResource, cacher.newListFunc, cacher, storage) + if utilfeature.DefaultFeatureGate.Enabled(features.DetectCacheInconsistency) || consistency.PanicOnCacheInconsistency { + d.checker = consistency.NewChecker(cacher.resourcePrefix, cacher.groupResource, cacher.newListFunc, cacher, storage) d.wg.Add(1) go func() { defer d.wg.Done() - d.checker.startChecking(d.stopCh) + d.checker.Run(d.stopCh) }() } return d @@ -79,7 +53,7 @@ func NewCacheDelegator(cacher *Cacher, storage storage.Interface) *CacheDelegato type CacheDelegator struct { cacher *Cacher storage storage.Interface - checker *consistencyChecker + checker *consistency.Checker wg sync.WaitGroup stopOnce sync.Once @@ -107,7 +81,7 @@ func (c *CacheDelegator) EnableResourceSizeEstimation(keys storage.KeysFunc) err func (c *CacheDelegator) Delete(ctx context.Context, key string, out runtime.Object, preconditions *storage.Preconditions, validateDeletion storage.ValidateObjectFunc, cachedExistingObject runtime.Object, opts storage.DeleteOptions) error { // Ignore the suggestion and try to pass down the current version of the object // read from cache. - if elem, exists, err := c.cacher.watchCache.GetByKey(key); err != nil { + if elem, exists, err := c.cacher.watchCache.storage.GetByKey(key); err != nil { klog.Errorf("GetByKey returned error: %v", err) } else if exists { // DeepCopy the object since we modify resource version when serializing the @@ -134,46 +108,23 @@ func (c *CacheDelegator) Watch(ctx context.Context, key string, opts storage.Lis } func (c *CacheDelegator) Get(ctx context.Context, key string, opts storage.GetOptions, objPtr runtime.Object) error { - ctx, span := tracing.Start(ctx, "cacher.Get", - attribute.String("audit-id", audit.GetAuditIDTruncated(ctx)), - attribute.String("key", key), - attribute.String("resource-version", opts.ResourceVersion)) - defer span.End(500 * time.Millisecond) if opts.ResourceVersion == "" { // If resourceVersion is not specified, serve it from underlying // storage (for backward compatibility). - span.AddEvent("About to Get from underlying storage") return c.storage.Get(ctx, key, opts, objPtr) } - if utilfeature.DefaultFeatureGate.Enabled(features.ResilientWatchCacheInitialization) { - if !c.cacher.Ready() { - // If Cache is not initialized, delegator Get requests to storage - // as described in https://kep.k8s.io/4568 - span.AddEvent("About to Get from underlying storage - cache not initialized") - return c.storage.Get(ctx, key, opts, objPtr) - } + if !c.cacher.Ready() { + // If Cache is not initialized, delegator Get requests to storage + // as described in https://kep.k8s.io/4568 + return c.storage.Get(ctx, key, opts, objPtr) } // If resourceVersion is specified, serve it from cache. // It's guaranteed that the returned value is at least that // fresh as the given resourceVersion. - getRV, err := c.cacher.versioner.ParseResourceVersion(opts.ResourceVersion) - if err != nil { + if _, err := c.cacher.versioner.ParseResourceVersion(opts.ResourceVersion); err != nil { return err } - // Do not create a trace - it's not for free and there are tons - // of Get requests. We can add it if it will be really needed. - if !utilfeature.DefaultFeatureGate.Enabled(features.ResilientWatchCacheInitialization) { - if getRV == 0 && !c.cacher.Ready() { - // If Cacher is not yet initialized and we don't require any specific - // minimal resource version, simply forward the request to storage. - return c.storage.Get(ctx, key, opts, objPtr) - } - if err := c.cacher.ready.wait(ctx); err != nil { - return errors.NewServiceUnavailable(err.Error()) - } - } - span.AddEvent("About to fetch object from cache") return c.cacher.Get(ctx, key, opts, objPtr) } @@ -190,23 +141,14 @@ func (c *CacheDelegator) GetList(ctx context.Context, key string, opts storage.L return c.storage.GetList(ctx, key, opts, listObj) } - listRV, err := c.cacher.versioner.ParseResourceVersion(opts.ResourceVersion) - if err != nil { + if _, err := c.cacher.versioner.ParseResourceVersion(opts.ResourceVersion); err != nil { return err } - if utilfeature.DefaultFeatureGate.Enabled(features.ResilientWatchCacheInitialization) { - if !c.cacher.Ready() && shouldDelegateListOnNotReadyCache(opts) { - // If Cacher is not initialized, delegator List requests to storage - // as described in https://kep.k8s.io/4568 - return c.storage.GetList(ctx, key, opts, listObj) - } - } else { - if listRV == 0 && !c.cacher.Ready() { - // If Cacher is not yet initialized and we don't require any specific - // minimal resource version, simply forward the request to storage. - return c.storage.GetList(ctx, key, opts, listObj) - } + if !c.cacher.Ready() && shouldDelegateListOnNotReadyCache(opts) { + // If Cacher is not initialized, delegator List requests to storage + // as described in https://kep.k8s.io/4568 + return c.storage.GetList(ctx, key, opts, listObj) } err = c.cacher.GetList(ctx, key, opts, listObj) success := "true" @@ -217,10 +159,15 @@ func (c *CacheDelegator) GetList(ctx context.Context, key string, opts storage.L } if result.ConsistentRead { // IsTooLargeResourceVersion occurs when the requested RV is higher than cache's current RV - // and cache hasn't caught up within the timeout period. Fall back to etcd. + // and cache hasn't caught up within the timeout period. if storage.IsTooLargeResourceVersion(err) { - fallback = "true" - err = c.storage.GetList(ctx, key, opts, listObj) + if utilfeature.DefaultFeatureGate.Enabled(features.ConsistentListFromCacheSkipTimeoutFallback) { + fallback = "skipped" + err = errors.NewTooManyRequests(err.Error(), resourceVersionTooHighRetrySeconds) + } else { + fallback = "true" + err = c.storage.GetList(ctx, key, opts, listObj) + } } if err != nil { success = "false" @@ -246,7 +193,7 @@ func shouldDelegateListOnNotReadyCache(opts storage.ListOptions) bool { func (c *CacheDelegator) GuaranteedUpdate(ctx context.Context, key string, destination runtime.Object, ignoreNotFound bool, preconditions *storage.Preconditions, tryUpdate storage.UpdateFunc, cachedExistingObject runtime.Object) error { // Ignore the suggestion and try to pass down the current version of the object // read from cache. - if elem, exists, err := c.cacher.watchCache.GetByKey(key); err != nil { + if elem, exists, err := c.cacher.watchCache.storage.GetByKey(key); err != nil { klog.Errorf("GetByKey returned error: %v", err) } else if exists { // DeepCopy the object since we modify resource version when serializing the @@ -286,215 +233,3 @@ func (c *CacheDelegator) Stop() { }) c.wg.Wait() } - -func newConsistencyChecker(resourcePrefix string, groupResource schema.GroupResource, newListFunc func() runtime.Object, cacher cacher, etcd getLister) *consistencyChecker { - return &consistencyChecker{ - groupResource: groupResource, - resourcePrefix: resourcePrefix, - newListFunc: newListFunc, - cacher: cacher, - etcd: etcd, - } -} - -type consistencyChecker struct { - resourcePrefix string - groupResource schema.GroupResource - newListFunc func() runtime.Object - - cacher cacher - etcd getLister -} - -type cacher interface { - getLister - Ready() bool - MarkConsistent(bool) -} - -type getLister interface { - GetList(ctx context.Context, key string, opts storage.ListOptions, listObj runtime.Object) error -} - -func (c consistencyChecker) startChecking(stopCh <-chan struct{}) { - klog.V(3).InfoS("Cache consistency check start", "group", c.groupResource.Group, "resource", c.groupResource.Resource) - jitter := 0.5 // Period between [interval, interval * (1.0 + jitter)] - sliding := true - // wait.JitterUntilWithContext starts work immediately, so wait first. - select { - case <-time.After(wait.Jitter(ConsistencyCheckPeriod, jitter)): - case <-stopCh: - } - wait.JitterUntilWithContext(wait.ContextForChannel(stopCh), c.check, ConsistencyCheckPeriod, jitter, sliding) -} - -func (c *consistencyChecker) check(ctx context.Context) { - digests, err := c.calculateDigests(ctx) - if err != nil { - klog.ErrorS(err, "Cache consistency check error", "group", c.groupResource.Group, "resource", c.groupResource.Resource) - metrics.StorageConsistencyCheckTotal.WithLabelValues(c.groupResource.Group, c.groupResource.Resource, "error").Inc() - return - } - if digests.CacheDigest == digests.EtcdDigest { - klog.V(3).InfoS("Cache consistency check passed", "group", c.groupResource.Group, "resource", c.groupResource.Resource, "resourceVersion", digests.ResourceVersion, "digest", digests.CacheDigest) - metrics.StorageConsistencyCheckTotal.WithLabelValues(c.groupResource.Group, c.groupResource.Resource, "success").Inc() - c.cacher.MarkConsistent(true) - return - } - klog.ErrorS(nil, "Cache consistency check failed", "group", c.groupResource.Group, "resource", c.groupResource.Resource, "resourceVersion", digests.ResourceVersion, "etcdDigest", digests.EtcdDigest, "cacheDigest", digests.CacheDigest, "diffDetail", digests.DiffDetail) - metrics.StorageConsistencyCheckTotal.WithLabelValues(c.groupResource.Group, c.groupResource.Resource, "failure").Inc() - if panicOnCacheInconsistency { - panic(fmt.Sprintf("Cache consistency check failed, group: %q, resource: %q, resourceVersion: %q, etcdDigest: %q, cacheDigest: %q, diffDetail: %v", c.groupResource.Group, c.groupResource.Resource, digests.ResourceVersion, digests.EtcdDigest, digests.CacheDigest, digests.DiffDetail)) - } - c.cacher.MarkConsistent(false) -} - -func (c *consistencyChecker) calculateDigests(ctx context.Context) (*storageDigest, error) { - if !c.cacher.Ready() { - return nil, fmt.Errorf("cache is not ready") - } - // variables for tracking the diff in consistency checker - cacheItems := []namespaceNameRV{} - var foundDiff *diffDetail - var etcdIndex int - - cacheDigest, cacheResourceVersion, err := c.calculateStoreDigest(ctx, c.cacher, "0", 0, func(obj metav1.Object) { - // collect items from cacher's list - cacheItems = append(cacheItems, namespaceNameRV{Namespace: obj.GetNamespace(), Name: obj.GetName(), RV: obj.GetResourceVersion()}) - }) - if err != nil { - return nil, fmt.Errorf("failed calculating cache digest: %w", err) - } - etcdDigest, etcdResourceVersion, err := c.calculateStoreDigest(ctx, c.etcd, cacheResourceVersion, storageWatchListPageSize, func(obj metav1.Object) { - // compare the item in etcd's list against cacheItems which is cacher's list - if foundDiff != nil { - return - } - etcdItem := namespaceNameRV{Namespace: obj.GetNamespace(), Name: obj.GetName(), RV: obj.GetResourceVersion()} - if len(cacheItems) <= etcdIndex { - foundDiff = &diffDetail{Index: etcdIndex, EtcdItem: &etcdItem} - cacheItems = nil // don't need it any more and nil it to allow GC to collect it - return - } - if cacheItem := cacheItems[etcdIndex]; cacheItem != etcdItem { - foundDiff = &diffDetail{Index: etcdIndex, EtcdItem: &etcdItem, CacheItem: &cacheItem} - cacheItems = nil // don't need it any more and nil it to allow GC to collect it - return - } - etcdIndex += 1 - }) - if err != nil { - return nil, fmt.Errorf("failed calculating etcd digest: %w", err) - } - if len(cacheItems) > etcdIndex { - cacheItem := cacheItems[etcdIndex] - foundDiff = &diffDetail{Index: etcdIndex, CacheItem: &cacheItem} - } - if cacheResourceVersion != etcdResourceVersion { - return nil, fmt.Errorf("etcd returned different resource version then expected, cache: %q, etcd: %q", cacheResourceVersion, etcdResourceVersion) - } - return &storageDigest{ - ResourceVersion: cacheResourceVersion, - CacheDigest: cacheDigest, - EtcdDigest: etcdDigest, - DiffDetail: foundDiff, - }, nil -} - -type namespaceNameRV struct { - Namespace string - Name string - RV string -} - -type diffDetail struct { - Index int - CacheItem *namespaceNameRV - EtcdItem *namespaceNameRV -} - -type storageDigest struct { - ResourceVersion string - CacheDigest string - EtcdDigest string - DiffDetail *diffDetail -} - -func (c *consistencyChecker) calculateStoreDigest(ctx context.Context, store getLister, resourceVersion string, limit int64, metaVisitor func(objectMeta metav1.Object)) (digest, rv string, err error) { - opts := storage.ListOptions{ - Recursive: true, - Predicate: storage.Everything, - ResourceVersion: resourceVersion, - } - opts.Predicate.Limit = limit - if resourceVersion == "0" { - opts.ResourceVersionMatch = metav1.ResourceVersionMatchNotOlderThan - } else { - opts.ResourceVersionMatch = metav1.ResourceVersionMatchExact - } - h := fnv.New64() - for { - resp := c.newListFunc() - err = store.GetList(ctx, c.resourcePrefix, opts, resp) - if err != nil { - return "", "", err - } - err = addListToDigest(h, resp, metaVisitor) - if err != nil { - return "", "", err - } - list, err := meta.ListAccessor(resp) - if err != nil { - return "", "", err - } - if resourceVersion == "0" { - resourceVersion = list.GetResourceVersion() - } - continueToken := list.GetContinue() - if continueToken == "" { - return fmt.Sprintf("%x", h.Sum64()), resourceVersion, nil - } - opts.Predicate.Continue = continueToken - opts.ResourceVersion = "" - opts.ResourceVersionMatch = "" - } -} - -func addListToDigest(h hash.Hash64, list runtime.Object, metaVisitor func(objectMeta metav1.Object)) error { - return meta.EachListItem(list, func(obj runtime.Object) error { - objectMeta, err := meta.Accessor(obj) - if err != nil { - return err - } - err = addObjectToDigest(h, objectMeta) - if err != nil { - return err - } - metaVisitor(objectMeta) - return nil - }) -} - -func addObjectToDigest(h hash.Hash64, objectMeta metav1.Object) error { - _, err := h.Write([]byte(objectMeta.GetNamespace())) - if err != nil { - return err - } - _, err = h.Write([]byte("/")) - if err != nil { - return err - } - _, err = h.Write([]byte(objectMeta.GetName())) - if err != nil { - return err - } - _, err = h.Write([]byte("/")) - if err != nil { - return err - } - _, err = h.Write([]byte(objectMeta.GetResourceVersion())) - if err != nil { - return err - } - return nil -} diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/delegator/interface.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/delegator/interface.go index 1cdf5145e4..2fefb46b9b 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/delegator/interface.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/delegator/interface.go @@ -18,10 +18,8 @@ package delegator import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apiserver/pkg/features" "k8s.io/apiserver/pkg/storage" etcdfeature "k8s.io/apiserver/pkg/storage/feature" - utilfeature "k8s.io/apiserver/pkg/util/feature" ) func ShouldDelegateListMeta(opts *metav1.ListOptions, cache Helper) (Result, error) { @@ -107,7 +105,5 @@ func (c CacheWithoutSnapshots) ShouldDelegateConsistentRead() (Result, error) { // ConsistentReadSupported returns whether cache can be used to serve reads with RV not yet observed by cache, including both consistent reads. // Function is located here to avoid import cycles between staging/src/k8s.io/apiserver/pkg/storage/cacher/delegator.go and staging/src/k8s.io/apiserver/pkg/util/flow_control/request/list_work_estimator.go. func ConsistentReadSupported() bool { - consistentListFromCacheEnabled := utilfeature.DefaultFeatureGate.Enabled(features.ConsistentListFromCache) - requestWatchProgressSupported := etcdfeature.DefaultFeatureSupportChecker.Supports(storage.RequestWatchProgress) - return consistentListFromCacheEnabled && requestWatchProgressSupported + return etcdfeature.DefaultFeatureSupportChecker.Supports(storage.RequestWatchProgress) } diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/key/key.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/key/key.go new file mode 100644 index 0000000000..1255c5a213 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/key/key.go @@ -0,0 +1,46 @@ +/* +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. +*/ + +package key + +import ( + "strings" +) + +// HasPathPrefix returns true if the string s matches pathPrefix exactly, or if s is prefixed with pathPrefix at a path segment boundary. +func HasPathPrefix(s, pathPrefix string) bool { + // Short circuit if s doesn't contain the prefix at all + if !strings.HasPrefix(s, pathPrefix) { + return false + } + + pathPrefixLength := len(pathPrefix) + + if len(s) == pathPrefixLength { + // Exact match + return true + } + if strings.HasSuffix(pathPrefix, "/") { + // pathPrefix already ensured a path segment boundary + return true + } + if s[pathPrefixLength:pathPrefixLength+1] == "/" { + // The next character in s is a path segment boundary + // Check this instead of normalizing pathPrefix to avoid allocating on every call + return true + } + return false +} diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/lister_watcher.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/lister_watcher.go index e037ed4ab8..ae3cda350b 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/lister_watcher.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/lister_watcher.go @@ -114,6 +114,7 @@ func (lw *listerWatcher) Watch(options metav1.ListOptions) (watch.Interface, err Recursive: true, ProgressNotify: true, SendInitialEvents: options.SendInitialEvents, + RecordTimestamps: true, } ctx := context.Background() if lw.contextMetadata != nil { diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/metrics/metrics.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/metrics/metrics.go index 0981d45739..7bc1339a9c 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/metrics/metrics.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/metrics/metrics.go @@ -18,9 +18,11 @@ package metrics import ( "sync" + "time" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apiserver/pkg/features" + storagemetrics "k8s.io/apiserver/pkg/storage/metrics" utilfeature "k8s.io/apiserver/pkg/util/feature" compbasemetrics "k8s.io/component-base/metrics" "k8s.io/component-base/metrics/legacyregistry" @@ -31,6 +33,37 @@ const ( subsystem = "watch_cache" ) +// DispatchStage identifies a single stage of an event's lifecycle as it moves +// through the watch cache dispatch pipeline. It is used as the "stage" label +// value on the dispatchStageDuration metric. +// +// StageTotal is the end-to-end latency of a successfully delivered event. +// The remaining stages measure individual segments of that path. +type DispatchStage int + +const ( + // StageTotal: end-to-end, etcd decode -> written to the result channel. + StageTotal DispatchStage = iota + + // StageStorageToCache: event decoded from etcd -> event received by cacher. + // Captures the delay between when an event is decoded from the storage backend + // and when it is first processed by the cacher's reflector loop. + StageStorageToCache + + // StageCacheToWatcher: watch.Event built -> written to watcher's result channel. + // Captures time spent blocked handing the event off to the client, + // i.e. downstream (result channel) backpressure. + StageCacheToWatcher + + numDispatchStages +) + +var dispatchStageName = [numDispatchStages]string{ + StageTotal: "total", + StageStorageToCache: "storage_to_cache", + StageCacheToWatcher: "cache_to_watcher", +} + /* * By default, all the following metrics are defined as falling under * ALPHA stability level https://github.com/kubernetes/enhancements/blob/master/keps/sig-instrumentation/1209-metrics-stability/kubernetes-control-plane-metrics-stability.md#stability-classes) @@ -42,28 +75,31 @@ const ( var ( listCacheCount = compbasemetrics.NewCounterVec( &compbasemetrics.CounterOpts{ - Namespace: namespace, - Name: "cache_list_total", - Help: "Number of LIST requests served from watch cache", - StabilityLevel: compbasemetrics.ALPHA, + Namespace: namespace, + Name: "cache_list_total", + Help: "Number of LIST requests served from watch cache", + StabilityLevel: compbasemetrics.ALPHA, + DeprecatedVersion: "1.37.0", }, []string{"group", "resource", "index"}, ) listCacheNumFetched = compbasemetrics.NewCounterVec( &compbasemetrics.CounterOpts{ - Namespace: namespace, - Name: "cache_list_fetched_objects_total", - Help: "Number of objects read from watch cache in the course of serving a LIST request", - StabilityLevel: compbasemetrics.ALPHA, + Namespace: namespace, + Name: "cache_list_fetched_objects_total", + Help: "Number of objects read from watch cache in the course of serving a LIST request", + StabilityLevel: compbasemetrics.ALPHA, + DeprecatedVersion: "1.37.0", }, []string{"group", "resource", "index"}, ) listCacheNumReturned = compbasemetrics.NewCounterVec( &compbasemetrics.CounterOpts{ - Namespace: namespace, - Name: "cache_list_returned_objects_total", - Help: "Number of objects returned for a LIST request from watch cache", - StabilityLevel: compbasemetrics.ALPHA, + Namespace: namespace, + Name: "cache_list_returned_objects_total", + Help: "Number of objects returned for a LIST request from watch cache", + StabilityLevel: compbasemetrics.ALPHA, + DeprecatedVersion: "1.37.0", }, []string{"group", "resource"}, ) @@ -161,6 +197,29 @@ var ( []string{"group", "resource"}, ) + WatchCacheInitializationErrors = compbasemetrics.NewCounterVec( + &compbasemetrics.CounterOpts{ + Namespace: namespace, + Subsystem: subsystem, + Name: "initialization_errors_total", + Help: "Counter of watch cache initialization errors broken by resource type.", + StabilityLevel: compbasemetrics.ALPHA, + }, + []string{"group", "resource"}, + ) + + WatchCacheInitializationDuration = compbasemetrics.NewHistogramVec( + &compbasemetrics.HistogramOpts{ + Namespace: namespace, + Subsystem: subsystem, + Name: "initialization_duration_seconds", + Help: "Histogram of watch cache initialization duration in seconds, broken by resource type.", + StabilityLevel: compbasemetrics.ALPHA, + Buckets: []float64{0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 30, 60, 180, 600}, + }, + []string{"group", "resource"}, + ) + WatchCacheReadWait = compbasemetrics.NewHistogramVec( &compbasemetrics.HistogramOpts{ Namespace: namespace, @@ -207,6 +266,16 @@ var ( }, []string{"group", "resource"}, ) + + DispatchStageDuration = compbasemetrics.NewHistogramVec( + &compbasemetrics.HistogramOpts{ + Namespace: namespace, + Subsystem: "watch_events", + Name: "dispatch_duration_seconds", + Help: "Histogram of watch event dispatch latency broken by resource type and pipeline stage. The 'total' stage is the end-to-end latency of a delivered event.", + StabilityLevel: compbasemetrics.ALPHA, + Buckets: []float64{0.0001, 0.0005, 0.001, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5}, + }, []string{"group", "resource", "stage"}) ) var registerMetrics sync.Once @@ -227,6 +296,8 @@ func Register() { legacyregistry.MustRegister(watchCacheCapacityDecreaseTotal) legacyregistry.MustRegister(WatchCacheCapacity) legacyregistry.MustRegister(WatchCacheInitializations) + legacyregistry.MustRegister(WatchCacheInitializationErrors) + legacyregistry.MustRegister(WatchCacheInitializationDuration) legacyregistry.MustRegister(WatchCacheReadWait) legacyregistry.MustRegister(ConsistentReadTotal) legacyregistry.MustRegister(StorageConsistencyCheckTotal) @@ -234,6 +305,7 @@ func Register() { legacyregistry.MustRegister(WatchShardsTotal) legacyregistry.MustRegister(WatchFilteredEventsTotal) } + legacyregistry.MustRegister(DispatchStageDuration) }) } @@ -242,6 +314,7 @@ func RecordListCacheMetrics(groupResource schema.GroupResource, indexName string listCacheCount.WithLabelValues(groupResource.Group, groupResource.Resource, indexName).Inc() listCacheNumFetched.WithLabelValues(groupResource.Group, groupResource.Resource, indexName).Add(float64(numFetched)) listCacheNumReturned.WithLabelValues(groupResource.Group, groupResource.Resource).Add(float64(numReturned)) + storagemetrics.RecordStorageListMetrics(groupResource, storagemetrics.StorageBackendWatchCache, indexName, numFetched, 0, numReturned) } // RecordResourceVersion sets the current resource version for a given resource type. @@ -275,3 +348,48 @@ func RecordsWatchCacheCapacityChange(groupResource schema.GroupResource, old, ne } watchCacheCapacityDecreaseTotal.WithLabelValues(groupResource.Group, groupResource.Resource).Inc() } + +// WatcherMetricsObservers holds pre-resolved (group, resource) observers for +// every dispatch stage, so the hot path never touches the label map. +type WatcherMetricsObservers struct { + stageDurations [numDispatchStages]compbasemetrics.ObserverMetric +} + +// NewWatcherMetricsObservers creates a pre-resolved metrics observer for watch connections. +func NewWatcherMetricsObservers(groupResource schema.GroupResource) *WatcherMetricsObservers { + o := &WatcherMetricsObservers{} + for s := range numDispatchStages { + o.stageDurations[s] = DispatchStageDuration.WithLabelValues(groupResource.Group, groupResource.Resource, dispatchStageName[s]) + } + return o +} + +// ObserveStage records the duration spent in the given dispatch stage. +func (d *WatcherMetricsObservers) ObserveStage(stage DispatchStage, duration time.Duration) { + if stage < 0 || stage >= numDispatchStages { + return + } + observe(d.stageDurations[stage], duration) +} + +func observe(m compbasemetrics.ObserverMetric, duration time.Duration) { + if duration < 0 { + duration = 0 + } + m.Observe(duration.Seconds()) +} + +type noopObserver struct{} + +func (noopObserver) Observe(float64) {} + +var noopObs noopObserver + +// NewNoopWatcherMetricsObservers returns a metrics observers struct that does nothing. +func NewNoopWatcherMetricsObservers() *WatcherMetricsObservers { + o := &WatcherMetricsObservers{} + for s := range o.stageDurations { + o.stageDurations[s] = noopObs + } + return o +} diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/store/store.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/store/store.go index 00dbc21298..242f526cc3 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/store/store.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/store/store.go @@ -22,8 +22,6 @@ import ( "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apiserver/pkg/features" - utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/client-go/tools/cache" ) @@ -70,19 +68,18 @@ type Indexer interface { GetByKey(key string) (item interface{}, exists bool, err error) Replace([]interface{}, string) error ByIndex(indexName, indexedValue string) ([]interface{}, error) + Count(prefix, continueKey string) (count int) + Clone() Snapshot + OrderedListPrefix(prefix, continueKey string) ([]interface{}, error) } -type OrderedLister interface { - ListPrefix(prefix, continueKey string) []interface{} - Count(prefix, continueKey string) (count int) - Clone() OrderedLister +type Snapshot interface { + GetByKey(key string) (item interface{}, exists bool, err error) + OrderedListPrefix(prefix, continueKey string) ([]interface{}, error) } func NewIndexer(indexers *cache.Indexers) Indexer { - if utilfeature.DefaultFeatureGate.Enabled(features.BtreeWatchCache) { - return newThreadedBtreeStoreIndexer(ElementIndexers(indexers), btreeDegree) - } - return cache.NewIndexer(ElementKey, ElementIndexers(indexers)) + return newThreadedBtreeStoreIndexer(ElementIndexers(indexers), btreeDegree) } // Computing a key of an object is generally non-trivial (it performs diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/store/store_btree.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/store/store_btree.go index 33e8e4f102..c760bf28ea 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/store/store_btree.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/store/store_btree.go @@ -43,7 +43,7 @@ type threadedStoreIndexer struct { indexer indexer } -var _ OrderedLister = (*threadedStoreIndexer)(nil) +var _ Snapshot = (*threadedStoreIndexer)(nil) func (si *threadedStoreIndexer) Count(prefix, continueKey string) (count int) { si.lock.RLock() @@ -51,9 +51,10 @@ func (si *threadedStoreIndexer) Count(prefix, continueKey string) (count int) { return si.store.Count(prefix, continueKey) } -func (si *threadedStoreIndexer) Clone() OrderedLister { - si.lock.RLock() - defer si.lock.RUnlock() +func (si *threadedStoreIndexer) Clone() Snapshot { + // Clone should not be called concurrently. + si.lock.Lock() + defer si.lock.Unlock() return si.store.Clone() } @@ -99,10 +100,10 @@ func (si *threadedStoreIndexer) List() []interface{} { return si.store.List() } -func (si *threadedStoreIndexer) ListPrefix(prefix, continueKey string) []interface{} { +func (si *threadedStoreIndexer) OrderedListPrefix(prefix, continueKey string) ([]interface{}, error) { si.lock.RLock() defer si.lock.RUnlock() - return si.store.ListPrefix(prefix, continueKey) + return si.store.OrderedListPrefix(prefix, continueKey) } func (si *threadedStoreIndexer) ListKeys() []string { @@ -151,7 +152,9 @@ type btreeStore struct { tree *btree.BTree[*Element] } -func (s *btreeStore) Clone() OrderedLister { +// Clone should not be called concurrently. +// Ref: https://github.com/kubernetes/kubernetes/blob/4a8f617f3ca/vendor/k8s.io/utils/third_party/forked/golang/btree/btree.go#L586-L588 +func (s *btreeStore) Clone() Snapshot { return &btreeStore{ tree: s.tree.Clone(), } @@ -253,7 +256,7 @@ func (s *btreeStore) getByKey(key string) (item interface{}, exists bool, err er return item, exists, nil } -func (s *btreeStore) ListPrefix(prefix, continueKey string) []interface{} { +func (s *btreeStore) OrderedListPrefix(prefix, continueKey string) ([]interface{}, error) { if continueKey == "" { continueKey = prefix } @@ -265,7 +268,7 @@ func (s *btreeStore) ListPrefix(prefix, continueKey string) []interface{} { result = append(result, item) return true }) - return result + return result, nil } func (s *btreeStore) Count(prefix, continueKey string) (count int) { @@ -439,8 +442,9 @@ var _ Snapshotter = (*storeSnapshotter)(nil) type Snapshotter interface { Reset() - GetLessOrEqual(rv uint64) (OrderedLister, bool) - Add(rv uint64, indexer OrderedLister) + GetLessOrEqual(rv uint64) (Snapshot, bool) + Latest() (Snapshot, bool) + Add(rv uint64, indexer Indexer) RemoveLess(rv uint64) Len() int } @@ -452,7 +456,7 @@ type storeSnapshotter struct { type rvSnapshot struct { resourceVersion uint64 - snapshot OrderedLister + snapshot Snapshot } func (s *storeSnapshotter) Reset() { @@ -461,7 +465,7 @@ func (s *storeSnapshotter) Reset() { s.snapshots.Clear(false) } -func (s *storeSnapshotter) GetLessOrEqual(rv uint64) (OrderedLister, bool) { +func (s *storeSnapshotter) GetLessOrEqual(rv uint64) (Snapshot, bool) { s.mux.RLock() defer s.mux.RUnlock() @@ -476,7 +480,18 @@ func (s *storeSnapshotter) GetLessOrEqual(rv uint64) (OrderedLister, bool) { return result.snapshot, true } -func (s *storeSnapshotter) Add(rv uint64, indexer OrderedLister) { +func (s *storeSnapshotter) Latest() (Snapshot, bool) { + s.mux.RLock() + defer s.mux.RUnlock() + + max, ok := s.snapshots.Max() + if !ok { + return nil, false + } + return max.snapshot, true +} + +func (s *storeSnapshotter) Add(rv uint64, indexer Indexer) { s.mux.Lock() defer s.mux.Unlock() s.snapshots.ReplaceOrInsert(rvSnapshot{resourceVersion: rv, snapshot: indexer.Clone()}) diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/store/watch_cache_storage.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/store/watch_cache_storage.go new file mode 100644 index 0000000000..30df3f0732 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/store/watch_cache_storage.go @@ -0,0 +1,292 @@ +/* +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. +*/ + +package store + +import ( + "fmt" + "sort" + "sync/atomic" + + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/apiserver/pkg/features" + "k8s.io/apiserver/pkg/storage/cacher/key" + utilfeature "k8s.io/apiserver/pkg/util/feature" + "k8s.io/client-go/tools/cache" +) + +func NewWatchCacheStorage(keyFunc func(runtime.Object) (string, error), indexers *cache.Indexers) *WatchCacheStorage { + storage := &WatchCacheStorage{ + keyFunc: keyFunc, + store: NewIndexer(indexers), + listResourceVersion: 0, + } + if utilfeature.DefaultFeatureGate.Enabled(features.ListFromCacheSnapshot) { + storage.snapshottingEnabled.Store(true) + storage.snapshots = NewSnapshotter() + } + return storage +} + +type WatchCacheStorage struct { + keyFunc func(runtime.Object) (string, error) + + // store will effectively support LIST operation from the "end of cache + // history" i.e. from the moment just after the newest cached watched event. + // It is necessary to effectively allow clients to start watching at now. + // NOTE: We assume that is thread-safe. + store Indexer + + // ResourceVersion of the last list result (populated via Replace() method). + listResourceVersion uint64 + + // Stores previous snapshots of orderedLister to allow serving requests from previous revisions. + snapshots Snapshotter + snapshottingEnabled atomic.Bool +} + +// StoreLocked returns the live store as a Snapshot. +// Unlike GetExactSnapshotLocked this is not an immutable point-in-time copy. +// The caller must hold the lock for the duration of use. +func (w *WatchCacheStorage) StoreLocked() Snapshot { + return w.store +} + +func (w *WatchCacheStorage) SnapshottingEnabled() bool { + return w.snapshots != nil && w.snapshottingEnabled.Load() +} + +func (w *WatchCacheStorage) CanServeExactRV(rv uint64) bool { + if w.snapshots == nil { + return false + } + _, canServe := w.snapshots.GetLessOrEqual(rv) + return canServe +} + +func (w *WatchCacheStorage) UpdateListResourceVersion(rv uint64) { + w.listResourceVersion = rv +} + +func (w *WatchCacheStorage) Compact(rev uint64) { + if w.snapshots == nil { + return + } + w.snapshots.RemoveLess(rev) +} + +func (w *WatchCacheStorage) MarkConsistent(consistent bool) { + if utilfeature.DefaultFeatureGate.Enabled(features.ListFromCacheSnapshot) { + w.snapshottingEnabled.Store(consistent) + if !consistent && w.snapshots != nil { + w.snapshots.Reset() + } + } +} + +func (w *WatchCacheStorage) LatestSnapshotLocked() (Snapshot, bool) { + if w.SnapshottingEnabled() { + return w.snapshots.Latest() + } + return nil, false +} + +func (w *WatchCacheStorage) GetLatestSnapshotOrBuildLocked(key, continueKey string) (Snapshot, error) { + if snap, ok := w.LatestSnapshotLocked(); ok { + // Snapshots are added in order as we update store, so the + // latest snapshot match latest store state and latest revision. + return snap, nil + } + // TODO: Consider using Indexer Clone() after benchmarking. + return orderedSnapshotResponseFromIndexer(w.store, key, continueKey) +} + +func orderedSnapshotResponseFromIndexer(indexer Indexer, key, continueKey string) (Snapshot, error) { + items, err := indexer.OrderedListPrefix(key, continueKey) + if err != nil { + return nil, err + } + return orderedListSnapshot{Items: items}, nil +} + +type orderedListSnapshot struct { + Items []interface{} +} + +var _ Snapshot = (*orderedListSnapshot)(nil) + +func (o orderedListSnapshot) GetByKey(key string) (interface{}, bool, error) { + for _, item := range o.Items { + elem, ok := item.(*Element) + if ok && elem.Key == key { + return item, true, nil + } + } + return nil, false, nil +} + +func (o orderedListSnapshot) OrderedListPrefix(prefix, continueKey string) ([]interface{}, error) { + return o.Items, nil +} + +type listSnapshot struct { + Items []interface{} +} + +var _ Snapshot = (*listSnapshot)(nil) + +func (l listSnapshot) GetByKey(key string) (interface{}, bool, error) { + for _, item := range l.Items { + elem, ok := item.(*Element) + if ok && elem.Key == key { + return item, true, nil + } + } + return nil, false, nil +} + +func (l listSnapshot) OrderedListPrefix(prefix string, continueKey string) ([]interface{}, error) { + var result []interface{} + for _, item := range l.Items { + elem, ok := item.(*Element) + if !ok { + return nil, fmt.Errorf("non *Element returned from storage: %v", item) + } + if len(continueKey) > 0 && continueKey >= elem.Key { + continue + } + if !key.HasPathPrefix(elem.Key, prefix) { + continue + } + result = append(result, item) + } + sort.Sort(sortableStoreElements(result)) + return result, nil +} + +type sortableStoreElements []interface{} + +func (s sortableStoreElements) Len() int { + return len(s) +} + +func (s sortableStoreElements) Less(i, j int) bool { + return s[i].(*Element).Key < s[j].(*Element).Key +} + +func (s sortableStoreElements) Swap(i, j int) { + s[i], s[j] = s[j], s[i] +} + +// Get takes runtime.Object as a parameter. However, it returns +// pointer to . +func (w *WatchCacheStorage) Get(obj interface{}) (interface{}, bool, error) { + object, ok := obj.(runtime.Object) + if !ok { + return nil, false, fmt.Errorf("obj does not implement runtime.Object interface: %v", obj) + } + key, err := w.keyFunc(object) + if err != nil { + return nil, false, fmt.Errorf("couldn't compute key: %w", err) + } + + return w.store.Get(&Element{Key: key, Object: object}) +} + +// GetByKey returns pointer to . +func (w *WatchCacheStorage) GetByKey(key string) (interface{}, bool, error) { + return w.store.GetByKey(key) +} + +func (w *WatchCacheStorage) ListKeys() []string { + return w.store.ListKeys() +} + +// List returns list of pointers to objects. +func (w *WatchCacheStorage) List() []interface{} { + return w.store.List() +} + +// UpdateStoreLocked executes a mutation (Add, Update, Delete) on the underlying store. +func (w *WatchCacheStorage) UpdateStoreLocked(eventType watch.EventType, elem *Element, resourceVersion uint64) (err error) { + switch eventType { + case watch.Added: + err = w.store.Add(elem) + case watch.Modified: + err = w.store.Update(elem) + case watch.Deleted: + err = w.store.Delete(elem) + default: + err = fmt.Errorf("unexpected event type: %v", eventType) + } + if err != nil { + return err + } + if w.snapshots != nil && w.snapshottingEnabled.Load() { + w.snapshots.Add(resourceVersion, w.store) + } + return nil +} + +// CompactSnapshotsLocked prunes snapshots older than the oldest history version. +func (w *WatchCacheStorage) CompactSnapshotsLocked(oldestRV uint64) { + if w.snapshots != nil && w.snapshottingEnabled.Load() { + w.snapshots.RemoveLess(oldestRV) + } +} + +// ReplaceLocked replaces the elements in the underlying store and resets snapshots. +func (w *WatchCacheStorage) ReplaceLocked(toReplace []interface{}, resourceVersion string, version uint64) error { + if err := w.store.Replace(toReplace, resourceVersion); err != nil { + return err + } + if w.snapshots != nil { + w.snapshots.Reset() + if w.snapshottingEnabled.Load() { + w.snapshots.Add(version, w.store) + } + } + w.listResourceVersion = version + return nil +} + +// GetExactSnapshotLocked retrieves a snapshot less than or equal to the given resource version. +func (w *WatchCacheStorage) GetExactSnapshotLocked(resourceVersion uint64) (Snapshot, error) { + if w.snapshots == nil { + return nil, errors.NewResourceExpired(fmt.Sprintf("too old resource version: %d", resourceVersion)) + } + snap, ok := w.snapshots.GetLessOrEqual(resourceVersion) + if !ok { + return nil, errors.NewResourceExpired(fmt.Sprintf("too old resource version: %d", resourceVersion)) + } + return snap, nil +} + +// GetByIndexSnapshot retrieves elements by index and wraps them in a Snapshot. +func (w *WatchCacheStorage) GetByIndexSnapshot(indexName, value string) (Snapshot, error) { + result, err := w.store.ByIndex(indexName, value) + if err != nil { + return nil, err + } + return listSnapshot{Items: result}, nil +} + +// ListResourceVersion returns the list resource version. +func (w *WatchCacheStorage) ListResourceVersion() uint64 { + return w.listResourceVersion +} diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/util.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/util.go index 341e256ad5..dd4fb44ad8 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/util.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/util.go @@ -18,35 +18,9 @@ package cacher import ( "math" - "strings" "time" ) -// hasPathPrefix returns true if the string matches pathPrefix exactly, or if is prefixed with pathPrefix at a path segment boundary -func hasPathPrefix(s, pathPrefix string) bool { - // Short circuit if s doesn't contain the prefix at all - if !strings.HasPrefix(s, pathPrefix) { - return false - } - - pathPrefixLength := len(pathPrefix) - - if len(s) == pathPrefixLength { - // Exact match - return true - } - if strings.HasSuffix(pathPrefix, "/") { - // pathPrefix already ensured a path segment boundary - return true - } - if s[pathPrefixLength:pathPrefixLength+1] == "/" { - // The next character in s is a path segment boundary - // Check this instead of normalizing pathPrefix to avoid allocating on every call - return true - } - return false -} - // calculateRetryAfterForUnreadyCache calculates the retry duration based on the cache downtime. func calculateRetryAfterForUnreadyCache(downtime time.Duration) int { factor := 0.06 diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache.go index fc73708a8c..30ddde3471 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache.go @@ -19,12 +19,10 @@ package cacher import ( "context" "fmt" - "math" - "sort" "sync" - "sync/atomic" "time" + "go.opentelemetry.io/otel/attribute" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" @@ -32,13 +30,11 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/watch" - "k8s.io/apiserver/pkg/features" "k8s.io/apiserver/pkg/storage" "k8s.io/apiserver/pkg/storage/cacher/delegator" "k8s.io/apiserver/pkg/storage/cacher/metrics" "k8s.io/apiserver/pkg/storage/cacher/progress" "k8s.io/apiserver/pkg/storage/cacher/store" - utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/client-go/tools/cache" "k8s.io/component-base/tracing" "k8s.io/klog/v2" @@ -55,13 +51,6 @@ const ( // resourceVersionTooHighRetrySeconds is the seconds before a operation should be retried by the client // after receiving a 'too high resource version' error. resourceVersionTooHighRetrySeconds = 1 - - // defaultLowerBoundCapacity is a default value for event cache capacity's lower bound. - // TODO: Figure out, to what value we can decreased it. - defaultLowerBoundCapacity = 100 - - // defaultUpperBoundCapacity should be able to keep the required history. - defaultUpperBoundCapacity = 100 * 1024 ) // watchCacheEvent is a single "watch event" that is send to users of @@ -79,6 +68,8 @@ type watchCacheEvent struct { Key string ResourceVersion uint64 RecordTime time.Time + // CacheReceived is the time the event was received by the cacher. + CacheReceived time.Time } // watchCache implements a Store interface. @@ -93,46 +84,25 @@ type watchCache struct { // resource version. cond *sync.Cond - // Maximum size of history window. - capacity int + // ResourceVersion up to which the watchCache is propagated. + resourceVersion uint64 + + // This handler is run at the end of every successful Replace() method. + onReplace func() - // upper bound of capacity since event cache has a dynamic size. - upperBoundCapacity int + history *watchCacheHistory + storage *store.WatchCacheStorage - // lower bound of capacity since event cache has a dynamic size. - lowerBoundCapacity int + config *ImmutableWatchCacheConfig +} +type ImmutableWatchCacheConfig struct { // keyFunc is used to get a key in the underlying storage for a given object. keyFunc func(runtime.Object) (string, error) // getAttrsFunc is used to get labels and fields of an object. getAttrsFunc func(runtime.Object) (labels.Set, fields.Set, error) - // cache is used a cyclic buffer - the "current" contents of it are - // stored in [start_index%capacity, end_index%capacity) - so the - // "current" contents have exactly end_index-start_index items. - cache []*watchCacheEvent - startIndex int - endIndex int - // removedEventSinceRelist holds the information whether any of the events - // were already removed from the `cache` cyclic buffer since the last relist - removedEventSinceRelist bool - - // store will effectively support LIST operation from the "end of cache - // history" i.e. from the moment just after the newest cached watched event. - // It is necessary to effectively allow clients to start watching at now. - // NOTE: We assume that is thread-safe. - store store.Indexer - - // ResourceVersion up to which the watchCache is propagated. - resourceVersion uint64 - - // ResourceVersion of the last list result (populated via Replace() method). - listResourceVersion uint64 - - // This handler is run at the end of every successful Replace() method. - onReplace func() - // This handler is run at the end of every Add/Update/Delete method // and additionally gets the previous value of the object. eventHandler func(*watchCacheEvent) @@ -140,9 +110,6 @@ type watchCache struct { // for testing timeouts. clock clock.Clock - // eventFreshDuration defines the minimum watch history watchcache will store. - eventFreshDuration time.Duration - // An underlying storage.Versioner. versioner storage.Versioner @@ -156,10 +123,6 @@ type watchCache struct { // to be fresh waitingUntilFresh *progress.ConditionalProgressRequester - // Stores previous snapshots of orderedLister to allow serving requests from previous revisions. - snapshots store.Snapshotter - snapshottingEnabled atomic.Bool - getCurrentRV func(context.Context) (uint64, error) } @@ -175,61 +138,29 @@ func newWatchCache( progressRequester *progress.ConditionalProgressRequester, getCurrentRV func(context.Context) (uint64, error), ) *watchCache { + config := &ImmutableWatchCacheConfig{ + keyFunc: keyFunc, + getAttrsFunc: getAttrsFunc, + eventHandler: eventHandler, + clock: clock, + versioner: versioner, + groupResource: groupResource, + waitingUntilFresh: progressRequester, + getCurrentRV: getCurrentRV, + } + wc := &watchCache{ - capacity: defaultLowerBoundCapacity, - keyFunc: keyFunc, - getAttrsFunc: getAttrsFunc, - cache: make([]*watchCacheEvent, defaultLowerBoundCapacity), - lowerBoundCapacity: defaultLowerBoundCapacity, - upperBoundCapacity: capacityUpperBound(eventFreshDuration), - startIndex: 0, - endIndex: 0, - store: store.NewIndexer(indexers), - resourceVersion: 0, - listResourceVersion: 0, - eventHandler: eventHandler, - clock: clock, - eventFreshDuration: eventFreshDuration, - versioner: versioner, - groupResource: groupResource, - waitingUntilFresh: progressRequester, - getCurrentRV: getCurrentRV, - } - if utilfeature.DefaultFeatureGate.Enabled(features.ListFromCacheSnapshot) { - wc.snapshottingEnabled.Store(true) - wc.snapshots = store.NewSnapshotter() - } - metrics.WatchCacheCapacity.WithLabelValues(groupResource.Group, groupResource.Resource).Set(float64(wc.capacity)) + resourceVersion: 0, + config: config, + history: newWatchCacheHistory(config, eventFreshDuration), + storage: store.NewWatchCacheStorage(config.keyFunc, indexers), + } wc.cond = sync.NewCond(wc.RLocker()) - wc.indexValidator = wc.isIndexValidLocked + wc.config.indexValidator = wc.history.isIndexValidLocked return wc } -// capacityUpperBound denotes the maximum possible capacity of the watch cache -// to which it can resize. -func capacityUpperBound(eventFreshDuration time.Duration) int { - if eventFreshDuration <= DefaultEventFreshDuration { - return defaultUpperBoundCapacity - } - // eventFreshDuration determines how long the watch events are supposed - // to be stored in the watch cache. - // In very high churn situations, there is a need to store more events - // in the watch cache, hence it would have to be upsized accordingly. - // Because of that, for larger values of eventFreshDuration, we set the - // upper bound of the watch cache's capacity proportionally to the ratio - // between eventFreshDuration and DefaultEventFreshDuration. - // Given that the watch cache size can only double, we round up that - // proportion to the next power of two. - exponent := int(math.Ceil((math.Log2(eventFreshDuration.Seconds() / DefaultEventFreshDuration.Seconds())))) - if maxExponent := int(math.Floor((math.Log2(math.MaxInt32 / defaultUpperBoundCapacity)))); exponent > maxExponent { - // Making sure that the capacity's upper bound fits in a 32-bit integer. - exponent = maxExponent - klog.Warningf("Capping watch cache capacity upper bound to %v", defaultUpperBoundCapacity< w.capacity { - w.doCacheResizeLocked(capacity) - } - return - } - if w.isCacheFullLocked() && eventTime.Sub(w.cache[(w.endIndex-w.capacity/4)%w.capacity].RecordTime) > w.eventFreshDuration { - capacity := max(w.capacity/2, w.lowerBoundCapacity) - if capacity < w.capacity { - w.doCacheResizeLocked(capacity) - } - return - } -} - -// isCacheFullLocked used to judge whether watchCacheEvent is full. -// Assumes that lock is already held for write. -func (w *watchCache) isCacheFullLocked() bool { - return w.endIndex == w.startIndex+w.capacity -} - -// doCacheResizeLocked resize watchCache's event array with different capacity. -// Assumes that lock is already held for write. -func (w *watchCache) doCacheResizeLocked(capacity int) { - newCache := make([]*watchCacheEvent, capacity) - if capacity < w.capacity { - // adjust startIndex if cache capacity shrink. - w.startIndex = w.endIndex - capacity - } - for i := w.startIndex; i < w.endIndex; i++ { - newCache[i%capacity] = w.cache[i%w.capacity] - } - w.cache = newCache - metrics.RecordsWatchCacheCapacityChange(w.groupResource, w.capacity, capacity) - w.capacity = capacity -} - func (w *watchCache) UpdateResourceVersion(resourceVersion string) { - rv, err := w.versioner.ParseResourceVersion(resourceVersion) + rv, err := w.config.versioner.ParseResourceVersion(resourceVersion) if err != nil { klog.Errorf("Couldn't parse resourceVersion: %v", err) return @@ -428,29 +304,29 @@ func (w *watchCache) UpdateResourceVersion(resourceVersion string) { // This is safe as long as there is at most one call to Add/Update/Delete and // UpdateResourceVersion in flight at any point in time, which is true now, // because reflector calls them synchronously from its main thread. - if w.eventHandler != nil { + if w.config.eventHandler != nil { wcEvent := &watchCacheEvent{ Type: watch.Bookmark, ResourceVersion: rv, } - w.eventHandler(wcEvent) + w.config.eventHandler(wcEvent) } - metrics.RecordResourceVersion(w.groupResource, rv) + metrics.RecordResourceVersion(w.config.groupResource, rv) } -// List returns list of pointers to objects. -func (w *watchCache) List() []interface{} { - return w.store.List() -} - -// waitUntilFreshAndBlock waits until cache is at least as fresh as given . -// NOTE: This function acquired lock and doesn't release it. -// You HAVE TO explicitly call w.RUnlock() after this function. -func (w *watchCache) waitUntilFreshAndBlock(ctx context.Context, resourceVersion uint64) error { - startTime := w.clock.Now() +// waitUntilFreshLocked waits until cache is at least as fresh as given resourceVersion. +func (w *watchCache) waitUntilFreshLocked(ctx context.Context, consistentReadSupported bool, resourceVersion uint64) error { + if resourceVersion == 0 || resourceVersion <= w.resourceVersion { + return nil + } + if consistentReadSupported { + w.config.waitingUntilFresh.Add() + defer w.config.waitingUntilFresh.Remove() + } + startTime := w.config.clock.Now() defer func() { if resourceVersion > 0 { - metrics.WatchCacheReadWait.WithContext(ctx).WithLabelValues(w.groupResource.Group, w.groupResource.Resource).Observe(w.clock.Since(startTime).Seconds()) + metrics.WatchCacheReadWait.WithContext(ctx).WithLabelValues(w.config.groupResource.Group, w.config.groupResource.Resource).Observe(w.config.clock.Since(startTime).Seconds()) } }() @@ -470,39 +346,21 @@ func (w *watchCache) waitUntilFreshAndBlock(ctx context.Context, resourceVersion // it will wake up the loop below sometime after the broadcast, // we don't need to worry about waking it up before the time // has expired accidentally. - <-w.clock.After(blockTimeout) + <-w.config.clock.After(blockTimeout) w.cond.Broadcast() }() } - w.RLock() - span := tracing.SpanFromContext(ctx) - span.AddEvent("watchCache locked acquired") for w.resourceVersion < resourceVersion { - if w.clock.Since(startTime) >= blockTimeout { + if w.config.clock.Since(startTime) >= blockTimeout { // Request that the client retry after 'resourceVersionTooHighRetrySeconds' seconds. return storage.NewTooLargeResourceVersionError(resourceVersion, w.resourceVersion, resourceVersionTooHighRetrySeconds) } w.cond.Wait() } - span.AddEvent("watchCache fresh enough") return nil } -type sortableStoreElements []interface{} - -func (s sortableStoreElements) Len() int { - return len(s) -} - -func (s sortableStoreElements) Less(i, j int) bool { - return s[i].(*store.Element).Key < s[j].(*store.Element).Key -} - -func (s sortableStoreElements) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - func (c *watchCache) WaitUntilFreshAndGetList(ctx context.Context, key string, opts storage.ListOptions) (listResp, string, error) { if opts.Recursive { return c.waitUntilFreshAndList(ctx, key, opts) @@ -515,12 +373,12 @@ func (c *watchCache) waitUntilFreshAndGetList(ctx context.Context, key string, o var err error if opts.ResourceVersionMatch == "" && opts.ResourceVersion == "" { // Consistent read - listRV, err = c.getCurrentRV(ctx) + listRV, err = c.config.getCurrentRV(ctx) if err != nil { return listResp{}, "", err } } else { - listRV, err = c.versioner.ParseResourceVersion(opts.ResourceVersion) + listRV, err = c.config.versioner.ParseResourceVersion(opts.ResourceVersion) if err != nil { return listResp{}, "", err } @@ -537,26 +395,26 @@ func (c *watchCache) waitUntilFreshAndGetList(ctx context.Context, key string, o // WaitUntilFreshAndList returns list of pointers to `storeElement` objects along // with their ResourceVersion and the name of the index, if any, that was used. -func (w *watchCache) WaitUntilFreshAndGetKeys(ctx context.Context, resourceVersion uint64) (keys []string, err error) { - if delegator.ConsistentReadSupported() && w.notFresh(resourceVersion) { - w.waitingUntilFresh.Add() - err = w.waitUntilFreshAndBlock(ctx, resourceVersion) - w.waitingUntilFresh.Remove() - } else { - err = w.waitUntilFreshAndBlock(ctx, resourceVersion) - } - +func (w *watchCache) WaitUntilFreshAndGetKeys(ctx context.Context, resourceVersion uint64) ([]string, error) { + span := tracing.SpanFromContext(ctx) + consistentReadSupported := delegator.ConsistentReadSupported() + w.RLock() + span.AddEvent("watchCache locked acquired") defer w.RUnlock() + err := w.waitUntilFreshLocked(ctx, consistentReadSupported, resourceVersion) if err != nil { return nil, err } - return w.store.ListKeys(), nil + span.AddEvent("watchCache fresh enough") + keys := w.storage.ListKeys() + span.AddEvent("ListKeys success") + return keys, nil } // NOTICE: Structure follows the shouldDelegateList function in // staging/src/k8s.io/apiserver/pkg/storage/cacher/delegator.go func (w *watchCache) waitUntilFreshAndList(ctx context.Context, key string, opts storage.ListOptions) (resp listResp, index string, err error) { - listRV, err := w.versioner.ParseResourceVersion(opts.ResourceVersion) + listRV, err := w.config.versioner.ParseResourceVersion(opts.ResourceVersion) if err != nil { return listResp{}, "", err } @@ -590,98 +448,93 @@ func (w *watchCache) waitUntilFreshAndList(ctx context.Context, key string, opts } func (w *watchCache) waitAndListExactRV(ctx context.Context, key, continueKey string, resourceVersion uint64) (resp listResp, index string, err error) { - if delegator.ConsistentReadSupported() && w.notFresh(resourceVersion) { - w.waitingUntilFresh.Add() - err = w.waitUntilFreshAndBlock(ctx, resourceVersion) - w.waitingUntilFresh.Remove() - } else { - err = w.waitUntilFreshAndBlock(ctx, resourceVersion) - } - defer w.RUnlock() + store, err := w.waitAndGetExactSnapshot(ctx, resourceVersion) if err != nil { return listResp{}, "", err } - - if w.snapshots == nil { - return listResp{}, "", errors.NewResourceExpired(fmt.Sprintf("too old resource version: %d", resourceVersion)) - } - store, ok := w.snapshots.GetLessOrEqual(resourceVersion) - if !ok { - return listResp{}, "", errors.NewResourceExpired(fmt.Sprintf("too old resource version: %d", resourceVersion)) - } - items := store.ListPrefix(key, continueKey) + items, err := store.OrderedListPrefix(key, continueKey) return listResp{ Items: items, ResourceVersion: resourceVersion, - }, "", nil + }, "", err +} + +func (w *watchCache) waitAndGetExactSnapshot(ctx context.Context, resourceVersion uint64) (store.Snapshot, error) { + span := tracing.SpanFromContext(ctx) + consistentReadSupported := delegator.ConsistentReadSupported() + w.RLock() + span.AddEvent("watchCache locked acquired") + defer w.RUnlock() + err := w.waitUntilFreshLocked(ctx, consistentReadSupported, resourceVersion) + if err != nil { + return nil, err + } + span.AddEvent("watchCache fresh enough") + + store, err := w.storage.GetExactSnapshotLocked(resourceVersion) + if err != nil { + span.AddEvent("GetExactSnapshotLocked failed", attribute.String("error", err.Error())) + return nil, err + } + span.AddEvent("GetExactSnapshotLocked success") + return store, nil } func (w *watchCache) waitAndListConsistent(ctx context.Context, key, continueKey string, matchValues []storage.MatchValue) (resp listResp, index string, err error) { - resourceVersion, err := w.getCurrentRV(ctx) + span := tracing.SpanFromContext(ctx) + resourceVersion, err := w.config.getCurrentRV(ctx) if err != nil { return listResp{}, "", err } + span.AddEvent("getCurrentRV success") return w.waitAndListLatestRV(ctx, resourceVersion, key, continueKey, matchValues) } -func (w *watchCache) waitAndListLatestRV(ctx context.Context, resourceVersion uint64, key, continueKey string, matchValues []storage.MatchValue) (resp listResp, index string, err error) { - if delegator.ConsistentReadSupported() && w.notFresh(resourceVersion) { - w.waitingUntilFresh.Add() - err = w.waitUntilFreshAndBlock(ctx, resourceVersion) - w.waitingUntilFresh.Remove() - } else { - err = w.waitUntilFreshAndBlock(ctx, resourceVersion) +func (w *watchCache) waitAndListLatestRV(ctx context.Context, minResourceVersion uint64, key, continueKey string, matchValues []storage.MatchValue) (resp listResp, index string, err error) { + snap, resourceVersion, index, err := w.waitAndGetLatestSnapshot(ctx, minResourceVersion, key, continueKey, matchValues) + if err != nil { + return listResp{}, "", err } - defer w.RUnlock() + items, err := snap.OrderedListPrefix(key, continueKey) if err != nil { return listResp{}, "", err } - return w.listLatestRV(key, continueKey, matchValues) + return listResp{ + Items: items, + ResourceVersion: resourceVersion, + }, index, nil } -func (w *watchCache) listLatestRV(key, continueKey string, matchValues []storage.MatchValue) (resp listResp, index string, err error) { +func (w *watchCache) waitAndGetLatestSnapshot(ctx context.Context, minResourceVersion uint64, key, continueKey string, matchValues []storage.MatchValue) (snap store.Snapshot, resourceVersion uint64, index string, err error) { + consistentReadSupported := delegator.ConsistentReadSupported() + span := tracing.SpanFromContext(ctx) + w.RLock() + span.AddEvent("watchCache locked acquired") + defer w.RUnlock() + err = w.waitUntilFreshLocked(ctx, consistentReadSupported, minResourceVersion) + if err != nil { + return nil, 0, "", err + } + span.AddEvent("watchCache fresh enough") // This isn't the place where we do "final filtering" - only some "prefiltering" is happening here. So the only // requirement here is to NOT miss anything that should be returned. We can return as many non-matching items as we // want - they will be filtered out later. The fact that we return less things is only further performance improvement. // TODO: if multiple indexes match, return the one with the fewest items, so as to do as much filtering as possible. for _, matchValue := range matchValues { - if result, err := w.store.ByIndex(matchValue.IndexName, matchValue.Value); err == nil { - result, err = filterPrefixAndOrder(key, result) - return listResp{ - Items: result, - ResourceVersion: w.resourceVersion, - }, matchValue.IndexName, err + snap, err := w.storage.GetByIndexSnapshot(matchValue.IndexName, matchValue.Value) + if err == nil { + span.AddEvent("GetByIndexSnapshot success", attribute.String("index", matchValue.IndexName)) + return snap, w.resourceVersion, matchValue.IndexName, nil } + span.AddEvent("GetByIndexSnapshot fail", attribute.String("index", matchValue.IndexName), attribute.String("error", err.Error())) } - if store, ok := w.store.(store.OrderedLister); ok { - result := store.ListPrefix(key, continueKey) - return listResp{ - Items: result, - ResourceVersion: w.resourceVersion, - }, "", nil - } - result := w.store.List() - result, err = filterPrefixAndOrder(key, result) - return listResp{ - Items: result, - ResourceVersion: w.resourceVersion, - }, "", err -} - -func filterPrefixAndOrder(prefix string, items []interface{}) ([]interface{}, error) { - var result []interface{} - for _, item := range items { - elem, ok := item.(*store.Element) - if !ok { - return nil, fmt.Errorf("non *store.Element returned from storage: %v", item) - } - if !hasPathPrefix(elem.Key, prefix) { - continue - } - result = append(result, item) + snap, err = w.storage.GetLatestSnapshotOrBuildLocked(key, continueKey) + if err != nil { + span.AddEvent("GetLatestSnapshotOrBuildLocked failed", attribute.String("error", err.Error())) + return nil, 0, "", err } - sort.Sort(sortableStoreElements(result)) - return result, nil + span.AddEvent("GetLatestSnapshotOrBuildLocked success") + return snap, w.resourceVersion, "", nil } func (w *watchCache) notFresh(resourceVersion uint64) bool { @@ -692,49 +545,28 @@ func (w *watchCache) notFresh(resourceVersion uint64) bool { // WaitUntilFreshAndGet returns a pointers to object. func (w *watchCache) WaitUntilFreshAndGet(ctx context.Context, resourceVersion uint64, key string) (interface{}, bool, uint64, error) { - var err error - if delegator.ConsistentReadSupported() && w.notFresh(resourceVersion) { - w.waitingUntilFresh.Add() - err = w.waitUntilFreshAndBlock(ctx, resourceVersion) - w.waitingUntilFresh.Remove() - } else { - err = w.waitUntilFreshAndBlock(ctx, resourceVersion) - } + span := tracing.SpanFromContext(ctx) + consistentReadSupported := delegator.ConsistentReadSupported() + w.RLock() + span.AddEvent("watchCache locked acquired") defer w.RUnlock() + err := w.waitUntilFreshLocked(ctx, consistentReadSupported, resourceVersion) if err != nil { return nil, false, 0, err } - value, exists, err := w.store.GetByKey(key) - return value, exists, w.resourceVersion, err -} - -func (w *watchCache) ListKeys() []string { - return w.store.ListKeys() -} - -// Get takes runtime.Object as a parameter. However, it returns -// pointer to . -func (w *watchCache) Get(obj interface{}) (interface{}, bool, error) { - object, ok := obj.(runtime.Object) - if !ok { - return nil, false, fmt.Errorf("obj does not implement runtime.Object interface: %v", obj) - } - key, err := w.keyFunc(object) + span.AddEvent("watchCache fresh enough") + value, exists, err := w.storage.GetByKey(key) if err != nil { - return nil, false, fmt.Errorf("couldn't compute key: %v", err) + span.AddEvent("GetByKey failed", attribute.String("error", err.Error())) + return nil, false, 0, err } - - return w.store.Get(&store.Element{Key: key, Object: object}) -} - -// GetByKey returns pointer to . -func (w *watchCache) GetByKey(key string) (interface{}, bool, error) { - return w.store.GetByKey(key) + span.AddEvent("GetByKey success") + return value, exists, w.resourceVersion, err } // Replace takes slice of runtime.Object as a parameter. func (w *watchCache) Replace(objs []interface{}, resourceVersion string) error { - version, err := w.versioner.ParseResourceVersion(resourceVersion) + version, err := w.config.versioner.ParseResourceVersion(resourceVersion) if err != nil { return err } @@ -745,11 +577,11 @@ func (w *watchCache) Replace(objs []interface{}, resourceVersion string) error { if !ok { return fmt.Errorf("didn't get runtime.Object for replace: %#v", obj) } - key, err := w.keyFunc(object) + key, err := w.config.keyFunc(object) if err != nil { return fmt.Errorf("couldn't compute key: %v", err) } - objLabels, objFields, err := w.getAttrsFunc(object) + objLabels, objFields, err := w.config.getAttrsFunc(object) if err != nil { return err } @@ -770,26 +602,18 @@ func (w *watchCache) Replace(objs []interface{}, resourceVersion string) error { // content. // Empty the cyclic buffer, ensuring startIndex doesn't decrease. - w.startIndex = w.endIndex - w.removedEventSinceRelist = false + w.history.ResetLocked() - if err := w.store.Replace(toReplace, resourceVersion); err != nil { + if err := w.storage.ReplaceLocked(toReplace, resourceVersion, version); err != nil { return err } - if w.snapshots != nil { - w.snapshots.Reset() - if orderedLister, ordered := w.store.(store.OrderedLister); ordered && w.snapshottingEnabled.Load() { - w.snapshots.Add(version, orderedLister) - } - } - w.listResourceVersion = version w.resourceVersion = version if w.onReplace != nil { w.onReplace() } w.cond.Broadcast() - metrics.RecordResourceVersion(w.groupResource, version) + metrics.RecordResourceVersion(w.config.groupResource, version) klog.V(3).Infof("Replaced watchCache (rev: %v) ", resourceVersion) return nil } @@ -808,66 +632,13 @@ func (w *watchCache) Resync() error { func (w *watchCache) getListResourceVersion() uint64 { w.RLock() defer w.RUnlock() - return w.listResourceVersion + return w.storage.ListResourceVersion() } -func (w *watchCache) currentCapacity() int { +func (w *watchCache) suggestedWatchChannelSize(indexExists, triggerUsed bool) int { w.RLock() defer w.RUnlock() - return w.capacity -} - -const ( - // minWatchChanSize is the min size of channels used by the watch. - // We keep that set to 10 for "backward compatibility" until we - // convince ourselves based on some metrics that decreasing is safe. - minWatchChanSize = 10 - // maxWatchChanSizeWithIndexAndTriger is the max size of the channel - // used by the watch using the index and trigger selector. - maxWatchChanSizeWithIndexAndTrigger = 10 - // maxWatchChanSizeWithIndexWithoutTrigger is the max size of the channel - // used by the watch using the index but without triggering selector. - // We keep that set to 1000 for "backward compatibility", until we - // convinced ourselves based on some metrics that decreasing is safe. - maxWatchChanSizeWithIndexWithoutTrigger = 1000 - // maxWatchChanSizeWithoutIndex is the max size of the channel - // used by the watch not using the index. - // TODO(wojtek-t): Figure out if the value shouldn't be higher. - maxWatchChanSizeWithoutIndex = 100 -) - -func (w *watchCache) suggestedWatchChannelSize(indexExists, triggerUsed bool) int { - // To estimate the channel size we use a heuristic that a channel - // should roughly be able to keep one second of history. - // We don't have an exact data, but given we store updates from - // the last , we approach it by dividing the - // capacity by the length of the history window. - chanSize := int(math.Ceil(float64(w.currentCapacity()) / w.eventFreshDuration.Seconds())) - - // Finally we adjust the size to avoid ending with too low or - // to large values. - if chanSize < minWatchChanSize { - chanSize = minWatchChanSize - } - var maxChanSize int - switch { - case indexExists && triggerUsed: - maxChanSize = maxWatchChanSizeWithIndexAndTrigger - case indexExists && !triggerUsed: - maxChanSize = maxWatchChanSizeWithIndexWithoutTrigger - case !indexExists: - maxChanSize = maxWatchChanSizeWithoutIndex - } - if chanSize > maxChanSize { - chanSize = maxChanSize - } - return chanSize -} - -// isIndexValidLocked checks if a given index is still valid. -// This assumes that the lock is held. -func (w *watchCache) isIndexValidLocked(index int) bool { - return index >= w.startIndex + return w.history.suggestedWatchChannelSize(indexExists, triggerUsed) } // getAllEventsSinceLocked returns a watchCacheInterval that can be used to @@ -880,24 +651,6 @@ func (w *watchCache) getAllEventsSinceLocked(resourceVersion uint64, key string, return w.getIntervalFromStoreLocked(key, matchesSingle) } - size := w.endIndex - w.startIndex - var oldest uint64 - switch { - case w.listResourceVersion > 0 && !w.removedEventSinceRelist: - // If no event was removed from the buffer since last relist, the oldest watch - // event we can deliver is one greater than the resource version of the list. - oldest = w.listResourceVersion + 1 - case size > 0: - // If the previous condition is not satisfied: either some event was already - // removed from the buffer or we've never completed a list (the latter can - // only happen in unit tests that populate the buffer without performing - // list/replace operations), the oldest watch event we can deliver is the first - // one in the buffer. - oldest = w.cache[w.startIndex%w.capacity].ResourceVersion - default: - return nil, fmt.Errorf("watch cache isn't correctly initialized") - } - if resourceVersion == 0 { if opts.SendInitialEvents == nil { // resourceVersion = 0 means that we don't require any specific starting point @@ -913,45 +666,20 @@ func (w *watchCache) getAllEventsSinceLocked(resourceVersion uint64, key string, // from Any resourceVersion resourceVersion = w.resourceVersion } - if resourceVersion < oldest-1 { - return nil, errors.NewResourceExpired(fmt.Sprintf("too old resource version: %d (%d)", resourceVersion, oldest-1)) - } - // Binary search the smallest index at which resourceVersion is greater than the given one. - f := func(i int) bool { - return w.cache[(w.startIndex+i)%w.capacity].ResourceVersion > resourceVersion - } - first := sort.Search(size, f) - indexerFunc := func(i int) *watchCacheEvent { - return w.cache[i%w.capacity] - } - ci := newCacheInterval(w.startIndex+first, w.endIndex, indexerFunc, w.indexValidator, resourceVersion, w.RWMutex.RLocker()) - return ci, nil + return w.history.GetIntervalLocked(resourceVersion, w.storage.ListResourceVersion(), w.RWMutex.RLocker()) } // getIntervalFromStoreLocked returns a watchCacheInterval // that covers the entire storage state. // This function assumes to be called under the watchCache lock. func (w *watchCache) getIntervalFromStoreLocked(key string, matchesSingle bool) (*watchCacheInterval, error) { - ci, err := newCacheIntervalFromStore(w.resourceVersion, w.store, key, matchesSingle) - if err != nil { - return nil, err - } - return ci, nil -} - -func (w *watchCache) Compact(rev uint64) { - if w.snapshots == nil { - return - } - w.snapshots.RemoveLess(rev) -} - -func (w *watchCache) MarkConsistent(consistent bool) { - if utilfeature.DefaultFeatureGate.Enabled(features.ListFromCacheSnapshot) { - w.snapshottingEnabled.Store(consistent) - if !consistent && w.snapshots != nil { - w.snapshots.Reset() + // When not matching a single key, an immutable snapshot lets us + // defer the O(N) interval build off the watchCache lock. + if !matchesSingle { + if snapshot, ok := w.storage.LatestSnapshotLocked(); ok { + return newCacheIntervalFromLazySnapshot(w.resourceVersion, snapshot), nil } } + return newCacheIntervalFromStore(w.resourceVersion, w.storage.StoreLocked(), key, matchesSingle) } diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache_history.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache_history.go new file mode 100644 index 0000000000..55481fe2b7 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache_history.go @@ -0,0 +1,260 @@ +/* +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. +*/ + +package cacher + +import ( + "fmt" + "math" + "sort" + "sync" + "time" + + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apiserver/pkg/storage/cacher/metrics" + "k8s.io/klog/v2" +) + +const ( + // defaultLowerBoundCapacity is a default value for event cache capacity's lower bound. + // TODO: Figure out, to what value we can decreased it. + defaultLowerBoundCapacity = 100 + + // defaultUpperBoundCapacity should be able to keep the required history. + defaultUpperBoundCapacity = 100 * 1024 +) + +func newWatchCacheHistory(config *ImmutableWatchCacheConfig, eventFreshDuration time.Duration) *watchCacheHistory { + h := &watchCacheHistory{ + config: config, + capacity: defaultLowerBoundCapacity, + cache: make([]*watchCacheEvent, defaultLowerBoundCapacity), + lowerBoundCapacity: defaultLowerBoundCapacity, + upperBoundCapacity: capacityUpperBound(eventFreshDuration), + startIndex: 0, + endIndex: 0, + eventFreshDuration: eventFreshDuration, + } + metrics.WatchCacheCapacity.WithLabelValues(config.groupResource.Group, config.groupResource.Resource).Set(float64(h.capacity)) + return h +} + +// capacityUpperBound denotes the maximum possible capacity of the watch cache +// to which it can resize. +func capacityUpperBound(eventFreshDuration time.Duration) int { + if eventFreshDuration <= DefaultEventFreshDuration { + return defaultUpperBoundCapacity + } + // eventFreshDuration determines how long the watch events are supposed + // to be stored in the watch cache. + // In very high churn situations, there is a need to store more events + // in the watch cache, hence it would have to be upsized accordingly. + // Because of that, for larger values of eventFreshDuration, we set the + // upper bound of the watch cache's capacity proportionally to the ratio + // between eventFreshDuration and DefaultEventFreshDuration. + // Given that the watch cache size can only double, we round up that + // proportion to the next power of two. + exponent := int(math.Ceil((math.Log2(eventFreshDuration.Seconds() / DefaultEventFreshDuration.Seconds())))) + if maxExponent := int(math.Floor((math.Log2(math.MaxInt32 / defaultUpperBoundCapacity)))); exponent > maxExponent { + // Making sure that the capacity's upper bound fits in a 32-bit integer. + exponent = maxExponent + klog.Warningf("Capping watch cache capacity upper bound to %v", defaultUpperBoundCapacity< w.capacity { + w.doCacheResizeLocked(capacity) + } + return + } + if w.isCacheFullLocked() && eventTime.Sub(w.cache[(w.endIndex-w.capacity/4)%w.capacity].RecordTime) > w.eventFreshDuration { + capacity := max(w.capacity/2, w.lowerBoundCapacity) + if capacity < w.capacity { + w.doCacheResizeLocked(capacity) + } + return + } +} + +// isCacheFullLocked used to judge whether watchCacheEvent is full. +// Assumes that lock is already held for write. +func (w *watchCacheHistory) isCacheFullLocked() bool { + return w.endIndex == w.startIndex+w.capacity +} + +// doCacheResizeLocked resize watchCache's event array with different capacity. +// Assumes that lock is already held for write. +func (w *watchCacheHistory) doCacheResizeLocked(capacity int) { + newCache := make([]*watchCacheEvent, capacity) + if capacity < w.capacity { + // adjust startIndex if cache capacity shrink. + w.startIndex = w.endIndex - capacity + } + for i := w.startIndex; i < w.endIndex; i++ { + newCache[i%capacity] = w.cache[i%w.capacity] + } + w.cache = newCache + metrics.RecordsWatchCacheCapacityChange(w.config.groupResource, w.capacity, capacity) + w.capacity = capacity +} + +// isIndexValidLocked checks if a given index is still valid. +// This assumes that the lock is held. +func (w *watchCacheHistory) isIndexValidLocked(index int) bool { + return index >= w.startIndex +} + +// ResetLocked empties the cyclic buffer, ensuring startIndex doesn't decrease. +// Assumes that lock is already held for write. +func (w *watchCacheHistory) ResetLocked() { + w.startIndex = w.endIndex + w.removedEventSinceRelist = false + clear(w.cache) +} + +const ( + // minWatchChanSize is the min size of channels used by the watch. + // We keep that set to 10 for "backward compatibility" until we + // convince ourselves based on some metrics that decreasing is safe. + minWatchChanSize = 10 + // maxWatchChanSizeWithIndexAndTrigger is the max size of the channel + // used by the watch using the index and trigger selector. + maxWatchChanSizeWithIndexAndTrigger = 10 + // maxWatchChanSizeWithIndexWithoutTrigger is the max size of the channel + // used by the watch using the index but without triggering selector. + // We keep that set to 1000 for "backward compatibility", until we + // convinced ourselves based on some metrics that decreasing is safe. + maxWatchChanSizeWithIndexWithoutTrigger = 1000 + // maxWatchChanSizeWithoutIndex is the max size of the channel + // used by the watch not using the index. + maxWatchChanSizeWithoutIndex = 100 +) + +func (w *watchCacheHistory) suggestedWatchChannelSize(indexExists, triggerUsed bool) int { + // To estimate the channel size we use a heuristic that a channel + // should roughly be able to keep one second of history. + // We don't have an exact data, but given we store updates from + // the last , we approach it by dividing the + // capacity by the length of the history window. + chanSize := int(math.Ceil(float64(w.capacity) / w.eventFreshDuration.Seconds())) + + // Finally we adjust the size to avoid ending with too low or + // to large values. + chanSize = max(chanSize, minWatchChanSize) + var maxChanSize int + switch { + case indexExists && triggerUsed: + maxChanSize = maxWatchChanSizeWithIndexAndTrigger + case indexExists && !triggerUsed: + maxChanSize = maxWatchChanSizeWithIndexWithoutTrigger + case !indexExists: + maxChanSize = maxWatchChanSizeWithoutIndex + } + return min(chanSize, maxChanSize) +} + +// GetIntervalLocked returns a watchCacheInterval that can be used to +// retrieve events since a certain resourceVersion. This function assumes to +// be called under the lock. +func (w *watchCacheHistory) GetIntervalLocked(resourceVersion uint64, listResourceVersion uint64, locker sync.Locker) (*watchCacheInterval, error) { + size := w.endIndex - w.startIndex + var oldest uint64 + switch { + case listResourceVersion > 0 && !w.removedEventSinceRelist: + // If no event was removed from the buffer since last relist, the oldest watch + // event we can deliver is one greater than the resource version of the list. + oldest = listResourceVersion + 1 + case size > 0: + // If the previous condition is not satisfied: either some event was already + // removed from the buffer or we've never completed a list (the latter can + // only happen in unit tests that populate the buffer without performing + // list/replace operations), the oldest watch event we can deliver is the first + // one in the buffer. + oldest = w.cache[w.startIndex%w.capacity].ResourceVersion + default: + return nil, fmt.Errorf("watch cache isn't correctly initialized") + } + + if resourceVersion < oldest-1 { + return nil, errors.NewResourceExpired(fmt.Sprintf("too old resource version: %d (%d)", resourceVersion, oldest-1)) + } + + // Binary search the smallest index at which resourceVersion is greater than the given one. + f := func(i int) bool { + return w.cache[(w.startIndex+i)%w.capacity].ResourceVersion > resourceVersion + } + first := sort.Search(size, f) + indexerFunc := func(i int) *watchCacheEvent { + return w.cache[i%w.capacity] + } + ci := newCacheInterval(w.startIndex+first, w.endIndex, indexerFunc, w.config.indexValidator, resourceVersion, locker) + return ci, nil +} + +// OldestResourceVersionLocked returns the resource version of the oldest event in the cyclic buffer. +func (w *watchCacheHistory) OldestResourceVersionLocked() uint64 { + return w.cache[w.startIndex%w.capacity].ResourceVersion +} + +// Capacity returns the current capacity of the event history cache. +func (w *watchCacheHistory) Capacity() int { + return w.capacity +} diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache_interval.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache_interval.go index 8cdcac370f..9e70b18194 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache_interval.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache_interval.go @@ -18,139 +18,77 @@ package cacher import ( "fmt" - "sort" "sync" "k8s.io/apimachinery/pkg/watch" "k8s.io/apiserver/pkg/storage/cacher/store" ) +// cacheIntervalSource provides the iteration logic for a watchCacheInterval. +type cacheIntervalSource interface { + Next() (*watchCacheEvent, error) +} + // watchCacheInterval serves as an abstraction over a source -// of watchCacheEvents. It maintains a window of events over -// an underlying source and these events can be served using -// the exposed Next() API. The main intent for doing things -// this way is to introduce an upper bound of memory usage -// for starting a watch and reduce the maximum possible time -// interval for which the lock would be held while events are -// copied over. -// -// The source of events for the interval is typically either -// the watchCache circular buffer, if events being retrieved -// need to be for resource versions > 0 or the underlying -// implementation of Store, if resource version = 0. -// -// Furthermore, an interval can be either valid or invalid at -// any given point of time. The notion of validity makes sense -// only in cases where the window of events in the underlying -// source can change over time - i.e. for watchCache circular -// buffer. When the circular buffer is full and an event needs -// to be popped off, watchCache::startIndex is incremented. In -// this case, an interval tracking that popped event is valid -// only if it has already been copied to its internal buffer. -// However, for efficiency we perform that lazily and we mark -// an interval as invalid iff we need to copy events from the -// watchCache and we end up needing events that have already -// been popped off. This translates to the following condition: -// -// watchCacheInterval::startIndex >= watchCache::startIndex. -// -// When this condition becomes false, the interval is no longer -// valid and should not be used to retrieve and serve elements -// from the underlying source. +// of watchCacheEvents. It delegates iteration to a cacheIntervalSource +// and holds common metadata (resourceVersion, initialEventsEndBookmark). type watchCacheInterval struct { - // startIndex denotes the starting point of the interval - // being considered. The value is the index in the actual - // source of watchCacheEvents. If the source of events is - // the watchCache, then this must be used modulo capacity. - startIndex int - - // endIndex denotes the ending point of the interval being - // considered. The value is the index in the actual source - // of events. If the source of the events is the watchCache, - // then this should be used modulo capacity. - endIndex int - - // indexer is meant to inject behaviour for how an event must - // be retrieved from the underlying source given an index. - indexer indexerFunc - - // indexValidator is used to check if a given index is still - // valid perspective. If it is deemed that the index is not - // valid, then this interval can no longer be used to serve - // events. Use of indexValidator is warranted only in cases - // where the window of events in the underlying source can - // change over time. Furthermore, an interval is invalid if - // its startIndex no longer coincides with the startIndex of - // underlying source. - indexValidator indexValidator - - // buffer holds watchCacheEvents that this interval returns on - // a call to Next(). This exists mainly to reduce acquiring the - // lock on each invocation of Next(). - buffer *watchCacheIntervalBuffer + // source provides the iteration logic for this interval. + source cacheIntervalSource // resourceVersion is the resourceVersion from which // the interval was constructed. resourceVersion uint64 - // lock effectively protects access to the underlying source - // of events through - indexer and indexValidator. - // - // Given that indexer and indexValidator only read state, if - // possible, Locker obtained through RLocker() is provided. - lock sync.Locker - // initialEventsEndBookmark will be sent after sending all events in cacheInterval initialEventsEndBookmark *watchCacheEvent } +// Next returns the next item in the cache interval provided the cache +// interval is still valid. An error is returned if the interval is +// invalidated. +func (wci *watchCacheInterval) Next() (*watchCacheEvent, error) { + return wci.source.Next() +} + type indexerFunc func(int) *watchCacheEvent type indexValidator func(int) bool func newCacheInterval(startIndex, endIndex int, indexer indexerFunc, indexValidator indexValidator, resourceVersion uint64, locker sync.Locker) *watchCacheInterval { return &watchCacheInterval{ - startIndex: startIndex, - endIndex: endIndex, - indexer: indexer, - indexValidator: indexValidator, - buffer: &watchCacheIntervalBuffer{buffer: make([]*watchCacheEvent, bufferSize)}, + source: &historyCacheIntervalSource{ + startIndex: startIndex, + endIndex: endIndex, + indexer: indexer, + indexValidator: indexValidator, + buffer: &watchCacheIntervalBuffer{buffer: make([]*watchCacheEvent, bufferSize)}, + lock: locker, + }, resourceVersion: resourceVersion, - lock: locker, } } -type sortableWatchCacheEvents []*watchCacheEvent - -func (s sortableWatchCacheEvents) Len() int { - return len(s) -} - -func (s sortableWatchCacheEvents) Less(i, j int) bool { - return s[i].Key < s[j].Key -} - -func (s sortableWatchCacheEvents) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - // newCacheIntervalFromStore is meant to handle the case of rv=0, such that the events // returned by Next() need to be events from a List() done on the underlying store of // the watch cache. // The items returned in the interval will be sorted by Key. -func newCacheIntervalFromStore(resourceVersion uint64, indexer store.Indexer, key string, matchesSingle bool) (*watchCacheInterval, error) { +func newCacheIntervalFromStore(resourceVersion uint64, snap store.Snapshot, key string, matchesSingle bool) (*watchCacheInterval, error) { buffer := &watchCacheIntervalBuffer{} var allItems []interface{} + var err error if matchesSingle { - item, exists, err := indexer.GetByKey(key) + item, exists, err := snap.GetByKey(key) if err != nil { return nil, err } - if exists { allItems = append(allItems, item) } } else { - allItems = indexer.List() + allItems, err = snap.OrderedListPrefix("", "") + if err != nil { + return nil, err + } } buffer.buffer = make([]*watchCacheEvent, len(allItems)) for i, item := range allItems { @@ -158,74 +96,209 @@ func newCacheIntervalFromStore(resourceVersion uint64, indexer store.Indexer, ke if !ok { return nil, fmt.Errorf("not a storeElement: %v", elem) } - buffer.buffer[i] = &watchCacheEvent{ - Type: watch.Added, - Object: elem.Object, - ObjLabels: elem.Labels, - ObjFields: elem.Fields, - Key: elem.Key, - ResourceVersion: resourceVersion, - } + buffer.buffer[i] = storeElementToWatchCacheEvent(elem, resourceVersion) buffer.endIndex++ } - sort.Sort(sortableWatchCacheEvents(buffer.buffer)) ci := &watchCacheInterval{ - startIndex: 0, - // Simulate that we already have all the events we're looking for. - endIndex: 0, - buffer: buffer, + source: &snapshotCacheIntervalSource{buffer: buffer}, resourceVersion: resourceVersion, } return ci, nil } -// Next returns the next item in the cache interval provided the cache -// interval is still valid. An error is returned if the interval is -// invalidated. -func (wci *watchCacheInterval) Next() (*watchCacheEvent, error) { +// newCacheIntervalFromLazySnapshot builds an interval backed by an immutable store snapshot +// Unlike newCacheIntervalFromStore, it captures snapshot reference which takes O(1) under watch-cache RLock +// and defers O(N) traversal to first Next() call post lock release +func newCacheIntervalFromLazySnapshot(resourceVersion uint64, snap store.Snapshot) *watchCacheInterval { + return &watchCacheInterval{ + source: &lazySnapshotCacheIntervalSource{ + snapshot: snap, + resourceVersion: resourceVersion, + }, + resourceVersion: resourceVersion, + } +} + +func storeElementToWatchCacheEvent(elem *store.Element, resourceVersion uint64) *watchCacheEvent { + return &watchCacheEvent{ + Type: watch.Added, + Object: elem.Object, + ObjLabels: elem.Labels, + ObjFields: elem.Fields, + Key: elem.Key, + ResourceVersion: resourceVersion, + } +} + +// historyCacheIntervalSource serves events from the watchCache circular buffer. +// It maintains a window of events over the underlying source and copies them +// in batches into an internal buffer to reduce lock acquisition frequency. +// +// An interval can be either valid or invalid at any given point of time. +// When the circular buffer is full and an event needs to be popped off, +// watchCache::startIndex is incremented. In this case, an interval tracking +// that popped event is valid only if it has already been copied to its +// internal buffer. However, for efficiency we perform that lazily and we +// mark an interval as invalid iff we need to copy events from the watchCache +// and we end up needing events that have already been popped off. This +// translates to the following condition: +// +// historyCacheIntervalSource::startIndex >= watchCache::startIndex. +// +// When this condition becomes false, the interval is no longer valid and +// should not be used to retrieve and serve elements from the underlying +// source. +type historyCacheIntervalSource struct { + // startIndex denotes the starting point of the interval + // being considered. The value is the index in the actual + // source of watchCacheEvents. If the source of events is + // the watchCache, then this must be used modulo capacity. + startIndex int + + // endIndex denotes the ending point of the interval being + // considered. The value is the index in the actual source + // of events. If the source of the events is the watchCache, + // then this should be used modulo capacity. + endIndex int + + // indexer is meant to inject behaviour for how an event must + // be retrieved from the underlying source given an index. + indexer indexerFunc + + // indexValidator is used to check if a given index is still + // valid perspective. If it is deemed that the index is not + // valid, then this interval can no longer be used to serve + // events. Use of indexValidator is warranted only in cases + // where the window of events in the underlying source can + // change over time. Furthermore, an interval is invalid if + // its startIndex no longer coincides with the startIndex of + // underlying source. + indexValidator indexValidator + + // buffer holds watchCacheEvents that this interval returns on + // a call to Next(). This exists mainly to reduce acquiring the + // lock on each invocation of Next(). + buffer *watchCacheIntervalBuffer + + // lock effectively protects access to the underlying source + // of events through - indexer and indexValidator. + // + // Given that indexer and indexValidator only read state, if + // possible, Locker obtained through RLocker() is provided. + lock sync.Locker +} + +// Next returns the next event from the watchCache circular buffer. +// An error is returned if the interval has been invalidated. +// +// An interval can be either valid or invalid at any given point of time. +// When the circular buffer is full and an event needs to be popped off, +// watchCache::startIndex is incremented. In this case, an interval tracking +// that popped event is valid only if it has already been copied to its +// internal buffer. However, for efficiency we perform that lazily and we +// mark an interval as invalid iff we need to copy events from the watchCache +// and we end up needing events that have already been popped off. This +// translates to the following condition: +// +// historyCacheIntervalSource::startIndex >= watchCache::startIndex. +// +// When this condition becomes false, the interval is no longer valid and +// should not be used to retrieve and serve elements from the underlying +// source. +func (s *historyCacheIntervalSource) Next() (*watchCacheEvent, error) { // if there are items in the buffer to return, return from // the buffer. - if event, exists := wci.buffer.next(); exists { + if event, exists := s.buffer.next(); exists { return event, nil } // check if there are still other events in this interval // that can be processed. - if wci.startIndex >= wci.endIndex { + if s.startIndex >= s.endIndex { return nil, nil } - wci.lock.Lock() - defer wci.lock.Unlock() + s.lock.Lock() + defer s.lock.Unlock() - if valid := wci.indexValidator(wci.startIndex); !valid { - return nil, fmt.Errorf("cache interval invalidated, interval startIndex: %d", wci.startIndex) + if valid := s.indexValidator(s.startIndex); !valid { + return nil, fmt.Errorf("cache interval invalidated, interval startIndex: %d", s.startIndex) } - wci.fillBuffer() - if event, exists := wci.buffer.next(); exists { + s.fillBuffer() + if event, exists := s.buffer.next(); exists { return event, nil } return nil, nil } -func (wci *watchCacheInterval) fillBuffer() { - wci.buffer.startIndex = 0 - wci.buffer.endIndex = 0 - for wci.startIndex < wci.endIndex && !wci.buffer.isFull() { - event := wci.indexer(wci.startIndex) +func (s *historyCacheIntervalSource) fillBuffer() { + s.buffer.startIndex = 0 + s.buffer.endIndex = 0 + for s.startIndex < s.endIndex && !s.buffer.isFull() { + event := s.indexer(s.startIndex) if event == nil { break } - wci.buffer.buffer[wci.buffer.endIndex] = event - wci.buffer.endIndex++ - wci.startIndex++ + s.buffer.buffer[s.buffer.endIndex] = event + s.buffer.endIndex++ + s.startIndex++ + } +} + +// snapshotCacheIntervalSource serves events from a pre-populated buffer. +type snapshotCacheIntervalSource struct { + buffer *watchCacheIntervalBuffer +} + +func (s *snapshotCacheIntervalSource) Next() (*watchCacheEvent, error) { + event, exists := s.buffer.next() + if !exists { + return nil, nil + } + return event, nil +} + +// lazySnapshotCacheIntervalSource serves events from an immutable snapshot. +// The snapshot reference is captured under the watchCache lock, but the O(N) +// traversal that materializes the events is deferred until the first Next() +// call so that it runs off the watchCache lock. +type lazySnapshotCacheIntervalSource struct { + // snapshot is an immutable point-in-time copy of the store. + snapshot store.Snapshot + // resourceVersion is assigned to every watchCacheEvent produced by this source. + resourceVersion uint64 + // loaded indicates whether items has been materialized from the snapshot. + loaded bool + // items holds the result of OrderedListPrefix, populated on the first Next() call + items []interface{} + // currentIndex tracks the current position within items. + currentIndex int +} + +func (s *lazySnapshotCacheIntervalSource) Next() (*watchCacheEvent, error) { + if !s.loaded { + items, err := s.snapshot.OrderedListPrefix("", "") + if err != nil { + return nil, err + } + s.items = items + s.loaded = true + } + if s.currentIndex >= len(s.items) { + return nil, nil + } + elem, ok := s.items[s.currentIndex].(*store.Element) + if !ok { + return nil, fmt.Errorf("not a storeElement: %v", s.items[s.currentIndex]) } + s.currentIndex++ + return storeElementToWatchCacheEvent(elem, s.resourceVersion), nil } const bufferSize = 100 // watchCacheIntervalBuffer is used to reduce acquiring -// the lock on each invocation of watchCacheInterval.Next(). +// the lock on each invocation of historyCacheIntervalSource.Next(). type watchCacheIntervalBuffer struct { // buffer is used to hold watchCacheEvents that // the interval returns on a call to Next(). @@ -243,6 +316,11 @@ func (wcib *watchCacheIntervalBuffer) next() (*watchCacheEvent, bool) { return nil, false } next := wcib.buffer[wcib.startIndex] + // clean the unused event reference in the buffer. If this is not + // done, event if the watch event is aged out from the watch + // cache, it will not be GCed during the lifetime of the watcher + // that holds a reference to the buffer. + wcib.buffer[wcib.startIndex] = nil wcib.startIndex++ return next, true } diff --git a/vendor/k8s.io/apiserver/pkg/storage/etcd3/block_logger.go b/vendor/k8s.io/apiserver/pkg/storage/etcd3/block_logger.go new file mode 100644 index 0000000000..305a4b48f3 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/storage/etcd3/block_logger.go @@ -0,0 +1,82 @@ +/* +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. +*/ + +package etcd3 + +import ( + "sync" + "time" + + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/klog/v2" + "k8s.io/utils/clock" +) + +// blockLogger is a rate-limited logger that tracks how long a watchChan is blocked. +type blockLogger struct { + interval time.Duration + threshold time.Duration + msg string + objectType string + groupResource schema.GroupResource + + clock clock.Clock + + mu sync.Mutex + lastLogTime time.Time + eventCount int + timeWaiting time.Duration +} + +func newBlockLogger(interval time.Duration, threshold time.Duration, msg string, objectType string, groupResource schema.GroupResource, clock clock.Clock) *blockLogger { + l := &blockLogger{ + interval: interval, + threshold: threshold, + msg: msg, + objectType: objectType, + groupResource: groupResource, + clock: clock, + } + l.lastLogTime = l.clock.Now() + return l +} + +func (l *blockLogger) recordWait(waitTime time.Duration) { + l.mu.Lock() + defer l.mu.Unlock() + + l.eventCount++ + l.timeWaiting += waitTime + + now := l.clock.Now() + window := now.Sub(l.lastLogTime) + if window < l.interval { + return + } + + if l.timeWaiting > l.threshold { + klog.V(3).InfoS(l.msg, + "objectType", l.objectType, + "groupResource", l.groupResource, + "eventCount", l.eventCount, + "timeWaiting", l.timeWaiting, + "window", window, + ) + } + l.eventCount = 0 + l.timeWaiting = 0 + l.lastLogTime = now +} diff --git a/vendor/k8s.io/apiserver/pkg/storage/etcd3/corrupt_obj_deleter.go b/vendor/k8s.io/apiserver/pkg/storage/etcd3/corrupt_obj_deleter.go index f94c56eaac..86ff51f179 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/etcd3/corrupt_obj_deleter.go +++ b/vendor/k8s.io/apiserver/pkg/storage/etcd3/corrupt_obj_deleter.go @@ -59,15 +59,19 @@ func WithCorruptObjErrorHandlingTransformer(transformer value.Transformer) value return &corruptObjErrorInterpretingTransformer{Transformer: transformer} } +// maxCorruptObjErrsToAggregate caps the number of corrupt object errors +// aggregated during a LIST operation. +const maxCorruptObjErrsToAggregate = 100 + // corruptObjErrAggregatorFactory returns an error aggregator that aggregates // corrupt object error(s) that the list operation encounters while // retrieving objects from the storage. // maxCount: it is the maximum number of error that will be aggregated -func corruptObjErrAggregatorFactory(maxCount int) func() ListErrorAggregator { +func corruptObjErrAggregatorFactory(maxCount int) func() listItemErrors { if maxCount <= 0 { return defaultListErrorAggregatorFactory } - return func() ListErrorAggregator { + return func() listItemErrors { return &corruptObjErrAggregator{maxCount: maxCount} } } @@ -81,15 +85,19 @@ type corruptObjErrAggregator struct { maxCount int } -func (a *corruptObjErrAggregator) Aggregate(key string, err error) bool { - if len(a.errs) >= a.maxCount { - // add a sentinel error to indicate there are more - a.errs = append(a.errs, errTooMany) +func (a *corruptObjErrAggregator) Append(key string, err error) bool { + if a.abortErr != nil { return true } + var corruptObjErr *corruptObjectError if errors.As(err, &corruptObjErr) { a.errs = append(a.errs, storage.NewCorruptObjError(key, corruptObjErr)) + if len(a.errs) >= a.maxCount { + // treat exceeding the limit as an abort condition + a.abortErr = errTooMany + return true + } return false } @@ -98,13 +106,13 @@ func (a *corruptObjErrAggregator) Aggregate(key string, err error) bool { return true } -func (a *corruptObjErrAggregator) Err() error { +func (a *corruptObjErrAggregator) Aggregate() error { switch { case len(a.errs) == 0 && a.abortErr != nil: return a.abortErr case len(a.errs) > 0: err := utilerrors.NewAggregate(a.errs) - return &aggregatedStorageError{errs: err, resourcePrefix: "list"} + return &aggregatedStorageError{errs: err, abortErr: a.abortErr, resourcePrefix: "list"} default: return nil } @@ -217,6 +225,9 @@ func (e *corruptObjectError) Error() string { type aggregatedStorageError struct { resourcePrefix string errs utilerrors.Aggregate + // abortErr is the reason the aggregation stopped, if any. + // It is nil when all items were processed without hitting a limit or unexpected error. + abortErr error } func (e *aggregatedStorageError) Error() string { @@ -227,14 +238,18 @@ func (e *aggregatedStorageError) Error() string { fmt.Fprintf(&b, "\t%s\n", err.Error()) } b.WriteString("}") + if e.abortErr != nil { + fmt.Fprintf(&b, ", aborted: %v", e.abortErr) + } return b.String() } // NewAPIStatusError creates a new APIStatus object from the // aggregated list of StorageError func (e *aggregatedStorageError) NewAPIStatusError(qualifiedResource schema.GroupResource) *apierrors.StatusError { + errs := e.errs.Errors() var causes []metav1.StatusCause - for _, err := range e.errs.Errors() { + for _, err := range errs { var storageErr *storage.StorageError if errors.As(err, &storageErr) { causes = append(causes, metav1.StatusCause{ @@ -243,15 +258,28 @@ func (e *aggregatedStorageError) NewAPIStatusError(qualifiedResource schema.Grou // TODO: do we need to expose the internal error message here? Message: err.Error(), }) - continue - } - if errors.Is(err, errTooMany) { - causes = append(causes, metav1.StatusCause{ - Type: metav1.CauseTypeTooMany, - Message: errTooMany.Error(), - }) } } + switch { + case errors.Is(e.abortErr, errTooMany): + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeTooMany, + Message: errTooMany.Error(), + }) + case e.abortErr != nil: + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeUnexpectedServerResponse, + Message: e.abortErr.Error(), + }) + } + + // the top-level message carries the first underlying error so it survives + // layers that flatten the error to text and drop the causes, for example + // the watch cache wrapping the reflector list error. + message := fmt.Sprintf("failed to read one or more %s from the storage: %v", qualifiedResource.String(), errs[0]) + if len(errs) > 1 { + message = fmt.Sprintf("%s (and %d more)", message, len(errs)-1) + } return &apierrors.StatusError{ ErrStatus: metav1.Status{ @@ -264,7 +292,7 @@ func (e *aggregatedStorageError) NewAPIStatusError(qualifiedResource schema.Grou Name: e.resourcePrefix, Causes: causes, }, - Message: fmt.Sprintf("failed to read one or more %s from the storage", qualifiedResource.String()), + Message: message, }, } } diff --git a/vendor/k8s.io/apiserver/pkg/storage/etcd3/event.go b/vendor/k8s.io/apiserver/pkg/storage/etcd3/event.go index e7644ddfae..d72420fbd4 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/etcd3/event.go +++ b/vendor/k8s.io/apiserver/pkg/storage/etcd3/event.go @@ -18,6 +18,8 @@ package etcd3 import ( "fmt" + "time" + "go.etcd.io/etcd/api/v3/mvccpb" clientv3 "go.etcd.io/etcd/client/v3" ) @@ -41,17 +43,21 @@ type event struct { // struct field to eliminate contention // between startWatching and processEvent isInitialEventsEndBookmark bool + // isInitialEvent indicates the event was generated from an initial state sync. + isInitialEvent bool + recordTime time.Time } // parseKV converts a KeyValue retrieved from an initial sync() listing to a synthetic isCreated event. func parseKV(kv *mvccpb.KeyValue) *event { return &event{ - key: string(kv.Key), - value: kv.Value, - prevValue: nil, - rev: kv.ModRevision, - isDeleted: false, - isCreated: true, + key: string(kv.Key), + value: kv.Value, + prevValue: nil, + rev: kv.ModRevision, + isDeleted: false, + isCreated: true, + isInitialEvent: true, } } @@ -62,11 +68,12 @@ func parseEvent(e *clientv3.Event) (*event, error) { } ret := &event{ - key: string(e.Kv.Key), - value: e.Kv.Value, - rev: e.Kv.ModRevision, - isDeleted: e.Type == clientv3.EventTypeDelete, - isCreated: e.IsCreate(), + key: string(e.Kv.Key), + value: e.Kv.Value, + rev: e.Kv.ModRevision, + isDeleted: e.Type == clientv3.EventTypeDelete, + isCreated: e.IsCreate(), + recordTime: time.Now(), } if e.PrevKv != nil { ret.prevValue = e.PrevKv.Value @@ -78,5 +85,6 @@ func progressNotifyEvent(rev int64) *event { return &event{ rev: rev, isProgressNotify: true, + recordTime: time.Now(), } } diff --git a/vendor/k8s.io/apiserver/pkg/storage/etcd3/metrics/metrics.go b/vendor/k8s.io/apiserver/pkg/storage/etcd3/metrics/metrics.go index 6bfec87116..2385641d12 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/etcd3/metrics/metrics.go +++ b/vendor/k8s.io/apiserver/pkg/storage/etcd3/metrics/metrics.go @@ -25,6 +25,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apiserver/pkg/features" "k8s.io/apiserver/pkg/storage" + storagemetrics "k8s.io/apiserver/pkg/storage/metrics" utilfeature "k8s.io/apiserver/pkg/util/feature" compbasemetrics "k8s.io/component-base/metrics" "k8s.io/component-base/metrics/legacyregistry" @@ -95,16 +96,6 @@ var ( }, []string{"group", "resource"}, ) - dbTotalSize = compbasemetrics.NewGaugeVec( - &compbasemetrics.GaugeOpts{ - Subsystem: "apiserver", - Name: "storage_db_total_size_in_bytes", - Help: "Total size of the storage database file physically allocated in bytes.", - StabilityLevel: compbasemetrics.ALPHA, - DeprecatedVersion: "1.28.0", - }, - []string{"endpoint"}, - ) storageSizeDescription = compbasemetrics.NewDesc("apiserver_storage_size_bytes", "Size of the storage database file physically allocated in bytes.", []string{"storage_cluster_id"}, nil, compbasemetrics.STABLE, "") storageMonitor = &monitorCollector{monitorGetter: func() ([]Monitor, error) { return nil, nil }} etcdEventsReceivedCounts = compbasemetrics.NewCounterVec( @@ -142,38 +133,6 @@ var ( }, []string{}, ) - listStorageCount = compbasemetrics.NewCounterVec( - &compbasemetrics.CounterOpts{ - Name: "apiserver_storage_list_total", - Help: "Number of LIST requests served from storage", - StabilityLevel: compbasemetrics.ALPHA, - }, - []string{"group", "resource"}, - ) - listStorageNumFetched = compbasemetrics.NewCounterVec( - &compbasemetrics.CounterOpts{ - Name: "apiserver_storage_list_fetched_objects_total", - Help: "Number of objects read from storage in the course of serving a LIST request", - StabilityLevel: compbasemetrics.ALPHA, - }, - []string{"group", "resource"}, - ) - listStorageNumSelectorEvals = compbasemetrics.NewCounterVec( - &compbasemetrics.CounterOpts{ - Name: "apiserver_storage_list_evaluated_objects_total", - Help: "Number of objects tested in the course of serving a LIST request from storage", - StabilityLevel: compbasemetrics.ALPHA, - }, - []string{"group", "resource"}, - ) - listStorageNumReturned = compbasemetrics.NewCounterVec( - &compbasemetrics.CounterOpts{ - Name: "apiserver_storage_list_returned_objects_total", - Help: "Number of objects returned for a LIST request from storage", - StabilityLevel: compbasemetrics.ALPHA, - }, - []string{"group", "resource"}, - ) decodeErrorCounts = compbasemetrics.NewCounterVec( &compbasemetrics.CounterOpts{ Namespace: "apiserver", @@ -183,6 +142,17 @@ var ( }, []string{"group", "resource"}, ) + listLatency = compbasemetrics.NewHistogramVec( + &compbasemetrics.HistogramOpts{ + Namespace: "apiserver", + Name: "storage_list_duration_seconds", + Help: "Latency of the storage layer GetList call in seconds, including object decode, split by whether etcd RangeStream was used.", + Buckets: []float64{0.005, 0.025, 0.05, 0.1, 0.2, 0.4, 0.6, 0.8, 1.0, 1.25, 1.5, 2, 3, + 4, 5, 6, 8, 10, 15, 20, 30, 45, 60}, + StabilityLevel: compbasemetrics.ALPHA, + }, + []string{"streamed", "group", "resource"}, + ) ) var registerMetrics sync.Once @@ -197,17 +167,13 @@ func Register() { legacyregistry.MustRegister(objectCounts) legacyregistry.MustRegister(resourceSizeEstimate) legacyregistry.MustRegister(newObjectCounts) - legacyregistry.MustRegister(dbTotalSize) legacyregistry.CustomMustRegister(storageMonitor) legacyregistry.MustRegister(etcdEventsReceivedCounts) legacyregistry.MustRegister(etcdBookmarkCounts) legacyregistry.MustRegister(etcdBookmarkTotal) legacyregistry.MustRegister(etcdLeaseObjectCounts) - legacyregistry.MustRegister(listStorageCount) - legacyregistry.MustRegister(listStorageNumFetched) - legacyregistry.MustRegister(listStorageNumSelectorEvals) - legacyregistry.MustRegister(listStorageNumReturned) legacyregistry.MustRegister(decodeErrorCounts) + legacyregistry.MustRegister(listLatency) }) } @@ -251,6 +217,15 @@ func RecordEtcdRequest(verb string, groupResource schema.GroupResource, err erro } } +// RecordListLatency sets the storage_list_duration_seconds metric. +func RecordListLatency(groupResource schema.GroupResource, streamed bool, startTime time.Time) { + streamedLabel := "false" + if streamed { + streamedLabel = "true" + } + listLatency.WithLabelValues(streamedLabel, groupResource.Group, groupResource.Resource).Observe(sinceInSeconds(startTime)) +} + // RecordEtcdEvent updated the etcd_events_received_total metric. func RecordEtcdEvent(groupResource schema.GroupResource) { etcdEventsReceivedCounts.WithLabelValues(groupResource.Group, groupResource.Resource).Inc() @@ -279,12 +254,6 @@ var sinceInSeconds = func(start time.Time) float64 { return time.Since(start).Seconds() } -// UpdateEtcdDbSize sets the etcd_db_total_size_in_bytes metric. -// Deprecated: Metric etcd_db_total_size_in_bytes will be replaced with apiserver_storage_size_bytes -func UpdateEtcdDbSize(ep string, size int64) { - dbTotalSize.WithLabelValues(ep).Set(float64(size)) -} - // SetStorageMonitorGetter sets monitor getter to allow monitoring etcd stats. func SetStorageMonitorGetter(getter func() ([]Monitor, error)) { storageMonitor.setGetter(getter) @@ -297,12 +266,9 @@ func UpdateLeaseObjectCount(count int64) { etcdLeaseObjectCounts.WithLabelValues().Observe(float64(count)) } -// RecordStorageListMetrics notes various metrics of the cost to serve a LIST request -func RecordStorageListMetrics(groupResource schema.GroupResource, numFetched, numEvald, numReturned int) { - listStorageCount.WithLabelValues(groupResource.Group, groupResource.Resource).Inc() - listStorageNumFetched.WithLabelValues(groupResource.Group, groupResource.Resource).Add(float64(numFetched)) - listStorageNumSelectorEvals.WithLabelValues(groupResource.Group, groupResource.Resource).Add(float64(numEvald)) - listStorageNumReturned.WithLabelValues(groupResource.Group, groupResource.Resource).Add(float64(numReturned)) +// RecordStorageListMetrics notes various metrics of the cost to serve a LIST request. +func RecordStorageListMetrics(groupResource schema.GroupResource, index string, numFetched, numEvald, numReturned int) { + storagemetrics.RecordStorageListMetrics(groupResource, storagemetrics.StorageBackendEtcd, index, numFetched, numEvald, numReturned) } type Monitor interface { @@ -352,7 +318,6 @@ func (c *monitorCollector) CollectWithStability(ch chan<- compbasemetrics.Metric ctx, cancel := context.WithTimeout(context.Background(), time.Second) metrics, err := m.Monitor(ctx) cancel() - m.Close() if err != nil { klog.InfoS("Failed to get storage metrics", "storage_cluster_id", storageClusterID, "err", err) continue diff --git a/vendor/k8s.io/apiserver/pkg/storage/etcd3/store.go b/vendor/k8s.io/apiserver/pkg/storage/etcd3/store.go index 8384832335..2717353314 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/etcd3/store.go +++ b/vendor/k8s.io/apiserver/pkg/storage/etcd3/store.go @@ -21,9 +21,9 @@ import ( "context" "errors" "fmt" + "iter" "path" "reflect" - "strconv" "strings" "sync" "time" @@ -32,14 +32,14 @@ import ( clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3/kubernetes" "go.opentelemetry.io/otel/attribute" + grpccodes "google.golang.org/grpc/codes" + grpcstatus "google.golang.org/grpc/status" etcdrpc "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/conversion" - "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/watch" @@ -87,7 +87,7 @@ type store struct { watcher *watcher leaseManager *leaseManager decoder Decoder - listErrAggrFactory func() ListErrorAggregator + listErrAggrFactory func() listItemErrors resourcePrefix string newListFunc func() runtime.Object @@ -113,36 +113,35 @@ type objState struct { stale bool } -// ListErrorAggregator aggregates the error(s) that the LIST operation -// encounters while retrieving object(s) from the storage -type ListErrorAggregator interface { - // Aggregate aggregates the given error from list operation - // key: it identifies the given object in the storage. - // err: it represents the error the list operation encountered while - // retrieving the given object from the storage. - // done: true if the aggregation is done and the list operation should - // abort, otherwise the list operation will continue - Aggregate(key string, err error) bool - - // Err returns the aggregated error - Err() error +// listItemErrors stores a slice of item storage errors during LIST operations. +// They are iteratively added, and eventually returned as an aggregated error. On +// each Append, it signals whether it considers itself full or the error to be fatal. +// In either case, the caller is supposed to not keep collecting, but return the +// collection. +type listItemErrors interface { + // Append adds an item storage error for the given storage key during a LIST operation. + // The caller is expected to stop appending as soon as true is returned. + Append(key string, err error) bool + + // Aggregate returns the aggregated error + Aggregate() error } // defaultListErrorAggregatorFactory returns the default list error // aggregator that maintains backward compatibility, which is abort // the list operation as soon as it encounters the first error -func defaultListErrorAggregatorFactory() ListErrorAggregator { return &abortOnFirstError{} } +func defaultListErrorAggregatorFactory() listItemErrors { return &abortOnFirstError{} } // LIST aborts on the first error it encounters (backward compatible) type abortOnFirstError struct { err error } -func (a *abortOnFirstError) Aggregate(key string, err error) bool { +func (a *abortOnFirstError) Append(key string, err error) bool { a.err = err return true } -func (a *abortOnFirstError) Err() error { return a.err } +func (a *abortOnFirstError) Aggregate() error { return a.err } // New returns an etcd3 implementation of storage.Interface. func New(c *kubernetes.Client, compactor Compactor, codec runtime.Codec, newFunc, newListFunc func() runtime.Object, prefix, resourcePrefix string, groupResource schema.GroupResource, transformer value.Transformer, leaseManagerConfig LeaseManagerConfig, decoder Decoder, versioner storage.Versioner) (*store, error) { @@ -166,7 +165,7 @@ func New(c *kubernetes.Client, compactor Compactor, codec runtime.Codec, newFunc listErrAggrFactory := defaultListErrorAggregatorFactory if utilfeature.DefaultFeatureGate.Enabled(features.AllowUnsafeMalformedObjectDeletion) { - listErrAggrFactory = corruptObjErrAggregatorFactory(100) + listErrAggrFactory = corruptObjErrAggregatorFactory(maxCorruptObjErrsToAggregate) } w := &watcher{ @@ -203,9 +202,7 @@ func New(c *kubernetes.Client, compactor Compactor, codec runtime.Codec, newFunc w.getCurrentStorageRV = func(ctx context.Context) (uint64, error) { return s.GetCurrentResourceVersion(ctx) } - if utilfeature.DefaultFeatureGate.Enabled(features.ConsistentListFromCache) || utilfeature.DefaultFeatureGate.Enabled(features.WatchList) { - etcdfeature.DefaultFeatureSupportChecker.CheckClient(c.Ctx(), c, storage.RequestWatchProgress) - } + etcdfeature.DefaultFeatureSupportChecker.CheckClient(c.Ctx(), c, storage.RequestWatchProgress) return s, nil } @@ -240,12 +237,21 @@ func (s *store) Get(ctx context.Context, key string, opts storage.GetOptions, ou if err != nil { return err } + ctx, span := tracing.Start(ctx, "Get etcd3", + attribute.String("audit-id", audit.GetAuditIDTruncated(ctx)), + attribute.String("key", key), + attribute.String("group", s.groupResource.Group), + attribute.String("resource", s.groupResource.Resource), + ) + defer span.End(500 * time.Millisecond) startTime := time.Now() getResp, err := s.client.Kubernetes.Get(ctx, preparedKey, kubernetes.GetOptions{}) metrics.RecordEtcdRequest("get", s.groupResource, err, startTime) if err != nil { + span.AddEvent("Get call failed", attribute.String("err", err.Error())) return err } + span.AddEvent("Get call succeeded") if err = s.validateMinimumResourceVersion(opts.ResourceVersion, uint64(getResp.Revision)); err != nil { return err } @@ -259,14 +265,18 @@ func (s *store) Get(ctx context.Context, key string, opts storage.GetOptions, ou data, _, err := s.transformer.TransformFromStorage(ctx, getResp.KV.Value, authenticatedDataString(preparedKey)) if err != nil { + span.AddEvent("TransformFromStorage failed", attribute.String("err", err.Error())) return storage.NewInternalError(err) } + span.AddEvent("TransformFromStorage succeeded") err = s.decoder.Decode(data, out, getResp.KV.ModRevision) if err != nil { + span.AddEvent("Decode failed", attribute.Int("len", len(data)), attribute.String("err", err.Error())) recordDecodeError(s.groupResource, preparedKey) return err } + span.AddEvent("Decode succeeded", attribute.Int("len", len(data))) return nil } @@ -329,11 +339,11 @@ func (s *store) Create(ctx context.Context, key string, obj, out runtime.Object, if out != nil { err = s.decoder.Decode(data, out, txnResp.Revision) if err != nil { - span.AddEvent("decode failed", attribute.Int("len", len(data)), attribute.String("err", err.Error())) + span.AddEvent("Decode failed", attribute.Int("len", len(data)), attribute.String("err", err.Error())) recordDecodeError(s.groupResource, preparedKey) return err } - span.AddEvent("decode succeeded", attribute.Int("len", len(data))) + span.AddEvent("Decode succeeded", attribute.Int("len", len(data))) } return nil } @@ -351,22 +361,22 @@ func (s *store) Delete( return fmt.Errorf("unable to convert output object to pointer: %v", err) } - skipTransformDecode := false + expectTransformOrDecodeError := false if utilfeature.DefaultFeatureGate.Enabled(features.AllowUnsafeMalformedObjectDeletion) { - skipTransformDecode = opts.IgnoreStoreReadError + expectTransformOrDecodeError = opts.ExpectTransformOrDecodeError } - return s.conditionalDelete(ctx, preparedKey, out, v, preconditions, validateDeletion, cachedExistingObject, skipTransformDecode) + return s.conditionalDelete(ctx, preparedKey, out, v, preconditions, validateDeletion, cachedExistingObject, expectTransformOrDecodeError) } func (s *store) conditionalDelete( ctx context.Context, key string, out runtime.Object, v reflect.Value, preconditions *storage.Preconditions, - validateDeletion storage.ValidateObjectFunc, cachedExistingObject runtime.Object, skipTransformDecode bool) error { - getCurrentState := s.getCurrentState(ctx, key, v, false, skipTransformDecode) + validateDeletion storage.ValidateObjectFunc, cachedExistingObject runtime.Object, expectTransformOrDecodeError bool) error { + getCurrentState := s.getCurrentState(ctx, key, v, false, expectTransformOrDecodeError) var origState *objState var err error var origStateIsCurrent bool - if cachedExistingObject != nil { + if cachedExistingObject != nil && !expectTransformOrDecodeError { origState, err = s.getStateFromObject(cachedExistingObject) } else { origState, err = getCurrentState() @@ -440,7 +450,7 @@ func (s *store) conditionalDelete( } if !txnResp.Succeeded { klog.V(4).Infof("deletion of %s failed because of a conflict, going to retry", key) - origState, err = s.getState(ctx, txnResp.KV, key, v, false, skipTransformDecode) + origState, err = s.getState(ctx, txnResp.KV, key, v, false, expectTransformOrDecodeError) if err != nil { return err } @@ -448,7 +458,7 @@ func (s *store) conditionalDelete( continue } - if !skipTransformDecode { + if !expectTransformOrDecodeError { err = s.decoder.Decode(origState.data, out, txnResp.Revision) if err != nil { recordDecodeError(s.groupResource, key) @@ -480,8 +490,7 @@ func (s *store) GuaranteedUpdate( return fmt.Errorf("unable to convert output object to pointer: %v", err) } - skipTransformDecode := false - getCurrentState := s.getCurrentState(ctx, preparedKey, v, ignoreNotFound, skipTransformDecode) + getCurrentState := s.getCurrentState(ctx, preparedKey, v, ignoreNotFound, false) var origState *objState var origStateIsCurrent bool @@ -607,7 +616,7 @@ func (s *store) GuaranteedUpdate( span.AddEvent("Transaction committed") if !txnResp.Succeeded { klog.V(4).Infof("GuaranteedUpdate of %s failed because of a conflict, going to retry", preparedKey) - origState, err = s.getState(ctx, txnResp.KV, preparedKey, v, ignoreNotFound, skipTransformDecode) + origState, err = s.getState(ctx, txnResp.KV, preparedKey, v, ignoreNotFound, false) if err != nil { return err } @@ -618,11 +627,11 @@ func (s *store) GuaranteedUpdate( err = s.decoder.Decode(data, destination, txnResp.Revision) if err != nil { - span.AddEvent("decode failed", attribute.Int("len", len(data)), attribute.String("err", err.Error())) + span.AddEvent("Decode failed", attribute.Int("len", len(data)), attribute.String("err", err.Error())) recordDecodeError(s.groupResource, preparedKey) return err } - span.AddEvent("decode succeeded", attribute.Int("len", len(data))) + span.AddEvent("Decode succeeded", attribute.Int("len", len(data))) return nil } } @@ -678,6 +687,21 @@ func (s *store) EnableResourceSizeEstimation(getKeys storage.KeysFunc) error { return nil } +// TestOnlyResetResourceSizeEstimator clears the resource size estimator so a +// subsequent EnableResourceSizeEstimation call succeeds. +func TestOnlyResetResourceSizeEstimator(s storage.Interface) { + st, ok := s.(*store) + if !ok { + return + } + st.collectorMux.Lock() + defer st.collectorMux.Unlock() + if st.resourceSizeEstimator != nil { + st.resourceSizeEstimator.Close() + st.resourceSizeEstimator = nil + } +} + func (s *store) getKeys(ctx context.Context) ([]string, error) { startTime := time.Now() prefix, err := s.prepareKey(s.resourcePrefix, true) @@ -702,34 +726,37 @@ func (s *store) ReadinessCheck() error { } func (s *store) GetCurrentResourceVersion(ctx context.Context) (uint64, error) { - emptyList := s.newListFunc() - pred := storage.SelectionPredicate{ - Label: labels.Everything(), - Field: fields.Everything(), - Limit: 1, // just in case we actually hit something - } - - err := s.GetList(ctx, s.resourcePrefix, storage.ListOptions{Predicate: pred}, emptyList) + preparedKey, err := s.prepareKey(s.resourcePrefix, false) if err != nil { return 0, err } - emptyListAccessor, err := meta.ListAccessor(emptyList) - if err != nil { - return 0, err - } - if emptyListAccessor == nil { - return 0, fmt.Errorf("unable to extract a list accessor from %T", emptyList) - } - currentResourceVersion, err := strconv.Atoi(emptyListAccessor.GetResourceVersion()) + startTime := time.Now() + getResp, err := s.client.Kubernetes.Get(ctx, preparedKey, kubernetes.GetOptions{}) + metrics.RecordEtcdRequest("getCurrentResourceVersion", s.groupResource, err, startTime) if err != nil { return 0, err } - if currentResourceVersion == 0 { + if getResp.Revision == 0 { return 0, fmt.Errorf("the current resource version must be greater than 0") } - return uint64(currentResourceVersion), nil + return uint64(getResp.Revision), nil +} + +// shouldStream determines whether a list request should use etcd RangeStream. +func shouldStream(opts storage.ListOptions) bool { + // Only recursive lists stream, a non-recursive request reads a single object. + if !opts.Recursive { + return false + } + // etcd is unaware of selector matches, so a filtered page can't carry a proper limit. + // Stream only unfiltered pages. + if opts.Predicate.Limit > 0 && !opts.Predicate.Empty() { + return false + } + return utilfeature.DefaultFeatureGate.Enabled(features.EtcdRangeStream) && + etcdfeature.DefaultFeatureSupportChecker.Supports(storage.RangeStream) } // GetList implements storage.Interface. @@ -768,142 +795,291 @@ func (s *store) GetList(ctx context.Context, key string, opts storage.ListOption // loop until we have filled the requested limit from etcd or there are no more results var lastKey []byte var hasMore bool - var getResp kubernetes.ListResponse + var count int64 var numFetched int var numEvald int + var streamed bool + startTime := time.Now() // Because these metrics are for understanding the costs of handling LIST requests, // get them recorded even in error cases. defer func() { numReturn := v.Len() - metrics.RecordStorageListMetrics(s.groupResource, numFetched, numEvald, numReturn) + metrics.RecordStorageListMetrics(s.groupResource, "", numFetched, numEvald, numReturn) + metrics.RecordListLatency(s.groupResource, streamed, startTime) }() aggregator := s.listErrAggrFactory() - for { - getResp, err = s.getList(ctx, keyPrefix, opts.Recursive, kubernetes.ListOptions{ - Revision: withRev, - Limit: limit, - Continue: continueKey, - }) - if err != nil { - if errors.Is(err, etcdrpc.ErrFutureRev) { - currentRV, getRVErr := s.GetCurrentResourceVersion(ctx) - if getRVErr != nil { - // If we can't get the current RV, use 0 as a fallback. - currentRV = 0 + + chunks := s.pagedChunks(ctx, keyPrefix, opts, withRev, limit, continueKey) + if shouldStream(opts) { + streamChunks, supported := s.streamChunks(ctx, keyPrefix, withRev, limit, continueKey) + if supported { + chunks = streamChunks + streamed = true + } else { + etcdfeature.DefaultFeatureSupportChecker.MarkUnsupported(storage.RangeStream) + klog.V(4).Infof("etcd server does not support RangeStream for %v; falling back to paginated list", s.groupResource) + } + } + + for chunk, chunkErr := range chunks { + if chunkErr != nil { + return chunkErr + } + numFetched += len(chunk.kvs) + if chunk.revision != nil { + if withRev == 0 { + if err = s.validateMinimumResourceVersion(opts.ResourceVersion, uint64(*chunk.revision)); err != nil { + return err } - return storage.NewTooLargeResourceVersionError(uint64(withRev), currentRV, 0) + withRev = *chunk.revision + } else if *chunk.revision != withRev { + return fmt.Errorf("etcd returned revision %d for a list read at revision %d", *chunk.revision, withRev) } - return interpretListError(err, len(opts.Predicate.Continue) > 0, continueKey, keyPrefix) } - numFetched += len(getResp.Kvs) - if err = s.validateMinimumResourceVersion(opts.ResourceVersion, uint64(getResp.Revision)); err != nil { - return err + if len(chunk.kvs) == 0 && chunk.hasMore { + return fmt.Errorf("no results were found, but etcd indicated there were more values remaining") } - hasMore = int64(len(getResp.Kvs)) < getResp.Count + count = chunk.count - if len(getResp.Kvs) == 0 && hasMore { - return fmt.Errorf("no results were found, but etcd indicated there were more values remaining") + chunkLastKey, chunkEvaluated, limitReached, err := s.appendChunk(ctx, chunk.kvs, opts.Predicate, newItemFunc, aggregator, v, paging) + if err != nil { + return err } - // indicate to the client which resource version was returned, and use the same resource version for subsequent requests. - if withRev == 0 { - withRev = getResp.Revision + numEvald += chunkEvaluated + if chunkLastKey != nil { + lastKey = chunkLastKey } + hasMore = chunk.hasMore || limitReached - // avoid small allocations for the result slice, since this can be called in many - // different contexts and we don't know how significantly the result will be filtered - if opts.Predicate.Empty() { - growSlice(v, len(getResp.Kvs)) - } else { - growSlice(v, 2048, len(getResp.Kvs)) + // the limit was reached mid-chunk or no results remain + if limitReached || !chunk.hasMore { + break } + // we're paging but we have filled our bucket + if paging && int64(v.Len()) >= opts.Predicate.Limit { + break + } + } - // take items from the response until the bucket is full, filtering as we go - for i, kv := range getResp.Kvs { - if paging && int64(v.Len()) >= opts.Predicate.Limit { - hasMore = true - break - } - lastKey = kv.Key + continueValue, remainingItemCount, err := storage.PrepareContinueToken(string(lastKey), keyPrefix, withRev, count, hasMore, opts) + if err != nil { + return err + } + return s.finalizeList(listObj, opts.Predicate, uint64(withRev), continueValue, remainingItemCount, aggregator, v) +} + +// listChunk is one batch of kvs from a list read: a page of a paginated Range, or a +// chunk of a RangeStream. +type listChunk struct { + kvs []*mvccpb.KeyValue + revision *int64 + count int64 // etcd's count of keys remaining in the range, including this batch + hasMore bool +} - data, _, err := s.transformer.TransformFromStorage(ctx, kv.Value, authenticatedDataString(kv.Key)) +func (s *store) pagedChunks(ctx context.Context, keyPrefix string, opts storage.ListOptions, withRev, limit int64, continueKey string) iter.Seq2[listChunk, error] { + return func(yield func(listChunk, error) bool) { + for { + getResp, err := s.getList(ctx, keyPrefix, opts.Recursive, kubernetes.ListOptions{ + Revision: withRev, + Limit: limit, + Continue: continueKey, + }) if err != nil { - if done := aggregator.Aggregate(string(kv.Key), storage.NewInternalError(fmt.Errorf("unable to transform key %q: %w", kv.Key, err))); done { - return aggregator.Err() - } - continue + yield(listChunk{}, s.listReadError(ctx, err, withRev, len(opts.Predicate.Continue) > 0, continueKey, keyPrefix)) + return } - - // Check if the request has already timed out before decode object - select { - case <-ctx.Done(): - // parent context is canceled or timed out, no point in continuing - return storage.NewTimeoutError(string(kv.Key), "request did not complete within requested timeout") - default: + hasMore := int64(len(getResp.Kvs)) < getResp.Count + // use the same resource version for subsequent requests + if withRev == 0 { + withRev = getResp.Revision } - - obj, err := s.decoder.DecodeListItem(ctx, data, uint64(kv.ModRevision), newItemFunc) - if err != nil { - recordDecodeError(s.groupResource, string(kv.Key)) - if done := aggregator.Aggregate(string(kv.Key), err); done { - return aggregator.Err() - } - continue + // capture the next continue key before yielding, the consumer nils out kvs as it decodes them + if len(getResp.Kvs) > 0 { + continueKey = string(getResp.Kvs[len(getResp.Kvs)-1].Key) + "\x00" } - - // being unable to set the version does not prevent the object from being extracted - if matched, err := opts.Predicate.Matches(obj); err == nil && matched { - v.Set(reflect.Append(v, reflect.ValueOf(obj).Elem())) + revision := withRev + if !yield(listChunk{kvs: getResp.Kvs, revision: &revision, count: getResp.Count, hasMore: hasMore}, nil) { + return } + if !hasMore { + return + } + if limit < maxLimit { + // We got incomplete result due to field/label selector dropping the object. + // Double page size to reduce total number of calls to etcd. + limit *= 2 + if limit > maxLimit { + limit = maxLimit + } + } + } + } +} - numEvald++ - - // free kv early. Long lists can take O(seconds) to decode. - getResp.Kvs[i] = nil +// listReadError maps an etcd list read error to the error GetList returns. +func (s *store) listReadError(ctx context.Context, err error, withRev int64, paging bool, continueKey, keyPrefix string) error { + if errors.Is(err, etcdrpc.ErrFutureRev) { + currentRV, getRVErr := s.GetCurrentResourceVersion(ctx) + if getRVErr != nil { + // If we can't get the current RV, use 0 as a fallback. + currentRV = 0 } - continueKey = string(lastKey) + "\x00" + return storage.NewTooLargeResourceVersionError(uint64(withRev), currentRV, 0) + } + return interpretListError(err, paging, continueKey, keyPrefix) +} - // no more results remain or we didn't request paging - if !hasMore || !paging { - break +// streamChunks reads the list as a single etcd RangeStream, pinned to withRev when +// nonzero, capped at limit keys and resumed from continueKey when set. +// supported is false when the etcd server does not implement RangeStream. +func (s *store) streamChunks(ctx context.Context, keyPrefix string, withRev, limit int64, continueKey string) (chunks iter.Seq2[listChunk, error], supported bool) { + startTime := time.Now() + paging := continueKey != "" + startKey := keyPrefix + if paging { + startKey = continueKey + } + streamOpts := []clientv3.OpOption{clientv3.WithRange(clientv3.GetPrefixRangeEnd(keyPrefix))} + if withRev > 0 { + streamOpts = append(streamOpts, clientv3.WithRev(withRev)) + } + if limit > 0 { + streamOpts = append(streamOpts, clientv3.WithLimit(limit)) + } + stream, streamErr := s.client.KV.GetStream(ctx, startKey, streamOpts...) + var first clientv3.RangeStreamResponse + var firstOk bool + if streamErr == nil { + first, firstOk = <-stream + if firstOk && grpcstatus.Code(first.Err()) == grpccodes.Unimplemented { + return nil, false } - // we're paging but we have filled our bucket - if int64(v.Len()) >= opts.Predicate.Limit { - break + } else if grpcstatus.Code(streamErr) == grpccodes.Unimplemented { + return nil, false + } + return func(yield func(listChunk, error) bool) { + var err error + defer func() { + metrics.RecordEtcdRequest("listStream", s.groupResource, err, startTime) + }() + if err = streamErr; err != nil { + yield(listChunk{}, s.listReadError(ctx, err, withRev, paging, continueKey, keyPrefix)) + return } - - if limit < maxLimit { - // We got incomplete result due to field/label selector dropping the object. - // Double page size to reduce total number of calls to etcd. - limit *= 2 - if limit > maxLimit { - limit = maxLimit + estimator := s.getResourceSizeEstimator() + var revision *int64 + if withRev > 0 { + revision = &withRev + } + resp, ok := first, firstOk + for ok { + if err = resp.Err(); err != nil { + yield(listChunk{}, s.listReadError(ctx, err, withRev, paging, continueKey, keyPrefix)) + return + } + rangeResp := resp.RangeResponse + if estimator != nil && len(rangeResp.Kvs) > 0 { + estimator.Update(rangeResp.Kvs) } + // A pinned stream's final header holds the latest store revision, not withRev. + if revision == nil && rangeResp.Header != nil { + revision = &rangeResp.Header.Revision + } + next, nextOk := <-stream + // On the final chunk, More means the limit truncated the range, so there + // is a next page even though the stream ended. + if !yield(listChunk{kvs: rangeResp.Kvs, revision: revision, count: rangeResp.Count, hasMore: nextOk || rangeResp.More}, nil) { + return + } + resp, ok = next, nextOk } - } + if revision == nil { + err = fmt.Errorf("rangeStream for %q completed without a revision", keyPrefix) + yield(listChunk{}, err) + } + }, true +} - if err := aggregator.Err(); err != nil { +func (s *store) finalizeList(listObj runtime.Object, pred storage.SelectionPredicate, rev uint64, continueValue string, remainingItemCount *int64, aggregator listItemErrors, v reflect.Value) error { + if err := aggregator.Aggregate(); err != nil { return err } - if v.IsNil() { // Ensure that we never return a nil Items pointer in the result for consistency. v.Set(reflect.MakeSlice(v.Type(), 0, 0)) } - - continueValue, remainingItemCount, err := storage.PrepareContinueToken(string(lastKey), keyPrefix, withRev, getResp.Count, hasMore, opts) - if err != nil { - return err - } - if err := s.versioner.UpdateList(listObj, uint64(withRev), continueValue, remainingItemCount); err != nil { + if err := s.versioner.UpdateList(listObj, rev, continueValue, remainingItemCount); err != nil { return err } if utilfeature.DefaultFeatureGate.Enabled(features.ShardedListAndWatch) { - opts.Predicate.SetShardInfoOnList(listObj) + pred.SetShardInfoOnList(listObj) } return nil } +func (s *store) processListItem(ctx context.Context, kv *mvccpb.KeyValue, pred storage.SelectionPredicate, newItemFunc func() runtime.Object, aggregator listItemErrors, v reflect.Value) (bool, error) { + data, _, err := s.transformer.TransformFromStorage(ctx, kv.Value, authenticatedDataString(kv.Key)) + if err != nil { + if done := aggregator.Append(string(kv.Key), storage.NewInternalError(fmt.Errorf("unable to transform key %q: %w", kv.Key, err))); done { + return false, aggregator.Aggregate() + } + return false, nil + } + + // Check if the request has already timed out before decode object + select { + case <-ctx.Done(): + // parent context is canceled or timed out, no point in continuing + return false, storage.NewTimeoutError(string(kv.Key), "request did not complete within requested timeout") + default: + } + + obj, err := s.decoder.DecodeListItem(ctx, data, uint64(kv.ModRevision), newItemFunc) + if err != nil { + recordDecodeError(s.groupResource, string(kv.Key)) + if done := aggregator.Append(string(kv.Key), err); done { + return false, aggregator.Aggregate() + } + return false, nil + } + + // being unable to set the version does not prevent the object from being extracted + if matched, err := pred.Matches(obj); err == nil && matched { + v.Set(reflect.Append(v, reflect.ValueOf(obj).Elem())) + } + + return true, nil +} + +// appendChunk appends the kvs matching pred to v. +func (s *store) appendChunk(ctx context.Context, kvs []*mvccpb.KeyValue, pred storage.SelectionPredicate, newItemFunc func() runtime.Object, aggregator listItemErrors, v reflect.Value, paging bool) (lastKey []byte, evaluated int, limitReached bool, err error) { + // avoid small allocations for the result slice, since this can be called in many + // different contexts and we don't know how significantly the result will be filtered + if pred.Empty() { + growSlice(v, len(kvs)) + } else { + growSlice(v, 2048, len(kvs)) + } + for i, kv := range kvs { + if paging && int64(v.Len()) >= pred.Limit { + return lastKey, evaluated, true, nil + } + lastKey = kv.Key + ok, err := s.processListItem(ctx, kv, pred, newItemFunc, aggregator, v) + if err != nil { + return lastKey, evaluated, false, err + } + if ok { + evaluated++ + } + // free kv early. Long lists can take O(seconds) to decode. + kvs[i] = nil + } + return lastKey, evaluated, false, nil +} + func (s *store) getList(ctx context.Context, keyPrefix string, recursive bool, options kubernetes.ListOptions) (resp kubernetes.ListResponse, err error) { startTime := time.Now() if recursive { @@ -988,7 +1164,7 @@ func (s *store) watchContext(ctx context.Context) context.Context { return clientv3.WithRequireLeader(ctx) } -func (s *store) getCurrentState(ctx context.Context, key string, v reflect.Value, ignoreNotFound bool, skipTransformDecode bool) func() (*objState, error) { +func (s *store) getCurrentState(ctx context.Context, key string, v reflect.Value, ignoreNotFound bool, expectTransformOrDecodeError bool) func() (*objState, error) { return func() (*objState, error) { startTime := time.Now() getResp, err := s.client.Kubernetes.Get(ctx, key, kubernetes.GetOptions{}) @@ -996,17 +1172,15 @@ func (s *store) getCurrentState(ctx context.Context, key string, v reflect.Value if err != nil { return nil, err } - return s.getState(ctx, getResp.KV, key, v, ignoreNotFound, skipTransformDecode) + return s.getState(ctx, getResp.KV, key, v, ignoreNotFound, expectTransformOrDecodeError) } } -// getState constructs a new objState from the given response from the storage. -// skipTransformDecode: if true, the function will neither transform the data -// from the storage nor decode it into an object; otherwise, data from the -// storage will be transformed and decoded. -// NOTE: when skipTransformDecode is true, the 'data', and the 'obj' fields -// of the objState will be nil, and 'stale' will be set to true. -func (s *store) getState(ctx context.Context, kv *mvccpb.KeyValue, key string, v reflect.Value, ignoreNotFound bool, skipTransformDecode bool) (*objState, error) { +// getState constructs a new objState from the given response from the storage. If +// expectTransformOrDecodeError is true and neither transformation nor decode fails, returns an +// InvalidObj error; if either fails, the returned error and the 'obj' field of the returned +// objState will both be nil. +func (s *store) getState(ctx context.Context, kv *mvccpb.KeyValue, key string, v reflect.Value, ignoreNotFound bool, expectTransformOrDecodeError bool) (*objState, error) { state := &objState{ meta: &storage.ResponseMeta{}, } @@ -1024,30 +1198,42 @@ func (s *store) getState(ctx context.Context, kv *mvccpb.KeyValue, key string, v if err := runtime.SetZeroValue(state.obj); err != nil { return nil, err } - } else { - state.rev = kv.ModRevision - state.meta.ResourceVersion = uint64(state.rev) - - if skipTransformDecode { - // be explicit that we don't have the object - state.obj = nil - state.stale = true // this seems a more sane value here - return state, nil - } + return state, nil + } - data, stale, err := s.transformer.TransformFromStorage(ctx, kv.Value, authenticatedDataString(key)) - if err != nil { + state.rev = kv.ModRevision + state.meta.ResourceVersion = uint64(state.rev) + + data, stale, err := s.transformer.TransformFromStorage(ctx, kv.Value, authenticatedDataString(key)) + if err != nil { + if !expectTransformOrDecodeError { return nil, storage.NewInternalError(err) } - state.data = data - state.stale = stale + // be explicit that we don't have the object + state.obj = nil + state.stale = true // this seems a more sane value here + return state, nil + } + + state.data = data + state.stale = stale - if err := s.decoder.Decode(state.data, state.obj, state.rev); err != nil { + if err := s.decoder.Decode(state.data, state.obj, state.rev); err != nil { + if !expectTransformOrDecodeError { recordDecodeError(s.groupResource, key) return nil, err } + + // be explicit that we don't have the object + state.obj = nil + return state, nil } + + if expectTransformOrDecodeError { + return nil, storage.NewInvalidObjError(key, "unsafe deletion is not allowed because the object is decodable from storage") + } + return state, nil } diff --git a/vendor/k8s.io/apiserver/pkg/storage/etcd3/watcher.go b/vendor/k8s.io/apiserver/pkg/storage/etcd3/watcher.go index 0559383f8d..629f29dd99 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/etcd3/watcher.go +++ b/vendor/k8s.io/apiserver/pkg/storage/etcd3/watcher.go @@ -32,6 +32,8 @@ import ( grpcstatus "google.golang.org/grpc/status" apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/wait" @@ -39,10 +41,12 @@ import ( "k8s.io/apiserver/pkg/features" "k8s.io/apiserver/pkg/storage" "k8s.io/apiserver/pkg/storage/etcd3/metrics" + etcdfeature "k8s.io/apiserver/pkg/storage/feature" "k8s.io/apiserver/pkg/storage/value" utilfeature "k8s.io/apiserver/pkg/util/feature" utilflowcontrol "k8s.io/apiserver/pkg/util/flowcontrol" "k8s.io/klog/v2" + "k8s.io/utils/clock" ) const ( @@ -50,6 +54,9 @@ const ( incomingBufSize = 100 outgoingBufSize = 100 processEventConcurrency = 10 + + watchChanLogWarningInterval = 5 * time.Second + watchChanLogWarningThreshold = 100 * time.Millisecond ) // defaultWatcherMaxLimit is used to facilitate construction tests @@ -61,12 +68,23 @@ var fatalOnDecodeError atomic.Bool func init() { // check to see if we are running in a test environment b, _ := strconv.ParseBool(os.Getenv("KUBE_PANIC_WATCH_DECODE_ERROR")) - TestOnlySetFatalOnDecodeError(b) + fatalOnDecodeError.Store(b) +} + +// TestingTB is the subset of testing.TB required by TestOnlySetFatalOnDecodeError. Avoids importing +// the testing package. +type TestingTB interface { + Helper() + Cleanup(func()) } // TestOnlySetFatalOnDecodeError should only be used for cases where decode errors are expected and need to be tested. e.g. conversion webhooks. -func TestOnlySetFatalOnDecodeError(b bool) { - fatalOnDecodeError.Store(b) +func TestOnlySetFatalOnDecodeError(tb TestingTB, b bool) { + tb.Helper() + old := fatalOnDecodeError.Swap(b) + tb.Cleanup(func() { + fatalOnDecodeError.Store(old) + }) } type watcher struct { @@ -88,12 +106,16 @@ type watchChan struct { initialRev int64 recursive bool progressNotify bool + recordTimestamps bool internalPred storage.SelectionPredicate ctx context.Context cancel context.CancelFunc incomingEventChan chan *event resultChan chan watch.Event getResourceSizeEstimator func() *resourceSizeEstimator + + incomingEventLogger *blockLogger + resultLogger *blockLogger } // Watch watches on a key and returns a watch.Interface that transfers relevant notifications. @@ -114,7 +136,7 @@ func (w *watcher) Watch(ctx context.Context, key string, rev int64, opts storage if err != nil { return nil, err } - wc := w.createWatchChan(ctx, key, startWatchRV, opts.Recursive, opts.ProgressNotify, opts.Predicate) + wc := w.createWatchChan(ctx, key, startWatchRV, opts.Recursive, opts.ProgressNotify, opts.RecordTimestamps, opts.Predicate) go wc.run(isInitialEventsEndBookmarkRequired(opts), areInitialEventsRequired(rev, opts)) // For etcd watch we don't have an easy way to answer whether the watch @@ -127,13 +149,14 @@ func (w *watcher) Watch(ctx context.Context, key string, rev int64, opts storage return wc, nil } -func (w *watcher) createWatchChan(ctx context.Context, key string, rev int64, recursive, progressNotify bool, pred storage.SelectionPredicate) *watchChan { +func (w *watcher) createWatchChan(ctx context.Context, key string, rev int64, recursive, progressNotify, recordTimestamps bool, pred storage.SelectionPredicate) *watchChan { wc := &watchChan{ watcher: w, key: key, initialRev: rev, recursive: recursive, progressNotify: progressNotify, + recordTimestamps: recordTimestamps, internalPred: pred, incomingEventChan: make(chan *event, incomingBufSize), resultChan: make(chan watch.Event, outgoingBufSize), @@ -144,6 +167,10 @@ func (w *watcher) createWatchChan(ctx context.Context, key string, rev int64, re wc.internalPred = storage.Everything } wc.ctx, wc.cancel = context.WithCancel(ctx) + + wc.incomingEventLogger = newBlockLogger(watchChanLogWarningInterval, watchChanLogWarningThreshold, "Fast watcher, slow processing. Probably caused by slow decoding, user not receiving fast, or other processing logic", wc.watcher.objectType, wc.watcher.groupResource, clock.RealClock{}) + wc.resultLogger = newBlockLogger(watchChanLogWarningInterval, watchChanLogWarningThreshold, "Fast watcher, slow processing. Probably caused by slow dispatching events to watchers", wc.watcher.objectType, wc.watcher.groupResource, clock.RealClock{}) + return wc } @@ -269,6 +296,22 @@ func (wc *watchChan) RequestWatchProgress() error { // The revision to watch will be set to the revision in response. // All events sent will have isCreated=true func (wc *watchChan) sync() error { + if wc.recursive && utilfeature.DefaultFeatureGate.Enabled(features.EtcdRangeStream) && + etcdfeature.DefaultFeatureSupportChecker.Supports(storage.RangeStream) { + err := wc.syncStreamRecursive() + if err == nil { + return nil + } + if grpcstatus.Code(err) != grpccodes.Unimplemented { + return err + } + etcdfeature.DefaultFeatureSupportChecker.MarkUnsupported(storage.RangeStream) + klog.V(4).Infof("etcd server does not support RangeStream for %v; falling back to paginated list", wc.watcher.groupResource) + } + return wc.syncPaginated() +} + +func (wc *watchChan) syncPaginated() error { opts := []clientv3.OpOption{} if wc.recursive { opts = append(opts, clientv3.WithLimit(defaultWatcherMaxLimit)) @@ -325,6 +368,52 @@ func (wc *watchChan) sync() error { } } +func (wc *watchChan) syncStreamRecursive() error { + if !wc.recursive { + return fmt.Errorf("syncStreamRecursive called on a non-recursive watch") + } + opts := []clientv3.OpOption{ + clientv3.WithRange(clientv3.GetPrefixRangeEnd(wc.key)), + } + + startTime := time.Now() + streamResp, err := wc.watcher.client.KV.GetStream(wc.ctx, wc.key, opts...) + if err != nil { + return err + } + defer func() { + // Only record the listStream metric if streaming was actually exercised. + if grpcstatus.Code(err) == grpccodes.Unimplemented { + return + } + metrics.RecordEtcdRequest("listStream", wc.watcher.groupResource, err, startTime) + }() + + var initialRev int64 + for r := range streamResp { + if err = r.Err(); err != nil { + // paging=false: a compaction mid-stream can't be resumed with a + // continue token, so surface it as ResourceExpired for a relist. + return interpretListError(err, false, wc.key, wc.key) + } + rangeResp := r.RangeResponse + for i, kv := range rangeResp.Kvs { + wc.queueEvent(parseKV(kv)) + // free kv early. Long lists can take O(seconds) to decode. + rangeResp.Kvs[i] = nil + } + if initialRev == 0 && rangeResp.Header != nil { + initialRev = rangeResp.Header.Revision + } + } + if initialRev == 0 { + return fmt.Errorf("rangeStream for %q completed without a revision", wc.key) + } + + wc.initialRev = initialRev + return nil +} + func logWatchChannelErr(err error) { switch { case strings.Contains(err.Error(), "mvcc: required revision has been compacted"): @@ -614,7 +703,7 @@ func (wc *watchChan) transform(e *event) (res *watch.Event, err error) { Type: watch.Modified, Object: curObj, } - return res, nil + break } curObjPasses := wc.filter(curObj) oldObjPasses := wc.filter(oldObj) @@ -636,9 +725,41 @@ func (wc *watchChan) transform(e *event) (res *watch.Event, err error) { } } } + if res != nil && wc.recordTimestamps && !e.isInitialEvent { + res.Object = &timedWatchEvent{Object: res.Object, recordTime: e.recordTime} + } return res, nil } +// timedWatchEvent wraps a decoded watch object with the timestamp at which the +// storage layer decoded it, so the watch cache can measure end-to-end dispatch +// latency. It exists only on the watch cache's ingest path (opened with +// ListOptions.RecordTimestamps) and MUST be unwrapped by the watch cache before +// the object is stored or serialized. +type timedWatchEvent struct { + runtime.Object + recordTime time.Time +} + +var _ storage.WatchEventWithRecordTime = &timedWatchEvent{} + +func (t *timedWatchEvent) GetObjectMeta() metav1.Object { + m, _ := meta.Accessor(t.Object) + return m +} + +func (t *timedWatchEvent) DeepCopyObject() runtime.Object { + return &timedWatchEvent{Object: t.Object.DeepCopyObject(), recordTime: t.recordTime} +} + +func (t *timedWatchEvent) RecordTime() time.Time { + return t.recordTime +} + +func (t *timedWatchEvent) Unwrap() runtime.Object { + return t.Object +} + func transformErrorToEvent(err error) *watch.Event { err = interpretWatchError(err) if _, ok := err.(apierrors.APIStatus); !ok { @@ -674,9 +795,8 @@ func (wc *watchChan) sendError(err error) { // sendEvent synchronously puts an event into resultChan. // Returns true if it was successful. func (wc *watchChan) sendEvent(event *watch.Event) bool { - if len(wc.resultChan) == cap(wc.resultChan) { - klog.V(3).InfoS("Fast watcher, slow processing. Probably caused by slow dispatching events to watchers", "outgoingEvents", outgoingBufSize, "objectType", wc.watcher.objectType, "groupResource", wc.watcher.groupResource) - } + defer func(start time.Time) { wc.resultLogger.recordWait(time.Since(start)) }(time.Now()) + // If user couldn't receive results fast enough, we also block incoming events from watcher. // Because storing events in local will cause more memory usage. // The worst case would be closing the fast watcher. @@ -689,9 +809,8 @@ func (wc *watchChan) sendEvent(event *watch.Event) bool { } func (wc *watchChan) queueEvent(e *event) { - if len(wc.incomingEventChan) == incomingBufSize { - klog.V(3).InfoS("Fast watcher, slow processing. Probably caused by slow decoding, user not receiving fast, or other processing logic", "incomingEvents", incomingBufSize, "objectType", wc.watcher.objectType, "groupResource", wc.watcher.groupResource) - } + defer func(start time.Time) { wc.incomingEventLogger.recordWait(time.Since(start)) }(time.Now()) + select { case wc.incomingEventChan <- e: case <-wc.ctx.Done(): diff --git a/vendor/k8s.io/apiserver/pkg/storage/feature/feature_support_checker.go b/vendor/k8s.io/apiserver/pkg/storage/feature/feature_support_checker.go index e664d22a64..cf42c70dd0 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/feature/feature_support_checker.go +++ b/vendor/k8s.io/apiserver/pkg/storage/feature/feature_support_checker.go @@ -28,6 +28,7 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apiserver/pkg/storage" "k8s.io/klog/v2" + "k8s.io/utils/clock" "k8s.io/utils/ptr" ) @@ -41,14 +42,17 @@ var ( DefaultFeatureSupportChecker FeatureSupportChecker = newDefaultFeatureSupportChecker() ) +// rangeStreamRecheckInterval is how long RangeStream stays marked unsupported +// before Supports reports it supported again. See storage.RangeStream. +const rangeStreamRecheckInterval = 10 * time.Minute + // FeatureSupportChecker to define Supports functions. type FeatureSupportChecker interface { - // Supports check if the feature is supported or not by checking internal cache. - // By default all calls to this function before calling CheckClient returns false. - // Returns true if all endpoints in etcd clients are supporting the feature. - // If client A supports and client B doesn't support the feature, the `Supports` will - // first return true at client A initializtion and then return false on client B - // initialzation, it can flip the support at runtime. + // Supports reports whether the etcd backend supports the given feature, from + // the result cached by CheckClient/MarkUnsupported. Before support is known it + // returns the feature's default, documented on the Feature constants (see + // storage.RequestWatchProgress and storage.RangeStream). Support can flip at + // runtime as endpoints are checked. Supports(feature storage.Feature) bool // CheckClient works with etcd client to recalcualte feature support and cache it internally. // All etcd clients should support feature to cause `Supports` return true. @@ -56,20 +60,33 @@ type FeatureSupportChecker interface { // first return true at client A initializtion and then return false on client B // initialzation, it can flip the support at runtime. CheckClient(ctx context.Context, c client, feature storage.Feature) + // MarkUnsupported records that an etcd endpoint reported the feature + // unimplemented. See the Feature constants for per-feature recheck behavior + // (e.g. storage.RangeStream). + MarkUnsupported(feature storage.Feature) } type defaultFeatureSupportChecker struct { - lock sync.Mutex - progressNotifySupported *bool - checkingEndpoint map[string]struct{} + lock sync.Mutex + progressNotifySupported *bool + rangeStreamUnsupportedAt time.Time + clock clock.Clock + checkingEndpoint map[string]struct{} } func newDefaultFeatureSupportChecker() *defaultFeatureSupportChecker { return &defaultFeatureSupportChecker{ checkingEndpoint: make(map[string]struct{}), + clock: clock.RealClock{}, } } +// NewDefaultFeatureSupportChecker returns a new FeatureSupportChecker. +// DefaultFeatureSupportChecker is the shared instance used by the storage layer. +func NewDefaultFeatureSupportChecker() FeatureSupportChecker { + return newDefaultFeatureSupportChecker() +} + // Supports can check the featue from anywhere without storage if it was cached before. func (f *defaultFeatureSupportChecker) Supports(feature storage.Feature) bool { switch feature { @@ -78,6 +95,14 @@ func (f *defaultFeatureSupportChecker) Supports(feature storage.Feature) bool { defer f.lock.Unlock() return ptr.Deref(f.progressNotifySupported, false) + case storage.RangeStream: + f.lock.Lock() + defer f.lock.Unlock() + + if f.rangeStreamUnsupportedAt.IsZero() { + return true + } + return f.clock.Since(f.rangeStreamUnsupportedAt) >= rangeStreamRecheckInterval default: runtime.HandleError(fmt.Errorf("feature %q is not implemented in DefaultFeatureSupportChecker", feature)) return false @@ -94,6 +119,17 @@ func (f *defaultFeatureSupportChecker) CheckClient(ctx context.Context, c client } } +func (f *defaultFeatureSupportChecker) MarkUnsupported(feature storage.Feature) { + switch feature { + case storage.RangeStream: + f.lock.Lock() + defer f.lock.Unlock() + f.rangeStreamUnsupportedAt = f.clock.Now() + default: + runtime.HandleError(fmt.Errorf("feature %q is not implemented in DefaultFeatureSupportChecker", feature)) + } +} + func (f *defaultFeatureSupportChecker) checkClient(ctx context.Context, c client) { // start with 10 ms, multiply by 2 each step, until 15 s and stays on 15 seconds. delayFunc := wait.Backoff{ diff --git a/vendor/k8s.io/apiserver/pkg/storage/interfaces.go b/vendor/k8s.io/apiserver/pkg/storage/interfaces.go index be9980cfc7..0545d3acd0 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/interfaces.go +++ b/vendor/k8s.io/apiserver/pkg/storage/interfaces.go @@ -20,6 +20,7 @@ import ( "context" "fmt" "strings" + "time" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" @@ -34,9 +35,15 @@ import ( // Feature is the name of each feature in storage that we check in feature_support_checker. type Feature = string -// RequestWatchProgress is an etcd feature that may use to check if it supported or not. +// RequestWatchProgress is an etcd feature for progress notification requests. +// Default: false. var RequestWatchProgress Feature = "RequestWatchProgress" +// RangeStream is an etcd feature (etcd 3.7+) for the streaming list RPC. +// Default: true. MarkUnsupported flips it to false on an Unimplemented response, +// reverting to true after a recheck interval. +var RangeStream Feature = "RangeStream" + // Versioner abstracts setting and retrieving metadata fields from database response // onto the object ot list. It is required to maintain storage invariants - updating an // object twice with the same data except for the ResourceVersion and SelfLink must be @@ -330,17 +337,35 @@ type ListOptions struct { // event containing a ResourceVersion after which the server // continues streaming events. SendInitialEvents *bool + // RecordTimestamps requests that the storage layer wrap each emitted watch + // object in a WatchEventWithRecordTime carrying its decode timestamp, for dispatch + // latency telemetry. This is intended for internal clients only (the watch + // cache); external clients cannot set it. The watch cache strips the wrapper + // before storing or serializing the object, so it never reaches other watchers. + RecordTimestamps bool +} + +// WatchEventWithRecordTime wraps a runtime.Object with the timestamp at which the +// storage layer decoded the corresponding watch event. It is produced by the +// storage layer only when ListOptions.RecordTimestamps is set, and is consumed +// and stripped by the watch cache before the underlying object is stored or +// serialized. It is never sent to watch clients. +type WatchEventWithRecordTime interface { + runtime.Object + // RecordTime returns the decode timestamp of the wrapped event. + RecordTime() time.Time + // Unwrap returns the underlying object. + Unwrap() runtime.Object } // DeleteOptions provides the options that may be provided for storage delete operations. type DeleteOptions struct { - // IgnoreStoreReadError, if enabled, will ignore store read error - // such as transformation or decode failure and go ahead with the - // deletion of the object. + // ExpectTransformOrDecodeError, if enabled, will return an error if the object can be + // transformed and decoded. // NOTE: for normal deletion flow it should always be false, it may be // enabled by the caller only to facilitate unsafe deletion of corrupt // object which otherwise can not be deleted using the normal flow - IgnoreStoreReadError bool + ExpectTransformOrDecodeError bool } func ValidateListOptions(keyPrefix string, versioner Versioner, opts ListOptions) (withRev int64, continueKey string, err error) { diff --git a/vendor/k8s.io/apiserver/pkg/storage/metrics/OWNERS b/vendor/k8s.io/apiserver/pkg/storage/metrics/OWNERS new file mode 100644 index 0000000000..b26e7a4dc7 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/storage/metrics/OWNERS @@ -0,0 +1,8 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: + - sig-instrumentation-approvers +reviewers: + - sig-instrumentation-reviewers +labels: + - sig/instrumentation diff --git a/vendor/k8s.io/apiserver/pkg/storage/metrics/metrics.go b/vendor/k8s.io/apiserver/pkg/storage/metrics/metrics.go new file mode 100644 index 0000000000..e86d1d5263 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/storage/metrics/metrics.go @@ -0,0 +1,84 @@ +/* +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. +*/ + +package metrics + +import ( + "sync" + + "k8s.io/apimachinery/pkg/runtime/schema" + compbasemetrics "k8s.io/component-base/metrics" + "k8s.io/component-base/metrics/legacyregistry" +) + +const ( + StorageBackendEtcd = "etcd" + StorageBackendWatchCache = "watchcache" +) + +var ( + listStorageCount = compbasemetrics.NewCounterVec( + &compbasemetrics.CounterOpts{ + Name: "apiserver_storage_list_total", + Help: "Number of LIST requests served from storage", + StabilityLevel: compbasemetrics.ALPHA, + }, + []string{"group", "resource", "storage", "index"}, + ) + listStorageNumFetched = compbasemetrics.NewCounterVec( + &compbasemetrics.CounterOpts{ + Name: "apiserver_storage_list_fetched_objects_total", + Help: "Number of objects read from storage in the course of serving a LIST request", + StabilityLevel: compbasemetrics.ALPHA, + }, + []string{"group", "resource", "storage", "index"}, + ) + listStorageNumSelectorEvals = compbasemetrics.NewCounterVec( + &compbasemetrics.CounterOpts{ + Name: "apiserver_storage_list_evaluated_objects_total", + Help: "Number of objects tested in the course of serving a LIST request from storage", + StabilityLevel: compbasemetrics.ALPHA, + }, + []string{"group", "resource", "storage"}, + ) + listStorageNumReturned = compbasemetrics.NewCounterVec( + &compbasemetrics.CounterOpts{ + Name: "apiserver_storage_list_returned_objects_total", + Help: "Number of objects returned for a LIST request from storage", + StabilityLevel: compbasemetrics.ALPHA, + }, + []string{"group", "resource", "storage"}, + ) + registerMetrics sync.Once +) + +// Register registers storage LIST metrics. +func Register() { + registerMetrics.Do(func() { + legacyregistry.MustRegister(listStorageCount) + legacyregistry.MustRegister(listStorageNumFetched) + legacyregistry.MustRegister(listStorageNumSelectorEvals) + legacyregistry.MustRegister(listStorageNumReturned) + }) +} + +// RecordStorageListMetrics notes various metrics of the cost to serve a LIST request. +func RecordStorageListMetrics(groupResource schema.GroupResource, storageBackend, index string, numFetched, numEvald, numReturned int) { + listStorageCount.WithLabelValues(groupResource.Group, groupResource.Resource, storageBackend, index).Inc() + listStorageNumFetched.WithLabelValues(groupResource.Group, groupResource.Resource, storageBackend, index).Add(float64(numFetched)) + listStorageNumSelectorEvals.WithLabelValues(groupResource.Group, groupResource.Resource, storageBackend).Add(float64(numEvald)) + listStorageNumReturned.WithLabelValues(groupResource.Group, groupResource.Resource, storageBackend).Add(float64(numReturned)) +} diff --git a/vendor/k8s.io/apiserver/pkg/storage/selection_predicate.go b/vendor/k8s.io/apiserver/pkg/storage/selection_predicate.go index 37d470b254..5bb7bdb920 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/selection_predicate.go +++ b/vendor/k8s.io/apiserver/pkg/storage/selection_predicate.go @@ -99,7 +99,7 @@ func (s *SelectionPredicate) Matches(obj runtime.Object) (bool, error) { return matched, err } } - if s.Empty() { + if s.labelFieldEmpty() { return true, nil } labels, fields, err := s.GetAttrs(obj) @@ -153,7 +153,17 @@ func (s *SelectionPredicate) MatchesSingle() (string, bool) { // Empty returns true if the predicate performs no filtering. func (s *SelectionPredicate) Empty() bool { - return s.Label.Empty() && s.Field.Empty() + // Check the selector before the feature gate: Empty is called per event on + // watch paths, and the nil check is free while the gate lookup is not. + if s.ShardSelector != nil && !s.ShardSelector.Empty() && + utilfeature.DefaultFeatureGate.Enabled(features.ShardedListAndWatch) { + return false + } + return s.labelFieldEmpty() +} + +func (s *SelectionPredicate) labelFieldEmpty() bool { + return (s.Label == nil || s.Label.Empty()) && (s.Field == nil || s.Field.Empty()) } // For any index defined by IndexFields, if a matcher can match only (a subset) diff --git a/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/etcd3.go b/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/etcd3.go index 6b60601a78..abe4d0f1e2 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/etcd3.go +++ b/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/etcd3.go @@ -39,7 +39,7 @@ import ( "go.uber.org/zap/zapcore" "golang.org/x/time/rate" "google.golang.org/grpc" - "k8s.io/klog/v2" + "google.golang.org/grpc/connectivity" "k8s.io/apimachinery/pkg/runtime" utilnet "k8s.io/apimachinery/pkg/util/net" @@ -67,8 +67,6 @@ const ( // It is set to 20 seconds as times shorter than that will cause TLS connections to fail // on heavily loaded arm64 CPUs (issue #64649) dialTimeout = 20 * time.Second - - dbMetricsMonitorJitter = 0.5 ) // TODO(negz): Stop using a package scoped logger. At the time of writing we're @@ -88,7 +86,6 @@ func init() { // metrics to our global registry here. // For reference: https://github.com/kubernetes/kubernetes/pull/81387 legacyregistry.RawMustRegister(grpcpromClientMetrics) - dbMetricsMonitors = make(map[string]struct{}) l, err := logutil.CreateDefaultZapLogger(etcdClientDebugLevel()) if err != nil { @@ -310,7 +307,6 @@ var newETCD3Client = func(c storagebackend.TransportConfig) (*kubernetes.Client, } } dialOptions := []grpc.DialOption{ - grpc.WithBlock(), // block until the underlying connection is up // use chained interceptors so that the default (retry and backoff) interceptors are added. // otherwise they will be overwritten by the metric interceptor. // @@ -319,17 +315,15 @@ var newETCD3Client = func(c storagebackend.TransportConfig) (*kubernetes.Client, grpc.WithChainUnaryInterceptor(grpcpromClientMetrics.UnaryClientInterceptor()), grpc.WithChainStreamInterceptor(grpcpromClientMetrics.StreamClientInterceptor()), } - if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.APIServerTracing) { - tracingOpts := []otelgrpc.Option{ - otelgrpc.WithMessageEvents(otelgrpc.ReceivedEvents, otelgrpc.SentEvents), - otelgrpc.WithPropagators(tracing.Propagators()), - otelgrpc.WithTracerProvider(c.TracerProvider), - } - // Even with Noop TracerProvider, the otelgrpc still handles context propagation. - // See https://github.com/open-telemetry/opentelemetry-go/tree/main/example/passthrough - dialOptions = append(dialOptions, - grpc.WithStatsHandler(otelgrpc.NewClientHandler(tracingOpts...))) + tracingOpts := []otelgrpc.Option{ + otelgrpc.WithMessageEvents(otelgrpc.ReceivedEvents, otelgrpc.SentEvents), + otelgrpc.WithPropagators(tracing.Propagators()), + otelgrpc.WithTracerProvider(c.TracerProvider), } + // Even with Noop TracerProvider, the otelgrpc still handles context propagation. + // See https://github.com/open-telemetry/opentelemetry-go/tree/main/example/passthrough + dialOptions = append(dialOptions, + grpc.WithStatsHandler(otelgrpc.NewClientHandler(tracingOpts...))) if egressDialer != nil { dialer := func(ctx context.Context, addr string) (net.Conn, error) { if strings.Contains(addr, "//") { @@ -355,7 +349,42 @@ var newETCD3Client = func(c storagebackend.TransportConfig) (*kubernetes.Client, Logger: etcd3ClientLogger, } - return kubernetes.New(cfg) + kClient, err := kubernetes.New(cfg) + if err != nil { + return nil, err + } + + if err := blockUntilReady(dialTimeout, kClient); err != nil { + return nil, err + } + + return kClient, nil +} + +func blockUntilReady(timeout time.Duration, client *kubernetes.Client) error { + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() + + conn := client.Client.ActiveConnection() + if conn == nil { + return fmt.Errorf("no grpc connection") + } + + for { + currentState := conn.GetState() + if currentState == connectivity.Ready { + // ready, return + return nil + } + if currentState == connectivity.Idle { + // attempt connect + conn.Connect() + } + // wait for state change from currentState until context times out + if !conn.WaitForStateChange(ctx, currentState) { + return fmt.Errorf("etcd grpc connection not ready: %w", ctx.Err()) + } + } } type runningCompactor struct { @@ -370,9 +399,6 @@ var ( // compactorsMu guards access to compactors map compactorsMu sync.Mutex compactors = map[string]*runningCompactor{} - // dbMetricsMonitorsMu guards access to dbMetricsMonitors map - dbMetricsMonitorsMu sync.Mutex - dbMetricsMonitors map[string]struct{} ) // startCompactorOnce start one compactor per transport. If the interval get smaller on repeated calls, the @@ -441,13 +467,6 @@ func newETCD3Storage(c storagebackend.ConfigForResource, newFunc, newListFunc fu // decorate the KV instance so we can track etcd latency per request. client.KV = etcd3.NewETCDLatencyTracker(client.KV) - stopDBSizeMonitor, err := startDBSizeMonitorPerEndpoint(client.Client, c.DBMetricPollInterval) - if err != nil { - stopCompactor() - _ = client.Close() - return nil, nil, err - } - transformer := c.Transformer if transformer == nil { transformer = identity.NewEncryptCheckTransformer() @@ -463,7 +482,6 @@ func newETCD3Storage(c storagebackend.ConfigForResource, newFunc, newListFunc fu store, err := etcd3.New(client, compactor, c.Codec, newFunc, newListFunc, c.Prefix, resourcePrefix, c.GroupResource, transformer, c.LeaseManagerConfig, decoder, versioner) if err != nil { stopCompactor() - stopDBSizeMonitor() _ = client.Close() return nil, nil, err } @@ -474,7 +492,6 @@ func newETCD3Storage(c storagebackend.ConfigForResource, newFunc, newListFunc fu // TODO: fix duplicated storage destroy calls higher level once.Do(func() { stopCompactor() - stopDBSizeMonitor() store.Close() _ = client.Close() }) @@ -485,37 +502,3 @@ func newETCD3Storage(c storagebackend.ConfigForResource, newFunc, newListFunc fu } return storage, destroyFunc, nil } - -// startDBSizeMonitorPerEndpoint starts a loop to monitor etcd database size and update the -// corresponding metric etcd_db_total_size_in_bytes for each etcd server endpoint. -// Deprecated: Will be replaced with newETCD3ProberMonitor -func startDBSizeMonitorPerEndpoint(client *clientv3.Client, interval time.Duration) (func(), error) { - if interval == 0 { - return func() {}, nil - } - dbMetricsMonitorsMu.Lock() - defer dbMetricsMonitorsMu.Unlock() - - ctx, cancel := context.WithCancel(context.Background()) - for _, ep := range client.Endpoints() { - if _, found := dbMetricsMonitors[ep]; found { - continue - } - dbMetricsMonitors[ep] = struct{}{} - endpoint := ep - klog.V(4).Infof("Start monitoring storage db size metric for endpoint %s with polling interval %v", endpoint, interval) - go wait.JitterUntilWithContext(ctx, func(context.Context) { - epStatus, err := client.Maintenance.Status(ctx, endpoint) - if err != nil { - klog.V(4).Infof("Failed to get storage db size for ep %s: %v", endpoint, err) - metrics.UpdateEtcdDbSize(endpoint, -1) - } else { - metrics.UpdateEtcdDbSize(endpoint, epStatus.DbSize) - } - }, interval, dbMetricsMonitorJitter, true) - } - - return func() { - cancel() - }, nil -} diff --git a/vendor/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/v2/api.pb.go b/vendor/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/v2/api.pb.go index 1fb57e21c0..486b9690fd 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/v2/api.pb.go +++ b/vendor/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/v2/api.pb.go @@ -33,7 +33,7 @@ limitations under the License. // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.4 +// protoc-gen-go v1.36.11 // protoc v4.23.4 // source: staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/v2/api.proto @@ -199,45 +199,21 @@ func (x *EncryptedObject) GetEncryptedDEKSourceType() EncryptedDEKSourceType { var File_staging_src_k8s_io_apiserver_pkg_storage_value_encrypt_envelope_kmsv2_v2_api_proto protoreflect.FileDescriptor -var file_staging_src_k8s_io_apiserver_pkg_storage_value_encrypt_envelope_kmsv2_v2_api_proto_rawDesc = string([]byte{ - 0x0a, 0x52, 0x73, 0x74, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x2f, 0x73, 0x72, 0x63, 0x2f, 0x6b, 0x38, - 0x73, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, - 0x6b, 0x67, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x2f, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x2f, 0x65, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, - 0x65, 0x2f, 0x6b, 0x6d, 0x73, 0x76, 0x32, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x76, 0x32, 0x22, 0xd9, 0x02, 0x0a, 0x0f, 0x45, 0x6e, 0x63, - 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x24, 0x0a, 0x0d, - 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x44, 0x61, - 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x44, 0x12, 0x2e, 0x0a, 0x12, 0x65, 0x6e, 0x63, 0x72, - 0x79, 0x70, 0x74, 0x65, 0x64, 0x44, 0x45, 0x4b, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x12, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x44, - 0x45, 0x4b, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x46, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, - 0x76, 0x32, 0x2e, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x4f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x12, 0x52, 0x0a, 0x16, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x44, 0x45, 0x4b, - 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x1a, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x44, - 0x45, 0x4b, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x16, 0x65, 0x6e, - 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x44, 0x45, 0x4b, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x4e, 0x0a, 0x16, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, - 0x64, 0x44, 0x45, 0x4b, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, - 0x0a, 0x0b, 0x41, 0x45, 0x53, 0x5f, 0x47, 0x43, 0x4d, 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x00, 0x12, - 0x23, 0x0a, 0x1f, 0x48, 0x4b, 0x44, 0x46, 0x5f, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x5f, 0x58, - 0x4e, 0x4f, 0x4e, 0x43, 0x45, 0x5f, 0x41, 0x45, 0x53, 0x5f, 0x47, 0x43, 0x4d, 0x5f, 0x53, 0x45, - 0x45, 0x44, 0x10, 0x01, 0x42, 0x3e, 0x5a, 0x3c, 0x6b, 0x38, 0x73, 0x2e, 0x69, 0x6f, 0x2f, 0x61, - 0x70, 0x69, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2f, 0x65, 0x6e, 0x63, 0x72, 0x79, - 0x70, 0x74, 0x2f, 0x65, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x2f, 0x6b, 0x6d, 0x73, 0x76, - 0x32, 0x2f, 0x76, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -}) +const file_staging_src_k8s_io_apiserver_pkg_storage_value_encrypt_envelope_kmsv2_v2_api_proto_rawDesc = "" + + "\n" + + "Rstaging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/v2/api.proto\x12\x02v2\"\xd9\x02\n" + + "\x0fEncryptedObject\x12$\n" + + "\rencryptedData\x18\x01 \x01(\fR\rencryptedData\x12\x14\n" + + "\x05keyID\x18\x02 \x01(\tR\x05keyID\x12.\n" + + "\x12encryptedDEKSource\x18\x03 \x01(\fR\x12encryptedDEKSource\x12F\n" + + "\vannotations\x18\x04 \x03(\v2$.v2.EncryptedObject.AnnotationsEntryR\vannotations\x12R\n" + + "\x16encryptedDEKSourceType\x18\x05 \x01(\x0e2\x1a.v2.EncryptedDEKSourceTypeR\x16encryptedDEKSourceType\x1a>\n" + + "\x10AnnotationsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\fR\x05value:\x028\x01*N\n" + + "\x16EncryptedDEKSourceType\x12\x0f\n" + + "\vAES_GCM_KEY\x10\x00\x12#\n" + + "\x1fHKDF_SHA256_XNONCE_AES_GCM_SEED\x10\x01B>Z 0 { - ret.FieldSelector = &authorizationv1.FieldSelectorAttributes{ - Requirements: selectorRequirements, - } + // If we are able to get any requirements while parsing selectors, use them, even if there's an error. + // This is because selectors only narrow, so if a subset of selector requirements are available, the request can be allowed. + if selectorRequirements, _ := fieldSelectorToAuthorizationAPI(attr); len(selectorRequirements) > 0 { + ret.FieldSelector = &authorizationv1.FieldSelectorAttributes{ + Requirements: selectorRequirements, } + } - if selectorRequirements, _ := labelSelectorToAuthorizationAPI(attr); len(selectorRequirements) > 0 { - ret.LabelSelector = &authorizationv1.LabelSelectorAttributes{ - Requirements: selectorRequirements, - } + if selectorRequirements, _ := labelSelectorToAuthorizationAPI(attr); len(selectorRequirements) > 0 { + ret.LabelSelector = &authorizationv1.LabelSelectorAttributes{ + Requirements: selectorRequirements, } } diff --git a/vendor/k8s.io/client-go/applyconfigurations/OWNERS b/vendor/k8s.io/client-go/applyconfigurations/OWNERS index de4067fd35..8bea129e9a 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/OWNERS +++ b/vendor/k8s.io/client-go/applyconfigurations/OWNERS @@ -1,6 +1,7 @@ # See the OWNERS docs at https://go.k8s.io/owners approvers: - - apelisse - jpbetz - api-approvers +emeritus_approvers: + - apelisse diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicy.go index f99f055b3c..ae3d2f1fc2 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicy.go @@ -32,7 +32,7 @@ import ( // // MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain. type MutatingAdmissionPolicyApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec defines the desired behavior of the MutatingAdmissionPolicy. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicybinding.go index 4bb30baa6f..bea8a4a0f6 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicybinding.go @@ -42,7 +42,7 @@ import ( // Adding/removing policies, bindings, or params can not affect whether a // given (policy, binding, param) combination is within its own CEL budget. type MutatingAdmissionPolicyBindingApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec defines the desired behavior of the MutatingAdmissionPolicyBinding. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go index dcb0b81cca..926f15936f 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go @@ -32,7 +32,7 @@ import ( // // MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object. type MutatingWebhookConfigurationApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // webhooks is a list of webhooks and the affected resources and operations. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/namedrulewithoperations.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/namedrulewithoperations.go index 326337c8cc..aaffe6cc1d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/namedrulewithoperations.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/namedrulewithoperations.go @@ -30,7 +30,7 @@ type NamedRuleWithOperationsApplyConfiguration struct { // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. ResourceNames []string `json:"resourceNames,omitempty"` // RuleWithOperations is a tuple of Operations and Resources. - RuleWithOperationsApplyConfiguration `json:",inline"` + RuleWithOperationsApplyConfiguration `json:""` } // NamedRuleWithOperationsApplyConfiguration constructs a declarative configuration of the NamedRuleWithOperations type for use with diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/rulewithoperations.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/rulewithoperations.go index 575e1ab35c..6692ef9393 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/rulewithoperations.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/rulewithoperations.go @@ -35,7 +35,7 @@ type RuleWithOperationsApplyConfiguration struct { Operations []admissionregistrationv1.OperationType `json:"operations,omitempty"` // Rule is embedded, it describes other criteria of the rule, like // APIGroups, APIVersions, Resources, etc. - RuleApplyConfiguration `json:",inline"` + RuleApplyConfiguration `json:""` } // RuleWithOperationsApplyConfiguration constructs a declarative configuration of the RuleWithOperations type for use with diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicy.go index 6e06ed3e5f..a007d50570 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicy.go @@ -32,7 +32,7 @@ import ( // // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. type ValidatingAdmissionPolicyApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec defines the desired behavior of the ValidatingAdmissionPolicy. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicybinding.go index 590aabda81..8fcc72c6db 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicybinding.go @@ -42,7 +42,7 @@ import ( // Adding/removing policies, bindings, or params can not affect whether a // given (policy, binding, param) combination is within its own CEL budget. type ValidatingAdmissionPolicyBindingApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec defines the desired behavior of the ValidatingAdmissionPolicyBinding. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go index c3ac1fafdd..d668f26def 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go @@ -32,7 +32,7 @@ import ( // // ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it. type ValidatingWebhookConfigurationApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // webhooks is a list of webhooks and the affected resources and operations. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/mutatingadmissionpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/mutatingadmissionpolicy.go index 678e4d612a..4c0ceff12f 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/mutatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/mutatingadmissionpolicy.go @@ -32,7 +32,7 @@ import ( // // MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain. type MutatingAdmissionPolicyApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec defines the desired behavior of the MutatingAdmissionPolicy. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/mutatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/mutatingadmissionpolicybinding.go index 5286ce24c5..1242180907 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/mutatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/mutatingadmissionpolicybinding.go @@ -42,7 +42,7 @@ import ( // Adding/removing policies, bindings, or params can not affect whether a // given (policy, binding, param) combination is within its own CEL budget. type MutatingAdmissionPolicyBindingApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec defines the desired behavior of the MutatingAdmissionPolicyBinding. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/namedrulewithoperations.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/namedrulewithoperations.go index 45c12f191d..5caf9c5717 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/namedrulewithoperations.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/namedrulewithoperations.go @@ -31,7 +31,7 @@ type NamedRuleWithOperationsApplyConfiguration struct { // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. ResourceNames []string `json:"resourceNames,omitempty"` // RuleWithOperations is a tuple of Operations and Resources. - v1.RuleWithOperationsApplyConfiguration `json:",inline"` + v1.RuleWithOperationsApplyConfiguration `json:""` } // NamedRuleWithOperationsApplyConfiguration constructs a declarative configuration of the NamedRuleWithOperations type for use with diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicy.go index 9191eaab20..6a591f4d5d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicy.go @@ -32,7 +32,7 @@ import ( // // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. type ValidatingAdmissionPolicyApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec defines the desired behavior of the ValidatingAdmissionPolicy. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicybinding.go index ad61dad084..0db11e2b07 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicybinding.go @@ -42,7 +42,7 @@ import ( // Adding/removing policies, bindings, or params can not affect whether a // given (policy, binding, param) combination is within its own CEL budget. type ValidatingAdmissionPolicyBindingApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec defines the desired behavior of the ValidatingAdmissionPolicyBinding. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingadmissionpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingadmissionpolicy.go index 9dbdd7dbd9..64ac2a936c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingadmissionpolicy.go @@ -32,7 +32,7 @@ import ( // // MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain. type MutatingAdmissionPolicyApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec defines the desired behavior of the MutatingAdmissionPolicy. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingadmissionpolicybinding.go index 560d1b1469..7aeacf4f42 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingadmissionpolicybinding.go @@ -42,7 +42,7 @@ import ( // Adding/removing policies, bindings, or params can not affect whether a // given (policy, binding, param) combination is within its own CEL budget. type MutatingAdmissionPolicyBindingApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec defines the desired behavior of the MutatingAdmissionPolicyBinding. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go index 63bce15404..5668e07c89 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go @@ -33,7 +33,7 @@ import ( // MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object. // Deprecated in v1.16, planned for removal in v1.19. Use admissionregistration.k8s.io/v1 MutatingWebhookConfiguration instead. type MutatingWebhookConfigurationApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // webhooks is a list of webhooks and the affected resources and operations. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/namedrulewithoperations.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/namedrulewithoperations.go index 0da66790cc..20a327cccd 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/namedrulewithoperations.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/namedrulewithoperations.go @@ -31,7 +31,7 @@ type NamedRuleWithOperationsApplyConfiguration struct { // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. ResourceNames []string `json:"resourceNames,omitempty"` // RuleWithOperations is a tuple of Operations and Resources. - v1.RuleWithOperationsApplyConfiguration `json:",inline"` + v1.RuleWithOperationsApplyConfiguration `json:""` } // NamedRuleWithOperationsApplyConfiguration constructs a declarative configuration of the NamedRuleWithOperations type for use with diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicy.go index bc1ad6473a..e727943350 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicy.go @@ -32,7 +32,7 @@ import ( // // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. type ValidatingAdmissionPolicyApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec defines the desired behavior of the ValidatingAdmissionPolicy. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicybinding.go index fd658f9a45..d202ccb73c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicybinding.go @@ -42,7 +42,7 @@ import ( // Adding/removing policies, bindings, or params can not affect whether a // given (policy, binding, param) combination is within its own CEL budget. type ValidatingAdmissionPolicyBindingApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec defines the desired behavior of the ValidatingAdmissionPolicyBinding. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go index dd53f3b334..cf4440d8ca 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go @@ -33,7 +33,7 @@ import ( // ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it. // Deprecated in v1.16, planned for removal in v1.19. Use admissionregistration.k8s.io/v1 ValidatingWebhookConfiguration instead. type ValidatingWebhookConfigurationApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // webhooks is a list of webhooks and the affected resources and operations. diff --git a/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go b/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go index 46b2349b1d..236f0d6652 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go @@ -32,7 +32,7 @@ import ( // // Storage version of a specific resource. type StorageVersionApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // metadata is the standard object metadata. // The name is .. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/apps/v1/controllerrevision.go b/vendor/k8s.io/client-go/applyconfigurations/apps/v1/controllerrevision.go index 8a01c0d754..1e4b09060e 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apps/v1/controllerrevision.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apps/v1/controllerrevision.go @@ -41,7 +41,7 @@ import ( // it may be subject to name and representation changes in future releases, and clients should not // depend on its stability. It is primarily for internal use by controllers. type ControllerRevisionApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonset.go b/vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonset.go index cc8f33f290..c2c0ded3e4 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonset.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonset.go @@ -32,7 +32,7 @@ import ( // // DaemonSet represents the configuration of a daemon set. type DaemonSetApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/apps/v1/deployment.go b/vendor/k8s.io/client-go/applyconfigurations/apps/v1/deployment.go index 771ca0a75b..0fa84e16ef 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apps/v1/deployment.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apps/v1/deployment.go @@ -32,7 +32,7 @@ import ( // // Deployment enables declarative updates for Pods and ReplicaSets. type DeploymentApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/apps/v1/replicaset.go b/vendor/k8s.io/client-go/applyconfigurations/apps/v1/replicaset.go index 63f11a2183..689ee1e39c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apps/v1/replicaset.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apps/v1/replicaset.go @@ -32,7 +32,7 @@ import ( // // ReplicaSet ensures that a specified number of pod replicas are running at any given time. type ReplicaSetApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // If the Labels of a ReplicaSet are empty, they are defaulted to // be the same as the Pod(s) that the ReplicaSet manages. // Standard object's metadata. diff --git a/vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulset.go b/vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulset.go index e3dc204637..b07c565144 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulset.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulset.go @@ -38,7 +38,7 @@ import ( // The StatefulSet guarantees that a given network identity will always // map to the same storage identity. type StatefulSetApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/controllerrevision.go b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/controllerrevision.go index 6d2fdbefc8..4b3eb6d25a 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/controllerrevision.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/controllerrevision.go @@ -43,7 +43,7 @@ import ( // it may be subject to name and representation changes in future releases, and clients should not // depend on its stability. It is primarily for internal use by controllers. type ControllerRevisionApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deployment.go b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deployment.go index e8195218ce..66cfa1fe4c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deployment.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deployment.go @@ -34,7 +34,7 @@ import ( // more information. // Deployment enables declarative updates for Pods and ReplicaSets. type DeploymentApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Specification of the desired behavior of the Deployment. diff --git a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulset.go b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulset.go index 361ed68a90..392336c037 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulset.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulset.go @@ -40,7 +40,7 @@ import ( // The StatefulSet guarantees that a given network identity will always // map to the same storage identity. type StatefulSetApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Spec defines the desired identities of pods in this set. Spec *StatefulSetSpecApplyConfiguration `json:"spec,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulsetspec.go b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulsetspec.go index 3047440cac..250d4ab5d0 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulsetspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulsetspec.go @@ -36,7 +36,7 @@ type StatefulSetSpecApplyConfiguration struct { // TODO: Consider a rename of this field. Replicas *int32 `json:"replicas,omitempty"` // selector is a label query over pods that should match the replica count. - // If empty, defaulted to labels on the pod template. + // It must match the pod template's labels. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` // template is the object that describes the pod that will be created if diff --git a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/controllerrevision.go b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/controllerrevision.go index 8ffacf61c2..120ebff872 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/controllerrevision.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/controllerrevision.go @@ -43,7 +43,7 @@ import ( // it may be subject to name and representation changes in future releases, and clients should not // depend on its stability. It is primarily for internal use by controllers. type ControllerRevisionApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonset.go b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonset.go index 12b6150a3a..f7cdd6e743 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonset.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonset.go @@ -34,7 +34,7 @@ import ( // more information. // DaemonSet represents the configuration of a daemon set. type DaemonSetApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deployment.go b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deployment.go index 4add5ae257..6d714e1942 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deployment.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deployment.go @@ -34,7 +34,7 @@ import ( // more information. // Deployment enables declarative updates for Pods and ReplicaSets. type DeploymentApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Specification of the desired behavior of the Deployment. diff --git a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/replicaset.go b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/replicaset.go index ea35da04ce..d34d5db25b 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/replicaset.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/replicaset.go @@ -34,7 +34,7 @@ import ( // more information. // ReplicaSet ensures that a specified number of pod replicas are running at any given time. type ReplicaSetApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // If the Labels of a ReplicaSet are empty, they are defaulted to // be the same as the Pod(s) that the ReplicaSet manages. // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata diff --git a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/scale.go b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/scale.go index ca62809fcd..42f5cc553e 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/scale.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/scale.go @@ -30,7 +30,7 @@ import ( // // Scale represents a scaling request for a resource. type ScaleApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. diff --git a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulset.go b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulset.go index 5649c11849..fc52c9ccf0 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulset.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulset.go @@ -40,7 +40,7 @@ import ( // The StatefulSet guarantees that a given network identity will always // map to the same storage identity. type StatefulSetApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Spec defines the desired identities of pods in this set. Spec *StatefulSetSpecApplyConfiguration `json:"spec,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/horizontalpodautoscaler.go index f3bd143807..ad35e28842 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/horizontalpodautoscaler.go +++ b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/horizontalpodautoscaler.go @@ -32,8 +32,8 @@ import ( // // configuration of a horizontal pod autoscaler. type HorizontalPodAutoscalerApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec defines the behaviour of autoscaler. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. Spec *HorizontalPodAutoscalerSpecApplyConfiguration `json:"spec,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/horizontalpodautoscalerspec.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/horizontalpodautoscalerspec.go index bf58371a9f..e4f0c72e17 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/horizontalpodautoscalerspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/horizontalpodautoscalerspec.go @@ -23,7 +23,7 @@ package v1 // // specification of a horizontal pod autoscaler. type HorizontalPodAutoscalerSpecApplyConfiguration struct { - // reference to scaled resource; horizontal pod autoscaler will learn the current resource consumption + // scaleTargetRef is the reference to scaled resource; horizontal pod autoscaler will learn the current resource consumption // and will set the desired number of pods by using its Scale subresource. ScaleTargetRef *CrossVersionObjectReferenceApplyConfiguration `json:"scaleTargetRef,omitempty"` // minReplicas is the lower limit for the number of replicas to which the autoscaler diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/scale.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/scale.go index a491c5ac84..ea605a98b5 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/scale.go +++ b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/scale.go @@ -29,8 +29,8 @@ import ( // // Scale represents a scaling request for a resource. type ScaleApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. Spec *ScaleSpecApplyConfiguration `json:"spec,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/horizontalpodautoscaler.go index e001653fc2..13de61084a 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/horizontalpodautoscaler.go +++ b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/horizontalpodautoscaler.go @@ -34,7 +34,7 @@ import ( // autoscaler, which automatically manages the replica count of any resource // implementing the scale subresource based on the metrics specified. type HorizontalPodAutoscalerApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/horizontalpodautoscalercondition.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/horizontalpodautoscalercondition.go index 75bb498524..9d43ddc1bd 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/horizontalpodautoscalercondition.go +++ b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/horizontalpodautoscalercondition.go @@ -42,6 +42,10 @@ type HorizontalPodAutoscalerConditionApplyConfiguration struct { // message is a human-readable explanation containing details about // the transition Message *string `json:"message,omitempty"` + // observedGeneration represents the .metadata.generation that the condition was set based upon. + // For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + // with respect to the current state of the instance. + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` } // HorizontalPodAutoscalerConditionApplyConfiguration constructs a declarative configuration of the HorizontalPodAutoscalerCondition type for use with @@ -89,3 +93,11 @@ func (b *HorizontalPodAutoscalerConditionApplyConfiguration) WithMessage(value s b.Message = &value return b } + +// WithObservedGeneration sets the ObservedGeneration 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 ObservedGeneration field is set to the value of the last call. +func (b *HorizontalPodAutoscalerConditionApplyConfiguration) WithObservedGeneration(value int64) *HorizontalPodAutoscalerConditionApplyConfiguration { + b.ObservedGeneration = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/hpascalingrules.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/hpascalingrules.go index cebb11aa6a..ad0556b0a6 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/hpascalingrules.go +++ b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/hpascalingrules.go @@ -36,8 +36,7 @@ import ( // window is chosen. // // The tolerance is applied to the metric values and prevents scaling too -// eagerly for small metric variations. (Note that setting a tolerance requires -// the beta HPAConfigurableTolerance feature gate to be enabled.) +// eagerly for small metric variations. type HPAScalingRulesApplyConfiguration struct { // stabilizationWindowSeconds is the number of seconds for which past recommendations should be // considered while scaling up or scaling down. @@ -62,9 +61,6 @@ type HPAScalingRulesApplyConfiguration struct { // For example, if autoscaling is configured with a memory consumption target of 100Mi, // and scale-down and scale-up tolerances of 5% and 1% respectively, scaling will be // triggered when the actual consumption falls below 95Mi or exceeds 101Mi. - // - // This is an beta field and requires the HPAConfigurableTolerance feature - // gate to be enabled. Tolerance *resource.Quantity `json:"tolerance,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/metricstatus.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/metricstatus.go index 7c1a2cb0d6..0092a3135f 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/metricstatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/metricstatus.go @@ -43,7 +43,7 @@ type MetricStatusApplyConfiguration struct { // Kubernetes, and have special scaling options on top of those available // to normal per-pod metrics using the "pods" source. Resource *ResourceMetricStatusApplyConfiguration `json:"resource,omitempty"` - // container resource refers to a resource metric (such as those specified in + // containerResource refers to a resource metric (such as those specified in // requests and limits) known to Kubernetes describing a single container in each pod in the // current scale target (e.g. CPU or memory). Such metrics are built in to // Kubernetes, and have special scaling options on top of those available diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/metricvaluestatus.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/metricvaluestatus.go index 9cd743d3e8..609c6e0248 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/metricvaluestatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/metricvaluestatus.go @@ -32,7 +32,7 @@ type MetricValueStatusApplyConfiguration struct { // averageValue is the current value of the average of the // metric across all relevant pods (as a quantity) AverageValue *resource.Quantity `json:"averageValue,omitempty"` - // currentAverageUtilization is the current value of the average of the + // averageUtilization is the current value of the average of the // resource metric across all relevant pods, represented as a percentage of // the requested value of the resource for the pods. AverageUtilization *int32 `json:"averageUtilization,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/objectmetricstatus.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/objectmetricstatus.go index ec5da782a4..dc43e05d9d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/objectmetricstatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/objectmetricstatus.go @@ -28,7 +28,7 @@ type ObjectMetricStatusApplyConfiguration struct { Metric *MetricIdentifierApplyConfiguration `json:"metric,omitempty"` // current contains the current value for the given metric Current *MetricValueStatusApplyConfiguration `json:"current,omitempty"` - // DescribedObject specifies the descriptions of a object,such as kind,name apiVersion + // describedObject specifies the descriptions of a object,such as kind,name apiVersion DescribedObject *CrossVersionObjectReferenceApplyConfiguration `json:"describedObject,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/batch/v1/cronjob.go b/vendor/k8s.io/client-go/applyconfigurations/batch/v1/cronjob.go index 2fbd489633..d6d8f0a8b6 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/batch/v1/cronjob.go +++ b/vendor/k8s.io/client-go/applyconfigurations/batch/v1/cronjob.go @@ -32,7 +32,7 @@ import ( // // CronJob represents the configuration of a single cron job. type CronJobApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/batch/v1/job.go b/vendor/k8s.io/client-go/applyconfigurations/batch/v1/job.go index 02d59f0ec4..42da14b3eb 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/batch/v1/job.go +++ b/vendor/k8s.io/client-go/applyconfigurations/batch/v1/job.go @@ -32,7 +32,7 @@ import ( // // Job represents the configuration of a single job. type JobApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobschedulingconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobschedulingconfiguration.go new file mode 100644 index 0000000000..21845d8012 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobschedulingconfiguration.go @@ -0,0 +1,98 @@ +/* +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 ( + v1alpha3 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha3" +) + +// JobSchedulingConfigurationApplyConfiguration represents a declarative configuration of the JobSchedulingConfiguration type for use +// with apply. +// +// JobSchedulingConfiguration composes the reusable workload-aware +// scheduling building blocks. +type JobSchedulingConfigurationApplyConfiguration struct { + // SchedulingPolicy defines the scheduling policy for this Job. + // Exactly one of Basic or Gang must be set. + // This field is immutable after creation: the policy may not be added or + // removed. The policy variant (basic/gang) is frozen by hand-written + // validation; only schedulingPolicy.gang.minCount may be changed. + SchedulingPolicy *v1alpha3.WorkloadPodGroupSchedulingPolicyApplyConfiguration `json:"schedulingPolicy,omitempty"` + // SchedulingConstraints defines scheduling constraints (e.g. topology) + // for the Job's pods. + // This field is immutable after creation. + SchedulingConstraints *v1alpha3.WorkloadPodGroupSchedulingConstraintsApplyConfiguration `json:"schedulingConstraints,omitempty"` + // DisruptionMode defines the mode in which the Job's pods can be disrupted. + // One of Single, All. + // This field is immutable after creation: it may not be added or removed, + // and the selected mode may not be changed. + DisruptionMode *v1alpha3.WorkloadPodGroupDisruptionModeApplyConfiguration `json:"disruptionMode,omitempty"` + // ResourceClaims defines which ResourceClaims may be shared among Pods in + // the Job. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // At most 4 claims may be set, matching the limit on the resulting PodGroup. + // This list is immutable after creation: entries may neither be added, + // removed, nor modified. + ResourceClaims []v1alpha3.WorkloadPodGroupResourceClaimApplyConfiguration `json:"resourceClaims,omitempty"` +} + +// JobSchedulingConfigurationApplyConfiguration constructs a declarative configuration of the JobSchedulingConfiguration type for use with +// apply. +func JobSchedulingConfiguration() *JobSchedulingConfigurationApplyConfiguration { + return &JobSchedulingConfigurationApplyConfiguration{} +} + +// WithSchedulingPolicy sets the SchedulingPolicy 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 SchedulingPolicy field is set to the value of the last call. +func (b *JobSchedulingConfigurationApplyConfiguration) WithSchedulingPolicy(value *v1alpha3.WorkloadPodGroupSchedulingPolicyApplyConfiguration) *JobSchedulingConfigurationApplyConfiguration { + b.SchedulingPolicy = value + return b +} + +// WithSchedulingConstraints sets the SchedulingConstraints 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 SchedulingConstraints field is set to the value of the last call. +func (b *JobSchedulingConfigurationApplyConfiguration) WithSchedulingConstraints(value *v1alpha3.WorkloadPodGroupSchedulingConstraintsApplyConfiguration) *JobSchedulingConfigurationApplyConfiguration { + b.SchedulingConstraints = value + return b +} + +// WithDisruptionMode sets the DisruptionMode 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 DisruptionMode field is set to the value of the last call. +func (b *JobSchedulingConfigurationApplyConfiguration) WithDisruptionMode(value *v1alpha3.WorkloadPodGroupDisruptionModeApplyConfiguration) *JobSchedulingConfigurationApplyConfiguration { + b.DisruptionMode = value + return b +} + +// WithResourceClaims adds the given value to the ResourceClaims 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 ResourceClaims field. +func (b *JobSchedulingConfigurationApplyConfiguration) WithResourceClaims(values ...*v1alpha3.WorkloadPodGroupResourceClaimApplyConfiguration) *JobSchedulingConfigurationApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithResourceClaims") + } + b.ResourceClaims = append(b.ResourceClaims, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobspec.go b/vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobspec.go index 81064df751..ea3d54b062 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobspec.go @@ -160,6 +160,15 @@ type JobSpecApplyConfiguration struct { // characters as defined by RFC 3986. The value cannot exceed 63 characters. // This field is immutable. ManagedBy *string `json:"managedBy,omitempty"` + // scheduling defines the Workload-aware Scheduling configuration for this Job. + // When set, it specifies the scheduling policy (basic or gang), topology + // constraints, disruption mode, and shared resource claims. + // When omitted, the Job defaults to the basic scheduling policy, which behaves + // as standard pod-by-pod scheduling. + // This field is alpha-level and requires the WorkloadWithJob feature gate. + // This field is immutable, including whether it is set at all, only + // policy.gang.minCount may be changed after creation. + Scheduling *JobSchedulingConfigurationApplyConfiguration `json:"scheduling,omitempty"` } // JobSpecApplyConfiguration constructs a declarative configuration of the JobSpec type for use with @@ -295,3 +304,11 @@ func (b *JobSpecApplyConfiguration) WithManagedBy(value string) *JobSpecApplyCon b.ManagedBy = &value return b } + +// WithScheduling sets the Scheduling 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 Scheduling field is set to the value of the last call. +func (b *JobSpecApplyConfiguration) WithScheduling(value *JobSchedulingConfigurationApplyConfiguration) *JobSpecApplyConfiguration { + b.Scheduling = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobstatus.go b/vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobstatus.go index 0e11fd9beb..8260f4b6dd 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobstatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobstatus.go @@ -69,9 +69,6 @@ type JobStatusApplyConfiguration struct { Failed *int32 `json:"failed,omitempty"` // The number of pods which are terminating (in phase Pending or Running // and have a deletionTimestamp). - // - // This field is beta-level. The job controller populates the field when - // the feature gate JobPodReplacementPolicy is enabled (enabled by default). Terminating *int32 `json:"terminating,omitempty"` // completedIndexes holds the completed indexes when .spec.completionMode = // "Indexed" in a text format. The indexes are represented as decimal integers diff --git a/vendor/k8s.io/client-go/applyconfigurations/batch/v1beta1/cronjob.go b/vendor/k8s.io/client-go/applyconfigurations/batch/v1beta1/cronjob.go index f0ab32de4d..6b3a33f374 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/batch/v1beta1/cronjob.go +++ b/vendor/k8s.io/client-go/applyconfigurations/batch/v1beta1/cronjob.go @@ -32,7 +32,7 @@ import ( // // CronJob represents the configuration of a single cron job. type CronJobApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/certificatesigningrequest.go b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/certificatesigningrequest.go index 0769c9f2c7..58bfd595c1 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/certificatesigningrequest.go +++ b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/certificatesigningrequest.go @@ -41,7 +41,7 @@ import ( // (with the "kubernetes.io/kube-apiserver-client" signerName), // or to obtain certificates from custom non-Kubernetes signers. type CertificateSigningRequestApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec contains the certificate request, and is immutable after creation. // Only the request, signerName, expirationSeconds, and usages fields can be set on creation. diff --git a/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/clustertrustbundle.go b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/clustertrustbundle.go new file mode 100644 index 0000000000..3879548644 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/clustertrustbundle.go @@ -0,0 +1,288 @@ +/* +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 ( + certificatesv1 "k8s.io/api/certificates/v1" + apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + internal "k8s.io/client-go/applyconfigurations/internal" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ClusterTrustBundleApplyConfiguration represents a declarative configuration of the ClusterTrustBundle type for use +// with apply. +// +// ClusterTrustBundle is a cluster-scoped container for X.509 trust anchors +// (root certificates). +// +// ClusterTrustBundle objects are considered to be readable by any authenticated +// user in the cluster, because they can be mounted by pods using the +// `clusterTrustBundle` projection. All service accounts have read access to +// ClusterTrustBundles by default. Users who only have namespace-level access +// to a cluster can read ClusterTrustBundles by impersonating a serviceaccount +// that they have access to. +// +// It can be optionally associated with a particular signer, in which case it +// contains one valid set of trust anchors for that signer. Signers may have +// multiple associated ClusterTrustBundles; each is an independent set of trust +// anchors for that signer. Admission control is used to enforce that only users +// with permissions on the signer can create or modify the corresponding bundle. +type ClusterTrustBundleApplyConfiguration struct { + metav1.TypeMetaApplyConfiguration `json:""` + // metadata contains the object metadata. + *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec contains the signer (if any) and trust anchors. + Spec *ClusterTrustBundleSpecApplyConfiguration `json:"spec,omitempty"` +} + +// ClusterTrustBundle constructs a declarative configuration of the ClusterTrustBundle type for use with +// apply. +func ClusterTrustBundle(name string) *ClusterTrustBundleApplyConfiguration { + b := &ClusterTrustBundleApplyConfiguration{} + b.WithName(name) + b.WithKind("ClusterTrustBundle") + b.WithAPIVersion("certificates.k8s.io/v1") + return b +} + +// ExtractClusterTrustBundleFrom extracts the applied configuration owned by fieldManager from +// clusterTrustBundle for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// clusterTrustBundle must be a unmodified ClusterTrustBundle API object that was retrieved from the Kubernetes API. +// ExtractClusterTrustBundleFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractClusterTrustBundleFrom(clusterTrustBundle *certificatesv1.ClusterTrustBundle, fieldManager string, subresource string) (*ClusterTrustBundleApplyConfiguration, error) { + b := &ClusterTrustBundleApplyConfiguration{} + err := managedfields.ExtractInto(clusterTrustBundle, internal.Parser().Type("io.k8s.api.certificates.v1.ClusterTrustBundle"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(clusterTrustBundle.Name) + + b.WithKind("ClusterTrustBundle") + b.WithAPIVersion("certificates.k8s.io/v1") + return b, nil +} + +// ExtractClusterTrustBundle extracts the applied configuration owned by fieldManager from +// clusterTrustBundle. If no managedFields are found in clusterTrustBundle for fieldManager, a +// ClusterTrustBundleApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// clusterTrustBundle must be a unmodified ClusterTrustBundle API object that was retrieved from the Kubernetes API. +// ExtractClusterTrustBundle provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractClusterTrustBundle(clusterTrustBundle *certificatesv1.ClusterTrustBundle, fieldManager string) (*ClusterTrustBundleApplyConfiguration, error) { + return ExtractClusterTrustBundleFrom(clusterTrustBundle, fieldManager, "") +} + +func (b ClusterTrustBundleApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind 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 Kind field is set to the value of the last call. +func (b *ClusterTrustBundleApplyConfiguration) WithKind(value string) *ClusterTrustBundleApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion 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 APIVersion field is set to the value of the last call. +func (b *ClusterTrustBundleApplyConfiguration) WithAPIVersion(value string) *ClusterTrustBundleApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// 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 *ClusterTrustBundleApplyConfiguration) WithName(value string) *ClusterTrustBundleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call. +func (b *ClusterTrustBundleApplyConfiguration) WithGenerateName(value string) *ClusterTrustBundleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call. +func (b *ClusterTrustBundleApplyConfiguration) WithNamespace(value string) *ClusterTrustBundleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID 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 UID field is set to the value of the last call. +func (b *ClusterTrustBundleApplyConfiguration) WithUID(value types.UID) *ClusterTrustBundleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call. +func (b *ClusterTrustBundleApplyConfiguration) WithResourceVersion(value string) *ClusterTrustBundleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation 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 Generation field is set to the value of the last call. +func (b *ClusterTrustBundleApplyConfiguration) WithGeneration(value int64) *ClusterTrustBundleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp 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 CreationTimestamp field is set to the value of the last call. +func (b *ClusterTrustBundleApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *ClusterTrustBundleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp 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 DeletionTimestamp field is set to the value of the last call. +func (b *ClusterTrustBundleApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *ClusterTrustBundleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds 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 DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ClusterTrustBundleApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ClusterTrustBundleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels 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 Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ClusterTrustBundleApplyConfiguration) WithLabels(entries map[string]string) *ClusterTrustBundleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations 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 Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ClusterTrustBundleApplyConfiguration) WithAnnotations(entries map[string]string) *ClusterTrustBundleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences 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 OwnerReferences field. +func (b *ClusterTrustBundleApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *ClusterTrustBundleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers 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 Finalizers field. +func (b *ClusterTrustBundleApplyConfiguration) WithFinalizers(values ...string) *ClusterTrustBundleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *ClusterTrustBundleApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec 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 Spec field is set to the value of the last call. +func (b *ClusterTrustBundleApplyConfiguration) WithSpec(value *ClusterTrustBundleSpecApplyConfiguration) *ClusterTrustBundleApplyConfiguration { + b.Spec = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *ClusterTrustBundleApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *ClusterTrustBundleApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ClusterTrustBundleApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *ClusterTrustBundleApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/clustertrustbundlespec.go b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/clustertrustbundlespec.go new file mode 100644 index 0000000000..5b7bb10384 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/clustertrustbundlespec.go @@ -0,0 +1,79 @@ +/* +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 + +// ClusterTrustBundleSpecApplyConfiguration represents a declarative configuration of the ClusterTrustBundleSpec type for use +// with apply. +// +// ClusterTrustBundleSpec contains the signer and trust anchors. +type ClusterTrustBundleSpecApplyConfiguration struct { + // signerName indicates the associated signer, if any. + // + // In order to create or update a ClusterTrustBundle that sets signerName, + // you must have the following cluster-scoped permission: + // group=certificates.k8s.io resource=signers resourceName= + // verb=attest. + // + // If signerName is not empty, then the ClusterTrustBundle object must be + // named with the signer name as a prefix (translating slashes to colons). + // For example, for the signer name `example.com/foo`, valid + // ClusterTrustBundle object names include `example.com:foo:abc` and + // `example.com:foo:v1`. + // + // If signerName is empty, then the ClusterTrustBundle object's name must + // not have such a prefix. + // + // List/watch requests for ClusterTrustBundles can filter on this field + // using a `spec.signerName=NAME` field selector. + SignerName *string `json:"signerName,omitempty"` + // trustBundle contains the individual X.509 trust anchors for this + // bundle, as PEM bundle of PEM-wrapped, DER-formatted X.509 certificates. + // + // The data must consist only of PEM certificate blocks that parse as valid + // X.509 certificates. Each certificate must include a basic constraints + // extension with the CA bit set. The API server will reject objects that + // contain duplicate certificates, or that use PEM block headers. + // + // Users of ClusterTrustBundles, including Kubelet, are free to reorder and + // deduplicate certificate blocks in this file according to their own logic, + // as well as to drop PEM block headers and inter-block data. + TrustBundle *string `json:"trustBundle,omitempty"` +} + +// ClusterTrustBundleSpecApplyConfiguration constructs a declarative configuration of the ClusterTrustBundleSpec type for use with +// apply. +func ClusterTrustBundleSpec() *ClusterTrustBundleSpecApplyConfiguration { + return &ClusterTrustBundleSpecApplyConfiguration{} +} + +// WithSignerName sets the SignerName 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 SignerName field is set to the value of the last call. +func (b *ClusterTrustBundleSpecApplyConfiguration) WithSignerName(value string) *ClusterTrustBundleSpecApplyConfiguration { + b.SignerName = &value + return b +} + +// WithTrustBundle sets the TrustBundle 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 TrustBundle field is set to the value of the last call. +func (b *ClusterTrustBundleSpecApplyConfiguration) WithTrustBundle(value string) *ClusterTrustBundleSpecApplyConfiguration { + b.TrustBundle = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/podcertificaterequest.go b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/podcertificaterequest.go new file mode 100644 index 0000000000..41ecc78d80 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/podcertificaterequest.go @@ -0,0 +1,295 @@ +/* +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 ( + certificatesv1 "k8s.io/api/certificates/v1" + apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + internal "k8s.io/client-go/applyconfigurations/internal" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// PodCertificateRequestApplyConfiguration represents a declarative configuration of the PodCertificateRequest type for use +// with apply. +// +// PodCertificateRequest encodes a pod requesting a certificate from a given +// signer. +// +// Kubelets use this API to implement podCertificate projected volumes +type PodCertificateRequestApplyConfiguration struct { + metav1.TypeMetaApplyConfiguration `json:""` + // metadata contains the object metadata. + *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec contains the details about the certificate being requested. + Spec *PodCertificateRequestSpecApplyConfiguration `json:"spec,omitempty"` + // status contains the issued certificate, and a standard set of conditions. + Status *PodCertificateRequestStatusApplyConfiguration `json:"status,omitempty"` +} + +// PodCertificateRequest constructs a declarative configuration of the PodCertificateRequest type for use with +// apply. +func PodCertificateRequest(name, namespace string) *PodCertificateRequestApplyConfiguration { + b := &PodCertificateRequestApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("PodCertificateRequest") + b.WithAPIVersion("certificates.k8s.io/v1") + return b +} + +// ExtractPodCertificateRequestFrom extracts the applied configuration owned by fieldManager from +// podCertificateRequest for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// podCertificateRequest must be a unmodified PodCertificateRequest API object that was retrieved from the Kubernetes API. +// ExtractPodCertificateRequestFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractPodCertificateRequestFrom(podCertificateRequest *certificatesv1.PodCertificateRequest, fieldManager string, subresource string) (*PodCertificateRequestApplyConfiguration, error) { + b := &PodCertificateRequestApplyConfiguration{} + err := managedfields.ExtractInto(podCertificateRequest, internal.Parser().Type("io.k8s.api.certificates.v1.PodCertificateRequest"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(podCertificateRequest.Name) + b.WithNamespace(podCertificateRequest.Namespace) + + b.WithKind("PodCertificateRequest") + b.WithAPIVersion("certificates.k8s.io/v1") + return b, nil +} + +// ExtractPodCertificateRequest extracts the applied configuration owned by fieldManager from +// podCertificateRequest. If no managedFields are found in podCertificateRequest for fieldManager, a +// PodCertificateRequestApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// podCertificateRequest must be a unmodified PodCertificateRequest API object that was retrieved from the Kubernetes API. +// ExtractPodCertificateRequest provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractPodCertificateRequest(podCertificateRequest *certificatesv1.PodCertificateRequest, fieldManager string) (*PodCertificateRequestApplyConfiguration, error) { + return ExtractPodCertificateRequestFrom(podCertificateRequest, fieldManager, "") +} + +// ExtractPodCertificateRequestStatus extracts the applied configuration owned by fieldManager from +// podCertificateRequest for the status subresource. +func ExtractPodCertificateRequestStatus(podCertificateRequest *certificatesv1.PodCertificateRequest, fieldManager string) (*PodCertificateRequestApplyConfiguration, error) { + return ExtractPodCertificateRequestFrom(podCertificateRequest, fieldManager, "status") +} + +func (b PodCertificateRequestApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind 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 Kind field is set to the value of the last call. +func (b *PodCertificateRequestApplyConfiguration) WithKind(value string) *PodCertificateRequestApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion 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 APIVersion field is set to the value of the last call. +func (b *PodCertificateRequestApplyConfiguration) WithAPIVersion(value string) *PodCertificateRequestApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// 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 *PodCertificateRequestApplyConfiguration) WithName(value string) *PodCertificateRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call. +func (b *PodCertificateRequestApplyConfiguration) WithGenerateName(value string) *PodCertificateRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call. +func (b *PodCertificateRequestApplyConfiguration) WithNamespace(value string) *PodCertificateRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID 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 UID field is set to the value of the last call. +func (b *PodCertificateRequestApplyConfiguration) WithUID(value types.UID) *PodCertificateRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call. +func (b *PodCertificateRequestApplyConfiguration) WithResourceVersion(value string) *PodCertificateRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation 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 Generation field is set to the value of the last call. +func (b *PodCertificateRequestApplyConfiguration) WithGeneration(value int64) *PodCertificateRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp 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 CreationTimestamp field is set to the value of the last call. +func (b *PodCertificateRequestApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *PodCertificateRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp 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 DeletionTimestamp field is set to the value of the last call. +func (b *PodCertificateRequestApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *PodCertificateRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds 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 DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *PodCertificateRequestApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PodCertificateRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels 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 Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *PodCertificateRequestApplyConfiguration) WithLabels(entries map[string]string) *PodCertificateRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations 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 Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *PodCertificateRequestApplyConfiguration) WithAnnotations(entries map[string]string) *PodCertificateRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences 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 OwnerReferences field. +func (b *PodCertificateRequestApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *PodCertificateRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers 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 Finalizers field. +func (b *PodCertificateRequestApplyConfiguration) WithFinalizers(values ...string) *PodCertificateRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *PodCertificateRequestApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec 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 Spec field is set to the value of the last call. +func (b *PodCertificateRequestApplyConfiguration) WithSpec(value *PodCertificateRequestSpecApplyConfiguration) *PodCertificateRequestApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status 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 Status field is set to the value of the last call. +func (b *PodCertificateRequestApplyConfiguration) WithStatus(value *PodCertificateRequestStatusApplyConfiguration) *PodCertificateRequestApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *PodCertificateRequestApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *PodCertificateRequestApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *PodCertificateRequestApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *PodCertificateRequestApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/podcertificaterequestspec.go b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/podcertificaterequestspec.go new file mode 100644 index 0000000000..a952f16523 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/podcertificaterequestspec.go @@ -0,0 +1,189 @@ +/* +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 ( + types "k8s.io/apimachinery/pkg/types" +) + +// PodCertificateRequestSpecApplyConfiguration represents a declarative configuration of the PodCertificateRequestSpec type for use +// with apply. +// +// PodCertificateRequestSpec describes the certificate request. All fields are +// immutable after creation. +type PodCertificateRequestSpecApplyConfiguration struct { + // signerName indicates the requested signer. + // + // All signer names beginning with `kubernetes.io` are reserved for use by + // the Kubernetes project. There is currently one well-known signer + // documented by the Kubernetes project, + // `kubernetes.io/kube-apiserver-client-pod`, which will issue client + // certificates understood by kube-apiserver. It is currently + // unimplemented. + SignerName *string `json:"signerName,omitempty"` + // podName is the name of the pod into which the certificate will be mounted. + PodName *string `json:"podName,omitempty"` + // podUID is the UID of the pod into which the certificate will be mounted. + PodUID *types.UID `json:"podUID,omitempty"` + // serviceAccountName is the name of the service account the pod is running as. + ServiceAccountName *string `json:"serviceAccountName,omitempty"` + // serviceAccountUID is the UID of the service account the pod is running as. + ServiceAccountUID *types.UID `json:"serviceAccountUID,omitempty"` + // nodeName is the name of the node the pod is assigned to. + NodeName *types.NodeName `json:"nodeName,omitempty"` + // nodeUID is the UID of the node the pod is assigned to. + NodeUID *types.UID `json:"nodeUID,omitempty"` + // maxExpirationSeconds is the maximum lifetime permitted for the + // certificate. + // + // If omitted, kube-apiserver will set it to 86400(24 hours). kube-apiserver + // will reject values shorter than 3600 (1 hour). The maximum allowable + // value is 7862400 (91 days). + // + // The signer implementation is then free to issue a certificate with any + // lifetime *shorter* than MaxExpirationSeconds, but no shorter than 3600 + // seconds (1 hour). This constraint is enforced by kube-apiserver. + // `kubernetes.io` signers will never issue certificates with a lifetime + // longer than 24 hours. + MaxExpirationSeconds *int32 `json:"maxExpirationSeconds,omitempty"` + // A PKCS#10 certificate signing request (DER-serialized) generated by + // Kubelet using the subject private key. + // + // Most signer implementations will ignore the contents of the CSR except to + // extract the subject public key. The API server automatically verifies the + // CSR signature during admission, so the signer does not need to repeat the + // verification. CSRs generated by kubelet are completely empty. + // + // The subject public key must be one of RSA3072, RSA4096, ECDSAP256, + // ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in + // the future. + // + // Signer implementations do not need to support all key types supported by + // kube-apiserver and kubelet. If a signer does not support the key type + // used for a given PodCertificateRequest, it must deny the request by + // setting a status.conditions entry with a type of "Denied" and a reason of + // "UnsupportedKeyType". It may also suggest a key type that it does support + // in the message field. + StubPKCS10Request []byte `json:"stubPKCS10Request,omitempty"` + // unverifiedUserAnnotations allow pod authors to pass additional information to + // the signer implementation. Kubernetes does not restrict or validate this + // metadata in any way. + // + // Entries are subject to the same validation as object metadata annotations, + // with the addition that all keys must be domain-prefixed. No restrictions + // are placed on values, except an overall size limitation on the entire field. + // + // Signers should document the keys and values they support. Signers should + // deny requests that contain keys they do not recognize. + UnverifiedUserAnnotations map[string]string `json:"unverifiedUserAnnotations,omitempty"` +} + +// PodCertificateRequestSpecApplyConfiguration constructs a declarative configuration of the PodCertificateRequestSpec type for use with +// apply. +func PodCertificateRequestSpec() *PodCertificateRequestSpecApplyConfiguration { + return &PodCertificateRequestSpecApplyConfiguration{} +} + +// WithSignerName sets the SignerName 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 SignerName field is set to the value of the last call. +func (b *PodCertificateRequestSpecApplyConfiguration) WithSignerName(value string) *PodCertificateRequestSpecApplyConfiguration { + b.SignerName = &value + return b +} + +// WithPodName sets the PodName 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 PodName field is set to the value of the last call. +func (b *PodCertificateRequestSpecApplyConfiguration) WithPodName(value string) *PodCertificateRequestSpecApplyConfiguration { + b.PodName = &value + return b +} + +// WithPodUID sets the PodUID 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 PodUID field is set to the value of the last call. +func (b *PodCertificateRequestSpecApplyConfiguration) WithPodUID(value types.UID) *PodCertificateRequestSpecApplyConfiguration { + b.PodUID = &value + return b +} + +// WithServiceAccountName sets the ServiceAccountName 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 ServiceAccountName field is set to the value of the last call. +func (b *PodCertificateRequestSpecApplyConfiguration) WithServiceAccountName(value string) *PodCertificateRequestSpecApplyConfiguration { + b.ServiceAccountName = &value + return b +} + +// WithServiceAccountUID sets the ServiceAccountUID 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 ServiceAccountUID field is set to the value of the last call. +func (b *PodCertificateRequestSpecApplyConfiguration) WithServiceAccountUID(value types.UID) *PodCertificateRequestSpecApplyConfiguration { + b.ServiceAccountUID = &value + return b +} + +// WithNodeName sets the NodeName 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 NodeName field is set to the value of the last call. +func (b *PodCertificateRequestSpecApplyConfiguration) WithNodeName(value types.NodeName) *PodCertificateRequestSpecApplyConfiguration { + b.NodeName = &value + return b +} + +// WithNodeUID sets the NodeUID 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 NodeUID field is set to the value of the last call. +func (b *PodCertificateRequestSpecApplyConfiguration) WithNodeUID(value types.UID) *PodCertificateRequestSpecApplyConfiguration { + b.NodeUID = &value + return b +} + +// WithMaxExpirationSeconds sets the MaxExpirationSeconds 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 MaxExpirationSeconds field is set to the value of the last call. +func (b *PodCertificateRequestSpecApplyConfiguration) WithMaxExpirationSeconds(value int32) *PodCertificateRequestSpecApplyConfiguration { + b.MaxExpirationSeconds = &value + return b +} + +// WithStubPKCS10Request adds the given value to the StubPKCS10Request 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 StubPKCS10Request field. +func (b *PodCertificateRequestSpecApplyConfiguration) WithStubPKCS10Request(values ...byte) *PodCertificateRequestSpecApplyConfiguration { + for i := range values { + b.StubPKCS10Request = append(b.StubPKCS10Request, values[i]) + } + return b +} + +// WithUnverifiedUserAnnotations puts the entries into the UnverifiedUserAnnotations 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 UnverifiedUserAnnotations field, +// overwriting an existing map entries in UnverifiedUserAnnotations field with the same key. +func (b *PodCertificateRequestSpecApplyConfiguration) WithUnverifiedUserAnnotations(entries map[string]string) *PodCertificateRequestSpecApplyConfiguration { + if b.UnverifiedUserAnnotations == nil && len(entries) > 0 { + b.UnverifiedUserAnnotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.UnverifiedUserAnnotations[k] = v + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/podcertificaterequeststatus.go b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/podcertificaterequeststatus.go new file mode 100644 index 0000000000..e10dd930a0 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/podcertificaterequeststatus.go @@ -0,0 +1,133 @@ +/* +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 ( + apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// PodCertificateRequestStatusApplyConfiguration represents a declarative configuration of the PodCertificateRequestStatus type for use +// with apply. +// +// PodCertificateRequestStatus describes the status of the request, and holds +// the certificate data if the request is issued. +type PodCertificateRequestStatusApplyConfiguration struct { + // conditions applied to the request. + // + // The types "Issued", "Denied", and "Failed" have special handling. At + // most one of these conditions may be present, and they must have status + // "True". + // + // If the request is denied with `Reason=UnsupportedKeyType`, the signer may + // suggest a key type that will work in the message field. + Conditions []metav1.ConditionApplyConfiguration `json:"conditions,omitempty"` + // certificateChain is populated with an issued certificate by the signer. + // This field is set via the /status subresource. Once populated, this field + // is immutable. + // + // If the certificate signing request is denied, a condition of type + // "Denied" is added and this field remains empty. If the signer cannot + // issue the certificate, a condition of type "Failed" is added and this + // field remains empty. + // + // Validation requirements: + // 1. certificateChain must consist of one or more PEM-formatted certificates. + // 2. Each entry must be a valid PEM-wrapped, DER-encoded ASN.1 Certificate as + // described in section 4 of RFC5280. + // + // If more than one block is present, and the definition of the requested + // spec.signerName does not indicate otherwise, the first block is the + // issued certificate, and subsequent blocks should be treated as + // intermediate certificates and presented in TLS handshakes. When + // projecting the chain into a pod volume, kubelet will drop any data + // in-between the PEM blocks, as well as any PEM block headers. + CertificateChain *string `json:"certificateChain,omitempty"` + // notBefore is the time at which the certificate becomes valid. The value + // must be the same as the notBefore value in the leaf certificate in + // certificateChain. This field is set via the /status subresource. Once + // populated, it is immutable. The signer must set this field at the same + // time it sets certificateChain. + NotBefore *apismetav1.Time `json:"notBefore,omitempty"` + // beginRefreshAt is the time at which the kubelet should begin trying to + // refresh the certificate. This field is set via the /status subresource, + // and must be set at the same time as certificateChain. Once populated, + // this field is immutable. + // + // This field is only a hint. Kubelet may start refreshing before or after + // this time if necessary. + BeginRefreshAt *apismetav1.Time `json:"beginRefreshAt,omitempty"` + // notAfter is the time at which the certificate expires. The value must be + // the same as the notAfter value in the leaf certificate in + // certificateChain. This field is set via the /status subresource. Once + // populated, it is immutable. The signer must set this field at the same + // time it sets certificateChain. + NotAfter *apismetav1.Time `json:"notAfter,omitempty"` +} + +// PodCertificateRequestStatusApplyConfiguration constructs a declarative configuration of the PodCertificateRequestStatus type for use with +// apply. +func PodCertificateRequestStatus() *PodCertificateRequestStatusApplyConfiguration { + return &PodCertificateRequestStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions 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 Conditions field. +func (b *PodCertificateRequestStatusApplyConfiguration) WithConditions(values ...*metav1.ConditionApplyConfiguration) *PodCertificateRequestStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithCertificateChain sets the CertificateChain 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 CertificateChain field is set to the value of the last call. +func (b *PodCertificateRequestStatusApplyConfiguration) WithCertificateChain(value string) *PodCertificateRequestStatusApplyConfiguration { + b.CertificateChain = &value + return b +} + +// WithNotBefore sets the NotBefore 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 NotBefore field is set to the value of the last call. +func (b *PodCertificateRequestStatusApplyConfiguration) WithNotBefore(value apismetav1.Time) *PodCertificateRequestStatusApplyConfiguration { + b.NotBefore = &value + return b +} + +// WithBeginRefreshAt sets the BeginRefreshAt 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 BeginRefreshAt field is set to the value of the last call. +func (b *PodCertificateRequestStatusApplyConfiguration) WithBeginRefreshAt(value apismetav1.Time) *PodCertificateRequestStatusApplyConfiguration { + b.BeginRefreshAt = &value + return b +} + +// WithNotAfter sets the NotAfter 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 NotAfter field is set to the value of the last call. +func (b *PodCertificateRequestStatusApplyConfiguration) WithNotAfter(value apismetav1.Time) *PodCertificateRequestStatusApplyConfiguration { + b.NotAfter = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/certificates/v1alpha1/clustertrustbundle.go b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1alpha1/clustertrustbundle.go index 9c26cdb915..7fdaae5b01 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/certificates/v1alpha1/clustertrustbundle.go +++ b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1alpha1/clustertrustbundle.go @@ -40,13 +40,13 @@ import ( // to a cluster can read ClusterTrustBundles by impersonating a serviceaccount // that they have access to. // -// It can be optionally associated with a particular assigner, in which case it +// It can be optionally associated with a particular signer, in which case it // contains one valid set of trust anchors for that signer. Signers may have // multiple associated ClusterTrustBundles; each is an independent set of trust // anchors for that signer. Admission control is used to enforce that only users // with permissions on the signer can create or modify the corresponding bundle. type ClusterTrustBundleApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // metadata contains the object metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec contains the signer (if any) and trust anchors. diff --git a/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/certificatesigningrequest.go b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/certificatesigningrequest.go index 05e16d2054..256e0f5045 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/certificatesigningrequest.go +++ b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/certificatesigningrequest.go @@ -32,7 +32,7 @@ import ( // // Describes a certificate signing request type CertificateSigningRequestApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec contains the certificate request, and is immutable after creation. // Only the request, signerName, expirationSeconds, and usages fields can be set on creation. diff --git a/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/clustertrustbundle.go b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/clustertrustbundle.go index 7f8be00ce4..5c70207c6a 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/clustertrustbundle.go +++ b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/clustertrustbundle.go @@ -40,13 +40,13 @@ import ( // to a cluster can read ClusterTrustBundles by impersonating a serviceaccount // that they have access to. // -// It can be optionally associated with a particular assigner, in which case it +// It can be optionally associated with a particular signer, in which case it // contains one valid set of trust anchors for that signer. Signers may have // multiple associated ClusterTrustBundles; each is an independent set of trust // anchors for that signer. Admission control is used to enforce that only users // with permissions on the signer can create or modify the corresponding bundle. type ClusterTrustBundleApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // metadata contains the object metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec contains the signer (if any) and trust anchors. diff --git a/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/podcertificaterequest.go b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/podcertificaterequest.go index 447172552c..bf12e23c0f 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/podcertificaterequest.go +++ b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/podcertificaterequest.go @@ -35,7 +35,7 @@ import ( // // Kubelets use this API to implement podCertificate projected volumes type PodCertificateRequestApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // metadata contains the object metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec contains the details about the certificate being requested. diff --git a/vendor/k8s.io/client-go/applyconfigurations/coordination/v1/lease.go b/vendor/k8s.io/client-go/applyconfigurations/coordination/v1/lease.go index de18339754..4dce4ca8a7 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/coordination/v1/lease.go +++ b/vendor/k8s.io/client-go/applyconfigurations/coordination/v1/lease.go @@ -32,7 +32,8 @@ import ( // // Lease defines a lease concept. type LeaseApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec contains the specification of the Lease. diff --git a/vendor/k8s.io/client-go/applyconfigurations/coordination/v1/leasespec.go b/vendor/k8s.io/client-go/applyconfigurations/coordination/v1/leasespec.go index 4dca58e2e5..05470ca61a 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/coordination/v1/leasespec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/coordination/v1/leasespec.go @@ -44,11 +44,11 @@ type LeaseSpecApplyConfiguration struct { // leaseTransitions is the number of transitions of a lease between // holders. LeaseTransitions *int32 `json:"leaseTransitions,omitempty"` - // Strategy indicates the strategy for picking the leader for coordinated leader election. + // strategy indicates the strategy for picking the leader for coordinated leader election. // If the field is not specified, there is no active coordination for this lease. // (Alpha) Using this field requires the CoordinatedLeaderElection feature gate to be enabled. Strategy *coordinationv1.CoordinatedLeaseStrategy `json:"strategy,omitempty"` - // PreferredHolder signals to a lease holder that the lease has a + // preferredHolder signals to a lease holder that the lease has a // more optimal holder and should be given up. // This field can only be set if Strategy is also set. PreferredHolder *string `json:"preferredHolder,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/coordination/v1alpha2/leasecandidate.go b/vendor/k8s.io/client-go/applyconfigurations/coordination/v1alpha2/leasecandidate.go index 73150cb43a..25a2a000d4 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/coordination/v1alpha2/leasecandidate.go +++ b/vendor/k8s.io/client-go/applyconfigurations/coordination/v1alpha2/leasecandidate.go @@ -33,7 +33,8 @@ import ( // LeaseCandidate defines a candidate for a Lease object. // Candidates are created such that coordinated leader election will pick the best leader from the list of candidates. type LeaseCandidateApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec contains the specification of the Lease. diff --git a/vendor/k8s.io/client-go/applyconfigurations/coordination/v1alpha2/leasecandidatespec.go b/vendor/k8s.io/client-go/applyconfigurations/coordination/v1alpha2/leasecandidatespec.go index 44a2db06ff..e6ab4897dd 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/coordination/v1alpha2/leasecandidatespec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/coordination/v1alpha2/leasecandidatespec.go @@ -28,15 +28,15 @@ import ( // // LeaseCandidateSpec is a specification of a Lease. type LeaseCandidateSpecApplyConfiguration struct { - // LeaseName is the name of the lease for which this candidate is contending. + // leaseName is the name of the lease for which this candidate is contending. // This field is immutable. LeaseName *string `json:"leaseName,omitempty"` - // PingTime is the last time that the server has requested the LeaseCandidate + // pingTime is the last time that the server has requested the LeaseCandidate // to renew. It is only done during leader election to check if any // LeaseCandidates have become ineligible. When PingTime is updated, the // LeaseCandidate will respond by updating RenewTime. PingTime *v1.MicroTime `json:"pingTime,omitempty"` - // RenewTime is the time that the LeaseCandidate was last updated. + // renewTime is the time that the LeaseCandidate was last updated. // Any time a Lease needs to do leader election, the PingTime field // is updated to signal to the LeaseCandidate that they should update // the RenewTime. @@ -44,14 +44,14 @@ type LeaseCandidateSpecApplyConfiguration struct { // since the last renew. The PingTime field is updated regularly to prevent // garbage collection for still active LeaseCandidates. RenewTime *v1.MicroTime `json:"renewTime,omitempty"` - // BinaryVersion is the binary version. It must be in a semver format without leading `v`. + // binaryVersion is the binary version. It must be in a semver format without leading `v`. // This field is required. BinaryVersion *string `json:"binaryVersion,omitempty"` - // EmulationVersion is the emulation version. It must be in a semver format without leading `v`. + // emulationVersion is the emulation version. It must be in a semver format without leading `v`. // EmulationVersion must be less than or equal to BinaryVersion. // This field is required when strategy is "OldestEmulationVersion" EmulationVersion *string `json:"emulationVersion,omitempty"` - // Strategy is the strategy that coordinated leader election will use for picking the leader. + // strategy is the strategy that coordinated leader election will use for picking the leader. // If multiple candidates for the same Lease return different strategies, the strategy provided // by the candidate with the latest BinaryVersion will be used. If there is still conflict, // this is a user error and coordinated leader election will not operate the Lease until resolved. diff --git a/vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/lease.go b/vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/lease.go index 38263059a8..dccfdca8a4 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/lease.go +++ b/vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/lease.go @@ -32,7 +32,8 @@ import ( // // Lease defines a lease concept. type LeaseApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec contains the specification of the Lease. diff --git a/vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/leasecandidate.go b/vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/leasecandidate.go index 4670d9d2b9..bfd45d103f 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/leasecandidate.go +++ b/vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/leasecandidate.go @@ -33,7 +33,8 @@ import ( // LeaseCandidate defines a candidate for a Lease object. // Candidates are created such that coordinated leader election will pick the best leader from the list of candidates. type LeaseCandidateApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec contains the specification of the Lease. diff --git a/vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/leasecandidatespec.go b/vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/leasecandidatespec.go index 6b146dc494..3aed4ccc21 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/leasecandidatespec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/leasecandidatespec.go @@ -28,17 +28,17 @@ import ( // // LeaseCandidateSpec is a specification of a Lease. type LeaseCandidateSpecApplyConfiguration struct { - // LeaseName is the name of the lease for which this candidate is contending. + // leaseName is the name of the lease for which this candidate is contending. // The limits on this field are the same as on Lease.name. Multiple lease candidates // may reference the same Lease.name. // This field is immutable. LeaseName *string `json:"leaseName,omitempty"` - // PingTime is the last time that the server has requested the LeaseCandidate + // pingTime is the last time that the server has requested the LeaseCandidate // to renew. It is only done during leader election to check if any // LeaseCandidates have become ineligible. When PingTime is updated, the // LeaseCandidate will respond by updating RenewTime. PingTime *v1.MicroTime `json:"pingTime,omitempty"` - // RenewTime is the time that the LeaseCandidate was last updated. + // renewTime is the time that the LeaseCandidate was last updated. // Any time a Lease needs to do leader election, the PingTime field // is updated to signal to the LeaseCandidate that they should update // the RenewTime. @@ -46,14 +46,14 @@ type LeaseCandidateSpecApplyConfiguration struct { // since the last renew. The PingTime field is updated regularly to prevent // garbage collection for still active LeaseCandidates. RenewTime *v1.MicroTime `json:"renewTime,omitempty"` - // BinaryVersion is the binary version. It must be in a semver format without leading `v`. + // binaryVersion is the binary version. It must be in a semver format without leading `v`. // This field is required. BinaryVersion *string `json:"binaryVersion,omitempty"` - // EmulationVersion is the emulation version. It must be in a semver format without leading `v`. + // emulationVersion is the emulation version. It must be in a semver format without leading `v`. // EmulationVersion must be less than or equal to BinaryVersion. // This field is required when strategy is "OldestEmulationVersion" EmulationVersion *string `json:"emulationVersion,omitempty"` - // Strategy is the strategy that coordinated leader election will use for picking the leader. + // strategy is the strategy that coordinated leader election will use for picking the leader. // If multiple candidates for the same Lease return different strategies, the strategy provided // by the candidate with the latest BinaryVersion will be used. If there is still conflict, // this is a user error and coordinated leader election will not operate the Lease until resolved. diff --git a/vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/leasespec.go b/vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/leasespec.go index db40b83592..ec4ee1190f 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/leasespec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/leasespec.go @@ -44,10 +44,10 @@ type LeaseSpecApplyConfiguration struct { // leaseTransitions is the number of transitions of a lease between // holders. LeaseTransitions *int32 `json:"leaseTransitions,omitempty"` - // Strategy indicates the strategy for picking the leader for coordinated leader election + // strategy indicates the strategy for picking the leader for coordinated leader election. // (Alpha) Using this field requires the CoordinatedLeaderElection feature gate to be enabled. Strategy *coordinationv1.CoordinatedLeaseStrategy `json:"strategy,omitempty"` - // PreferredHolder signals to a lease holder that the lease has a + // preferredHolder signals to a lease holder that the lease has a // more optimal holder and should be given up. PreferredHolder *string `json:"preferredHolder,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/clustertrustbundleprojection.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/clustertrustbundleprojection.go index 00eec6b377..8964d84f26 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/clustertrustbundleprojection.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/clustertrustbundleprojection.go @@ -49,6 +49,10 @@ type ClusterTrustBundleProjectionApplyConfiguration struct { Optional *bool `json:"optional,omitempty"` // Relative path from the volume root to write the bundle. Path *string `json:"path,omitempty"` + // user is Optional: The owner UID of the created file. + // If specified, the item-level user field takes precedence over defaultUser. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + User *int64 `json:"user,omitempty"` } // ClusterTrustBundleProjectionApplyConfiguration constructs a declarative configuration of the ClusterTrustBundleProjection type for use with @@ -96,3 +100,11 @@ func (b *ClusterTrustBundleProjectionApplyConfiguration) WithPath(value string) b.Path = &value return b } + +// WithUser sets the User 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 User field is set to the value of the last call. +func (b *ClusterTrustBundleProjectionApplyConfiguration) WithUser(value int64) *ClusterTrustBundleProjectionApplyConfiguration { + b.User = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/componentstatus.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/componentstatus.go index 5b9b7f32ce..b356d1ee37 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/componentstatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/componentstatus.go @@ -33,7 +33,7 @@ import ( // ComponentStatus (and ComponentStatusList) holds the cluster validation info. // Deprecated: This API is deprecated in v1.19+ type ComponentStatusApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmap.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmap.go index d638482048..6a181e3256 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmap.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmap.go @@ -32,7 +32,7 @@ import ( // // ConfigMap holds configuration data for pods to consume. type ConfigMapApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` @@ -54,6 +54,8 @@ type ConfigMapApplyConfiguration struct { // the Data field, this is enforced during validation process. // Using this field will require 1.10+ apiserver and // kubelet. + // Note: BinaryData keys are not currently propagated to container env vars + // via ConfigMapKeyRef or ConfigMapRef env sources; only Data keys are used. BinaryData map[string][]byte `json:"binaryData,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapenvsource.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapenvsource.go index c2c067b2c4..b50b3f11de 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapenvsource.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapenvsource.go @@ -26,9 +26,10 @@ package v1 // // The contents of the target ConfigMap's Data field will represent the // key-value pairs as environment variables. +// Keys in the BinaryData field are not currently propagated to container env vars. type ConfigMapEnvSourceApplyConfiguration struct { // The ConfigMap to select from. - LocalObjectReferenceApplyConfiguration `json:",inline"` + LocalObjectReferenceApplyConfiguration `json:""` // Specify whether the ConfigMap must be defined Optional *bool `json:"optional,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapkeyselector.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapkeyselector.go index 415edded52..384db766aa 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapkeyselector.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapkeyselector.go @@ -24,8 +24,9 @@ package v1 // Selects a key from a ConfigMap. type ConfigMapKeySelectorApplyConfiguration struct { // The ConfigMap to select from. - LocalObjectReferenceApplyConfiguration `json:",inline"` - // The key to select. + LocalObjectReferenceApplyConfiguration `json:""` + // The key to select from the ConfigMap's Data field. + // Keys in the BinaryData field are not currently propagated to container env vars. Key *string `json:"key,omitempty"` // Specify whether the ConfigMap or its key must be defined Optional *bool `json:"optional,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapprojection.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapprojection.go index 0357ca9983..9af0ca301f 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapprojection.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapprojection.go @@ -29,7 +29,7 @@ package v1 // Note that this is identical to a configmap volume source without the default // mode. type ConfigMapProjectionApplyConfiguration struct { - LocalObjectReferenceApplyConfiguration `json:",inline"` + LocalObjectReferenceApplyConfiguration `json:""` // items if unspecified, each key-value pair in the Data field of the referenced // ConfigMap will be projected into the volume as a file whose name is the // key and content is the value. If specified, the listed keys will be diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapvolumesource.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapvolumesource.go index b8a6a333f6..158857b8b2 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapvolumesource.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapvolumesource.go @@ -28,7 +28,7 @@ package v1 // the items element is populated with specific mappings of keys to paths. // ConfigMap volumes support ownership management and SELinux relabeling. type ConfigMapVolumeSourceApplyConfiguration struct { - LocalObjectReferenceApplyConfiguration `json:",inline"` + LocalObjectReferenceApplyConfiguration `json:""` // items if unspecified, each key-value pair in the Data field of the referenced // ConfigMap will be projected into the volume as a file whose name is the // key and content is the value. If specified, the listed keys will be @@ -47,6 +47,10 @@ type ConfigMapVolumeSourceApplyConfiguration struct { DefaultMode *int32 `json:"defaultMode,omitempty"` // optional specify whether the ConfigMap or its keys must be defined Optional *bool `json:"optional,omitempty"` + // defaultUser is Optional: The owner UID of the created files by default. + // The defaultUser field is only used as a fallback when the item-level user field is unset. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + DefaultUser *int64 `json:"defaultUser,omitempty"` } // ConfigMapVolumeSourceApplyConfiguration constructs a declarative configuration of the ConfigMapVolumeSource type for use with @@ -91,3 +95,11 @@ func (b *ConfigMapVolumeSourceApplyConfiguration) WithOptional(value bool) *Conf b.Optional = &value return b } + +// WithDefaultUser sets the DefaultUser 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 DefaultUser field is set to the value of the last call. +func (b *ConfigMapVolumeSourceApplyConfiguration) WithDefaultUser(value int64) *ConfigMapVolumeSourceApplyConfiguration { + b.DefaultUser = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/downwardapivolumefile.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/downwardapivolumefile.go index 9028f3133c..99eb736fa1 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/downwardapivolumefile.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/downwardapivolumefile.go @@ -37,6 +37,10 @@ type DownwardAPIVolumeFileApplyConfiguration struct { // This might be in conflict with other options that affect the file // mode, like fsGroup, and the result can be other mode bits set. Mode *int32 `json:"mode,omitempty"` + // user is Optional: The owner UID of the created file. + // If specified, the item-level user field takes precedence over defaultUser. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + User *int64 `json:"user,omitempty"` } // DownwardAPIVolumeFileApplyConfiguration constructs a declarative configuration of the DownwardAPIVolumeFile type for use with @@ -76,3 +80,11 @@ func (b *DownwardAPIVolumeFileApplyConfiguration) WithMode(value int32) *Downwar b.Mode = &value return b } + +// WithUser sets the User 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 User field is set to the value of the last call. +func (b *DownwardAPIVolumeFileApplyConfiguration) WithUser(value int64) *DownwardAPIVolumeFileApplyConfiguration { + b.User = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/downwardapivolumesource.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/downwardapivolumesource.go index 42e726689d..308b05780b 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/downwardapivolumesource.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/downwardapivolumesource.go @@ -35,6 +35,10 @@ type DownwardAPIVolumeSourceApplyConfiguration struct { // This might be in conflict with other options that affect the file // mode, like fsGroup, and the result can be other mode bits set. DefaultMode *int32 `json:"defaultMode,omitempty"` + // defaultUser is Optional: The owner UID of the created files by default. + // The defaultUser field is only used as a fallback when the item-level user field is unset. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + DefaultUser *int64 `json:"defaultUser,omitempty"` } // DownwardAPIVolumeSourceApplyConfiguration constructs a declarative configuration of the DownwardAPIVolumeSource type for use with @@ -63,3 +67,11 @@ func (b *DownwardAPIVolumeSourceApplyConfiguration) WithDefaultMode(value int32) b.DefaultMode = &value return b } + +// WithDefaultUser sets the DefaultUser 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 DefaultUser field is set to the value of the last call. +func (b *DownwardAPIVolumeSourceApplyConfiguration) WithDefaultUser(value int64) *DownwardAPIVolumeSourceApplyConfiguration { + b.DefaultUser = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/emptydirvolumesource.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/emptydirvolumesource.go index 97f71e8d21..b79a874d65 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/emptydirvolumesource.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/emptydirvolumesource.go @@ -41,6 +41,15 @@ type EmptyDirVolumeSourceApplyConfiguration struct { // The default is nil which means that the limit is undefined. // More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir SizeLimit *resource.Quantity `json:"sizeLimit,omitempty"` + // mode specifies the permission bits for the emptyDir directory, in numeric + // notation (e.g., 0755, 01777). Must be a value between 0000 and 01777. + // If not specified, defaults to 0777. + // This might be in conflict with other options that affect the file + // mode, like fsGroup. If fsGroup is specified, the fsGroup permissions + // will override the mode specified here. + // This field has no effect on Windows. + // This field is alpha and requires EmptyDirVolumeMode featuregate to be enabled. + Mode *int32 `json:"mode,omitempty"` } // EmptyDirVolumeSourceApplyConfiguration constructs a declarative configuration of the EmptyDirVolumeSource type for use with @@ -64,3 +73,11 @@ func (b *EmptyDirVolumeSourceApplyConfiguration) WithSizeLimit(value resource.Qu b.SizeLimit = &value return b } + +// WithMode sets the Mode 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 Mode field is set to the value of the last call. +func (b *EmptyDirVolumeSourceApplyConfiguration) WithMode(value int32) *EmptyDirVolumeSourceApplyConfiguration { + b.Mode = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/endpoints.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/endpoints.go index a13cd30e89..45861f369e 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/endpoints.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/endpoints.go @@ -49,7 +49,7 @@ import ( // // Deprecated: This API is deprecated in v1.33+. Use discoveryv1.EndpointSlice. type EndpointsApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/ephemeralcontainer.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/ephemeralcontainer.go index 43d97a6eff..3b3d1698c4 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/ephemeralcontainer.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/ephemeralcontainer.go @@ -38,7 +38,7 @@ type EphemeralContainerApplyConfiguration struct { // specific to ephemeral containers. Fields in common with Container are in the // following inlined struct so than an EphemeralContainer may easily be converted // to a Container. - EphemeralContainerCommonApplyConfiguration `json:",inline"` + EphemeralContainerCommonApplyConfiguration `json:""` // If set, the name of the container from PodSpec that this ephemeral container targets. // The ephemeral container will be run in the namespaces (IPC, PID, etc) of this container. // If not set then the ephemeral container uses the namespaces configured in the Pod spec. diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/event.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/event.go index 676a719b2f..80f48d4eef 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/event.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/event.go @@ -37,7 +37,7 @@ import ( // continued existence of events with that Reason. Events should be // treated as informative, best-effort, supplemental data. type EventApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/evictionresponder.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/evictionresponder.go new file mode 100644 index 0000000000..9decf94dd1 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/evictionresponder.go @@ -0,0 +1,70 @@ +/* +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 + +// EvictionResponderApplyConfiguration represents a declarative configuration of the EvictionResponder type for use +// with apply. +// +// EvictionResponder allows you to specify the responder reacting to an Eviction. +// Responders should observe and communicate through the Eviction Resource API to help with +// the graceful eviction of a target (e.g. termination of a pod). +type EvictionResponderApplyConfiguration struct { + // name allows you to identify the responder responding to the Eviction. + // + // It must be a valid domain-prefixed key (such as "acme.io/foo"). + // Domain names *.k8s.io and *.kubernetes.io are reserved. + // This field must be unique for each responder. + // This field is required. + Name *string `json:"name,omitempty"` + // priority for this responder. Higher priorities are selected first by the evictionrequest-controller. + // If there are responders with the same priority, the responder whose domain name comes first in the + // alphabetical higher domain order, will be picked. This means that the top domain labels are compared + // alphabetically first, followed by the lower domain labels. The key is compared last. + // + // The responder that is the managing controller of the pod should set the value of + // this field to 10000 to allow both for preemption or fallback registration by other + // responders. + // + // The minimum value is 0 and the maximum value is 100000. + // The interval 0-999 is reserved for responders with *.k8s.io suffix. + // This field is required. + Priority *int32 `json:"priority,omitempty"` +} + +// EvictionResponderApplyConfiguration constructs a declarative configuration of the EvictionResponder type for use with +// apply. +func EvictionResponder() *EvictionResponderApplyConfiguration { + return &EvictionResponderApplyConfiguration{} +} + +// 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 *EvictionResponderApplyConfiguration) WithName(value string) *EvictionResponderApplyConfiguration { + b.Name = &value + return b +} + +// WithPriority sets the Priority 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 Priority field is set to the value of the last call. +func (b *EvictionResponderApplyConfiguration) WithPriority(value int32) *EvictionResponderApplyConfiguration { + b.Priority = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/grpcaction.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/grpcaction.go index 40f5f9ecfd..05534f6bc8 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/grpcaction.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/grpcaction.go @@ -18,6 +18,10 @@ limitations under the License. package v1 +import ( + corev1 "k8s.io/api/core/v1" +) + // GRPCActionApplyConfiguration represents a declarative configuration of the GRPCAction type for use // with apply. // @@ -30,6 +34,11 @@ type GRPCActionApplyConfiguration struct { // // If this is not specified, the default behavior is defined by gRPC. Service *string `json:"service,omitempty"` + // mode specifies the connection mode for the gRPC health probe. + // Set to "TLS" to use TLS without certificate verification. + // Set to "Plaintext" to use a plaintext (insecure) connection explicitly. + // If not specified, the probe uses a plaintext (insecure) connection. + Mode *corev1.GRPCProbeMode `json:"mode,omitempty"` } // GRPCActionApplyConfiguration constructs a declarative configuration of the GRPCAction type for use with @@ -53,3 +62,11 @@ func (b *GRPCActionApplyConfiguration) WithService(value string) *GRPCActionAppl b.Service = &value return b } + +// WithMode sets the Mode 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 Mode field is set to the value of the last call. +func (b *GRPCActionApplyConfiguration) WithMode(value corev1.GRPCProbeMode) *GRPCActionApplyConfiguration { + b.Mode = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/httpgetaction.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/httpgetaction.go index 3f892c752d..ec4ac6ee61 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/httpgetaction.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/httpgetaction.go @@ -42,6 +42,9 @@ type HTTPGetActionApplyConfiguration struct { Scheme *corev1.URIScheme `json:"scheme,omitempty"` // Custom headers to set in the request. HTTP allows repeated headers. HTTPHeaders []HTTPHeaderApplyConfiguration `json:"httpHeaders,omitempty"` + // Protocol selects the wire protocol for the probe connection. + // Nil defaults to HTTP/1.1. + Protocol *corev1.HTTPProtocol `json:"protocol,omitempty"` } // HTTPGetActionApplyConfiguration constructs a declarative configuration of the HTTPGetAction type for use with @@ -94,3 +97,11 @@ func (b *HTTPGetActionApplyConfiguration) WithHTTPHeaders(values ...*HTTPHeaderA } return b } + +// WithProtocol sets the Protocol 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 Protocol field is set to the value of the last call. +func (b *HTTPGetActionApplyConfiguration) WithProtocol(value corev1.HTTPProtocol) *HTTPGetActionApplyConfiguration { + b.Protocol = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/keytopath.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/keytopath.go index 75ce1130a6..317554c74e 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/keytopath.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/keytopath.go @@ -37,6 +37,10 @@ type KeyToPathApplyConfiguration struct { // This might be in conflict with other options that affect the file // mode, like fsGroup, and the result can be other mode bits set. Mode *int32 `json:"mode,omitempty"` + // user is Optional: The owner UID of the created file. + // If specified, the item-level user field takes precedence over defaultUser. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + User *int64 `json:"user,omitempty"` } // KeyToPathApplyConfiguration constructs a declarative configuration of the KeyToPath type for use with @@ -68,3 +72,11 @@ func (b *KeyToPathApplyConfiguration) WithMode(value int32) *KeyToPathApplyConfi b.Mode = &value return b } + +// WithUser sets the User 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 User field is set to the value of the last call. +func (b *KeyToPathApplyConfiguration) WithUser(value int64) *KeyToPathApplyConfiguration { + b.User = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/limitrange.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/limitrange.go index 84a9fca312..e4da20c659 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/limitrange.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/limitrange.go @@ -32,7 +32,7 @@ import ( // // LimitRange sets resource usage limits for each kind of resource in a Namespace. type LimitRangeApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/namespace.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/namespace.go index a5bf0f9468..ab5c1b00d1 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/namespace.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/namespace.go @@ -33,7 +33,7 @@ import ( // Namespace provides a scope for Names. // Use of multiple namespaces is optional. type NamespaceApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/node.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/node.go index ff45b89945..511f02053d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/node.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/node.go @@ -33,7 +33,7 @@ import ( // Node is a worker node in Kubernetes. // Each node will have a unique identifier in the cache (i.e. in etcd). type NodeApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeallocatablemappedresources.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeallocatablemappedresources.go new file mode 100644 index 0000000000..aab1093bdb --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeallocatablemappedresources.go @@ -0,0 +1,59 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// NodeAllocatableMappedResourcesApplyConfiguration represents a declarative configuration of the NodeAllocatableMappedResources type for use +// with apply. +// +// NodeAllocatableMappedResources describes mapped node allocatable resource allocations. +type NodeAllocatableMappedResourcesApplyConfiguration struct { + // Name is the name of the resource (e.g., cpu, memory). + Name *corev1.ResourceName `json:"name,omitempty"` + // Quantity is the total node allocatable resource capacity allocated for the claim. + // This claim's allocated devices is shared by all the containers referencing the claim. + // Kubelet adds this value to both requests and limits at the pod-level cgroup, and to limits at the container-level cgroup for each container referencing the claim. + Quantity *resource.Quantity `json:"quantity,omitempty"` +} + +// NodeAllocatableMappedResourcesApplyConfiguration constructs a declarative configuration of the NodeAllocatableMappedResources type for use with +// apply. +func NodeAllocatableMappedResources() *NodeAllocatableMappedResourcesApplyConfiguration { + return &NodeAllocatableMappedResourcesApplyConfiguration{} +} + +// 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 *NodeAllocatableMappedResourcesApplyConfiguration) WithName(value corev1.ResourceName) *NodeAllocatableMappedResourcesApplyConfiguration { + b.Name = &value + return b +} + +// WithQuantity sets the Quantity 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 Quantity field is set to the value of the last call. +func (b *NodeAllocatableMappedResourcesApplyConfiguration) WithQuantity(value resource.Quantity) *NodeAllocatableMappedResourcesApplyConfiguration { + b.Quantity = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeallocatableoverheadresources.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeallocatableoverheadresources.go new file mode 100644 index 0000000000..fa7ca9442a --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeallocatableoverheadresources.go @@ -0,0 +1,77 @@ +/* +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 ( + corev1 "k8s.io/api/core/v1" + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// NodeAllocatableOverheadResourcesApplyConfiguration represents a declarative configuration of the NodeAllocatableOverheadResources type for use +// with apply. +// +// NodeAllocatableOverheadResources describes auxiliary overhead resource allocations. +type NodeAllocatableOverheadResourcesApplyConfiguration struct { + // Name is the name of the resource (e.g., cpu, memory). + Name *corev1.ResourceName `json:"name,omitempty"` + // PerPod is the flat overhead quantity allocated per pod. + // Adding to each container limit allows individual containers to utilize the overhead, while the parent pod-level cgroup limit caps the total usage at the pod boundary where the overhead is accounted for exactly once. + // At least one of PerPod or PerContainer must be specified. Specifying neither is an invalid configuration. + PerPod *resource.Quantity `json:"perPod,omitempty"` + // PerContainer is the variable overhead quantity applied for each container referencing the claim. + // The container references are recorded in `nodeAllocatableResourceClaimStatuses.containers`. + // The total overhead quantity allocated for the claim is computed as: + // Quantity = PerPod + (PerContainer * NumReferences) + // Kubelet accounts for this overhead in cgroups: + // - Pod-level cgroup (requests and limits): Kubelet adds PerPod + (PerContainer * NumReferences). + // - Container-level cgroup (limits only): Kubelet adds PerPod + PerContainer for each referencing container. + // This allows any single container to access the pod-level overhead, while the parent cgroup caps the total usage to account for PerPod exactly once. + // At least one of PerPod or PerContainer must be specified. Specifying neither is an invalid configuration. + PerContainer *resource.Quantity `json:"perContainer,omitempty"` +} + +// NodeAllocatableOverheadResourcesApplyConfiguration constructs a declarative configuration of the NodeAllocatableOverheadResources type for use with +// apply. +func NodeAllocatableOverheadResources() *NodeAllocatableOverheadResourcesApplyConfiguration { + return &NodeAllocatableOverheadResourcesApplyConfiguration{} +} + +// 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 *NodeAllocatableOverheadResourcesApplyConfiguration) WithName(value corev1.ResourceName) *NodeAllocatableOverheadResourcesApplyConfiguration { + b.Name = &value + return b +} + +// WithPerPod sets the PerPod 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 PerPod field is set to the value of the last call. +func (b *NodeAllocatableOverheadResourcesApplyConfiguration) WithPerPod(value resource.Quantity) *NodeAllocatableOverheadResourcesApplyConfiguration { + b.PerPod = &value + return b +} + +// WithPerContainer sets the PerContainer 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 PerContainer field is set to the value of the last call. +func (b *NodeAllocatableOverheadResourcesApplyConfiguration) WithPerContainer(value resource.Quantity) *NodeAllocatableOverheadResourcesApplyConfiguration { + b.PerContainer = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeallocatableresourceclaimstatus.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeallocatableresourceclaimstatus.go index 6e384b0028..9c67c7f9b4 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeallocatableresourceclaimstatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeallocatableresourceclaimstatus.go @@ -18,11 +18,6 @@ limitations under the License. package v1 -import ( - corev1 "k8s.io/api/core/v1" - resource "k8s.io/apimachinery/pkg/api/resource" -) - // NodeAllocatableResourceClaimStatusApplyConfiguration represents a declarative configuration of the NodeAllocatableResourceClaimStatus type for use // with apply. // @@ -32,8 +27,12 @@ type NodeAllocatableResourceClaimStatusApplyConfiguration struct { ResourceClaimName *string `json:"resourceClaimName,omitempty"` // Containers lists the names of all containers in this pod that reference the claim. Containers []string `json:"containers,omitempty"` - // Resources is a map of the node-allocatable resource name to the aggregate quantity allocated to the claim. - Resources map[corev1.ResourceName]resource.Quantity `json:"resources,omitempty"` + // Mapping contains allocations through devices mapped in the device spec's `nodeAllocatableResources[...].mapping` field. + // This is used by kubelet for pod level and container-level cgroup enforcement. + Mapping []NodeAllocatableMappedResourcesApplyConfiguration `json:"mapping,omitempty"` + // Overhead contains allocations through devices mapped in the device spec's `nodeAllocatableResources[...].overhead` field. + // This is used by kubelet for pod level and container-level cgroup enforcement. + Overhead []NodeAllocatableOverheadResourcesApplyConfiguration `json:"overhead,omitempty"` } // NodeAllocatableResourceClaimStatusApplyConfiguration constructs a declarative configuration of the NodeAllocatableResourceClaimStatus type for use with @@ -60,16 +59,28 @@ func (b *NodeAllocatableResourceClaimStatusApplyConfiguration) WithContainers(va return b } -// WithResources puts the entries into the Resources field in the declarative configuration +// WithMapping adds the given value to the Mapping 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 Resources field, -// overwriting an existing map entries in Resources field with the same key. -func (b *NodeAllocatableResourceClaimStatusApplyConfiguration) WithResources(entries map[corev1.ResourceName]resource.Quantity) *NodeAllocatableResourceClaimStatusApplyConfiguration { - if b.Resources == nil && len(entries) > 0 { - b.Resources = make(map[corev1.ResourceName]resource.Quantity, len(entries)) +// If called multiple times, values provided by each call will be appended to the Mapping field. +func (b *NodeAllocatableResourceClaimStatusApplyConfiguration) WithMapping(values ...*NodeAllocatableMappedResourcesApplyConfiguration) *NodeAllocatableResourceClaimStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMapping") + } + b.Mapping = append(b.Mapping, *values[i]) } - for k, v := range entries { - b.Resources[k] = v + return b +} + +// WithOverhead adds the given value to the Overhead 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 Overhead field. +func (b *NodeAllocatableResourceClaimStatusApplyConfiguration) WithOverhead(values ...*NodeAllocatableOverheadResourcesApplyConfiguration) *NodeAllocatableResourceClaimStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOverhead") + } + b.Overhead = append(b.Overhead, *values[i]) } return b } diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodepodpreemptionpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodepodpreemptionpolicy.go new file mode 100644 index 0000000000..62c0a00aec --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodepodpreemptionpolicy.go @@ -0,0 +1,47 @@ +/* +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 + +// NodePodPreemptionPolicyApplyConfiguration represents a declarative configuration of the NodePodPreemptionPolicy type for use +// with apply. +// +// NodePodPreemptionPolicy defines the node-level policies governing preemption for pods on this node. +type NodePodPreemptionPolicyApplyConfiguration struct { + // DisableResizePreemption lists the owners (e.g., autoscalers, operators, administrators) + // that have requested to disable scheduler and Kubelet preemption for in-place pod resize on this node. + // If this list is non-empty, resize-induced preemption is disabled on this node. + // This is an alpha field and requires enabling the InPlacePodVerticalScalingSchedulerPreemption feature gate. + DisableResizePreemption []string `json:"disableResizePreemption,omitempty"` +} + +// NodePodPreemptionPolicyApplyConfiguration constructs a declarative configuration of the NodePodPreemptionPolicy type for use with +// apply. +func NodePodPreemptionPolicy() *NodePodPreemptionPolicyApplyConfiguration { + return &NodePodPreemptionPolicyApplyConfiguration{} +} + +// WithDisableResizePreemption adds the given value to the DisableResizePreemption 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 DisableResizePreemption field. +func (b *NodePodPreemptionPolicyApplyConfiguration) WithDisableResizePreemption(values ...string) *NodePodPreemptionPolicyApplyConfiguration { + for i := range values { + b.DisableResizePreemption = append(b.DisableResizePreemption, values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodespec.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodespec.go index b53ed21d79..2839ed7679 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodespec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodespec.go @@ -41,6 +41,9 @@ type NodeSpecApplyConfiguration struct { // Deprecated. Not all kubelets will set this field. Remove field after 1.13. // see: https://issues.k8s.io/61966 DoNotUseExternalID *string `json:"externalID,omitempty"` + // PodPreemptionPolicy controls the node-level preemption behaviors for pods on this node. + // This is an alpha field and requires enabling the InPlacePodVerticalScalingSchedulerPreemption feature gate. + PodPreemptionPolicy *NodePodPreemptionPolicyApplyConfiguration `json:"podPreemptionPolicy,omitempty"` } // NodeSpecApplyConfiguration constructs a declarative configuration of the NodeSpec type for use with @@ -111,3 +114,11 @@ func (b *NodeSpecApplyConfiguration) WithDoNotUseExternalID(value string) *NodeS b.DoNotUseExternalID = &value return b } + +// WithPodPreemptionPolicy sets the PodPreemptionPolicy 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 PodPreemptionPolicy field is set to the value of the last call. +func (b *NodeSpecApplyConfiguration) WithPodPreemptionPolicy(value *NodePodPreemptionPolicyApplyConfiguration) *NodeSpecApplyConfiguration { + b.PodPreemptionPolicy = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodesysteminfo.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodesysteminfo.go index 70b8a7819d..14a4680b2a 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodesysteminfo.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodesysteminfo.go @@ -49,6 +49,8 @@ type NodeSystemInfoApplyConfiguration struct { Architecture *string `json:"architecture,omitempty"` // Swap Info reported by the node. Swap *NodeSwapStatusApplyConfiguration `json:"swap,omitempty"` + // Whether the node is running in a user namespace. + RunningInUserNamespace *bool `json:"runningInUserNamespace,omitempty"` } // NodeSystemInfoApplyConfiguration constructs a declarative configuration of the NodeSystemInfo type for use with @@ -144,3 +146,11 @@ func (b *NodeSystemInfoApplyConfiguration) WithSwap(value *NodeSwapStatusApplyCo b.Swap = value return b } + +// WithRunningInUserNamespace sets the RunningInUserNamespace 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 RunningInUserNamespace field is set to the value of the last call. +func (b *NodeSystemInfoApplyConfiguration) WithRunningInUserNamespace(value bool) *NodeSystemInfoApplyConfiguration { + b.RunningInUserNamespace = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolume.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolume.go index 4ef8ed4b5f..34da80ab9f 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolume.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolume.go @@ -34,7 +34,7 @@ import ( // It is analogous to a node. // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes type PersistentVolumeApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaim.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaim.go index d77417f359..1f86f61f7b 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaim.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaim.go @@ -32,7 +32,7 @@ import ( // // PersistentVolumeClaim is a user's request for and claim to a persistent volume type PersistentVolumeClaimApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimspec.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimspec.go index 8710769b77..1761f7bf30 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimspec.go @@ -53,8 +53,8 @@ type PersistentVolumeClaimSpecApplyConfiguration struct { // * An existing PVC (PersistentVolumeClaim) // If the provisioner or an external controller can support the specified data source, // it will create a new volume based on the contents of the specified data source. - // When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, - // and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. + // dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be + // copied to dataSource when dataSourceRef.namespace is not specified. // If the namespace is specified, then dataSourceRef will not be copied to dataSource. DataSource *TypedLocalObjectReferenceApplyConfiguration `json:"dataSource,omitempty"` // dataSourceRef specifies the object from which to populate the volume with data, if a non-empty @@ -78,7 +78,6 @@ type PersistentVolumeClaimSpecApplyConfiguration struct { // specified. // * While dataSource only allows local objects, dataSourceRef allows objects // in any namespaces. - // (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. // (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. DataSourceRef *TypedObjectReferenceApplyConfiguration `json:"dataSourceRef,omitempty"` // volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimstatus.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimstatus.go index ee2d5adbd3..c910005eb4 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimstatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimstatus.go @@ -98,6 +98,9 @@ type PersistentVolumeClaimStatusApplyConfiguration struct { // ModifyVolumeStatus represents the status object of ControllerModifyVolume operation. // When this is unset, there is no ModifyVolume operation being attempted. ModifyVolumeStatus *ModifyVolumeStatusApplyConfiguration `json:"modifyVolumeStatus,omitempty"` + // healthStatus contains the latest controller-reported health information + // for the volume bound to this claim. + HealthStatus *VolumeHealthStatusApplyConfiguration `json:"healthStatus,omitempty"` } // PersistentVolumeClaimStatusApplyConfiguration constructs a declarative configuration of the PersistentVolumeClaimStatus type for use with @@ -182,3 +185,11 @@ func (b *PersistentVolumeClaimStatusApplyConfiguration) WithModifyVolumeStatus(v b.ModifyVolumeStatus = value return b } + +// WithHealthStatus sets the HealthStatus 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 HealthStatus field is set to the value of the last call. +func (b *PersistentVolumeClaimStatusApplyConfiguration) WithHealthStatus(value *VolumeHealthStatusApplyConfiguration) *PersistentVolumeClaimStatusApplyConfiguration { + b.HealthStatus = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumespec.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumespec.go index 8c16610222..72fb8f540c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumespec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumespec.go @@ -31,7 +31,7 @@ type PersistentVolumeSpecApplyConfiguration struct { // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity Capacity *corev1.ResourceList `json:"capacity,omitempty"` // persistentVolumeSource is the actual volume backing the persistent volume. - PersistentVolumeSourceApplyConfiguration `json:",inline"` + PersistentVolumeSourceApplyConfiguration `json:""` // accessModes contains all ways the volume can be mounted. // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes AccessModes []corev1.PersistentVolumeAccessMode `json:"accessModes,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/pod.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/pod.go index d10d38de19..815c0b4b63 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/pod.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/pod.go @@ -33,7 +33,7 @@ import ( // Pod is a collection of containers that can run on a host. This resource is created // by clients and scheduled onto hosts. type PodApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podcertificateprojection.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podcertificateprojection.go index 0d951a8948..3c10f37e0d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podcertificateprojection.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podcertificateprojection.go @@ -89,6 +89,10 @@ type PodCertificateProjectionApplyConfiguration struct { // Signers should document the keys and values they support. Signers should // deny requests that contain keys they do not recognize. UserAnnotations map[string]string `json:"userAnnotations,omitempty"` + // user is Optional: The owner UID of the created file. + // If specified, the item-level user field takes precedence over defaultUser. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + User *int64 `json:"user,omitempty"` } // PodCertificateProjectionApplyConfiguration constructs a declarative configuration of the PodCertificateProjection type for use with @@ -158,3 +162,11 @@ func (b *PodCertificateProjectionApplyConfiguration) WithUserAnnotations(entries } return b } + +// WithUser sets the User 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 User field is set to the value of the last call. +func (b *PodCertificateProjectionApplyConfiguration) WithUser(value int64) *PodCertificateProjectionApplyConfiguration { + b.User = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podsecuritycontext.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podsecuritycontext.go index a6f1629ed7..951ced04b4 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podsecuritycontext.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podsecuritycontext.go @@ -121,11 +121,8 @@ type PodSecurityContextApplyConfiguration struct { // Eligible volumes are in-tree FibreChannel and iSCSI volumes, and all CSI volumes // whose CSI driver announces SELinux support by setting spec.seLinuxMount: true in their // CSIDriver instance. Other volumes are always re-labelled recursively. - // "MountOption" value is allowed only when SELinuxMount feature gate is enabled. // - // If not specified and SELinuxMount feature gate is enabled, "MountOption" is used. - // If not specified and SELinuxMount feature gate is disabled, "MountOption" is used for ReadWriteOncePod volumes - // and "Recursive" for all other volumes. + // If not specified, "MountOption" is used. // // This field affects only Pods that have SELinux label set, either in PodSecurityContext or in SecurityContext of all containers. // diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podspec.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podspec.go index e67c18c41b..f46481dabc 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podspec.go @@ -172,6 +172,8 @@ type PodSpecApplyConfiguration struct { EnableServiceLinks *bool `json:"enableServiceLinks,omitempty"` // PreemptionPolicy is the Policy for preempting pods with lower priority. // One of Never, PreemptLowerPriority. + // When Priority Admission Controller is enabled, it prevents users from setting + // this field. The admission controller populates this field from PriorityClassName. // Defaults to PreemptLowerPriority if unset. PreemptionPolicy *corev1.PreemptionPolicy `json:"preemptionPolicy,omitempty"` // Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. @@ -270,7 +272,6 @@ type PodSpecApplyConfiguration struct { // - `hostNetwork` must be set to false. // // This field must be a valid DNS subdomain as defined in RFC 1123 and contain at most 64 characters. - // Requires the HostnameOverride feature gate to be enabled. HostnameOverride *string `json:"hostnameOverride,omitempty"` // SchedulingGroup provides a reference to the immediate scheduling runtime // grouping object that this Pod belongs to. @@ -285,6 +286,22 @@ type PodSpecApplyConfiguration struct { // recreated with different policies. Doing this during pod scheduling // may result in the placement not conforming to the expected policies. SchedulingGroup *PodSchedulingGroupApplyConfiguration `json:"schedulingGroup,omitempty"` + // evictionResponders reference responders that react to Evictions based on EvictionRequests. + // Responders should observe and communicate through the Eviction Resource API to help with + // the graceful termination of a pod. The responders are selected sequentially, according to + // their specified priority. + // + // Responders should periodically report on an eviction progress by updating the + // .status.responders[].heartbeatTime field of the Eviction object. If this field is not updated + // within the heartbeat deadline defined by the Eviction API (currently 20 minutes), the eviction + // is passed over to the next responder with a lower priority. If there is no other responder, + // the last default imperative-eviction.k8s.io/evictor responder with a priority of 100 will + // evict the pod using the imperative Eviction API (pods//eviction subresource). + // + // The maximum length of the responders list is 10. + // Responders are not supported when the pod is part of a PodGroup (.spec.schedulingGroup is set). + // This field can only be set on creation and is immutable afterwards. + EvictionResponders []EvictionResponderApplyConfiguration `json:"evictionResponders,omitempty"` } // PodSpecApplyConfiguration constructs a declarative configuration of the PodSpec type for use with @@ -689,3 +706,16 @@ func (b *PodSpecApplyConfiguration) WithSchedulingGroup(value *PodSchedulingGrou b.SchedulingGroup = value return b } + +// WithEvictionResponders adds the given value to the EvictionResponders 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 EvictionResponders field. +func (b *PodSpecApplyConfiguration) WithEvictionResponders(values ...*EvictionResponderApplyConfiguration) *PodSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithEvictionResponders") + } + b.EvictionResponders = append(b.EvictionResponders, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podstatus.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podstatus.go index 8328d9cdb1..1bc37b5071 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podstatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podstatus.go @@ -145,6 +145,9 @@ type PodStatusApplyConfiguration struct { // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). // Examples include "cpu", "memory", "ephemeral-storage", and hugepages. NodeAllocatableResourceClaimStatuses []NodeAllocatableResourceClaimStatusApplyConfiguration `json:"nodeAllocatableResourceClaimStatuses,omitempty"` + // volumeHealth contains node-reported health for each volume the pod is using. + // Populated by the kubelet on the pod's node. + VolumeHealth []PodVolumeHealthApplyConfiguration `json:"volumeHealth,omitempty"` } // PodStatusApplyConfiguration constructs a declarative configuration of the PodStatus type for use with @@ -360,3 +363,16 @@ func (b *PodStatusApplyConfiguration) WithNodeAllocatableResourceClaimStatuses(v } return b } + +// WithVolumeHealth adds the given value to the VolumeHealth 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 VolumeHealth field. +func (b *PodStatusApplyConfiguration) WithVolumeHealth(values ...*PodVolumeHealthApplyConfiguration) *PodStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVolumeHealth") + } + b.VolumeHealth = append(b.VolumeHealth, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podtemplate.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podtemplate.go index a4a2e300e4..a78cd0430b 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podtemplate.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podtemplate.go @@ -32,7 +32,7 @@ import ( // // PodTemplate describes a template for creating copies of a predefined pod. type PodTemplateApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podvolumehealth.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podvolumehealth.go new file mode 100644 index 0000000000..f17399dff7 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podvolumehealth.go @@ -0,0 +1,74 @@ +/* +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 ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PodVolumeHealthApplyConfiguration represents a declarative configuration of the PodVolumeHealth type for use +// with apply. +// +// PodVolumeHealth contains health information for a volume used by a pod, +// reported by the CSI node plugin via the kubelet. +type PodVolumeHealthApplyConfiguration struct { + // name matches an entry in pod.spec.volumes. + Name *string `json:"name,omitempty"` + // conditions is the set of adverse conditions reported by + // the CSI node plugin for this volume on this node. + // At most 16 conditions may be reported. + HealthConditions []VolumeHealthConditionApplyConfiguration `json:"healthConditions,omitempty"` + // lastTransitionTime is when the current set of conditions first appeared. + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` +} + +// PodVolumeHealthApplyConfiguration constructs a declarative configuration of the PodVolumeHealth type for use with +// apply. +func PodVolumeHealth() *PodVolumeHealthApplyConfiguration { + return &PodVolumeHealthApplyConfiguration{} +} + +// 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 *PodVolumeHealthApplyConfiguration) WithName(value string) *PodVolumeHealthApplyConfiguration { + b.Name = &value + return b +} + +// WithHealthConditions adds the given value to the HealthConditions 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 HealthConditions field. +func (b *PodVolumeHealthApplyConfiguration) WithHealthConditions(values ...*VolumeHealthConditionApplyConfiguration) *PodVolumeHealthApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithHealthConditions") + } + b.HealthConditions = append(b.HealthConditions, *values[i]) + } + return b +} + +// WithLastTransitionTime sets the LastTransitionTime 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 LastTransitionTime field is set to the value of the last call. +func (b *PodVolumeHealthApplyConfiguration) WithLastTransitionTime(value metav1.Time) *PodVolumeHealthApplyConfiguration { + b.LastTransitionTime = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/probe.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/probe.go index e6b3ddd7c5..5ea41ea5cf 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/probe.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/probe.go @@ -25,7 +25,7 @@ package v1 // alive or ready to receive traffic. type ProbeApplyConfiguration struct { // The action taken to determine the health of a container - ProbeHandlerApplyConfiguration `json:",inline"` + ProbeHandlerApplyConfiguration `json:""` // Number of seconds after the container has started before liveness probes are initiated. // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes InitialDelaySeconds *int32 `json:"initialDelaySeconds,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/projectedvolumesource.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/projectedvolumesource.go index a17e4d1dfc..c00e9ca6c4 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/projectedvolumesource.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/projectedvolumesource.go @@ -33,6 +33,10 @@ type ProjectedVolumeSourceApplyConfiguration struct { // This might be in conflict with other options that affect the file // mode, like fsGroup, and the result can be other mode bits set. DefaultMode *int32 `json:"defaultMode,omitempty"` + // defaultUser is Optional: The owner UID of the created files by default. + // The defaultUser field is only used as a fallback when the item-level user field is unset. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + DefaultUser *int64 `json:"defaultUser,omitempty"` } // ProjectedVolumeSourceApplyConfiguration constructs a declarative configuration of the ProjectedVolumeSource type for use with @@ -61,3 +65,11 @@ func (b *ProjectedVolumeSourceApplyConfiguration) WithDefaultMode(value int32) * b.DefaultMode = &value return b } + +// WithDefaultUser sets the DefaultUser 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 DefaultUser field is set to the value of the last call. +func (b *ProjectedVolumeSourceApplyConfiguration) WithDefaultUser(value int64) *ProjectedVolumeSourceApplyConfiguration { + b.DefaultUser = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/replicationcontroller.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/replicationcontroller.go index a6416c4b77..8d8c43547a 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/replicationcontroller.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/replicationcontroller.go @@ -32,7 +32,7 @@ import ( // // ReplicationController represents the configuration of a replication controller. type ReplicationControllerApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // If the Labels of a ReplicationController are empty, they are defaulted to // be the same as the Pod(s) that the replication controller manages. // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcequota.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcequota.go index 6489d2928d..475135b071 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcequota.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcequota.go @@ -32,7 +32,7 @@ import ( // // ResourceQuota sets aggregate quota restrictions enforced per namespace type ResourceQuotaApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcestatus.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcestatus.go index 511164e7cf..b418ff4cb4 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcestatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcestatus.go @@ -28,8 +28,13 @@ import ( // ResourceStatus represents the status of a single resource allocated to a Pod. type ResourceStatusApplyConfiguration struct { // Name of the resource. Must be unique within the pod and in case of non-DRA resource, match one of the resources from the pod spec. - // For DRA resources, the value must be "claim:/". - // When this status is reported about a container, the "claim_name" and "request" must match one of the claims of this container. + // For DRA resources, the value must be "claim:/" when + // container.resources.claims[*].request is set or "claim:" when + // container.resources.claims[*].request is empty. + // For DRA-backed extended resources, "claim:/" is used + // when the claim name and request name are recorded in pod.status.extendedResourceClaimStatus. + // When this status is reported about a container, the "claim_name" and "request" + // must match one of the claims of this container. Name *corev1.ResourceName `json:"name,omitempty"` // List of unique resources health. Each element in the list contains an unique resource ID and its health. // At a minimum, for the lifetime of a Pod, resource ID must uniquely identify the resource allocated to the Pod on the Node. diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/secret.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/secret.go index 42be779311..e4b12ad2bf 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/secret.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/secret.go @@ -33,7 +33,7 @@ import ( // Secret holds secret data of a certain type. The total bytes of the values in // the Data field must be less than MaxSecretSize bytes. type SecretApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretenvsource.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretenvsource.go index 21a6b75248..bb2f7243e7 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretenvsource.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretenvsource.go @@ -28,7 +28,7 @@ package v1 // key-value pairs as environment variables. type SecretEnvSourceApplyConfiguration struct { // The Secret to select from. - LocalObjectReferenceApplyConfiguration `json:",inline"` + LocalObjectReferenceApplyConfiguration `json:""` // Specify whether the Secret must be defined Optional *bool `json:"optional,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretkeyselector.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretkeyselector.go index 8e83bc813c..71d48813c5 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretkeyselector.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretkeyselector.go @@ -24,7 +24,7 @@ package v1 // SecretKeySelector selects a key of a Secret. type SecretKeySelectorApplyConfiguration struct { // The name of the secret in the pod's namespace to select from. - LocalObjectReferenceApplyConfiguration `json:",inline"` + LocalObjectReferenceApplyConfiguration `json:""` // The key of the secret to select from. Must be a valid secret key. Key *string `json:"key,omitempty"` // Specify whether the Secret or its key must be defined diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretprojection.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretprojection.go index 87016d9fa3..879ed4bf4e 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretprojection.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretprojection.go @@ -28,7 +28,7 @@ package v1 // Note that this is identical to a secret volume source without the default // mode. type SecretProjectionApplyConfiguration struct { - LocalObjectReferenceApplyConfiguration `json:",inline"` + LocalObjectReferenceApplyConfiguration `json:""` // items if unspecified, each key-value pair in the Data field of the referenced // Secret will be projected into the volume as a file whose name is the // key and content is the value. If specified, the listed keys will be diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretvolumesource.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretvolumesource.go index bdc098535e..a4c37ae01e 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretvolumesource.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretvolumesource.go @@ -48,6 +48,10 @@ type SecretVolumeSourceApplyConfiguration struct { DefaultMode *int32 `json:"defaultMode,omitempty"` // optional field specify whether the Secret or its keys must be defined Optional *bool `json:"optional,omitempty"` + // defaultUser is Optional: The owner UID of the created files by default. + // The defaultUser field is only used as a fallback when the item-level user field is unset. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + DefaultUser *int64 `json:"defaultUser,omitempty"` } // SecretVolumeSourceApplyConfiguration constructs a declarative configuration of the SecretVolumeSource type for use with @@ -92,3 +96,11 @@ func (b *SecretVolumeSourceApplyConfiguration) WithOptional(value bool) *SecretV b.Optional = &value return b } + +// WithDefaultUser sets the DefaultUser 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 DefaultUser field is set to the value of the last call. +func (b *SecretVolumeSourceApplyConfiguration) WithDefaultUser(value int64) *SecretVolumeSourceApplyConfiguration { + b.DefaultUser = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/service.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/service.go index b0e667824b..432aa14eed 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/service.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/service.go @@ -34,7 +34,7 @@ import ( // (for example 3306) that the proxy listens on, and the selector that determines which pods // will answer requests sent through the proxy. type ServiceApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/serviceaccount.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/serviceaccount.go index d439347778..2104cb4e43 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/serviceaccount.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/serviceaccount.go @@ -35,7 +35,7 @@ import ( // * a principal that can be authenticated and authorized // * a set of secrets type ServiceAccountApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/serviceaccounttokenprojection.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/serviceaccounttokenprojection.go index e2bf69bc44..93b13a2897 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/serviceaccounttokenprojection.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/serviceaccounttokenprojection.go @@ -41,6 +41,10 @@ type ServiceAccountTokenProjectionApplyConfiguration struct { // path is the path relative to the mount point of the file to project the // token into. Path *string `json:"path,omitempty"` + // user is Optional: The owner UID of the created file. + // If specified, the item-level user field takes precedence over defaultUser. + // (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + User *int64 `json:"user,omitempty"` } // ServiceAccountTokenProjectionApplyConfiguration constructs a declarative configuration of the ServiceAccountTokenProjection type for use with @@ -72,3 +76,11 @@ func (b *ServiceAccountTokenProjectionApplyConfiguration) WithPath(value string) b.Path = &value return b } + +// WithUser sets the User 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 User field is set to the value of the last call. +func (b *ServiceAccountTokenProjectionApplyConfiguration) WithUser(value int64) *ServiceAccountTokenProjectionApplyConfiguration { + b.User = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/volume.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/volume.go index 2e4c0e6ad6..a2e0b3fc9d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/volume.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/volume.go @@ -30,7 +30,7 @@ type VolumeApplyConfiguration struct { // volumeSource represents the location and type of the mounted volume. // If not specified, the Volume is implied to be an EmptyDir. // This implied behavior is deprecated and will be removed in a future version. - VolumeSourceApplyConfiguration `json:",inline"` + VolumeSourceApplyConfiguration `json:""` } // VolumeApplyConfiguration constructs a declarative configuration of the Volume type for use with diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumehealthcondition.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumehealthcondition.go new file mode 100644 index 0000000000..26fa8d1401 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumehealthcondition.go @@ -0,0 +1,73 @@ +/* +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 ( + corev1 "k8s.io/api/core/v1" +) + +// VolumeHealthConditionApplyConfiguration represents a declarative configuration of the VolumeHealthCondition type for use +// with apply. +// +// VolumeHealthCondition represents an adverse health condition reported for a volume. +type VolumeHealthConditionApplyConfiguration struct { + // status is the machine-parseable health category. + // Possible values: + // - "Inaccessible": the volume cannot be accessed. + // - "DataLoss": data loss has been detected on the volume. + // - "Degraded": the volume is functioning with reduced capability. + Status *corev1.VolumeHealthStatusType `json:"status,omitempty"` + // reason is a brief CamelCase machine-parseable reason. + // Together with status it forms the unique identity of a condition entry. + // Maximum permitted length of a reason is 256 bytes. + Reason *string `json:"reason,omitempty"` + // message is a human-readable description. + // Maximum permitted length of a message is 1024 bytes. + Message *string `json:"message,omitempty"` +} + +// VolumeHealthConditionApplyConfiguration constructs a declarative configuration of the VolumeHealthCondition type for use with +// apply. +func VolumeHealthCondition() *VolumeHealthConditionApplyConfiguration { + return &VolumeHealthConditionApplyConfiguration{} +} + +// WithStatus sets the Status 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 Status field is set to the value of the last call. +func (b *VolumeHealthConditionApplyConfiguration) WithStatus(value corev1.VolumeHealthStatusType) *VolumeHealthConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithReason sets the Reason 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 Reason field is set to the value of the last call. +func (b *VolumeHealthConditionApplyConfiguration) WithReason(value string) *VolumeHealthConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message 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 Message field is set to the value of the last call. +func (b *VolumeHealthConditionApplyConfiguration) WithMessage(value string) *VolumeHealthConditionApplyConfiguration { + b.Message = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumehealthstatus.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumehealthstatus.go new file mode 100644 index 0000000000..23d3b22c8d --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumehealthstatus.go @@ -0,0 +1,64 @@ +/* +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 ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// VolumeHealthStatusApplyConfiguration represents a declarative configuration of the VolumeHealthStatus type for use +// with apply. +// +// VolumeHealthStatus contains health information for a volume reported +// by the CSI controller plugin. +type VolumeHealthStatusApplyConfiguration struct { + // conditions is the set of adverse conditions reported by + // the CSI controller plugin. An empty list means no adverse condition. + // At most 16 conditions may be reported. + HealthConditions []VolumeHealthConditionApplyConfiguration `json:"healthConditions,omitempty"` + // lastTransitionTime is when the current set of conditions first appeared. + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` +} + +// VolumeHealthStatusApplyConfiguration constructs a declarative configuration of the VolumeHealthStatus type for use with +// apply. +func VolumeHealthStatus() *VolumeHealthStatusApplyConfiguration { + return &VolumeHealthStatusApplyConfiguration{} +} + +// WithHealthConditions adds the given value to the HealthConditions 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 HealthConditions field. +func (b *VolumeHealthStatusApplyConfiguration) WithHealthConditions(values ...*VolumeHealthConditionApplyConfiguration) *VolumeHealthStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithHealthConditions") + } + b.HealthConditions = append(b.HealthConditions, *values[i]) + } + return b +} + +// WithLastTransitionTime sets the LastTransitionTime 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 LastTransitionTime field is set to the value of the last call. +func (b *VolumeHealthStatusApplyConfiguration) WithLastTransitionTime(value metav1.Time) *VolumeHealthStatusApplyConfiguration { + b.LastTransitionTime = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumemount.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumemount.go index 83b71eb659..35e77e3dac 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumemount.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumemount.go @@ -49,8 +49,7 @@ type VolumeMountApplyConfiguration struct { // // If this field is not specified, it is treated as an equivalent of Disabled. RecursiveReadOnly *corev1.RecursiveReadOnlyMode `json:"recursiveReadOnly,omitempty"` - // Path within the container at which the volume should be mounted. Must - // not contain ':'. + // Path within the container at which the volume should be mounted. MountPath *string `json:"mountPath,omitempty"` // Path within the volume from which the container's volume should be mounted. // Defaults to "" (volume's root). @@ -67,6 +66,13 @@ type VolumeMountApplyConfiguration struct { // Defaults to "" (volume's root). // SubPathExpr and SubPath are mutually exclusive. SubPathExpr *string `json:"subPathExpr,omitempty"` + // bindMountOptions is the list of additional bind mount options to apply when + // mounting this volume into the container. Allowed values are noexec, + // nodev, and nosuid. These are Linux mount options and have no effect on + // Windows nodes. + // This field is not supported with image volumes. + // This is an alpha field and requires enabling the VolumeBindMountOptions feature gate. + BindMountOptions []string `json:"bindMountOptions,omitempty"` } // VolumeMountApplyConfiguration constructs a declarative configuration of the VolumeMount type for use with @@ -130,3 +136,13 @@ func (b *VolumeMountApplyConfiguration) WithSubPathExpr(value string) *VolumeMou b.SubPathExpr = &value return b } + +// WithBindMountOptions adds the given value to the BindMountOptions 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 BindMountOptions field. +func (b *VolumeMountApplyConfiguration) WithBindMountOptions(values ...string) *VolumeMountApplyConfiguration { + for i := range values { + b.BindMountOptions = append(b.BindMountOptions, values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpointslice.go b/vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpointslice.go index cba77dd571..705dd0be44 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpointslice.go +++ b/vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpointslice.go @@ -37,7 +37,7 @@ import ( // by listing EndpointSlices in the service's namespace whose `kubernetes.io/service-name` // label contains the service's name. type EndpointSliceApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // addressType specifies the type of address carried by this EndpointSlice. diff --git a/vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpointslice.go b/vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpointslice.go index 4d40de54a6..2a1ac2ca95 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpointslice.go +++ b/vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpointslice.go @@ -34,7 +34,7 @@ import ( // For a given service there may be multiple EndpointSlice objects, selected by // labels, which must be joined to produce the full set of endpoints. type EndpointSliceApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // addressType specifies the type of address carried by this EndpointSlice. diff --git a/vendor/k8s.io/client-go/applyconfigurations/events/v1/event.go b/vendor/k8s.io/client-go/applyconfigurations/events/v1/event.go index 122cccad7e..e5c5721733 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/events/v1/event.go +++ b/vendor/k8s.io/client-go/applyconfigurations/events/v1/event.go @@ -38,8 +38,8 @@ import ( // continued existence of events with that Reason. Events should be // treated as informative, best-effort, supplemental data. type EventApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // eventTime is the time when this Event was first observed. It is required. diff --git a/vendor/k8s.io/client-go/applyconfigurations/events/v1beta1/event.go b/vendor/k8s.io/client-go/applyconfigurations/events/v1beta1/event.go index cf6068f470..a4a6abe6d1 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/events/v1beta1/event.go +++ b/vendor/k8s.io/client-go/applyconfigurations/events/v1beta1/event.go @@ -38,8 +38,8 @@ import ( // continued existence of events with that Reason. Events should be // treated as informative, best-effort, supplemental data. type EventApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // eventTime is the time when this Event was first observed. It is required. diff --git a/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonset.go b/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonset.go index 452f9b1c2d..c6968fec94 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonset.go +++ b/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonset.go @@ -34,7 +34,7 @@ import ( // more information. // DaemonSet represents the configuration of a daemon set. type DaemonSetApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deployment.go b/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deployment.go index 6d0e5f89cf..27a554b12c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deployment.go +++ b/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deployment.go @@ -34,7 +34,7 @@ import ( // more information. // Deployment enables declarative updates for Pods and ReplicaSets. type DeploymentApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Specification of the desired behavior of the Deployment. diff --git a/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingress.go b/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingress.go index ba82ba9be4..8b6ed56e05 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingress.go +++ b/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingress.go @@ -36,7 +36,7 @@ import ( // based virtual hosting etc. // DEPRECATED - This group version of Ingress is deprecated by networking.k8s.io/v1beta1 Ingress. See the release notes for more information. type IngressApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressrule.go b/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressrule.go index 91ebcf89f0..323574f095 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressrule.go +++ b/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressrule.go @@ -53,7 +53,7 @@ type IngressRuleApplyConfiguration struct { // just traffic matching the host to the default backend or all traffic to the // default backend, is left to the controller fulfilling the Ingress. Http is // currently the only supported IngressRuleValue. - IngressRuleValueApplyConfiguration `json:",inline"` + IngressRuleValueApplyConfiguration `json:""` } // IngressRuleApplyConfiguration constructs a declarative configuration of the IngressRule type for use with diff --git a/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicy.go index 64d95e4925..860d8ec7e4 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicy.go +++ b/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicy.go @@ -33,7 +33,7 @@ import ( // DEPRECATED 1.9 - This group version of NetworkPolicy is deprecated by networking/v1/NetworkPolicy. // NetworkPolicy describes what network traffic is allowed for a set of Pods type NetworkPolicyApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/replicaset.go b/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/replicaset.go index 02d6cbffe4..2dfa8fdcb2 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/replicaset.go +++ b/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/replicaset.go @@ -34,7 +34,7 @@ import ( // more information. // ReplicaSet ensures that a specified number of pod replicas are running at any given time. type ReplicaSetApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // If the Labels of a ReplicaSet are empty, they are defaulted to // be the same as the Pod(s) that the ReplicaSet manages. // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata diff --git a/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/scale.go b/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/scale.go index 9637d58c84..8542fa6667 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/scale.go +++ b/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/scale.go @@ -30,7 +30,7 @@ import ( // // represents a scaling request for a resource. type ScaleApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. diff --git a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1/flowschema.go b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1/flowschema.go index 1bfc945a3f..085dd1bf92 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1/flowschema.go +++ b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1/flowschema.go @@ -33,7 +33,7 @@ import ( // FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with // similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". type FlowSchemaApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1/flowschemacondition.go b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1/flowschemacondition.go index a9023615de..fa6c672058 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1/flowschemacondition.go +++ b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1/flowschemacondition.go @@ -32,8 +32,7 @@ type FlowSchemaConditionApplyConfiguration struct { // Required. Type *flowcontrolv1.FlowSchemaConditionType `json:"type,omitempty"` // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. Status *flowcontrolv1.ConditionStatus `json:"status,omitempty"` // `lastTransitionTime` is the last time the condition transitioned from one status to another. LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1/prioritylevelconfiguration.go index d64c3acb62..ae87170fd7 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1/prioritylevelconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1/prioritylevelconfiguration.go @@ -32,7 +32,7 @@ import ( // // PriorityLevelConfiguration represents the configuration of a priority level. type PriorityLevelConfigurationApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1/prioritylevelconfigurationcondition.go b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1/prioritylevelconfigurationcondition.go index 82b9547d57..ea7be15dca 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1/prioritylevelconfigurationcondition.go +++ b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1/prioritylevelconfigurationcondition.go @@ -32,8 +32,7 @@ type PriorityLevelConfigurationConditionApplyConfiguration struct { // Required. Type *flowcontrolv1.PriorityLevelConfigurationConditionType `json:"type,omitempty"` // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. Status *flowcontrolv1.ConditionStatus `json:"status,omitempty"` // `lastTransitionTime` is the last time the condition transitioned from one status to another. LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschema.go b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschema.go index 80a1f720fa..dbd3a5f291 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschema.go +++ b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschema.go @@ -33,7 +33,7 @@ import ( // FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with // similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". type FlowSchemaApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschemacondition.go b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschemacondition.go index 9462bbd02e..aa926a1be5 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschemacondition.go +++ b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschemacondition.go @@ -32,8 +32,7 @@ type FlowSchemaConditionApplyConfiguration struct { // Required. Type *flowcontrolv1beta1.FlowSchemaConditionType `json:"type,omitempty"` // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. Status *flowcontrolv1beta1.ConditionStatus `json:"status,omitempty"` // `lastTransitionTime` is the last time the condition transitioned from one status to another. LastTransitionTime *v1.Time `json:"lastTransitionTime,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfiguration.go index 8fecf8688c..1f34672a1b 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfiguration.go @@ -32,7 +32,7 @@ import ( // // PriorityLevelConfiguration represents the configuration of a priority level. type PriorityLevelConfigurationApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfigurationcondition.go b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfigurationcondition.go index a2ebf71fc5..af4dc6a3a4 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfigurationcondition.go +++ b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfigurationcondition.go @@ -32,8 +32,7 @@ type PriorityLevelConfigurationConditionApplyConfiguration struct { // Required. Type *flowcontrolv1beta1.PriorityLevelConfigurationConditionType `json:"type,omitempty"` // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. Status *flowcontrolv1beta1.ConditionStatus `json:"status,omitempty"` // `lastTransitionTime` is the last time the condition transitioned from one status to another. LastTransitionTime *v1.Time `json:"lastTransitionTime,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/flowschema.go b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/flowschema.go index 394f24b993..a083ea91e9 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/flowschema.go +++ b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/flowschema.go @@ -33,7 +33,7 @@ import ( // FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with // similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". type FlowSchemaApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/flowschemacondition.go b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/flowschemacondition.go index 6bebc912c6..2706b563cb 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/flowschemacondition.go +++ b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/flowschemacondition.go @@ -32,8 +32,7 @@ type FlowSchemaConditionApplyConfiguration struct { // Required. Type *flowcontrolv1beta2.FlowSchemaConditionType `json:"type,omitempty"` // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. Status *flowcontrolv1beta2.ConditionStatus `json:"status,omitempty"` // `lastTransitionTime` is the last time the condition transitioned from one status to another. LastTransitionTime *v1.Time `json:"lastTransitionTime,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/prioritylevelconfiguration.go index a60827b636..56cb3557a3 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/prioritylevelconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/prioritylevelconfiguration.go @@ -32,7 +32,7 @@ import ( // // PriorityLevelConfiguration represents the configuration of a priority level. type PriorityLevelConfigurationApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/prioritylevelconfigurationcondition.go b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/prioritylevelconfigurationcondition.go index 26a8b66243..a6c7898868 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/prioritylevelconfigurationcondition.go +++ b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/prioritylevelconfigurationcondition.go @@ -32,8 +32,7 @@ type PriorityLevelConfigurationConditionApplyConfiguration struct { // Required. Type *flowcontrolv1beta2.PriorityLevelConfigurationConditionType `json:"type,omitempty"` // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. Status *flowcontrolv1beta2.ConditionStatus `json:"status,omitempty"` // `lastTransitionTime` is the last time the condition transitioned from one status to another. LastTransitionTime *v1.Time `json:"lastTransitionTime,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/flowschema.go b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/flowschema.go index 0079748b66..19e43e5cbe 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/flowschema.go +++ b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/flowschema.go @@ -33,7 +33,7 @@ import ( // FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with // similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". type FlowSchemaApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/flowschemacondition.go b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/flowschemacondition.go index de2aff5682..74189b100a 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/flowschemacondition.go +++ b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/flowschemacondition.go @@ -32,8 +32,7 @@ type FlowSchemaConditionApplyConfiguration struct { // Required. Type *flowcontrolv1beta3.FlowSchemaConditionType `json:"type,omitempty"` // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. Status *flowcontrolv1beta3.ConditionStatus `json:"status,omitempty"` // `lastTransitionTime` is the last time the condition transitioned from one status to another. LastTransitionTime *v1.Time `json:"lastTransitionTime,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/prioritylevelconfiguration.go index 910cb4c25c..5b16a044aa 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/prioritylevelconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/prioritylevelconfiguration.go @@ -32,7 +32,7 @@ import ( // // PriorityLevelConfiguration represents the configuration of a priority level. type PriorityLevelConfigurationApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // `metadata` is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/prioritylevelconfigurationcondition.go b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/prioritylevelconfigurationcondition.go index bd14650a93..87013c67b1 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/prioritylevelconfigurationcondition.go +++ b/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/prioritylevelconfigurationcondition.go @@ -32,8 +32,7 @@ type PriorityLevelConfigurationConditionApplyConfiguration struct { // Required. Type *flowcontrolv1beta3.PriorityLevelConfigurationConditionType `json:"type,omitempty"` // `status` is the status of the condition. - // Can be True, False, Unknown. - // Required. + // Should be specified and set to one of True, False, Unknown. Status *flowcontrolv1beta3.ConditionStatus `json:"status,omitempty"` // `lastTransitionTime` is the last time the condition transitioned from one status to another. LastTransitionTime *v1.Time `json:"lastTransitionTime,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/imagepolicy/v1alpha1/imagereview.go b/vendor/k8s.io/client-go/applyconfigurations/imagepolicy/v1alpha1/imagereview.go index f63c86ceb2..c2aad9565b 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/imagepolicy/v1alpha1/imagereview.go +++ b/vendor/k8s.io/client-go/applyconfigurations/imagepolicy/v1alpha1/imagereview.go @@ -32,13 +32,13 @@ import ( // // ImageReview checks if the set of images in a pod are allowed. type ImageReviewApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Spec holds information about the pod being evaluated + // spec holds information about the pod being evaluated Spec *ImageReviewSpecApplyConfiguration `json:"spec,omitempty"` - // Status is filled in by the backend and indicates whether the pod should be allowed. + // status is filled in by the backend and indicates whether the pod should be allowed. Status *ImageReviewStatusApplyConfiguration `json:"status,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/imagepolicy/v1alpha1/imagereviewcontainerspec.go b/vendor/k8s.io/client-go/applyconfigurations/imagepolicy/v1alpha1/imagereviewcontainerspec.go index 1f0193f031..0a24f4332d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/imagepolicy/v1alpha1/imagereviewcontainerspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/imagepolicy/v1alpha1/imagereviewcontainerspec.go @@ -23,7 +23,7 @@ package v1alpha1 // // ImageReviewContainerSpec is a description of a container within the pod creation request. type ImageReviewContainerSpecApplyConfiguration struct { - // This can be in the form image:tag or image@SHA:012345679abcdef. + // image can be in the form image:tag or image@SHA:012345679abcdef. Image *string `json:"image,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/imagepolicy/v1alpha1/imagereviewspec.go b/vendor/k8s.io/client-go/applyconfigurations/imagepolicy/v1alpha1/imagereviewspec.go index 14c6603f5e..9abdc95017 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/imagepolicy/v1alpha1/imagereviewspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/imagepolicy/v1alpha1/imagereviewspec.go @@ -23,13 +23,13 @@ package v1alpha1 // // ImageReviewSpec is a description of the pod creation request. type ImageReviewSpecApplyConfiguration struct { - // Containers is a list of a subset of the information in each container of the Pod being created. + // containers is a list of a subset of the information in each container of the Pod being created. Containers []ImageReviewContainerSpecApplyConfiguration `json:"containers,omitempty"` - // Annotations is a list of key-value pairs extracted from the Pod's annotations. + // annotations is a list of key-value pairs extracted from the Pod's annotations. // It only includes keys which match the pattern `*.image-policy.k8s.io/*`. // It is up to each webhook backend to determine how to interpret these annotations, if at all. Annotations map[string]string `json:"annotations,omitempty"` - // Namespace is the namespace the pod is being created in. + // namespace is the namespace the pod is being created in. Namespace *string `json:"namespace,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/imagepolicy/v1alpha1/imagereviewstatus.go b/vendor/k8s.io/client-go/applyconfigurations/imagepolicy/v1alpha1/imagereviewstatus.go index 52828a29c1..53d32ee915 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/imagepolicy/v1alpha1/imagereviewstatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/imagepolicy/v1alpha1/imagereviewstatus.go @@ -23,13 +23,13 @@ package v1alpha1 // // ImageReviewStatus is the result of the review for the pod creation request. type ImageReviewStatusApplyConfiguration struct { - // Allowed indicates that all images were allowed to be run. + // allowed indicates that all images were allowed to be run. Allowed *bool `json:"allowed,omitempty"` - // Reason should be empty unless Allowed is false in which case it + // reason should be empty unless Allowed is false in which case it // may contain a short description of what is wrong. Kubernetes // may truncate excessively long errors when displaying to the user. Reason *string `json:"reason,omitempty"` - // AuditAnnotations will be added to the attributes object of the + // auditAnnotations will be added to the attributes object of the // admission controller request using 'AddAnnotation'. The keys should // be prefix-less (i.e., the admission controller will add an // appropriate prefix). diff --git a/vendor/k8s.io/client-go/applyconfigurations/internal/internal.go b/vendor/k8s.io/client-go/applyconfigurations/internal/internal.go index c0b255cc73..a8007a3d1b 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/internal/internal.go +++ b/vendor/k8s.io/client-go/applyconfigurations/internal/internal.go @@ -3188,6 +3188,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: message type: scalar: string + - name: observedGeneration + type: + scalar: numeric - name: reason type: scalar: string @@ -3517,6 +3520,26 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" +- name: io.k8s.api.batch.v1.JobSchedulingConfiguration + map: + fields: + - name: disruptionMode + type: + namedType: io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupDisruptionMode + - name: resourceClaims + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupResourceClaim + elementRelationship: associative + keys: + - name + - name: schedulingConstraints + type: + namedType: io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupSchedulingConstraints + - name: schedulingPolicy + type: + namedType: io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupSchedulingPolicy - name: io.k8s.api.batch.v1.JobSpec map: fields: @@ -3553,6 +3576,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: podReplacementPolicy type: scalar: string + - name: scheduling + type: + namedType: io.k8s.api.batch.v1.JobSchedulingConfiguration - name: selector type: namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector @@ -3877,6 +3903,120 @@ var schemaYAML = typed.YAMLObject(`types: elementRelationship: associative keys: - type +- name: io.k8s.api.certificates.v1.ClusterTrustBundle + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.api.certificates.v1.ClusterTrustBundleSpec + default: {} +- name: io.k8s.api.certificates.v1.ClusterTrustBundleSpec + map: + fields: + - name: signerName + type: + scalar: string + - name: trustBundle + type: + scalar: string + default: "" +- name: io.k8s.api.certificates.v1.PodCertificateRequest + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.api.certificates.v1.PodCertificateRequestSpec + default: {} + - name: status + type: + namedType: io.k8s.api.certificates.v1.PodCertificateRequestStatus + default: {} +- name: io.k8s.api.certificates.v1.PodCertificateRequestSpec + map: + fields: + - name: maxExpirationSeconds + type: + scalar: numeric + default: 86400 + - name: nodeName + type: + scalar: string + default: "" + - name: nodeUID + type: + scalar: string + default: "" + - name: podName + type: + scalar: string + default: "" + - name: podUID + type: + scalar: string + default: "" + - name: serviceAccountName + type: + scalar: string + default: "" + - name: serviceAccountUID + type: + scalar: string + default: "" + - name: signerName + type: + scalar: string + default: "" + - name: stubPKCS10Request + type: + scalar: string + - name: unverifiedUserAnnotations + type: + map: + elementType: + scalar: string +- name: io.k8s.api.certificates.v1.PodCertificateRequestStatus + map: + fields: + - name: beginRefreshAt + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: certificateChain + type: + scalar: string + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type + - name: notAfter + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: notBefore + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time - name: io.k8s.api.certificates.v1alpha1.ClusterTrustBundle map: fields: @@ -4572,6 +4712,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: signerName type: scalar: string + - name: user + type: + scalar: numeric - name: io.k8s.api.core.v1.ComponentCondition map: fields: @@ -4704,6 +4847,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: defaultMode type: scalar: numeric + - name: defaultUser + type: + scalar: numeric - name: items type: list: @@ -5069,12 +5215,18 @@ var schemaYAML = typed.YAMLObject(`types: - name: resourceFieldRef type: namedType: io.k8s.api.core.v1.ResourceFieldSelector + - name: user + type: + scalar: numeric - name: io.k8s.api.core.v1.DownwardAPIVolumeSource map: fields: - name: defaultMode type: scalar: numeric + - name: defaultUser + type: + scalar: numeric - name: items type: list: @@ -5087,6 +5239,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: medium type: scalar: string + - name: mode + type: + scalar: numeric - name: sizeLimit type: namedType: io.k8s.apimachinery.pkg.api.resource.Quantity @@ -5409,6 +5564,17 @@ var schemaYAML = typed.YAMLObject(`types: - name: host type: scalar: string +- name: io.k8s.api.core.v1.EvictionResponder + map: + fields: + - name: name + type: + scalar: string + default: "" + - name: priority + type: + scalar: numeric + elementRelationship: atomic - name: io.k8s.api.core.v1.ExecAction map: fields: @@ -5532,6 +5698,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: io.k8s.api.core.v1.GRPCAction map: fields: + - name: mode + type: + scalar: string - name: port type: scalar: numeric @@ -5602,6 +5771,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: port type: namedType: io.k8s.apimachinery.pkg.util.intstr.IntOrString + - name: protocol + type: + scalar: string - name: scheme type: scalar: string @@ -5761,6 +5933,9 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" + - name: user + type: + scalar: numeric - name: io.k8s.api.core.v1.Lifecycle map: fields: @@ -6040,6 +6215,29 @@ var schemaYAML = typed.YAMLObject(`types: - name: requiredDuringSchedulingIgnoredDuringExecution type: namedType: io.k8s.api.core.v1.NodeSelector +- name: io.k8s.api.core.v1.NodeAllocatableMappedResources + map: + fields: + - name: name + type: + scalar: string + default: "" + - name: quantity + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity +- name: io.k8s.api.core.v1.NodeAllocatableOverheadResources + map: + fields: + - name: name + type: + scalar: string + default: "" + - name: perContainer + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity + - name: perPod + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity - name: io.k8s.api.core.v1.NodeAllocatableResourceClaimStatus map: fields: @@ -6049,15 +6247,26 @@ var schemaYAML = typed.YAMLObject(`types: elementType: scalar: string elementRelationship: associative + - name: mapping + type: + list: + elementType: + namedType: io.k8s.api.core.v1.NodeAllocatableMappedResources + elementRelationship: associative + keys: + - name + - name: overhead + type: + list: + elementType: + namedType: io.k8s.api.core.v1.NodeAllocatableOverheadResources + elementRelationship: associative + keys: + - name - name: resourceClaimName type: scalar: string default: "" - - name: resources - type: - map: - elementType: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity - name: io.k8s.api.core.v1.NodeCondition map: fields: @@ -6115,6 +6324,15 @@ var schemaYAML = typed.YAMLObject(`types: - name: supplementalGroupsPolicy type: scalar: boolean +- name: io.k8s.api.core.v1.NodePodPreemptionPolicy + map: + fields: + - name: disableResizePreemption + type: + list: + elementType: + scalar: string + elementRelationship: associative - name: io.k8s.api.core.v1.NodeRuntimeHandler map: fields: @@ -6195,6 +6413,9 @@ var schemaYAML = typed.YAMLObject(`types: elementType: scalar: string elementRelationship: associative + - name: podPreemptionPolicy + type: + namedType: io.k8s.api.core.v1.NodePodPreemptionPolicy - name: providerID type: scalar: string @@ -6328,6 +6549,9 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" + - name: runningInUserNamespace + type: + scalar: boolean - name: swap type: namedType: io.k8s.api.core.v1.NodeSwapStatus @@ -6506,6 +6730,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: currentVolumeAttributesClassName type: scalar: string + - name: healthStatus + type: + namedType: io.k8s.api.core.v1.VolumeHealthStatus - name: modifyVolumeStatus type: namedType: io.k8s.api.core.v1.ModifyVolumeStatus @@ -6766,6 +6993,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: signerName type: scalar: string + - name: user + type: + scalar: numeric - name: userAnnotations type: map: @@ -6986,6 +7216,14 @@ var schemaYAML = typed.YAMLObject(`types: elementRelationship: associative keys: - name + - name: evictionResponders + type: + list: + elementType: + namedType: io.k8s.api.core.v1.EvictionResponder + elementRelationship: associative + keys: + - name - name: hostAliases type: list: @@ -7189,7 +7427,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: io.k8s.api.core.v1.NodeAllocatableResourceClaimStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - resourceClaimName - name: nominatedNodeName type: scalar: string @@ -7233,6 +7473,14 @@ var schemaYAML = typed.YAMLObject(`types: - name: startTime type: namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: volumeHealth + type: + list: + elementType: + namedType: io.k8s.api.core.v1.PodVolumeHealth + elementRelationship: associative + keys: + - name - name: io.k8s.api.core.v1.PodTemplate map: fields: @@ -7261,6 +7509,25 @@ var schemaYAML = typed.YAMLObject(`types: type: namedType: io.k8s.api.core.v1.PodSpec default: {} +- name: io.k8s.api.core.v1.PodVolumeHealth + map: + fields: + - name: healthConditions + type: + list: + elementType: + namedType: io.k8s.api.core.v1.VolumeHealthCondition + elementRelationship: associative + keys: + - status + - reason + - name: lastTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: name + type: + scalar: string + default: "" - name: io.k8s.api.core.v1.PortStatus map: fields: @@ -7338,6 +7605,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: defaultMode type: scalar: numeric + - name: defaultUser + type: + scalar: numeric - name: sources type: list: @@ -7864,6 +8134,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: defaultMode type: scalar: numeric + - name: defaultUser + type: + scalar: numeric - name: items type: list: @@ -7979,6 +8252,9 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" + - name: user + type: + scalar: numeric - name: io.k8s.api.core.v1.ServicePort map: fields: @@ -8401,21 +8677,56 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" -- name: io.k8s.api.core.v1.VolumeMount +- name: io.k8s.api.core.v1.VolumeHealthCondition map: fields: - - name: mountPath + - name: message type: scalar: string - default: "" - - name: mountPropagation + - name: reason type: scalar: string - - name: name + default: "" + - name: status type: scalar: string default: "" - - name: readOnly +- name: io.k8s.api.core.v1.VolumeHealthStatus + map: + fields: + - name: healthConditions + type: + list: + elementType: + namedType: io.k8s.api.core.v1.VolumeHealthCondition + elementRelationship: associative + keys: + - status + - reason + - name: lastTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time +- name: io.k8s.api.core.v1.VolumeMount + map: + fields: + - name: bindMountOptions + type: + list: + elementType: + scalar: string + elementRelationship: associative + - name: mountPath + type: + scalar: string + default: "" + - name: mountPropagation + type: + scalar: string + - name: name + type: + scalar: string + default: "" + - name: readOnly type: scalar: boolean - name: recursiveReadOnly @@ -10862,6 +11173,214 @@ var schemaYAML = typed.YAMLObject(`types: - name: reason type: scalar: string +- name: io.k8s.api.lifecycle.v1alpha1.Eviction + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.api.lifecycle.v1alpha1.EvictionSpec + default: {} + - name: status + type: + namedType: io.k8s.api.lifecycle.v1alpha1.EvictionStatus + default: {} +- name: io.k8s.api.lifecycle.v1alpha1.EvictionPodReference + map: + fields: + - name: name + type: + scalar: string + default: "" + - name: uid + type: + scalar: string + default: "" +- name: io.k8s.api.lifecycle.v1alpha1.EvictionRequest + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.api.lifecycle.v1alpha1.EvictionRequestSpec + default: {} + - name: status + type: + namedType: io.k8s.api.lifecycle.v1alpha1.EvictionRequestStatus + default: {} +- name: io.k8s.api.lifecycle.v1alpha1.EvictionRequestPodReference + map: + fields: + - name: name + type: + scalar: string + default: "" + - name: uid + type: + scalar: string + default: "" +- name: io.k8s.api.lifecycle.v1alpha1.EvictionRequestSpec + map: + fields: + - name: intent + type: + scalar: string + default: "" + - name: requester + type: + scalar: string + default: "" + - name: target + type: + namedType: io.k8s.api.lifecycle.v1alpha1.EvictionRequestTarget + default: {} +- name: io.k8s.api.lifecycle.v1alpha1.EvictionRequestStatus + map: + fields: + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type + - name: observedGeneration + type: + scalar: numeric +- name: io.k8s.api.lifecycle.v1alpha1.EvictionRequestTarget + map: + fields: + - name: pod + type: + namedType: io.k8s.api.lifecycle.v1alpha1.EvictionRequestPodReference + unions: + - fields: + - fieldName: pod + discriminatorValue: Pod +- name: io.k8s.api.lifecycle.v1alpha1.EvictionSpec + map: + fields: + - name: target + type: + namedType: io.k8s.api.lifecycle.v1alpha1.EvictionTarget + default: {} +- name: io.k8s.api.lifecycle.v1alpha1.EvictionStatus + map: + fields: + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type + - name: observedGeneration + type: + scalar: numeric + - name: requesters + type: + list: + elementType: + namedType: io.k8s.api.lifecycle.v1alpha1.Requester + elementRelationship: associative + keys: + - name + - name: responders + type: + list: + elementType: + namedType: io.k8s.api.lifecycle.v1alpha1.ResponderStatus + elementRelationship: associative + keys: + - name + - name: targetResponders + type: + list: + elementType: + namedType: io.k8s.api.lifecycle.v1alpha1.TargetResponder + elementRelationship: associative + keys: + - name +- name: io.k8s.api.lifecycle.v1alpha1.EvictionTarget + map: + fields: + - name: pod + type: + namedType: io.k8s.api.lifecycle.v1alpha1.EvictionPodReference + unions: + - fields: + - fieldName: pod + discriminatorValue: Pod +- name: io.k8s.api.lifecycle.v1alpha1.Requester + map: + fields: + - name: intent + type: + scalar: string + default: "" + - name: name + type: + scalar: string + default: "" + elementRelationship: atomic +- name: io.k8s.api.lifecycle.v1alpha1.ResponderStatus + map: + fields: + - name: completionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: expectedCompletionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: heartbeatTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: message + type: + scalar: string + - name: name + type: + scalar: string + default: "" + - name: startTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + elementRelationship: separable +- name: io.k8s.api.lifecycle.v1alpha1.TargetResponder + map: + fields: + - name: name + type: + scalar: string + default: "" + - name: priority + type: + scalar: numeric + - name: state + type: + scalar: string + default: "" + elementRelationship: atomic - name: io.k8s.api.networking.v1.HTTPIngressPath map: fields: @@ -12476,11 +12995,11 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" - - name: nodeAllocatableResourceMappings + - name: nodeAllocatableResources type: map: elementType: - namedType: io.k8s.api.resource.v1.NodeAllocatableResourceMapping + namedType: io.k8s.api.resource.v1.NodeAllocatableResource - name: nodeName type: scalar: string @@ -12664,6 +13183,12 @@ var schemaYAML = typed.YAMLObject(`types: - name: io.k8s.api.resource.v1.DeviceCounterConsumption map: fields: + - name: compatibilityGroups + type: + list: + elementType: + scalar: string + elementRelationship: atomic - name: counterSet type: scalar: string @@ -12673,6 +13198,17 @@ var schemaYAML = typed.YAMLObject(`types: map: elementType: namedType: io.k8s.api.resource.v1.Counter +- name: io.k8s.api.resource.v1.DeviceDerivedAttribute + map: + fields: + - name: expression + type: + scalar: string + default: "" + - name: name + type: + scalar: string + default: "" - name: io.k8s.api.resource.v1.DeviceRequest map: fields: @@ -12731,6 +13267,12 @@ var schemaYAML = typed.YAMLObject(`types: - name: shareID type: scalar: string + - name: skipNodeOperations + type: + list: + elementType: + scalar: string + elementRelationship: associative - name: tolerations type: list: @@ -12755,6 +13297,12 @@ var schemaYAML = typed.YAMLObject(`types: - name: count type: scalar: numeric + - name: derivedAttributes + type: + list: + elementType: + namedType: io.k8s.api.resource.v1.DeviceDerivedAttribute + elementRelationship: atomic - name: deviceClassName type: scalar: string @@ -12792,40 +13340,100 @@ var schemaYAML = typed.YAMLObject(`types: - name: value type: scalar: string -- name: io.k8s.api.resource.v1.DeviceToleration +- name: io.k8s.api.resource.v1.DeviceTaintRule map: fields: - - name: effect + - name: apiVersion type: scalar: string - - name: key + - name: kind type: scalar: string - - name: operator + - name: metadata type: - scalar: string - default: Equal - - name: tolerationSeconds + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec type: - scalar: numeric - - name: value + namedType: io.k8s.api.resource.v1.DeviceTaintRuleSpec + default: {} + - name: status type: - scalar: string -- name: io.k8s.api.resource.v1.ExactDeviceRequest + namedType: io.k8s.api.resource.v1.DeviceTaintRuleStatus + default: {} +- name: io.k8s.api.resource.v1.DeviceTaintRuleSpec map: fields: - - name: adminAccess - type: - scalar: boolean - - name: allocationMode + - name: deviceSelector type: - scalar: string - - name: capacity + namedType: io.k8s.api.resource.v1.DeviceTaintSelector + - name: taint type: - namedType: io.k8s.api.resource.v1.CapacityRequirements - - name: count + namedType: io.k8s.api.resource.v1.DeviceTaint + default: {} +- name: io.k8s.api.resource.v1.DeviceTaintRuleStatus + map: + fields: + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type +- name: io.k8s.api.resource.v1.DeviceTaintSelector + map: + fields: + - name: device + type: + scalar: string + - name: driver + type: + scalar: string + - name: pool + type: + scalar: string +- name: io.k8s.api.resource.v1.DeviceToleration + map: + fields: + - name: effect + type: + scalar: string + - name: key + type: + scalar: string + - name: operator + type: + scalar: string + default: Equal + - name: tolerationSeconds type: scalar: numeric + - name: value + type: + scalar: string +- name: io.k8s.api.resource.v1.ExactDeviceRequest + map: + fields: + - name: adminAccess + type: + scalar: boolean + - name: allocationMode + type: + scalar: string + - name: capacity + type: + namedType: io.k8s.api.resource.v1.CapacityRequirements + - name: count + type: + scalar: numeric + - name: derivedAttributes + type: + list: + elementType: + namedType: io.k8s.api.resource.v1.DeviceDerivedAttribute + elementRelationship: atomic - name: deviceClassName type: scalar: string @@ -12857,15 +13465,36 @@ var schemaYAML = typed.YAMLObject(`types: elementType: scalar: string elementRelationship: atomic -- name: io.k8s.api.resource.v1.NodeAllocatableResourceMapping +- name: io.k8s.api.resource.v1.NodeAllocatableMapping map: fields: - - name: allocationMultiplier - type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity - name: capacityKey type: scalar: string + - name: capacityMultiplier + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity + - name: deviceMultiplier + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity +- name: io.k8s.api.resource.v1.NodeAllocatableOverhead + map: + fields: + - name: perContainer + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity + - name: perPod + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity +- name: io.k8s.api.resource.v1.NodeAllocatableResource + map: + fields: + - name: mapping + type: + namedType: io.k8s.api.resource.v1.NodeAllocatableMapping + - name: overhead + type: + namedType: io.k8s.api.resource.v1.NodeAllocatableOverhead - name: io.k8s.api.resource.v1.OpaqueDeviceConfiguration map: fields: @@ -13029,6 +13658,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: nodeSelector type: namedType: io.k8s.api.core.v1.NodeSelector + - name: partitionTypeAttribute + type: + scalar: string - name: perDeviceNodeSelection type: scalar: boolean @@ -13042,6 +13674,12 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.api.resource.v1.CounterSet elementRelationship: atomic + - name: skipNodeOperations + type: + list: + elementType: + scalar: string + elementRelationship: associative - name: io.k8s.api.resource.v1alpha3.DeviceTaint map: fields: @@ -13113,6 +13751,21 @@ var schemaYAML = typed.YAMLObject(`types: - name: pool type: scalar: string +- name: io.k8s.api.resource.v1alpha3.PartitionTypeStatus + map: + fields: + - name: allocatable + type: + scalar: numeric + - name: attribute + type: + scalar: string + - name: total + type: + scalar: numeric + - name: type + type: + scalar: string - name: io.k8s.api.resource.v1alpha3.PoolStatus map: fields: @@ -13132,12 +13785,21 @@ var schemaYAML = typed.YAMLObject(`types: - name: nodeName type: scalar: string + - name: partitionSummary + type: + list: + elementType: + namedType: io.k8s.api.resource.v1alpha3.PartitionTypeStatus + elementRelationship: atomic - name: poolName type: scalar: string - name: resourceSliceCount type: scalar: numeric + - name: shareableSummary + type: + namedType: io.k8s.api.resource.v1alpha3.ShareableSummaryStatus - name: totalDevices type: scalar: numeric @@ -13170,6 +13832,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequestSpec map: fields: + - name: defaultPartitionTypeAttribute + type: + scalar: string - name: driver type: scalar: string @@ -13201,6 +13866,36 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.api.resource.v1alpha3.PoolStatus elementRelationship: atomic +- name: io.k8s.api.resource.v1alpha3.ShareableCapacityStatus + map: + fields: + - name: available + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity + - name: consumed + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity + - name: name + type: + scalar: string + - name: total + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity +- name: io.k8s.api.resource.v1alpha3.ShareableSummaryStatus + map: + fields: + - name: capacity + type: + list: + elementType: + namedType: io.k8s.api.resource.v1alpha3.ShareableCapacityStatus + elementRelationship: atomic + - name: fullyAvailableDevices + type: + scalar: numeric + - name: partiallyAvailableDevices + type: + scalar: numeric - name: io.k8s.api.resource.v1beta1.AllocatedDeviceStatus map: fields: @@ -13286,11 +13981,11 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.api.resource.v1beta1.DeviceCounterConsumption elementRelationship: atomic - - name: nodeAllocatableResourceMappings + - name: nodeAllocatableResources type: map: elementType: - namedType: io.k8s.api.resource.v1beta1.NodeAllocatableResourceMapping + namedType: io.k8s.api.resource.v1beta1.NodeAllocatableResource - name: nodeName type: scalar: string @@ -13544,6 +14239,12 @@ var schemaYAML = typed.YAMLObject(`types: - name: io.k8s.api.resource.v1beta1.DeviceCounterConsumption map: fields: + - name: compatibilityGroups + type: + list: + elementType: + scalar: string + elementRelationship: atomic - name: counterSet type: scalar: string @@ -13553,6 +14254,17 @@ var schemaYAML = typed.YAMLObject(`types: map: elementType: namedType: io.k8s.api.resource.v1beta1.Counter +- name: io.k8s.api.resource.v1beta1.DeviceDerivedAttribute + map: + fields: + - name: expression + type: + scalar: string + default: "" + - name: name + type: + scalar: string + default: "" - name: io.k8s.api.resource.v1beta1.DeviceRequest map: fields: @@ -13568,6 +14280,12 @@ var schemaYAML = typed.YAMLObject(`types: - name: count type: scalar: numeric + - name: derivedAttributes + type: + list: + elementType: + namedType: io.k8s.api.resource.v1beta1.DeviceDerivedAttribute + elementRelationship: atomic - name: deviceClassName type: scalar: string @@ -13636,6 +14354,12 @@ var schemaYAML = typed.YAMLObject(`types: - name: shareID type: scalar: string + - name: skipNodeOperations + type: + list: + elementType: + scalar: string + elementRelationship: associative - name: tolerations type: list: @@ -13660,6 +14384,12 @@ var schemaYAML = typed.YAMLObject(`types: - name: count type: scalar: numeric + - name: derivedAttributes + type: + list: + elementType: + namedType: io.k8s.api.resource.v1beta1.DeviceDerivedAttribute + elementRelationship: atomic - name: deviceClassName type: scalar: string @@ -13731,15 +14461,36 @@ var schemaYAML = typed.YAMLObject(`types: elementType: scalar: string elementRelationship: atomic -- name: io.k8s.api.resource.v1beta1.NodeAllocatableResourceMapping +- name: io.k8s.api.resource.v1beta1.NodeAllocatableMapping map: fields: - - name: allocationMultiplier - type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity - name: capacityKey type: scalar: string + - name: capacityMultiplier + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity + - name: deviceMultiplier + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity +- name: io.k8s.api.resource.v1beta1.NodeAllocatableOverhead + map: + fields: + - name: perContainer + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity + - name: perPod + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity +- name: io.k8s.api.resource.v1beta1.NodeAllocatableResource + map: + fields: + - name: mapping + type: + namedType: io.k8s.api.resource.v1beta1.NodeAllocatableMapping + - name: overhead + type: + namedType: io.k8s.api.resource.v1beta1.NodeAllocatableOverhead - name: io.k8s.api.resource.v1beta1.OpaqueDeviceConfiguration map: fields: @@ -13903,6 +14654,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: nodeSelector type: namedType: io.k8s.api.core.v1.NodeSelector + - name: partitionTypeAttribute + type: + scalar: string - name: perDeviceNodeSelection type: scalar: boolean @@ -13916,6 +14670,12 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.api.resource.v1beta1.CounterSet elementRelationship: atomic + - name: skipNodeOperations + type: + list: + elementType: + scalar: string + elementRelationship: associative - name: io.k8s.api.resource.v1beta2.AllocatedDeviceStatus map: fields: @@ -14065,11 +14825,11 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" - - name: nodeAllocatableResourceMappings + - name: nodeAllocatableResources type: map: elementType: - namedType: io.k8s.api.resource.v1beta2.NodeAllocatableResourceMapping + namedType: io.k8s.api.resource.v1beta2.NodeAllocatableResource - name: nodeName type: scalar: string @@ -14253,6 +15013,12 @@ var schemaYAML = typed.YAMLObject(`types: - name: io.k8s.api.resource.v1beta2.DeviceCounterConsumption map: fields: + - name: compatibilityGroups + type: + list: + elementType: + scalar: string + elementRelationship: atomic - name: counterSet type: scalar: string @@ -14262,6 +15028,17 @@ var schemaYAML = typed.YAMLObject(`types: map: elementType: namedType: io.k8s.api.resource.v1beta2.Counter +- name: io.k8s.api.resource.v1beta2.DeviceDerivedAttribute + map: + fields: + - name: expression + type: + scalar: string + default: "" + - name: name + type: + scalar: string + default: "" - name: io.k8s.api.resource.v1beta2.DeviceRequest map: fields: @@ -14320,6 +15097,12 @@ var schemaYAML = typed.YAMLObject(`types: - name: shareID type: scalar: string + - name: skipNodeOperations + type: + list: + elementType: + scalar: string + elementRelationship: associative - name: tolerations type: list: @@ -14344,6 +15127,12 @@ var schemaYAML = typed.YAMLObject(`types: - name: count type: scalar: numeric + - name: derivedAttributes + type: + list: + elementType: + namedType: io.k8s.api.resource.v1beta2.DeviceDerivedAttribute + elementRelationship: atomic - name: deviceClassName type: scalar: string @@ -14469,6 +15258,12 @@ var schemaYAML = typed.YAMLObject(`types: - name: count type: scalar: numeric + - name: derivedAttributes + type: + list: + elementType: + namedType: io.k8s.api.resource.v1beta2.DeviceDerivedAttribute + elementRelationship: atomic - name: deviceClassName type: scalar: string @@ -14500,15 +15295,36 @@ var schemaYAML = typed.YAMLObject(`types: elementType: scalar: string elementRelationship: atomic -- name: io.k8s.api.resource.v1beta2.NodeAllocatableResourceMapping +- name: io.k8s.api.resource.v1beta2.NodeAllocatableMapping map: fields: - - name: allocationMultiplier - type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity - name: capacityKey type: scalar: string + - name: capacityMultiplier + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity + - name: deviceMultiplier + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity +- name: io.k8s.api.resource.v1beta2.NodeAllocatableOverhead + map: + fields: + - name: perContainer + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity + - name: perPod + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity +- name: io.k8s.api.resource.v1beta2.NodeAllocatableResource + map: + fields: + - name: mapping + type: + namedType: io.k8s.api.resource.v1beta2.NodeAllocatableMapping + - name: overhead + type: + namedType: io.k8s.api.resource.v1beta2.NodeAllocatableOverhead - name: io.k8s.api.resource.v1beta2.OpaqueDeviceConfiguration map: fields: @@ -14672,6 +15488,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: nodeSelector type: namedType: io.k8s.api.core.v1.NodeSelector + - name: partitionTypeAttribute + type: + scalar: string - name: perDeviceNodeSelection type: scalar: boolean @@ -14685,6 +15504,12 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.api.resource.v1beta2.CounterSet elementRelationship: atomic + - name: skipNodeOperations + type: + list: + elementType: + scalar: string + elementRelationship: associative - name: io.k8s.api.scheduling.v1.PriorityClass map: fields: @@ -14711,7 +15536,7 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: numeric default: 0 -- name: io.k8s.api.scheduling.v1alpha2.BasicSchedulingPolicy +- name: io.k8s.api.scheduling.v1alpha3.AllCompositeDisruptionMode map: elementType: scalar: untyped @@ -14723,35 +15548,742 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: __untyped_deduced_ elementRelationship: separable -- name: io.k8s.api.scheduling.v1alpha2.GangSchedulingPolicy - map: - fields: - - name: minCount - type: - scalar: numeric - default: 0 -- name: io.k8s.api.scheduling.v1alpha2.PodGroup +- name: io.k8s.api.scheduling.v1alpha3.AllDisruptionMode map: - fields: - - name: apiVersion - type: - scalar: string - - name: kind - type: - scalar: string - - name: metadata - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta - default: {} - - name: spec - type: - namedType: io.k8s.api.scheduling.v1alpha2.PodGroupSpec - default: {} - - name: status - type: - namedType: io.k8s.api.scheduling.v1alpha2.PodGroupStatus - default: {} -- name: io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaim + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.api.scheduling.v1alpha3.BasicSchedulingPolicy + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.api.scheduling.v1alpha3.CompositeBasicSchedulingPolicy + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.api.scheduling.v1alpha3.CompositeDisruptionMode + map: + fields: + - name: all + type: + namedType: io.k8s.api.scheduling.v1alpha3.AllCompositeDisruptionMode + - name: single + type: + namedType: io.k8s.api.scheduling.v1alpha3.SingleCompositeDisruptionMode + unions: + - fields: + - fieldName: all + discriminatorValue: All + - fieldName: single + discriminatorValue: Single +- name: io.k8s.api.scheduling.v1alpha3.CompositeGangSchedulingPolicy + map: + fields: + - name: minGroupCount + type: + scalar: numeric + default: 0 +- name: io.k8s.api.scheduling.v1alpha3.CompositePodGroup + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.api.scheduling.v1alpha3.CompositePodGroupSpec + default: {} + - name: status + type: + namedType: io.k8s.api.scheduling.v1alpha3.CompositePodGroupStatus + default: {} +- name: io.k8s.api.scheduling.v1alpha3.CompositePodGroupSchedulingConstraints + map: + fields: + - name: topology + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha3.TopologyConstraint + elementRelationship: atomic +- name: io.k8s.api.scheduling.v1alpha3.CompositePodGroupSchedulingPolicy + map: + fields: + - name: basic + type: + namedType: io.k8s.api.scheduling.v1alpha3.CompositeBasicSchedulingPolicy + - name: gang + type: + namedType: io.k8s.api.scheduling.v1alpha3.CompositeGangSchedulingPolicy + unions: + - fields: + - fieldName: basic + discriminatorValue: Basic + - fieldName: gang + discriminatorValue: Gang +- name: io.k8s.api.scheduling.v1alpha3.CompositePodGroupSpec + map: + fields: + - name: disruptionMode + type: + namedType: io.k8s.api.scheduling.v1alpha3.CompositeDisruptionMode + default: + single: {} + - name: parentCompositePodGroupName + type: + scalar: string + - name: preemptionPolicy + type: + scalar: string + - name: priority + type: + scalar: numeric + - name: priorityClassName + type: + scalar: string + - name: schedulingConstraints + type: + namedType: io.k8s.api.scheduling.v1alpha3.CompositePodGroupSchedulingConstraints + - name: schedulingPolicy + type: + namedType: io.k8s.api.scheduling.v1alpha3.CompositePodGroupSchedulingPolicy + default: {} + - name: workloadRef + type: + namedType: io.k8s.api.scheduling.v1alpha3.WorkloadReference +- name: io.k8s.api.scheduling.v1alpha3.CompositePodGroupStatus + map: + fields: + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type +- name: io.k8s.api.scheduling.v1alpha3.CompositePodGroupTemplate + map: + fields: + - name: compositePodGroupTemplates + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha3.CompositePodGroupTemplate + elementRelationship: associative + keys: + - name + - name: disruptionMode + type: + namedType: io.k8s.api.scheduling.v1alpha3.CompositeDisruptionMode + - name: name + type: + scalar: string + default: "" + - name: podGroupTemplates + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha3.PodGroupTemplate + elementRelationship: associative + keys: + - name + - name: preemptionPolicy + type: + scalar: string + - name: priority + type: + scalar: numeric + - name: priorityClassName + type: + scalar: string + - name: schedulingConstraints + type: + namedType: io.k8s.api.scheduling.v1alpha3.CompositePodGroupSchedulingConstraints + - name: schedulingPolicy + type: + namedType: io.k8s.api.scheduling.v1alpha3.CompositePodGroupSchedulingPolicy + default: {} +- name: io.k8s.api.scheduling.v1alpha3.DisruptionMode + map: + fields: + - name: all + type: + namedType: io.k8s.api.scheduling.v1alpha3.AllDisruptionMode + - name: single + type: + namedType: io.k8s.api.scheduling.v1alpha3.SingleDisruptionMode + unions: + - fields: + - fieldName: all + discriminatorValue: All + - fieldName: single + discriminatorValue: Single +- name: io.k8s.api.scheduling.v1alpha3.GangSchedulingPolicy + map: + fields: + - name: minCount + type: + scalar: numeric + default: 0 +- name: io.k8s.api.scheduling.v1alpha3.PodGroup + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.api.scheduling.v1alpha3.PodGroupSpec + default: {} + - name: status + type: + namedType: io.k8s.api.scheduling.v1alpha3.PodGroupStatus + default: {} +- name: io.k8s.api.scheduling.v1alpha3.PodGroupResourceClaim + map: + fields: + - name: name + type: + scalar: string + default: "" + - name: resourceClaimName + type: + scalar: string + - name: resourceClaimTemplateName + type: + scalar: string +- name: io.k8s.api.scheduling.v1alpha3.PodGroupResourceClaimStatus + map: + fields: + - name: name + type: + scalar: string + default: "" + - name: resourceClaimName + type: + scalar: string +- name: io.k8s.api.scheduling.v1alpha3.PodGroupSchedulingConstraints + map: + fields: + - name: topology + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha3.TopologyConstraint + elementRelationship: atomic +- name: io.k8s.api.scheduling.v1alpha3.PodGroupSchedulingPolicy + map: + fields: + - name: basic + type: + namedType: io.k8s.api.scheduling.v1alpha3.BasicSchedulingPolicy + - name: gang + type: + namedType: io.k8s.api.scheduling.v1alpha3.GangSchedulingPolicy + unions: + - fields: + - fieldName: basic + discriminatorValue: Basic + - fieldName: gang + discriminatorValue: Gang +- name: io.k8s.api.scheduling.v1alpha3.PodGroupSpec + map: + fields: + - name: disruptionMode + type: + namedType: io.k8s.api.scheduling.v1alpha3.DisruptionMode + default: + single: {} + - name: parentCompositePodGroupName + type: + scalar: string + - name: preemptionPolicy + type: + scalar: string + - name: priority + type: + scalar: numeric + - name: priorityClassName + type: + scalar: string + - name: resourceClaims + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha3.PodGroupResourceClaim + elementRelationship: associative + keys: + - name + - name: schedulingConstraints + type: + namedType: io.k8s.api.scheduling.v1alpha3.PodGroupSchedulingConstraints + - name: schedulingPolicy + type: + namedType: io.k8s.api.scheduling.v1alpha3.PodGroupSchedulingPolicy + default: {} + - name: workloadRef + type: + namedType: io.k8s.api.scheduling.v1alpha3.WorkloadReference +- name: io.k8s.api.scheduling.v1alpha3.PodGroupStatus + map: + fields: + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type + - name: resourceClaimStatuses + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha3.PodGroupResourceClaimStatus + elementRelationship: associative + keys: + - name +- name: io.k8s.api.scheduling.v1alpha3.PodGroupTemplate + map: + fields: + - name: disruptionMode + type: + namedType: io.k8s.api.scheduling.v1alpha3.DisruptionMode + - name: name + type: + scalar: string + default: "" + - name: preemptionPolicy + type: + scalar: string + - name: priority + type: + scalar: numeric + - name: priorityClassName + type: + scalar: string + - name: resourceClaims + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha3.PodGroupResourceClaim + elementRelationship: associative + keys: + - name + - name: schedulingConstraints + type: + namedType: io.k8s.api.scheduling.v1alpha3.PodGroupSchedulingConstraints + - name: schedulingPolicy + type: + namedType: io.k8s.api.scheduling.v1alpha3.PodGroupSchedulingPolicy + default: {} +- name: io.k8s.api.scheduling.v1alpha3.SingleCompositeDisruptionMode + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.api.scheduling.v1alpha3.SingleDisruptionMode + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.api.scheduling.v1alpha3.TopologyConstraint + map: + fields: + - name: key + type: + scalar: string + default: "" +- name: io.k8s.api.scheduling.v1alpha3.TypedLocalObjectReference + map: + fields: + - name: apiGroup + type: + scalar: string + - name: kind + type: + scalar: string + default: "" + - name: name + type: + scalar: string + default: "" +- name: io.k8s.api.scheduling.v1alpha3.Workload + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.api.scheduling.v1alpha3.WorkloadSpec + default: {} +- name: io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupAllDisruptionMode + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupBasicSchedulingPolicy + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupDisruptionMode + map: + fields: + - name: all + type: + namedType: io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupAllDisruptionMode + - name: single + type: + namedType: io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupSingleDisruptionMode + unions: + - fields: + - fieldName: all + discriminatorValue: All + - fieldName: single + discriminatorValue: Single +- name: io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupGangSchedulingPolicy + map: + fields: + - name: minCount + type: + scalar: numeric +- name: io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupResourceClaim + map: + fields: + - name: name + type: + scalar: string + default: "" + - name: resourceClaimName + type: + scalar: string + - name: resourceClaimTemplateName + type: + scalar: string +- name: io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupSchedulingConstraints + map: + fields: + - name: topology + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha3.TopologyConstraint + elementRelationship: atomic +- name: io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupSchedulingPolicy + map: + fields: + - name: basic + type: + namedType: io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupBasicSchedulingPolicy + - name: gang + type: + namedType: io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupGangSchedulingPolicy + unions: + - fields: + - fieldName: basic + discriminatorValue: Basic + - fieldName: gang + discriminatorValue: Gang +- name: io.k8s.api.scheduling.v1alpha3.WorkloadPodGroupSingleDisruptionMode + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.api.scheduling.v1alpha3.WorkloadReference + map: + fields: + - name: templateName + type: + scalar: string + default: "" + - name: workloadName + type: + scalar: string + default: "" +- name: io.k8s.api.scheduling.v1alpha3.WorkloadSpec + map: + fields: + - name: compositePodGroupTemplates + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha3.CompositePodGroupTemplate + elementRelationship: associative + keys: + - name + - name: controllerRef + type: + namedType: io.k8s.api.scheduling.v1alpha3.TypedLocalObjectReference + - name: podGroupTemplates + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha3.PodGroupTemplate + elementRelationship: associative + keys: + - name +- name: io.k8s.api.scheduling.v1beta1.AllCompositeDisruptionMode + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.api.scheduling.v1beta1.AllDisruptionMode + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.api.scheduling.v1beta1.BasicSchedulingPolicy + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.api.scheduling.v1beta1.CompositeBasicSchedulingPolicy + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.api.scheduling.v1beta1.CompositeDisruptionMode + map: + fields: + - name: all + type: + namedType: io.k8s.api.scheduling.v1beta1.AllCompositeDisruptionMode + - name: single + type: + namedType: io.k8s.api.scheduling.v1beta1.SingleCompositeDisruptionMode + unions: + - fields: + - fieldName: all + discriminatorValue: All + - fieldName: single + discriminatorValue: Single +- name: io.k8s.api.scheduling.v1beta1.CompositeGangSchedulingPolicy + map: + fields: + - name: minGroupCount + type: + scalar: numeric + default: 0 +- name: io.k8s.api.scheduling.v1beta1.CompositePodGroupSchedulingConstraints + map: + fields: + - name: topology + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1beta1.TopologyConstraint + elementRelationship: atomic +- name: io.k8s.api.scheduling.v1beta1.CompositePodGroupSchedulingPolicy + map: + fields: + - name: basic + type: + namedType: io.k8s.api.scheduling.v1beta1.CompositeBasicSchedulingPolicy + - name: gang + type: + namedType: io.k8s.api.scheduling.v1beta1.CompositeGangSchedulingPolicy + unions: + - fields: + - fieldName: basic + discriminatorValue: Basic + - fieldName: gang + discriminatorValue: Gang +- name: io.k8s.api.scheduling.v1beta1.CompositePodGroupTemplate + map: + fields: + - name: compositePodGroupTemplates + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1beta1.CompositePodGroupTemplate + elementRelationship: associative + keys: + - name + - name: disruptionMode + type: + namedType: io.k8s.api.scheduling.v1beta1.CompositeDisruptionMode + - name: name + type: + scalar: string + default: "" + - name: podGroupTemplates + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1beta1.PodGroupTemplate + elementRelationship: associative + keys: + - name + - name: preemptionPolicy + type: + scalar: string + - name: priority + type: + scalar: numeric + - name: priorityClassName + type: + scalar: string + - name: schedulingConstraints + type: + namedType: io.k8s.api.scheduling.v1beta1.CompositePodGroupSchedulingConstraints + - name: schedulingPolicy + type: + namedType: io.k8s.api.scheduling.v1beta1.CompositePodGroupSchedulingPolicy + default: {} +- name: io.k8s.api.scheduling.v1beta1.DisruptionMode + map: + fields: + - name: all + type: + namedType: io.k8s.api.scheduling.v1beta1.AllDisruptionMode + - name: single + type: + namedType: io.k8s.api.scheduling.v1beta1.SingleDisruptionMode + unions: + - fields: + - fieldName: all + discriminatorValue: All + - fieldName: single + discriminatorValue: Single +- name: io.k8s.api.scheduling.v1beta1.GangSchedulingPolicy + map: + fields: + - name: minCount + type: + scalar: numeric + default: 0 +- name: io.k8s.api.scheduling.v1beta1.PodGroup + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.api.scheduling.v1beta1.PodGroupSpec + default: {} + - name: status + type: + namedType: io.k8s.api.scheduling.v1beta1.PodGroupStatus + default: {} +- name: io.k8s.api.scheduling.v1beta1.PodGroupResourceClaim map: fields: - name: name @@ -14764,7 +16296,7 @@ var schemaYAML = typed.YAMLObject(`types: - name: resourceClaimTemplateName type: scalar: string -- name: io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaimStatus +- name: io.k8s.api.scheduling.v1beta1.PodGroupResourceClaimStatus map: fields: - name: name @@ -14774,40 +16306,44 @@ var schemaYAML = typed.YAMLObject(`types: - name: resourceClaimName type: scalar: string -- name: io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingConstraints +- name: io.k8s.api.scheduling.v1beta1.PodGroupSchedulingConstraints map: fields: - name: topology type: list: elementType: - namedType: io.k8s.api.scheduling.v1alpha2.TopologyConstraint + namedType: io.k8s.api.scheduling.v1beta1.TopologyConstraint elementRelationship: atomic -- name: io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingPolicy +- name: io.k8s.api.scheduling.v1beta1.PodGroupSchedulingPolicy map: fields: - name: basic type: - namedType: io.k8s.api.scheduling.v1alpha2.BasicSchedulingPolicy + namedType: io.k8s.api.scheduling.v1beta1.BasicSchedulingPolicy - name: gang type: - namedType: io.k8s.api.scheduling.v1alpha2.GangSchedulingPolicy + namedType: io.k8s.api.scheduling.v1beta1.GangSchedulingPolicy unions: - fields: - fieldName: basic discriminatorValue: Basic - fieldName: gang discriminatorValue: Gang -- name: io.k8s.api.scheduling.v1alpha2.PodGroupSpec +- name: io.k8s.api.scheduling.v1beta1.PodGroupSpec map: fields: - name: disruptionMode + type: + namedType: io.k8s.api.scheduling.v1beta1.DisruptionMode + default: + single: {} + - name: parentCompositePodGroupName type: scalar: string - default: Pod - - name: podGroupTemplateRef + - name: preemptionPolicy type: - namedType: io.k8s.api.scheduling.v1alpha2.PodGroupTemplateReference + scalar: string - name: priority type: scalar: numeric @@ -14818,18 +16354,21 @@ var schemaYAML = typed.YAMLObject(`types: type: list: elementType: - namedType: io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaim + namedType: io.k8s.api.scheduling.v1beta1.PodGroupResourceClaim elementRelationship: associative keys: - name - name: schedulingConstraints type: - namedType: io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingConstraints + namedType: io.k8s.api.scheduling.v1beta1.PodGroupSchedulingConstraints - name: schedulingPolicy type: - namedType: io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingPolicy + namedType: io.k8s.api.scheduling.v1beta1.PodGroupSchedulingPolicy default: {} -- name: io.k8s.api.scheduling.v1alpha2.PodGroupStatus + - name: workloadRef + type: + namedType: io.k8s.api.scheduling.v1beta1.WorkloadReference +- name: io.k8s.api.scheduling.v1beta1.PodGroupStatus map: fields: - name: conditions @@ -14844,20 +16383,23 @@ var schemaYAML = typed.YAMLObject(`types: type: list: elementType: - namedType: io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaimStatus + namedType: io.k8s.api.scheduling.v1beta1.PodGroupResourceClaimStatus elementRelationship: associative keys: - name -- name: io.k8s.api.scheduling.v1alpha2.PodGroupTemplate +- name: io.k8s.api.scheduling.v1beta1.PodGroupTemplate map: fields: - name: disruptionMode type: - scalar: string + namedType: io.k8s.api.scheduling.v1beta1.DisruptionMode - name: name type: scalar: string default: "" + - name: preemptionPolicy + type: + scalar: string - name: priority type: scalar: numeric @@ -14868,35 +16410,75 @@ var schemaYAML = typed.YAMLObject(`types: type: list: elementType: - namedType: io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaim + namedType: io.k8s.api.scheduling.v1beta1.PodGroupResourceClaim elementRelationship: associative keys: - name - name: schedulingConstraints type: - namedType: io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingConstraints + namedType: io.k8s.api.scheduling.v1beta1.PodGroupSchedulingConstraints - name: schedulingPolicy type: - namedType: io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingPolicy + namedType: io.k8s.api.scheduling.v1beta1.PodGroupSchedulingPolicy default: {} -- name: io.k8s.api.scheduling.v1alpha2.PodGroupTemplateReference +- name: io.k8s.api.scheduling.v1beta1.PriorityClass map: fields: - - name: workload + - name: apiVersion type: - namedType: io.k8s.api.scheduling.v1alpha2.WorkloadPodGroupTemplateReference - unions: - - fields: - - fieldName: workload - discriminatorValue: Workload -- name: io.k8s.api.scheduling.v1alpha2.TopologyConstraint + scalar: string + - name: description + type: + scalar: string + - name: globalDefault + type: + scalar: boolean + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: preemptionPolicy + type: + scalar: string + - name: value + type: + scalar: numeric + default: 0 +- name: io.k8s.api.scheduling.v1beta1.SingleCompositeDisruptionMode + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.api.scheduling.v1beta1.SingleDisruptionMode + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.api.scheduling.v1beta1.TopologyConstraint map: fields: - name: key type: scalar: string default: "" -- name: io.k8s.api.scheduling.v1alpha2.TypedLocalObjectReference +- name: io.k8s.api.scheduling.v1beta1.TypedLocalObjectReference map: fields: - name: apiGroup @@ -14910,7 +16492,7 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" -- name: io.k8s.api.scheduling.v1alpha2.Workload +- name: io.k8s.api.scheduling.v1beta1.Workload map: fields: - name: apiVersion @@ -14925,12 +16507,12 @@ var schemaYAML = typed.YAMLObject(`types: default: {} - name: spec type: - namedType: io.k8s.api.scheduling.v1alpha2.WorkloadSpec + namedType: io.k8s.api.scheduling.v1beta1.WorkloadSpec default: {} -- name: io.k8s.api.scheduling.v1alpha2.WorkloadPodGroupTemplateReference +- name: io.k8s.api.scheduling.v1beta1.WorkloadReference map: fields: - - name: podGroupTemplateName + - name: templateName type: scalar: string default: "" @@ -14938,46 +16520,28 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" -- name: io.k8s.api.scheduling.v1alpha2.WorkloadSpec +- name: io.k8s.api.scheduling.v1beta1.WorkloadSpec map: fields: + - name: compositePodGroupTemplates + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1beta1.CompositePodGroupTemplate + elementRelationship: associative + keys: + - name - name: controllerRef type: - namedType: io.k8s.api.scheduling.v1alpha2.TypedLocalObjectReference + namedType: io.k8s.api.scheduling.v1beta1.TypedLocalObjectReference - name: podGroupTemplates type: list: elementType: - namedType: io.k8s.api.scheduling.v1alpha2.PodGroupTemplate + namedType: io.k8s.api.scheduling.v1beta1.PodGroupTemplate elementRelationship: associative keys: - name -- name: io.k8s.api.scheduling.v1beta1.PriorityClass - map: - fields: - - name: apiVersion - type: - scalar: string - - name: description - type: - scalar: string - - name: globalDefault - type: - scalar: boolean - - name: kind - type: - scalar: string - - name: metadata - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta - default: {} - - name: preemptionPolicy - type: - scalar: string - - name: value - type: - scalar: numeric - default: 0 - name: io.k8s.api.storage.v1.CSIDriver map: fields: @@ -15054,6 +16618,10 @@ var schemaYAML = typed.YAMLObject(`types: type: namedType: io.k8s.api.storage.v1.CSINodeSpec default: {} + - name: status + type: + namedType: io.k8s.api.storage.v1.CSINodeStatus + default: {} - name: io.k8s.api.storage.v1.CSINodeDriver map: fields: @@ -15085,6 +16653,17 @@ var schemaYAML = typed.YAMLObject(`types: elementRelationship: associative keys: - name +- name: io.k8s.api.storage.v1.CSINodeStatus + map: + fields: + - name: storageHealth + type: + list: + elementType: + namedType: io.k8s.api.storage.v1.StorageHealth + elementRelationship: associative + keys: + - name - name: io.k8s.api.storage.v1.CSIStorageCapacity map: fields: @@ -15154,6 +16733,42 @@ var schemaYAML = typed.YAMLObject(`types: - name: volumeBindingMode type: scalar: string +- name: io.k8s.api.storage.v1.StorageHealth + map: + fields: + - name: healthConditions + type: + list: + elementType: + namedType: io.k8s.api.storage.v1.StorageHealthCondition + elementRelationship: atomic + - name: name + type: + scalar: string + default: "" +- name: io.k8s.api.storage.v1.StorageHealthCondition + map: + fields: + - name: accessMode + type: + scalar: string + - name: lastTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: message + type: + scalar: string + - name: reason + type: + scalar: string + default: "" + - name: status + type: + scalar: string + default: "" + - name: volumeMode + type: + scalar: string - name: io.k8s.api.storage.v1.TokenRequest map: fields: @@ -15466,6 +17081,10 @@ var schemaYAML = typed.YAMLObject(`types: type: namedType: io.k8s.api.storage.v1beta1.CSINodeSpec default: {} + - name: status + type: + namedType: io.k8s.api.storage.v1beta1.CSINodeStatus + default: {} - name: io.k8s.api.storage.v1beta1.CSINodeDriver map: fields: @@ -15497,6 +17116,17 @@ var schemaYAML = typed.YAMLObject(`types: elementRelationship: associative keys: - name +- name: io.k8s.api.storage.v1beta1.CSINodeStatus + map: + fields: + - name: storageHealth + type: + list: + elementType: + namedType: io.k8s.api.storage.v1beta1.StorageHealth + elementRelationship: associative + keys: + - name - name: io.k8s.api.storage.v1beta1.CSIStorageCapacity map: fields: @@ -15566,6 +17196,42 @@ var schemaYAML = typed.YAMLObject(`types: - name: volumeBindingMode type: scalar: string +- name: io.k8s.api.storage.v1beta1.StorageHealth + map: + fields: + - name: healthConditions + type: + list: + elementType: + namedType: io.k8s.api.storage.v1beta1.StorageHealthCondition + elementRelationship: atomic + - name: name + type: + scalar: string + default: "" +- name: io.k8s.api.storage.v1beta1.StorageHealthCondition + map: + fields: + - name: accessMode + type: + scalar: string + - name: lastTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: message + type: + scalar: string + - name: reason + type: + scalar: string + default: "" + - name: status + type: + scalar: string + default: "" + - name: volumeMode + type: + scalar: string - name: io.k8s.api.storage.v1beta1.TokenRequest map: fields: @@ -15679,6 +17345,48 @@ var schemaYAML = typed.YAMLObject(`types: - name: count type: scalar: numeric +- name: io.k8s.api.storagemigration.v1.StorageVersionMigration + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.api.storagemigration.v1.StorageVersionMigrationSpec + default: {} + - name: status + type: + namedType: io.k8s.api.storagemigration.v1.StorageVersionMigrationStatus + default: {} +- name: io.k8s.api.storagemigration.v1.StorageVersionMigrationSpec + map: + fields: + - name: resource + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.GroupResource + default: {} +- name: io.k8s.api.storagemigration.v1.StorageVersionMigrationStatus + map: + fields: + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type + - name: resourceVersion + type: + scalar: string - name: io.k8s.api.storagemigration.v1beta1.StorageVersionMigration map: fields: diff --git a/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/eviction.go b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/eviction.go new file mode 100644 index 0000000000..afcf451205 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/eviction.go @@ -0,0 +1,327 @@ +/* +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 v1alpha1 + +import ( + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + internal "k8s.io/client-go/applyconfigurations/internal" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// EvictionApplyConfiguration represents a declarative configuration of the Eviction type for use +// with apply. +// +// Eviction initiates an eviction process, which should ideally result in a graceful eviction of a +// .spec.target (e.g. termination of a pod). +// +// The evictionrequest-controller observes intents of all EvictionRequests and transforms them into +// Evictions. It manages the Eviction lifecycle. +// Requesters are preserved in .status.requesters even after they have withdrawn their request. +// If all requesters withdraw their eviction intent for a common target, the eviction will be +// canceled. Once all EvictionRequest corresponding to this Eviction .spec.target have been +// removed, this Eviction object will eventually be garbage collected. +// +// If the target is a pod, the .status.targetResponders is populated from Pod's +// .spec.evictionResponders. +// +// Responders should observe and communicate through the .status to help with the eviction +// of the target when they see their state == Active in .status.targetResponders. ResponderStatus +// struct should then be periodically updated to indicate the progress or completion of the eviction +// process by each responder in .status.responders. If .status.responders[].heartbeatTime is not +// updated within the heartbeat deadline defined by the Eviction API (currently 20 minutes), the +// eviction is passed over to the next responder with a lower priority. +// +// If there are no other responders and the target is a pod, the last default +// imperative-eviction.k8s.io/evictor responder with a priority of 100 will evict the pod using the +// imperative Eviction API (pods//eviction subresource). +type EvictionApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // .metadata.name set by the evictionrequest-controller is purely informative and subject to change. + // .spec.target field should be used to identify the target precisesly. + // + // The requester and responder names will be used as label keys and added to the labels of the + // eviction in one of the following formats: + // 1. acme.io/foo: "requester" + // 2. acme.io/foo: "responder" + // 3. acme.io/foo: "requester-responder" + // + // Please see EvictionParticipantRole for available role label values. + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec defines the eviction specification. + // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *EvictionSpecApplyConfiguration `json:"spec,omitempty"` + // status represents the most recently observed status of the eviction. + // Populated by responders and evictionrequest-controller. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Status *EvictionStatusApplyConfiguration `json:"status,omitempty"` +} + +// Eviction constructs a declarative configuration of the Eviction type for use with +// apply. +func Eviction(name, namespace string) *EvictionApplyConfiguration { + b := &EvictionApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Eviction") + b.WithAPIVersion("lifecycle.k8s.io/v1alpha1") + return b +} + +// ExtractEvictionFrom extracts the applied configuration owned by fieldManager from +// eviction for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// eviction must be a unmodified Eviction API object that was retrieved from the Kubernetes API. +// ExtractEvictionFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractEvictionFrom(eviction *lifecyclev1alpha1.Eviction, fieldManager string, subresource string) (*EvictionApplyConfiguration, error) { + b := &EvictionApplyConfiguration{} + err := managedfields.ExtractInto(eviction, internal.Parser().Type("io.k8s.api.lifecycle.v1alpha1.Eviction"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(eviction.Name) + b.WithNamespace(eviction.Namespace) + + b.WithKind("Eviction") + b.WithAPIVersion("lifecycle.k8s.io/v1alpha1") + return b, nil +} + +// ExtractEviction extracts the applied configuration owned by fieldManager from +// eviction. If no managedFields are found in eviction for fieldManager, a +// EvictionApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// eviction must be a unmodified Eviction API object that was retrieved from the Kubernetes API. +// ExtractEviction provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractEviction(eviction *lifecyclev1alpha1.Eviction, fieldManager string) (*EvictionApplyConfiguration, error) { + return ExtractEvictionFrom(eviction, fieldManager, "") +} + +// ExtractEvictionStatus extracts the applied configuration owned by fieldManager from +// eviction for the status subresource. +func ExtractEvictionStatus(eviction *lifecyclev1alpha1.Eviction, fieldManager string) (*EvictionApplyConfiguration, error) { + return ExtractEvictionFrom(eviction, fieldManager, "status") +} + +func (b EvictionApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind 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 Kind field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithKind(value string) *EvictionApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion 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 APIVersion field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithAPIVersion(value string) *EvictionApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// 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 *EvictionApplyConfiguration) WithName(value string) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithGenerateName(value string) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithNamespace(value string) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID 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 UID field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithUID(value types.UID) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithResourceVersion(value string) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation 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 Generation field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithGeneration(value int64) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp 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 CreationTimestamp field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithCreationTimestamp(value metav1.Time) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp 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 DeletionTimestamp field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds 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 DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels 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 Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *EvictionApplyConfiguration) WithLabels(entries map[string]string) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations 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 Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *EvictionApplyConfiguration) WithAnnotations(entries map[string]string) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences 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 OwnerReferences field. +func (b *EvictionApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers 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 Finalizers field. +func (b *EvictionApplyConfiguration) WithFinalizers(values ...string) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *EvictionApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec 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 Spec field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithSpec(value *EvictionSpecApplyConfiguration) *EvictionApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status 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 Status field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithStatus(value *EvictionStatusApplyConfiguration) *EvictionApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *EvictionApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *EvictionApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *EvictionApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *EvictionApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionpodreference.go b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionpodreference.go new file mode 100644 index 0000000000..bc5c6e0f20 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionpodreference.go @@ -0,0 +1,60 @@ +/* +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 v1alpha1 + +import ( + types "k8s.io/apimachinery/pkg/types" +) + +// EvictionPodReferenceApplyConfiguration represents a declarative configuration of the EvictionPodReference type for use +// with apply. +// +// EvictionPodReference contains enough information to locate the referenced pod inside the same +// namespace. +type EvictionPodReferenceApplyConfiguration struct { + // name of the target. + // This field is required. + Name *string `json:"name,omitempty"` + // uid of the target. + // It can be found in .metadata.uid of the target and is a lowercase UUID in 8-4-4-4-12 format. + // This field is required. + UID *types.UID `json:"uid,omitempty"` +} + +// EvictionPodReferenceApplyConfiguration constructs a declarative configuration of the EvictionPodReference type for use with +// apply. +func EvictionPodReference() *EvictionPodReferenceApplyConfiguration { + return &EvictionPodReferenceApplyConfiguration{} +} + +// 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 *EvictionPodReferenceApplyConfiguration) WithName(value string) *EvictionPodReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithUID sets the UID 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 UID field is set to the value of the last call. +func (b *EvictionPodReferenceApplyConfiguration) WithUID(value types.UID) *EvictionPodReferenceApplyConfiguration { + b.UID = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionrequest.go b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionrequest.go new file mode 100644 index 0000000000..66bfeb38fb --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionrequest.go @@ -0,0 +1,310 @@ +/* +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 v1alpha1 + +import ( + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + internal "k8s.io/client-go/applyconfigurations/internal" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// EvictionRequestApplyConfiguration represents a declarative configuration of the EvictionRequest type for use +// with apply. +// +// EvictionRequest defines a request that should ideally result in a graceful eviction of a +// .spec.target (e.g. termination of a pod). +// +// The evictionrequest-controller observes intents of all EvictionRequests and transforms them into +// Evictions. +// - .spec.requester is set as a label on the Eviction for easier lookup. +// - Each target can have a set of responders assigned to it. Eviction objects are observed by +// these responders, who implement the eviction logic and update the Eviction's status with +// progress. +// +// There is many-to-many relationship between EvictionRequests and Evictions in general. +// And many-to-one if the target is a pod. +// +// If all requesters withdraw their eviction intent for a common target, the eviction will be +// canceled. Deleting an EvictionRequest also counts as a withdrawal. +// Once all EvictionRequest of a target are removed, the corresponding Evictions are eventually +// garbage collected. +type EvictionRequestApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec defines the eviction request specification. + // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *EvictionRequestSpecApplyConfiguration `json:"spec,omitempty"` + // status represents the most recently observed status of the eviction request. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Status *EvictionRequestStatusApplyConfiguration `json:"status,omitempty"` +} + +// EvictionRequest constructs a declarative configuration of the EvictionRequest type for use with +// apply. +func EvictionRequest(name, namespace string) *EvictionRequestApplyConfiguration { + b := &EvictionRequestApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("EvictionRequest") + b.WithAPIVersion("lifecycle.k8s.io/v1alpha1") + return b +} + +// ExtractEvictionRequestFrom extracts the applied configuration owned by fieldManager from +// evictionRequest for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// evictionRequest must be a unmodified EvictionRequest API object that was retrieved from the Kubernetes API. +// ExtractEvictionRequestFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractEvictionRequestFrom(evictionRequest *lifecyclev1alpha1.EvictionRequest, fieldManager string, subresource string) (*EvictionRequestApplyConfiguration, error) { + b := &EvictionRequestApplyConfiguration{} + err := managedfields.ExtractInto(evictionRequest, internal.Parser().Type("io.k8s.api.lifecycle.v1alpha1.EvictionRequest"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(evictionRequest.Name) + b.WithNamespace(evictionRequest.Namespace) + + b.WithKind("EvictionRequest") + b.WithAPIVersion("lifecycle.k8s.io/v1alpha1") + return b, nil +} + +// ExtractEvictionRequest extracts the applied configuration owned by fieldManager from +// evictionRequest. If no managedFields are found in evictionRequest for fieldManager, a +// EvictionRequestApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// evictionRequest must be a unmodified EvictionRequest API object that was retrieved from the Kubernetes API. +// ExtractEvictionRequest provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractEvictionRequest(evictionRequest *lifecyclev1alpha1.EvictionRequest, fieldManager string) (*EvictionRequestApplyConfiguration, error) { + return ExtractEvictionRequestFrom(evictionRequest, fieldManager, "") +} + +// ExtractEvictionRequestStatus extracts the applied configuration owned by fieldManager from +// evictionRequest for the status subresource. +func ExtractEvictionRequestStatus(evictionRequest *lifecyclev1alpha1.EvictionRequest, fieldManager string) (*EvictionRequestApplyConfiguration, error) { + return ExtractEvictionRequestFrom(evictionRequest, fieldManager, "status") +} + +func (b EvictionRequestApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind 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 Kind field is set to the value of the last call. +func (b *EvictionRequestApplyConfiguration) WithKind(value string) *EvictionRequestApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion 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 APIVersion field is set to the value of the last call. +func (b *EvictionRequestApplyConfiguration) WithAPIVersion(value string) *EvictionRequestApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// 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 *EvictionRequestApplyConfiguration) WithName(value string) *EvictionRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call. +func (b *EvictionRequestApplyConfiguration) WithGenerateName(value string) *EvictionRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call. +func (b *EvictionRequestApplyConfiguration) WithNamespace(value string) *EvictionRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID 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 UID field is set to the value of the last call. +func (b *EvictionRequestApplyConfiguration) WithUID(value types.UID) *EvictionRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call. +func (b *EvictionRequestApplyConfiguration) WithResourceVersion(value string) *EvictionRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation 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 Generation field is set to the value of the last call. +func (b *EvictionRequestApplyConfiguration) WithGeneration(value int64) *EvictionRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp 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 CreationTimestamp field is set to the value of the last call. +func (b *EvictionRequestApplyConfiguration) WithCreationTimestamp(value metav1.Time) *EvictionRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp 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 DeletionTimestamp field is set to the value of the last call. +func (b *EvictionRequestApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *EvictionRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds 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 DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *EvictionRequestApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *EvictionRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels 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 Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *EvictionRequestApplyConfiguration) WithLabels(entries map[string]string) *EvictionRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations 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 Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *EvictionRequestApplyConfiguration) WithAnnotations(entries map[string]string) *EvictionRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences 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 OwnerReferences field. +func (b *EvictionRequestApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *EvictionRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers 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 Finalizers field. +func (b *EvictionRequestApplyConfiguration) WithFinalizers(values ...string) *EvictionRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *EvictionRequestApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec 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 Spec field is set to the value of the last call. +func (b *EvictionRequestApplyConfiguration) WithSpec(value *EvictionRequestSpecApplyConfiguration) *EvictionRequestApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status 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 Status field is set to the value of the last call. +func (b *EvictionRequestApplyConfiguration) WithStatus(value *EvictionRequestStatusApplyConfiguration) *EvictionRequestApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *EvictionRequestApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *EvictionRequestApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *EvictionRequestApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *EvictionRequestApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionrequestpodreference.go b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionrequestpodreference.go new file mode 100644 index 0000000000..4e64868656 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionrequestpodreference.go @@ -0,0 +1,60 @@ +/* +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 v1alpha1 + +import ( + types "k8s.io/apimachinery/pkg/types" +) + +// EvictionRequestPodReferenceApplyConfiguration represents a declarative configuration of the EvictionRequestPodReference type for use +// with apply. +// +// EvictionRequestPodReference contains enough information to locate the referenced pod inside the +// same namespace. +type EvictionRequestPodReferenceApplyConfiguration struct { + // name of the target. + // This field is required. + Name *string `json:"name,omitempty"` + // uid of the target. + // It can be found in .metadata.uid of the target and is a lowercase UUID in 8-4-4-4-12 format. + // This field is required. + UID *types.UID `json:"uid,omitempty"` +} + +// EvictionRequestPodReferenceApplyConfiguration constructs a declarative configuration of the EvictionRequestPodReference type for use with +// apply. +func EvictionRequestPodReference() *EvictionRequestPodReferenceApplyConfiguration { + return &EvictionRequestPodReferenceApplyConfiguration{} +} + +// 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 *EvictionRequestPodReferenceApplyConfiguration) WithName(value string) *EvictionRequestPodReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithUID sets the UID 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 UID field is set to the value of the last call. +func (b *EvictionRequestPodReferenceApplyConfiguration) WithUID(value types.UID) *EvictionRequestPodReferenceApplyConfiguration { + b.UID = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionrequestspec.go b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionrequestspec.go new file mode 100644 index 0000000000..6fc40b8c22 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionrequestspec.go @@ -0,0 +1,79 @@ +/* +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 v1alpha1 + +import ( + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" +) + +// EvictionRequestSpecApplyConfiguration represents a declarative configuration of the EvictionRequestSpec type for use +// with apply. +// +// EvictionRequestSpec is a specification of an EvictionRequest. +type EvictionRequestSpecApplyConfiguration struct { + // target contains a reference to an object (e.g. a pod) that should be evicted. + // This field is required and immutable. + Target *EvictionRequestTargetApplyConfiguration `json:"target,omitempty"` + // requester allows you to identify the entity, that requested the eviction of the target. + // + // It must be a valid domain-prefixed key (such as "acme.io/foo"). + // Domain names *.k8s.io and *.kubernetes.io are reserved. + // This field is required and immutable. + Requester *string `json:"requester,omitempty"` + // intent specifies the action that should be taken for the specified target. + // + // - Eviction means that the requester is interested in the eviction of the target. + // - Withdrawn means that the requester is no longer interested in the eviction of the target. + // If all requesters' intents are withdrawn for a common target, the eviction will be canceled. + // Cancellation consequences: + // - Inactive responders will never run. + // - Active responders are expected to cancel the eviction. + // - Completed or Interrupted responders should not take any action. + Intent *lifecyclev1alpha1.EvictionRequestIntent `json:"intent,omitempty"` +} + +// EvictionRequestSpecApplyConfiguration constructs a declarative configuration of the EvictionRequestSpec type for use with +// apply. +func EvictionRequestSpec() *EvictionRequestSpecApplyConfiguration { + return &EvictionRequestSpecApplyConfiguration{} +} + +// WithTarget sets the Target 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 Target field is set to the value of the last call. +func (b *EvictionRequestSpecApplyConfiguration) WithTarget(value *EvictionRequestTargetApplyConfiguration) *EvictionRequestSpecApplyConfiguration { + b.Target = value + return b +} + +// WithRequester sets the Requester 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 Requester field is set to the value of the last call. +func (b *EvictionRequestSpecApplyConfiguration) WithRequester(value string) *EvictionRequestSpecApplyConfiguration { + b.Requester = &value + return b +} + +// WithIntent sets the Intent 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 Intent field is set to the value of the last call. +func (b *EvictionRequestSpecApplyConfiguration) WithIntent(value lifecyclev1alpha1.EvictionRequestIntent) *EvictionRequestSpecApplyConfiguration { + b.Intent = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionrequeststatus.go b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionrequeststatus.go new file mode 100644 index 0000000000..8367990f9c --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionrequeststatus.go @@ -0,0 +1,75 @@ +/* +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 v1alpha1 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// EvictionRequestStatusApplyConfiguration represents a declarative configuration of the EvictionRequestStatus type for use +// with apply. +// +// EvictionRequestStatus represents the last observed status of the eviction request. +type EvictionRequestStatusApplyConfiguration struct { + // conditions contain information about the eviction request. + // + // EvictionRequest specific conditions are: TargetEvicted or Failed (managed by evictionrequest-controller). + // - Failed means that the eviction request is no longer being processed + // by any eviction responder. This can happen if the request is canceled or if no responder + // managed to evict the target (e.g. terminate or delete a pod). + // - TargetEvicted means that the target has been evicted (e.g. a pod has been terminated or deleted). + // + // These conditions can be reset if the eviction was unsuccessful and a new Eviction intent has + // been submitted. + // + // The maximum length of the conditions list is 100. + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` + // observedGeneration is EvictionRequest's .metadata.generation observed by the evictionrequest-controller. + // The observed generation value cannot be negative and can only be incremented. + // The minimum value is 1. + // This field is managed by evictionrequest-controller. + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` +} + +// EvictionRequestStatusApplyConfiguration constructs a declarative configuration of the EvictionRequestStatus type for use with +// apply. +func EvictionRequestStatus() *EvictionRequestStatusApplyConfiguration { + return &EvictionRequestStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions 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 Conditions field. +func (b *EvictionRequestStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *EvictionRequestStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithObservedGeneration sets the ObservedGeneration 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 ObservedGeneration field is set to the value of the last call. +func (b *EvictionRequestStatusApplyConfiguration) WithObservedGeneration(value int64) *EvictionRequestStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionrequesttarget.go b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionrequesttarget.go new file mode 100644 index 0000000000..1000dc533a --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionrequesttarget.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 v1alpha1 + +// EvictionRequestTargetApplyConfiguration represents a declarative configuration of the EvictionRequestTarget type for use +// with apply. +// +// EvictionRequestTarget contains a reference to an object that should be evicted. +type EvictionRequestTargetApplyConfiguration struct { + // pod references a pod that is subject to eviction/termination. + // Pods that are part of a PodGroup (.spec.schedulingGroup is set) are not supported. + Pod *EvictionRequestPodReferenceApplyConfiguration `json:"pod,omitempty"` +} + +// EvictionRequestTargetApplyConfiguration constructs a declarative configuration of the EvictionRequestTarget type for use with +// apply. +func EvictionRequestTarget() *EvictionRequestTargetApplyConfiguration { + return &EvictionRequestTargetApplyConfiguration{} +} + +// WithPod sets the Pod 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 Pod field is set to the value of the last call. +func (b *EvictionRequestTargetApplyConfiguration) WithPod(value *EvictionRequestPodReferenceApplyConfiguration) *EvictionRequestTargetApplyConfiguration { + b.Pod = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionspec.go b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionspec.go new file mode 100644 index 0000000000..4ed00a53bf --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionspec.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 v1alpha1 + +// EvictionSpecApplyConfiguration represents a declarative configuration of the EvictionSpec type for use +// with apply. +// +// EvictionSpec is a specification of an Eviction. +type EvictionSpecApplyConfiguration struct { + // target contains a reference to an object (e.g. a pod) that should be evicted. + // This field is required and immutable. + Target *EvictionTargetApplyConfiguration `json:"target,omitempty"` +} + +// EvictionSpecApplyConfiguration constructs a declarative configuration of the EvictionSpec type for use with +// apply. +func EvictionSpec() *EvictionSpecApplyConfiguration { + return &EvictionSpecApplyConfiguration{} +} + +// WithTarget sets the Target 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 Target field is set to the value of the last call. +func (b *EvictionSpecApplyConfiguration) WithTarget(value *EvictionTargetApplyConfiguration) *EvictionSpecApplyConfiguration { + b.Target = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionstatus.go b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionstatus.go new file mode 100644 index 0000000000..b6d3a96584 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictionstatus.go @@ -0,0 +1,147 @@ +/* +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 v1alpha1 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// EvictionStatusApplyConfiguration represents a declarative configuration of the EvictionStatus type for use +// with apply. +// +// EvictionStatus represents the last observed status of the eviction request. +type EvictionStatusApplyConfiguration struct { + // conditions contain information about the eviction request. + // + // Eviction specific conditions are: TargetEvicted or Failed (managed by evictionrequest-controller). + // - Failed means that the eviction request is no longer being processed + // by any eviction responder. This can happen if the request is canceled or if no responder + // managed to evict the target (e.g. terminate or delete a pod). + // - TargetEvicted means that the target has been evicted (e.g. a pod has been terminated or deleted). + // + // The maximum length of the conditions list is 100. + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` + // observedGeneration is Eviction's .metadata.generation observed by the evictionrequest-controller. + // The observed generation value cannot be negative and can only be incremented. + // The minimum value is 1. + // This field is managed by evictionrequest-controller. + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + // requesters allow you to identify the entities, that requested the eviction of the target. + // If all the requesters withdraw their eviction intent, the eviction will be canceled. + // + // The maximum length of the requesters list is 100. + // If this limit is exceeded, requesters with Withdrawn intent should be dropped first. + Requesters []RequesterApplyConfiguration `json:"requesters,omitempty"` + // targetResponders reference responders that should eventually respond to this eviction + // to help with the graceful eviction of a target. These responders are selected sequentially, + // according to their specified priority by setting the Active state to the TargetResponder + // .state field. The maximum number of active responders allowed is 1. + // Eventually each responder can end up in an Interrupted, Canceled or, Completed state. + // Responders should observe these states in order to navigate their lifecycle. + // + // If the target is a pod, the field is populated from Pod's .spec.evictionResponders. Default + // responders may be added to the list according to the target. + // + // Default responders: + // - imperative-eviction.k8s.io/evictor responder with a priority of 100 is added to the list if the + // target is a pod. It will call the imperative Eviction API (pods//eviction subresource). + // This call may not succeed due to PodDisruptionBudgets, which may block the pod termination. + // It will update the responder message and try again with a backoff. + // + // The maximum length of the responders list is 11. + // The length and keys of the list cannot change once set. + // This field is managed by evictionrequest-controller. + TargetResponders []TargetResponderApplyConfiguration `json:"targetResponders,omitempty"` + // responders represents the eviction process status of each declared responder. + // + // The responder list should be the same length and have the same .name fields as + // .status.targetResponders. Only responders with .name that have Active state in + // .targetResponders[].state should be updated and can be mutated. First initialization + // of the list is allowed. + // + // Each ResponderStatus is initialized by evictionrequest-controller and then managed by + // the designated responder. + Responders []ResponderStatusApplyConfiguration `json:"responders,omitempty"` +} + +// EvictionStatusApplyConfiguration constructs a declarative configuration of the EvictionStatus type for use with +// apply. +func EvictionStatus() *EvictionStatusApplyConfiguration { + return &EvictionStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions 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 Conditions field. +func (b *EvictionStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *EvictionStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithObservedGeneration sets the ObservedGeneration 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 ObservedGeneration field is set to the value of the last call. +func (b *EvictionStatusApplyConfiguration) WithObservedGeneration(value int64) *EvictionStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithRequesters adds the given value to the Requesters 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 Requesters field. +func (b *EvictionStatusApplyConfiguration) WithRequesters(values ...*RequesterApplyConfiguration) *EvictionStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithRequesters") + } + b.Requesters = append(b.Requesters, *values[i]) + } + return b +} + +// WithTargetResponders adds the given value to the TargetResponders 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 TargetResponders field. +func (b *EvictionStatusApplyConfiguration) WithTargetResponders(values ...*TargetResponderApplyConfiguration) *EvictionStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithTargetResponders") + } + b.TargetResponders = append(b.TargetResponders, *values[i]) + } + return b +} + +// WithResponders adds the given value to the Responders 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 Responders field. +func (b *EvictionStatusApplyConfiguration) WithResponders(values ...*ResponderStatusApplyConfiguration) *EvictionStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithResponders") + } + b.Responders = append(b.Responders, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictiontarget.go b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictiontarget.go new file mode 100644 index 0000000000..ff353caebb --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/evictiontarget.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 v1alpha1 + +// EvictionTargetApplyConfiguration represents a declarative configuration of the EvictionTarget type for use +// with apply. +// +// EvictionTarget contains a reference to an object that should be evicted. +type EvictionTargetApplyConfiguration struct { + // pod references a pod that is subject to eviction/termination. + // Pods that are part of a PodGroup (.spec.schedulingGroup is set) are not supported. + Pod *EvictionPodReferenceApplyConfiguration `json:"pod,omitempty"` +} + +// EvictionTargetApplyConfiguration constructs a declarative configuration of the EvictionTarget type for use with +// apply. +func EvictionTarget() *EvictionTargetApplyConfiguration { + return &EvictionTargetApplyConfiguration{} +} + +// WithPod sets the Pod 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 Pod field is set to the value of the last call. +func (b *EvictionTargetApplyConfiguration) WithPod(value *EvictionPodReferenceApplyConfiguration) *EvictionTargetApplyConfiguration { + b.Pod = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/requester.go b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/requester.go new file mode 100644 index 0000000000..3991be03ea --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/requester.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" +) + +// RequesterApplyConfiguration represents a declarative configuration of the Requester type for use +// with apply. +// +// Requester allows you to identify the entity, that requested the eviction of the target. +type RequesterApplyConfiguration struct { + // name allows you to identify the entity, that requested the eviction of the target. + // + // It must be a valid domain-prefixed key (such as "acme.io/foo"). + // This field must be unique for each requester. + // This field is required. + Name *string `json:"name,omitempty"` + // intent specifies the action that should be taken for the specified target. + // + // - Eviction means that the requester is interested in the eviction of the target. + // - Withdrawn means that the requester is no longer interested in the eviction of the target. + // If all requesters' intents are withdrawn, the eviction will be canceled. + // Cancellation consequences: + // - Inactive responders will never run. + // - Active responders are expected to cancel the eviction. + // - Completed or Interrupted responders should not take any action. + Intent *lifecyclev1alpha1.RequesterIntent `json:"intent,omitempty"` +} + +// RequesterApplyConfiguration constructs a declarative configuration of the Requester type for use with +// apply. +func Requester() *RequesterApplyConfiguration { + return &RequesterApplyConfiguration{} +} + +// 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 *RequesterApplyConfiguration) WithName(value string) *RequesterApplyConfiguration { + b.Name = &value + return b +} + +// WithIntent sets the Intent 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 Intent field is set to the value of the last call. +func (b *RequesterApplyConfiguration) WithIntent(value lifecyclev1alpha1.RequesterIntent) *RequesterApplyConfiguration { + b.Intent = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/responderstatus.go b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/responderstatus.go new file mode 100644 index 0000000000..e7d41d6670 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/responderstatus.go @@ -0,0 +1,118 @@ +/* +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 v1alpha1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ResponderStatusApplyConfiguration represents a declarative configuration of the ResponderStatus type for use +// with apply. +// +// ResponderStatus represents the last observed status of the eviction process of the responder. +// It should be only updated by the designated responder whose name is .name field. +type ResponderStatusApplyConfiguration struct { + // name allows you to identify the responder reacting to the Eviction. + // + // It must be a valid domain-prefixed key (such as "acme.io/foo"). + // This field is initialized by Kubernetes and must be unique for each responder. + // This field is required. + Name *string `json:"name,omitempty"` + // startTime tracks the time at which this responder was designated as active and should start + // processing the eviction request. + // It should reflect the present time when set. + // This field is initialized by Kubernetes when this responder becomes active. + // This field becomes immutable once set. + StartTime *v1.Time `json:"startTime,omitempty"` + // heartbeatTime is the last time at which the eviction process was reported to be in progress + // by the responder. + // It should reflect the present time when set. + // Responders should avoid heartbeats more frequent than 20 seconds to avoid overloading the + // control-plane. + HeartbeatTime *v1.Time `json:"heartbeatTime,omitempty"` + // expectedCompletionTime is the time at which the eviction process step is expected to end for the + // responder. + // The time cannot be set to the past. + // May be omitted if no estimate can be made. + ExpectedCompletionTime *v1.Time `json:"expectedCompletionTime,omitempty"` + // completionTime tracks the time at which the Responder stopped processing the eviction request. + // Completion means that the responders has either fully or partially completed the + // eviction process, which may have resulted in target eviction (e.g. pod termination). + // It should reflect the present time when set. + // This field becomes immutable once set. + CompletionTime *v1.Time `json:"completionTime,omitempty"` + // message provides human-readable details about the state of the responder and the eviction + // process. + // Maximum length is 4000 characters. + Message *string `json:"message,omitempty"` +} + +// ResponderStatusApplyConfiguration constructs a declarative configuration of the ResponderStatus type for use with +// apply. +func ResponderStatus() *ResponderStatusApplyConfiguration { + return &ResponderStatusApplyConfiguration{} +} + +// 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 *ResponderStatusApplyConfiguration) WithName(value string) *ResponderStatusApplyConfiguration { + b.Name = &value + return b +} + +// WithStartTime sets the StartTime 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 StartTime field is set to the value of the last call. +func (b *ResponderStatusApplyConfiguration) WithStartTime(value v1.Time) *ResponderStatusApplyConfiguration { + b.StartTime = &value + return b +} + +// WithHeartbeatTime sets the HeartbeatTime 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 HeartbeatTime field is set to the value of the last call. +func (b *ResponderStatusApplyConfiguration) WithHeartbeatTime(value v1.Time) *ResponderStatusApplyConfiguration { + b.HeartbeatTime = &value + return b +} + +// WithExpectedCompletionTime sets the ExpectedCompletionTime 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 ExpectedCompletionTime field is set to the value of the last call. +func (b *ResponderStatusApplyConfiguration) WithExpectedCompletionTime(value v1.Time) *ResponderStatusApplyConfiguration { + b.ExpectedCompletionTime = &value + return b +} + +// WithCompletionTime sets the CompletionTime 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 CompletionTime field is set to the value of the last call. +func (b *ResponderStatusApplyConfiguration) WithCompletionTime(value v1.Time) *ResponderStatusApplyConfiguration { + b.CompletionTime = &value + return b +} + +// WithMessage sets the Message 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 Message field is set to the value of the last call. +func (b *ResponderStatusApplyConfiguration) WithMessage(value string) *ResponderStatusApplyConfiguration { + b.Message = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/targetresponder.go b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/targetresponder.go new file mode 100644 index 0000000000..a04690e787 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1/targetresponder.go @@ -0,0 +1,102 @@ +/* +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 v1alpha1 + +import ( + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" +) + +// TargetResponderApplyConfiguration represents a declarative configuration of the TargetResponder type for use +// with apply. +// +// TargetResponder allows you to specify the responder reacting to the Eviction. +// Responders should observe and communicate through the Eviction API (see .state) to help +// with the graceful eviction of a target (e.g. termination of a pod). +type TargetResponderApplyConfiguration struct { + // name allows you to identify the responder reacting to the Eviction. + // + // It must be a valid domain-prefixed key (such as "acme.io/foo"). + // This field must be unique for each responder. + // This field is required. + Name *string `json:"name,omitempty"` + // priority for this responder. Higher priorities are selected first by the evictionrequest-controller. + // If there are responders with the same priority, the responder whose domain name comes first in the + // alphabetical higher domain order, will be picked. This means that the top domain labels are compared + // alphabetically first, followed by the lower domain labels. The key is compared last. + // + // The responder that is the managing controller of the pod should set the value of + // this field to 10000 to allow both for preemption or fallback registration by other + // responders. + // + // The minimum value is 0 and the maximum value is 100000. + // The interval 0-999 is reserved for responders with *.k8s.io suffix. + // This field is required and immutable. + Priority *int32 `json:"priority,omitempty"` + // state specifies a state that is assigned by the evictionrequest-controller. Responders should observe + // this state in order to navigate their lifecycle. + // - Inactive means that the responder should not yet process this eviction request. + // - Active means that the responder is either running or expected to start soon. + // Also, startTime has been set in the ResponderStatus by the evictionrequest-controller. + // + // An active responder should currently interact with the eviction process by updating + // .status.responders, where .name is the active responder name. ResponderStatus fields + // should be periodically updated to indicate the progress or completion of the eviction process. + // If .status.responders[].heartbeatTime field is not updated within the heartbeat deadline defined + // by the Eviction API (currently 20 minutes), the eviction is passed over to the next responder + // with a lower priority. Only one responder can be active at a time. + // - Interrupted means that the responder has failed to start or failed to update + // heartbeatTime in ResponderStatus in a timely manner. + // - Canceled means that the responder has been canceled. In other words, there is no + // EvictionRequest with the same target and Eviction intent in .spec.intent. + // - Completed means that the responder has successfully completed and set completionTime + // in ResponderStatus. + // + // Please refer to the ResponderStatus in .status.responders for more details on each responder. + State *lifecyclev1alpha1.ResponderStateType `json:"state,omitempty"` +} + +// TargetResponderApplyConfiguration constructs a declarative configuration of the TargetResponder type for use with +// apply. +func TargetResponder() *TargetResponderApplyConfiguration { + return &TargetResponderApplyConfiguration{} +} + +// 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 *TargetResponderApplyConfiguration) WithName(value string) *TargetResponderApplyConfiguration { + b.Name = &value + return b +} + +// WithPriority sets the Priority 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 Priority field is set to the value of the last call. +func (b *TargetResponderApplyConfiguration) WithPriority(value int32) *TargetResponderApplyConfiguration { + b.Priority = &value + return b +} + +// WithState sets the State 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 State field is set to the value of the last call. +func (b *TargetResponderApplyConfiguration) WithState(value lifecyclev1alpha1.ResponderStateType) *TargetResponderApplyConfiguration { + b.State = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/meta/v1/condition.go b/vendor/k8s.io/client-go/applyconfigurations/meta/v1/condition.go index 6b0a44312b..11e0260ab8 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/meta/v1/condition.go +++ b/vendor/k8s.io/client-go/applyconfigurations/meta/v1/condition.go @@ -36,6 +36,9 @@ import ( // // +patchStrategy=merge // // +listType=map // // +listMapKey=type +// // +k8s:alpha(since: "1.37")=+k8s:optional +// // +k8s:alpha(since: "1.37")=+k8s:listType=map +// // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type // Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` // // // other fields diff --git a/vendor/k8s.io/client-go/applyconfigurations/meta/v1/deleteoptions.go b/vendor/k8s.io/client-go/applyconfigurations/meta/v1/deleteoptions.go index ed4c4bfa50..0679f1c8f1 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/meta/v1/deleteoptions.go +++ b/vendor/k8s.io/client-go/applyconfigurations/meta/v1/deleteoptions.go @@ -27,7 +27,7 @@ import ( // // DeleteOptions may be provided when deleting an API object. type DeleteOptionsApplyConfiguration struct { - TypeMetaApplyConfiguration `json:",inline"` + TypeMetaApplyConfiguration `json:""` // The duration in seconds before the object should be deleted. Value must be non-negative integer. // The value zero indicates delete immediately. If this value is nil, the default grace period for the // specified type will be used. diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingress.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingress.go index e6bb92050b..dad98cc876 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingress.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingress.go @@ -35,8 +35,8 @@ import ( // externally-reachable urls, load balance traffic, terminate SSL, offer name // based virtual hosting etc. type IngressApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec is the desired state of the Ingress. diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressclass.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressclass.go index 387e45728b..69da66c6c9 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressclass.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressclass.go @@ -36,8 +36,8 @@ import ( // single IngressClass resource has this annotation set to true, new Ingress // resources without a class specified will be assigned this default class. type IngressClassApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec is the desired state of the IngressClass. diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressrule.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressrule.go index e77494d869..7a8ffbf8bd 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressrule.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressrule.go @@ -53,7 +53,7 @@ type IngressRuleApplyConfiguration struct { // just traffic matching the host to the default backend or all traffic to the // default backend, is left to the controller fulfilling the Ingress. Http is // currently the only supported IngressRuleValue. - IngressRuleValueApplyConfiguration `json:",inline"` + IngressRuleValueApplyConfiguration `json:""` } // IngressRuleApplyConfiguration constructs a declarative configuration of the IngressRule type for use with diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressrulevalue.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressrulevalue.go index c1ca4853e2..198899ee68 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressrulevalue.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressrulevalue.go @@ -26,6 +26,7 @@ package v1 // mixing different types of rules in a single Ingress is disallowed, so exactly // one of the following must be set. type IngressRuleValueApplyConfiguration struct { + // http is a HTTP IngressRuleValue, which contains a list of http selectors HTTP *HTTPIngressRuleValueApplyConfiguration `json:"http,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ipaddress.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ipaddress.go index c0e4298aa3..8f73ecac7a 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ipaddress.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ipaddress.go @@ -38,8 +38,8 @@ import ( // Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1 // Invalid: 10.01.2.3 or 2001:db8:0:0:0::1 type IPAddressApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec is the desired state of the IPAddress. diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ipaddressspec.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ipaddressspec.go index e9dce93b64..30bb1dbea4 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ipaddressspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ipaddressspec.go @@ -23,7 +23,7 @@ package v1 // // IPAddressSpec describe the attributes in an IP Address. type IPAddressSpecApplyConfiguration struct { - // ParentRef references the resource that an IPAddress is attached to. + // parentRef references the resource that an IPAddress is attached to. // An IPAddress must reference a parent object. ParentRef *ParentReferenceApplyConfiguration `json:"parentRef,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicy.go index f3e1e1e5ed..be8b78720d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicy.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicy.go @@ -32,8 +32,8 @@ import ( // // NetworkPolicy describes what network traffic is allowed for a set of Pods type NetworkPolicyApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec represents the specification of the desired behavior for this NetworkPolicy. diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/parentreference.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/parentreference.go index c725e697b0..34756f07e2 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/parentreference.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/parentreference.go @@ -23,13 +23,13 @@ package v1 // // ParentReference describes a reference to a parent object. type ParentReferenceApplyConfiguration struct { - // Group is the group of the object being referenced. + // group is the group of the object being referenced. Group *string `json:"group,omitempty"` - // Resource is the resource of the object being referenced. + // resource is the resource of the object being referenced. Resource *string `json:"resource,omitempty"` - // Namespace is the namespace of the object being referenced. + // namespace is the namespace of the object being referenced. Namespace *string `json:"namespace,omitempty"` - // Name is the name of the object being referenced. + // name is the name of the object being referenced. Name *string `json:"name,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/servicecidr.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/servicecidr.go index 8eede13e36..158ca7f925 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/servicecidr.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/servicecidr.go @@ -33,8 +33,8 @@ import ( // ServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64). // This range is used to allocate ClusterIPs to Service objects. type ServiceCIDRApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec is the desired state of the ServiceCIDR. diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/servicecidrspec.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/servicecidrspec.go index 9372a162bd..0844008346 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1/servicecidrspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1/servicecidrspec.go @@ -23,7 +23,7 @@ package v1 // // ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services. type ServiceCIDRSpecApplyConfiguration struct { - // CIDRs defines the IP blocks in CIDR notation (e.g. "192.168.0.0/24" or "2001:db8::/64") + // cidrs defines the IP blocks in CIDR notation (e.g. "192.168.0.0/24" or "2001:db8::/64") // from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family. // This field is immutable. CIDRs []string `json:"cidrs,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingress.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingress.go index 061c29c992..d2144ed9bb 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingress.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingress.go @@ -35,8 +35,8 @@ import ( // externally-reachable urls, load balance traffic, terminate SSL, offer name // based virtual hosting etc. type IngressApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec is the desired state of the Ingress. diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressclass.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressclass.go index c4d6df50b4..30882d4ad5 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressclass.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressclass.go @@ -36,8 +36,8 @@ import ( // single IngressClass resource has this annotation set to true, new Ingress // resources without a class specified will be assigned this default class. type IngressClassApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec is the desired state of the IngressClass. diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressrule.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressrule.go index 6c8b973ed0..b84026d674 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressrule.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressrule.go @@ -53,7 +53,7 @@ type IngressRuleApplyConfiguration struct { // just traffic matching the host to the default backend or all traffic to the // default backend, is left to the controller fulfilling the Ingress. Http is // currently the only supported IngressRuleValue. - IngressRuleValueApplyConfiguration `json:",inline"` + IngressRuleValueApplyConfiguration `json:""` } // IngressRuleApplyConfiguration constructs a declarative configuration of the IngressRule type for use with diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressrulevalue.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressrulevalue.go index 502384fa3d..e215effaf0 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressrulevalue.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressrulevalue.go @@ -26,6 +26,7 @@ package v1beta1 // mixing different types of rules in a single Ingress is disallowed, so exactly // one of the following must be set. type IngressRuleValueApplyConfiguration struct { + // http is a HTTP IngressRuleValue, which contains a list of http selectors HTTP *HTTPIngressRuleValueApplyConfiguration `json:"http,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ipaddress.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ipaddress.go index 28167f1f4c..10919a97ae 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ipaddress.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ipaddress.go @@ -38,8 +38,8 @@ import ( // Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1 // Invalid: 10.01.2.3 or 2001:db8:0:0:0::1 type IPAddressApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec is the desired state of the IPAddress. diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ipaddressspec.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ipaddressspec.go index c0c012aaa6..7218076ba3 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ipaddressspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ipaddressspec.go @@ -23,7 +23,7 @@ package v1beta1 // // IPAddressSpec describe the attributes in an IP Address. type IPAddressSpecApplyConfiguration struct { - // ParentRef references the resource that an IPAddress is attached to. + // parentRef references the resource that an IPAddress is attached to. // An IPAddress must reference a parent object. ParentRef *ParentReferenceApplyConfiguration `json:"parentRef,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/parentreference.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/parentreference.go index edcc3b95d3..9acf5f7478 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/parentreference.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/parentreference.go @@ -23,13 +23,13 @@ package v1beta1 // // ParentReference describes a reference to a parent object. type ParentReferenceApplyConfiguration struct { - // Group is the group of the object being referenced. + // group is the group of the object being referenced. Group *string `json:"group,omitempty"` - // Resource is the resource of the object being referenced. + // resource is the resource of the object being referenced. Resource *string `json:"resource,omitempty"` - // Namespace is the namespace of the object being referenced. + // namespace is the namespace of the object being referenced. Namespace *string `json:"namespace,omitempty"` - // Name is the name of the object being referenced. + // name is the name of the object being referenced. Name *string `json:"name,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/servicecidr.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/servicecidr.go index 07281de616..68704740c9 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/servicecidr.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/servicecidr.go @@ -33,8 +33,8 @@ import ( // ServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64). // This range is used to allocate ClusterIPs to Service objects. type ServiceCIDRApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec is the desired state of the ServiceCIDR. diff --git a/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/servicecidrspec.go b/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/servicecidrspec.go index 7652700e2a..890dd1410f 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/servicecidrspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/servicecidrspec.go @@ -23,7 +23,7 @@ package v1beta1 // // ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services. type ServiceCIDRSpecApplyConfiguration struct { - // CIDRs defines the IP blocks in CIDR notation (e.g. "192.168.0.0/24" or "2001:db8::/64") + // cidrs defines the IP blocks in CIDR notation (e.g. "192.168.0.0/24" or "2001:db8::/64") // from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family. // This field is immutable. CIDRs []string `json:"cidrs,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/node/v1/runtimeclass.go b/vendor/k8s.io/client-go/applyconfigurations/node/v1/runtimeclass.go index 6b33701cab..3a05a98942 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/node/v1/runtimeclass.go +++ b/vendor/k8s.io/client-go/applyconfigurations/node/v1/runtimeclass.go @@ -38,7 +38,8 @@ import ( // pod. For more details, see // https://kubernetes.io/docs/concepts/containers/runtime-class/ type RuntimeClassApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // handler specifies the underlying runtime and configuration that the CRI diff --git a/vendor/k8s.io/client-go/applyconfigurations/node/v1alpha1/runtimeclass.go b/vendor/k8s.io/client-go/applyconfigurations/node/v1alpha1/runtimeclass.go index 5fbf9a649a..da0736e769 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/node/v1alpha1/runtimeclass.go +++ b/vendor/k8s.io/client-go/applyconfigurations/node/v1alpha1/runtimeclass.go @@ -38,7 +38,8 @@ import ( // pod. For more details, see // https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class type RuntimeClassApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec represents specification of the RuntimeClass diff --git a/vendor/k8s.io/client-go/applyconfigurations/node/v1beta1/runtimeclass.go b/vendor/k8s.io/client-go/applyconfigurations/node/v1beta1/runtimeclass.go index fc75967fc0..a7d34d2c90 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/node/v1beta1/runtimeclass.go +++ b/vendor/k8s.io/client-go/applyconfigurations/node/v1beta1/runtimeclass.go @@ -38,7 +38,8 @@ import ( // pod. For more details, see // https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class type RuntimeClassApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // handler specifies the underlying runtime and configuration that the CRI diff --git a/vendor/k8s.io/client-go/applyconfigurations/policy/v1/eviction.go b/vendor/k8s.io/client-go/applyconfigurations/policy/v1/eviction.go index bd944a5e8b..a229524661 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/policy/v1/eviction.go +++ b/vendor/k8s.io/client-go/applyconfigurations/policy/v1/eviction.go @@ -34,10 +34,10 @@ import ( // This is a subresource of Pod. A request to cause such an eviction is // created by POSTing to .../pods//evictions. type EvictionApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // ObjectMeta describes the pod that is being evicted. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata describes the pod that is being evicted. *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // DeleteOptions may be provided + // deleteOptions may be provided DeleteOptions *metav1.DeleteOptionsApplyConfiguration `json:"deleteOptions,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/policy/v1/poddisruptionbudget.go b/vendor/k8s.io/client-go/applyconfigurations/policy/v1/poddisruptionbudget.go index c9d4fd1a60..84f01bb1c7 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/policy/v1/poddisruptionbudget.go +++ b/vendor/k8s.io/client-go/applyconfigurations/policy/v1/poddisruptionbudget.go @@ -32,13 +32,13 @@ import ( // // PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods type PodDisruptionBudgetApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Specification of the desired behavior of the PodDisruptionBudget. + // spec is the specification of the desired behavior of the PodDisruptionBudget. Spec *PodDisruptionBudgetSpecApplyConfiguration `json:"spec,omitempty"` - // Most recently observed status of the PodDisruptionBudget. + // status is the most recently observed status of the PodDisruptionBudget. Status *PodDisruptionBudgetStatusApplyConfiguration `json:"status,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/policy/v1/poddisruptionbudgetspec.go b/vendor/k8s.io/client-go/applyconfigurations/policy/v1/poddisruptionbudgetspec.go index 0d2307332b..acc995b330 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/policy/v1/poddisruptionbudgetspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/policy/v1/poddisruptionbudgetspec.go @@ -29,22 +29,22 @@ import ( // // PodDisruptionBudgetSpec is a description of a PodDisruptionBudget. type PodDisruptionBudgetSpecApplyConfiguration struct { - // An eviction is allowed if at least "minAvailable" pods selected by + // minAvailable indicates that an eviction is allowed if at least "minAvailable" pods selected by // "selector" will still be available after the eviction, i.e. even in the // absence of the evicted pod. So for example you can prevent all voluntary // evictions by specifying "100%". MinAvailable *intstr.IntOrString `json:"minAvailable,omitempty"` - // Label query over pods whose evictions are managed by the disruption + // selector is a label query over pods whose evictions are managed by the disruption // budget. // A null selector will match no pods, while an empty ({}) selector will select // all pods within the namespace. Selector *metav1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` - // An eviction is allowed if at most "maxUnavailable" pods selected by + // maxUnavailable indicates that an eviction is allowed if at most "maxUnavailable" pods selected by // "selector" are unavailable after the eviction, i.e. even in absence of // the evicted pod. For example, one can prevent all voluntary evictions // by specifying 0. This is a mutually exclusive setting with "minAvailable". MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"` - // UnhealthyPodEvictionPolicy defines the criteria for when unhealthy pods + // unhealthyPodEvictionPolicy defines the criteria for when unhealthy pods // should be considered for eviction. Current implementation considers healthy pods, // as pods that have status.conditions item with type="Ready",status="True". // diff --git a/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/eviction.go b/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/eviction.go index eeadbbcb7d..333b0869fa 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/eviction.go +++ b/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/eviction.go @@ -34,10 +34,10 @@ import ( // This is a subresource of Pod. A request to cause such an eviction is // created by POSTing to .../pods//evictions. type EvictionApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // ObjectMeta describes the pod that is being evicted. + v1.TypeMetaApplyConfiguration `json:""` + // metadata describes the pod that is being evicted. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // DeleteOptions may be provided + // deleteOptions may be provided DeleteOptions *v1.DeleteOptionsApplyConfiguration `json:"deleteOptions,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/poddisruptionbudget.go b/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/poddisruptionbudget.go index ca2d839daa..54ee768948 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/poddisruptionbudget.go +++ b/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/poddisruptionbudget.go @@ -32,13 +32,13 @@ import ( // // PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods type PodDisruptionBudgetApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Specification of the desired behavior of the PodDisruptionBudget. + // spec is the specification of the desired behavior of the PodDisruptionBudget. Spec *PodDisruptionBudgetSpecApplyConfiguration `json:"spec,omitempty"` - // Most recently observed status of the PodDisruptionBudget. + // status is the most recently observed status of the PodDisruptionBudget. Status *PodDisruptionBudgetStatusApplyConfiguration `json:"status,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/poddisruptionbudgetspec.go b/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/poddisruptionbudgetspec.go index 1fe247b489..28914430f3 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/poddisruptionbudgetspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/poddisruptionbudgetspec.go @@ -29,23 +29,23 @@ import ( // // PodDisruptionBudgetSpec is a description of a PodDisruptionBudget. type PodDisruptionBudgetSpecApplyConfiguration struct { - // An eviction is allowed if at least "minAvailable" pods selected by + // minAvailable indicates that an eviction is allowed if at least "minAvailable" pods selected by // "selector" will still be available after the eviction, i.e. even in the // absence of the evicted pod. So for example you can prevent all voluntary // evictions by specifying "100%". MinAvailable *intstr.IntOrString `json:"minAvailable,omitempty"` - // Label query over pods whose evictions are managed by the disruption + // selector is a label query over pods whose evictions are managed by the disruption // budget. // A null selector selects no pods. // An empty selector ({}) also selects no pods, which differs from standard behavior of selecting all pods. // In policy/v1, an empty selector will select all pods in the namespace. Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` - // An eviction is allowed if at most "maxUnavailable" pods selected by + // maxUnavailable indicates that an eviction is allowed if at most "maxUnavailable" pods selected by // "selector" are unavailable after the eviction, i.e. even in absence of // the evicted pod. For example, one can prevent all voluntary evictions // by specifying 0. This is a mutually exclusive setting with "minAvailable". MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"` - // UnhealthyPodEvictionPolicy defines the criteria for when unhealthy pods + // unhealthyPodEvictionPolicy defines the criteria for when unhealthy pods // should be considered for eviction. Current implementation considers healthy pods, // as pods that have status.conditions item with type="Ready",status="True". // diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/aggregationrule.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/aggregationrule.go index 6f44e79795..572b477410 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/aggregationrule.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/aggregationrule.go @@ -27,7 +27,7 @@ import ( // // AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole type AggregationRuleApplyConfiguration struct { - // ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. + // clusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. // If any of the selectors match, then the ClusterRole's permissions will be added ClusterRoleSelectors []metav1.LabelSelectorApplyConfiguration `json:"clusterRoleSelectors,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/clusterrole.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/clusterrole.go index d65387e249..2f8395cf21 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/clusterrole.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/clusterrole.go @@ -32,12 +32,12 @@ import ( // // ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. type ClusterRoleApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object's metadata. *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Rules holds all the PolicyRules for this ClusterRole + // rules holds all the PolicyRules for this ClusterRole Rules []PolicyRuleApplyConfiguration `json:"rules,omitempty"` - // AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. + // aggregationRule is an optional field that describes how to build the Rules for this ClusterRole. // If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be // stomped by the controller. AggregationRule *AggregationRuleApplyConfiguration `json:"aggregationRule,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/clusterrolebinding.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/clusterrolebinding.go index 13d3d0201f..f4327511cc 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/clusterrolebinding.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/clusterrolebinding.go @@ -33,12 +33,12 @@ import ( // ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace, // and adds who information via Subject. type ClusterRoleBindingApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object's metadata. *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Subjects holds references to the objects the role applies to. + // subjects holds references to the objects the role applies to. Subjects []SubjectApplyConfiguration `json:"subjects,omitempty"` - // RoleRef can only reference a ClusterRole in the global namespace. + // roleRef can only reference a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. // This field is immutable. RoleRef *RoleRefApplyConfiguration `json:"roleRef,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/policyrule.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/policyrule.go index 03556b01c4..9685f7b278 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/policyrule.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/policyrule.go @@ -28,16 +28,16 @@ package v1 // PolicyRule holds information that describes a policy rule, but does not contain information // about who the rule applies to or which namespace the rule applies to. type PolicyRuleApplyConfiguration struct { - // Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. + // verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. Verbs []string `json:"verbs,omitempty"` - // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of + // apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of // the enumerated resources in any API group will be allowed. "" represents the core API group and "*" represents all API groups. APIGroups []string `json:"apiGroups,omitempty"` - // Resources is a list of resources this rule applies to. '*' represents all resources. + // resources is a list of resources this rule applies to. '*' represents all resources. Resources []string `json:"resources,omitempty"` - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. ResourceNames []string `json:"resourceNames,omitempty"` - // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path + // nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path // Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. // Rules can either apply to API resources (such as "pods" or "secrets") or non-resource URL paths (such as "/api"), but not both. NonResourceURLs []string `json:"nonResourceURLs,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/role.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/role.go index 9e2895b1a8..fee603dff6 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/role.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/role.go @@ -32,10 +32,10 @@ import ( // // Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. type RoleApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object's metadata. *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Rules holds all the PolicyRules for this Role + // rules holds all the PolicyRules for this Role Rules []PolicyRuleApplyConfiguration `json:"rules,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/rolebinding.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/rolebinding.go index 776fb3ed30..994779c8c9 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/rolebinding.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/rolebinding.go @@ -34,12 +34,12 @@ import ( // It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given // namespace only have effect in that namespace. type RoleBindingApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object's metadata. *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Subjects holds references to the objects the role applies to. + // subjects holds references to the objects the role applies to. Subjects []SubjectApplyConfiguration `json:"subjects,omitempty"` - // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. + // roleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. // This field is immutable. RoleRef *RoleRefApplyConfiguration `json:"roleRef,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/roleref.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/roleref.go index 231fe0dd49..1df91726d1 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/roleref.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/roleref.go @@ -23,11 +23,11 @@ package v1 // // RoleRef contains information that points to the role being used type RoleRefApplyConfiguration struct { - // APIGroup is the group for the resource being referenced + // apiGroup is the group for the resource being referenced APIGroup *string `json:"apiGroup,omitempty"` - // Kind is the type of resource being referenced + // kind is the type of resource being referenced Kind *string `json:"kind,omitempty"` - // Name is the name of resource being referenced + // name is the name of resource being referenced Name *string `json:"name,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/subject.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/subject.go index 1914086c0f..1432b410a5 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/subject.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/subject.go @@ -24,16 +24,16 @@ package v1 // Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, // or a value for non-objects such as user and group names. type SubjectApplyConfiguration struct { - // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". + // kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". // If the Authorizer does not recognized the kind value, the Authorizer should report an error. Kind *string `json:"kind,omitempty"` - // APIGroup holds the API group of the referenced subject. + // apiGroup holds the API group of the referenced subject. // Defaults to "" for ServiceAccount subjects. // Defaults to "rbac.authorization.k8s.io" for User and Group subjects. APIGroup *string `json:"apiGroup,omitempty"` - // Name of the object being referenced. + // name of the object being referenced. Name *string `json:"name,omitempty"` - // Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty + // namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty // the Authorizer should report an error. Namespace *string `json:"namespace,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/aggregationrule.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/aggregationrule.go index 397d14a1ac..169cf984d7 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/aggregationrule.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/aggregationrule.go @@ -27,7 +27,7 @@ import ( // // AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole type AggregationRuleApplyConfiguration struct { - // ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. + // clusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. // If any of the selectors match, then the ClusterRole's permissions will be added ClusterRoleSelectors []v1.LabelSelectorApplyConfiguration `json:"clusterRoleSelectors,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/clusterrole.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/clusterrole.go index 678761e6a0..5cc806dea1 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/clusterrole.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/clusterrole.go @@ -33,12 +33,12 @@ import ( // ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRole, and will no longer be served in v1.22. type ClusterRoleApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object's metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Rules holds all the PolicyRules for this ClusterRole + // rules holds all the PolicyRules for this ClusterRole Rules []PolicyRuleApplyConfiguration `json:"rules,omitempty"` - // AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. + // aggregationRule is an optional field that describes how to build the Rules for this ClusterRole. // If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be // stomped by the controller. AggregationRule *AggregationRuleApplyConfiguration `json:"aggregationRule,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/clusterrolebinding.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/clusterrolebinding.go index f4ee74f18f..fcfe3709ed 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/clusterrolebinding.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/clusterrolebinding.go @@ -34,12 +34,12 @@ import ( // and adds who information via Subject. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRoleBinding, and will no longer be served in v1.22. type ClusterRoleBindingApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object's metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Subjects holds references to the objects the role applies to. + // subjects holds references to the objects the role applies to. Subjects []SubjectApplyConfiguration `json:"subjects,omitempty"` - // RoleRef can only reference a ClusterRole in the global namespace. + // roleRef can only reference a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. RoleRef *RoleRefApplyConfiguration `json:"roleRef,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/policyrule.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/policyrule.go index f4a6d3fff7..7c4e9cca1b 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/policyrule.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/policyrule.go @@ -28,16 +28,16 @@ package v1alpha1 // PolicyRule holds information that describes a policy rule, but does not contain information // about who the rule applies to or which namespace the rule applies to. type PolicyRuleApplyConfiguration struct { - // Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. + // verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. Verbs []string `json:"verbs,omitempty"` - // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of + // apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of // the enumerated resources in any API group will be allowed. "" represents the core API group and "*" represents all API groups. APIGroups []string `json:"apiGroups,omitempty"` - // Resources is a list of resources this rule applies to. '*' represents all resources. + // resources is a list of resources this rule applies to. '*' represents all resources. Resources []string `json:"resources,omitempty"` - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. ResourceNames []string `json:"resourceNames,omitempty"` - // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path + // nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path // Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. // Rules can either apply to API resources (such as "pods" or "secrets") or non-resource URL paths (such as "/api"), but not both. NonResourceURLs []string `json:"nonResourceURLs,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/role.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/role.go index 19b123b2d2..b2f8ca8b2c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/role.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/role.go @@ -33,10 +33,10 @@ import ( // Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 Role, and will no longer be served in v1.22. type RoleApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object's metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Rules holds all the PolicyRules for this Role + // rules holds all the PolicyRules for this Role Rules []PolicyRuleApplyConfiguration `json:"rules,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/rolebinding.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/rolebinding.go index 116f293765..b836c08a5e 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/rolebinding.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/rolebinding.go @@ -35,12 +35,12 @@ import ( // namespace only have effect in that namespace. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 RoleBinding, and will no longer be served in v1.22. type RoleBindingApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object's metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Subjects holds references to the objects the role applies to. + // subjects holds references to the objects the role applies to. Subjects []SubjectApplyConfiguration `json:"subjects,omitempty"` - // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. + // roleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. RoleRef *RoleRefApplyConfiguration `json:"roleRef,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/roleref.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/roleref.go index a02a36be89..25aab93791 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/roleref.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/roleref.go @@ -23,11 +23,11 @@ package v1alpha1 // // RoleRef contains information that points to the role being used type RoleRefApplyConfiguration struct { - // APIGroup is the group for the resource being referenced + // apiGroup is the group for the resource being referenced APIGroup *string `json:"apiGroup,omitempty"` - // Kind is the type of resource being referenced + // kind is the type of resource being referenced Kind *string `json:"kind,omitempty"` - // Name is the name of resource being referenced + // name is the name of resource being referenced Name *string `json:"name,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/subject.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/subject.go index d24f865d4e..51a5b4d4b4 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/subject.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/subject.go @@ -24,16 +24,16 @@ package v1alpha1 // Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, // or a value for non-objects such as user and group names. type SubjectApplyConfiguration struct { - // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". + // kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". // If the Authorizer does not recognized the kind value, the Authorizer should report an error. Kind *string `json:"kind,omitempty"` - // APIVersion holds the API group and version of the referenced subject. + // apiVersion holds the API group and version of the referenced subject. // Defaults to "v1" for ServiceAccount subjects. // Defaults to "rbac.authorization.k8s.io/v1alpha1" for User and Group subjects. APIVersion *string `json:"apiVersion,omitempty"` - // Name of the object being referenced. + // name of the object being referenced. Name *string `json:"name,omitempty"` - // Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty + // namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty // the Authorizer should report an error. Namespace *string `json:"namespace,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/aggregationrule.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/aggregationrule.go index b4c6bd5aed..8064db4dd5 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/aggregationrule.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/aggregationrule.go @@ -27,7 +27,7 @@ import ( // // AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole type AggregationRuleApplyConfiguration struct { - // ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. + // clusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. // If any of the selectors match, then the ClusterRole's permissions will be added ClusterRoleSelectors []v1.LabelSelectorApplyConfiguration `json:"clusterRoleSelectors,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/clusterrole.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/clusterrole.go index a105df5f0d..dacb3b17b9 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/clusterrole.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/clusterrole.go @@ -33,12 +33,12 @@ import ( // ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRole, and will no longer be served in v1.22. type ClusterRoleApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object's metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Rules holds all the PolicyRules for this ClusterRole + // rules holds all the PolicyRules for this ClusterRole Rules []PolicyRuleApplyConfiguration `json:"rules,omitempty"` - // AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. + // aggregationRule is an optional field that describes how to build the Rules for this ClusterRole. // If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be // stomped by the controller. AggregationRule *AggregationRuleApplyConfiguration `json:"aggregationRule,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/clusterrolebinding.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/clusterrolebinding.go index c519c6e078..0b400e124d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/clusterrolebinding.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/clusterrolebinding.go @@ -34,12 +34,12 @@ import ( // and adds who information via Subject. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 ClusterRoleBinding, and will no longer be served in v1.22. type ClusterRoleBindingApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object's metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Subjects holds references to the objects the role applies to. + // subjects holds references to the objects the role applies to. Subjects []SubjectApplyConfiguration `json:"subjects,omitempty"` - // RoleRef can only reference a ClusterRole in the global namespace. + // roleRef can only reference a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. RoleRef *RoleRefApplyConfiguration `json:"roleRef,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/policyrule.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/policyrule.go index bf3a5a5086..c5cf6a8fcf 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/policyrule.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/policyrule.go @@ -28,17 +28,17 @@ package v1beta1 // PolicyRule holds information that describes a policy rule, but does not contain information // about who the rule applies to or which namespace the rule applies to. type PolicyRuleApplyConfiguration struct { - // Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. + // verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. Verbs []string `json:"verbs,omitempty"` - // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of + // apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of // the enumerated resources in any API group will be allowed. "" represents the core API group and "*" represents all API groups. APIGroups []string `json:"apiGroups,omitempty"` - // Resources is a list of resources this rule applies to. '*' represents all resources in the specified apiGroups. + // resources is a list of resources this rule applies to. '*' represents all resources in the specified apiGroups. // '*/foo' represents the subresource 'foo' for all resources in the specified apiGroups. Resources []string `json:"resources,omitempty"` - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. ResourceNames []string `json:"resourceNames,omitempty"` - // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path + // nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path // Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. // Rules can either apply to API resources (such as "pods" or "secrets") or non-resource URL paths (such as "/api"), but not both. NonResourceURLs []string `json:"nonResourceURLs,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/role.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/role.go index d0a4c20c68..df72d643b3 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/role.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/role.go @@ -33,10 +33,10 @@ import ( // Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 Role, and will no longer be served in v1.22. type RoleApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object's metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Rules holds all the PolicyRules for this Role + // rules holds all the PolicyRules for this Role Rules []PolicyRuleApplyConfiguration `json:"rules,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/rolebinding.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/rolebinding.go index 64669c1033..f851aab7b7 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/rolebinding.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/rolebinding.go @@ -35,12 +35,12 @@ import ( // namespace only have effect in that namespace. // Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 RoleBinding, and will no longer be served in v1.22. type RoleBindingApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object's metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Subjects holds references to the objects the role applies to. + // subjects holds references to the objects the role applies to. Subjects []SubjectApplyConfiguration `json:"subjects,omitempty"` - // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. + // roleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. RoleRef *RoleRefApplyConfiguration `json:"roleRef,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/roleref.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/roleref.go index 350930af7a..63d1c40c1d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/roleref.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/roleref.go @@ -23,11 +23,11 @@ package v1beta1 // // RoleRef contains information that points to the role being used type RoleRefApplyConfiguration struct { - // APIGroup is the group for the resource being referenced + // apiGroup is the group for the resource being referenced APIGroup *string `json:"apiGroup,omitempty"` - // Kind is the type of resource being referenced + // kind is the type of resource being referenced Kind *string `json:"kind,omitempty"` - // Name is the name of resource being referenced + // name is the name of resource being referenced Name *string `json:"name,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/subject.go b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/subject.go index 8abbaa9fb3..083c8a1a2d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/subject.go +++ b/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/subject.go @@ -24,16 +24,16 @@ package v1beta1 // Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, // or a value for non-objects such as user and group names. type SubjectApplyConfiguration struct { - // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". + // kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". // If the Authorizer does not recognized the kind value, the Authorizer should report an error. Kind *string `json:"kind,omitempty"` - // APIGroup holds the API group of the referenced subject. + // apiGroup holds the API group of the referenced subject. // Defaults to "" for ServiceAccount subjects. // Defaults to "rbac.authorization.k8s.io" for User and Group subjects. APIGroup *string `json:"apiGroup,omitempty"` - // Name of the object being referenced. + // name of the object being referenced. Name *string `json:"name,omitempty"` - // Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty + // namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty // the Authorizer should report an error. Namespace *string `json:"namespace,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/capacityrequestpolicyrange.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/capacityrequestpolicyrange.go index b3bade6113..057b1dfd13 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/capacityrequestpolicyrange.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/capacityrequestpolicyrange.go @@ -27,6 +27,13 @@ import ( // // CapacityRequestPolicyRange defines a valid range for consumable capacity values. // +// If the DRAFractionalCapacityRange feature gate is +// enabled and at least one of Min, Max, or Step is a fractional quantity (i.e. +// its value is not an integer), milli-unit arithmetic is used instead, +// supporting values with up to 3 decimal places (e.g. 100m = 0.1). +// The largest supported value then is 1000 times smaller compared to using 64-bit integers. +// Otherwise, all comparisons use 64-bit integer arithmetic via resource.Quantity.Value(). +// // - If the requested amount is less than Min, it is rounded up to the Min value. // - If Step is set and the requested amount is between Min and Max but not aligned with Step, // it will be rounded up to the next value equal to Min + (n * Step). diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/celdeviceselector.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/celdeviceselector.go index 15ec20da40..d5ca19905d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/celdeviceselector.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/celdeviceselector.go @@ -33,7 +33,7 @@ type CELDeviceSelectorApplyConfiguration struct { // - driver (string): the name of the driver which defines this device. // - attributes (map[string]object): the device's attributes, grouped by prefix // (e.g. device.attributes["dra.example.com"] evaluates to an object with all - // of the attributes which were prefixed by "dra.example.com". + // of the attributes which were prefixed by "dra.example.com"). // - capacity (map[string]object): the device's capacities, grouped by prefix. // - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device // (v1.34+ with the DRAConsumableCapacity feature enabled). @@ -66,6 +66,15 @@ type CELDeviceSelectorApplyConfiguration struct { // A robust expression should check for the existence of attributes // before referencing them. // + // Common errors: + // - "no such key": Use optional chaining (.? followed by orValue()) + // or guarding the check with has() for optional fields. + // See CEL Optional Types for details: + // https://pkg.go.dev/github.com/google/cel-go@v0.17.4/cel#OptionalTypes + // + // For more CEL expression syntax and examples, see: + // https://kubernetes.io/docs/reference/using-api/cel/ + // // For ease of use, the cel.bind() function is enabled, and can be used // to simplify expressions that access multiple attributes with the // same domain. For example: diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/device.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/device.go index f19b9000cd..4ebb005fd7 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/device.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/device.go @@ -114,7 +114,7 @@ type DeviceApplyConfiguration struct { // If AllowMultipleAllocations is set to true, the device can be allocated more than once, // and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not. AllowMultipleAllocations *bool `json:"allowMultipleAllocations,omitempty"` - // NodeAllocatableResourceMappings defines the mapping of node resources + // NodeAllocatableResources defines the mapping of node resources // that are managed by the DRA driver exposing this device. This includes resources currently // reported in v1.Node `status.allocatable` that are not extended resources // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). @@ -125,7 +125,7 @@ type DeviceApplyConfiguration struct { // dependencies of an accelerator device. // The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). // Extended resource names are not permitted as keys. - NodeAllocatableResourceMappings map[apicorev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration `json:"nodeAllocatableResourceMappings,omitempty"` + NodeAllocatableResources map[apicorev1.ResourceName]NodeAllocatableResourceApplyConfiguration `json:"nodeAllocatableResources,omitempty"` } // DeviceApplyConfiguration constructs a declarative configuration of the Device type for use with @@ -256,16 +256,16 @@ func (b *DeviceApplyConfiguration) WithAllowMultipleAllocations(value bool) *Dev return b } -// WithNodeAllocatableResourceMappings puts the entries into the NodeAllocatableResourceMappings field in the declarative configuration +// WithNodeAllocatableResources puts the entries into the NodeAllocatableResources 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 NodeAllocatableResourceMappings field, -// overwriting an existing map entries in NodeAllocatableResourceMappings field with the same key. -func (b *DeviceApplyConfiguration) WithNodeAllocatableResourceMappings(entries map[apicorev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration) *DeviceApplyConfiguration { - if b.NodeAllocatableResourceMappings == nil && len(entries) > 0 { - b.NodeAllocatableResourceMappings = make(map[apicorev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration, len(entries)) +// If called multiple times, the entries provided by each call will be put on the NodeAllocatableResources field, +// overwriting an existing map entries in NodeAllocatableResources field with the same key. +func (b *DeviceApplyConfiguration) WithNodeAllocatableResources(entries map[apicorev1.ResourceName]NodeAllocatableResourceApplyConfiguration) *DeviceApplyConfiguration { + if b.NodeAllocatableResources == nil && len(entries) > 0 { + b.NodeAllocatableResources = make(map[apicorev1.ResourceName]NodeAllocatableResourceApplyConfiguration, len(entries)) } for k, v := range entries { - b.NodeAllocatableResourceMappings[k] = v + b.NodeAllocatableResources[k] = v } return b } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceallocationconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceallocationconfiguration.go index 29e1ba427a..2cfca606d2 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceallocationconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceallocationconfiguration.go @@ -38,7 +38,7 @@ type DeviceAllocationConfigurationApplyConfiguration struct { // and may include the subrequest using the format
[/]. If just // the main request is given, the configuration applies to all subrequests. Requests []string `json:"requests,omitempty"` - DeviceConfigurationApplyConfiguration `json:",inline"` + DeviceConfigurationApplyConfiguration `json:""` } // DeviceAllocationConfigurationApplyConfiguration constructs a declarative configuration of the DeviceAllocationConfiguration type for use with diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclaimconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclaimconfiguration.go index 402cd877c9..2da8207609 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclaimconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclaimconfiguration.go @@ -30,7 +30,7 @@ type DeviceClaimConfigurationApplyConfiguration struct { // and may include the subrequest using the format
[/]. If just // the main request is given, the configuration applies to all subrequests. Requests []string `json:"requests,omitempty"` - DeviceConfigurationApplyConfiguration `json:",inline"` + DeviceConfigurationApplyConfiguration `json:""` } // DeviceClaimConfigurationApplyConfiguration constructs a declarative configuration of the DeviceClaimConfiguration type for use with diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclass.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclass.go index 478f90bb04..49d6d7258d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclass.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclass.go @@ -35,7 +35,7 @@ import ( // the device requests of a claim to apply these presets. // Cluster scoped. type DeviceClassApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Spec defines what can be allocated and how to configure it. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclassconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclassconfiguration.go index c47fd9f85c..062cde2ab8 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclassconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclassconfiguration.go @@ -23,7 +23,7 @@ package v1 // // DeviceClassConfiguration is used in DeviceClass. type DeviceClassConfigurationApplyConfiguration struct { - DeviceConfigurationApplyConfiguration `json:",inline"` + DeviceConfigurationApplyConfiguration `json:""` } // DeviceClassConfigurationApplyConfiguration constructs a declarative configuration of the DeviceClassConfiguration type for use with diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclassspec.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclassspec.go index a6a3992c92..5e7d736199 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclassspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclassspec.go @@ -40,8 +40,6 @@ type DeviceClassSpecApplyConfiguration struct { // is picked to satisfy a pod's extended resource requests. // If two classes are created at the same time, then the name of the class // lexicographically sorted first is picked. - // - // This is a beta field. ExtendedResourceName *string `json:"extendedResourceName,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicecounterconsumption.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicecounterconsumption.go index 9bcd936db2..939894bea7 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicecounterconsumption.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicecounterconsumption.go @@ -31,6 +31,26 @@ type DeviceCounterConsumptionApplyConfiguration struct { // // The maximum number of counters is 32. Counters map[string]CounterApplyConfiguration `json:"counters,omitempty"` + // CompatibilityGroups is a list of opaque group names for + // this counter set consumption. + // + // Devices that consume counters from the same counter set may only be + // allocated at the same time ("co-allocated") if they all share at least + // one common group: the intersection of the CompatibilityGroups of all + // co-allocated devices on that counter set must be non-empty. Devices + // that consume from different counter sets are never compared via this + // field. + // + // An unset field, an explicit nil, and an empty list are equivalent and + // mean "no groups": such a device is only co-allocatable with sibling + // devices on the same counter set that also have no groups, and is never + // co-allocatable with a device that declares one or more groups. + // + // Group names are opaque and meaningful only within the + // publishing driver's pool. + // + // The maximum number of groups is 2, and the names must be unique. + CompatibilityGroups []string `json:"compatibilityGroups,omitempty"` } // DeviceCounterConsumptionApplyConfiguration constructs a declarative configuration of the DeviceCounterConsumption type for use with @@ -60,3 +80,13 @@ func (b *DeviceCounterConsumptionApplyConfiguration) WithCounters(entries map[st } return b } + +// WithCompatibilityGroups adds the given value to the CompatibilityGroups 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 CompatibilityGroups field. +func (b *DeviceCounterConsumptionApplyConfiguration) WithCompatibilityGroups(values ...string) *DeviceCounterConsumptionApplyConfiguration { + for i := range values { + b.CompatibilityGroups = append(b.CompatibilityGroups, values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicederivedattribute.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicederivedattribute.go new file mode 100644 index 0000000000..9283a257d6 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicederivedattribute.go @@ -0,0 +1,95 @@ +/* +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 ( + resourcev1 "k8s.io/api/resource/v1" +) + +// DeviceDerivedAttributeApplyConfiguration represents a declarative configuration of the DeviceDerivedAttribute type for use +// with apply. +// +// DeviceDerivedAttribute defines a derived attribute computed via CEL. +type DeviceDerivedAttributeApplyConfiguration struct { + // Name is the identifier for this derived attribute, used in constraints. + // + // It must be a DNS subdomain followed by a slash ("/") followed by a C identifier + // (e.g. "example.com/numaNode" or "derived/numaNode"). + // + // If the chosen name matches an existing physical attribute from a driver, + // the derived attribute's expression will shadow the physical attribute, + // and its evaluated value will be used in constraints instead. When the goal + // is to define a derived attribute that is only used within the ResourceClaim + // and not meant to shadow an existing attribute, use a domain prefix that + // no DRA driver should be using (e.g. "derived/myAttribute"). + // + // It is not valid to define a derived attribute that isn't used in at least + // one constraint. + Name *resourcev1.FullyQualifiedName `json:"name,omitempty"` + // Expression is a CEL expression evaluated against each candidate device. + // The expression must evaluate to a primitive scalar (string, integer, + // boolean, or semver) or a list of these scalars ([]string, []int64, + // []bool, []semver) to act as a virtual grouping key. Any other return type + // is an error and causes CEL evaluation for the device to fail. + // + // The expression's input is an object named "device", which carries the + // same properties as in a CELDeviceSelector. + // + // When pod scheduling encounters CEL runtime errors (such as looking + // up an attribute that isn't defined) for some devices, it will abort + // allocation and fail scheduling for the Pod. Surfacing evaluation + // errors immediately prevents silent topology matching failures that are + // extremely hard to detect. A robust expression should, for example, check + // for the existence of attributes before referencing them to avoid + // runtime evaluation errors. + // + // The expression gets evaluated after a device has passed the other + // selector expressions for the request in which this expression is used. + // This allows writing expressions that are tailored towards the specific + // devices being requested (for example, by assuming the device is from a + // certain vendor and skipping those checks). + // + // The length of the expression must be smaller or equal to 10 Ki. The + // cost of evaluating it is also limited based on the estimated number + // of logical steps; the combined cost of all derived attributes in a + // claim is capped by a shared CEL cost budget. + Expression *string `json:"expression,omitempty"` +} + +// DeviceDerivedAttributeApplyConfiguration constructs a declarative configuration of the DeviceDerivedAttribute type for use with +// apply. +func DeviceDerivedAttribute() *DeviceDerivedAttributeApplyConfiguration { + return &DeviceDerivedAttributeApplyConfiguration{} +} + +// 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 *DeviceDerivedAttributeApplyConfiguration) WithName(value resourcev1.FullyQualifiedName) *DeviceDerivedAttributeApplyConfiguration { + b.Name = &value + return b +} + +// WithExpression sets the Expression 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 Expression field is set to the value of the last call. +func (b *DeviceDerivedAttributeApplyConfiguration) WithExpression(value string) *DeviceDerivedAttributeApplyConfiguration { + b.Expression = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicerequestallocationresult.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicerequestallocationresult.go index 592a641756..a32440eaca 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicerequestallocationresult.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicerequestallocationresult.go @@ -94,6 +94,12 @@ type DeviceRequestAllocationResultApplyConfiguration struct { // This field is populated only for devices that allow multiple allocations. // All capacity entries are included, even if the consumed amount is zero. ConsumedCapacity map[resourcev1.QualifiedName]resource.Quantity `json:"consumedCapacity,omitempty"` + // SkipNodeOperations lists node-local resource operations (gRPC calls) + // that will be skipped for this allocated device when determining whether + // operations are necessary on the node. If all allocated devices for a driver in + // a claim skip an operation, that gRPC call will be skipped. It is a copy of + // the ResourceSlice.spec.skipNodeOperations value at the time when the device was allocated. + SkipNodeOperations []resourcev1.SkipNodeOperation `json:"skipNodeOperations,omitempty"` } // DeviceRequestAllocationResultApplyConfiguration constructs a declarative configuration of the DeviceRequestAllocationResult type for use with @@ -196,3 +202,13 @@ func (b *DeviceRequestAllocationResultApplyConfiguration) WithConsumedCapacity(e } return b } + +// WithSkipNodeOperations adds the given value to the SkipNodeOperations 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 SkipNodeOperations field. +func (b *DeviceRequestAllocationResultApplyConfiguration) WithSkipNodeOperations(values ...resourcev1.SkipNodeOperation) *DeviceRequestAllocationResultApplyConfiguration { + for i := range values { + b.SkipNodeOperations = append(b.SkipNodeOperations, values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicesubrequest.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicesubrequest.go index d554522fa1..74a7e96124 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicesubrequest.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicesubrequest.go @@ -109,6 +109,27 @@ type DeviceSubRequestApplyConfiguration struct { // the request fails if there are devices that otherwise match the request, // and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request. Capacity *CapacityRequirementsApplyConfiguration `json:"capacity,omitempty"` + // DerivedAttributes defines a set of virtual attributes computed via CEL expressions + // for each candidate device. These virtual attributes can be referenced in + // `.devices.constraints` to align and match different devices (e.g., co-allocating + // a GPU and a NIC on the same NUMA node) even if their drivers publish different + // attributes. Derived attributes are not available via `device.attributes` + // in the CEL environment when evaluating selector expressions. + // + // Derived attributes allow you to extract, transform, or normalize topology + // information (such as extracting a NUMA index from a complex topology string or + // renaming a vendor-specific attribute) into a common virtual attribute name at + // scheduling time. The scheduler then evaluates these virtual attributes exactly + // like static attributes when matching constraints. + // + // Every derived attribute defined in this list must be referenced by at least one + // MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + // + // The maximum number of derived attributes is 32. + // + // This is an alpha field and requires enabling the DRADerivedAttributes + // feature gate. + DerivedAttributes []DeviceDerivedAttributeApplyConfiguration `json:"derivedAttributes,omitempty"` } // DeviceSubRequestApplyConfiguration constructs a declarative configuration of the DeviceSubRequest type for use with @@ -182,3 +203,16 @@ func (b *DeviceSubRequestApplyConfiguration) WithCapacity(value *CapacityRequire b.Capacity = value return b } + +// WithDerivedAttributes adds the given value to the DerivedAttributes 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 DerivedAttributes field. +func (b *DeviceSubRequestApplyConfiguration) WithDerivedAttributes(values ...*DeviceDerivedAttributeApplyConfiguration) *DeviceSubRequestApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithDerivedAttributes") + } + b.DerivedAttributes = append(b.DerivedAttributes, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicetaintrule.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicetaintrule.go new file mode 100644 index 0000000000..e97d4855e6 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicetaintrule.go @@ -0,0 +1,294 @@ +/* +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 ( + resourcev1 "k8s.io/api/resource/v1" + apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + internal "k8s.io/client-go/applyconfigurations/internal" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// DeviceTaintRuleApplyConfiguration represents a declarative configuration of the DeviceTaintRule type for use +// with apply. +// +// DeviceTaintRule adds one taint to all devices which match the selector. +// This has the same effect as if the taint was specified directly +// in the ResourceSlice by the DRA driver. +type DeviceTaintRuleApplyConfiguration struct { + metav1.TypeMetaApplyConfiguration `json:""` + // Standard object metadata + *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // Spec specifies the selector and one taint. + // + // Changing the spec automatically increments the metadata.generation number. + Spec *DeviceTaintRuleSpecApplyConfiguration `json:"spec,omitempty"` + // Status provides information about what was requested in the spec. + Status *DeviceTaintRuleStatusApplyConfiguration `json:"status,omitempty"` +} + +// DeviceTaintRule constructs a declarative configuration of the DeviceTaintRule type for use with +// apply. +func DeviceTaintRule(name string) *DeviceTaintRuleApplyConfiguration { + b := &DeviceTaintRuleApplyConfiguration{} + b.WithName(name) + b.WithKind("DeviceTaintRule") + b.WithAPIVersion("resource.k8s.io/v1") + return b +} + +// ExtractDeviceTaintRuleFrom extracts the applied configuration owned by fieldManager from +// deviceTaintRule for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// deviceTaintRule must be a unmodified DeviceTaintRule API object that was retrieved from the Kubernetes API. +// ExtractDeviceTaintRuleFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractDeviceTaintRuleFrom(deviceTaintRule *resourcev1.DeviceTaintRule, fieldManager string, subresource string) (*DeviceTaintRuleApplyConfiguration, error) { + b := &DeviceTaintRuleApplyConfiguration{} + err := managedfields.ExtractInto(deviceTaintRule, internal.Parser().Type("io.k8s.api.resource.v1.DeviceTaintRule"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(deviceTaintRule.Name) + + b.WithKind("DeviceTaintRule") + b.WithAPIVersion("resource.k8s.io/v1") + return b, nil +} + +// ExtractDeviceTaintRule extracts the applied configuration owned by fieldManager from +// deviceTaintRule. If no managedFields are found in deviceTaintRule for fieldManager, a +// DeviceTaintRuleApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// deviceTaintRule must be a unmodified DeviceTaintRule API object that was retrieved from the Kubernetes API. +// ExtractDeviceTaintRule provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractDeviceTaintRule(deviceTaintRule *resourcev1.DeviceTaintRule, fieldManager string) (*DeviceTaintRuleApplyConfiguration, error) { + return ExtractDeviceTaintRuleFrom(deviceTaintRule, fieldManager, "") +} + +// ExtractDeviceTaintRuleStatus extracts the applied configuration owned by fieldManager from +// deviceTaintRule for the status subresource. +func ExtractDeviceTaintRuleStatus(deviceTaintRule *resourcev1.DeviceTaintRule, fieldManager string) (*DeviceTaintRuleApplyConfiguration, error) { + return ExtractDeviceTaintRuleFrom(deviceTaintRule, fieldManager, "status") +} + +func (b DeviceTaintRuleApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind 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 Kind field is set to the value of the last call. +func (b *DeviceTaintRuleApplyConfiguration) WithKind(value string) *DeviceTaintRuleApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion 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 APIVersion field is set to the value of the last call. +func (b *DeviceTaintRuleApplyConfiguration) WithAPIVersion(value string) *DeviceTaintRuleApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// 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 *DeviceTaintRuleApplyConfiguration) WithName(value string) *DeviceTaintRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call. +func (b *DeviceTaintRuleApplyConfiguration) WithGenerateName(value string) *DeviceTaintRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call. +func (b *DeviceTaintRuleApplyConfiguration) WithNamespace(value string) *DeviceTaintRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID 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 UID field is set to the value of the last call. +func (b *DeviceTaintRuleApplyConfiguration) WithUID(value types.UID) *DeviceTaintRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call. +func (b *DeviceTaintRuleApplyConfiguration) WithResourceVersion(value string) *DeviceTaintRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation 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 Generation field is set to the value of the last call. +func (b *DeviceTaintRuleApplyConfiguration) WithGeneration(value int64) *DeviceTaintRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp 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 CreationTimestamp field is set to the value of the last call. +func (b *DeviceTaintRuleApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *DeviceTaintRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp 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 DeletionTimestamp field is set to the value of the last call. +func (b *DeviceTaintRuleApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *DeviceTaintRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds 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 DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *DeviceTaintRuleApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *DeviceTaintRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels 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 Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *DeviceTaintRuleApplyConfiguration) WithLabels(entries map[string]string) *DeviceTaintRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations 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 Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *DeviceTaintRuleApplyConfiguration) WithAnnotations(entries map[string]string) *DeviceTaintRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences 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 OwnerReferences field. +func (b *DeviceTaintRuleApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *DeviceTaintRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers 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 Finalizers field. +func (b *DeviceTaintRuleApplyConfiguration) WithFinalizers(values ...string) *DeviceTaintRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *DeviceTaintRuleApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec 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 Spec field is set to the value of the last call. +func (b *DeviceTaintRuleApplyConfiguration) WithSpec(value *DeviceTaintRuleSpecApplyConfiguration) *DeviceTaintRuleApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status 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 Status field is set to the value of the last call. +func (b *DeviceTaintRuleApplyConfiguration) WithStatus(value *DeviceTaintRuleStatusApplyConfiguration) *DeviceTaintRuleApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *DeviceTaintRuleApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *DeviceTaintRuleApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *DeviceTaintRuleApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *DeviceTaintRuleApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicetaintrulespec.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicetaintrulespec.go new file mode 100644 index 0000000000..694a5c4b2d --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicetaintrulespec.go @@ -0,0 +1,55 @@ +/* +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 + +// DeviceTaintRuleSpecApplyConfiguration represents a declarative configuration of the DeviceTaintRuleSpec type for use +// with apply. +// +// DeviceTaintRuleSpec specifies the selector and one taint. +type DeviceTaintRuleSpecApplyConfiguration struct { + // DeviceSelector defines which device(s) the taint is applied to. + // All selector criteria must be satisfied for a device to + // match. The empty selector matches all devices. Without + // a selector, no devices are matches. + DeviceSelector *DeviceTaintSelectorApplyConfiguration `json:"deviceSelector,omitempty"` + // The taint that gets applied to matching devices. + Taint *DeviceTaintApplyConfiguration `json:"taint,omitempty"` +} + +// DeviceTaintRuleSpecApplyConfiguration constructs a declarative configuration of the DeviceTaintRuleSpec type for use with +// apply. +func DeviceTaintRuleSpec() *DeviceTaintRuleSpecApplyConfiguration { + return &DeviceTaintRuleSpecApplyConfiguration{} +} + +// WithDeviceSelector sets the DeviceSelector 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 DeviceSelector field is set to the value of the last call. +func (b *DeviceTaintRuleSpecApplyConfiguration) WithDeviceSelector(value *DeviceTaintSelectorApplyConfiguration) *DeviceTaintRuleSpecApplyConfiguration { + b.DeviceSelector = value + return b +} + +// WithTaint sets the Taint 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 Taint field is set to the value of the last call. +func (b *DeviceTaintRuleSpecApplyConfiguration) WithTaint(value *DeviceTaintApplyConfiguration) *DeviceTaintRuleSpecApplyConfiguration { + b.Taint = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicetaintrulestatus.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicetaintrulestatus.go new file mode 100644 index 0000000000..568cc205ac --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicetaintrulestatus.go @@ -0,0 +1,70 @@ +/* +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 ( + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// DeviceTaintRuleStatusApplyConfiguration represents a declarative configuration of the DeviceTaintRuleStatus type for use +// with apply. +// +// DeviceTaintRuleStatus provides information about an on-going pod eviction. +type DeviceTaintRuleStatusApplyConfiguration struct { + // Conditions provide information about the state of the DeviceTaintRule + // and the cluster at some point in time, + // in a machine-readable and human-readable format. + // + // The following condition is currently defined as part of this API, more may + // get added: + // - Type: EvictionInProgress + // - Status: True if there are currently pods which need to be evicted, False otherwise + // (includes the effects which don't cause eviction). + // - Reason: not specified, may change + // - Message: includes information about number of pending pods and already evicted pods + // in a human-readable format, updated periodically, may change + // + // For `effect: None`, the condition above gets set once for each change to + // the spec, with the message containing information about what would happen + // if the effect was `NoExecute`. This feedback can be used to decide whether + // changing the effect to `NoExecute` will work as intended. It only gets + // set once to avoid having to constantly update the status. + // + // Must have 8 or fewer entries. + Conditions []metav1.ConditionApplyConfiguration `json:"conditions,omitempty"` +} + +// DeviceTaintRuleStatusApplyConfiguration constructs a declarative configuration of the DeviceTaintRuleStatus type for use with +// apply. +func DeviceTaintRuleStatus() *DeviceTaintRuleStatusApplyConfiguration { + return &DeviceTaintRuleStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions 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 Conditions field. +func (b *DeviceTaintRuleStatusApplyConfiguration) WithConditions(values ...*metav1.ConditionApplyConfiguration) *DeviceTaintRuleStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicetaintselector.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicetaintselector.go new file mode 100644 index 0000000000..6d31934be2 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicetaintselector.go @@ -0,0 +1,76 @@ +/* +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 + +// DeviceTaintSelectorApplyConfiguration represents a declarative configuration of the DeviceTaintSelector type for use +// with apply. +// +// DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to. +// The empty selector matches all devices. Without a selector, no devices +// are matched. +type DeviceTaintSelectorApplyConfiguration struct { + // If driver is set, only devices from that driver are selected. + // This fields corresponds to slice.spec.driver. + Driver *string `json:"driver,omitempty"` + // If pool is set, only devices in that pool are selected. + // + // Also setting the driver name may be useful to avoid + // ambiguity when different drivers use the same pool name, + // but this is not required because selecting pools from + // different drivers may also be useful, for example when + // drivers with node-local devices use the node name as + // their pool name. + Pool *string `json:"pool,omitempty"` + // If device is set, only devices with that name are selected. + // This field corresponds to slice.spec.devices[].name. + // + // Setting also driver and pool may be required to avoid ambiguity, + // but is not required. + Device *string `json:"device,omitempty"` +} + +// DeviceTaintSelectorApplyConfiguration constructs a declarative configuration of the DeviceTaintSelector type for use with +// apply. +func DeviceTaintSelector() *DeviceTaintSelectorApplyConfiguration { + return &DeviceTaintSelectorApplyConfiguration{} +} + +// WithDriver sets the Driver 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 Driver field is set to the value of the last call. +func (b *DeviceTaintSelectorApplyConfiguration) WithDriver(value string) *DeviceTaintSelectorApplyConfiguration { + b.Driver = &value + return b +} + +// WithPool sets the Pool 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 Pool field is set to the value of the last call. +func (b *DeviceTaintSelectorApplyConfiguration) WithPool(value string) *DeviceTaintSelectorApplyConfiguration { + b.Pool = &value + return b +} + +// WithDevice sets the Device 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 Device field is set to the value of the last call. +func (b *DeviceTaintSelectorApplyConfiguration) WithDevice(value string) *DeviceTaintSelectorApplyConfiguration { + b.Device = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/exactdevicerequest.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/exactdevicerequest.go index 8eb0fd3526..68b3c2d40c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/exactdevicerequest.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/exactdevicerequest.go @@ -106,6 +106,27 @@ type ExactDeviceRequestApplyConfiguration struct { // the request fails if there are devices that otherwise match the request, // and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request. Capacity *CapacityRequirementsApplyConfiguration `json:"capacity,omitempty"` + // DerivedAttributes defines a set of virtual attributes computed via CEL expressions + // for each candidate device. These virtual attributes can be referenced in + // `.devices.constraints` to align and match different devices (e.g., co-allocating + // a GPU and a NIC on the same NUMA node) even if their drivers publish different + // attributes. Derived attributes are not available via `device.attributes` + // in the CEL environment when evaluating selector expressions. + // + // Derived attributes allow you to extract, transform, or normalize topology + // information (such as extracting a NUMA index from a complex topology string or + // renaming a vendor-specific attribute) into a common virtual attribute name at + // scheduling time. The scheduler then evaluates these virtual attributes exactly + // like static attributes when matching constraints. + // + // Every derived attribute defined in this list must be referenced by at least one + // MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + // + // The maximum number of derived attributes is 32. + // + // This is an alpha field and requires enabling the DRADerivedAttributes + // feature gate. + DerivedAttributes []DeviceDerivedAttributeApplyConfiguration `json:"derivedAttributes,omitempty"` } // ExactDeviceRequestApplyConfiguration constructs a declarative configuration of the ExactDeviceRequest type for use with @@ -179,3 +200,16 @@ func (b *ExactDeviceRequestApplyConfiguration) WithCapacity(value *CapacityRequi b.Capacity = value return b } + +// WithDerivedAttributes adds the given value to the DerivedAttributes 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 DerivedAttributes field. +func (b *ExactDeviceRequestApplyConfiguration) WithDerivedAttributes(values ...*DeviceDerivedAttributeApplyConfiguration) *ExactDeviceRequestApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithDerivedAttributes") + } + b.DerivedAttributes = append(b.DerivedAttributes, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/nodeallocatablemapping.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/nodeallocatablemapping.go new file mode 100644 index 0000000000..69ba07d5d2 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/nodeallocatablemapping.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + resourcev1 "k8s.io/api/resource/v1" + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// NodeAllocatableMappingApplyConfiguration represents a declarative configuration of the NodeAllocatableMapping type for use +// with apply. +// +// NodeAllocatableMapping defines how a DRA allocation directly translates into a node allocatable resource quantity. +// The mapping can be derived from either the count of allocated devices (via deviceMultiplier) or the specific capacity consumed (via capacityKey and capacityMultiplier). These options are mutually exclusive. +// Kubelet adds this mapped resource quantity from claim to both requests and limits at the pod-level cgroup, and to limits at the container-level cgroup for each container referencing the claim. +type NodeAllocatableMappingApplyConfiguration struct { + // CapacityKey references a capacity name defined as a key in the + // `spec.devices[*].capacity` map. When this field is set, the value associated with + // this key in the `status.allocation.devices.results[*].consumedCapacity` map + // (for a specific claim allocation) determines the base quantity for + // the node allocatable resource. `capacityMultiplier` must also be set and is + // multiplied with the base quantity. + // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", + // and this field is set to "dra.example.com/memory", then for a claim allocation + // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the + // node allocatable resource mapping will be "4Gi". + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. + CapacityKey *resourcev1.QualifiedName `json:"capacityKey,omitempty"` + // CapacityMultiplier is used as a multiplier for the allocated capacity consumed. + // It is only valid if `capacityKey` is set. + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. + // For example, if a Device's capacity "dra.example.com/cores" is consumed, + // and each "core" provides 2 "cpu"s, the mapping would be: + // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", capacityMultiplier: "2"}. + // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. + CapacityMultiplier *resource.Quantity `json:"capacityMultiplier,omitempty"` + // DeviceMultiplier is used as a multiplier for the allocated device count in the claim. + // The final node allocatable resource amount is `deviceCount` * `deviceMultiplier`. + // For example, a DRA driver representing each cache complex (CCX) as a device would have + // {ResourceName: "cpu", deviceMultiplier: "8"} in its `nodeAllocatableResources`. + // If 2 devices (CCX) are allocated to the claim, 2 * 8 = 16 CPUs would be considered as allocated. + // It is only valid when `capacityKey` and `capacityMultiplier` are not set. + DeviceMultiplier *resource.Quantity `json:"deviceMultiplier,omitempty"` +} + +// NodeAllocatableMappingApplyConfiguration constructs a declarative configuration of the NodeAllocatableMapping type for use with +// apply. +func NodeAllocatableMapping() *NodeAllocatableMappingApplyConfiguration { + return &NodeAllocatableMappingApplyConfiguration{} +} + +// WithCapacityKey sets the CapacityKey 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 CapacityKey field is set to the value of the last call. +func (b *NodeAllocatableMappingApplyConfiguration) WithCapacityKey(value resourcev1.QualifiedName) *NodeAllocatableMappingApplyConfiguration { + b.CapacityKey = &value + return b +} + +// WithCapacityMultiplier sets the CapacityMultiplier 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 CapacityMultiplier field is set to the value of the last call. +func (b *NodeAllocatableMappingApplyConfiguration) WithCapacityMultiplier(value resource.Quantity) *NodeAllocatableMappingApplyConfiguration { + b.CapacityMultiplier = &value + return b +} + +// WithDeviceMultiplier sets the DeviceMultiplier 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 DeviceMultiplier field is set to the value of the last call. +func (b *NodeAllocatableMappingApplyConfiguration) WithDeviceMultiplier(value resource.Quantity) *NodeAllocatableMappingApplyConfiguration { + b.DeviceMultiplier = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/nodeallocatableoverhead.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/nodeallocatableoverhead.go new file mode 100644 index 0000000000..120fb94f28 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/nodeallocatableoverhead.go @@ -0,0 +1,67 @@ +/* +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 ( + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// NodeAllocatableOverheadApplyConfiguration represents a declarative configuration of the NodeAllocatableOverhead type for use +// with apply. +// +// NodeAllocatableOverhead defines auxiliary resource overheads incurred when allocating a device. +// Overheads can be specified as a fixed cost per pod referencing the claim, a variable cost per container reference, or both. +// Kubelet accounts for this overhead by adding it to both the pod-level and container-level cgroups of referencing containers. +type NodeAllocatableOverheadApplyConfiguration struct { + // PerPod is overhead applied once per pod referencing the claim on this node. + // This is a flat overhead incurred for every pod referencing the claim. + PerPod *resource.Quantity `json:"perPod,omitempty"` + // PerContainer is applied per container reference to the claim. + // This models overhead scaling linearly with the number of containers actively using the device. + // When both PerPod and PerContainer are specified, the total overhead allocated for each pod referencing + // the claim is computed as: + // Quantity = PerPod + (PerContainer * NumReferences) + // Kubelet accounts for this overhead in cgroups: + // - Pod-level cgroup (requests and limits): Kubelet adds PerPod + (PerContainer * NumReferences). + // - Container-level cgroup (limits only): Kubelet adds PerPod + PerContainer for each referencing container. + // This allows any single container to access the pod-level overhead, while the parent cgroup caps the total usage to account for PerPod exactly once. + PerContainer *resource.Quantity `json:"perContainer,omitempty"` +} + +// NodeAllocatableOverheadApplyConfiguration constructs a declarative configuration of the NodeAllocatableOverhead type for use with +// apply. +func NodeAllocatableOverhead() *NodeAllocatableOverheadApplyConfiguration { + return &NodeAllocatableOverheadApplyConfiguration{} +} + +// WithPerPod sets the PerPod 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 PerPod field is set to the value of the last call. +func (b *NodeAllocatableOverheadApplyConfiguration) WithPerPod(value resource.Quantity) *NodeAllocatableOverheadApplyConfiguration { + b.PerPod = &value + return b +} + +// WithPerContainer sets the PerContainer 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 PerContainer field is set to the value of the last call. +func (b *NodeAllocatableOverheadApplyConfiguration) WithPerContainer(value resource.Quantity) *NodeAllocatableOverheadApplyConfiguration { + b.PerContainer = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/nodeallocatableresource.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/nodeallocatableresource.go new file mode 100644 index 0000000000..fc13ebdde8 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/nodeallocatableresource.go @@ -0,0 +1,65 @@ +/* +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 + +// NodeAllocatableResourceApplyConfiguration represents a declarative configuration of the NodeAllocatableResource type for use +// with apply. +// +// NodeAllocatableResource defines the translation between the DRA device/capacity +// units requested to the corresponding quantity of the node allocatable resource. +// At least one of Mapping or Overhead must be specified. Not specifying either is an invalid configuration. +type NodeAllocatableResourceApplyConfiguration struct { + // Mapping is used when the device directly models a node allocatable resource like standard CPU or memory + // (e.g., with a CPU DRA driver). The calculated quantity is accounted for exactly once per claim instance + // on the node. To prevent node cgroup isolation friction, the scheduler explicitly + // blocks sharing mapped device claims across multiple pods. + Mapping *NodeAllocatableMappingApplyConfiguration `json:"mapping,omitempty"` + // Overhead contains fields for modeling auxiliary overhead incurred on node allocatable resources + // when allocating devices that are not themselves modeling a node allocatable resource (e.g., host memory overhead for GPUs). + // Sharing overhead-mapped claims across multiple pods is allowed. The node allocatable overhead is accounted + // for individually for each pod referencing the claim. + // Overhead is always subtracted from the node's allocatable capacity for the resource, even when mapping + // is specified for the same resource. + // Eg: If a device models memory capacity per socket as a consumable capacity pool via Mapping (with CapacityKey), + // any overhead specified for the same resource will be subtracted from the node's general allocatable capacity + // and not from the per-socket capacity pool in Mapping. + Overhead *NodeAllocatableOverheadApplyConfiguration `json:"overhead,omitempty"` +} + +// NodeAllocatableResourceApplyConfiguration constructs a declarative configuration of the NodeAllocatableResource type for use with +// apply. +func NodeAllocatableResource() *NodeAllocatableResourceApplyConfiguration { + return &NodeAllocatableResourceApplyConfiguration{} +} + +// WithMapping sets the Mapping 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 Mapping field is set to the value of the last call. +func (b *NodeAllocatableResourceApplyConfiguration) WithMapping(value *NodeAllocatableMappingApplyConfiguration) *NodeAllocatableResourceApplyConfiguration { + b.Mapping = value + return b +} + +// WithOverhead sets the Overhead 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 Overhead field is set to the value of the last call. +func (b *NodeAllocatableResourceApplyConfiguration) WithOverhead(value *NodeAllocatableOverheadApplyConfiguration) *NodeAllocatableResourceApplyConfiguration { + b.Overhead = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/nodeallocatableresourcemapping.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/nodeallocatableresourcemapping.go deleted file mode 100644 index 600d96af89..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/nodeallocatableresourcemapping.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -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 ( - resourcev1 "k8s.io/api/resource/v1" - resource "k8s.io/apimachinery/pkg/api/resource" -) - -// NodeAllocatableResourceMappingApplyConfiguration represents a declarative configuration of the NodeAllocatableResourceMapping type for use -// with apply. -// -// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity -// units requested to the corresponding quantity of the node allocatable resource. -type NodeAllocatableResourceMappingApplyConfiguration struct { - // CapacityKey references a capacity name defined as a key in the - // `spec.devices[*].capacity` map. When this field is set, the value associated with - // this key in the `status.allocation.devices.results[*].consumedCapacity` map - // (for a specific claim allocation) determines the base quantity for - // the node allocatable resource. If `allocationMultiplier` is also set, it is - // multiplied with the base quantity. - // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", - // and this field is set to "dra.example.com/memory", then for a claim allocation - // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the - // node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should - // be omitted or set to "1". - CapacityKey *resourcev1.QualifiedName `json:"capacityKey,omitempty"` - // AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. - // It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. - // 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim. - // a. A DRA driver representing each CPU core as a device would have - // {ResourceName: "cpu", allocationMultiplier: "2"} in its - // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim, - // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. - // b. A GPU device that needs additional node memory per GPU allocation would - // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated - // GPU device instance of this type will account for 2Gi of memory. - // - // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed. - // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`. - // For example, if a Device's capacity "dra.example.com/cores" is consumed, - // and each "core" provides 2 "cpu"s, the mapping would be: - // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. - // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. - AllocationMultiplier *resource.Quantity `json:"allocationMultiplier,omitempty"` -} - -// NodeAllocatableResourceMappingApplyConfiguration constructs a declarative configuration of the NodeAllocatableResourceMapping type for use with -// apply. -func NodeAllocatableResourceMapping() *NodeAllocatableResourceMappingApplyConfiguration { - return &NodeAllocatableResourceMappingApplyConfiguration{} -} - -// WithCapacityKey sets the CapacityKey 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 CapacityKey field is set to the value of the last call. -func (b *NodeAllocatableResourceMappingApplyConfiguration) WithCapacityKey(value resourcev1.QualifiedName) *NodeAllocatableResourceMappingApplyConfiguration { - b.CapacityKey = &value - return b -} - -// WithAllocationMultiplier sets the AllocationMultiplier 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 AllocationMultiplier field is set to the value of the last call. -func (b *NodeAllocatableResourceMappingApplyConfiguration) WithAllocationMultiplier(value resource.Quantity) *NodeAllocatableResourceMappingApplyConfiguration { - b.AllocationMultiplier = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceclaim.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceclaim.go index 5a87ea3cbc..ec3504e623 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceclaim.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceclaim.go @@ -36,7 +36,7 @@ import ( // stanza tracks whether this claim has been satisfied and what specific // resources have been allocated. type ResourceClaimApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Spec describes what is being requested and how to configure it. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceclaimtemplate.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceclaimtemplate.go index cee18f3797..2f2fa25069 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceclaimtemplate.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceclaimtemplate.go @@ -32,7 +32,7 @@ import ( // // ResourceClaimTemplate is used to produce ResourceClaim objects. type ResourceClaimTemplateApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Describes the ResourceClaim that is to be generated. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourcepool.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourcepool.go index 2c779f3cad..4dce50617c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourcepool.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourcepool.go @@ -25,6 +25,8 @@ package v1 type ResourcePoolApplyConfiguration struct { // Name is used to identify the pool. For node-local devices, this // is often the node name, but this is not required. + // A field selector can be used to list only ResourceSlice objects + // belonging to a certain pool. // // It must not be longer than 253 characters and must consist of one or more DNS sub-domains // separated by slashes. This field is immutable. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceslice.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceslice.go index 7a3eec9d5c..d7eb3d6893 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceslice.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceslice.go @@ -52,7 +52,7 @@ import ( // For resources that are not local to a node, the node name is not set. Instead, // the driver may use a node selector to specify where the devices are available. type ResourceSliceApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` // Standard object metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Contains the information published by the driver. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceslicespec.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceslicespec.go index b268fc8d7c..a7c858e0ea 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceslicespec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceslicespec.go @@ -19,6 +19,7 @@ limitations under the License. package v1 import ( + resourcev1 "k8s.io/api/resource/v1" corev1 "k8s.io/client-go/applyconfigurations/core/v1" ) @@ -82,6 +83,28 @@ type ResourceSliceSpecApplyConfiguration struct { // // The maximum number of counter sets is 8. SharedCounters []CounterSetApplyConfiguration `json:"sharedCounters,omitempty"` + // PartitionTypeAttribute names a string device attribute (by fully + // qualified name, e.g. "gpu.example.com/profile") whose value labels + // each device with its partition type, such as "Full" or "Half" for a + // MIG-style GPU. + // + // When set, every partitionable device in the slice must carry the attribute + // and devices sharing a value must share the same ConsumesCounters cost. + PartitionTypeAttribute *resourcev1.FullyQualifiedName `json:"partitionTypeAttribute,omitempty"` + // SkipNodeOperations lists node-local resource operations (gRPC calls) + // that will be skipped for the devices in this slice when determining whether + // operations are necessary on the node. If all allocated devices for a driver in + // a claim skip an operation, that gRPC call will be skipped. Valid values are: + // + // - "NodePrepareResources": NodePrepareResources gRPC calls are skipped. This + // value cannot be specified unless "NodeUnprepareResources" is also listed + // (or "*" is specified). + // - "NodeUnprepareResources": NodeUnprepareResources gRPC calls are skipped. + // - "*": All node-local resource operations are skipped. + // + // Other values may be added in the future. The kubelet must ignore unknown + // values. + SkipNodeOperations []resourcev1.SkipNodeOperation `json:"skipNodeOperations,omitempty"` } // ResourceSliceSpecApplyConfiguration constructs a declarative configuration of the ResourceSliceSpec type for use with @@ -163,3 +186,21 @@ func (b *ResourceSliceSpecApplyConfiguration) WithSharedCounters(values ...*Coun } return b } + +// WithPartitionTypeAttribute sets the PartitionTypeAttribute 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 PartitionTypeAttribute field is set to the value of the last call. +func (b *ResourceSliceSpecApplyConfiguration) WithPartitionTypeAttribute(value resourcev1.FullyQualifiedName) *ResourceSliceSpecApplyConfiguration { + b.PartitionTypeAttribute = &value + return b +} + +// WithSkipNodeOperations adds the given value to the SkipNodeOperations 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 SkipNodeOperations field. +func (b *ResourceSliceSpecApplyConfiguration) WithSkipNodeOperations(values ...resourcev1.SkipNodeOperation) *ResourceSliceSpecApplyConfiguration { + for i := range values { + b.SkipNodeOperations = append(b.SkipNodeOperations, values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/devicetaintrule.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/devicetaintrule.go index b28d015de3..4824d6ccf8 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/devicetaintrule.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/devicetaintrule.go @@ -34,7 +34,7 @@ import ( // This has the same effect as if the taint was specified directly // in the ResourceSlice by the DRA driver. type DeviceTaintRuleApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Spec specifies the selector and one taint. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/partitiontypestatus.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/partitiontypestatus.go new file mode 100644 index 0000000000..f6222c71fd --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/partitiontypestatus.go @@ -0,0 +1,77 @@ +/* +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 + +// PartitionTypeStatusApplyConfiguration represents a declarative configuration of the PartitionTypeStatus type for use +// with apply. +// +// PartitionTypeStatus reports allocatability for a single partition type, +// identified by the value of a grouping attribute. +type PartitionTypeStatusApplyConfiguration struct { + // Attribute is the fully qualified name of the device attribute whose value + // groups this entry. It is the PartitionTypeAttribute declared by the + // devices' own slice, or the default named in the request when their slice + // declares none. + Attribute *string `json:"attribute,omitempty"` + // Type is the partition type value (e.g. "Full" or "Half"). + Type *string `json:"type,omitempty"` + // Total is the number of devices of this partition type in the pool. + Total *int32 `json:"total,omitempty"` + // Allocatable is the number of additional devices of this partition type + // that could still be allocated given current shared-counter consumption. + Allocatable *int32 `json:"allocatable,omitempty"` +} + +// PartitionTypeStatusApplyConfiguration constructs a declarative configuration of the PartitionTypeStatus type for use with +// apply. +func PartitionTypeStatus() *PartitionTypeStatusApplyConfiguration { + return &PartitionTypeStatusApplyConfiguration{} +} + +// WithAttribute sets the Attribute 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 Attribute field is set to the value of the last call. +func (b *PartitionTypeStatusApplyConfiguration) WithAttribute(value string) *PartitionTypeStatusApplyConfiguration { + b.Attribute = &value + return b +} + +// 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 *PartitionTypeStatusApplyConfiguration) WithType(value string) *PartitionTypeStatusApplyConfiguration { + b.Type = &value + return b +} + +// WithTotal sets the Total 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 Total field is set to the value of the last call. +func (b *PartitionTypeStatusApplyConfiguration) WithTotal(value int32) *PartitionTypeStatusApplyConfiguration { + b.Total = &value + return b +} + +// WithAllocatable sets the Allocatable 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 Allocatable field is set to the value of the last call. +func (b *PartitionTypeStatusApplyConfiguration) WithAllocatable(value int32) *PartitionTypeStatusApplyConfiguration { + b.Allocatable = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/poolstatus.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/poolstatus.go index 343fe8247d..3daeed07dc 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/poolstatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/poolstatus.go @@ -63,6 +63,19 @@ type PoolStatusApplyConfiguration struct { // validated (e.g., incomplete slice publication). When set, device // count fields and ResourceSliceCount may be unset. ValidationError *string `json:"validationError,omitempty"` + // PartitionSummary reports allocatability per (attribute, partition type) + // for a partitionable pool that publishes SharedCounters. Each entry names + // the grouping attribute it was resolved from: the PartitionTypeAttribute + // declared by a device's own slice, or for devices whose slice declares + // none, the default named in the request. A pool that mixes partitions + // declared under different attributes reports each independently. When no + // slice declares an attribute and the request names no default, the pool + // reports no partition summary. + PartitionSummary []PartitionTypeStatusApplyConfiguration `json:"partitionSummary,omitempty"` + // ShareableSummary reports aggregate capacity for a pool that contains + // devices with AllowMultipleAllocations. It is populated only when at + // least one device in the pool is shareable. + ShareableSummary *ShareableSummaryStatusApplyConfiguration `json:"shareableSummary,omitempty"` } // PoolStatusApplyConfiguration constructs a declarative configuration of the PoolStatus type for use with @@ -150,3 +163,24 @@ func (b *PoolStatusApplyConfiguration) WithValidationError(value string) *PoolSt b.ValidationError = &value return b } + +// WithPartitionSummary adds the given value to the PartitionSummary 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 PartitionSummary field. +func (b *PoolStatusApplyConfiguration) WithPartitionSummary(values ...*PartitionTypeStatusApplyConfiguration) *PoolStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPartitionSummary") + } + b.PartitionSummary = append(b.PartitionSummary, *values[i]) + } + return b +} + +// WithShareableSummary sets the ShareableSummary 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 ShareableSummary field is set to the value of the last call. +func (b *PoolStatusApplyConfiguration) WithShareableSummary(value *ShareableSummaryStatusApplyConfiguration) *PoolStatusApplyConfiguration { + b.ShareableSummary = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequest.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequest.go index aee4d0ed90..e5b82c28ae 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequest.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequest.go @@ -34,7 +34,7 @@ import ( // based on the provided filters. Once status is set, the request is considered complete and will not be reprocessed. // Users should delete and recreate requests to get updated information. type ResourcePoolStatusRequestApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Spec defines the filters for which pools to include in the status. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequestspec.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequestspec.go index bb86727321..85fd362a25 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequestspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequestspec.go @@ -40,6 +40,19 @@ type ResourcePoolStatusRequestSpecApplyConfiguration struct { // Minimum: 1 // Maximum: 1000 Limit *int32 `json:"limit,omitempty"` + // DefaultPartitionTypeAttribute optionally names a device attribute (by its + // fully qualified name, e.g. "gpu.example.com/profile") to use as the default + // grouping attribute for partitionable devices whose slice has not declared + // one themselves. + // + // A slice's own PartitionTypeAttribute always takes precedence. This default + // applies only to devices whose slice does not declare one, so that a request + // can still get an accurate partitionSummary from a driver that has not + // been updated to declare it. When neither the slice nor this default names + // an attribute, a partitionable pool reports no partitionSummary. + // + // Must include the domain qualifier. + DefaultPartitionTypeAttribute *string `json:"defaultPartitionTypeAttribute,omitempty"` } // ResourcePoolStatusRequestSpecApplyConfiguration constructs a declarative configuration of the ResourcePoolStatusRequestSpec type for use with @@ -71,3 +84,11 @@ func (b *ResourcePoolStatusRequestSpecApplyConfiguration) WithLimit(value int32) b.Limit = &value return b } + +// WithDefaultPartitionTypeAttribute sets the DefaultPartitionTypeAttribute 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 DefaultPartitionTypeAttribute field is set to the value of the last call. +func (b *ResourcePoolStatusRequestSpecApplyConfiguration) WithDefaultPartitionTypeAttribute(value string) *ResourcePoolStatusRequestSpecApplyConfiguration { + b.DefaultPartitionTypeAttribute = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/shareablecapacitystatus.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/shareablecapacitystatus.go new file mode 100644 index 0000000000..1e90896373 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/shareablecapacitystatus.go @@ -0,0 +1,77 @@ +/* +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 ( + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// ShareableCapacityStatusApplyConfiguration represents a declarative configuration of the ShareableCapacityStatus type for use +// with apply. +// +// ShareableCapacityStatus reports aggregate amounts for a single shareable +// capacity key. +type ShareableCapacityStatusApplyConfiguration struct { + // Name is the capacity name. + Name *string `json:"name,omitempty"` + // Total is the sum of this capacity across shareable devices in the pool. + Total *resource.Quantity `json:"total,omitempty"` + // Consumed is the amount drawn by current allocations. + Consumed *resource.Quantity `json:"consumed,omitempty"` + // Available is Total minus Consumed, never negative. + Available *resource.Quantity `json:"available,omitempty"` +} + +// ShareableCapacityStatusApplyConfiguration constructs a declarative configuration of the ShareableCapacityStatus type for use with +// apply. +func ShareableCapacityStatus() *ShareableCapacityStatusApplyConfiguration { + return &ShareableCapacityStatusApplyConfiguration{} +} + +// 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 *ShareableCapacityStatusApplyConfiguration) WithName(value string) *ShareableCapacityStatusApplyConfiguration { + b.Name = &value + return b +} + +// WithTotal sets the Total 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 Total field is set to the value of the last call. +func (b *ShareableCapacityStatusApplyConfiguration) WithTotal(value resource.Quantity) *ShareableCapacityStatusApplyConfiguration { + b.Total = &value + return b +} + +// WithConsumed sets the Consumed 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 Consumed field is set to the value of the last call. +func (b *ShareableCapacityStatusApplyConfiguration) WithConsumed(value resource.Quantity) *ShareableCapacityStatusApplyConfiguration { + b.Consumed = &value + return b +} + +// WithAvailable sets the Available 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 Available field is set to the value of the last call. +func (b *ShareableCapacityStatusApplyConfiguration) WithAvailable(value resource.Quantity) *ShareableCapacityStatusApplyConfiguration { + b.Available = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/shareablesummarystatus.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/shareablesummarystatus.go new file mode 100644 index 0000000000..0a52934279 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/shareablesummarystatus.go @@ -0,0 +1,71 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha3 + +// ShareableSummaryStatusApplyConfiguration represents a declarative configuration of the ShareableSummaryStatus type for use +// with apply. +// +// ShareableSummaryStatus reports aggregate capacity for a pool that contains +// devices with AllowMultipleAllocations. +type ShareableSummaryStatusApplyConfiguration struct { + // FullyAvailableDevices is the number of shareable devices with no + // capacity consumed. + FullyAvailableDevices *int32 `json:"fullyAvailableDevices,omitempty"` + // PartiallyAvailableDevices is the number of shareable devices with some + // but not all capacity consumed. + PartiallyAvailableDevices *int32 `json:"partiallyAvailableDevices,omitempty"` + // Capacity reports aggregate total, consumed, and available amounts per + // shareable capacity key across the pool. + Capacity []ShareableCapacityStatusApplyConfiguration `json:"capacity,omitempty"` +} + +// ShareableSummaryStatusApplyConfiguration constructs a declarative configuration of the ShareableSummaryStatus type for use with +// apply. +func ShareableSummaryStatus() *ShareableSummaryStatusApplyConfiguration { + return &ShareableSummaryStatusApplyConfiguration{} +} + +// WithFullyAvailableDevices sets the FullyAvailableDevices 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 FullyAvailableDevices field is set to the value of the last call. +func (b *ShareableSummaryStatusApplyConfiguration) WithFullyAvailableDevices(value int32) *ShareableSummaryStatusApplyConfiguration { + b.FullyAvailableDevices = &value + return b +} + +// WithPartiallyAvailableDevices sets the PartiallyAvailableDevices 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 PartiallyAvailableDevices field is set to the value of the last call. +func (b *ShareableSummaryStatusApplyConfiguration) WithPartiallyAvailableDevices(value int32) *ShareableSummaryStatusApplyConfiguration { + b.PartiallyAvailableDevices = &value + return b +} + +// WithCapacity adds the given value to the Capacity 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 Capacity field. +func (b *ShareableSummaryStatusApplyConfiguration) WithCapacity(values ...*ShareableCapacityStatusApplyConfiguration) *ShareableSummaryStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithCapacity") + } + b.Capacity = append(b.Capacity, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/basicdevice.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/basicdevice.go index 64527b2938..5d4c565e8a 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/basicdevice.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/basicdevice.go @@ -110,7 +110,7 @@ type BasicDeviceApplyConfiguration struct { // If AllowMultipleAllocations is set to true, the device can be allocated more than once, // and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not. AllowMultipleAllocations *bool `json:"allowMultipleAllocations,omitempty"` - // NodeAllocatableResourceMappings defines the mapping of node resources + // NodeAllocatableResources defines the mapping of node resources // that are managed by the DRA driver exposing this device. This includes resources currently // reported in v1.Node `status.allocatable` that are not extended resources // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). @@ -121,7 +121,7 @@ type BasicDeviceApplyConfiguration struct { // dependencies of an accelerator device. // The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). // Extended resource names are not permitted as keys. - NodeAllocatableResourceMappings map[corev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration `json:"nodeAllocatableResourceMappings,omitempty"` + NodeAllocatableResources map[corev1.ResourceName]NodeAllocatableResourceApplyConfiguration `json:"nodeAllocatableResources,omitempty"` } // BasicDeviceApplyConfiguration constructs a declarative configuration of the BasicDevice type for use with @@ -244,16 +244,16 @@ func (b *BasicDeviceApplyConfiguration) WithAllowMultipleAllocations(value bool) return b } -// WithNodeAllocatableResourceMappings puts the entries into the NodeAllocatableResourceMappings field in the declarative configuration +// WithNodeAllocatableResources puts the entries into the NodeAllocatableResources 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 NodeAllocatableResourceMappings field, -// overwriting an existing map entries in NodeAllocatableResourceMappings field with the same key. -func (b *BasicDeviceApplyConfiguration) WithNodeAllocatableResourceMappings(entries map[corev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration) *BasicDeviceApplyConfiguration { - if b.NodeAllocatableResourceMappings == nil && len(entries) > 0 { - b.NodeAllocatableResourceMappings = make(map[corev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration, len(entries)) +// If called multiple times, the entries provided by each call will be put on the NodeAllocatableResources field, +// overwriting an existing map entries in NodeAllocatableResources field with the same key. +func (b *BasicDeviceApplyConfiguration) WithNodeAllocatableResources(entries map[corev1.ResourceName]NodeAllocatableResourceApplyConfiguration) *BasicDeviceApplyConfiguration { + if b.NodeAllocatableResources == nil && len(entries) > 0 { + b.NodeAllocatableResources = make(map[corev1.ResourceName]NodeAllocatableResourceApplyConfiguration, len(entries)) } for k, v := range entries { - b.NodeAllocatableResourceMappings[k] = v + b.NodeAllocatableResources[k] = v } return b } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/capacityrequestpolicyrange.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/capacityrequestpolicyrange.go index cddfe6daf9..9216d4deb5 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/capacityrequestpolicyrange.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/capacityrequestpolicyrange.go @@ -27,6 +27,13 @@ import ( // // CapacityRequestPolicyRange defines a valid range for consumable capacity values. // +// If the DRAFractionalCapacityRange feature gate is +// enabled and at least one of Min, Max, or Step is a fractional quantity (i.e. +// its value is not an integer), milli-unit arithmetic is used instead, +// supporting values with up to 3 decimal places (e.g. 100m = 0.1). +// The largest supported value then is 1000 times smaller compared to using 64-bit integers. +// Otherwise, all comparisons use 64-bit integer arithmetic via resource.Quantity.Value(). +// // - If the requested amount is less than Min, it is rounded up to the Min value. // - If Step is set and the requested amount is between Min and Max but not aligned with Step, // it will be rounded up to the next value equal to Min + (n * Step). diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/celdeviceselector.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/celdeviceselector.go index ba65467ae5..40663836d6 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/celdeviceselector.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/celdeviceselector.go @@ -33,7 +33,7 @@ type CELDeviceSelectorApplyConfiguration struct { // - driver (string): the name of the driver which defines this device. // - attributes (map[string]object): the device's attributes, grouped by prefix // (e.g. device.attributes["dra.example.com"] evaluates to an object with all - // of the attributes which were prefixed by "dra.example.com". + // of the attributes which were prefixed by "dra.example.com"). // - capacity (map[string]object): the device's capacities, grouped by prefix. // - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device // (v1.34+ with the DRAConsumableCapacity feature enabled). @@ -66,6 +66,15 @@ type CELDeviceSelectorApplyConfiguration struct { // A robust expression should check for the existence of attributes // before referencing them. // + // Common errors: + // - "no such key": Use optional chaining (.? followed by orValue()) + // or guarding the check with has() for optional fields. + // See CEL Optional Types for details: + // https://pkg.go.dev/github.com/google/cel-go@v0.17.4/cel#OptionalTypes + // + // For more CEL expression syntax and examples, see: + // https://kubernetes.io/docs/reference/using-api/cel/ + // // For ease of use, the cel.bind() function is enabled, and can be used // to simplify expressions that access multiple attributes with the // same domain. For example: diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceallocationconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceallocationconfiguration.go index 314ff5fa71..f26f528fbe 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceallocationconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceallocationconfiguration.go @@ -38,7 +38,7 @@ type DeviceAllocationConfigurationApplyConfiguration struct { // and may include the subrequest using the format
[/]. If just // the main request is given, the configuration applies to all subrequests. Requests []string `json:"requests,omitempty"` - DeviceConfigurationApplyConfiguration `json:",inline"` + DeviceConfigurationApplyConfiguration `json:""` } // DeviceAllocationConfigurationApplyConfiguration constructs a declarative configuration of the DeviceAllocationConfiguration type for use with diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclaimconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclaimconfiguration.go index 2c7faab5b9..1b094a80cb 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclaimconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclaimconfiguration.go @@ -30,7 +30,7 @@ type DeviceClaimConfigurationApplyConfiguration struct { // and may include the subrequest using the format
[/]. If just // the main request is given, the configuration applies to all subrequests. Requests []string `json:"requests,omitempty"` - DeviceConfigurationApplyConfiguration `json:",inline"` + DeviceConfigurationApplyConfiguration `json:""` } // DeviceClaimConfigurationApplyConfiguration constructs a declarative configuration of the DeviceClaimConfiguration type for use with diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclass.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclass.go index b0fcbac6fb..a242986f95 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclass.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclass.go @@ -38,7 +38,7 @@ import ( // This is an alpha type and requires enabling the DynamicResourceAllocation // feature gate. type DeviceClassApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Spec defines what can be allocated and how to configure it. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclassconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclassconfiguration.go index d521f01e12..b87b5407ce 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclassconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclassconfiguration.go @@ -23,7 +23,7 @@ package v1beta1 // // DeviceClassConfiguration is used in DeviceClass. type DeviceClassConfigurationApplyConfiguration struct { - DeviceConfigurationApplyConfiguration `json:",inline"` + DeviceConfigurationApplyConfiguration `json:""` } // DeviceClassConfigurationApplyConfiguration constructs a declarative configuration of the DeviceClassConfiguration type for use with diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclassspec.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclassspec.go index c234bdd732..d01256a3e1 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclassspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclassspec.go @@ -40,8 +40,6 @@ type DeviceClassSpecApplyConfiguration struct { // is picked to satisfy a pod's extended resource requests. // If two classes are created at the same time, then the name of the class // lexicographically sorted first is picked. - // - // This is a beta field. ExtendedResourceName *string `json:"extendedResourceName,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicecounterconsumption.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicecounterconsumption.go index 1b1956c5cf..667a88bd1c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicecounterconsumption.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicecounterconsumption.go @@ -31,6 +31,26 @@ type DeviceCounterConsumptionApplyConfiguration struct { // // The maximum number of counters is 32. Counters map[string]CounterApplyConfiguration `json:"counters,omitempty"` + // CompatibilityGroups is a list of opaque group names for + // this counter set consumption. + // + // Devices that consume counters from the same counter set may only be + // allocated at the same time ("co-allocated") if they all share at least + // one common group: the intersection of the CompatibilityGroups of all + // co-allocated devices on that counter set must be non-empty. Devices + // that consume from different counter sets are never compared via this + // field. + // + // An unset field, an explicit nil, and an empty list are equivalent and + // mean "no groups": such a device is only co-allocatable with sibling + // devices on the same counter set that also have no groups, and is never + // co-allocatable with a device that declares one or more groups. + // + // Group names are opaque and meaningful only within the + // publishing driver's pool. + // + // The maximum number of groups is 2, and the names must be unique. + CompatibilityGroups []string `json:"compatibilityGroups,omitempty"` } // DeviceCounterConsumptionApplyConfiguration constructs a declarative configuration of the DeviceCounterConsumption type for use with @@ -60,3 +80,13 @@ func (b *DeviceCounterConsumptionApplyConfiguration) WithCounters(entries map[st } return b } + +// WithCompatibilityGroups adds the given value to the CompatibilityGroups 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 CompatibilityGroups field. +func (b *DeviceCounterConsumptionApplyConfiguration) WithCompatibilityGroups(values ...string) *DeviceCounterConsumptionApplyConfiguration { + for i := range values { + b.CompatibilityGroups = append(b.CompatibilityGroups, values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicederivedattribute.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicederivedattribute.go new file mode 100644 index 0000000000..0c560d70bc --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicederivedattribute.go @@ -0,0 +1,95 @@ +/* +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 v1beta1 + +import ( + resourcev1beta1 "k8s.io/api/resource/v1beta1" +) + +// DeviceDerivedAttributeApplyConfiguration represents a declarative configuration of the DeviceDerivedAttribute type for use +// with apply. +// +// DeviceDerivedAttribute defines a derived attribute computed via CEL. +type DeviceDerivedAttributeApplyConfiguration struct { + // Name is the identifier for this derived attribute, used in constraints. + // + // It must be a DNS subdomain followed by a slash ("/") followed by a C identifier + // (e.g. "example.com/numaNode" or "derived/numaNode"). + // + // If the chosen name matches an existing physical attribute from a driver, + // the derived attribute's expression will shadow the physical attribute, + // and its evaluated value will be used in constraints instead. When the goal + // is to define a derived attribute that is only used within the ResourceClaim + // and not meant to shadow an existing attribute, use a domain prefix that + // no DRA driver should be using (e.g. "derived/myAttribute"). + // + // It is not valid to define a derived attribute that isn't used in at least + // one constraint. + Name *resourcev1beta1.FullyQualifiedName `json:"name,omitempty"` + // Expression is a CEL expression evaluated against each candidate device. + // The expression must evaluate to a primitive scalar (string, integer, + // boolean, or semver) or a list of these scalars ([]string, []int64, + // []bool, []semver) to act as a virtual grouping key. Any other return type + // is an error and causes CEL evaluation for the device to fail. + // + // The expression's input is an object named "device", which carries the + // same properties as in a CELDeviceSelector. + // + // When pod scheduling encounters CEL runtime errors (such as looking + // up an attribute that isn't defined) for some devices, it will abort + // allocation and fail scheduling for the Pod. Surfacing evaluation + // errors immediately prevents silent topology matching failures that are + // extremely hard to detect. A robust expression should, for example, check + // for the existence of attributes before referencing them to avoid + // runtime evaluation errors. + // + // The expression gets evaluated after a device has passed the other + // selector expressions for the request in which this expression is used. + // This allows writing expressions that are tailored towards the specific + // devices being requested (for example, by assuming the device is from a + // certain vendor and skipping those checks). + // + // The length of the expression must be smaller or equal to 10 Ki. The + // cost of evaluating it is also limited based on the estimated number + // of logical steps; the combined cost of all derived attributes in a + // claim is capped by a shared CEL cost budget. + Expression *string `json:"expression,omitempty"` +} + +// DeviceDerivedAttributeApplyConfiguration constructs a declarative configuration of the DeviceDerivedAttribute type for use with +// apply. +func DeviceDerivedAttribute() *DeviceDerivedAttributeApplyConfiguration { + return &DeviceDerivedAttributeApplyConfiguration{} +} + +// 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 *DeviceDerivedAttributeApplyConfiguration) WithName(value resourcev1beta1.FullyQualifiedName) *DeviceDerivedAttributeApplyConfiguration { + b.Name = &value + return b +} + +// WithExpression sets the Expression 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 Expression field is set to the value of the last call. +func (b *DeviceDerivedAttributeApplyConfiguration) WithExpression(value string) *DeviceDerivedAttributeApplyConfiguration { + b.Expression = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicerequest.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicerequest.go index fdcb928a57..caa52fcd22 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicerequest.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicerequest.go @@ -149,6 +149,27 @@ type DeviceRequestApplyConfiguration struct { // the request fails if there are devices that otherwise match the request, // and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request. Capacity *CapacityRequirementsApplyConfiguration `json:"capacity,omitempty"` + // DerivedAttributes defines a set of virtual attributes computed via CEL expressions + // for each candidate device. These virtual attributes can be referenced in + // `.devices.constraints` to align and match different devices (e.g., co-allocating + // a GPU and a NIC on the same NUMA node) even if their drivers publish different + // attributes. Derived attributes are not available via `device.attributes` + // in the CEL environment when evaluating selector expressions. + // + // Derived attributes allow you to extract, transform, or normalize topology + // information (such as extracting a NUMA index from a complex topology string or + // renaming a vendor-specific attribute) into a common virtual attribute name at + // scheduling time. The scheduler then evaluates these virtual attributes exactly + // like static attributes when matching constraints. + // + // Every derived attribute defined in this list must be referenced by at least one + // MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + // + // The maximum number of derived attributes is 32. + // + // This is an alpha field and requires enabling the DRADerivedAttributes + // feature gate. + DerivedAttributes []DeviceDerivedAttributeApplyConfiguration `json:"derivedAttributes,omitempty"` } // DeviceRequestApplyConfiguration constructs a declarative configuration of the DeviceRequest type for use with @@ -243,3 +264,16 @@ func (b *DeviceRequestApplyConfiguration) WithCapacity(value *CapacityRequiremen b.Capacity = value return b } + +// WithDerivedAttributes adds the given value to the DerivedAttributes 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 DerivedAttributes field. +func (b *DeviceRequestApplyConfiguration) WithDerivedAttributes(values ...*DeviceDerivedAttributeApplyConfiguration) *DeviceRequestApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithDerivedAttributes") + } + b.DerivedAttributes = append(b.DerivedAttributes, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicerequestallocationresult.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicerequestallocationresult.go index 3a47b9c1f6..d356dd841c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicerequestallocationresult.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicerequestallocationresult.go @@ -95,6 +95,12 @@ type DeviceRequestAllocationResultApplyConfiguration struct { // This field is populated only for devices that allow multiple allocations. // All capacity entries are included, even if the consumed amount is zero. ConsumedCapacity map[resourcev1beta1.QualifiedName]resource.Quantity `json:"consumedCapacity,omitempty"` + // SkipNodeOperations lists node-local resource operations (gRPC calls) + // that will be skipped for this allocated device when determining whether + // operations are necessary on the node. If all allocated devices for a driver in + // a claim skip an operation, that gRPC call will be skipped. It is a copy of + // the ResourceSlice.spec.skipNodeOperations value at the time when the device was allocated. + SkipNodeOperations []resourcev1beta1.SkipNodeOperation `json:"skipNodeOperations,omitempty"` } // DeviceRequestAllocationResultApplyConfiguration constructs a declarative configuration of the DeviceRequestAllocationResult type for use with @@ -197,3 +203,13 @@ func (b *DeviceRequestAllocationResultApplyConfiguration) WithConsumedCapacity(e } return b } + +// WithSkipNodeOperations adds the given value to the SkipNodeOperations 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 SkipNodeOperations field. +func (b *DeviceRequestAllocationResultApplyConfiguration) WithSkipNodeOperations(values ...resourcev1beta1.SkipNodeOperation) *DeviceRequestAllocationResultApplyConfiguration { + for i := range values { + b.SkipNodeOperations = append(b.SkipNodeOperations, values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicesubrequest.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicesubrequest.go index ae7bf65a04..3810b539f8 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicesubrequest.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicesubrequest.go @@ -110,6 +110,27 @@ type DeviceSubRequestApplyConfiguration struct { // the request fails if there are devices that otherwise match the request, // and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request. Capacity *CapacityRequirementsApplyConfiguration `json:"capacity,omitempty"` + // DerivedAttributes defines a set of virtual attributes computed via CEL expressions + // for each candidate device. These virtual attributes can be referenced in + // `.devices.constraints` to align and match different devices (e.g., co-allocating + // a GPU and a NIC on the same NUMA node) even if their drivers publish different + // attributes. Derived attributes are not available via `device.attributes` + // in the CEL environment when evaluating selector expressions. + // + // Derived attributes allow you to extract, transform, or normalize topology + // information (such as extracting a NUMA index from a complex topology string or + // renaming a vendor-specific attribute) into a common virtual attribute name at + // scheduling time. The scheduler then evaluates these virtual attributes exactly + // like static attributes when matching constraints. + // + // Every derived attribute defined in this list must be referenced by at least one + // MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + // + // The maximum number of derived attributes is 32. + // + // This is an alpha field and requires enabling the DRADerivedAttributes + // feature gate. + DerivedAttributes []DeviceDerivedAttributeApplyConfiguration `json:"derivedAttributes,omitempty"` } // DeviceSubRequestApplyConfiguration constructs a declarative configuration of the DeviceSubRequest type for use with @@ -183,3 +204,16 @@ func (b *DeviceSubRequestApplyConfiguration) WithCapacity(value *CapacityRequire b.Capacity = value return b } + +// WithDerivedAttributes adds the given value to the DerivedAttributes 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 DerivedAttributes field. +func (b *DeviceSubRequestApplyConfiguration) WithDerivedAttributes(values ...*DeviceDerivedAttributeApplyConfiguration) *DeviceSubRequestApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithDerivedAttributes") + } + b.DerivedAttributes = append(b.DerivedAttributes, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/nodeallocatablemapping.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/nodeallocatablemapping.go new file mode 100644 index 0000000000..a95af3ab64 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/nodeallocatablemapping.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +import ( + resourcev1beta1 "k8s.io/api/resource/v1beta1" + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// NodeAllocatableMappingApplyConfiguration represents a declarative configuration of the NodeAllocatableMapping type for use +// with apply. +// +// NodeAllocatableMapping defines how a DRA allocation directly translates into a node allocatable resource quantity. +// The mapping can be derived from either the count of allocated devices or the specific capacity consumed. These options are mutually exclusive. +// Kubelet adds this mapped resource quantity from claim to both requests and limits at the pod-level cgroup, and to limits at the container-level cgroup for each container referencing the claim. +type NodeAllocatableMappingApplyConfiguration struct { + // CapacityKey references a capacity name defined as a key in the + // `spec.devices[*].capacity` map. When this field is set, the value associated with + // this key in the `status.allocation.devices.results[*].consumedCapacity` map + // (for a specific claim allocation) determines the base quantity for + // the node allocatable resource. `capacityMultiplier` must also be set and is + // multiplied with the base quantity. + // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", + // and this field is set to "dra.example.com/memory", then for a claim allocation + // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the + // node allocatable resource mapping will be "4Gi". + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. + CapacityKey *resourcev1beta1.QualifiedName `json:"capacityKey,omitempty"` + // CapacityMultiplier is used as a multiplier for the allocated capacity consumed. + // It is only valid if `capacityKey` is set. + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. + // For example, if a Device's capacity "dra.example.com/cores" is consumed, + // and each "core" provides 2 "cpu"s, the mapping would be: + // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", capacityMultiplier: "2"}. + // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. + CapacityMultiplier *resource.Quantity `json:"capacityMultiplier,omitempty"` + // DeviceMultiplier is used as a multiplier for the allocated device count in the claim. + // The final node allocatable resource amount is `deviceCount` * `deviceMultiplier`. + // For example, a DRA driver representing each cache complex (CCX) as a device would have + // {ResourceName: "cpu", deviceMultiplier: "8"} in its `nodeAllocatableResources`. + // If 2 devices (CCX) are allocated to the claim, 2 * 8 = 16 CPUs would be considered as allocated. + // It is only valid when `capacityKey` and `capacityMultiplier` are not set. + DeviceMultiplier *resource.Quantity `json:"deviceMultiplier,omitempty"` +} + +// NodeAllocatableMappingApplyConfiguration constructs a declarative configuration of the NodeAllocatableMapping type for use with +// apply. +func NodeAllocatableMapping() *NodeAllocatableMappingApplyConfiguration { + return &NodeAllocatableMappingApplyConfiguration{} +} + +// WithCapacityKey sets the CapacityKey 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 CapacityKey field is set to the value of the last call. +func (b *NodeAllocatableMappingApplyConfiguration) WithCapacityKey(value resourcev1beta1.QualifiedName) *NodeAllocatableMappingApplyConfiguration { + b.CapacityKey = &value + return b +} + +// WithCapacityMultiplier sets the CapacityMultiplier 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 CapacityMultiplier field is set to the value of the last call. +func (b *NodeAllocatableMappingApplyConfiguration) WithCapacityMultiplier(value resource.Quantity) *NodeAllocatableMappingApplyConfiguration { + b.CapacityMultiplier = &value + return b +} + +// WithDeviceMultiplier sets the DeviceMultiplier 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 DeviceMultiplier field is set to the value of the last call. +func (b *NodeAllocatableMappingApplyConfiguration) WithDeviceMultiplier(value resource.Quantity) *NodeAllocatableMappingApplyConfiguration { + b.DeviceMultiplier = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/nodeallocatableoverhead.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/nodeallocatableoverhead.go new file mode 100644 index 0000000000..00526a9253 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/nodeallocatableoverhead.go @@ -0,0 +1,67 @@ +/* +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 v1beta1 + +import ( + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// NodeAllocatableOverheadApplyConfiguration represents a declarative configuration of the NodeAllocatableOverhead type for use +// with apply. +// +// NodeAllocatableOverhead defines auxiliary resource overheads incurred when allocating a device. +// Overheads can be specified as a fixed cost per pod referencing the claim, a variable cost per container reference, or both. +// Kubelet accounts for this overhead by adding it to both the pod-level and container-level cgroups of referencing containers. +type NodeAllocatableOverheadApplyConfiguration struct { + // PerPod is overhead applied once per pod referencing the claim on this node. + // This is a flat overhead incurred for every pod referencing the claim. + PerPod *resource.Quantity `json:"perPod,omitempty"` + // PerContainer is applied per container reference to the claim. + // This models overhead scaling linearly with the number of containers actively using the device. + // When both PerPod and PerContainer are specified, the total overhead allocated for each pod referencing + // the claim is computed as: + // Quantity = PerPod + (PerContainer * NumReferences) + // Kubelet accounts for this overhead in cgroups: + // - Pod-level cgroup (requests and limits): Kubelet adds PerPod + (PerContainer * NumReferences). + // - Container-level cgroup (limits only): Kubelet adds PerPod + PerContainer for each referencing container. + // This allows any single container to access the pod-level overhead, while the parent cgroup caps the total usage to account for PerPod exactly once. + PerContainer *resource.Quantity `json:"perContainer,omitempty"` +} + +// NodeAllocatableOverheadApplyConfiguration constructs a declarative configuration of the NodeAllocatableOverhead type for use with +// apply. +func NodeAllocatableOverhead() *NodeAllocatableOverheadApplyConfiguration { + return &NodeAllocatableOverheadApplyConfiguration{} +} + +// WithPerPod sets the PerPod 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 PerPod field is set to the value of the last call. +func (b *NodeAllocatableOverheadApplyConfiguration) WithPerPod(value resource.Quantity) *NodeAllocatableOverheadApplyConfiguration { + b.PerPod = &value + return b +} + +// WithPerContainer sets the PerContainer 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 PerContainer field is set to the value of the last call. +func (b *NodeAllocatableOverheadApplyConfiguration) WithPerContainer(value resource.Quantity) *NodeAllocatableOverheadApplyConfiguration { + b.PerContainer = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/nodeallocatableresource.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/nodeallocatableresource.go new file mode 100644 index 0000000000..11df524b95 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/nodeallocatableresource.go @@ -0,0 +1,65 @@ +/* +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 v1beta1 + +// NodeAllocatableResourceApplyConfiguration represents a declarative configuration of the NodeAllocatableResource type for use +// with apply. +// +// NodeAllocatableResource defines the translation between the DRA device/capacity +// units requested to the corresponding quantity of the node allocatable resource. +// At least one of Mapping or Overhead must be specified. Not specifying either is an invalid configuration. +type NodeAllocatableResourceApplyConfiguration struct { + // Mapping is used when the device directly models a node allocatable resource like standard CPU or memory + // (e.g., with a CPU DRA driver). The calculated quantity is accounted for exactly once per claim instance + // on the node. To prevent node cgroup isolation friction, the scheduler explicitly + // blocks sharing mapped device claims across multiple pods. + Mapping *NodeAllocatableMappingApplyConfiguration `json:"mapping,omitempty"` + // Overhead contains fields for modeling auxiliary overhead incurred on node allocatable resources + // when allocating devices that are not themselves modeling a node allocatable resource (e.g., host memory overhead for GPUs). + // Sharing overhead-mapped claims across multiple pods is allowed. The node allocatable overhead is accounted + // for individually for each pod referencing the claim. + // Overhead is always subtracted from the node's allocatable capacity for the resource, even when mapping + // is specified for the same resource. + // Eg: If a device models memory capacity per socket as a consumable capacity pool via Mapping (with CapacityKey), + // any overhead specified for the same resource will be subtracted from the node's general allocatable capacity + // and not from the per-socket capacity pool in Mapping. + Overhead *NodeAllocatableOverheadApplyConfiguration `json:"overhead,omitempty"` +} + +// NodeAllocatableResourceApplyConfiguration constructs a declarative configuration of the NodeAllocatableResource type for use with +// apply. +func NodeAllocatableResource() *NodeAllocatableResourceApplyConfiguration { + return &NodeAllocatableResourceApplyConfiguration{} +} + +// WithMapping sets the Mapping 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 Mapping field is set to the value of the last call. +func (b *NodeAllocatableResourceApplyConfiguration) WithMapping(value *NodeAllocatableMappingApplyConfiguration) *NodeAllocatableResourceApplyConfiguration { + b.Mapping = value + return b +} + +// WithOverhead sets the Overhead 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 Overhead field is set to the value of the last call. +func (b *NodeAllocatableResourceApplyConfiguration) WithOverhead(value *NodeAllocatableOverheadApplyConfiguration) *NodeAllocatableResourceApplyConfiguration { + b.Overhead = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/nodeallocatableresourcemapping.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/nodeallocatableresourcemapping.go deleted file mode 100644 index 5cdc2c7512..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/nodeallocatableresourcemapping.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -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 v1beta1 - -import ( - resourcev1beta1 "k8s.io/api/resource/v1beta1" - resource "k8s.io/apimachinery/pkg/api/resource" -) - -// NodeAllocatableResourceMappingApplyConfiguration represents a declarative configuration of the NodeAllocatableResourceMapping type for use -// with apply. -// -// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity -// units requested to the corresponding quantity of the node allocatable resource. -type NodeAllocatableResourceMappingApplyConfiguration struct { - // CapacityKey references a capacity name defined as a key in the - // `spec.devices[*].capacity` map. When this field is set, the value associated with - // this key in the `status.allocation.devices.results[*].consumedCapacity` map - // (for a specific claim allocation) determines the base quantity for - // the node allocatable resource. If `allocationMultiplier` is also set, it is - // multiplied with the base quantity. - // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", - // and this field is set to "dra.example.com/memory", then for a claim allocation - // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the - // node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should - // be omitted or set to "1". - CapacityKey *resourcev1beta1.QualifiedName `json:"capacityKey,omitempty"` - // AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. - // It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. - // 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim. - // a. A DRA driver representing each CPU core as a device would have - // {ResourceName: "cpu", allocationMultiplier: "2"} in its - // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim, - // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. - // b. A GPU device that needs additional node memory per GPU allocation would - // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated - // GPU device instance of this type will account for 2Gi of memory. - // - // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed. - // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`. - // For example, if a Device's capacity "dra.example.com/cores" is consumed, - // and each "core" provides 2 "cpu"s, the mapping would be: - // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. - // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. - AllocationMultiplier *resource.Quantity `json:"allocationMultiplier,omitempty"` -} - -// NodeAllocatableResourceMappingApplyConfiguration constructs a declarative configuration of the NodeAllocatableResourceMapping type for use with -// apply. -func NodeAllocatableResourceMapping() *NodeAllocatableResourceMappingApplyConfiguration { - return &NodeAllocatableResourceMappingApplyConfiguration{} -} - -// WithCapacityKey sets the CapacityKey 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 CapacityKey field is set to the value of the last call. -func (b *NodeAllocatableResourceMappingApplyConfiguration) WithCapacityKey(value resourcev1beta1.QualifiedName) *NodeAllocatableResourceMappingApplyConfiguration { - b.CapacityKey = &value - return b -} - -// WithAllocationMultiplier sets the AllocationMultiplier 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 AllocationMultiplier field is set to the value of the last call. -func (b *NodeAllocatableResourceMappingApplyConfiguration) WithAllocationMultiplier(value resource.Quantity) *NodeAllocatableResourceMappingApplyConfiguration { - b.AllocationMultiplier = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourceclaim.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourceclaim.go index aaeaf687d6..a617fecd84 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourceclaim.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourceclaim.go @@ -39,7 +39,7 @@ import ( // This is an alpha type and requires enabling the DynamicResourceAllocation // feature gate. type ResourceClaimApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Spec describes what is being requested and how to configure it. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourceclaimtemplate.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourceclaimtemplate.go index fe42003266..4c1eba7cd9 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourceclaimtemplate.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourceclaimtemplate.go @@ -35,7 +35,7 @@ import ( // This is an alpha type and requires enabling the DynamicResourceAllocation // feature gate. type ResourceClaimTemplateApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Describes the ResourceClaim that is to be generated. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourcepool.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourcepool.go index eff9e042c8..3452dd18ba 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourcepool.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourcepool.go @@ -25,6 +25,8 @@ package v1beta1 type ResourcePoolApplyConfiguration struct { // Name is used to identify the pool. For node-local devices, this // is often the node name, but this is not required. + // A field selector can be used to list only ResourceSlice objects + // belonging to a certain pool. // // It must not be longer than 253 characters and must consist of one or more DNS sub-domains // separated by slashes. This field is immutable. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourceslice.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourceslice.go index c9ec6a7b74..c6b5fc59c6 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourceslice.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourceslice.go @@ -55,7 +55,7 @@ import ( // This is an alpha type and requires enabling the DynamicResourceAllocation // feature gate. type ResourceSliceApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Contains the information published by the driver. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourceslicespec.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourceslicespec.go index 2302486433..d463e72383 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourceslicespec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/resourceslicespec.go @@ -19,6 +19,7 @@ limitations under the License. package v1beta1 import ( + resourcev1beta1 "k8s.io/api/resource/v1beta1" v1 "k8s.io/client-go/applyconfigurations/core/v1" ) @@ -82,6 +83,28 @@ type ResourceSliceSpecApplyConfiguration struct { // // The maximum number of counter sets is 8. SharedCounters []CounterSetApplyConfiguration `json:"sharedCounters,omitempty"` + // PartitionTypeAttribute names a string device attribute (by fully + // qualified name, e.g. "gpu.example.com/profile") whose value labels + // each device with its partition type, such as "Full" or "Half" for a + // MIG-style GPU. + // + // When set, every partitionable device in the slice must carry the attribute + // and devices sharing a value must share the same ConsumesCounters cost. + PartitionTypeAttribute *resourcev1beta1.FullyQualifiedName `json:"partitionTypeAttribute,omitempty"` + // SkipNodeOperations lists node-local resource operations (gRPC calls) + // that will be skipped for the devices in this slice when determining whether + // operations are necessary on the node. If all allocated devices for a driver in + // a claim skip an operation, that gRPC call will be skipped. Valid values are: + // + // - "NodePrepareResources": NodePrepareResources gRPC calls are skipped. This + // value cannot be specified unless "NodeUnprepareResources" is also listed + // (or "*" is specified). + // - "NodeUnprepareResources": NodeUnprepareResources gRPC calls are skipped. + // - "*": All node-local resource operations are skipped. + // + // Other values may be added in the future. The kubelet must ignore unknown + // values. + SkipNodeOperations []resourcev1beta1.SkipNodeOperation `json:"skipNodeOperations,omitempty"` } // ResourceSliceSpecApplyConfiguration constructs a declarative configuration of the ResourceSliceSpec type for use with @@ -163,3 +186,21 @@ func (b *ResourceSliceSpecApplyConfiguration) WithSharedCounters(values ...*Coun } return b } + +// WithPartitionTypeAttribute sets the PartitionTypeAttribute 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 PartitionTypeAttribute field is set to the value of the last call. +func (b *ResourceSliceSpecApplyConfiguration) WithPartitionTypeAttribute(value resourcev1beta1.FullyQualifiedName) *ResourceSliceSpecApplyConfiguration { + b.PartitionTypeAttribute = &value + return b +} + +// WithSkipNodeOperations adds the given value to the SkipNodeOperations 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 SkipNodeOperations field. +func (b *ResourceSliceSpecApplyConfiguration) WithSkipNodeOperations(values ...resourcev1beta1.SkipNodeOperation) *ResourceSliceSpecApplyConfiguration { + for i := range values { + b.SkipNodeOperations = append(b.SkipNodeOperations, values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/capacityrequestpolicyrange.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/capacityrequestpolicyrange.go index bd9a734221..60e71b9045 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/capacityrequestpolicyrange.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/capacityrequestpolicyrange.go @@ -27,6 +27,13 @@ import ( // // CapacityRequestPolicyRange defines a valid range for consumable capacity values. // +// If the DRAFractionalCapacityRange feature gate is +// enabled and at least one of Min, Max, or Step is a fractional quantity (i.e. +// its value is not an integer), milli-unit arithmetic is used instead, +// supporting values with up to 3 decimal places (e.g. 100m = 0.1). +// The largest supported value then is 1000 times smaller compared to using 64-bit integers. +// Otherwise, all comparisons use 64-bit integer arithmetic via resource.Quantity.Value(). +// // - If the requested amount is less than Min, it is rounded up to the Min value. // - If Step is set and the requested amount is between Min and Max but not aligned with Step, // it will be rounded up to the next value equal to Min + (n * Step). diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/celdeviceselector.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/celdeviceselector.go index a184590ebe..73485f5029 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/celdeviceselector.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/celdeviceselector.go @@ -33,7 +33,7 @@ type CELDeviceSelectorApplyConfiguration struct { // - driver (string): the name of the driver which defines this device. // - attributes (map[string]object): the device's attributes, grouped by prefix // (e.g. device.attributes["dra.example.com"] evaluates to an object with all - // of the attributes which were prefixed by "dra.example.com". + // of the attributes which were prefixed by "dra.example.com"). // - capacity (map[string]object): the device's capacities, grouped by prefix. // - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device // (v1.34+ with the DRAConsumableCapacity feature enabled). @@ -66,6 +66,15 @@ type CELDeviceSelectorApplyConfiguration struct { // A robust expression should check for the existence of attributes // before referencing them. // + // Common errors: + // - "no such key": Use optional chaining (.? followed by orValue()) + // or guarding the check with has() for optional fields. + // See CEL Optional Types for details: + // https://pkg.go.dev/github.com/google/cel-go@v0.17.4/cel#OptionalTypes + // + // For more CEL expression syntax and examples, see: + // https://kubernetes.io/docs/reference/using-api/cel/ + // // For ease of use, the cel.bind() function is enabled, and can be used // to simplify expressions that access multiple attributes with the // same domain. For example: diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/device.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/device.go index b3985b0ca5..71e2440be7 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/device.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/device.go @@ -114,7 +114,7 @@ type DeviceApplyConfiguration struct { // If AllowMultipleAllocations is set to true, the device can be allocated more than once, // and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not. AllowMultipleAllocations *bool `json:"allowMultipleAllocations,omitempty"` - // NodeAllocatableResourceMappings defines the mapping of node resources + // NodeAllocatableResources defines the mapping of node resources // that are managed by the DRA driver exposing this device. This includes resources currently // reported in v1.Node `status.allocatable` that are not extended resources // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). @@ -125,7 +125,7 @@ type DeviceApplyConfiguration struct { // dependencies of an accelerator device. // The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). // Extended resource names are not permitted as keys. - NodeAllocatableResourceMappings map[corev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration `json:"nodeAllocatableResourceMappings,omitempty"` + NodeAllocatableResources map[corev1.ResourceName]NodeAllocatableResourceApplyConfiguration `json:"nodeAllocatableResources,omitempty"` } // DeviceApplyConfiguration constructs a declarative configuration of the Device type for use with @@ -256,16 +256,16 @@ func (b *DeviceApplyConfiguration) WithAllowMultipleAllocations(value bool) *Dev return b } -// WithNodeAllocatableResourceMappings puts the entries into the NodeAllocatableResourceMappings field in the declarative configuration +// WithNodeAllocatableResources puts the entries into the NodeAllocatableResources 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 NodeAllocatableResourceMappings field, -// overwriting an existing map entries in NodeAllocatableResourceMappings field with the same key. -func (b *DeviceApplyConfiguration) WithNodeAllocatableResourceMappings(entries map[corev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration) *DeviceApplyConfiguration { - if b.NodeAllocatableResourceMappings == nil && len(entries) > 0 { - b.NodeAllocatableResourceMappings = make(map[corev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration, len(entries)) +// If called multiple times, the entries provided by each call will be put on the NodeAllocatableResources field, +// overwriting an existing map entries in NodeAllocatableResources field with the same key. +func (b *DeviceApplyConfiguration) WithNodeAllocatableResources(entries map[corev1.ResourceName]NodeAllocatableResourceApplyConfiguration) *DeviceApplyConfiguration { + if b.NodeAllocatableResources == nil && len(entries) > 0 { + b.NodeAllocatableResources = make(map[corev1.ResourceName]NodeAllocatableResourceApplyConfiguration, len(entries)) } for k, v := range entries { - b.NodeAllocatableResourceMappings[k] = v + b.NodeAllocatableResources[k] = v } return b } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceallocationconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceallocationconfiguration.go index cbfb0c1f26..fb0c7e6bea 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceallocationconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceallocationconfiguration.go @@ -38,7 +38,7 @@ type DeviceAllocationConfigurationApplyConfiguration struct { // and may include the subrequest using the format
[/]. If just // the main request is given, the configuration applies to all subrequests. Requests []string `json:"requests,omitempty"` - DeviceConfigurationApplyConfiguration `json:",inline"` + DeviceConfigurationApplyConfiguration `json:""` } // DeviceAllocationConfigurationApplyConfiguration constructs a declarative configuration of the DeviceAllocationConfiguration type for use with diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclaimconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclaimconfiguration.go index 59a4f50f6b..34876049f7 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclaimconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclaimconfiguration.go @@ -30,7 +30,7 @@ type DeviceClaimConfigurationApplyConfiguration struct { // and may include the subrequest using the format
[/]. If just // the main request is given, the configuration applies to all subrequests. Requests []string `json:"requests,omitempty"` - DeviceConfigurationApplyConfiguration `json:",inline"` + DeviceConfigurationApplyConfiguration `json:""` } // DeviceClaimConfigurationApplyConfiguration constructs a declarative configuration of the DeviceClaimConfiguration type for use with diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclass.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclass.go index 439e03c6d0..687af43937 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclass.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclass.go @@ -38,7 +38,7 @@ import ( // This is an alpha type and requires enabling the DynamicResourceAllocation // feature gate. type DeviceClassApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Spec defines what can be allocated and how to configure it. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclassconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclassconfiguration.go index f668fcf865..6b3f04366c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclassconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclassconfiguration.go @@ -23,7 +23,7 @@ package v1beta2 // // DeviceClassConfiguration is used in DeviceClass. type DeviceClassConfigurationApplyConfiguration struct { - DeviceConfigurationApplyConfiguration `json:",inline"` + DeviceConfigurationApplyConfiguration `json:""` } // DeviceClassConfigurationApplyConfiguration constructs a declarative configuration of the DeviceClassConfiguration type for use with diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclassspec.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclassspec.go index 4ae2eaa29f..fc510c6ff1 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclassspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclassspec.go @@ -40,8 +40,6 @@ type DeviceClassSpecApplyConfiguration struct { // is picked to satisfy a pod's extended resource requests. // If two classes are created at the same time, then the name of the class // lexicographically sorted first is picked. - // - // This is a beta field. ExtendedResourceName *string `json:"extendedResourceName,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicecounterconsumption.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicecounterconsumption.go index f636ccdbd8..e94c38fc74 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicecounterconsumption.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicecounterconsumption.go @@ -31,6 +31,26 @@ type DeviceCounterConsumptionApplyConfiguration struct { // // The maximum number of counters is 32. Counters map[string]CounterApplyConfiguration `json:"counters,omitempty"` + // CompatibilityGroups is a list of opaque group names for + // this counter set consumption. + // + // Devices that consume counters from the same counter set may only be + // allocated at the same time ("co-allocated") if they all share at least + // one common group: the intersection of the CompatibilityGroups of all + // co-allocated devices on that counter set must be non-empty. Devices + // that consume from different counter sets are never compared via this + // field. + // + // An unset field, an explicit nil, and an empty list are equivalent and + // mean "no groups": such a device is only co-allocatable with sibling + // devices on the same counter set that also have no groups, and is never + // co-allocatable with a device that declares one or more groups. + // + // Group names are opaque and meaningful only within the + // publishing driver's pool. + // + // The maximum number of groups is 2, and the names must be unique. + CompatibilityGroups []string `json:"compatibilityGroups,omitempty"` } // DeviceCounterConsumptionApplyConfiguration constructs a declarative configuration of the DeviceCounterConsumption type for use with @@ -60,3 +80,13 @@ func (b *DeviceCounterConsumptionApplyConfiguration) WithCounters(entries map[st } return b } + +// WithCompatibilityGroups adds the given value to the CompatibilityGroups 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 CompatibilityGroups field. +func (b *DeviceCounterConsumptionApplyConfiguration) WithCompatibilityGroups(values ...string) *DeviceCounterConsumptionApplyConfiguration { + for i := range values { + b.CompatibilityGroups = append(b.CompatibilityGroups, values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicederivedattribute.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicederivedattribute.go new file mode 100644 index 0000000000..6b57b3f1a1 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicederivedattribute.go @@ -0,0 +1,95 @@ +/* +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 v1beta2 + +import ( + resourcev1beta2 "k8s.io/api/resource/v1beta2" +) + +// DeviceDerivedAttributeApplyConfiguration represents a declarative configuration of the DeviceDerivedAttribute type for use +// with apply. +// +// DeviceDerivedAttribute defines a derived attribute computed via CEL. +type DeviceDerivedAttributeApplyConfiguration struct { + // Name is the identifier for this derived attribute, used in constraints. + // + // It must be a DNS subdomain followed by a slash ("/") followed by a C identifier + // (e.g. "example.com/numaNode" or "derived/numaNode"). + // + // If the chosen name matches an existing physical attribute from a driver, + // the derived attribute's expression will shadow the physical attribute, + // and its evaluated value will be used in constraints instead. When the goal + // is to define a derived attribute that is only used within the ResourceClaim + // and not meant to shadow an existing attribute, use a domain prefix that + // no DRA driver should be using (e.g. "derived/myAttribute"). + // + // It is not valid to define a derived attribute that isn't used in at least + // one constraint. + Name *resourcev1beta2.FullyQualifiedName `json:"name,omitempty"` + // Expression is a CEL expression evaluated against each candidate device. + // The expression must evaluate to a primitive scalar (string, integer, + // boolean, or semver) or a list of these scalars ([]string, []int64, + // []bool, []semver) to act as a virtual grouping key. Any other return type + // is an error and causes CEL evaluation for the device to fail. + // + // The expression's input is an object named "device", which carries the + // same properties as in a CELDeviceSelector. + // + // When pod scheduling encounters CEL runtime errors (such as looking + // up an attribute that isn't defined) for some devices, it will abort + // allocation and fail scheduling for the Pod. Surfacing evaluation + // errors immediately prevents silent topology matching failures that are + // extremely hard to detect. A robust expression should, for example, check + // for the existence of attributes before referencing them to avoid + // runtime evaluation errors. + // + // The expression gets evaluated after a device has passed the other + // selector expressions for the request in which this expression is used. + // This allows writing expressions that are tailored towards the specific + // devices being requested (for example, by assuming the device is from a + // certain vendor and skipping those checks). + // + // The length of the expression must be smaller or equal to 10 Ki. The + // cost of evaluating it is also limited based on the estimated number + // of logical steps; the combined cost of all derived attributes in a + // claim is capped by a shared CEL cost budget. + Expression *string `json:"expression,omitempty"` +} + +// DeviceDerivedAttributeApplyConfiguration constructs a declarative configuration of the DeviceDerivedAttribute type for use with +// apply. +func DeviceDerivedAttribute() *DeviceDerivedAttributeApplyConfiguration { + return &DeviceDerivedAttributeApplyConfiguration{} +} + +// 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 *DeviceDerivedAttributeApplyConfiguration) WithName(value resourcev1beta2.FullyQualifiedName) *DeviceDerivedAttributeApplyConfiguration { + b.Name = &value + return b +} + +// WithExpression sets the Expression 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 Expression field is set to the value of the last call. +func (b *DeviceDerivedAttributeApplyConfiguration) WithExpression(value string) *DeviceDerivedAttributeApplyConfiguration { + b.Expression = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicerequestallocationresult.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicerequestallocationresult.go index a274e5706c..e80cd933ec 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicerequestallocationresult.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicerequestallocationresult.go @@ -95,6 +95,12 @@ type DeviceRequestAllocationResultApplyConfiguration struct { // This field is populated only for devices that allow multiple allocations. // All capacity entries are included, even if the consumed amount is zero. ConsumedCapacity map[resourcev1beta2.QualifiedName]resource.Quantity `json:"consumedCapacity,omitempty"` + // SkipNodeOperations lists node-local resource operations (gRPC calls) + // that will be skipped for this allocated device when determining whether + // operations are necessary on the node. If all allocated devices for a driver in + // a claim skip an operation, that gRPC call will be skipped. It is a copy of + // the ResourceSlice.spec.skipNodeOperations value at the time when the device was allocated. + SkipNodeOperations []resourcev1beta2.SkipNodeOperation `json:"skipNodeOperations,omitempty"` } // DeviceRequestAllocationResultApplyConfiguration constructs a declarative configuration of the DeviceRequestAllocationResult type for use with @@ -197,3 +203,13 @@ func (b *DeviceRequestAllocationResultApplyConfiguration) WithConsumedCapacity(e } return b } + +// WithSkipNodeOperations adds the given value to the SkipNodeOperations 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 SkipNodeOperations field. +func (b *DeviceRequestAllocationResultApplyConfiguration) WithSkipNodeOperations(values ...resourcev1beta2.SkipNodeOperation) *DeviceRequestAllocationResultApplyConfiguration { + for i := range values { + b.SkipNodeOperations = append(b.SkipNodeOperations, values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicesubrequest.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicesubrequest.go index d9f4a5cb57..f0c882185d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicesubrequest.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicesubrequest.go @@ -109,6 +109,27 @@ type DeviceSubRequestApplyConfiguration struct { // the request fails if there are devices that otherwise match the request, // and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request. Capacity *CapacityRequirementsApplyConfiguration `json:"capacity,omitempty"` + // DerivedAttributes defines a set of virtual attributes computed via CEL expressions + // for each candidate device. These virtual attributes can be referenced in + // `.devices.constraints` to align and match different devices (e.g., co-allocating + // a GPU and a NIC on the same NUMA node) even if their drivers publish different + // attributes. Derived attributes are not available via `device.attributes` + // in the CEL environment when evaluating selector expressions. + // + // Derived attributes allow you to extract, transform, or normalize topology + // information (such as extracting a NUMA index from a complex topology string or + // renaming a vendor-specific attribute) into a common virtual attribute name at + // scheduling time. The scheduler then evaluates these virtual attributes exactly + // like static attributes when matching constraints. + // + // Every derived attribute defined in this list must be referenced by at least one + // MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + // + // The maximum number of derived attributes is 32. + // + // This is an alpha field and requires enabling the DRADerivedAttributes + // feature gate. + DerivedAttributes []DeviceDerivedAttributeApplyConfiguration `json:"derivedAttributes,omitempty"` } // DeviceSubRequestApplyConfiguration constructs a declarative configuration of the DeviceSubRequest type for use with @@ -182,3 +203,16 @@ func (b *DeviceSubRequestApplyConfiguration) WithCapacity(value *CapacityRequire b.Capacity = value return b } + +// WithDerivedAttributes adds the given value to the DerivedAttributes 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 DerivedAttributes field. +func (b *DeviceSubRequestApplyConfiguration) WithDerivedAttributes(values ...*DeviceDerivedAttributeApplyConfiguration) *DeviceSubRequestApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithDerivedAttributes") + } + b.DerivedAttributes = append(b.DerivedAttributes, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintrule.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintrule.go index 18b2aca188..5e7a5a0cbb 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintrule.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintrule.go @@ -34,7 +34,7 @@ import ( // This has the same effect as if the taint was specified directly // in the ResourceSlice by the DRA driver. type DeviceTaintRuleApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Spec specifies the selector and one taint. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/exactdevicerequest.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/exactdevicerequest.go index bda1152701..b23786194d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/exactdevicerequest.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/exactdevicerequest.go @@ -107,6 +107,27 @@ type ExactDeviceRequestApplyConfiguration struct { // the request fails if there are devices that otherwise match the request, // and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request. Capacity *CapacityRequirementsApplyConfiguration `json:"capacity,omitempty"` + // DerivedAttributes defines a set of virtual attributes computed via CEL expressions + // for each candidate device. These virtual attributes can be referenced in + // `.devices.constraints` to align and match different devices (e.g., co-allocating + // a GPU and a NIC on the same NUMA node) even if their drivers publish different + // attributes. Derived attributes are not available via `device.attributes` + // in the CEL environment when evaluating selector expressions. + // + // Derived attributes allow you to extract, transform, or normalize topology + // information (such as extracting a NUMA index from a complex topology string or + // renaming a vendor-specific attribute) into a common virtual attribute name at + // scheduling time. The scheduler then evaluates these virtual attributes exactly + // like static attributes when matching constraints. + // + // Every derived attribute defined in this list must be referenced by at least one + // MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + // + // The maximum number of derived attributes is 32. + // + // This is an alpha field and requires enabling the DRADerivedAttributes + // feature gate. + DerivedAttributes []DeviceDerivedAttributeApplyConfiguration `json:"derivedAttributes,omitempty"` } // ExactDeviceRequestApplyConfiguration constructs a declarative configuration of the ExactDeviceRequest type for use with @@ -180,3 +201,16 @@ func (b *ExactDeviceRequestApplyConfiguration) WithCapacity(value *CapacityRequi b.Capacity = value return b } + +// WithDerivedAttributes adds the given value to the DerivedAttributes 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 DerivedAttributes field. +func (b *ExactDeviceRequestApplyConfiguration) WithDerivedAttributes(values ...*DeviceDerivedAttributeApplyConfiguration) *ExactDeviceRequestApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithDerivedAttributes") + } + b.DerivedAttributes = append(b.DerivedAttributes, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/nodeallocatablemapping.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/nodeallocatablemapping.go new file mode 100644 index 0000000000..50b4069736 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/nodeallocatablemapping.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta2 + +import ( + resourcev1beta2 "k8s.io/api/resource/v1beta2" + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// NodeAllocatableMappingApplyConfiguration represents a declarative configuration of the NodeAllocatableMapping type for use +// with apply. +// +// NodeAllocatableMapping defines how a DRA allocation directly translates into a node allocatable resource quantity. +// The mapping can be derived from either the count of allocated devices (via deviceMultiplier) or the specific capacity consumed (via capacityKey and capacityMultiplier). These options are mutually exclusive. +// Kubelet adds this mapped resource quantity from claim to both requests and limits at the pod-level cgroup, and to limits at the container-level cgroup for each container referencing the claim. +type NodeAllocatableMappingApplyConfiguration struct { + // CapacityKey references a capacity name defined as a key in the + // `spec.devices[*].capacity` map. When this field is set, the value associated with + // this key in the `status.allocation.devices.results[*].consumedCapacity` map + // (for a specific claim allocation) determines the base quantity for + // the node allocatable resource. `capacityMultiplier` must also be set and is + // multiplied with the base quantity. + // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", + // and this field is set to "dra.example.com/memory", then for a claim allocation + // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the + // node allocatable resource mapping will be "4Gi". + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. + CapacityKey *resourcev1beta2.QualifiedName `json:"capacityKey,omitempty"` + // CapacityMultiplier is used as a multiplier for the allocated capacity consumed. + // It is only valid if `capacityKey` is set. + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `capacityMultiplier`. + // For example, if a Device's capacity "dra.example.com/cores" is consumed, + // and each "core" provides 2 "cpu"s, the mapping would be: + // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", capacityMultiplier: "2"}. + // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. + CapacityMultiplier *resource.Quantity `json:"capacityMultiplier,omitempty"` + // DeviceMultiplier is used as a multiplier for the allocated device count in the claim. + // The final node allocatable resource amount is `deviceCount` * `deviceMultiplier`. + // For example, a DRA driver representing each cache complex (CCX) as a device would have + // {ResourceName: "cpu", deviceMultiplier: "8"} in its `nodeAllocatableResources`. + // If 2 devices (CCX) are allocated to the claim, 2 * 8 = 16 CPUs would be considered as allocated. + // It is only valid when `capacityKey` and `capacityMultiplier` are not set. + DeviceMultiplier *resource.Quantity `json:"deviceMultiplier,omitempty"` +} + +// NodeAllocatableMappingApplyConfiguration constructs a declarative configuration of the NodeAllocatableMapping type for use with +// apply. +func NodeAllocatableMapping() *NodeAllocatableMappingApplyConfiguration { + return &NodeAllocatableMappingApplyConfiguration{} +} + +// WithCapacityKey sets the CapacityKey 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 CapacityKey field is set to the value of the last call. +func (b *NodeAllocatableMappingApplyConfiguration) WithCapacityKey(value resourcev1beta2.QualifiedName) *NodeAllocatableMappingApplyConfiguration { + b.CapacityKey = &value + return b +} + +// WithCapacityMultiplier sets the CapacityMultiplier 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 CapacityMultiplier field is set to the value of the last call. +func (b *NodeAllocatableMappingApplyConfiguration) WithCapacityMultiplier(value resource.Quantity) *NodeAllocatableMappingApplyConfiguration { + b.CapacityMultiplier = &value + return b +} + +// WithDeviceMultiplier sets the DeviceMultiplier 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 DeviceMultiplier field is set to the value of the last call. +func (b *NodeAllocatableMappingApplyConfiguration) WithDeviceMultiplier(value resource.Quantity) *NodeAllocatableMappingApplyConfiguration { + b.DeviceMultiplier = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/nodeallocatableoverhead.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/nodeallocatableoverhead.go new file mode 100644 index 0000000000..49205e8997 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/nodeallocatableoverhead.go @@ -0,0 +1,67 @@ +/* +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 v1beta2 + +import ( + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// NodeAllocatableOverheadApplyConfiguration represents a declarative configuration of the NodeAllocatableOverhead type for use +// with apply. +// +// NodeAllocatableOverhead defines auxiliary resource overheads incurred when allocating a device. +// Overheads can be specified as a fixed cost per pod referencing the claim, a variable cost per container reference, or both. +// Kubelet accounts for this overhead by adding it to both the pod-level and container-level cgroups of referencing containers. +type NodeAllocatableOverheadApplyConfiguration struct { + // PerPod is overhead applied once per pod referencing the claim on this node. + // This is a flat overhead incurred for every pod referencing the claim. + PerPod *resource.Quantity `json:"perPod,omitempty"` + // PerContainer is applied per container reference to the claim. + // This models overhead scaling linearly with the number of containers actively using the device. + // When both PerPod and PerContainer are specified, the total overhead allocated for each pod referencing + // the claim is computed as: + // Quantity = PerPod + (PerContainer * NumReferences) + // Kubelet accounts for this overhead in cgroups: + // - Pod-level cgroup (requests and limits): Kubelet adds PerPod + (PerContainer * NumReferences). + // - Container-level cgroup (limits only): Kubelet adds PerPod + PerContainer for each referencing container. + // This allows any single container to access the pod-level overhead, while the parent cgroup caps the total usage to account for PerPod exactly once. + PerContainer *resource.Quantity `json:"perContainer,omitempty"` +} + +// NodeAllocatableOverheadApplyConfiguration constructs a declarative configuration of the NodeAllocatableOverhead type for use with +// apply. +func NodeAllocatableOverhead() *NodeAllocatableOverheadApplyConfiguration { + return &NodeAllocatableOverheadApplyConfiguration{} +} + +// WithPerPod sets the PerPod 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 PerPod field is set to the value of the last call. +func (b *NodeAllocatableOverheadApplyConfiguration) WithPerPod(value resource.Quantity) *NodeAllocatableOverheadApplyConfiguration { + b.PerPod = &value + return b +} + +// WithPerContainer sets the PerContainer 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 PerContainer field is set to the value of the last call. +func (b *NodeAllocatableOverheadApplyConfiguration) WithPerContainer(value resource.Quantity) *NodeAllocatableOverheadApplyConfiguration { + b.PerContainer = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/nodeallocatableresource.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/nodeallocatableresource.go new file mode 100644 index 0000000000..ce116f3d47 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/nodeallocatableresource.go @@ -0,0 +1,65 @@ +/* +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 v1beta2 + +// NodeAllocatableResourceApplyConfiguration represents a declarative configuration of the NodeAllocatableResource type for use +// with apply. +// +// NodeAllocatableResource defines the translation between the DRA device/capacity +// units requested to the corresponding quantity of the node allocatable resource. +// At least one of Mapping or Overhead must be specified. Not specifying either is an invalid configuration. +type NodeAllocatableResourceApplyConfiguration struct { + // Mapping is used when the device directly models a node allocatable resource like standard CPU or memory + // (e.g., with a CPU DRA driver). The calculated quantity is accounted for exactly once per claim instance + // on the node. To prevent node cgroup isolation friction, the scheduler explicitly + // blocks sharing mapped device claims across multiple pods. + Mapping *NodeAllocatableMappingApplyConfiguration `json:"mapping,omitempty"` + // Overhead contains fields for modeling auxiliary overhead incurred on node allocatable resources + // when allocating devices that are not themselves modeling a node allocatable resource (e.g., host memory overhead for GPUs). + // Sharing overhead-mapped claims across multiple pods is allowed. The node allocatable overhead is accounted + // for individually for each pod referencing the claim. + // Overhead is always subtracted from the node's allocatable capacity for the resource, even when mapping + // is specified for the same resource. + // Eg: If a device models memory capacity per socket as a consumable capacity pool via Mapping (with CapacityKey), + // any overhead specified for the same resource will be subtracted from the node's general allocatable capacity + // and not from the per-socket capacity pool in Mapping. + Overhead *NodeAllocatableOverheadApplyConfiguration `json:"overhead,omitempty"` +} + +// NodeAllocatableResourceApplyConfiguration constructs a declarative configuration of the NodeAllocatableResource type for use with +// apply. +func NodeAllocatableResource() *NodeAllocatableResourceApplyConfiguration { + return &NodeAllocatableResourceApplyConfiguration{} +} + +// WithMapping sets the Mapping 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 Mapping field is set to the value of the last call. +func (b *NodeAllocatableResourceApplyConfiguration) WithMapping(value *NodeAllocatableMappingApplyConfiguration) *NodeAllocatableResourceApplyConfiguration { + b.Mapping = value + return b +} + +// WithOverhead sets the Overhead 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 Overhead field is set to the value of the last call. +func (b *NodeAllocatableResourceApplyConfiguration) WithOverhead(value *NodeAllocatableOverheadApplyConfiguration) *NodeAllocatableResourceApplyConfiguration { + b.Overhead = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/nodeallocatableresourcemapping.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/nodeallocatableresourcemapping.go deleted file mode 100644 index b1490b5e75..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/nodeallocatableresourcemapping.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -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 v1beta2 - -import ( - resourcev1beta2 "k8s.io/api/resource/v1beta2" - resource "k8s.io/apimachinery/pkg/api/resource" -) - -// NodeAllocatableResourceMappingApplyConfiguration represents a declarative configuration of the NodeAllocatableResourceMapping type for use -// with apply. -// -// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity -// units requested to the corresponding quantity of the node allocatable resource. -type NodeAllocatableResourceMappingApplyConfiguration struct { - // CapacityKey references a capacity name defined as a key in the - // `spec.devices[*].capacity` map. When this field is set, the value associated with - // this key in the `status.allocation.devices.results[*].consumedCapacity` map - // (for a specific claim allocation) determines the base quantity for - // the node allocatable resource. If `allocationMultiplier` is also set, it is - // multiplied with the base quantity. - // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", - // and this field is set to "dra.example.com/memory", then for a claim allocation - // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the - // node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should - // be omitted or set to "1". - CapacityKey *resourcev1beta2.QualifiedName `json:"capacityKey,omitempty"` - // AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. - // It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. - // 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim. - // a. A DRA driver representing each CPU core as a device would have - // {ResourceName: "cpu", allocationMultiplier: "2"} in its - // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim, - // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. - // b. A GPU device that needs additional node memory per GPU allocation would - // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated - // GPU device instance of this type will account for 2Gi of memory. - // - // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed. - // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`. - // For example, if a Device's capacity "dra.example.com/cores" is consumed, - // and each "core" provides 2 "cpu"s, the mapping would be: - // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. - // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. - AllocationMultiplier *resource.Quantity `json:"allocationMultiplier,omitempty"` -} - -// NodeAllocatableResourceMappingApplyConfiguration constructs a declarative configuration of the NodeAllocatableResourceMapping type for use with -// apply. -func NodeAllocatableResourceMapping() *NodeAllocatableResourceMappingApplyConfiguration { - return &NodeAllocatableResourceMappingApplyConfiguration{} -} - -// WithCapacityKey sets the CapacityKey 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 CapacityKey field is set to the value of the last call. -func (b *NodeAllocatableResourceMappingApplyConfiguration) WithCapacityKey(value resourcev1beta2.QualifiedName) *NodeAllocatableResourceMappingApplyConfiguration { - b.CapacityKey = &value - return b -} - -// WithAllocationMultiplier sets the AllocationMultiplier 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 AllocationMultiplier field is set to the value of the last call. -func (b *NodeAllocatableResourceMappingApplyConfiguration) WithAllocationMultiplier(value resource.Quantity) *NodeAllocatableResourceMappingApplyConfiguration { - b.AllocationMultiplier = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourceclaim.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourceclaim.go index e35d087cd6..7b8e86139e 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourceclaim.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourceclaim.go @@ -39,7 +39,7 @@ import ( // This is an alpha type and requires enabling the DynamicResourceAllocation // feature gate. type ResourceClaimApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Spec describes what is being requested and how to configure it. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourceclaimtemplate.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourceclaimtemplate.go index 999521cee2..35e5adbdfc 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourceclaimtemplate.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourceclaimtemplate.go @@ -35,7 +35,7 @@ import ( // This is an alpha type and requires enabling the DynamicResourceAllocation // feature gate. type ResourceClaimTemplateApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Describes the ResourceClaim that is to be generated. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourcepool.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourcepool.go index f5b0c9b618..4d631c3976 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourcepool.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourcepool.go @@ -25,6 +25,8 @@ package v1beta2 type ResourcePoolApplyConfiguration struct { // Name is used to identify the pool. For node-local devices, this // is often the node name, but this is not required. + // A field selector can be used to list only ResourceSlice objects + // belonging to a certain pool. // // It must not be longer than 253 characters and must consist of one or more DNS sub-domains // separated by slashes. This field is immutable. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourceslice.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourceslice.go index dbbe7b2ea2..89eae2d216 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourceslice.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourceslice.go @@ -55,7 +55,7 @@ import ( // This is an alpha type and requires enabling the DynamicResourceAllocation // feature gate. type ResourceSliceApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Contains the information published by the driver. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourceslicespec.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourceslicespec.go index 2efc7d0750..cdd52c111a 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourceslicespec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/resourceslicespec.go @@ -19,6 +19,7 @@ limitations under the License. package v1beta2 import ( + resourcev1beta2 "k8s.io/api/resource/v1beta2" v1 "k8s.io/client-go/applyconfigurations/core/v1" ) @@ -82,6 +83,28 @@ type ResourceSliceSpecApplyConfiguration struct { // // The maximum number of counter sets is 8. SharedCounters []CounterSetApplyConfiguration `json:"sharedCounters,omitempty"` + // PartitionTypeAttribute names a string device attribute (by fully + // qualified name, e.g. "gpu.example.com/profile") whose value labels + // each device with its partition type, such as "Full" or "Half" for a + // MIG-style GPU. + // + // When set, every partitionable device in the slice must carry the attribute + // and devices sharing a value must share the same ConsumesCounters cost. + PartitionTypeAttribute *resourcev1beta2.FullyQualifiedName `json:"partitionTypeAttribute,omitempty"` + // SkipNodeOperations lists node-local resource operations (gRPC calls) + // that will be skipped for the devices in this slice when determining whether + // operations are necessary on the node. If all allocated devices for a driver in + // a claim skip an operation, that gRPC call will be skipped. Valid values are: + // + // - "NodePrepareResources": NodePrepareResources gRPC calls are skipped. This + // value cannot be specified unless "NodeUnprepareResources" is also listed + // (or "*" is specified). + // - "NodeUnprepareResources": NodeUnprepareResources gRPC calls are skipped. + // - "*": All node-local resource operations are skipped. + // + // Other values may be added in the future. The kubelet must ignore unknown + // values. + SkipNodeOperations []resourcev1beta2.SkipNodeOperation `json:"skipNodeOperations,omitempty"` } // ResourceSliceSpecApplyConfiguration constructs a declarative configuration of the ResourceSliceSpec type for use with @@ -163,3 +186,21 @@ func (b *ResourceSliceSpecApplyConfiguration) WithSharedCounters(values ...*Coun } return b } + +// WithPartitionTypeAttribute sets the PartitionTypeAttribute 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 PartitionTypeAttribute field is set to the value of the last call. +func (b *ResourceSliceSpecApplyConfiguration) WithPartitionTypeAttribute(value resourcev1beta2.FullyQualifiedName) *ResourceSliceSpecApplyConfiguration { + b.PartitionTypeAttribute = &value + return b +} + +// WithSkipNodeOperations adds the given value to the SkipNodeOperations 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 SkipNodeOperations field. +func (b *ResourceSliceSpecApplyConfiguration) WithSkipNodeOperations(values ...resourcev1beta2.SkipNodeOperation) *ResourceSliceSpecApplyConfiguration { + for i := range values { + b.SkipNodeOperations = append(b.SkipNodeOperations, values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1/priorityclass.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1/priorityclass.go index 4056dcdd2f..b8612d6cbb 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1/priorityclass.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1/priorityclass.go @@ -34,8 +34,8 @@ import ( // PriorityClass defines mapping from a priority class name to the priority // integer value. The value can be any valid integer. type PriorityClassApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // value represents the integer value of this priority class. This is the actual priority that pods diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgrouptemplatereference.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgrouptemplatereference.go deleted file mode 100644 index f8b1f61ffc..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgrouptemplatereference.go +++ /dev/null @@ -1,44 +0,0 @@ -/* -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 v1alpha2 - -// PodGroupTemplateReferenceApplyConfiguration represents a declarative configuration of the PodGroupTemplateReference type for use -// with apply. -// -// PodGroupTemplateReference references a PodGroup template defined in some object (e.g. Workload). -// Exactly one reference must be set. -type PodGroupTemplateReferenceApplyConfiguration struct { - // Workload references the PodGroupTemplate within the Workload object that was used to create - // the PodGroup. - Workload *WorkloadPodGroupTemplateReferenceApplyConfiguration `json:"workload,omitempty"` -} - -// PodGroupTemplateReferenceApplyConfiguration constructs a declarative configuration of the PodGroupTemplateReference type for use with -// apply. -func PodGroupTemplateReference() *PodGroupTemplateReferenceApplyConfiguration { - return &PodGroupTemplateReferenceApplyConfiguration{} -} - -// WithWorkload sets the Workload 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 Workload field is set to the value of the last call. -func (b *PodGroupTemplateReferenceApplyConfiguration) WithWorkload(value *WorkloadPodGroupTemplateReferenceApplyConfiguration) *PodGroupTemplateReferenceApplyConfiguration { - b.Workload = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workloadpodgrouptemplatereference.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workloadpodgrouptemplatereference.go deleted file mode 100644 index ff3ab06c8d..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workloadpodgrouptemplatereference.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -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 v1alpha2 - -// WorkloadPodGroupTemplateReferenceApplyConfiguration represents a declarative configuration of the WorkloadPodGroupTemplateReference type for use -// with apply. -// -// WorkloadPodGroupTemplateReference references the PodGroupTemplate within the Workload object. -type WorkloadPodGroupTemplateReferenceApplyConfiguration struct { - // WorkloadName defines the name of the Workload object. - WorkloadName *string `json:"workloadName,omitempty"` - // PodGroupTemplateName defines the PodGroupTemplate name within the Workload object. - PodGroupTemplateName *string `json:"podGroupTemplateName,omitempty"` -} - -// WorkloadPodGroupTemplateReferenceApplyConfiguration constructs a declarative configuration of the WorkloadPodGroupTemplateReference type for use with -// apply. -func WorkloadPodGroupTemplateReference() *WorkloadPodGroupTemplateReferenceApplyConfiguration { - return &WorkloadPodGroupTemplateReferenceApplyConfiguration{} -} - -// WithWorkloadName sets the WorkloadName 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 WorkloadName field is set to the value of the last call. -func (b *WorkloadPodGroupTemplateReferenceApplyConfiguration) WithWorkloadName(value string) *WorkloadPodGroupTemplateReferenceApplyConfiguration { - b.WorkloadName = &value - return b -} - -// WithPodGroupTemplateName sets the PodGroupTemplateName 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 PodGroupTemplateName field is set to the value of the last call. -func (b *WorkloadPodGroupTemplateReferenceApplyConfiguration) WithPodGroupTemplateName(value string) *WorkloadPodGroupTemplateReferenceApplyConfiguration { - b.PodGroupTemplateName = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositedisruptionmode.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositedisruptionmode.go new file mode 100644 index 0000000000..70ff0162ac --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositedisruptionmode.go @@ -0,0 +1,57 @@ +/* +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 ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" +) + +// CompositeDisruptionModeApplyConfiguration represents a declarative configuration of the CompositeDisruptionMode type for use +// with apply. +// +// CompositeDisruptionMode defines how individual entities within a composite pod group can be disrupted. +// Exactly one mode must be set. +type CompositeDisruptionModeApplyConfiguration struct { + // single specifies that children groups can be disrupted independently from each other. + Single *schedulingv1alpha3.SingleCompositeDisruptionMode `json:"single,omitempty"` + // all specifies that all children groups can only be disrupted together. + All *schedulingv1alpha3.AllCompositeDisruptionMode `json:"all,omitempty"` +} + +// CompositeDisruptionModeApplyConfiguration constructs a declarative configuration of the CompositeDisruptionMode type for use with +// apply. +func CompositeDisruptionMode() *CompositeDisruptionModeApplyConfiguration { + return &CompositeDisruptionModeApplyConfiguration{} +} + +// WithSingle sets the Single 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 Single field is set to the value of the last call. +func (b *CompositeDisruptionModeApplyConfiguration) WithSingle(value schedulingv1alpha3.SingleCompositeDisruptionMode) *CompositeDisruptionModeApplyConfiguration { + b.Single = &value + return b +} + +// WithAll sets the All 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 All field is set to the value of the last call. +func (b *CompositeDisruptionModeApplyConfiguration) WithAll(value schedulingv1alpha3.AllCompositeDisruptionMode) *CompositeDisruptionModeApplyConfiguration { + b.All = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositegangschedulingpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositegangschedulingpolicy.go new file mode 100644 index 0000000000..c462b55a9e --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositegangschedulingpolicy.go @@ -0,0 +1,45 @@ +/* +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 + +// CompositeGangSchedulingPolicyApplyConfiguration represents a declarative configuration of the CompositeGangSchedulingPolicy type for use +// with apply. +// +// CompositeGangSchedulingPolicy indicates that the groups belonging to the composite group +// should be scheduled using all-or-nothing semantics. +type CompositeGangSchedulingPolicyApplyConfiguration struct { + // minGroupCount is the minimum number of child groups that must be schedulable + // or scheduled at the same time for the scheduler to admit the entire group. + // It must be a positive integer. + MinGroupCount *int32 `json:"minGroupCount,omitempty"` +} + +// CompositeGangSchedulingPolicyApplyConfiguration constructs a declarative configuration of the CompositeGangSchedulingPolicy type for use with +// apply. +func CompositeGangSchedulingPolicy() *CompositeGangSchedulingPolicyApplyConfiguration { + return &CompositeGangSchedulingPolicyApplyConfiguration{} +} + +// WithMinGroupCount sets the MinGroupCount 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 MinGroupCount field is set to the value of the last call. +func (b *CompositeGangSchedulingPolicyApplyConfiguration) WithMinGroupCount(value int32) *CompositeGangSchedulingPolicyApplyConfiguration { + b.MinGroupCount = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositepodgroup.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositepodgroup.go new file mode 100644 index 0000000000..e408c0a791 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositepodgroup.go @@ -0,0 +1,296 @@ +/* +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 ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + internal "k8s.io/client-go/applyconfigurations/internal" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// CompositePodGroupApplyConfiguration represents a declarative configuration of the CompositePodGroup type for use +// with apply. +// +// CompositePodGroup represents a runtime instance of pod groups grouped together. +// CompositePodGroups are created by workload controllers (LWS, JobSet, etc...) from +// Workload.compositePodGroupTemplates. +// CompositePodGroup API enablement is toggled by the CompositePodGroup feature gate. +type CompositePodGroupApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec defines the desired state of the CompositePodGroup. + Spec *CompositePodGroupSpecApplyConfiguration `json:"spec,omitempty"` + // status represents the current observed state of the CompositePodGroup. + Status *CompositePodGroupStatusApplyConfiguration `json:"status,omitempty"` +} + +// CompositePodGroup constructs a declarative configuration of the CompositePodGroup type for use with +// apply. +func CompositePodGroup(name, namespace string) *CompositePodGroupApplyConfiguration { + b := &CompositePodGroupApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("CompositePodGroup") + b.WithAPIVersion("scheduling.k8s.io/v1alpha3") + return b +} + +// ExtractCompositePodGroupFrom extracts the applied configuration owned by fieldManager from +// compositePodGroup for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// compositePodGroup must be a unmodified CompositePodGroup API object that was retrieved from the Kubernetes API. +// ExtractCompositePodGroupFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractCompositePodGroupFrom(compositePodGroup *schedulingv1alpha3.CompositePodGroup, fieldManager string, subresource string) (*CompositePodGroupApplyConfiguration, error) { + b := &CompositePodGroupApplyConfiguration{} + err := managedfields.ExtractInto(compositePodGroup, internal.Parser().Type("io.k8s.api.scheduling.v1alpha3.CompositePodGroup"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(compositePodGroup.Name) + b.WithNamespace(compositePodGroup.Namespace) + + b.WithKind("CompositePodGroup") + b.WithAPIVersion("scheduling.k8s.io/v1alpha3") + return b, nil +} + +// ExtractCompositePodGroup extracts the applied configuration owned by fieldManager from +// compositePodGroup. If no managedFields are found in compositePodGroup for fieldManager, a +// CompositePodGroupApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// compositePodGroup must be a unmodified CompositePodGroup API object that was retrieved from the Kubernetes API. +// ExtractCompositePodGroup provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractCompositePodGroup(compositePodGroup *schedulingv1alpha3.CompositePodGroup, fieldManager string) (*CompositePodGroupApplyConfiguration, error) { + return ExtractCompositePodGroupFrom(compositePodGroup, fieldManager, "") +} + +// ExtractCompositePodGroupStatus extracts the applied configuration owned by fieldManager from +// compositePodGroup for the status subresource. +func ExtractCompositePodGroupStatus(compositePodGroup *schedulingv1alpha3.CompositePodGroup, fieldManager string) (*CompositePodGroupApplyConfiguration, error) { + return ExtractCompositePodGroupFrom(compositePodGroup, fieldManager, "status") +} + +func (b CompositePodGroupApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind 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 Kind field is set to the value of the last call. +func (b *CompositePodGroupApplyConfiguration) WithKind(value string) *CompositePodGroupApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion 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 APIVersion field is set to the value of the last call. +func (b *CompositePodGroupApplyConfiguration) WithAPIVersion(value string) *CompositePodGroupApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// 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 *CompositePodGroupApplyConfiguration) WithName(value string) *CompositePodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call. +func (b *CompositePodGroupApplyConfiguration) WithGenerateName(value string) *CompositePodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call. +func (b *CompositePodGroupApplyConfiguration) WithNamespace(value string) *CompositePodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID 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 UID field is set to the value of the last call. +func (b *CompositePodGroupApplyConfiguration) WithUID(value types.UID) *CompositePodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call. +func (b *CompositePodGroupApplyConfiguration) WithResourceVersion(value string) *CompositePodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation 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 Generation field is set to the value of the last call. +func (b *CompositePodGroupApplyConfiguration) WithGeneration(value int64) *CompositePodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp 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 CreationTimestamp field is set to the value of the last call. +func (b *CompositePodGroupApplyConfiguration) WithCreationTimestamp(value metav1.Time) *CompositePodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp 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 DeletionTimestamp field is set to the value of the last call. +func (b *CompositePodGroupApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *CompositePodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds 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 DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *CompositePodGroupApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *CompositePodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels 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 Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *CompositePodGroupApplyConfiguration) WithLabels(entries map[string]string) *CompositePodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations 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 Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *CompositePodGroupApplyConfiguration) WithAnnotations(entries map[string]string) *CompositePodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences 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 OwnerReferences field. +func (b *CompositePodGroupApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *CompositePodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers 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 Finalizers field. +func (b *CompositePodGroupApplyConfiguration) WithFinalizers(values ...string) *CompositePodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *CompositePodGroupApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec 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 Spec field is set to the value of the last call. +func (b *CompositePodGroupApplyConfiguration) WithSpec(value *CompositePodGroupSpecApplyConfiguration) *CompositePodGroupApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status 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 Status field is set to the value of the last call. +func (b *CompositePodGroupApplyConfiguration) WithStatus(value *CompositePodGroupStatusApplyConfiguration) *CompositePodGroupApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *CompositePodGroupApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *CompositePodGroupApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *CompositePodGroupApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *CompositePodGroupApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositepodgroupschedulingconstraints.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositepodgroupschedulingconstraints.go new file mode 100644 index 0000000000..4c6fe983c0 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositepodgroupschedulingconstraints.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 v1alpha3 + +// CompositePodGroupSchedulingConstraintsApplyConfiguration represents a declarative configuration of the CompositePodGroupSchedulingConstraints type for use +// with apply. +// +// CompositePodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a CompositePodGroup. +type CompositePodGroupSchedulingConstraintsApplyConfiguration struct { + // topology defines the topology constraints for the composite pod group. + // Currently only a single topology constraint can be specified. This may change in the future. + Topology []TopologyConstraintApplyConfiguration `json:"topology,omitempty"` +} + +// CompositePodGroupSchedulingConstraintsApplyConfiguration constructs a declarative configuration of the CompositePodGroupSchedulingConstraints type for use with +// apply. +func CompositePodGroupSchedulingConstraints() *CompositePodGroupSchedulingConstraintsApplyConfiguration { + return &CompositePodGroupSchedulingConstraintsApplyConfiguration{} +} + +// WithTopology adds the given value to the Topology 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 Topology field. +func (b *CompositePodGroupSchedulingConstraintsApplyConfiguration) WithTopology(values ...*TopologyConstraintApplyConfiguration) *CompositePodGroupSchedulingConstraintsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithTopology") + } + b.Topology = append(b.Topology, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositepodgroupschedulingpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositepodgroupschedulingpolicy.go new file mode 100644 index 0000000000..c98be7fbe3 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositepodgroupschedulingpolicy.go @@ -0,0 +1,59 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" +) + +// CompositePodGroupSchedulingPolicyApplyConfiguration represents a declarative configuration of the CompositePodGroupSchedulingPolicy type for use +// with apply. +// +// CompositePodGroupSchedulingPolicy defines the scheduling configuration for a CompositePodGroup. +// Exactly one policy must be set. +type CompositePodGroupSchedulingPolicyApplyConfiguration struct { + // basic specifies that the groups of this composite group should be scheduled independently. + // This field is immutable. + Basic *schedulingv1alpha3.CompositeBasicSchedulingPolicy `json:"basic,omitempty"` + // gang specifies that the groups of this composite group should be scheduled using + // all-or-nothing semantics. + Gang *CompositeGangSchedulingPolicyApplyConfiguration `json:"gang,omitempty"` +} + +// CompositePodGroupSchedulingPolicyApplyConfiguration constructs a declarative configuration of the CompositePodGroupSchedulingPolicy type for use with +// apply. +func CompositePodGroupSchedulingPolicy() *CompositePodGroupSchedulingPolicyApplyConfiguration { + return &CompositePodGroupSchedulingPolicyApplyConfiguration{} +} + +// WithBasic sets the Basic 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 Basic field is set to the value of the last call. +func (b *CompositePodGroupSchedulingPolicyApplyConfiguration) WithBasic(value schedulingv1alpha3.CompositeBasicSchedulingPolicy) *CompositePodGroupSchedulingPolicyApplyConfiguration { + b.Basic = &value + return b +} + +// WithGang sets the Gang 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 Gang field is set to the value of the last call. +func (b *CompositePodGroupSchedulingPolicyApplyConfiguration) WithGang(value *CompositeGangSchedulingPolicyApplyConfiguration) *CompositePodGroupSchedulingPolicyApplyConfiguration { + b.Gang = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositepodgroupspec.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositepodgroupspec.go new file mode 100644 index 0000000000..16bc538a54 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositepodgroupspec.go @@ -0,0 +1,144 @@ +/* +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 ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" +) + +// CompositePodGroupSpecApplyConfiguration represents a declarative configuration of the CompositePodGroupSpec type for use +// with apply. +// +// CompositePodGroupSpec defines the desired state of CompositePodGroup. +type CompositePodGroupSpecApplyConfiguration struct { + // parentCompositePodGroupName contains the name of the parent composite pod group + // within the same namespace as this composite pod group. It must be a DNS name. + // If it's nil, then this composite pod group is a root of a workload's hierarchy. + // This field is immutable. + ParentCompositePodGroupName *string `json:"parentCompositePodGroupName,omitempty"` + // workloadRef references an optional CompositePodGroup template within the + // Workload object that was used to create the CompositePodGroup. + // This field is required. + // This field is immutable. + WorkloadRef *WorkloadReferenceApplyConfiguration `json:"workloadRef,omitempty"` + // schedulingPolicy defines the scheduling policy for this instance of the CompositePodGroup. + // Controllers are expected to fill this field by copying it from a CompositePodGroupTemplate. + // This field is immutable. + SchedulingPolicy *CompositePodGroupSchedulingPolicyApplyConfiguration `json:"schedulingPolicy,omitempty"` + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this CompositePodGroup. + // Controllers are expected to fill this field by copying it from a CompositePodGroupTemplate. + // This field is immutable. + SchedulingConstraints *CompositePodGroupSchedulingConstraintsApplyConfiguration `json:"schedulingConstraints,omitempty"` + // disruptionMode defines the mode in which a given CompositePodGroup can be disrupted. + // Controllers are expected to fill this field by copying it from a CompositePodGroupTemplate. + // One of Single, All. Defaults to Single if unset. + // This field is immutable. + DisruptionMode *CompositeDisruptionModeApplyConfiguration `json:"disruptionMode,omitempty"` + // priorityClassName defines the priority that should be considered when scheduling this CompositePodGroup. + // Controllers are expected to fill this field by copying it from a CompositePodGroupTemplate. + // If left unspecified, it is validated and resolved similarly to the PriorityClassName field in Pods + // (i.e. if no priority class is specified, admission control can set this to the global default + // priority class if it exists. Otherwise, the composite pod group's priority will be zero). + // This field is immutable. + PriorityClassName *string `json:"priorityClassName,omitempty"` + // priority is the value of priority of this composite pod group. Various system components + // use this field to find the priority of the composite pod group. When Priority Admission + // Controller is enabled, it prevents users from setting this field. The admission + // controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + Priority *int32 `json:"priority,omitempty"` + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. + // When Priority Admission Controller is enabled, it populates this field from PriorityClassName, + // and defaults to PreemptLowerPriority if value is unset in PriorityClass. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + PreemptionPolicy *schedulingv1alpha3.PreemptionPolicy `json:"preemptionPolicy,omitempty"` +} + +// CompositePodGroupSpecApplyConfiguration constructs a declarative configuration of the CompositePodGroupSpec type for use with +// apply. +func CompositePodGroupSpec() *CompositePodGroupSpecApplyConfiguration { + return &CompositePodGroupSpecApplyConfiguration{} +} + +// WithParentCompositePodGroupName sets the ParentCompositePodGroupName 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 ParentCompositePodGroupName field is set to the value of the last call. +func (b *CompositePodGroupSpecApplyConfiguration) WithParentCompositePodGroupName(value string) *CompositePodGroupSpecApplyConfiguration { + b.ParentCompositePodGroupName = &value + return b +} + +// WithWorkloadRef sets the WorkloadRef 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 WorkloadRef field is set to the value of the last call. +func (b *CompositePodGroupSpecApplyConfiguration) WithWorkloadRef(value *WorkloadReferenceApplyConfiguration) *CompositePodGroupSpecApplyConfiguration { + b.WorkloadRef = value + return b +} + +// WithSchedulingPolicy sets the SchedulingPolicy 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 SchedulingPolicy field is set to the value of the last call. +func (b *CompositePodGroupSpecApplyConfiguration) WithSchedulingPolicy(value *CompositePodGroupSchedulingPolicyApplyConfiguration) *CompositePodGroupSpecApplyConfiguration { + b.SchedulingPolicy = value + return b +} + +// WithSchedulingConstraints sets the SchedulingConstraints 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 SchedulingConstraints field is set to the value of the last call. +func (b *CompositePodGroupSpecApplyConfiguration) WithSchedulingConstraints(value *CompositePodGroupSchedulingConstraintsApplyConfiguration) *CompositePodGroupSpecApplyConfiguration { + b.SchedulingConstraints = value + return b +} + +// WithDisruptionMode sets the DisruptionMode 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 DisruptionMode field is set to the value of the last call. +func (b *CompositePodGroupSpecApplyConfiguration) WithDisruptionMode(value *CompositeDisruptionModeApplyConfiguration) *CompositePodGroupSpecApplyConfiguration { + b.DisruptionMode = value + return b +} + +// WithPriorityClassName sets the PriorityClassName 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 PriorityClassName field is set to the value of the last call. +func (b *CompositePodGroupSpecApplyConfiguration) WithPriorityClassName(value string) *CompositePodGroupSpecApplyConfiguration { + b.PriorityClassName = &value + return b +} + +// WithPriority sets the Priority 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 Priority field is set to the value of the last call. +func (b *CompositePodGroupSpecApplyConfiguration) WithPriority(value int32) *CompositePodGroupSpecApplyConfiguration { + b.Priority = &value + return b +} + +// WithPreemptionPolicy sets the PreemptionPolicy 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 PreemptionPolicy field is set to the value of the last call. +func (b *CompositePodGroupSpecApplyConfiguration) WithPreemptionPolicy(value schedulingv1alpha3.PreemptionPolicy) *CompositePodGroupSpecApplyConfiguration { + b.PreemptionPolicy = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositepodgroupstatus.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositepodgroupstatus.go new file mode 100644 index 0000000000..7c96916526 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositepodgroupstatus.go @@ -0,0 +1,72 @@ +/* +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 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// CompositePodGroupStatusApplyConfiguration represents a declarative configuration of the CompositePodGroupStatus type for use +// with apply. +// +// CompositePodGroupStatus represents information about the status of a composite pod group. +type CompositePodGroupStatusApplyConfiguration struct { + // conditions represent the latest observations of the CompositePodGroup's state. + // + // Known condition types: + // - "CompositePodGroupInitiallyScheduled": Indicates whether the overall scheduling requirement + // for the subtree under this CompositePodGroup has been satisfied. Once this condition + // transitions to True, it serves as a terminal state and will never revert to False, + // even if pods are subsequently deleted and group constraints are no longer met. + // - "DisruptionTarget": Indicates whether the CompositePodGroup is about to be terminated + // due to disruption such as preemption. + // + // Known reasons for the CompositePodGroupInitiallyScheduled condition: + // - "Unschedulable": The CompositePodGroup's subtree could not be placed due to resource constraints, + // affinity/anti-affinity, or topological constraints. + // - "SchedulerError": The CompositePodGroup cannot be scheduled due to some internal error + // that occurred during scheduling. + // - "Invalid": Set to True when kube-scheduler detects an invalid group layout during + // runtime validation. The `message` field details the specific layout violation (such as + // a detected cycle, exceeding the maximum depth of 4, or referencing multiple distinct Workloads). + // + // Known reasons for the DisruptionTarget condition: + // - "PreemptionByScheduler": The CompositePodGroup was targeted by the scheduler's preemption loop + // to free up capacity for higher-priority preemptors. + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` +} + +// CompositePodGroupStatusApplyConfiguration constructs a declarative configuration of the CompositePodGroupStatus type for use with +// apply. +func CompositePodGroupStatus() *CompositePodGroupStatusApplyConfiguration { + return &CompositePodGroupStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions 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 Conditions field. +func (b *CompositePodGroupStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *CompositePodGroupStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositepodgrouptemplate.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositepodgrouptemplate.go new file mode 100644 index 0000000000..fd8aadc2ed --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/compositepodgrouptemplate.go @@ -0,0 +1,157 @@ +/* +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 ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" +) + +// CompositePodGroupTemplateApplyConfiguration represents a declarative configuration of the CompositePodGroupTemplate type for use +// with apply. +// +// CompositePodGroupTemplate represents a template for a CompositePodGroup with a scheduling policy. +type CompositePodGroupTemplateApplyConfiguration struct { + // name is a unique identifier for the CompositePodGroupTemplate within the Workload. + // It must be a DNS label. This field is required. + Name *string `json:"name,omitempty"` + // schedulingPolicy defines the scheduling policy for this template. + SchedulingPolicy *CompositePodGroupSchedulingPolicyApplyConfiguration `json:"schedulingPolicy,omitempty"` + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this CompositePodGroupTemplate. + // This field is immutable. + SchedulingConstraints *CompositePodGroupSchedulingConstraintsApplyConfiguration `json:"schedulingConstraints,omitempty"` + // disruptionMode defines the mode in which a given CompositePodGroup can be disrupted. + // One of Single, All. + // This field is immutable. + DisruptionMode *CompositeDisruptionModeApplyConfiguration `json:"disruptionMode,omitempty"` + // priorityClassName indicates the priority that should be considered when scheduling + // a composite pod group created from this template. If no priority class is specified, + // admission control can set this to the global default priority class if it exists. + // Otherwise, composite pod groups created from this template will have the priority set + // to zero. + // This field is immutable. + PriorityClassName *string `json:"priorityClassName,omitempty"` + // priority is the value of priority of composite pod groups created from this template. + // Various system components use this field to find the priority of the composite pod group. + // When Priority Admission Controller is enabled, it prevents users from setting this field. + // The admission controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + Priority *int32 `json:"priority,omitempty"` + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + PreemptionPolicy *schedulingv1alpha3.PreemptionPolicy `json:"preemptionPolicy,omitempty"` + // podGroupTemplates is the list of templates for children PodGroups. + // The maximum number of templates is 8. At least one entry in CompositePodGroupTemplates + // or PodGroupTemplates must be set. + PodGroupTemplates []PodGroupTemplateApplyConfiguration `json:"podGroupTemplates,omitempty"` + // compositePodGroupTemplates is the list of templates for children CompositePodGroups. + // The maximum number of templates is 8. At least one entry in CompositePodGroupTemplates + // or PodGroupTemplates must be set. + CompositePodGroupTemplates []CompositePodGroupTemplateApplyConfiguration `json:"compositePodGroupTemplates,omitempty"` +} + +// CompositePodGroupTemplateApplyConfiguration constructs a declarative configuration of the CompositePodGroupTemplate type for use with +// apply. +func CompositePodGroupTemplate() *CompositePodGroupTemplateApplyConfiguration { + return &CompositePodGroupTemplateApplyConfiguration{} +} + +// 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 *CompositePodGroupTemplateApplyConfiguration) WithName(value string) *CompositePodGroupTemplateApplyConfiguration { + b.Name = &value + return b +} + +// WithSchedulingPolicy sets the SchedulingPolicy 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 SchedulingPolicy field is set to the value of the last call. +func (b *CompositePodGroupTemplateApplyConfiguration) WithSchedulingPolicy(value *CompositePodGroupSchedulingPolicyApplyConfiguration) *CompositePodGroupTemplateApplyConfiguration { + b.SchedulingPolicy = value + return b +} + +// WithSchedulingConstraints sets the SchedulingConstraints 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 SchedulingConstraints field is set to the value of the last call. +func (b *CompositePodGroupTemplateApplyConfiguration) WithSchedulingConstraints(value *CompositePodGroupSchedulingConstraintsApplyConfiguration) *CompositePodGroupTemplateApplyConfiguration { + b.SchedulingConstraints = value + return b +} + +// WithDisruptionMode sets the DisruptionMode 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 DisruptionMode field is set to the value of the last call. +func (b *CompositePodGroupTemplateApplyConfiguration) WithDisruptionMode(value *CompositeDisruptionModeApplyConfiguration) *CompositePodGroupTemplateApplyConfiguration { + b.DisruptionMode = value + return b +} + +// WithPriorityClassName sets the PriorityClassName 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 PriorityClassName field is set to the value of the last call. +func (b *CompositePodGroupTemplateApplyConfiguration) WithPriorityClassName(value string) *CompositePodGroupTemplateApplyConfiguration { + b.PriorityClassName = &value + return b +} + +// WithPriority sets the Priority 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 Priority field is set to the value of the last call. +func (b *CompositePodGroupTemplateApplyConfiguration) WithPriority(value int32) *CompositePodGroupTemplateApplyConfiguration { + b.Priority = &value + return b +} + +// WithPreemptionPolicy sets the PreemptionPolicy 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 PreemptionPolicy field is set to the value of the last call. +func (b *CompositePodGroupTemplateApplyConfiguration) WithPreemptionPolicy(value schedulingv1alpha3.PreemptionPolicy) *CompositePodGroupTemplateApplyConfiguration { + b.PreemptionPolicy = &value + return b +} + +// WithPodGroupTemplates adds the given value to the PodGroupTemplates 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 PodGroupTemplates field. +func (b *CompositePodGroupTemplateApplyConfiguration) WithPodGroupTemplates(values ...*PodGroupTemplateApplyConfiguration) *CompositePodGroupTemplateApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPodGroupTemplates") + } + b.PodGroupTemplates = append(b.PodGroupTemplates, *values[i]) + } + return b +} + +// WithCompositePodGroupTemplates adds the given value to the CompositePodGroupTemplates 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 CompositePodGroupTemplates field. +func (b *CompositePodGroupTemplateApplyConfiguration) WithCompositePodGroupTemplates(values ...*CompositePodGroupTemplateApplyConfiguration) *CompositePodGroupTemplateApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithCompositePodGroupTemplates") + } + b.CompositePodGroupTemplates = append(b.CompositePodGroupTemplates, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/disruptionmode.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/disruptionmode.go new file mode 100644 index 0000000000..b500fd3600 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/disruptionmode.go @@ -0,0 +1,57 @@ +/* +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 ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" +) + +// DisruptionModeApplyConfiguration represents a declarative configuration of the DisruptionMode type for use +// with apply. +// +// DisruptionMode defines how individual entities within a group can be disrupted. +// Exactly one mode can be set. +type DisruptionModeApplyConfiguration struct { + // single specifies that children can be disrupted independently from each other. + Single *schedulingv1alpha3.SingleDisruptionMode `json:"single,omitempty"` + // all specifies that all children can only be disrupted together. + All *schedulingv1alpha3.AllDisruptionMode `json:"all,omitempty"` +} + +// DisruptionModeApplyConfiguration constructs a declarative configuration of the DisruptionMode type for use with +// apply. +func DisruptionMode() *DisruptionModeApplyConfiguration { + return &DisruptionModeApplyConfiguration{} +} + +// WithSingle sets the Single 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 Single field is set to the value of the last call. +func (b *DisruptionModeApplyConfiguration) WithSingle(value schedulingv1alpha3.SingleDisruptionMode) *DisruptionModeApplyConfiguration { + b.Single = &value + return b +} + +// WithAll sets the All 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 All field is set to the value of the last call. +func (b *DisruptionModeApplyConfiguration) WithAll(value schedulingv1alpha3.AllDisruptionMode) *DisruptionModeApplyConfiguration { + b.All = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/gangschedulingpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/gangschedulingpolicy.go new file mode 100644 index 0000000000..f0d3561ba4 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/gangschedulingpolicy.go @@ -0,0 +1,52 @@ +/* +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 + +// GangSchedulingPolicyApplyConfiguration represents a declarative configuration of the GangSchedulingPolicy type for use +// with apply. +// +// GangSchedulingPolicy defines the parameters for gang scheduling. +type GangSchedulingPolicyApplyConfiguration struct { + // minCount is the minimum number of pods that must be schedulable or scheduled + // at the same time for the scheduler to admit the entire group. + // It must be a positive integer. This field is mutable to support workload scaling. + // + // Note that the scheduler operates on an eventually consistent model. Updates + // to minCount may not be immediately reflected in scheduling decisions due to + // propagation delays. If minCount is updated while a scheduling cycle is in + // progress for that group, the new value may not take effect until the next + // cycle. Moreover, minCount is only enforced during scheduling, meaning that + // modifications to this field do not affect already-scheduled pods, applying + // only to those evaluated in future cycles. + MinCount *int32 `json:"minCount,omitempty"` +} + +// GangSchedulingPolicyApplyConfiguration constructs a declarative configuration of the GangSchedulingPolicy type for use with +// apply. +func GangSchedulingPolicy() *GangSchedulingPolicyApplyConfiguration { + return &GangSchedulingPolicyApplyConfiguration{} +} + +// WithMinCount sets the MinCount 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 MinCount field is set to the value of the last call. +func (b *GangSchedulingPolicyApplyConfiguration) WithMinCount(value int32) *GangSchedulingPolicyApplyConfiguration { + b.MinCount = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroup.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroup.go similarity index 95% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroup.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroup.go index ee28510624..4970d44cb9 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroup.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroup.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 import ( - schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" managedfields "k8s.io/apimachinery/pkg/util/managedfields" @@ -35,13 +35,13 @@ import ( // Workload.podGroupTemplates. // PodGroup API enablement is toggled by the GenericWorkload feature gate. type PodGroupApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Spec defines the desired state of the PodGroup. + // spec defines the desired state of the PodGroup. Spec *PodGroupSpecApplyConfiguration `json:"spec,omitempty"` - // Status represents the current observed state of the PodGroup. + // status represents the current observed state of the PodGroup. Status *PodGroupStatusApplyConfiguration `json:"status,omitempty"` } @@ -52,7 +52,7 @@ func PodGroup(name, namespace string) *PodGroupApplyConfiguration { b.WithName(name) b.WithNamespace(namespace) b.WithKind("PodGroup") - b.WithAPIVersion("scheduling.k8s.io/v1alpha2") + b.WithAPIVersion("scheduling.k8s.io/v1alpha3") return b } @@ -63,9 +63,9 @@ func PodGroup(name, namespace string) *PodGroupApplyConfiguration { // ExtractPodGroupFrom provides a way to perform a extract/modify-in-place/apply workflow. // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously // applied if another fieldManager has updated or force applied any of the previously applied fields. -func ExtractPodGroupFrom(podGroup *schedulingv1alpha2.PodGroup, fieldManager string, subresource string) (*PodGroupApplyConfiguration, error) { +func ExtractPodGroupFrom(podGroup *schedulingv1alpha3.PodGroup, fieldManager string, subresource string) (*PodGroupApplyConfiguration, error) { b := &PodGroupApplyConfiguration{} - err := managedfields.ExtractInto(podGroup, internal.Parser().Type("io.k8s.api.scheduling.v1alpha2.PodGroup"), fieldManager, b, subresource) + err := managedfields.ExtractInto(podGroup, internal.Parser().Type("io.k8s.api.scheduling.v1alpha3.PodGroup"), fieldManager, b, subresource) if err != nil { return nil, err } @@ -73,7 +73,7 @@ func ExtractPodGroupFrom(podGroup *schedulingv1alpha2.PodGroup, fieldManager str b.WithNamespace(podGroup.Namespace) b.WithKind("PodGroup") - b.WithAPIVersion("scheduling.k8s.io/v1alpha2") + b.WithAPIVersion("scheduling.k8s.io/v1alpha3") return b, nil } @@ -87,13 +87,13 @@ func ExtractPodGroupFrom(podGroup *schedulingv1alpha2.PodGroup, fieldManager str // ExtractPodGroup provides a way to perform a extract/modify-in-place/apply workflow. // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously // applied if another fieldManager has updated or force applied any of the previously applied fields. -func ExtractPodGroup(podGroup *schedulingv1alpha2.PodGroup, fieldManager string) (*PodGroupApplyConfiguration, error) { +func ExtractPodGroup(podGroup *schedulingv1alpha3.PodGroup, fieldManager string) (*PodGroupApplyConfiguration, error) { return ExtractPodGroupFrom(podGroup, fieldManager, "") } // ExtractPodGroupStatus extracts the applied configuration owned by fieldManager from // podGroup for the status subresource. -func ExtractPodGroupStatus(podGroup *schedulingv1alpha2.PodGroup, fieldManager string) (*PodGroupApplyConfiguration, error) { +func ExtractPodGroupStatus(podGroup *schedulingv1alpha3.PodGroup, fieldManager string) (*PodGroupApplyConfiguration, error) { return ExtractPodGroupFrom(podGroup, fieldManager, "status") } diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupresourceclaim.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroupresourceclaim.go similarity index 95% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupresourceclaim.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroupresourceclaim.go index a7b21b530b..cb132a07d6 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupresourceclaim.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroupresourceclaim.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 // PodGroupResourceClaimApplyConfiguration represents a declarative configuration of the PodGroupResourceClaim type for use // with apply. @@ -30,17 +30,17 @@ package v1alpha2 // own Spec.ResourceClaims. The Pod's claim must match all fields of the // PodGroup's claim exactly. type PodGroupResourceClaimApplyConfiguration struct { - // Name uniquely identifies this resource claim inside the PodGroup. + // name uniquely identifies this resource claim inside the PodGroup. // This must be a DNS_LABEL. Name *string `json:"name,omitempty"` - // ResourceClaimName is the name of a ResourceClaim object in the same + // resourceClaimName is the name of a ResourceClaim object in the same // namespace as this PodGroup. The ResourceClaim will be reserved for the // PodGroup instead of its individual pods. // // Exactly one of ResourceClaimName and ResourceClaimTemplateName must // be set. ResourceClaimName *string `json:"resourceClaimName,omitempty"` - // ResourceClaimTemplateName is the name of a ResourceClaimTemplate + // resourceClaimTemplateName is the name of a ResourceClaimTemplate // object in the same namespace as this PodGroup. // // The template will be used to create a new ResourceClaim, which will diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupresourceclaimstatus.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroupresourceclaimstatus.go similarity index 94% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupresourceclaimstatus.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroupresourceclaimstatus.go index 5f8498b13e..e3250d82d8 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupresourceclaimstatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroupresourceclaimstatus.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 // PodGroupResourceClaimStatusApplyConfiguration represents a declarative configuration of the PodGroupResourceClaimStatus type for use // with apply. @@ -25,11 +25,11 @@ package v1alpha2 // PodGroupResourceClaim which references a ResourceClaimTemplate. It stores the // generated name for the corresponding ResourceClaim. type PodGroupResourceClaimStatusApplyConfiguration struct { - // Name uniquely identifies this resource claim inside the PodGroup. This + // name uniquely identifies this resource claim inside the PodGroup. This // must match the name of an entry in podgroup.spec.resourceClaims, which // implies that the string must be a DNS_LABEL. Name *string `json:"name,omitempty"` - // ResourceClaimName is the name of the ResourceClaim that was generated for + // resourceClaimName is the name of the ResourceClaim that was generated for // the PodGroup in the namespace of the PodGroup. If this is unset, then // generating a ResourceClaim was not necessary. The // podgroup.spec.resourceClaims entry can be ignored in this case. diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupschedulingconstraints.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroupschedulingconstraints.go similarity index 96% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupschedulingconstraints.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroupschedulingconstraints.go index eda72ea50e..5dadef14bf 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupschedulingconstraints.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroupschedulingconstraints.go @@ -16,14 +16,14 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 // PodGroupSchedulingConstraintsApplyConfiguration represents a declarative configuration of the PodGroupSchedulingConstraints type for use // with apply. // // PodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a PodGroup. type PodGroupSchedulingConstraintsApplyConfiguration struct { - // Topology defines the topology constraints for the pod group. + // topology defines the topology constraints for the pod group. // Currently only a single topology constraint can be specified. This may change in the future. Topology []TopologyConstraintApplyConfiguration `json:"topology,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupschedulingpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroupschedulingpolicy.go similarity index 67% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupschedulingpolicy.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroupschedulingpolicy.go index 02be5f27eb..67232d1925 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupschedulingpolicy.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroupschedulingpolicy.go @@ -16,23 +16,28 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 import ( - schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" ) // PodGroupSchedulingPolicyApplyConfiguration represents a declarative configuration of the PodGroupSchedulingPolicy type for use // with apply. // // PodGroupSchedulingPolicy defines the scheduling configuration for a PodGroup. -// Exactly one policy must be set. +// Exactly one policy must be set. The policy is chosen at creation time by setting either the +// Basic or Gang field. The PodGroup may not change policy after creation. +// Fields within chosen policy may be updated after creation when their individual fields allow it. type PodGroupSchedulingPolicyApplyConfiguration struct { - // Basic specifies that the pods in this group should be scheduled using - // standard Kubernetes scheduling behavior. - Basic *schedulingv1alpha2.BasicSchedulingPolicy `json:"basic,omitempty"` - // Gang specifies that the pods in this group should be scheduled using - // all-or-nothing semantics. + // basic specifies that the pods in this group should be scheduled using + // standard Kubernetes scheduling behavior. Setting this field at group creation time + // opts this group to basic scheduling; this field cannot be changed afterward. + Basic *schedulingv1alpha3.BasicSchedulingPolicy `json:"basic,omitempty"` + // gang specifies that the pods in this group should be scheduled using + // all-or-nothing semantics. Setting this field at group creation time + // opts this group to gang scheduling; this field cannot be set or unset afterward. + // The minCount field within Gang scheduling policy remains mutable after group creation. Gang *GangSchedulingPolicyApplyConfiguration `json:"gang,omitempty"` } @@ -45,7 +50,7 @@ func PodGroupSchedulingPolicy() *PodGroupSchedulingPolicyApplyConfiguration { // WithBasic sets the Basic 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 Basic field is set to the value of the last call. -func (b *PodGroupSchedulingPolicyApplyConfiguration) WithBasic(value schedulingv1alpha2.BasicSchedulingPolicy) *PodGroupSchedulingPolicyApplyConfiguration { +func (b *PodGroupSchedulingPolicyApplyConfiguration) WithBasic(value schedulingv1alpha3.BasicSchedulingPolicy) *PodGroupSchedulingPolicyApplyConfiguration { b.Basic = &value return b } diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroupspec.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroupspec.go new file mode 100644 index 0000000000..5ca2ee1aba --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroupspec.go @@ -0,0 +1,168 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" +) + +// PodGroupSpecApplyConfiguration represents a declarative configuration of the PodGroupSpec type for use +// with apply. +// +// PodGroupSpec defines the desired state of a PodGroup. +type PodGroupSpecApplyConfiguration struct { + // parentCompositePodGroupName contains the name of the parent composite pod group + // within the same namespace as this pod group. + // If it's nil, then this pod group is a root of a workload's hierarchy. + // This field is used only when the CompositePodGroup feature gate is enabled. + // This field is immutable. + ParentCompositePodGroupName *string `json:"parentCompositePodGroupName,omitempty"` + // workloadRef references an optional PodGroup template within the Workload + // object that was used to create the PodGroup. + // This field is immutable. + WorkloadRef *WorkloadReferenceApplyConfiguration `json:"workloadRef,omitempty"` + // schedulingPolicy defines the scheduling policy for this instance of the PodGroup. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + SchedulingPolicy *PodGroupSchedulingPolicyApplyConfiguration `json:"schedulingPolicy,omitempty"` + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroup. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // This field is immutable. + // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. + SchedulingConstraints *PodGroupSchedulingConstraintsApplyConfiguration `json:"schedulingConstraints,omitempty"` + // resourceClaims defines which ResourceClaims may be shared among Pods in + // the group. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // + // This is a beta-level field and requires that the + // DRAWorkloadResourceClaims feature gate is enabled. + // + // This field is immutable. + ResourceClaims []PodGroupResourceClaimApplyConfiguration `json:"resourceClaims,omitempty"` + // disruptionMode defines the mode in which a given PodGroup can be disrupted. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // One of Single, All. Defaults to Single if unset. + // This field is immutable. + DisruptionMode *DisruptionModeApplyConfiguration `json:"disruptionMode,omitempty"` + // priorityClassName defines the priority that should be considered when scheduling this pod group. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // Otherwise, it is validated and resolved similarly to the PriorityClassName on PodGroupTemplate + // (i.e. if no priority class is specified, admission control can set this to the global default + // priority class if it exists. Otherwise, the pod group's priority will be zero). + // This field is immutable. + PriorityClassName *string `json:"priorityClassName,omitempty"` + // priority is the value of priority of this pod group. Various system components + // use this field to find the priority of the pod group. When Priority Admission + // Controller is enabled, it prevents users from setting this field. The admission + // controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + Priority *int32 `json:"priority,omitempty"` + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. + // When Priority Admission Controller is enabled, it populates this field from PriorityClassName, + // and defaults to PreemptLowerPriority if value is unset in PriorityClass. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + PreemptionPolicy *schedulingv1alpha3.PreemptionPolicy `json:"preemptionPolicy,omitempty"` +} + +// PodGroupSpecApplyConfiguration constructs a declarative configuration of the PodGroupSpec type for use with +// apply. +func PodGroupSpec() *PodGroupSpecApplyConfiguration { + return &PodGroupSpecApplyConfiguration{} +} + +// WithParentCompositePodGroupName sets the ParentCompositePodGroupName 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 ParentCompositePodGroupName field is set to the value of the last call. +func (b *PodGroupSpecApplyConfiguration) WithParentCompositePodGroupName(value string) *PodGroupSpecApplyConfiguration { + b.ParentCompositePodGroupName = &value + return b +} + +// WithWorkloadRef sets the WorkloadRef 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 WorkloadRef field is set to the value of the last call. +func (b *PodGroupSpecApplyConfiguration) WithWorkloadRef(value *WorkloadReferenceApplyConfiguration) *PodGroupSpecApplyConfiguration { + b.WorkloadRef = value + return b +} + +// WithSchedulingPolicy sets the SchedulingPolicy 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 SchedulingPolicy field is set to the value of the last call. +func (b *PodGroupSpecApplyConfiguration) WithSchedulingPolicy(value *PodGroupSchedulingPolicyApplyConfiguration) *PodGroupSpecApplyConfiguration { + b.SchedulingPolicy = value + return b +} + +// WithSchedulingConstraints sets the SchedulingConstraints 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 SchedulingConstraints field is set to the value of the last call. +func (b *PodGroupSpecApplyConfiguration) WithSchedulingConstraints(value *PodGroupSchedulingConstraintsApplyConfiguration) *PodGroupSpecApplyConfiguration { + b.SchedulingConstraints = value + return b +} + +// WithResourceClaims adds the given value to the ResourceClaims 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 ResourceClaims field. +func (b *PodGroupSpecApplyConfiguration) WithResourceClaims(values ...*PodGroupResourceClaimApplyConfiguration) *PodGroupSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithResourceClaims") + } + b.ResourceClaims = append(b.ResourceClaims, *values[i]) + } + return b +} + +// WithDisruptionMode sets the DisruptionMode 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 DisruptionMode field is set to the value of the last call. +func (b *PodGroupSpecApplyConfiguration) WithDisruptionMode(value *DisruptionModeApplyConfiguration) *PodGroupSpecApplyConfiguration { + b.DisruptionMode = value + return b +} + +// WithPriorityClassName sets the PriorityClassName 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 PriorityClassName field is set to the value of the last call. +func (b *PodGroupSpecApplyConfiguration) WithPriorityClassName(value string) *PodGroupSpecApplyConfiguration { + b.PriorityClassName = &value + return b +} + +// WithPriority sets the Priority 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 Priority field is set to the value of the last call. +func (b *PodGroupSpecApplyConfiguration) WithPriority(value int32) *PodGroupSpecApplyConfiguration { + b.Priority = &value + return b +} + +// WithPreemptionPolicy sets the PreemptionPolicy 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 PreemptionPolicy field is set to the value of the last call. +func (b *PodGroupSpecApplyConfiguration) WithPreemptionPolicy(value schedulingv1alpha3.PreemptionPolicy) *PodGroupSpecApplyConfiguration { + b.PreemptionPolicy = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroupstatus.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroupstatus.go new file mode 100644 index 0000000000..af0b5d31da --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgroupstatus.go @@ -0,0 +1,83 @@ +/* +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 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// PodGroupStatusApplyConfiguration represents a declarative configuration of the PodGroupStatus type for use +// with apply. +// +// PodGroupStatus represents information about the status of a pod group. +type PodGroupStatusApplyConfiguration struct { + // conditions represent the latest observations of the PodGroup's state. + // + // Known condition types: + // - "PodGroupInitiallyScheduled": Indicates whether the scheduling requirement has been satisfied. + // Once this condition transitions to True, it serves as a terminal state and will never revert to False, + // even if pods are subsequently evicted and group constraints are no longer met. + // - "DisruptionTarget": Indicates whether the PodGroup is about to be terminated + // due to disruption such as preemption. + // + // Known reasons for the PodGroupInitiallyScheduled condition: + // - "Unschedulable": The PodGroup cannot be scheduled due to resource constraints, + // affinity/anti-affinity rules, or insufficient capacity for the gang. + // - "SchedulerError": The PodGroup cannot be scheduled due to some internal error + // that happened during scheduling, for example due to nodeAffinity parsing errors. + // + // Known reasons for the DisruptionTarget condition: + // - "PreemptionByScheduler": The PodGroup was preempted by the scheduler to make room for + // higher-priority PodGroups or Pods. + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` + // resourceClaimStatuses is status of resource claims. + ResourceClaimStatuses []PodGroupResourceClaimStatusApplyConfiguration `json:"resourceClaimStatuses,omitempty"` +} + +// PodGroupStatusApplyConfiguration constructs a declarative configuration of the PodGroupStatus type for use with +// apply. +func PodGroupStatus() *PodGroupStatusApplyConfiguration { + return &PodGroupStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions 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 Conditions field. +func (b *PodGroupStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *PodGroupStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithResourceClaimStatuses adds the given value to the ResourceClaimStatuses 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 ResourceClaimStatuses field. +func (b *PodGroupStatusApplyConfiguration) WithResourceClaimStatuses(values ...*PodGroupResourceClaimStatusApplyConfiguration) *PodGroupStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithResourceClaimStatuses") + } + b.ResourceClaimStatuses = append(b.ResourceClaimStatuses, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgrouptemplate.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgrouptemplate.go new file mode 100644 index 0000000000..b004ac0b32 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/podgrouptemplate.go @@ -0,0 +1,143 @@ +/* +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 ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" +) + +// PodGroupTemplateApplyConfiguration represents a declarative configuration of the PodGroupTemplate type for use +// with apply. +// +// PodGroupTemplate represents a template for a set of pods with a scheduling policy. +type PodGroupTemplateApplyConfiguration struct { + // name is a unique identifier for the PodGroupTemplate within the Workload. + // It must be a DNS label. This field is immutable. + Name *string `json:"name,omitempty"` + // schedulingPolicy defines the scheduling policy for this PodGroupTemplate. + SchedulingPolicy *PodGroupSchedulingPolicyApplyConfiguration `json:"schedulingPolicy,omitempty"` + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroupTemplate. + // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. + // This field is immutable. + SchedulingConstraints *PodGroupSchedulingConstraintsApplyConfiguration `json:"schedulingConstraints,omitempty"` + // resourceClaims defines which ResourceClaims may be shared among Pods in + // the group. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // + // This is a beta-level field and requires that the + // DRAWorkloadResourceClaims feature gate is enabled. + // + // This field is immutable. + ResourceClaims []PodGroupResourceClaimApplyConfiguration `json:"resourceClaims,omitempty"` + // disruptionMode defines the mode in which a given PodGroup can be disrupted. + // One of Single, All. + // This field is immutable. + DisruptionMode *DisruptionModeApplyConfiguration `json:"disruptionMode,omitempty"` + // priorityClassName indicates the priority that should be considered when scheduling + // a pod group created from this template. + // This field is immutable. + PriorityClassName *string `json:"priorityClassName,omitempty"` + // priority is the value of priority of pod groups created from this template. Various + // system components use this field to find the priority of the pod group. + // The higher the value, the higher the priority. + // This field is immutable. + Priority *int32 `json:"priority,omitempty"` + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + PreemptionPolicy *schedulingv1alpha3.PreemptionPolicy `json:"preemptionPolicy,omitempty"` +} + +// PodGroupTemplateApplyConfiguration constructs a declarative configuration of the PodGroupTemplate type for use with +// apply. +func PodGroupTemplate() *PodGroupTemplateApplyConfiguration { + return &PodGroupTemplateApplyConfiguration{} +} + +// 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 *PodGroupTemplateApplyConfiguration) WithName(value string) *PodGroupTemplateApplyConfiguration { + b.Name = &value + return b +} + +// WithSchedulingPolicy sets the SchedulingPolicy 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 SchedulingPolicy field is set to the value of the last call. +func (b *PodGroupTemplateApplyConfiguration) WithSchedulingPolicy(value *PodGroupSchedulingPolicyApplyConfiguration) *PodGroupTemplateApplyConfiguration { + b.SchedulingPolicy = value + return b +} + +// WithSchedulingConstraints sets the SchedulingConstraints 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 SchedulingConstraints field is set to the value of the last call. +func (b *PodGroupTemplateApplyConfiguration) WithSchedulingConstraints(value *PodGroupSchedulingConstraintsApplyConfiguration) *PodGroupTemplateApplyConfiguration { + b.SchedulingConstraints = value + return b +} + +// WithResourceClaims adds the given value to the ResourceClaims 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 ResourceClaims field. +func (b *PodGroupTemplateApplyConfiguration) WithResourceClaims(values ...*PodGroupResourceClaimApplyConfiguration) *PodGroupTemplateApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithResourceClaims") + } + b.ResourceClaims = append(b.ResourceClaims, *values[i]) + } + return b +} + +// WithDisruptionMode sets the DisruptionMode 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 DisruptionMode field is set to the value of the last call. +func (b *PodGroupTemplateApplyConfiguration) WithDisruptionMode(value *DisruptionModeApplyConfiguration) *PodGroupTemplateApplyConfiguration { + b.DisruptionMode = value + return b +} + +// WithPriorityClassName sets the PriorityClassName 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 PriorityClassName field is set to the value of the last call. +func (b *PodGroupTemplateApplyConfiguration) WithPriorityClassName(value string) *PodGroupTemplateApplyConfiguration { + b.PriorityClassName = &value + return b +} + +// WithPriority sets the Priority 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 Priority field is set to the value of the last call. +func (b *PodGroupTemplateApplyConfiguration) WithPriority(value int32) *PodGroupTemplateApplyConfiguration { + b.Priority = &value + return b +} + +// WithPreemptionPolicy sets the PreemptionPolicy 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 PreemptionPolicy field is set to the value of the last call. +func (b *PodGroupTemplateApplyConfiguration) WithPreemptionPolicy(value schedulingv1alpha3.PreemptionPolicy) *PodGroupTemplateApplyConfiguration { + b.PreemptionPolicy = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/topologyconstraint.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/topologyconstraint.go similarity index 95% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/topologyconstraint.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/topologyconstraint.go index 92727eb2bb..b1c4f26389 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/topologyconstraint.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/topologyconstraint.go @@ -16,14 +16,14 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 // TopologyConstraintApplyConfiguration represents a declarative configuration of the TopologyConstraint type for use // with apply. // // TopologyConstraint defines a topology constraint for a PodGroup. type TopologyConstraintApplyConfiguration struct { - // Key specifies the key of the node label representing the topology domain. + // key specifies the key of the node label representing the topology domain. // All pods within the PodGroup must be colocated within the same domain instance. // Different PodGroups can land on different domain instances even if they derive from the same PodGroupTemplate. // Examples: "topology.kubernetes.io/rack" diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/typedlocalobjectreference.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/typedlocalobjectreference.go similarity index 94% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/typedlocalobjectreference.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/typedlocalobjectreference.go index cfbbc48e07..e8303eb66e 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/typedlocalobjectreference.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/typedlocalobjectreference.go @@ -16,22 +16,22 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 // TypedLocalObjectReferenceApplyConfiguration represents a declarative configuration of the TypedLocalObjectReference type for use // with apply. // // TypedLocalObjectReference allows to reference typed object inside the same namespace. type TypedLocalObjectReferenceApplyConfiguration struct { - // APIGroup is the group for the resource being referenced. + // apiGroup is the group for the resource being referenced. // If APIGroup is empty, the specified Kind must be in the core API group. // For any other third-party types, setting APIGroup is required. // It must be a DNS subdomain. APIGroup *string `json:"apiGroup,omitempty"` - // Kind is the type of resource being referenced. + // kind is the type of resource being referenced. // It must be a path segment name. Kind *string `json:"kind,omitempty"` - // Name is the name of resource being referenced. + // name is the name of resource being referenced. // It must be a path segment name. Name *string `json:"name,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workload.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workload.go similarity index 96% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workload.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workload.go index 787095d238..6088ead036 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workload.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workload.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 import ( - schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" managedfields "k8s.io/apimachinery/pkg/util/managedfields" @@ -35,11 +35,11 @@ import ( // including scheduling, preemption, eviction and other phases. // Workload API enablement is toggled by the GenericWorkload feature gate. type WorkloadApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Spec defines the desired behavior of a Workload. + // spec defines the desired behavior of a Workload. Spec *WorkloadSpecApplyConfiguration `json:"spec,omitempty"` } @@ -50,7 +50,7 @@ func Workload(name, namespace string) *WorkloadApplyConfiguration { b.WithName(name) b.WithNamespace(namespace) b.WithKind("Workload") - b.WithAPIVersion("scheduling.k8s.io/v1alpha2") + b.WithAPIVersion("scheduling.k8s.io/v1alpha3") return b } @@ -61,9 +61,9 @@ func Workload(name, namespace string) *WorkloadApplyConfiguration { // ExtractWorkloadFrom provides a way to perform a extract/modify-in-place/apply workflow. // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously // applied if another fieldManager has updated or force applied any of the previously applied fields. -func ExtractWorkloadFrom(workload *schedulingv1alpha2.Workload, fieldManager string, subresource string) (*WorkloadApplyConfiguration, error) { +func ExtractWorkloadFrom(workload *schedulingv1alpha3.Workload, fieldManager string, subresource string) (*WorkloadApplyConfiguration, error) { b := &WorkloadApplyConfiguration{} - err := managedfields.ExtractInto(workload, internal.Parser().Type("io.k8s.api.scheduling.v1alpha2.Workload"), fieldManager, b, subresource) + err := managedfields.ExtractInto(workload, internal.Parser().Type("io.k8s.api.scheduling.v1alpha3.Workload"), fieldManager, b, subresource) if err != nil { return nil, err } @@ -71,7 +71,7 @@ func ExtractWorkloadFrom(workload *schedulingv1alpha2.Workload, fieldManager str b.WithNamespace(workload.Namespace) b.WithKind("Workload") - b.WithAPIVersion("scheduling.k8s.io/v1alpha2") + b.WithAPIVersion("scheduling.k8s.io/v1alpha3") return b, nil } @@ -85,7 +85,7 @@ func ExtractWorkloadFrom(workload *schedulingv1alpha2.Workload, fieldManager str // ExtractWorkload provides a way to perform a extract/modify-in-place/apply workflow. // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously // applied if another fieldManager has updated or force applied any of the previously applied fields. -func ExtractWorkload(workload *schedulingv1alpha2.Workload, fieldManager string) (*WorkloadApplyConfiguration, error) { +func ExtractWorkload(workload *schedulingv1alpha3.Workload, fieldManager string) (*WorkloadApplyConfiguration, error) { return ExtractWorkloadFrom(workload, fieldManager, "") } diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadpodgroupdisruptionmode.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadpodgroupdisruptionmode.go new file mode 100644 index 0000000000..4a524de531 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadpodgroupdisruptionmode.go @@ -0,0 +1,78 @@ +/* +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 ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" +) + +// WorkloadPodGroupDisruptionModeApplyConfiguration represents a declarative configuration of the WorkloadPodGroupDisruptionMode type for use +// with apply. +// +// WorkloadPodGroupDisruptionMode defines how individual pods within a +// group can be disrupted. Exactly one mode must be set. +// +// --- +// +// This is a reusable building block meant to be embedded in a controller's own +// API, next to its other scheduling fields (for example, in a Job's +// spec.scheduling). It's recommended to freeze the field after creation +// (+k8s:immutable), since the selected mode is immutable in the compiled +// Workload. For example, +// +// type JobSchedulingConfiguration struct { +// // DisruptionMode defines the mode in which the Job's pods can be disrupted. +// // One of Single, All. +// // This field is immutable after creation: it may not be added or removed, +// // and the selected mode may not be changed. +// // +optional +// // +k8s:optional +// // +k8s:immutable +// DisruptionMode *schedulingv1alpha3.WorkloadPodGroupDisruptionMode `json:"disruptionMode,omitempty" protobuf:"bytes,N,opt,name=disruptionMode"` +// +// // other scheduling fields +// } +type WorkloadPodGroupDisruptionModeApplyConfiguration struct { + // single specifies that pods can be disrupted independently from each other. + Single *schedulingv1alpha3.WorkloadPodGroupSingleDisruptionMode `json:"single,omitempty"` + // all specifies that all pods in the group must be disrupted together. + All *schedulingv1alpha3.WorkloadPodGroupAllDisruptionMode `json:"all,omitempty"` +} + +// WorkloadPodGroupDisruptionModeApplyConfiguration constructs a declarative configuration of the WorkloadPodGroupDisruptionMode type for use with +// apply. +func WorkloadPodGroupDisruptionMode() *WorkloadPodGroupDisruptionModeApplyConfiguration { + return &WorkloadPodGroupDisruptionModeApplyConfiguration{} +} + +// WithSingle sets the Single 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 Single field is set to the value of the last call. +func (b *WorkloadPodGroupDisruptionModeApplyConfiguration) WithSingle(value schedulingv1alpha3.WorkloadPodGroupSingleDisruptionMode) *WorkloadPodGroupDisruptionModeApplyConfiguration { + b.Single = &value + return b +} + +// WithAll sets the All 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 All field is set to the value of the last call. +func (b *WorkloadPodGroupDisruptionModeApplyConfiguration) WithAll(value schedulingv1alpha3.WorkloadPodGroupAllDisruptionMode) *WorkloadPodGroupDisruptionModeApplyConfiguration { + b.All = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadpodgroupgangschedulingpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadpodgroupgangschedulingpolicy.go new file mode 100644 index 0000000000..4464dfc2a5 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadpodgroupgangschedulingpolicy.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 v1alpha3 + +// WorkloadPodGroupGangSchedulingPolicyApplyConfiguration represents a declarative configuration of the WorkloadPodGroupGangSchedulingPolicy type for use +// with apply. +// +// WorkloadPodGroupGangSchedulingPolicy defines the parameters for gang +// (all-or-nothing) scheduling. +type WorkloadPodGroupGangSchedulingPolicyApplyConfiguration struct { + // minCount is the minimum number of pods that must be scheduled + // at the same time for the scheduler to admit the entire group. + // This field is optional. If it is not specified, the controller + // should inject a context-specific sane default (e.g., + // parallelism for a Job). + // If set, it must be a positive integer. + MinCount *int32 `json:"minCount,omitempty"` +} + +// WorkloadPodGroupGangSchedulingPolicyApplyConfiguration constructs a declarative configuration of the WorkloadPodGroupGangSchedulingPolicy type for use with +// apply. +func WorkloadPodGroupGangSchedulingPolicy() *WorkloadPodGroupGangSchedulingPolicyApplyConfiguration { + return &WorkloadPodGroupGangSchedulingPolicyApplyConfiguration{} +} + +// WithMinCount sets the MinCount 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 MinCount field is set to the value of the last call. +func (b *WorkloadPodGroupGangSchedulingPolicyApplyConfiguration) WithMinCount(value int32) *WorkloadPodGroupGangSchedulingPolicyApplyConfiguration { + b.MinCount = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadpodgroupresourceclaim.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadpodgroupresourceclaim.go new file mode 100644 index 0000000000..a34c5a2e55 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadpodgroupresourceclaim.go @@ -0,0 +1,98 @@ +/* +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 + +// WorkloadPodGroupResourceClaimApplyConfiguration represents a declarative configuration of the WorkloadPodGroupResourceClaim type for use +// with apply. +// +// WorkloadPodGroupResourceClaim references a dynamic resource claim +// that is shared across pods in the group. +// +// --- +// +// This is a reusable building block meant to be embedded in a controller's own +// API as a list, next to its other scheduling fields (for example, in a Job's +// spec.scheduling). It's recommended to freeze the whole list after creation +// (+k8s:immutable), since the list is immutable in the compiled Workload. For +// example, +// +// type JobSchedulingConfiguration struct { +// // ResourceClaims lists the ResourceClaims shared among the group's pods. +// // At most 4 claims may be set, matching the limit on the resulting PodGroup. +// // This list is immutable after creation: entries may neither be added, +// // removed, nor modified. +// // +optional +// // +patchMergeKey=name +// // +patchStrategy=merge +// // +listType=map +// // +listMapKey=name +// // +k8s:optional +// // +k8s:listType=map +// // +k8s:listMapKey=name +// // +k8s:maxItems=4 +// // +k8s:immutable +// ResourceClaims []schedulingv1alpha3.WorkloadPodGroupResourceClaim `json:"resourceClaims,omitempty" protobuf:"bytes,N,rep,name=resourceClaims"` +// +// // other scheduling fields +// } +type WorkloadPodGroupResourceClaimApplyConfiguration struct { + // name uniquely identifies this resource claim inside the group. + // This field is required. It must be a DNS_LABEL. + Name *string `json:"name,omitempty"` + // resourceClaimName is the name of a ResourceClaim object in the same + // namespace. + // This field is optional. If it is not specified, no resource claim + // is used. If set, it must be a DNS subdomain. + ResourceClaimName *string `json:"resourceClaimName,omitempty"` + // resourceClaimTemplateName is the name of a ResourceClaimTemplate + // object in the same namespace. + // This field is optional. If it is not specified, no resource claim + // template is used. If set, it must be a DNS subdomain. + ResourceClaimTemplateName *string `json:"resourceClaimTemplateName,omitempty"` +} + +// WorkloadPodGroupResourceClaimApplyConfiguration constructs a declarative configuration of the WorkloadPodGroupResourceClaim type for use with +// apply. +func WorkloadPodGroupResourceClaim() *WorkloadPodGroupResourceClaimApplyConfiguration { + return &WorkloadPodGroupResourceClaimApplyConfiguration{} +} + +// 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 *WorkloadPodGroupResourceClaimApplyConfiguration) WithName(value string) *WorkloadPodGroupResourceClaimApplyConfiguration { + b.Name = &value + return b +} + +// WithResourceClaimName sets the ResourceClaimName 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 ResourceClaimName field is set to the value of the last call. +func (b *WorkloadPodGroupResourceClaimApplyConfiguration) WithResourceClaimName(value string) *WorkloadPodGroupResourceClaimApplyConfiguration { + b.ResourceClaimName = &value + return b +} + +// WithResourceClaimTemplateName sets the ResourceClaimTemplateName 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 ResourceClaimTemplateName field is set to the value of the last call. +func (b *WorkloadPodGroupResourceClaimApplyConfiguration) WithResourceClaimTemplateName(value string) *WorkloadPodGroupResourceClaimApplyConfiguration { + b.ResourceClaimTemplateName = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadpodgroupschedulingconstraints.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadpodgroupschedulingconstraints.go new file mode 100644 index 0000000000..1721ca6cbf --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadpodgroupschedulingconstraints.go @@ -0,0 +1,70 @@ +/* +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 + +// WorkloadPodGroupSchedulingConstraintsApplyConfiguration represents a declarative configuration of the WorkloadPodGroupSchedulingConstraints type for use +// with apply. +// +// WorkloadPodGroupSchedulingConstraints defines leaf-level scheduling +// constraints, such as topology. +// +// --- +// +// This is a reusable building block meant to be embedded in a controller's own +// API, next to its other scheduling fields (for example, in a Job's +// spec.scheduling). It's recommended to freeze the field after creation +// (+k8s:immutable), since constraints are immutable in the compiled Workload. +// For example, +// +// type JobSchedulingConfiguration struct { +// // SchedulingConstraints defines scheduling constraints (e.g. topology) +// // for the Job's pods. +// // This field is immutable after creation. +// // +optional +// // +k8s:optional +// // +k8s:immutable +// SchedulingConstraints *schedulingv1alpha3.WorkloadPodGroupSchedulingConstraints `json:"schedulingConstraints,omitempty" protobuf:"bytes,N,opt,name=schedulingConstraints"` +// +// // other scheduling fields +// } +type WorkloadPodGroupSchedulingConstraintsApplyConfiguration struct { + // topology specifies desired topological placements for all pods + // within the pod group. + // If unset, no topology placement is requested. + Topology []TopologyConstraintApplyConfiguration `json:"topology,omitempty"` +} + +// WorkloadPodGroupSchedulingConstraintsApplyConfiguration constructs a declarative configuration of the WorkloadPodGroupSchedulingConstraints type for use with +// apply. +func WorkloadPodGroupSchedulingConstraints() *WorkloadPodGroupSchedulingConstraintsApplyConfiguration { + return &WorkloadPodGroupSchedulingConstraintsApplyConfiguration{} +} + +// WithTopology adds the given value to the Topology 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 Topology field. +func (b *WorkloadPodGroupSchedulingConstraintsApplyConfiguration) WithTopology(values ...*TopologyConstraintApplyConfiguration) *WorkloadPodGroupSchedulingConstraintsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithTopology") + } + b.Topology = append(b.Topology, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadpodgroupschedulingpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadpodgroupschedulingpolicy.go new file mode 100644 index 0000000000..13a1249d88 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadpodgroupschedulingpolicy.go @@ -0,0 +1,84 @@ +/* +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 ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" +) + +// WorkloadPodGroupSchedulingPolicyApplyConfiguration represents a declarative configuration of the WorkloadPodGroupSchedulingPolicy type for use +// with apply. +// +// WorkloadPodGroupSchedulingPolicy defines the scheduling policy for a +// group of pods managed by a workload controller. +// Exactly one policy must be set. +// +// --- +// +// This is a reusable building block meant to be embedded in a controller's own +// API, next to its other scheduling fields (for example, in a Job's +// spec.scheduling). It's recommended to block changing the policy +// after creation, while still allowing gang.minCount to change. DV cannot +// express that only gang.minCount is mutable while the basic/gang variant is +// frozen, so the embedder must enforce variant immutability with hand-written +// validation. For example, +// +// type JobSchedulingConfiguration struct { +// // SchedulingPolicy defines the scheduling policy for this Job. +// // Exactly one of Basic or Gang must be set. +// // This field is immutable after creation: the policy may not be added or +// // removed. The policy variant (basic/gang) is frozen by the controller's +// // hand-written validation; only schedulingPolicy.gang.minCount may be changed. +// // +optional +// // +k8s:optional +// // +k8s:update=NoSet +// // +k8s:update=NoUnset +// SchedulingPolicy *schedulingv1alpha3.WorkloadPodGroupSchedulingPolicy `json:"schedulingPolicy,omitempty" protobuf:"bytes,N,opt,name=schedulingPolicy"` +// +// // other scheduling fields +// } +type WorkloadPodGroupSchedulingPolicyApplyConfiguration struct { + // basic specifies that standard, pod-by-pod Kubernetes scheduling + // behavior should be used. + Basic *schedulingv1alpha3.WorkloadPodGroupBasicSchedulingPolicy `json:"basic,omitempty"` + // gang specifies all-or-nothing scheduling semantics. + Gang *WorkloadPodGroupGangSchedulingPolicyApplyConfiguration `json:"gang,omitempty"` +} + +// WorkloadPodGroupSchedulingPolicyApplyConfiguration constructs a declarative configuration of the WorkloadPodGroupSchedulingPolicy type for use with +// apply. +func WorkloadPodGroupSchedulingPolicy() *WorkloadPodGroupSchedulingPolicyApplyConfiguration { + return &WorkloadPodGroupSchedulingPolicyApplyConfiguration{} +} + +// WithBasic sets the Basic 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 Basic field is set to the value of the last call. +func (b *WorkloadPodGroupSchedulingPolicyApplyConfiguration) WithBasic(value schedulingv1alpha3.WorkloadPodGroupBasicSchedulingPolicy) *WorkloadPodGroupSchedulingPolicyApplyConfiguration { + b.Basic = &value + return b +} + +// WithGang sets the Gang 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 Gang field is set to the value of the last call. +func (b *WorkloadPodGroupSchedulingPolicyApplyConfiguration) WithGang(value *WorkloadPodGroupGangSchedulingPolicyApplyConfiguration) *WorkloadPodGroupSchedulingPolicyApplyConfiguration { + b.Gang = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadreference.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadreference.go new file mode 100644 index 0000000000..e7dd7c7c5e --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadreference.go @@ -0,0 +1,58 @@ +/* +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 + +// WorkloadReferenceApplyConfiguration represents a declarative configuration of the WorkloadReference type for use +// with apply. +// +// WorkloadReference references the Workload object together with the template +// that was used to create a particular PodGroup. +type WorkloadReferenceApplyConfiguration struct { + // workloadName is the name of the Workload object that contains a template + // that was used when creating a pod group. It must + // be a DNS name. + // This field is required. + WorkloadName *string `json:"workloadName,omitempty"` + // templateName is the name of a template within the Workload object that + // was used to create a pod group. It must be a DNS label. + // This field is required. + TemplateName *string `json:"templateName,omitempty"` +} + +// WorkloadReferenceApplyConfiguration constructs a declarative configuration of the WorkloadReference type for use with +// apply. +func WorkloadReference() *WorkloadReferenceApplyConfiguration { + return &WorkloadReferenceApplyConfiguration{} +} + +// WithWorkloadName sets the WorkloadName 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 WorkloadName field is set to the value of the last call. +func (b *WorkloadReferenceApplyConfiguration) WithWorkloadName(value string) *WorkloadReferenceApplyConfiguration { + b.WorkloadName = &value + return b +} + +// WithTemplateName sets the TemplateName 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 TemplateName field is set to the value of the last call. +func (b *WorkloadReferenceApplyConfiguration) WithTemplateName(value string) *WorkloadReferenceApplyConfiguration { + b.TemplateName = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadspec.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadspec.go new file mode 100644 index 0000000000..475b998745 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha3/workloadspec.go @@ -0,0 +1,82 @@ +/* +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 + +// WorkloadSpecApplyConfiguration represents a declarative configuration of the WorkloadSpec type for use +// with apply. +// +// WorkloadSpec defines the desired state of a Workload. +type WorkloadSpecApplyConfiguration struct { + // controllerRef is an optional reference to the controlling object, such as a + // Deployment or Job. This field is intended for use by tools like CLIs + // to provide a link back to the original workload definition. + // This field is immutable. + ControllerRef *TypedLocalObjectReferenceApplyConfiguration `json:"controllerRef,omitempty"` + // podGroupTemplates is the list of templates that make up the Workload. + // The maximum number of templates is 8. Templates cannot be added or removed after the workload is created. + // Existing templates may still be updated where their individual fields allow it. + // Exactly one of CompositePodGroupTemplates and PodGroupTemplates must be set. + PodGroupTemplates []PodGroupTemplateApplyConfiguration `json:"podGroupTemplates,omitempty"` + // compositePodGroupTemplates is the list of CompositePodGroup templates that make up the Workload. + // The maximum number of templates is 8. This field is immutable. + // Exactly one of CompositePodGroupTemplates and PodGroupTemplates must be set. + // + // This field is used only when the CompositePodGroup feature gate is enabled. + CompositePodGroupTemplates []CompositePodGroupTemplateApplyConfiguration `json:"compositePodGroupTemplates,omitempty"` +} + +// WorkloadSpecApplyConfiguration constructs a declarative configuration of the WorkloadSpec type for use with +// apply. +func WorkloadSpec() *WorkloadSpecApplyConfiguration { + return &WorkloadSpecApplyConfiguration{} +} + +// WithControllerRef sets the ControllerRef 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 ControllerRef field is set to the value of the last call. +func (b *WorkloadSpecApplyConfiguration) WithControllerRef(value *TypedLocalObjectReferenceApplyConfiguration) *WorkloadSpecApplyConfiguration { + b.ControllerRef = value + return b +} + +// WithPodGroupTemplates adds the given value to the PodGroupTemplates 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 PodGroupTemplates field. +func (b *WorkloadSpecApplyConfiguration) WithPodGroupTemplates(values ...*PodGroupTemplateApplyConfiguration) *WorkloadSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPodGroupTemplates") + } + b.PodGroupTemplates = append(b.PodGroupTemplates, *values[i]) + } + return b +} + +// WithCompositePodGroupTemplates adds the given value to the CompositePodGroupTemplates 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 CompositePodGroupTemplates field. +func (b *WorkloadSpecApplyConfiguration) WithCompositePodGroupTemplates(values ...*CompositePodGroupTemplateApplyConfiguration) *WorkloadSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithCompositePodGroupTemplates") + } + b.CompositePodGroupTemplates = append(b.CompositePodGroupTemplates, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/compositedisruptionmode.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/compositedisruptionmode.go new file mode 100644 index 0000000000..40f9a62984 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/compositedisruptionmode.go @@ -0,0 +1,57 @@ +/* +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 v1beta1 + +import ( + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" +) + +// CompositeDisruptionModeApplyConfiguration represents a declarative configuration of the CompositeDisruptionMode type for use +// with apply. +// +// CompositeDisruptionMode defines how individual entities within a composite pod group can be disrupted. +// Exactly one mode must be set. +type CompositeDisruptionModeApplyConfiguration struct { + // single specifies that children groups can be disrupted independently from each other. + Single *schedulingv1beta1.SingleCompositeDisruptionMode `json:"single,omitempty"` + // all specifies that all children groups can only be disrupted together. + All *schedulingv1beta1.AllCompositeDisruptionMode `json:"all,omitempty"` +} + +// CompositeDisruptionModeApplyConfiguration constructs a declarative configuration of the CompositeDisruptionMode type for use with +// apply. +func CompositeDisruptionMode() *CompositeDisruptionModeApplyConfiguration { + return &CompositeDisruptionModeApplyConfiguration{} +} + +// WithSingle sets the Single 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 Single field is set to the value of the last call. +func (b *CompositeDisruptionModeApplyConfiguration) WithSingle(value schedulingv1beta1.SingleCompositeDisruptionMode) *CompositeDisruptionModeApplyConfiguration { + b.Single = &value + return b +} + +// WithAll sets the All 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 All field is set to the value of the last call. +func (b *CompositeDisruptionModeApplyConfiguration) WithAll(value schedulingv1beta1.AllCompositeDisruptionMode) *CompositeDisruptionModeApplyConfiguration { + b.All = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/compositegangschedulingpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/compositegangschedulingpolicy.go new file mode 100644 index 0000000000..fc007af154 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/compositegangschedulingpolicy.go @@ -0,0 +1,45 @@ +/* +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 v1beta1 + +// CompositeGangSchedulingPolicyApplyConfiguration represents a declarative configuration of the CompositeGangSchedulingPolicy type for use +// with apply. +// +// CompositeGangSchedulingPolicy indicates that the groups belonging to the composite group +// should be scheduled using all-or-nothing semantics. +type CompositeGangSchedulingPolicyApplyConfiguration struct { + // minGroupCount is the minimum number of child groups that must be schedulable + // or scheduled at the same time for the scheduler to admit the entire group. + // It must be a positive integer. + MinGroupCount *int32 `json:"minGroupCount,omitempty"` +} + +// CompositeGangSchedulingPolicyApplyConfiguration constructs a declarative configuration of the CompositeGangSchedulingPolicy type for use with +// apply. +func CompositeGangSchedulingPolicy() *CompositeGangSchedulingPolicyApplyConfiguration { + return &CompositeGangSchedulingPolicyApplyConfiguration{} +} + +// WithMinGroupCount sets the MinGroupCount 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 MinGroupCount field is set to the value of the last call. +func (b *CompositeGangSchedulingPolicyApplyConfiguration) WithMinGroupCount(value int32) *CompositeGangSchedulingPolicyApplyConfiguration { + b.MinGroupCount = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/compositepodgroupschedulingconstraints.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/compositepodgroupschedulingconstraints.go new file mode 100644 index 0000000000..56361230cd --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/compositepodgroupschedulingconstraints.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 v1beta1 + +// CompositePodGroupSchedulingConstraintsApplyConfiguration represents a declarative configuration of the CompositePodGroupSchedulingConstraints type for use +// with apply. +// +// CompositePodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a CompositePodGroup. +type CompositePodGroupSchedulingConstraintsApplyConfiguration struct { + // topology defines the topology constraints for the composite pod group. + // Currently only a single topology constraint can be specified. This may change in the future. + Topology []TopologyConstraintApplyConfiguration `json:"topology,omitempty"` +} + +// CompositePodGroupSchedulingConstraintsApplyConfiguration constructs a declarative configuration of the CompositePodGroupSchedulingConstraints type for use with +// apply. +func CompositePodGroupSchedulingConstraints() *CompositePodGroupSchedulingConstraintsApplyConfiguration { + return &CompositePodGroupSchedulingConstraintsApplyConfiguration{} +} + +// WithTopology adds the given value to the Topology 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 Topology field. +func (b *CompositePodGroupSchedulingConstraintsApplyConfiguration) WithTopology(values ...*TopologyConstraintApplyConfiguration) *CompositePodGroupSchedulingConstraintsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithTopology") + } + b.Topology = append(b.Topology, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/compositepodgroupschedulingpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/compositepodgroupschedulingpolicy.go new file mode 100644 index 0000000000..8c8905d77d --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/compositepodgroupschedulingpolicy.go @@ -0,0 +1,59 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +import ( + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" +) + +// CompositePodGroupSchedulingPolicyApplyConfiguration represents a declarative configuration of the CompositePodGroupSchedulingPolicy type for use +// with apply. +// +// CompositePodGroupSchedulingPolicy defines the scheduling configuration for a CompositePodGroup. +// Exactly one policy must be set. +type CompositePodGroupSchedulingPolicyApplyConfiguration struct { + // basic specifies that the groups of this composite group should be scheduled independently. + // This field is immutable. + Basic *schedulingv1beta1.CompositeBasicSchedulingPolicy `json:"basic,omitempty"` + // gang specifies that the groups of this composite group should be scheduled using + // all-or-nothing semantics. + Gang *CompositeGangSchedulingPolicyApplyConfiguration `json:"gang,omitempty"` +} + +// CompositePodGroupSchedulingPolicyApplyConfiguration constructs a declarative configuration of the CompositePodGroupSchedulingPolicy type for use with +// apply. +func CompositePodGroupSchedulingPolicy() *CompositePodGroupSchedulingPolicyApplyConfiguration { + return &CompositePodGroupSchedulingPolicyApplyConfiguration{} +} + +// WithBasic sets the Basic 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 Basic field is set to the value of the last call. +func (b *CompositePodGroupSchedulingPolicyApplyConfiguration) WithBasic(value schedulingv1beta1.CompositeBasicSchedulingPolicy) *CompositePodGroupSchedulingPolicyApplyConfiguration { + b.Basic = &value + return b +} + +// WithGang sets the Gang 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 Gang field is set to the value of the last call. +func (b *CompositePodGroupSchedulingPolicyApplyConfiguration) WithGang(value *CompositeGangSchedulingPolicyApplyConfiguration) *CompositePodGroupSchedulingPolicyApplyConfiguration { + b.Gang = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/compositepodgrouptemplate.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/compositepodgrouptemplate.go new file mode 100644 index 0000000000..511b4cca54 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/compositepodgrouptemplate.go @@ -0,0 +1,157 @@ +/* +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 v1beta1 + +import ( + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" +) + +// CompositePodGroupTemplateApplyConfiguration represents a declarative configuration of the CompositePodGroupTemplate type for use +// with apply. +// +// CompositePodGroupTemplate represents a template for a CompositePodGroup with a scheduling policy. +type CompositePodGroupTemplateApplyConfiguration struct { + // name is a unique identifier for the CompositePodGroupTemplate within the Workload. + // It must be a DNS label. This field is required. + Name *string `json:"name,omitempty"` + // schedulingPolicy defines the scheduling policy for this template. + SchedulingPolicy *CompositePodGroupSchedulingPolicyApplyConfiguration `json:"schedulingPolicy,omitempty"` + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this CompositePodGroupTemplate. + // This field is immutable. + SchedulingConstraints *CompositePodGroupSchedulingConstraintsApplyConfiguration `json:"schedulingConstraints,omitempty"` + // disruptionMode defines the mode in which a given CompositePodGroup can be disrupted. + // One of Single, All. + // This field is immutable. + DisruptionMode *CompositeDisruptionModeApplyConfiguration `json:"disruptionMode,omitempty"` + // priorityClassName indicates the priority that should be considered when scheduling + // a composite pod group created from this template. If no priority class is specified, + // admission control can set this to the global default priority class if it exists. + // Otherwise, composite pod groups created from this template will have the priority set + // to zero. + // This field is immutable. + PriorityClassName *string `json:"priorityClassName,omitempty"` + // priority is the value of priority of composite pod groups created from this template. + // Various system components use this field to find the priority of the composite pod group. + // When Priority Admission Controller is enabled, it prevents users from setting this field. + // The admission controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + Priority *int32 `json:"priority,omitempty"` + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + PreemptionPolicy *schedulingv1beta1.PreemptionPolicy `json:"preemptionPolicy,omitempty"` + // podGroupTemplates is the list of templates for children PodGroups. + // The maximum number of templates is 8. At least one entry in CompositePodGroupTemplates + // or PodGroupTemplates must be set. + PodGroupTemplates []PodGroupTemplateApplyConfiguration `json:"podGroupTemplates,omitempty"` + // compositePodGroupTemplates is the list of templates for children CompositePodGroups. + // The maximum number of templates is 8. At least one entry in CompositePodGroupTemplates + // or PodGroupTemplates must be set. + CompositePodGroupTemplates []CompositePodGroupTemplateApplyConfiguration `json:"compositePodGroupTemplates,omitempty"` +} + +// CompositePodGroupTemplateApplyConfiguration constructs a declarative configuration of the CompositePodGroupTemplate type for use with +// apply. +func CompositePodGroupTemplate() *CompositePodGroupTemplateApplyConfiguration { + return &CompositePodGroupTemplateApplyConfiguration{} +} + +// 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 *CompositePodGroupTemplateApplyConfiguration) WithName(value string) *CompositePodGroupTemplateApplyConfiguration { + b.Name = &value + return b +} + +// WithSchedulingPolicy sets the SchedulingPolicy 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 SchedulingPolicy field is set to the value of the last call. +func (b *CompositePodGroupTemplateApplyConfiguration) WithSchedulingPolicy(value *CompositePodGroupSchedulingPolicyApplyConfiguration) *CompositePodGroupTemplateApplyConfiguration { + b.SchedulingPolicy = value + return b +} + +// WithSchedulingConstraints sets the SchedulingConstraints 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 SchedulingConstraints field is set to the value of the last call. +func (b *CompositePodGroupTemplateApplyConfiguration) WithSchedulingConstraints(value *CompositePodGroupSchedulingConstraintsApplyConfiguration) *CompositePodGroupTemplateApplyConfiguration { + b.SchedulingConstraints = value + return b +} + +// WithDisruptionMode sets the DisruptionMode 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 DisruptionMode field is set to the value of the last call. +func (b *CompositePodGroupTemplateApplyConfiguration) WithDisruptionMode(value *CompositeDisruptionModeApplyConfiguration) *CompositePodGroupTemplateApplyConfiguration { + b.DisruptionMode = value + return b +} + +// WithPriorityClassName sets the PriorityClassName 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 PriorityClassName field is set to the value of the last call. +func (b *CompositePodGroupTemplateApplyConfiguration) WithPriorityClassName(value string) *CompositePodGroupTemplateApplyConfiguration { + b.PriorityClassName = &value + return b +} + +// WithPriority sets the Priority 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 Priority field is set to the value of the last call. +func (b *CompositePodGroupTemplateApplyConfiguration) WithPriority(value int32) *CompositePodGroupTemplateApplyConfiguration { + b.Priority = &value + return b +} + +// WithPreemptionPolicy sets the PreemptionPolicy 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 PreemptionPolicy field is set to the value of the last call. +func (b *CompositePodGroupTemplateApplyConfiguration) WithPreemptionPolicy(value schedulingv1beta1.PreemptionPolicy) *CompositePodGroupTemplateApplyConfiguration { + b.PreemptionPolicy = &value + return b +} + +// WithPodGroupTemplates adds the given value to the PodGroupTemplates 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 PodGroupTemplates field. +func (b *CompositePodGroupTemplateApplyConfiguration) WithPodGroupTemplates(values ...*PodGroupTemplateApplyConfiguration) *CompositePodGroupTemplateApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPodGroupTemplates") + } + b.PodGroupTemplates = append(b.PodGroupTemplates, *values[i]) + } + return b +} + +// WithCompositePodGroupTemplates adds the given value to the CompositePodGroupTemplates 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 CompositePodGroupTemplates field. +func (b *CompositePodGroupTemplateApplyConfiguration) WithCompositePodGroupTemplates(values ...*CompositePodGroupTemplateApplyConfiguration) *CompositePodGroupTemplateApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithCompositePodGroupTemplates") + } + b.CompositePodGroupTemplates = append(b.CompositePodGroupTemplates, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/disruptionmode.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/disruptionmode.go new file mode 100644 index 0000000000..de1d2c8d3b --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/disruptionmode.go @@ -0,0 +1,57 @@ +/* +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 v1beta1 + +import ( + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" +) + +// DisruptionModeApplyConfiguration represents a declarative configuration of the DisruptionMode type for use +// with apply. +// +// DisruptionMode defines how individual entities within a group can be disrupted. +// Exactly one mode can be set. +type DisruptionModeApplyConfiguration struct { + // single specifies that children can be disrupted independently from each other. + Single *schedulingv1beta1.SingleDisruptionMode `json:"single,omitempty"` + // all specifies that all children can only be disrupted together. + All *schedulingv1beta1.AllDisruptionMode `json:"all,omitempty"` +} + +// DisruptionModeApplyConfiguration constructs a declarative configuration of the DisruptionMode type for use with +// apply. +func DisruptionMode() *DisruptionModeApplyConfiguration { + return &DisruptionModeApplyConfiguration{} +} + +// WithSingle sets the Single 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 Single field is set to the value of the last call. +func (b *DisruptionModeApplyConfiguration) WithSingle(value schedulingv1beta1.SingleDisruptionMode) *DisruptionModeApplyConfiguration { + b.Single = &value + return b +} + +// WithAll sets the All 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 All field is set to the value of the last call. +func (b *DisruptionModeApplyConfiguration) WithAll(value schedulingv1beta1.AllDisruptionMode) *DisruptionModeApplyConfiguration { + b.All = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/gangschedulingpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/gangschedulingpolicy.go similarity index 71% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/gangschedulingpolicy.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/gangschedulingpolicy.go index 987a89013b..0c6d1a4d3e 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/gangschedulingpolicy.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/gangschedulingpolicy.go @@ -16,16 +16,24 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 // GangSchedulingPolicyApplyConfiguration represents a declarative configuration of the GangSchedulingPolicy type for use // with apply. // // GangSchedulingPolicy defines the parameters for gang scheduling. type GangSchedulingPolicyApplyConfiguration struct { - // MinCount is the minimum number of pods that must be schedulable or scheduled + // minCount is the minimum number of pods that must be schedulable or scheduled // at the same time for the scheduler to admit the entire group. - // It must be a positive integer. + // It must be a positive integer. This field is mutable to support workload scaling. + // + // Note that the scheduler operates on an eventually consistent model. Updates + // to minCount may not be immediately reflected in scheduling decisions due to + // propagation delays. If minCount is updated while a scheduling cycle is in + // progress for that group, the new value may not take effect until the next + // cycle. Moreover, minCount is only enforced during scheduling, meaning that + // modifications to this field do not affect already-scheduled pods, applying + // only to those evaluated in future cycles. MinCount *int32 `json:"minCount,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroup.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroup.go new file mode 100644 index 0000000000..0bdbc2d4e9 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroup.go @@ -0,0 +1,296 @@ +/* +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 v1beta1 + +import ( + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + internal "k8s.io/client-go/applyconfigurations/internal" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// PodGroupApplyConfiguration represents a declarative configuration of the PodGroup type for use +// with apply. +// +// PodGroup represents a runtime instance of pods grouped together. +// PodGroups are created by workload controllers (Job, LWS, JobSet, etc...) from +// Workload.podGroupTemplates. +// PodGroup API enablement is toggled by the GenericWorkload feature gate. +type PodGroupApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec defines the desired state of the PodGroup. + Spec *PodGroupSpecApplyConfiguration `json:"spec,omitempty"` + // status represents the current observed state of the PodGroup. + Status *PodGroupStatusApplyConfiguration `json:"status,omitempty"` +} + +// PodGroup constructs a declarative configuration of the PodGroup type for use with +// apply. +func PodGroup(name, namespace string) *PodGroupApplyConfiguration { + b := &PodGroupApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("PodGroup") + b.WithAPIVersion("scheduling.k8s.io/v1beta1") + return b +} + +// ExtractPodGroupFrom extracts the applied configuration owned by fieldManager from +// podGroup for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// podGroup must be a unmodified PodGroup API object that was retrieved from the Kubernetes API. +// ExtractPodGroupFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractPodGroupFrom(podGroup *schedulingv1beta1.PodGroup, fieldManager string, subresource string) (*PodGroupApplyConfiguration, error) { + b := &PodGroupApplyConfiguration{} + err := managedfields.ExtractInto(podGroup, internal.Parser().Type("io.k8s.api.scheduling.v1beta1.PodGroup"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(podGroup.Name) + b.WithNamespace(podGroup.Namespace) + + b.WithKind("PodGroup") + b.WithAPIVersion("scheduling.k8s.io/v1beta1") + return b, nil +} + +// ExtractPodGroup extracts the applied configuration owned by fieldManager from +// podGroup. If no managedFields are found in podGroup for fieldManager, a +// PodGroupApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// podGroup must be a unmodified PodGroup API object that was retrieved from the Kubernetes API. +// ExtractPodGroup provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractPodGroup(podGroup *schedulingv1beta1.PodGroup, fieldManager string) (*PodGroupApplyConfiguration, error) { + return ExtractPodGroupFrom(podGroup, fieldManager, "") +} + +// ExtractPodGroupStatus extracts the applied configuration owned by fieldManager from +// podGroup for the status subresource. +func ExtractPodGroupStatus(podGroup *schedulingv1beta1.PodGroup, fieldManager string) (*PodGroupApplyConfiguration, error) { + return ExtractPodGroupFrom(podGroup, fieldManager, "status") +} + +func (b PodGroupApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind 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 Kind field is set to the value of the last call. +func (b *PodGroupApplyConfiguration) WithKind(value string) *PodGroupApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion 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 APIVersion field is set to the value of the last call. +func (b *PodGroupApplyConfiguration) WithAPIVersion(value string) *PodGroupApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// 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 *PodGroupApplyConfiguration) WithName(value string) *PodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call. +func (b *PodGroupApplyConfiguration) WithGenerateName(value string) *PodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call. +func (b *PodGroupApplyConfiguration) WithNamespace(value string) *PodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID 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 UID field is set to the value of the last call. +func (b *PodGroupApplyConfiguration) WithUID(value types.UID) *PodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call. +func (b *PodGroupApplyConfiguration) WithResourceVersion(value string) *PodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation 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 Generation field is set to the value of the last call. +func (b *PodGroupApplyConfiguration) WithGeneration(value int64) *PodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp 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 CreationTimestamp field is set to the value of the last call. +func (b *PodGroupApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp 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 DeletionTimestamp field is set to the value of the last call. +func (b *PodGroupApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds 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 DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *PodGroupApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels 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 Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *PodGroupApplyConfiguration) WithLabels(entries map[string]string) *PodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations 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 Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *PodGroupApplyConfiguration) WithAnnotations(entries map[string]string) *PodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences 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 OwnerReferences field. +func (b *PodGroupApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers 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 Finalizers field. +func (b *PodGroupApplyConfiguration) WithFinalizers(values ...string) *PodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *PodGroupApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec 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 Spec field is set to the value of the last call. +func (b *PodGroupApplyConfiguration) WithSpec(value *PodGroupSpecApplyConfiguration) *PodGroupApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status 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 Status field is set to the value of the last call. +func (b *PodGroupApplyConfiguration) WithStatus(value *PodGroupStatusApplyConfiguration) *PodGroupApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *PodGroupApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *PodGroupApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *PodGroupApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *PodGroupApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroupresourceclaim.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroupresourceclaim.go new file mode 100644 index 0000000000..6b4de69ffe --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroupresourceclaim.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +// PodGroupResourceClaimApplyConfiguration represents a declarative configuration of the PodGroupResourceClaim type for use +// with apply. +// +// PodGroupResourceClaim references exactly one ResourceClaim, either directly +// or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim +// for the PodGroup. +// +// It adds a name to it that uniquely identifies the ResourceClaim inside the PodGroup. +// Pods that need access to the ResourceClaim define a matching reference in its +// own Spec.ResourceClaims. The Pod's claim must match all fields of the +// PodGroup's claim exactly. +type PodGroupResourceClaimApplyConfiguration struct { + // name uniquely identifies this resource claim inside the PodGroup. + // This must be a DNS_LABEL. + Name *string `json:"name,omitempty"` + // resourceClaimName is the name of a ResourceClaim object in the same + // namespace as this PodGroup. The ResourceClaim will be reserved for the + // PodGroup instead of its individual pods. + // + // Exactly one of ResourceClaimName and ResourceClaimTemplateName must + // be set. + ResourceClaimName *string `json:"resourceClaimName,omitempty"` + // resourceClaimTemplateName is the name of a ResourceClaimTemplate + // object in the same namespace as this PodGroup. + // + // The template will be used to create a new ResourceClaim, which will + // be bound to this PodGroup. When this PodGroup is deleted, the ResourceClaim + // will also be deleted. The PodGroup name and resource name, along with a + // generated component, will be used to form a unique name for the + // ResourceClaim, which will be recorded in podgroup.status.resourceClaimStatuses. + // + // This field is immutable and no changes will be made to the + // corresponding ResourceClaim by the control plane after creating the + // ResourceClaim. + // + // Exactly one of ResourceClaimName and ResourceClaimTemplateName must + // be set. + ResourceClaimTemplateName *string `json:"resourceClaimTemplateName,omitempty"` +} + +// PodGroupResourceClaimApplyConfiguration constructs a declarative configuration of the PodGroupResourceClaim type for use with +// apply. +func PodGroupResourceClaim() *PodGroupResourceClaimApplyConfiguration { + return &PodGroupResourceClaimApplyConfiguration{} +} + +// 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 *PodGroupResourceClaimApplyConfiguration) WithName(value string) *PodGroupResourceClaimApplyConfiguration { + b.Name = &value + return b +} + +// WithResourceClaimName sets the ResourceClaimName 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 ResourceClaimName field is set to the value of the last call. +func (b *PodGroupResourceClaimApplyConfiguration) WithResourceClaimName(value string) *PodGroupResourceClaimApplyConfiguration { + b.ResourceClaimName = &value + return b +} + +// WithResourceClaimTemplateName sets the ResourceClaimTemplateName 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 ResourceClaimTemplateName field is set to the value of the last call. +func (b *PodGroupResourceClaimApplyConfiguration) WithResourceClaimTemplateName(value string) *PodGroupResourceClaimApplyConfiguration { + b.ResourceClaimTemplateName = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroupresourceclaimstatus.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroupresourceclaimstatus.go new file mode 100644 index 0000000000..4b41f4e5f8 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroupresourceclaimstatus.go @@ -0,0 +1,59 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +// PodGroupResourceClaimStatusApplyConfiguration represents a declarative configuration of the PodGroupResourceClaimStatus type for use +// with apply. +// +// PodGroupResourceClaimStatus is stored in the PodGroupStatus for each +// PodGroupResourceClaim which references a ResourceClaimTemplate. It stores the +// generated name for the corresponding ResourceClaim. +type PodGroupResourceClaimStatusApplyConfiguration struct { + // name uniquely identifies this resource claim inside the PodGroup. This + // must match the name of an entry in podgroup.spec.resourceClaims, which + // implies that the string must be a DNS_LABEL. + Name *string `json:"name,omitempty"` + // resourceClaimName is the name of the ResourceClaim that was generated for + // the PodGroup in the namespace of the PodGroup. If this is unset, then + // generating a ResourceClaim was not necessary. The + // podgroup.spec.resourceClaims entry can be ignored in this case. + ResourceClaimName *string `json:"resourceClaimName,omitempty"` +} + +// PodGroupResourceClaimStatusApplyConfiguration constructs a declarative configuration of the PodGroupResourceClaimStatus type for use with +// apply. +func PodGroupResourceClaimStatus() *PodGroupResourceClaimStatusApplyConfiguration { + return &PodGroupResourceClaimStatusApplyConfiguration{} +} + +// 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 *PodGroupResourceClaimStatusApplyConfiguration) WithName(value string) *PodGroupResourceClaimStatusApplyConfiguration { + b.Name = &value + return b +} + +// WithResourceClaimName sets the ResourceClaimName 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 ResourceClaimName field is set to the value of the last call. +func (b *PodGroupResourceClaimStatusApplyConfiguration) WithResourceClaimName(value string) *PodGroupResourceClaimStatusApplyConfiguration { + b.ResourceClaimName = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroupschedulingconstraints.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroupschedulingconstraints.go new file mode 100644 index 0000000000..11a0ec79b7 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroupschedulingconstraints.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 v1beta1 + +// PodGroupSchedulingConstraintsApplyConfiguration represents a declarative configuration of the PodGroupSchedulingConstraints type for use +// with apply. +// +// PodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a PodGroup. +type PodGroupSchedulingConstraintsApplyConfiguration struct { + // topology defines the topology constraints for the pod group. + // Currently only a single topology constraint can be specified. This may change in the future. + Topology []TopologyConstraintApplyConfiguration `json:"topology,omitempty"` +} + +// PodGroupSchedulingConstraintsApplyConfiguration constructs a declarative configuration of the PodGroupSchedulingConstraints type for use with +// apply. +func PodGroupSchedulingConstraints() *PodGroupSchedulingConstraintsApplyConfiguration { + return &PodGroupSchedulingConstraintsApplyConfiguration{} +} + +// WithTopology adds the given value to the Topology 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 Topology field. +func (b *PodGroupSchedulingConstraintsApplyConfiguration) WithTopology(values ...*TopologyConstraintApplyConfiguration) *PodGroupSchedulingConstraintsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithTopology") + } + b.Topology = append(b.Topology, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroupschedulingpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroupschedulingpolicy.go new file mode 100644 index 0000000000..9cd2d05ab8 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroupschedulingpolicy.go @@ -0,0 +1,64 @@ +/* +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 v1beta1 + +import ( + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" +) + +// PodGroupSchedulingPolicyApplyConfiguration represents a declarative configuration of the PodGroupSchedulingPolicy type for use +// with apply. +// +// PodGroupSchedulingPolicy defines the scheduling configuration for a PodGroup. +// Exactly one policy must be set. The policy is chosen at creation time by setting either the +// Basic or Gang field. The PodGroup may not change policy after creation. +// Fields within chosen policy may be updated after creation when their individual fields allow it. +type PodGroupSchedulingPolicyApplyConfiguration struct { + // basic specifies that the pods in this group should be scheduled using + // standard Kubernetes scheduling behavior. Setting this field at group creation time + // opts this group to basic scheduling; this field cannot be changed afterward. + Basic *schedulingv1beta1.BasicSchedulingPolicy `json:"basic,omitempty"` + // gang specifies that the pods in this group should be scheduled using + // all-or-nothing semantics. Setting this field at group creation time + // opts this group to gang scheduling; this field cannot be set or unset afterward. + // The minCount field within Gang scheduling policy remains mutable after group creation. + Gang *GangSchedulingPolicyApplyConfiguration `json:"gang,omitempty"` +} + +// PodGroupSchedulingPolicyApplyConfiguration constructs a declarative configuration of the PodGroupSchedulingPolicy type for use with +// apply. +func PodGroupSchedulingPolicy() *PodGroupSchedulingPolicyApplyConfiguration { + return &PodGroupSchedulingPolicyApplyConfiguration{} +} + +// WithBasic sets the Basic 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 Basic field is set to the value of the last call. +func (b *PodGroupSchedulingPolicyApplyConfiguration) WithBasic(value schedulingv1beta1.BasicSchedulingPolicy) *PodGroupSchedulingPolicyApplyConfiguration { + b.Basic = &value + return b +} + +// WithGang sets the Gang 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 Gang field is set to the value of the last call. +func (b *PodGroupSchedulingPolicyApplyConfiguration) WithGang(value *GangSchedulingPolicyApplyConfiguration) *PodGroupSchedulingPolicyApplyConfiguration { + b.Gang = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupspec.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroupspec.go similarity index 65% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupspec.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroupspec.go index 76538c6221..fb40a2f150 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroupspec.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( - schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" ) // PodGroupSpecApplyConfiguration represents a declarative configuration of the PodGroupSpec type for use @@ -27,54 +27,61 @@ import ( // // PodGroupSpec defines the desired state of a PodGroup. type PodGroupSpecApplyConfiguration struct { - // PodGroupTemplateRef references an optional PodGroup template within other object - // (e.g. Workload) that was used to create the PodGroup. This field is immutable. - PodGroupTemplateRef *PodGroupTemplateReferenceApplyConfiguration `json:"podGroupTemplateRef,omitempty"` - // SchedulingPolicy defines the scheduling policy for this instance of the PodGroup. - // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // parentCompositePodGroupName contains the name of the parent composite pod group + // within the same namespace as this pod group. + // If it's nil, then this pod group is a root of a workload's hierarchy. + // This field is used only when the CompositePodGroup feature gate is enabled. + // This field is immutable. + ParentCompositePodGroupName *string `json:"parentCompositePodGroupName,omitempty"` + // workloadRef references an optional PodGroup template within the Workload + // object that was used to create the PodGroup. // This field is immutable. + WorkloadRef *WorkloadReferenceApplyConfiguration `json:"workloadRef,omitempty"` + // schedulingPolicy defines the scheduling policy for this instance of the PodGroup. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. SchedulingPolicy *PodGroupSchedulingPolicyApplyConfiguration `json:"schedulingPolicy,omitempty"` - // SchedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroup. + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroup. // Controllers are expected to fill this field by copying it from a PodGroupTemplate. // This field is immutable. // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. SchedulingConstraints *PodGroupSchedulingConstraintsApplyConfiguration `json:"schedulingConstraints,omitempty"` - // ResourceClaims defines which ResourceClaims may be shared among Pods in + // resourceClaims defines which ResourceClaims may be shared among Pods in // the group. Pods consume the devices allocated to a PodGroup's claim by // defining a claim in its own Spec.ResourceClaims that matches the // PodGroup's claim exactly. The claim must have the same name and refer to // the same ResourceClaim or ResourceClaimTemplate. // - // This is an alpha-level field and requires that the + // This is a beta-level field and requires that the // DRAWorkloadResourceClaims feature gate is enabled. // // This field is immutable. ResourceClaims []PodGroupResourceClaimApplyConfiguration `json:"resourceClaims,omitempty"` - // DisruptionMode defines the mode in which a given PodGroup can be disrupted. + // disruptionMode defines the mode in which a given PodGroup can be disrupted. // Controllers are expected to fill this field by copying it from a PodGroupTemplate. - // One of Pod, PodGroup. Defaults to Pod if unset. + // One of Single, All. Defaults to Single if unset. // This field is immutable. - // This field is available only when the WorkloadAwarePreemption feature gate - // is enabled. - DisruptionMode *schedulingv1alpha2.DisruptionMode `json:"disruptionMode,omitempty"` - // PriorityClassName defines the priority that should be considered when scheduling this pod group. + DisruptionMode *DisruptionModeApplyConfiguration `json:"disruptionMode,omitempty"` + // priorityClassName defines the priority that should be considered when scheduling this pod group. // Controllers are expected to fill this field by copying it from a PodGroupTemplate. // Otherwise, it is validated and resolved similarly to the PriorityClassName on PodGroupTemplate // (i.e. if no priority class is specified, admission control can set this to the global default // priority class if it exists. Otherwise, the pod group's priority will be zero). // This field is immutable. - // This field is available only when the WorkloadAwarePreemption feature gate - // is enabled. PriorityClassName *string `json:"priorityClassName,omitempty"` - // Priority is the value of priority of this pod group. Various system components + // priority is the value of priority of this pod group. Various system components // use this field to find the priority of the pod group. When Priority Admission // Controller is enabled, it prevents users from setting this field. The admission // controller populates this field from PriorityClassName. // The higher the value, the higher the priority. // This field is immutable. - // This field is available only when the WorkloadAwarePreemption feature gate - // is enabled. Priority *int32 `json:"priority,omitempty"` + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. + // When Priority Admission Controller is enabled, it populates this field from PriorityClassName, + // and defaults to PreemptLowerPriority if value is unset in PriorityClass. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + PreemptionPolicy *schedulingv1beta1.PreemptionPolicy `json:"preemptionPolicy,omitempty"` } // PodGroupSpecApplyConfiguration constructs a declarative configuration of the PodGroupSpec type for use with @@ -83,11 +90,19 @@ func PodGroupSpec() *PodGroupSpecApplyConfiguration { return &PodGroupSpecApplyConfiguration{} } -// WithPodGroupTemplateRef sets the PodGroupTemplateRef field in the declarative configuration to the given value +// WithParentCompositePodGroupName sets the ParentCompositePodGroupName 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 ParentCompositePodGroupName field is set to the value of the last call. +func (b *PodGroupSpecApplyConfiguration) WithParentCompositePodGroupName(value string) *PodGroupSpecApplyConfiguration { + b.ParentCompositePodGroupName = &value + return b +} + +// WithWorkloadRef sets the WorkloadRef 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 PodGroupTemplateRef field is set to the value of the last call. -func (b *PodGroupSpecApplyConfiguration) WithPodGroupTemplateRef(value *PodGroupTemplateReferenceApplyConfiguration) *PodGroupSpecApplyConfiguration { - b.PodGroupTemplateRef = value +// If called multiple times, the WorkloadRef field is set to the value of the last call. +func (b *PodGroupSpecApplyConfiguration) WithWorkloadRef(value *WorkloadReferenceApplyConfiguration) *PodGroupSpecApplyConfiguration { + b.WorkloadRef = value return b } @@ -123,8 +138,8 @@ func (b *PodGroupSpecApplyConfiguration) WithResourceClaims(values ...*PodGroupR // WithDisruptionMode sets the DisruptionMode 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 DisruptionMode field is set to the value of the last call. -func (b *PodGroupSpecApplyConfiguration) WithDisruptionMode(value schedulingv1alpha2.DisruptionMode) *PodGroupSpecApplyConfiguration { - b.DisruptionMode = &value +func (b *PodGroupSpecApplyConfiguration) WithDisruptionMode(value *DisruptionModeApplyConfiguration) *PodGroupSpecApplyConfiguration { + b.DisruptionMode = value return b } @@ -143,3 +158,11 @@ func (b *PodGroupSpecApplyConfiguration) WithPriority(value int32) *PodGroupSpec b.Priority = &value return b } + +// WithPreemptionPolicy sets the PreemptionPolicy 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 PreemptionPolicy field is set to the value of the last call. +func (b *PodGroupSpecApplyConfiguration) WithPreemptionPolicy(value schedulingv1beta1.PreemptionPolicy) *PodGroupSpecApplyConfiguration { + b.PreemptionPolicy = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupstatus.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroupstatus.go similarity index 87% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupstatus.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroupstatus.go index c8c4b30da9..f52dd7cd2b 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupstatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgroupstatus.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" @@ -27,14 +27,16 @@ import ( // // PodGroupStatus represents information about the status of a pod group. type PodGroupStatusApplyConfiguration struct { - // Conditions represent the latest observations of the PodGroup's state. + // conditions represent the latest observations of the PodGroup's state. // // Known condition types: - // - "PodGroupScheduled": Indicates whether the scheduling requirement has been satisfied. + // - "PodGroupInitiallyScheduled": Indicates whether the scheduling requirement has been satisfied. + // Once this condition transitions to True, it serves as a terminal state and will never revert to False, + // even if pods are subsequently evicted and group constraints are no longer met. // - "DisruptionTarget": Indicates whether the PodGroup is about to be terminated // due to disruption such as preemption. // - // Known reasons for the PodGroupScheduled condition: + // Known reasons for the PodGroupInitiallyScheduled condition: // - "Unschedulable": The PodGroup cannot be scheduled due to resource constraints, // affinity/anti-affinity rules, or insufficient capacity for the gang. // - "SchedulerError": The PodGroup cannot be scheduled due to some internal error @@ -44,7 +46,7 @@ type PodGroupStatusApplyConfiguration struct { // - "PreemptionByScheduler": The PodGroup was preempted by the scheduler to make room for // higher-priority PodGroups or Pods. Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` - // Status of resource claims. + // resourceClaimStatuses is status of resource claims. ResourceClaimStatuses []PodGroupResourceClaimStatusApplyConfiguration `json:"resourceClaimStatuses,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgrouptemplate.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgrouptemplate.go similarity index 76% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgrouptemplate.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgrouptemplate.go index 695caf2997..e53e7d41cd 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgrouptemplate.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/podgrouptemplate.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( - schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" ) // PodGroupTemplateApplyConfiguration represents a declarative configuration of the PodGroupTemplate type for use @@ -27,45 +27,44 @@ import ( // // PodGroupTemplate represents a template for a set of pods with a scheduling policy. type PodGroupTemplateApplyConfiguration struct { - // Name is a unique identifier for the PodGroupTemplate within the Workload. + // name is a unique identifier for the PodGroupTemplate within the Workload. // It must be a DNS label. This field is immutable. Name *string `json:"name,omitempty"` - // SchedulingPolicy defines the scheduling policy for this PodGroupTemplate. + // schedulingPolicy defines the scheduling policy for this PodGroupTemplate. SchedulingPolicy *PodGroupSchedulingPolicyApplyConfiguration `json:"schedulingPolicy,omitempty"` - // SchedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroupTemplate. + // schedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroupTemplate. // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. + // This field is immutable. SchedulingConstraints *PodGroupSchedulingConstraintsApplyConfiguration `json:"schedulingConstraints,omitempty"` - // ResourceClaims defines which ResourceClaims may be shared among Pods in + // resourceClaims defines which ResourceClaims may be shared among Pods in // the group. Pods consume the devices allocated to a PodGroup's claim by // defining a claim in its own Spec.ResourceClaims that matches the // PodGroup's claim exactly. The claim must have the same name and refer to // the same ResourceClaim or ResourceClaimTemplate. // - // This is an alpha-level field and requires that the + // This is a beta-level field and requires that the // DRAWorkloadResourceClaims feature gate is enabled. // // This field is immutable. ResourceClaims []PodGroupResourceClaimApplyConfiguration `json:"resourceClaims,omitempty"` - // DisruptionMode defines the mode in which a given PodGroup can be disrupted. - // One of Pod, PodGroup. - // This field is available only when the WorkloadAwarePreemption feature gate - // is enabled. - DisruptionMode *schedulingv1alpha2.DisruptionMode `json:"disruptionMode,omitempty"` - // PriorityClassName indicates the priority that should be considered when scheduling - // a pod group created from this template. If no priority class is specified, admission - // control can set this to the global default priority class if it exists. Otherwise, - // pod groups created from this template will have the priority set to zero. - // This field is available only when the WorkloadAwarePreemption feature gate - // is enabled. + // disruptionMode defines the mode in which a given PodGroup can be disrupted. + // One of Single, All. + // This field is immutable. + DisruptionMode *DisruptionModeApplyConfiguration `json:"disruptionMode,omitempty"` + // priorityClassName indicates the priority that should be considered when scheduling + // a pod group created from this template. + // This field is immutable. PriorityClassName *string `json:"priorityClassName,omitempty"` - // Priority is the value of priority of pod groups created from this template. Various - // system components use this field to find the priority of the pod group. When - // Priority Admission Controller is enabled, it prevents users from setting this field. - // The admission controller populates this field from PriorityClassName. + // priority is the value of priority of pod groups created from this template. Various + // system components use this field to find the priority of the pod group. // The higher the value, the higher the priority. - // This field is available only when the WorkloadAwarePreemption feature gate - // is enabled. + // This field is immutable. Priority *int32 `json:"priority,omitempty"` + // preemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + PreemptionPolicy *schedulingv1beta1.PreemptionPolicy `json:"preemptionPolicy,omitempty"` } // PodGroupTemplateApplyConfiguration constructs a declarative configuration of the PodGroupTemplate type for use with @@ -114,8 +113,8 @@ func (b *PodGroupTemplateApplyConfiguration) WithResourceClaims(values ...*PodGr // WithDisruptionMode sets the DisruptionMode 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 DisruptionMode field is set to the value of the last call. -func (b *PodGroupTemplateApplyConfiguration) WithDisruptionMode(value schedulingv1alpha2.DisruptionMode) *PodGroupTemplateApplyConfiguration { - b.DisruptionMode = &value +func (b *PodGroupTemplateApplyConfiguration) WithDisruptionMode(value *DisruptionModeApplyConfiguration) *PodGroupTemplateApplyConfiguration { + b.DisruptionMode = value return b } @@ -134,3 +133,11 @@ func (b *PodGroupTemplateApplyConfiguration) WithPriority(value int32) *PodGroup b.Priority = &value return b } + +// WithPreemptionPolicy sets the PreemptionPolicy 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 PreemptionPolicy field is set to the value of the last call. +func (b *PodGroupTemplateApplyConfiguration) WithPreemptionPolicy(value schedulingv1beta1.PreemptionPolicy) *PodGroupTemplateApplyConfiguration { + b.PreemptionPolicy = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/priorityclass.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/priorityclass.go index 5fab5624ec..3c918fe901 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/priorityclass.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/priorityclass.go @@ -35,8 +35,8 @@ import ( // PriorityClass defines mapping from a priority class name to the priority // integer value. The value can be any valid integer. type PriorityClassApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // value represents the integer value of this priority class. This is the actual priority that pods diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/topologyconstraint.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/topologyconstraint.go new file mode 100644 index 0000000000..52bd8a77b5 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/topologyconstraint.go @@ -0,0 +1,45 @@ +/* +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 v1beta1 + +// TopologyConstraintApplyConfiguration represents a declarative configuration of the TopologyConstraint type for use +// with apply. +// +// TopologyConstraint defines a topology constraint for a PodGroup. +type TopologyConstraintApplyConfiguration struct { + // key specifies the key of the node label representing the topology domain. + // All pods within the PodGroup must be colocated within the same domain instance. + // Different PodGroups can land on different domain instances even if they derive from the same PodGroupTemplate. + // Examples: "topology.kubernetes.io/rack" + Key *string `json:"key,omitempty"` +} + +// TopologyConstraintApplyConfiguration constructs a declarative configuration of the TopologyConstraint type for use with +// apply. +func TopologyConstraint() *TopologyConstraintApplyConfiguration { + return &TopologyConstraintApplyConfiguration{} +} + +// WithKey sets the Key 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 Key field is set to the value of the last call. +func (b *TopologyConstraintApplyConfiguration) WithKey(value string) *TopologyConstraintApplyConfiguration { + b.Key = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/typedlocalobjectreference.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/typedlocalobjectreference.go new file mode 100644 index 0000000000..4eb57815f0 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/typedlocalobjectreference.go @@ -0,0 +1,67 @@ +/* +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 v1beta1 + +// TypedLocalObjectReferenceApplyConfiguration represents a declarative configuration of the TypedLocalObjectReference type for use +// with apply. +// +// TypedLocalObjectReference allows to reference typed object inside the same namespace. +type TypedLocalObjectReferenceApplyConfiguration struct { + // apiGroup is the group for the resource being referenced. + // If apiGroup is empty, the specified Kind must be in the core API group. + // For any other third-party types, setting apiGroup is required. + // It must be a DNS subdomain. + APIGroup *string `json:"apiGroup,omitempty"` + // kind is the type of resource being referenced. + // It must be a path segment name. + Kind *string `json:"kind,omitempty"` + // name is the name of resource being referenced. + // It must be a path segment name. + Name *string `json:"name,omitempty"` +} + +// TypedLocalObjectReferenceApplyConfiguration constructs a declarative configuration of the TypedLocalObjectReference type for use with +// apply. +func TypedLocalObjectReference() *TypedLocalObjectReferenceApplyConfiguration { + return &TypedLocalObjectReferenceApplyConfiguration{} +} + +// WithAPIGroup sets the APIGroup 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 APIGroup field is set to the value of the last call. +func (b *TypedLocalObjectReferenceApplyConfiguration) WithAPIGroup(value string) *TypedLocalObjectReferenceApplyConfiguration { + b.APIGroup = &value + return b +} + +// WithKind sets the Kind 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 Kind field is set to the value of the last call. +func (b *TypedLocalObjectReferenceApplyConfiguration) WithKind(value string) *TypedLocalObjectReferenceApplyConfiguration { + b.Kind = &value + return b +} + +// 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 *TypedLocalObjectReferenceApplyConfiguration) WithName(value string) *TypedLocalObjectReferenceApplyConfiguration { + b.Name = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/workload.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/workload.go new file mode 100644 index 0000000000..179620a4a3 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/workload.go @@ -0,0 +1,280 @@ +/* +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 v1beta1 + +import ( + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + internal "k8s.io/client-go/applyconfigurations/internal" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// WorkloadApplyConfiguration represents a declarative configuration of the Workload type for use +// with apply. +// +// Workload allows for expressing scheduling constraints that should be used +// when managing the lifecycle of workloads from the scheduling perspective, +// including scheduling, preemption, eviction and other phases. +// Workload API enablement is toggled by the GenericWorkload feature gate. +type WorkloadApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec defines the desired behavior of a Workload. + Spec *WorkloadSpecApplyConfiguration `json:"spec,omitempty"` +} + +// Workload constructs a declarative configuration of the Workload type for use with +// apply. +func Workload(name, namespace string) *WorkloadApplyConfiguration { + b := &WorkloadApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Workload") + b.WithAPIVersion("scheduling.k8s.io/v1beta1") + return b +} + +// ExtractWorkloadFrom extracts the applied configuration owned by fieldManager from +// workload for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// workload must be a unmodified Workload API object that was retrieved from the Kubernetes API. +// ExtractWorkloadFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractWorkloadFrom(workload *schedulingv1beta1.Workload, fieldManager string, subresource string) (*WorkloadApplyConfiguration, error) { + b := &WorkloadApplyConfiguration{} + err := managedfields.ExtractInto(workload, internal.Parser().Type("io.k8s.api.scheduling.v1beta1.Workload"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(workload.Name) + b.WithNamespace(workload.Namespace) + + b.WithKind("Workload") + b.WithAPIVersion("scheduling.k8s.io/v1beta1") + return b, nil +} + +// ExtractWorkload extracts the applied configuration owned by fieldManager from +// workload. If no managedFields are found in workload for fieldManager, a +// WorkloadApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// workload must be a unmodified Workload API object that was retrieved from the Kubernetes API. +// ExtractWorkload provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractWorkload(workload *schedulingv1beta1.Workload, fieldManager string) (*WorkloadApplyConfiguration, error) { + return ExtractWorkloadFrom(workload, fieldManager, "") +} + +func (b WorkloadApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind 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 Kind field is set to the value of the last call. +func (b *WorkloadApplyConfiguration) WithKind(value string) *WorkloadApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion 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 APIVersion field is set to the value of the last call. +func (b *WorkloadApplyConfiguration) WithAPIVersion(value string) *WorkloadApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// 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 *WorkloadApplyConfiguration) WithName(value string) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call. +func (b *WorkloadApplyConfiguration) WithGenerateName(value string) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call. +func (b *WorkloadApplyConfiguration) WithNamespace(value string) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID 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 UID field is set to the value of the last call. +func (b *WorkloadApplyConfiguration) WithUID(value types.UID) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call. +func (b *WorkloadApplyConfiguration) WithResourceVersion(value string) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation 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 Generation field is set to the value of the last call. +func (b *WorkloadApplyConfiguration) WithGeneration(value int64) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp 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 CreationTimestamp field is set to the value of the last call. +func (b *WorkloadApplyConfiguration) WithCreationTimestamp(value metav1.Time) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp 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 DeletionTimestamp field is set to the value of the last call. +func (b *WorkloadApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds 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 DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *WorkloadApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels 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 Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *WorkloadApplyConfiguration) WithLabels(entries map[string]string) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations 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 Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *WorkloadApplyConfiguration) WithAnnotations(entries map[string]string) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences 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 OwnerReferences field. +func (b *WorkloadApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers 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 Finalizers field. +func (b *WorkloadApplyConfiguration) WithFinalizers(values ...string) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *WorkloadApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec 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 Spec field is set to the value of the last call. +func (b *WorkloadApplyConfiguration) WithSpec(value *WorkloadSpecApplyConfiguration) *WorkloadApplyConfiguration { + b.Spec = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *WorkloadApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *WorkloadApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *WorkloadApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *WorkloadApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/workloadreference.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/workloadreference.go new file mode 100644 index 0000000000..ee6a1aee84 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/workloadreference.go @@ -0,0 +1,58 @@ +/* +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 v1beta1 + +// WorkloadReferenceApplyConfiguration represents a declarative configuration of the WorkloadReference type for use +// with apply. +// +// WorkloadReference references the Workload object together with the template +// that was used to create a particular PodGroup. +type WorkloadReferenceApplyConfiguration struct { + // workloadName is the name of the Workload object that contains a template + // that was used when creating a pod group. It must + // be a DNS name. + // This field is required. + WorkloadName *string `json:"workloadName,omitempty"` + // templateName is the name of a template within the Workload object that + // was used to create a pod group. It must be a DNS label. + // This field is required. + TemplateName *string `json:"templateName,omitempty"` +} + +// WorkloadReferenceApplyConfiguration constructs a declarative configuration of the WorkloadReference type for use with +// apply. +func WorkloadReference() *WorkloadReferenceApplyConfiguration { + return &WorkloadReferenceApplyConfiguration{} +} + +// WithWorkloadName sets the WorkloadName 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 WorkloadName field is set to the value of the last call. +func (b *WorkloadReferenceApplyConfiguration) WithWorkloadName(value string) *WorkloadReferenceApplyConfiguration { + b.WorkloadName = &value + return b +} + +// WithTemplateName sets the TemplateName 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 TemplateName field is set to the value of the last call. +func (b *WorkloadReferenceApplyConfiguration) WithTemplateName(value string) *WorkloadReferenceApplyConfiguration { + b.TemplateName = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workloadspec.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/workloadspec.go similarity index 63% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workloadspec.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/workloadspec.go index 33eb8a5c09..36a4e37fcd 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workloadspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/workloadspec.go @@ -16,21 +16,29 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 // WorkloadSpecApplyConfiguration represents a declarative configuration of the WorkloadSpec type for use // with apply. // // WorkloadSpec defines the desired state of a Workload. type WorkloadSpecApplyConfiguration struct { - // ControllerRef is an optional reference to the controlling object, such as a + // controllerRef is an optional reference to the controlling object, such as a // Deployment or Job. This field is intended for use by tools like CLIs // to provide a link back to the original workload definition. // This field is immutable. ControllerRef *TypedLocalObjectReferenceApplyConfiguration `json:"controllerRef,omitempty"` - // PodGroupTemplates is the list of templates that make up the Workload. - // The maximum number of templates is 8. This field is immutable. + // podGroupTemplates is the list of templates that make up the Workload. + // The maximum number of templates is 8. Templates cannot be added or removed after the workload is created. + // Existing templates may still be updated where their individual fields allow it. + // Exactly one of CompositePodGroupTemplates and PodGroupTemplates must be set. PodGroupTemplates []PodGroupTemplateApplyConfiguration `json:"podGroupTemplates,omitempty"` + // compositePodGroupTemplates is the list of CompositePodGroup templates that make up the Workload. + // The maximum number of templates is 8. This field is immutable. + // Exactly one of CompositePodGroupTemplates and PodGroupTemplates must be set. + // + // This field is used only when the CompositePodGroup feature gate is enabled. + CompositePodGroupTemplates []CompositePodGroupTemplateApplyConfiguration `json:"compositePodGroupTemplates,omitempty"` } // WorkloadSpecApplyConfiguration constructs a declarative configuration of the WorkloadSpec type for use with @@ -59,3 +67,16 @@ func (b *WorkloadSpecApplyConfiguration) WithPodGroupTemplates(values ...*PodGro } return b } + +// WithCompositePodGroupTemplates adds the given value to the CompositePodGroupTemplates 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 CompositePodGroupTemplates field. +func (b *WorkloadSpecApplyConfiguration) WithCompositePodGroupTemplates(values ...*CompositePodGroupTemplateApplyConfiguration) *WorkloadSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithCompositePodGroupTemplates") + } + b.CompositePodGroupTemplates = append(b.CompositePodGroupTemplates, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csidriver.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csidriver.go index 39ce1eb045..a4a1bb11c4 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csidriver.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csidriver.go @@ -36,8 +36,8 @@ import ( // Kubelet uses this object to determine whether pod information needs to be passed on mount. // CSIDriver objects are non-namespaced. type CSIDriverApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // metadata.Name indicates the name of the CSI driver that this object // refers to; it MUST be the same name returned by the CSI GetPluginName() // call for that driver. diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csidriverspec.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csidriverspec.go index 4a715c141b..839b714167 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csidriverspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csidriverspec.go @@ -178,7 +178,7 @@ type CSIDriverSpecApplyConfiguration struct { // // Default behavior if unset is to pass tokens in the VolumeContext field. ServiceAccountTokenInSecrets *bool `json:"serviceAccountTokenInSecrets,omitempty"` - // PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod + // preventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod // scheduling if the CSI driver on the node is missing. // // Enabling this option will prevent the scheduler (or any other @@ -193,7 +193,7 @@ type CSIDriverSpecApplyConfiguration struct { // newly created node may be rejected by the scheduler because of missing CSI driver // information from the node. // - // This is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled. + // This is a beta feature and requires the VolumeLimitScaling feature gate to be enabled. // Default is "false". PreventPodSchedulingIfMissing *bool `json:"preventPodSchedulingIfMissing,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csinode.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csinode.go index e0b7f349e2..9a43dc622c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csinode.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csinode.go @@ -40,12 +40,14 @@ import ( // enough that it doesn't create this object. // CSINode has an OwnerReference that points to the corresponding node object. type CSINodeApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // metadata.name must be the Kubernetes node name. *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec is the specification of CSINode Spec *CSINodeSpecApplyConfiguration `json:"spec,omitempty"` + // status contains health and status information for the node's storage. + Status *CSINodeStatusApplyConfiguration `json:"status,omitempty"` } // CSINode constructs a declarative configuration of the CSINode type for use with @@ -92,6 +94,12 @@ func ExtractCSINode(cSINode *storagev1.CSINode, fieldManager string) (*CSINodeAp return ExtractCSINodeFrom(cSINode, fieldManager, "") } +// ExtractCSINodeStatus extracts the applied configuration owned by fieldManager from +// cSINode for the status subresource. +func ExtractCSINodeStatus(cSINode *storagev1.CSINode, fieldManager string) (*CSINodeApplyConfiguration, error) { + return ExtractCSINodeFrom(cSINode, fieldManager, "status") +} + func (b CSINodeApplyConfiguration) IsApplyConfiguration() {} // WithKind sets the Kind field in the declarative configuration to the given value @@ -260,6 +268,14 @@ func (b *CSINodeApplyConfiguration) WithSpec(value *CSINodeSpecApplyConfiguratio return b } +// WithStatus sets the Status 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 Status field is set to the value of the last call. +func (b *CSINodeApplyConfiguration) WithStatus(value *CSINodeStatusApplyConfiguration) *CSINodeApplyConfiguration { + b.Status = value + return b +} + // GetKind retrieves the value of the Kind field in the declarative configuration. func (b *CSINodeApplyConfiguration) GetKind() *string { return b.TypeMetaApplyConfiguration.Kind diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csinodestatus.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csinodestatus.go new file mode 100644 index 0000000000..35294a3c29 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csinodestatus.go @@ -0,0 +1,47 @@ +/* +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 + +// CSINodeStatusApplyConfiguration represents a declarative configuration of the CSINodeStatus type for use +// with apply. +// +// CSINodeStatus contains health and status information for storage on a node. +type CSINodeStatusApplyConfiguration struct { + // storageHealth contains backend health reports for CSI drivers registered on the node. + StorageHealth []StorageHealthApplyConfiguration `json:"storageHealth,omitempty"` +} + +// CSINodeStatusApplyConfiguration constructs a declarative configuration of the CSINodeStatus type for use with +// apply. +func CSINodeStatus() *CSINodeStatusApplyConfiguration { + return &CSINodeStatusApplyConfiguration{} +} + +// WithStorageHealth adds the given value to the StorageHealth 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 StorageHealth field. +func (b *CSINodeStatusApplyConfiguration) WithStorageHealth(values ...*StorageHealthApplyConfiguration) *CSINodeStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithStorageHealth") + } + b.StorageHealth = append(b.StorageHealth, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csistoragecapacity.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csistoragecapacity.go index 8682c4349f..9ae931534b 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csistoragecapacity.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csistoragecapacity.go @@ -56,8 +56,8 @@ import ( // the scheduler assumes that capacity is insufficient and tries some other // node. type CSIStorageCapacityApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // The name has no particular meaning. It must be a DNS subdomain (dots allowed, 253 characters). // To ensure that there are no conflicts with other CSI drivers on the cluster, // the recommendation is to use csisc-, a generated name, or a reverse-domain name diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/storageclass.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/storageclass.go index 766b795c47..f4fdf32d0b 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/storageclass.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/storageclass.go @@ -38,8 +38,8 @@ import ( // StorageClasses are non-namespaced; the name of the storage class // according to etcd is in ObjectMeta.Name. type StorageClassApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // provisioner indicates the type of the provisioner. diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/storagehealth.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/storagehealth.go new file mode 100644 index 0000000000..9d232b2e66 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/storagehealth.go @@ -0,0 +1,58 @@ +/* +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 + +// StorageHealthApplyConfiguration represents a declarative configuration of the StorageHealth type for use +// with apply. +// +// StorageHealth contains storage backend health reported by a CSI driver on a node. +type StorageHealthApplyConfiguration struct { + // name is the CSI driver name, matching CSINodeDriver.name. + Name *string `json:"name,omitempty"` + // healthConditions are the adverse storage backend conditions reported by the CSI driver. + // At most 16 conditions may be reported. + HealthConditions []StorageHealthConditionApplyConfiguration `json:"healthConditions,omitempty"` +} + +// StorageHealthApplyConfiguration constructs a declarative configuration of the StorageHealth type for use with +// apply. +func StorageHealth() *StorageHealthApplyConfiguration { + return &StorageHealthApplyConfiguration{} +} + +// 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 *StorageHealthApplyConfiguration) WithName(value string) *StorageHealthApplyConfiguration { + b.Name = &value + return b +} + +// WithHealthConditions adds the given value to the HealthConditions 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 HealthConditions field. +func (b *StorageHealthApplyConfiguration) WithHealthConditions(values ...*StorageHealthConditionApplyConfiguration) *StorageHealthApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithHealthConditions") + } + b.HealthConditions = append(b.HealthConditions, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/storagehealthcondition.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/storagehealthcondition.go new file mode 100644 index 0000000000..518d00821c --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/storagehealthcondition.go @@ -0,0 +1,102 @@ +/* +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 ( + corev1 "k8s.io/api/core/v1" + storagev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// StorageHealthConditionApplyConfiguration represents a declarative configuration of the StorageHealthCondition type for use +// with apply. +// +// StorageHealthCondition represents an adverse health condition reported +// by a CSI driver for its storage backend on a node. +type StorageHealthConditionApplyConfiguration struct { + // status is the health status category. + // One of "StorageUnreachable", "StorageDegraded". + Status *storagev1.StorageHealthStatusType `json:"status,omitempty"` + // reason is a brief CamelCase machine-parseable reason. + // Maximum permitted length of a reason is 256 characters. + Reason *string `json:"reason,omitempty"` + // message is a human-readable description. + // Maximum permitted length of a message is 1024 characters. + Message *string `json:"message,omitempty"` + // accessMode is the access mode affected. Nil means all access modes are affected. + AccessMode *corev1.PersistentVolumeAccessMode `json:"accessMode,omitempty"` + // volumeMode is the volume mode affected. Nil means both are affected. + VolumeMode *corev1.PersistentVolumeMode `json:"volumeMode,omitempty"` + // lastTransitionTime is when this condition first appeared at its current state. + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` +} + +// StorageHealthConditionApplyConfiguration constructs a declarative configuration of the StorageHealthCondition type for use with +// apply. +func StorageHealthCondition() *StorageHealthConditionApplyConfiguration { + return &StorageHealthConditionApplyConfiguration{} +} + +// WithStatus sets the Status 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 Status field is set to the value of the last call. +func (b *StorageHealthConditionApplyConfiguration) WithStatus(value storagev1.StorageHealthStatusType) *StorageHealthConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithReason sets the Reason 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 Reason field is set to the value of the last call. +func (b *StorageHealthConditionApplyConfiguration) WithReason(value string) *StorageHealthConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message 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 Message field is set to the value of the last call. +func (b *StorageHealthConditionApplyConfiguration) WithMessage(value string) *StorageHealthConditionApplyConfiguration { + b.Message = &value + return b +} + +// WithAccessMode sets the AccessMode 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 AccessMode field is set to the value of the last call. +func (b *StorageHealthConditionApplyConfiguration) WithAccessMode(value corev1.PersistentVolumeAccessMode) *StorageHealthConditionApplyConfiguration { + b.AccessMode = &value + return b +} + +// WithVolumeMode sets the VolumeMode 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 VolumeMode field is set to the value of the last call. +func (b *StorageHealthConditionApplyConfiguration) WithVolumeMode(value corev1.PersistentVolumeMode) *StorageHealthConditionApplyConfiguration { + b.VolumeMode = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime 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 LastTransitionTime field is set to the value of the last call. +func (b *StorageHealthConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *StorageHealthConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattachment.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattachment.go index 6240421803..2f958f3cde 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattachment.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattachment.go @@ -35,8 +35,8 @@ import ( // // VolumeAttachment objects are non-namespaced. type VolumeAttachmentApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec represents specification of the desired attach/detach volume behavior. diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattributesclass.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattributesclass.go index aee276c3d7..9e2e8db131 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattributesclass.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattributesclass.go @@ -34,11 +34,11 @@ import ( // defined by the CSI driver. The class can be specified during dynamic provisioning // of PersistentVolumeClaims, and changed in the PersistentVolumeClaim spec after provisioning. type VolumeAttributesClassApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + metav1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Name of the CSI driver + // driverName is the name of the CSI driver // This field is immutable. DriverName *string `json:"driverName,omitempty"` // parameters hold volume attributes defined by the CSI driver. These values diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/csistoragecapacity.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/csistoragecapacity.go index e52c1adf4f..9885263cd8 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/csistoragecapacity.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/csistoragecapacity.go @@ -56,8 +56,8 @@ import ( // the scheduler assumes that capacity is insufficient and tries some other // node. type CSIStorageCapacityApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. The name has no particular meaning. It must be + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. The name has no particular meaning. It must be // be a DNS subdomain (dots allowed, 253 characters). To ensure that // there are no conflicts with other CSI drivers on the cluster, the recommendation // is to use csisc-, a generated name, or a reverse-domain name which ends diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattachment.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattachment.go index bd214650ba..839abce4b1 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattachment.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattachment.go @@ -35,8 +35,8 @@ import ( // // VolumeAttachment objects are non-namespaced. type VolumeAttachmentApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec represents specification of the desired attach/detach volume behavior. diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattributesclass.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattributesclass.go index 62ff6dcbf9..c384c1722a 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattributesclass.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattributesclass.go @@ -34,11 +34,11 @@ import ( // defined by the CSI driver. The class can be specified during dynamic provisioning // of PersistentVolumeClaims, and changed in the PersistentVolumeClaim spec after provisioning. type VolumeAttributesClassApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Name of the CSI driver + // driverName is the name of the CSI driver // This field is immutable. DriverName *string `json:"driverName,omitempty"` // parameters hold volume attributes defined by the CSI driver. These values diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csidriver.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csidriver.go index bace6d42b6..4a50776999 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csidriver.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csidriver.go @@ -39,8 +39,8 @@ import ( // Kubelet uses this object to determine whether pod information needs to be passed on mount. // CSIDriver objects are non-namespaced. type CSIDriverApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // metadata.Name indicates the name of the CSI driver that this object // refers to; it MUST be the same name returned by the CSI GetPluginName() // call for that driver. diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csidriverspec.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csidriverspec.go index cec76d9fd8..624fad712c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csidriverspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csidriverspec.go @@ -178,7 +178,7 @@ type CSIDriverSpecApplyConfiguration struct { // // Default behavior if unset is to pass tokens in the VolumeContext field. ServiceAccountTokenInSecrets *bool `json:"serviceAccountTokenInSecrets,omitempty"` - // PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod + // preventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod // scheduling if the CSI driver on the node is missing. // // Enabling this option will prevent the scheduler (or any other @@ -193,7 +193,7 @@ type CSIDriverSpecApplyConfiguration struct { // newly created node may be rejected by the scheduler because of missing CSI driver // information from the node. // - // This is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled. + // This is a beta feature and requires the VolumeLimitScaling feature gate to be enabled. // Default is "false". PreventPodSchedulingIfMissing *bool `json:"preventPodSchedulingIfMissing,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csinode.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csinode.go index 7f6907275e..f1496eb190 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csinode.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csinode.go @@ -42,11 +42,14 @@ import ( // enough that it doesn't create this object. // CSINode has an OwnerReference that points to the corresponding node object. type CSINodeApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // metadata.name must be the Kubernetes node name. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec is the specification of CSINode Spec *CSINodeSpecApplyConfiguration `json:"spec,omitempty"` + // status contains health and status information for the node's storage. + Status *CSINodeStatusApplyConfiguration `json:"status,omitempty"` } // CSINode constructs a declarative configuration of the CSINode type for use with @@ -93,6 +96,12 @@ func ExtractCSINode(cSINode *storagev1beta1.CSINode, fieldManager string) (*CSIN return ExtractCSINodeFrom(cSINode, fieldManager, "") } +// ExtractCSINodeStatus extracts the applied configuration owned by fieldManager from +// cSINode for the status subresource. +func ExtractCSINodeStatus(cSINode *storagev1beta1.CSINode, fieldManager string) (*CSINodeApplyConfiguration, error) { + return ExtractCSINodeFrom(cSINode, fieldManager, "status") +} + func (b CSINodeApplyConfiguration) IsApplyConfiguration() {} // WithKind sets the Kind field in the declarative configuration to the given value @@ -261,6 +270,14 @@ func (b *CSINodeApplyConfiguration) WithSpec(value *CSINodeSpecApplyConfiguratio return b } +// WithStatus sets the Status 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 Status field is set to the value of the last call. +func (b *CSINodeApplyConfiguration) WithStatus(value *CSINodeStatusApplyConfiguration) *CSINodeApplyConfiguration { + b.Status = value + return b +} + // GetKind retrieves the value of the Kind field in the declarative configuration. func (b *CSINodeApplyConfiguration) GetKind() *string { return b.TypeMetaApplyConfiguration.Kind diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csinodestatus.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csinodestatus.go new file mode 100644 index 0000000000..85ab831078 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csinodestatus.go @@ -0,0 +1,47 @@ +/* +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 v1beta1 + +// CSINodeStatusApplyConfiguration represents a declarative configuration of the CSINodeStatus type for use +// with apply. +// +// CSINodeStatus contains health and status information for storage on a node. +type CSINodeStatusApplyConfiguration struct { + // storageHealth contains backend health reports for CSI drivers registered on the node. + StorageHealth []StorageHealthApplyConfiguration `json:"storageHealth,omitempty"` +} + +// CSINodeStatusApplyConfiguration constructs a declarative configuration of the CSINodeStatus type for use with +// apply. +func CSINodeStatus() *CSINodeStatusApplyConfiguration { + return &CSINodeStatusApplyConfiguration{} +} + +// WithStorageHealth adds the given value to the StorageHealth 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 StorageHealth field. +func (b *CSINodeStatusApplyConfiguration) WithStorageHealth(values ...*StorageHealthApplyConfiguration) *CSINodeStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithStorageHealth") + } + b.StorageHealth = append(b.StorageHealth, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csistoragecapacity.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csistoragecapacity.go index e27221e82c..34f1830e97 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csistoragecapacity.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csistoragecapacity.go @@ -56,8 +56,8 @@ import ( // the scheduler assumes that capacity is insufficient and tries some other // node. type CSIStorageCapacityApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. The name has no particular meaning. It must be + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. The name has no particular meaning. It must be // be a DNS subdomain (dots allowed, 253 characters). To ensure that // there are no conflicts with other CSI drivers on the cluster, the recommendation // is to use csisc-, a generated name, or a reverse-domain name which ends diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/storageclass.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/storageclass.go index 49bf87ac59..d45801926b 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/storageclass.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/storageclass.go @@ -38,8 +38,8 @@ import ( // StorageClasses are non-namespaced; the name of the storage class // according to etcd is in ObjectMeta.Name. type StorageClassApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // provisioner indicates the type of the provisioner. diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/storagehealth.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/storagehealth.go new file mode 100644 index 0000000000..ccd30766e2 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/storagehealth.go @@ -0,0 +1,58 @@ +/* +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 v1beta1 + +// StorageHealthApplyConfiguration represents a declarative configuration of the StorageHealth type for use +// with apply. +// +// StorageHealth contains storage backend health reported by a CSI driver on a node. +type StorageHealthApplyConfiguration struct { + // name is the CSI driver name, matching CSINodeDriver.name. + Name *string `json:"name,omitempty"` + // healthConditions are the adverse storage backend conditions reported by the CSI driver. + // At most 16 conditions may be reported. + HealthConditions []StorageHealthConditionApplyConfiguration `json:"healthConditions,omitempty"` +} + +// StorageHealthApplyConfiguration constructs a declarative configuration of the StorageHealth type for use with +// apply. +func StorageHealth() *StorageHealthApplyConfiguration { + return &StorageHealthApplyConfiguration{} +} + +// 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 *StorageHealthApplyConfiguration) WithName(value string) *StorageHealthApplyConfiguration { + b.Name = &value + return b +} + +// WithHealthConditions adds the given value to the HealthConditions 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 HealthConditions field. +func (b *StorageHealthApplyConfiguration) WithHealthConditions(values ...*StorageHealthConditionApplyConfiguration) *StorageHealthApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithHealthConditions") + } + b.HealthConditions = append(b.HealthConditions, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/storagehealthcondition.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/storagehealthcondition.go new file mode 100644 index 0000000000..6fd4e6bfa1 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/storagehealthcondition.go @@ -0,0 +1,102 @@ +/* +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 v1beta1 + +import ( + v1 "k8s.io/api/core/v1" + storagev1beta1 "k8s.io/api/storage/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// StorageHealthConditionApplyConfiguration represents a declarative configuration of the StorageHealthCondition type for use +// with apply. +// +// StorageHealthCondition represents an adverse health condition reported +// by a CSI driver for its storage backend on a node. +type StorageHealthConditionApplyConfiguration struct { + // status is the health status category. + // One of "StorageUnreachable", "StorageDegraded". + Status *storagev1beta1.StorageHealthStatusType `json:"status,omitempty"` + // reason is a brief CamelCase machine-parseable reason. + // Maximum permitted length of a reason is 256 characters. + Reason *string `json:"reason,omitempty"` + // message is a human-readable description. + // Maximum permitted length of a message is 1024 characters. + Message *string `json:"message,omitempty"` + // accessMode is the access mode affected. Nil means all access modes are affected. + AccessMode *v1.PersistentVolumeAccessMode `json:"accessMode,omitempty"` + // volumeMode is the volume mode affected. Nil means both are affected. + VolumeMode *v1.PersistentVolumeMode `json:"volumeMode,omitempty"` + // lastTransitionTime is when this condition first appeared at its current state. + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` +} + +// StorageHealthConditionApplyConfiguration constructs a declarative configuration of the StorageHealthCondition type for use with +// apply. +func StorageHealthCondition() *StorageHealthConditionApplyConfiguration { + return &StorageHealthConditionApplyConfiguration{} +} + +// WithStatus sets the Status 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 Status field is set to the value of the last call. +func (b *StorageHealthConditionApplyConfiguration) WithStatus(value storagev1beta1.StorageHealthStatusType) *StorageHealthConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithReason sets the Reason 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 Reason field is set to the value of the last call. +func (b *StorageHealthConditionApplyConfiguration) WithReason(value string) *StorageHealthConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message 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 Message field is set to the value of the last call. +func (b *StorageHealthConditionApplyConfiguration) WithMessage(value string) *StorageHealthConditionApplyConfiguration { + b.Message = &value + return b +} + +// WithAccessMode sets the AccessMode 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 AccessMode field is set to the value of the last call. +func (b *StorageHealthConditionApplyConfiguration) WithAccessMode(value v1.PersistentVolumeAccessMode) *StorageHealthConditionApplyConfiguration { + b.AccessMode = &value + return b +} + +// WithVolumeMode sets the VolumeMode 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 VolumeMode field is set to the value of the last call. +func (b *StorageHealthConditionApplyConfiguration) WithVolumeMode(value v1.PersistentVolumeMode) *StorageHealthConditionApplyConfiguration { + b.VolumeMode = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime 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 LastTransitionTime field is set to the value of the last call. +func (b *StorageHealthConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *StorageHealthConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattachment.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattachment.go index da938bd301..25ffcd1402 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattachment.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattachment.go @@ -35,8 +35,8 @@ import ( // // VolumeAttachment objects are non-namespaced. type VolumeAttachmentApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // spec represents specification of the desired attach/detach volume behavior. diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattributesclass.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattributesclass.go index 7d04a86c84..1eab6c2cac 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattributesclass.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattributesclass.go @@ -34,11 +34,11 @@ import ( // defined by the CSI driver. The class can be specified during dynamic provisioning // of PersistentVolumeClaims, and changed in the PersistentVolumeClaim spec after provisioning. type VolumeAttributesClassApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. + v1.TypeMetaApplyConfiguration `json:""` + // metadata is the standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Name of the CSI driver + // driverName is the name of the CSI driver // This field is immutable. DriverName *string `json:"driverName,omitempty"` // parameters hold volume attributes defined by the CSI driver. These values diff --git a/vendor/k8s.io/client-go/applyconfigurations/storagemigration/v1/storageversionmigration.go b/vendor/k8s.io/client-go/applyconfigurations/storagemigration/v1/storageversionmigration.go new file mode 100644 index 0000000000..b42000e712 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/storagemigration/v1/storageversionmigration.go @@ -0,0 +1,292 @@ +/* +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 ( + storagemigrationv1 "k8s.io/api/storagemigration/v1" + apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + internal "k8s.io/client-go/applyconfigurations/internal" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// StorageVersionMigrationApplyConfiguration represents a declarative configuration of the StorageVersionMigration type for use +// with apply. +// +// StorageVersionMigration represents a migration of stored data to the latest +// storage version. +type StorageVersionMigrationApplyConfiguration struct { + metav1.TypeMetaApplyConfiguration `json:""` + // Standard object metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // Specification of the migration. + Spec *StorageVersionMigrationSpecApplyConfiguration `json:"spec,omitempty"` + // Status of the migration. + Status *StorageVersionMigrationStatusApplyConfiguration `json:"status,omitempty"` +} + +// StorageVersionMigration constructs a declarative configuration of the StorageVersionMigration type for use with +// apply. +func StorageVersionMigration(name string) *StorageVersionMigrationApplyConfiguration { + b := &StorageVersionMigrationApplyConfiguration{} + b.WithName(name) + b.WithKind("StorageVersionMigration") + b.WithAPIVersion("storagemigration.k8s.io/v1") + return b +} + +// ExtractStorageVersionMigrationFrom extracts the applied configuration owned by fieldManager from +// storageVersionMigration for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// storageVersionMigration must be a unmodified StorageVersionMigration API object that was retrieved from the Kubernetes API. +// ExtractStorageVersionMigrationFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractStorageVersionMigrationFrom(storageVersionMigration *storagemigrationv1.StorageVersionMigration, fieldManager string, subresource string) (*StorageVersionMigrationApplyConfiguration, error) { + b := &StorageVersionMigrationApplyConfiguration{} + err := managedfields.ExtractInto(storageVersionMigration, internal.Parser().Type("io.k8s.api.storagemigration.v1.StorageVersionMigration"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(storageVersionMigration.Name) + + b.WithKind("StorageVersionMigration") + b.WithAPIVersion("storagemigration.k8s.io/v1") + return b, nil +} + +// ExtractStorageVersionMigration extracts the applied configuration owned by fieldManager from +// storageVersionMigration. If no managedFields are found in storageVersionMigration for fieldManager, a +// StorageVersionMigrationApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// storageVersionMigration must be a unmodified StorageVersionMigration API object that was retrieved from the Kubernetes API. +// ExtractStorageVersionMigration provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractStorageVersionMigration(storageVersionMigration *storagemigrationv1.StorageVersionMigration, fieldManager string) (*StorageVersionMigrationApplyConfiguration, error) { + return ExtractStorageVersionMigrationFrom(storageVersionMigration, fieldManager, "") +} + +// ExtractStorageVersionMigrationStatus extracts the applied configuration owned by fieldManager from +// storageVersionMigration for the status subresource. +func ExtractStorageVersionMigrationStatus(storageVersionMigration *storagemigrationv1.StorageVersionMigration, fieldManager string) (*StorageVersionMigrationApplyConfiguration, error) { + return ExtractStorageVersionMigrationFrom(storageVersionMigration, fieldManager, "status") +} + +func (b StorageVersionMigrationApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind 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 Kind field is set to the value of the last call. +func (b *StorageVersionMigrationApplyConfiguration) WithKind(value string) *StorageVersionMigrationApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion 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 APIVersion field is set to the value of the last call. +func (b *StorageVersionMigrationApplyConfiguration) WithAPIVersion(value string) *StorageVersionMigrationApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// 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 *StorageVersionMigrationApplyConfiguration) WithName(value string) *StorageVersionMigrationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call. +func (b *StorageVersionMigrationApplyConfiguration) WithGenerateName(value string) *StorageVersionMigrationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call. +func (b *StorageVersionMigrationApplyConfiguration) WithNamespace(value string) *StorageVersionMigrationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID 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 UID field is set to the value of the last call. +func (b *StorageVersionMigrationApplyConfiguration) WithUID(value types.UID) *StorageVersionMigrationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call. +func (b *StorageVersionMigrationApplyConfiguration) WithResourceVersion(value string) *StorageVersionMigrationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation 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 Generation field is set to the value of the last call. +func (b *StorageVersionMigrationApplyConfiguration) WithGeneration(value int64) *StorageVersionMigrationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp 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 CreationTimestamp field is set to the value of the last call. +func (b *StorageVersionMigrationApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *StorageVersionMigrationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp 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 DeletionTimestamp field is set to the value of the last call. +func (b *StorageVersionMigrationApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *StorageVersionMigrationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds 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 DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *StorageVersionMigrationApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *StorageVersionMigrationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels 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 Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *StorageVersionMigrationApplyConfiguration) WithLabels(entries map[string]string) *StorageVersionMigrationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations 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 Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *StorageVersionMigrationApplyConfiguration) WithAnnotations(entries map[string]string) *StorageVersionMigrationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences 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 OwnerReferences field. +func (b *StorageVersionMigrationApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *StorageVersionMigrationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers 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 Finalizers field. +func (b *StorageVersionMigrationApplyConfiguration) WithFinalizers(values ...string) *StorageVersionMigrationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *StorageVersionMigrationApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec 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 Spec field is set to the value of the last call. +func (b *StorageVersionMigrationApplyConfiguration) WithSpec(value *StorageVersionMigrationSpecApplyConfiguration) *StorageVersionMigrationApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status 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 Status field is set to the value of the last call. +func (b *StorageVersionMigrationApplyConfiguration) WithStatus(value *StorageVersionMigrationStatusApplyConfiguration) *StorageVersionMigrationApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *StorageVersionMigrationApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *StorageVersionMigrationApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *StorageVersionMigrationApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *StorageVersionMigrationApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/storagemigration/v1/storageversionmigrationspec.go b/vendor/k8s.io/client-go/applyconfigurations/storagemigration/v1/storageversionmigrationspec.go new file mode 100644 index 0000000000..2c8603560b --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/storagemigration/v1/storageversionmigrationspec.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 + +import ( + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// StorageVersionMigrationSpecApplyConfiguration represents a declarative configuration of the StorageVersionMigrationSpec type for use +// with apply. +// +// Spec of the storage version migration. +type StorageVersionMigrationSpecApplyConfiguration struct { + // The resource that is being migrated. The migrator sends requests to + // the endpoint serving the resource. + // Immutable. + Resource *metav1.GroupResourceApplyConfiguration `json:"resource,omitempty"` +} + +// StorageVersionMigrationSpecApplyConfiguration constructs a declarative configuration of the StorageVersionMigrationSpec type for use with +// apply. +func StorageVersionMigrationSpec() *StorageVersionMigrationSpecApplyConfiguration { + return &StorageVersionMigrationSpecApplyConfiguration{} +} + +// WithResource sets the Resource 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 Resource field is set to the value of the last call. +func (b *StorageVersionMigrationSpecApplyConfiguration) WithResource(value *metav1.GroupResourceApplyConfiguration) *StorageVersionMigrationSpecApplyConfiguration { + b.Resource = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/storagemigration/v1/storageversionmigrationstatus.go b/vendor/k8s.io/client-go/applyconfigurations/storagemigration/v1/storageversionmigrationstatus.go new file mode 100644 index 0000000000..14bc869731 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/storagemigration/v1/storageversionmigrationstatus.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 ( + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// StorageVersionMigrationStatusApplyConfiguration represents a declarative configuration of the StorageVersionMigrationStatus type for use +// with apply. +// +// Status of the storage version migration. +type StorageVersionMigrationStatusApplyConfiguration struct { + // The latest available observations of the migration's current state. + Conditions []metav1.ConditionApplyConfiguration `json:"conditions,omitempty"` + // ResourceVersion to compare with the GC cache for performing the migration. + // This is the current resource version of given group, version and resource when + // kube-controller-manager first observes this StorageVersionMigration resource. + ResourceVersion *string `json:"resourceVersion,omitempty"` +} + +// StorageVersionMigrationStatusApplyConfiguration constructs a declarative configuration of the StorageVersionMigrationStatus type for use with +// apply. +func StorageVersionMigrationStatus() *StorageVersionMigrationStatusApplyConfiguration { + return &StorageVersionMigrationStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions 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 Conditions field. +func (b *StorageVersionMigrationStatusApplyConfiguration) WithConditions(values ...*metav1.ConditionApplyConfiguration) *StorageVersionMigrationStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call. +func (b *StorageVersionMigrationStatusApplyConfiguration) WithResourceVersion(value string) *StorageVersionMigrationStatusApplyConfiguration { + b.ResourceVersion = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/storagemigration/v1beta1/storageversionmigration.go b/vendor/k8s.io/client-go/applyconfigurations/storagemigration/v1beta1/storageversionmigration.go index e52fa5d813..f82428997f 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storagemigration/v1beta1/storageversionmigration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storagemigration/v1beta1/storageversionmigration.go @@ -33,7 +33,7 @@ import ( // StorageVersionMigration represents a migration of stored data to the latest // storage version. type StorageVersionMigrationApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` // Standard object metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/utils.go b/vendor/k8s.io/client-go/applyconfigurations/utils.go index 355051fc8d..f498c284ee 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/utils.go +++ b/vendor/k8s.io/client-go/applyconfigurations/utils.go @@ -47,6 +47,7 @@ import ( flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" v1beta3 "k8s.io/api/flowcontrol/v1beta3" imagepolicyv1alpha1 "k8s.io/api/imagepolicy/v1alpha1" + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" networkingv1 "k8s.io/api/networking/v1" networkingv1beta1 "k8s.io/api/networking/v1beta1" nodev1 "k8s.io/api/node/v1" @@ -62,11 +63,12 @@ import ( resourcev1beta1 "k8s.io/api/resource/v1beta1" resourcev1beta2 "k8s.io/api/resource/v1beta2" schedulingv1 "k8s.io/api/scheduling/v1" - schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" storagev1 "k8s.io/api/storage/v1" storagev1alpha1 "k8s.io/api/storage/v1alpha1" storagev1beta1 "k8s.io/api/storage/v1beta1" + storagemigrationv1 "k8s.io/api/storagemigration/v1" storagemigrationv1beta1 "k8s.io/api/storagemigration/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -101,6 +103,7 @@ import ( flowcontrolv1beta3 "k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3" applyconfigurationsimagepolicyv1alpha1 "k8s.io/client-go/applyconfigurations/imagepolicy/v1alpha1" internal "k8s.io/client-go/applyconfigurations/internal" + applyconfigurationslifecyclev1alpha1 "k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1" applyconfigurationsmetav1 "k8s.io/client-go/applyconfigurations/meta/v1" applyconfigurationsnetworkingv1 "k8s.io/client-go/applyconfigurations/networking/v1" applyconfigurationsnetworkingv1beta1 "k8s.io/client-go/applyconfigurations/networking/v1beta1" @@ -117,11 +120,12 @@ import ( applyconfigurationsresourcev1beta1 "k8s.io/client-go/applyconfigurations/resource/v1beta1" applyconfigurationsresourcev1beta2 "k8s.io/client-go/applyconfigurations/resource/v1beta2" applyconfigurationsschedulingv1 "k8s.io/client-go/applyconfigurations/scheduling/v1" - applyconfigurationsschedulingv1alpha2 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha2" + applyconfigurationsschedulingv1alpha3 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha3" applyconfigurationsschedulingv1beta1 "k8s.io/client-go/applyconfigurations/scheduling/v1beta1" applyconfigurationsstoragev1 "k8s.io/client-go/applyconfigurations/storage/v1" applyconfigurationsstoragev1alpha1 "k8s.io/client-go/applyconfigurations/storage/v1alpha1" applyconfigurationsstoragev1beta1 "k8s.io/client-go/applyconfigurations/storage/v1beta1" + applyconfigurationsstoragemigrationv1 "k8s.io/client-go/applyconfigurations/storagemigration/v1" applyconfigurationsstoragemigrationv1beta1 "k8s.io/client-go/applyconfigurations/storagemigration/v1beta1" ) @@ -510,6 +514,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsbatchv1.JobApplyConfiguration{} case batchv1.SchemeGroupVersion.WithKind("JobCondition"): return &applyconfigurationsbatchv1.JobConditionApplyConfiguration{} + case batchv1.SchemeGroupVersion.WithKind("JobSchedulingConfiguration"): + return &applyconfigurationsbatchv1.JobSchedulingConfigurationApplyConfiguration{} case batchv1.SchemeGroupVersion.WithKind("JobSpec"): return &applyconfigurationsbatchv1.JobSpecApplyConfiguration{} case batchv1.SchemeGroupVersion.WithKind("JobStatus"): @@ -550,6 +556,16 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationscertificatesv1.CertificateSigningRequestSpecApplyConfiguration{} case certificatesv1.SchemeGroupVersion.WithKind("CertificateSigningRequestStatus"): return &applyconfigurationscertificatesv1.CertificateSigningRequestStatusApplyConfiguration{} + case certificatesv1.SchemeGroupVersion.WithKind("ClusterTrustBundle"): + return &applyconfigurationscertificatesv1.ClusterTrustBundleApplyConfiguration{} + case certificatesv1.SchemeGroupVersion.WithKind("ClusterTrustBundleSpec"): + return &applyconfigurationscertificatesv1.ClusterTrustBundleSpecApplyConfiguration{} + case certificatesv1.SchemeGroupVersion.WithKind("PodCertificateRequest"): + return &applyconfigurationscertificatesv1.PodCertificateRequestApplyConfiguration{} + case certificatesv1.SchemeGroupVersion.WithKind("PodCertificateRequestSpec"): + return &applyconfigurationscertificatesv1.PodCertificateRequestSpecApplyConfiguration{} + case certificatesv1.SchemeGroupVersion.WithKind("PodCertificateRequestStatus"): + return &applyconfigurationscertificatesv1.PodCertificateRequestStatusApplyConfiguration{} // Group=certificates.k8s.io, Version=v1alpha1 case certificatesv1alpha1.SchemeGroupVersion.WithKind("ClusterTrustBundle"): @@ -710,6 +726,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationscorev1.EventSeriesApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("EventSource"): return &applyconfigurationscorev1.EventSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("EvictionResponder"): + return &applyconfigurationscorev1.EvictionResponderApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("ExecAction"): return &applyconfigurationscorev1.ExecActionApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("FCVolumeSource"): @@ -790,6 +808,10 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationscorev1.NodeAddressApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("NodeAffinity"): return &applyconfigurationscorev1.NodeAffinityApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NodeAllocatableMappedResources"): + return &applyconfigurationscorev1.NodeAllocatableMappedResourcesApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NodeAllocatableOverheadResources"): + return &applyconfigurationscorev1.NodeAllocatableOverheadResourcesApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("NodeAllocatableResourceClaimStatus"): return &applyconfigurationscorev1.NodeAllocatableResourceClaimStatusApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("NodeCondition"): @@ -802,6 +824,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationscorev1.NodeDaemonEndpointsApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("NodeFeatures"): return &applyconfigurationscorev1.NodeFeaturesApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NodePodPreemptionPolicy"): + return &applyconfigurationscorev1.NodePodPreemptionPolicyApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("NodeRuntimeHandler"): return &applyconfigurationscorev1.NodeRuntimeHandlerApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("NodeRuntimeHandlerFeatures"): @@ -888,6 +912,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationscorev1.PodTemplateApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("PodTemplateSpec"): return &applyconfigurationscorev1.PodTemplateSpecApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodVolumeHealth"): + return &applyconfigurationscorev1.PodVolumeHealthApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("PortStatus"): return &applyconfigurationscorev1.PortStatusApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("PortworxVolumeSource"): @@ -998,6 +1024,10 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationscorev1.VolumeApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("VolumeDevice"): return &applyconfigurationscorev1.VolumeDeviceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("VolumeHealthCondition"): + return &applyconfigurationscorev1.VolumeHealthConditionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("VolumeHealthStatus"): + return &applyconfigurationscorev1.VolumeHealthStatusApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("VolumeMount"): return &applyconfigurationscorev1.VolumeMountApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("VolumeMountStatus"): @@ -1335,6 +1365,34 @@ func ForKind(kind schema.GroupVersionKind) interface{} { case apiserverinternalv1alpha1.SchemeGroupVersion.WithKind("StorageVersionStatus"): return &applyconfigurationsapiserverinternalv1alpha1.StorageVersionStatusApplyConfiguration{} + // Group=lifecycle.k8s.io, Version=v1alpha1 + case lifecyclev1alpha1.SchemeGroupVersion.WithKind("Eviction"): + return &applyconfigurationslifecyclev1alpha1.EvictionApplyConfiguration{} + case lifecyclev1alpha1.SchemeGroupVersion.WithKind("EvictionPodReference"): + return &applyconfigurationslifecyclev1alpha1.EvictionPodReferenceApplyConfiguration{} + case lifecyclev1alpha1.SchemeGroupVersion.WithKind("EvictionRequest"): + return &applyconfigurationslifecyclev1alpha1.EvictionRequestApplyConfiguration{} + case lifecyclev1alpha1.SchemeGroupVersion.WithKind("EvictionRequestPodReference"): + return &applyconfigurationslifecyclev1alpha1.EvictionRequestPodReferenceApplyConfiguration{} + case lifecyclev1alpha1.SchemeGroupVersion.WithKind("EvictionRequestSpec"): + return &applyconfigurationslifecyclev1alpha1.EvictionRequestSpecApplyConfiguration{} + case lifecyclev1alpha1.SchemeGroupVersion.WithKind("EvictionRequestStatus"): + return &applyconfigurationslifecyclev1alpha1.EvictionRequestStatusApplyConfiguration{} + case lifecyclev1alpha1.SchemeGroupVersion.WithKind("EvictionRequestTarget"): + return &applyconfigurationslifecyclev1alpha1.EvictionRequestTargetApplyConfiguration{} + case lifecyclev1alpha1.SchemeGroupVersion.WithKind("EvictionSpec"): + return &applyconfigurationslifecyclev1alpha1.EvictionSpecApplyConfiguration{} + case lifecyclev1alpha1.SchemeGroupVersion.WithKind("EvictionStatus"): + return &applyconfigurationslifecyclev1alpha1.EvictionStatusApplyConfiguration{} + case lifecyclev1alpha1.SchemeGroupVersion.WithKind("EvictionTarget"): + return &applyconfigurationslifecyclev1alpha1.EvictionTargetApplyConfiguration{} + case lifecyclev1alpha1.SchemeGroupVersion.WithKind("Requester"): + return &applyconfigurationslifecyclev1alpha1.RequesterApplyConfiguration{} + case lifecyclev1alpha1.SchemeGroupVersion.WithKind("ResponderStatus"): + return &applyconfigurationslifecyclev1alpha1.ResponderStatusApplyConfiguration{} + case lifecyclev1alpha1.SchemeGroupVersion.WithKind("TargetResponder"): + return &applyconfigurationslifecyclev1alpha1.TargetResponderApplyConfiguration{} + // Group=meta.k8s.io, Version=v1 case metav1.SchemeGroupVersion.WithKind("Condition"): return &applyconfigurationsmetav1.ConditionApplyConfiguration{} @@ -1606,6 +1664,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsresourcev1.DeviceConstraintApplyConfiguration{} case resourcev1.SchemeGroupVersion.WithKind("DeviceCounterConsumption"): return &applyconfigurationsresourcev1.DeviceCounterConsumptionApplyConfiguration{} + case resourcev1.SchemeGroupVersion.WithKind("DeviceDerivedAttribute"): + return &applyconfigurationsresourcev1.DeviceDerivedAttributeApplyConfiguration{} case resourcev1.SchemeGroupVersion.WithKind("DeviceRequest"): return &applyconfigurationsresourcev1.DeviceRequestApplyConfiguration{} case resourcev1.SchemeGroupVersion.WithKind("DeviceRequestAllocationResult"): @@ -1616,14 +1676,26 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsresourcev1.DeviceSubRequestApplyConfiguration{} case resourcev1.SchemeGroupVersion.WithKind("DeviceTaint"): return &applyconfigurationsresourcev1.DeviceTaintApplyConfiguration{} + case resourcev1.SchemeGroupVersion.WithKind("DeviceTaintRule"): + return &applyconfigurationsresourcev1.DeviceTaintRuleApplyConfiguration{} + case resourcev1.SchemeGroupVersion.WithKind("DeviceTaintRuleSpec"): + return &applyconfigurationsresourcev1.DeviceTaintRuleSpecApplyConfiguration{} + case resourcev1.SchemeGroupVersion.WithKind("DeviceTaintRuleStatus"): + return &applyconfigurationsresourcev1.DeviceTaintRuleStatusApplyConfiguration{} + case resourcev1.SchemeGroupVersion.WithKind("DeviceTaintSelector"): + return &applyconfigurationsresourcev1.DeviceTaintSelectorApplyConfiguration{} case resourcev1.SchemeGroupVersion.WithKind("DeviceToleration"): return &applyconfigurationsresourcev1.DeviceTolerationApplyConfiguration{} case resourcev1.SchemeGroupVersion.WithKind("ExactDeviceRequest"): return &applyconfigurationsresourcev1.ExactDeviceRequestApplyConfiguration{} case resourcev1.SchemeGroupVersion.WithKind("NetworkDeviceData"): return &applyconfigurationsresourcev1.NetworkDeviceDataApplyConfiguration{} - case resourcev1.SchemeGroupVersion.WithKind("NodeAllocatableResourceMapping"): - return &applyconfigurationsresourcev1.NodeAllocatableResourceMappingApplyConfiguration{} + case resourcev1.SchemeGroupVersion.WithKind("NodeAllocatableMapping"): + return &applyconfigurationsresourcev1.NodeAllocatableMappingApplyConfiguration{} + case resourcev1.SchemeGroupVersion.WithKind("NodeAllocatableOverhead"): + return &applyconfigurationsresourcev1.NodeAllocatableOverheadApplyConfiguration{} + case resourcev1.SchemeGroupVersion.WithKind("NodeAllocatableResource"): + return &applyconfigurationsresourcev1.NodeAllocatableResourceApplyConfiguration{} case resourcev1.SchemeGroupVersion.WithKind("OpaqueDeviceConfiguration"): return &applyconfigurationsresourcev1.OpaqueDeviceConfigurationApplyConfiguration{} case resourcev1.SchemeGroupVersion.WithKind("ResourceClaim"): @@ -1656,6 +1728,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &resourcev1alpha3.DeviceTaintRuleStatusApplyConfiguration{} case v1alpha3.SchemeGroupVersion.WithKind("DeviceTaintSelector"): return &resourcev1alpha3.DeviceTaintSelectorApplyConfiguration{} + case v1alpha3.SchemeGroupVersion.WithKind("PartitionTypeStatus"): + return &resourcev1alpha3.PartitionTypeStatusApplyConfiguration{} case v1alpha3.SchemeGroupVersion.WithKind("PoolStatus"): return &resourcev1alpha3.PoolStatusApplyConfiguration{} case v1alpha3.SchemeGroupVersion.WithKind("ResourcePoolStatusRequest"): @@ -1664,6 +1738,10 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &resourcev1alpha3.ResourcePoolStatusRequestSpecApplyConfiguration{} case v1alpha3.SchemeGroupVersion.WithKind("ResourcePoolStatusRequestStatus"): return &resourcev1alpha3.ResourcePoolStatusRequestStatusApplyConfiguration{} + case v1alpha3.SchemeGroupVersion.WithKind("ShareableCapacityStatus"): + return &resourcev1alpha3.ShareableCapacityStatusApplyConfiguration{} + case v1alpha3.SchemeGroupVersion.WithKind("ShareableSummaryStatus"): + return &resourcev1alpha3.ShareableSummaryStatusApplyConfiguration{} // Group=resource.k8s.io, Version=v1beta1 case resourcev1beta1.SchemeGroupVersion.WithKind("AllocatedDeviceStatus"): @@ -1710,6 +1788,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsresourcev1beta1.DeviceConstraintApplyConfiguration{} case resourcev1beta1.SchemeGroupVersion.WithKind("DeviceCounterConsumption"): return &applyconfigurationsresourcev1beta1.DeviceCounterConsumptionApplyConfiguration{} + case resourcev1beta1.SchemeGroupVersion.WithKind("DeviceDerivedAttribute"): + return &applyconfigurationsresourcev1beta1.DeviceDerivedAttributeApplyConfiguration{} case resourcev1beta1.SchemeGroupVersion.WithKind("DeviceRequest"): return &applyconfigurationsresourcev1beta1.DeviceRequestApplyConfiguration{} case resourcev1beta1.SchemeGroupVersion.WithKind("DeviceRequestAllocationResult"): @@ -1724,8 +1804,12 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsresourcev1beta1.DeviceTolerationApplyConfiguration{} case resourcev1beta1.SchemeGroupVersion.WithKind("NetworkDeviceData"): return &applyconfigurationsresourcev1beta1.NetworkDeviceDataApplyConfiguration{} - case resourcev1beta1.SchemeGroupVersion.WithKind("NodeAllocatableResourceMapping"): - return &applyconfigurationsresourcev1beta1.NodeAllocatableResourceMappingApplyConfiguration{} + case resourcev1beta1.SchemeGroupVersion.WithKind("NodeAllocatableMapping"): + return &applyconfigurationsresourcev1beta1.NodeAllocatableMappingApplyConfiguration{} + case resourcev1beta1.SchemeGroupVersion.WithKind("NodeAllocatableOverhead"): + return &applyconfigurationsresourcev1beta1.NodeAllocatableOverheadApplyConfiguration{} + case resourcev1beta1.SchemeGroupVersion.WithKind("NodeAllocatableResource"): + return &applyconfigurationsresourcev1beta1.NodeAllocatableResourceApplyConfiguration{} case resourcev1beta1.SchemeGroupVersion.WithKind("OpaqueDeviceConfiguration"): return &applyconfigurationsresourcev1beta1.OpaqueDeviceConfigurationApplyConfiguration{} case resourcev1beta1.SchemeGroupVersion.WithKind("ResourceClaim"): @@ -1790,6 +1874,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsresourcev1beta2.DeviceConstraintApplyConfiguration{} case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceCounterConsumption"): return &applyconfigurationsresourcev1beta2.DeviceCounterConsumptionApplyConfiguration{} + case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceDerivedAttribute"): + return &applyconfigurationsresourcev1beta2.DeviceDerivedAttributeApplyConfiguration{} case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceRequest"): return &applyconfigurationsresourcev1beta2.DeviceRequestApplyConfiguration{} case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceRequestAllocationResult"): @@ -1814,8 +1900,12 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsresourcev1beta2.ExactDeviceRequestApplyConfiguration{} case resourcev1beta2.SchemeGroupVersion.WithKind("NetworkDeviceData"): return &applyconfigurationsresourcev1beta2.NetworkDeviceDataApplyConfiguration{} - case resourcev1beta2.SchemeGroupVersion.WithKind("NodeAllocatableResourceMapping"): - return &applyconfigurationsresourcev1beta2.NodeAllocatableResourceMappingApplyConfiguration{} + case resourcev1beta2.SchemeGroupVersion.WithKind("NodeAllocatableMapping"): + return &applyconfigurationsresourcev1beta2.NodeAllocatableMappingApplyConfiguration{} + case resourcev1beta2.SchemeGroupVersion.WithKind("NodeAllocatableOverhead"): + return &applyconfigurationsresourcev1beta2.NodeAllocatableOverheadApplyConfiguration{} + case resourcev1beta2.SchemeGroupVersion.WithKind("NodeAllocatableResource"): + return &applyconfigurationsresourcev1beta2.NodeAllocatableResourceApplyConfiguration{} case resourcev1beta2.SchemeGroupVersion.WithKind("OpaqueDeviceConfiguration"): return &applyconfigurationsresourcev1beta2.OpaqueDeviceConfigurationApplyConfiguration{} case resourcev1beta2.SchemeGroupVersion.WithKind("ResourceClaim"): @@ -1841,41 +1931,107 @@ func ForKind(kind schema.GroupVersionKind) interface{} { case schedulingv1.SchemeGroupVersion.WithKind("PriorityClass"): return &applyconfigurationsschedulingv1.PriorityClassApplyConfiguration{} - // Group=scheduling.k8s.io, Version=v1alpha2 - case schedulingv1alpha2.SchemeGroupVersion.WithKind("GangSchedulingPolicy"): - return &applyconfigurationsschedulingv1alpha2.GangSchedulingPolicyApplyConfiguration{} - case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroup"): - return &applyconfigurationsschedulingv1alpha2.PodGroupApplyConfiguration{} - case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupResourceClaim"): - return &applyconfigurationsschedulingv1alpha2.PodGroupResourceClaimApplyConfiguration{} - case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupResourceClaimStatus"): - return &applyconfigurationsschedulingv1alpha2.PodGroupResourceClaimStatusApplyConfiguration{} - case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupSchedulingConstraints"): - return &applyconfigurationsschedulingv1alpha2.PodGroupSchedulingConstraintsApplyConfiguration{} - case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupSchedulingPolicy"): - return &applyconfigurationsschedulingv1alpha2.PodGroupSchedulingPolicyApplyConfiguration{} - case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupSpec"): - return &applyconfigurationsschedulingv1alpha2.PodGroupSpecApplyConfiguration{} - case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupStatus"): - return &applyconfigurationsschedulingv1alpha2.PodGroupStatusApplyConfiguration{} - case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupTemplate"): - return &applyconfigurationsschedulingv1alpha2.PodGroupTemplateApplyConfiguration{} - case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupTemplateReference"): - return &applyconfigurationsschedulingv1alpha2.PodGroupTemplateReferenceApplyConfiguration{} - case schedulingv1alpha2.SchemeGroupVersion.WithKind("TopologyConstraint"): - return &applyconfigurationsschedulingv1alpha2.TopologyConstraintApplyConfiguration{} - case schedulingv1alpha2.SchemeGroupVersion.WithKind("TypedLocalObjectReference"): - return &applyconfigurationsschedulingv1alpha2.TypedLocalObjectReferenceApplyConfiguration{} - case schedulingv1alpha2.SchemeGroupVersion.WithKind("Workload"): - return &applyconfigurationsschedulingv1alpha2.WorkloadApplyConfiguration{} - case schedulingv1alpha2.SchemeGroupVersion.WithKind("WorkloadPodGroupTemplateReference"): - return &applyconfigurationsschedulingv1alpha2.WorkloadPodGroupTemplateReferenceApplyConfiguration{} - case schedulingv1alpha2.SchemeGroupVersion.WithKind("WorkloadSpec"): - return &applyconfigurationsschedulingv1alpha2.WorkloadSpecApplyConfiguration{} + // Group=scheduling.k8s.io, Version=v1alpha3 + case schedulingv1alpha3.SchemeGroupVersion.WithKind("CompositeDisruptionMode"): + return &applyconfigurationsschedulingv1alpha3.CompositeDisruptionModeApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("CompositeGangSchedulingPolicy"): + return &applyconfigurationsschedulingv1alpha3.CompositeGangSchedulingPolicyApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("CompositePodGroup"): + return &applyconfigurationsschedulingv1alpha3.CompositePodGroupApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("CompositePodGroupSchedulingConstraints"): + return &applyconfigurationsschedulingv1alpha3.CompositePodGroupSchedulingConstraintsApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("CompositePodGroupSchedulingPolicy"): + return &applyconfigurationsschedulingv1alpha3.CompositePodGroupSchedulingPolicyApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("CompositePodGroupSpec"): + return &applyconfigurationsschedulingv1alpha3.CompositePodGroupSpecApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("CompositePodGroupStatus"): + return &applyconfigurationsschedulingv1alpha3.CompositePodGroupStatusApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("CompositePodGroupTemplate"): + return &applyconfigurationsschedulingv1alpha3.CompositePodGroupTemplateApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("DisruptionMode"): + return &applyconfigurationsschedulingv1alpha3.DisruptionModeApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("GangSchedulingPolicy"): + return &applyconfigurationsschedulingv1alpha3.GangSchedulingPolicyApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("PodGroup"): + return &applyconfigurationsschedulingv1alpha3.PodGroupApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("PodGroupResourceClaim"): + return &applyconfigurationsschedulingv1alpha3.PodGroupResourceClaimApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("PodGroupResourceClaimStatus"): + return &applyconfigurationsschedulingv1alpha3.PodGroupResourceClaimStatusApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("PodGroupSchedulingConstraints"): + return &applyconfigurationsschedulingv1alpha3.PodGroupSchedulingConstraintsApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("PodGroupSchedulingPolicy"): + return &applyconfigurationsschedulingv1alpha3.PodGroupSchedulingPolicyApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("PodGroupSpec"): + return &applyconfigurationsschedulingv1alpha3.PodGroupSpecApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("PodGroupStatus"): + return &applyconfigurationsschedulingv1alpha3.PodGroupStatusApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("PodGroupTemplate"): + return &applyconfigurationsschedulingv1alpha3.PodGroupTemplateApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("TopologyConstraint"): + return &applyconfigurationsschedulingv1alpha3.TopologyConstraintApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("TypedLocalObjectReference"): + return &applyconfigurationsschedulingv1alpha3.TypedLocalObjectReferenceApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("Workload"): + return &applyconfigurationsschedulingv1alpha3.WorkloadApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("WorkloadPodGroupDisruptionMode"): + return &applyconfigurationsschedulingv1alpha3.WorkloadPodGroupDisruptionModeApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("WorkloadPodGroupGangSchedulingPolicy"): + return &applyconfigurationsschedulingv1alpha3.WorkloadPodGroupGangSchedulingPolicyApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("WorkloadPodGroupResourceClaim"): + return &applyconfigurationsschedulingv1alpha3.WorkloadPodGroupResourceClaimApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("WorkloadPodGroupSchedulingConstraints"): + return &applyconfigurationsschedulingv1alpha3.WorkloadPodGroupSchedulingConstraintsApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("WorkloadPodGroupSchedulingPolicy"): + return &applyconfigurationsschedulingv1alpha3.WorkloadPodGroupSchedulingPolicyApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("WorkloadReference"): + return &applyconfigurationsschedulingv1alpha3.WorkloadReferenceApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("WorkloadSpec"): + return &applyconfigurationsschedulingv1alpha3.WorkloadSpecApplyConfiguration{} // Group=scheduling.k8s.io, Version=v1beta1 + case schedulingv1beta1.SchemeGroupVersion.WithKind("CompositeDisruptionMode"): + return &applyconfigurationsschedulingv1beta1.CompositeDisruptionModeApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("CompositeGangSchedulingPolicy"): + return &applyconfigurationsschedulingv1beta1.CompositeGangSchedulingPolicyApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("CompositePodGroupSchedulingConstraints"): + return &applyconfigurationsschedulingv1beta1.CompositePodGroupSchedulingConstraintsApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("CompositePodGroupSchedulingPolicy"): + return &applyconfigurationsschedulingv1beta1.CompositePodGroupSchedulingPolicyApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("CompositePodGroupTemplate"): + return &applyconfigurationsschedulingv1beta1.CompositePodGroupTemplateApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("DisruptionMode"): + return &applyconfigurationsschedulingv1beta1.DisruptionModeApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("GangSchedulingPolicy"): + return &applyconfigurationsschedulingv1beta1.GangSchedulingPolicyApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("PodGroup"): + return &applyconfigurationsschedulingv1beta1.PodGroupApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("PodGroupResourceClaim"): + return &applyconfigurationsschedulingv1beta1.PodGroupResourceClaimApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("PodGroupResourceClaimStatus"): + return &applyconfigurationsschedulingv1beta1.PodGroupResourceClaimStatusApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("PodGroupSchedulingConstraints"): + return &applyconfigurationsschedulingv1beta1.PodGroupSchedulingConstraintsApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("PodGroupSchedulingPolicy"): + return &applyconfigurationsschedulingv1beta1.PodGroupSchedulingPolicyApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("PodGroupSpec"): + return &applyconfigurationsschedulingv1beta1.PodGroupSpecApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("PodGroupStatus"): + return &applyconfigurationsschedulingv1beta1.PodGroupStatusApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("PodGroupTemplate"): + return &applyconfigurationsschedulingv1beta1.PodGroupTemplateApplyConfiguration{} case schedulingv1beta1.SchemeGroupVersion.WithKind("PriorityClass"): return &applyconfigurationsschedulingv1beta1.PriorityClassApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("TopologyConstraint"): + return &applyconfigurationsschedulingv1beta1.TopologyConstraintApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("TypedLocalObjectReference"): + return &applyconfigurationsschedulingv1beta1.TypedLocalObjectReferenceApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("Workload"): + return &applyconfigurationsschedulingv1beta1.WorkloadApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("WorkloadReference"): + return &applyconfigurationsschedulingv1beta1.WorkloadReferenceApplyConfiguration{} + case schedulingv1beta1.SchemeGroupVersion.WithKind("WorkloadSpec"): + return &applyconfigurationsschedulingv1beta1.WorkloadSpecApplyConfiguration{} // Group=storage.k8s.io, Version=v1 case storagev1.SchemeGroupVersion.WithKind("CSIDriver"): @@ -1888,10 +2044,16 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsstoragev1.CSINodeDriverApplyConfiguration{} case storagev1.SchemeGroupVersion.WithKind("CSINodeSpec"): return &applyconfigurationsstoragev1.CSINodeSpecApplyConfiguration{} + case storagev1.SchemeGroupVersion.WithKind("CSINodeStatus"): + return &applyconfigurationsstoragev1.CSINodeStatusApplyConfiguration{} case storagev1.SchemeGroupVersion.WithKind("CSIStorageCapacity"): return &applyconfigurationsstoragev1.CSIStorageCapacityApplyConfiguration{} case storagev1.SchemeGroupVersion.WithKind("StorageClass"): return &applyconfigurationsstoragev1.StorageClassApplyConfiguration{} + case storagev1.SchemeGroupVersion.WithKind("StorageHealth"): + return &applyconfigurationsstoragev1.StorageHealthApplyConfiguration{} + case storagev1.SchemeGroupVersion.WithKind("StorageHealthCondition"): + return &applyconfigurationsstoragev1.StorageHealthConditionApplyConfiguration{} case storagev1.SchemeGroupVersion.WithKind("TokenRequest"): return &applyconfigurationsstoragev1.TokenRequestApplyConfiguration{} case storagev1.SchemeGroupVersion.WithKind("VolumeAttachment"): @@ -1936,10 +2098,16 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsstoragev1beta1.CSINodeDriverApplyConfiguration{} case storagev1beta1.SchemeGroupVersion.WithKind("CSINodeSpec"): return &applyconfigurationsstoragev1beta1.CSINodeSpecApplyConfiguration{} + case storagev1beta1.SchemeGroupVersion.WithKind("CSINodeStatus"): + return &applyconfigurationsstoragev1beta1.CSINodeStatusApplyConfiguration{} case storagev1beta1.SchemeGroupVersion.WithKind("CSIStorageCapacity"): return &applyconfigurationsstoragev1beta1.CSIStorageCapacityApplyConfiguration{} case storagev1beta1.SchemeGroupVersion.WithKind("StorageClass"): return &applyconfigurationsstoragev1beta1.StorageClassApplyConfiguration{} + case storagev1beta1.SchemeGroupVersion.WithKind("StorageHealth"): + return &applyconfigurationsstoragev1beta1.StorageHealthApplyConfiguration{} + case storagev1beta1.SchemeGroupVersion.WithKind("StorageHealthCondition"): + return &applyconfigurationsstoragev1beta1.StorageHealthConditionApplyConfiguration{} case storagev1beta1.SchemeGroupVersion.WithKind("TokenRequest"): return &applyconfigurationsstoragev1beta1.TokenRequestApplyConfiguration{} case storagev1beta1.SchemeGroupVersion.WithKind("VolumeAttachment"): @@ -1957,6 +2125,14 @@ func ForKind(kind schema.GroupVersionKind) interface{} { case storagev1beta1.SchemeGroupVersion.WithKind("VolumeNodeResources"): return &applyconfigurationsstoragev1beta1.VolumeNodeResourcesApplyConfiguration{} + // Group=storagemigration.k8s.io, Version=v1 + case storagemigrationv1.SchemeGroupVersion.WithKind("StorageVersionMigration"): + return &applyconfigurationsstoragemigrationv1.StorageVersionMigrationApplyConfiguration{} + case storagemigrationv1.SchemeGroupVersion.WithKind("StorageVersionMigrationSpec"): + return &applyconfigurationsstoragemigrationv1.StorageVersionMigrationSpecApplyConfiguration{} + case storagemigrationv1.SchemeGroupVersion.WithKind("StorageVersionMigrationStatus"): + return &applyconfigurationsstoragemigrationv1.StorageVersionMigrationStatusApplyConfiguration{} + // Group=storagemigration.k8s.io, Version=v1beta1 case storagemigrationv1beta1.SchemeGroupVersion.WithKind("StorageVersionMigration"): return &applyconfigurationsstoragemigrationv1beta1.StorageVersionMigrationApplyConfiguration{} diff --git a/vendor/k8s.io/client-go/discovery/aggregated_discovery.go b/vendor/k8s.io/client-go/discovery/aggregated_discovery.go index 82d46b4895..2111b26454 100644 --- a/vendor/k8s.io/client-go/discovery/aggregated_discovery.go +++ b/vendor/k8s.io/client-go/discovery/aggregated_discovery.go @@ -20,7 +20,6 @@ import ( "fmt" apidiscovery "k8s.io/api/apidiscovery/v2" - apidiscoveryv2beta1 "k8s.io/api/apidiscovery/v2beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" ) @@ -155,124 +154,3 @@ func convertAPISubresource(parent metav1.APIResource, in apidiscovery.APISubreso result.Verbs = in.Verbs return result, nil } - -// Please note the functions below will be removed in v1.35. They facilitate conversion -// between the deprecated type apidiscoveryv2beta1.APIGroupDiscoveryList. - -// SplitGroupsAndResourcesV2Beta1 transforms "aggregated" discovery top-level structure into -// the previous "unaggregated" discovery groups and resources. -// Deprecated: Please use SplitGroupsAndResources -func SplitGroupsAndResourcesV2Beta1(aggregatedGroups apidiscoveryv2beta1.APIGroupDiscoveryList) ( - *metav1.APIGroupList, - map[schema.GroupVersion]*metav1.APIResourceList, - map[schema.GroupVersion]error) { - // Aggregated group list will contain the entirety of discovery, including - // groups, versions, and resources. GroupVersions marked "stale" are failed. - groups := []*metav1.APIGroup{} - failedGVs := map[schema.GroupVersion]error{} - resourcesByGV := map[schema.GroupVersion]*metav1.APIResourceList{} - for _, aggGroup := range aggregatedGroups.Items { - group, resources, failed := convertAPIGroupv2beta1(aggGroup) - groups = append(groups, group) - for gv, resourceList := range resources { - resourcesByGV[gv] = resourceList - } - for gv, err := range failed { - failedGVs[gv] = err - } - } - // Transform slice of groups to group list before returning. - groupList := &metav1.APIGroupList{} - groupList.Groups = make([]metav1.APIGroup, 0, len(groups)) - for _, group := range groups { - groupList.Groups = append(groupList.Groups, *group) - } - return groupList, resourcesByGV, failedGVs -} - -// convertAPIGroupv2beta1 tranforms an "aggregated" APIGroupDiscovery to an "legacy" APIGroup, -// also returning the map of APIResourceList for resources within GroupVersions. -func convertAPIGroupv2beta1(g apidiscoveryv2beta1.APIGroupDiscovery) ( - *metav1.APIGroup, - map[schema.GroupVersion]*metav1.APIResourceList, - map[schema.GroupVersion]error) { - // Iterate through versions to convert to group and resources. - group := &metav1.APIGroup{} - gvResources := map[schema.GroupVersion]*metav1.APIResourceList{} - failedGVs := map[schema.GroupVersion]error{} - group.Name = g.ObjectMeta.Name - for _, v := range g.Versions { - gv := schema.GroupVersion{Group: g.Name, Version: v.Version} - if v.Freshness == apidiscoveryv2beta1.DiscoveryFreshnessStale { - failedGVs[gv] = StaleGroupVersionError{gv: gv} - continue - } - version := metav1.GroupVersionForDiscovery{} - version.GroupVersion = gv.String() - version.Version = v.Version - group.Versions = append(group.Versions, version) - // PreferredVersion is first non-stale Version - if group.PreferredVersion == (metav1.GroupVersionForDiscovery{}) { - group.PreferredVersion = version - } - resourceList := &metav1.APIResourceList{} - resourceList.GroupVersion = gv.String() - for _, r := range v.Resources { - resource, err := convertAPIResourcev2beta1(r) - if err == nil { - resourceList.APIResources = append(resourceList.APIResources, resource) - } - // Subresources field in new format get transformed into full APIResources. - // It is possible a partial result with an error was returned to be used - // as the parent resource for the subresource. - for _, subresource := range r.Subresources { - sr, err := convertAPISubresourcev2beta1(resource, subresource) - if err == nil { - resourceList.APIResources = append(resourceList.APIResources, sr) - } - } - } - gvResources[gv] = resourceList - } - return group, gvResources, failedGVs -} - -// convertAPIResource tranforms a APIResourceDiscovery to an APIResource. We are -// resilient to missing GVK, since this resource might be the parent resource -// for a subresource. If the parent is missing a GVK, it is not returned in -// discovery, and the subresource MUST have the GVK. -func convertAPIResourcev2beta1(in apidiscoveryv2beta1.APIResourceDiscovery) (metav1.APIResource, error) { - result := metav1.APIResource{ - Name: in.Resource, - SingularName: in.SingularResource, - Namespaced: in.Scope == apidiscoveryv2beta1.ScopeNamespace, - Verbs: in.Verbs, - ShortNames: in.ShortNames, - Categories: in.Categories, - } - // Can return partial result with error, which can be the parent for a - // subresource. Do not add this result to the returned discovery resources. - if in.ResponseKind == nil || (*in.ResponseKind) == emptyKind { - return result, fmt.Errorf("discovery resource %s missing GVK", in.Resource) - } - result.Group = in.ResponseKind.Group - result.Version = in.ResponseKind.Version - result.Kind = in.ResponseKind.Kind - return result, nil -} - -// convertAPISubresource tranforms a APISubresourceDiscovery to an APIResource. -func convertAPISubresourcev2beta1(parent metav1.APIResource, in apidiscoveryv2beta1.APISubresourceDiscovery) (metav1.APIResource, error) { - result := metav1.APIResource{} - if in.ResponseKind == nil || (*in.ResponseKind) == emptyKind { - return result, fmt.Errorf("subresource %s/%s missing GVK", parent.Name, in.Subresource) - } - result.Name = fmt.Sprintf("%s/%s", parent.Name, in.Subresource) - result.SingularName = parent.SingularName - result.Namespaced = parent.Namespaced - result.Group = in.ResponseKind.Group - result.Version = in.ResponseKind.Version - result.Kind = in.ResponseKind.Kind - result.Verbs = in.Verbs - return result, nil -} diff --git a/vendor/k8s.io/client-go/discovery/cached/memory/memcache.go b/vendor/k8s.io/client-go/discovery/cached/memory/memcache.go index 3829b3cc09..9334cafe5a 100644 --- a/vendor/k8s.io/client-go/discovery/cached/memory/memcache.go +++ b/vendor/k8s.io/client-go/discovery/cached/memory/memcache.go @@ -17,6 +17,7 @@ limitations under the License. package memory import ( + "context" "errors" "fmt" "sync" @@ -47,13 +48,13 @@ type cacheEntry struct { // TODO: Switch to a watch interface. Right now it will poll after each // Invalidate() call. type memCacheClient struct { - delegate discovery.DiscoveryInterface + delegate discovery.DiscoveryInterfaceWithContext lock sync.RWMutex groupToServerResources map[string]*cacheEntry groupList *metav1.APIGroupList cacheValid bool - openapiClient openapi.Client + openapiClient *cachedopenapi.Client receivedAggregatedDiscovery bool } @@ -72,6 +73,7 @@ func (e *emptyResponseError) Error() string { } var _ discovery.CachedDiscoveryInterface = &memCacheClient{} +var _ discovery.CachedDiscoveryInterfaceWithContext = &memCacheClient{} // isTransientConnectionError checks whether given error is "Connection refused" or // "Connection reset" error which usually means that apiserver is temporarily @@ -85,6 +87,11 @@ func isTransientConnectionError(err error) bool { } func isTransientError(err error) bool { + // Context cancelation is transient, retrying with a different context can work. + if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { + return true + } + if isTransientConnectionError(err) { return true } @@ -98,10 +105,15 @@ func isTransientError(err error) bool { // ServerResourcesForGroupVersion returns the supported resources for a group and version. func (d *memCacheClient) ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error) { + return d.ServerResourcesForGroupVersionWithContext(context.Background(), groupVersion) +} + +// ServerResourcesForGroupVersion returns the supported resources for a group and version. +func (d *memCacheClient) ServerResourcesForGroupVersionWithContext(ctx context.Context, groupVersion string) (*metav1.APIResourceList, error) { d.lock.Lock() defer d.lock.Unlock() if !d.cacheValid { - if err := d.refreshLocked(); err != nil { + if err := d.refreshLocked(ctx); err != nil { return nil, err } } @@ -111,14 +123,14 @@ func (d *memCacheClient) ServerResourcesForGroupVersion(groupVersion string) (*m } if cachedVal.err != nil && isTransientError(cachedVal.err) { - r, err := d.serverResourcesForGroupVersion(groupVersion) + r, err := d.serverResourcesForGroupVersion(ctx, groupVersion) if err != nil { // Don't log "empty response" as an error; it is a common response for metrics. if _, emptyErr := err.(*emptyResponseError); emptyErr { // Log at same verbosity as disk cache. - klog.V(3).Infof("%v", err) + klog.FromContext(ctx).V(3).Info(err.Error()) } else { - utilruntime.HandleError(fmt.Errorf("couldn't get resource list for %v: %v", groupVersion, err)) + utilruntime.HandleErrorWithContext(ctx, err, "Couldn't get resource list", "gv", groupVersion) } } cachedVal = &cacheEntry{r, err} @@ -129,19 +141,43 @@ func (d *memCacheClient) ServerResourcesForGroupVersion(groupVersion string) (*m } // ServerGroupsAndResources returns the groups and supported resources for all groups and versions. +// +// ServerGroupsAndResourcesWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerGroupsAndResourcesWithContext instead. func (d *memCacheClient) ServerGroupsAndResources() ([]*metav1.APIGroup, []*metav1.APIResourceList, error) { - return discovery.ServerGroupsAndResources(d) + return d.ServerGroupsAndResourcesWithContext(context.Background()) +} + +// ServerGroupsAndResources returns the groups and supported resources for all groups and versions. +func (d *memCacheClient) ServerGroupsAndResourcesWithContext(ctx context.Context) ([]*metav1.APIGroup, []*metav1.APIResourceList, error) { + return discovery.ServerGroupsAndResourcesWithContext(ctx, d) } // GroupsAndMaybeResources returns the list of APIGroups, and possibly the map of group/version // to resources. The returned groups will never be nil, but the resources map can be nil // if there are no cached resources. +// +// GroupsAndMaybeResourcesWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use GroupsAndMaybeResourcesWithContext instead. func (d *memCacheClient) GroupsAndMaybeResources() (*metav1.APIGroupList, map[schema.GroupVersion]*metav1.APIResourceList, map[schema.GroupVersion]error, error) { + return d.GroupsAndMaybeResourcesWithContext(context.Background()) +} + +// GroupsAndMaybeResourcesWithContext returns the list of APIGroups, and possibly the map of group/version +// to resources. The returned groups will never be nil, but the resources map can be nil +// if there are no cached resources. +func (d *memCacheClient) GroupsAndMaybeResourcesWithContext(ctx context.Context) (*metav1.APIGroupList, map[schema.GroupVersion]*metav1.APIResourceList, map[schema.GroupVersion]error, error) { + if err := ctx.Err(); err != nil { + return nil, nil, nil, err + } + d.lock.Lock() defer d.lock.Unlock() if !d.cacheValid { - if err := d.refreshLocked(); err != nil { + if err := d.refreshLocked(ctx); err != nil { return nil, nil, nil, err } } @@ -166,8 +202,15 @@ func (d *memCacheClient) GroupsAndMaybeResources() (*metav1.APIGroupList, map[sc return d.groupList, resourcesMap, failedGVs, nil } +// ServerGroupsWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerGroupsWithContext instead. func (d *memCacheClient) ServerGroups() (*metav1.APIGroupList, error) { - groups, _, _, err := d.GroupsAndMaybeResources() + return d.ServerGroupsWithContext(context.Background()) +} + +func (d *memCacheClient) ServerGroupsWithContext(ctx context.Context) (*metav1.APIGroupList, error) { + groups, _, _, err := d.GroupsAndMaybeResourcesWithContext(ctx) if err != nil { return nil, err } @@ -178,35 +221,81 @@ func (d *memCacheClient) RESTClient() restclient.Interface { return d.delegate.RESTClient() } +// ServerPreferredResourcesWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerPreferredResourcesWithContext instead. func (d *memCacheClient) ServerPreferredResources() ([]*metav1.APIResourceList, error) { - return discovery.ServerPreferredResources(d) + return d.ServerPreferredResourcesWithContext(context.Background()) } +func (d *memCacheClient) ServerPreferredResourcesWithContext(ctx context.Context) ([]*metav1.APIResourceList, error) { + return discovery.ServerPreferredResourcesWithContext(ctx, d) +} + +// ServerPreferredNamespacedResourcesWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerPreferredNamespacedResourcesWithContext instead. func (d *memCacheClient) ServerPreferredNamespacedResources() ([]*metav1.APIResourceList, error) { - return discovery.ServerPreferredNamespacedResources(d) + return d.ServerPreferredNamespacedResourcesWithContext(context.Background()) } +func (d *memCacheClient) ServerPreferredNamespacedResourcesWithContext(ctx context.Context) ([]*metav1.APIResourceList, error) { + return discovery.ServerPreferredNamespacedResourcesWithContext(ctx, d) +} + +// ServerVersionWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerVersionWithContext instead. func (d *memCacheClient) ServerVersion() (*version.Info, error) { - return d.delegate.ServerVersion() + return d.ServerVersionWithContext(context.Background()) +} + +func (d *memCacheClient) ServerVersionWithContext(ctx context.Context) (*version.Info, error) { + return d.delegate.ServerVersionWithContext(ctx) } +// OpenAPISchemaWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use OpenAPISchemaWithContext instead. func (d *memCacheClient) OpenAPISchema() (*openapi_v2.Document, error) { - return d.delegate.OpenAPISchema() + return d.OpenAPISchemaWithContext(context.Background()) +} + +func (d *memCacheClient) OpenAPISchemaWithContext(ctx context.Context) (*openapi_v2.Document, error) { + return d.delegate.OpenAPISchemaWithContext(ctx) } +// OpenAPIV3WithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use OpenAPIV3WithContext instead. func (d *memCacheClient) OpenAPIV3() openapi.Client { + return d.openAPIV3(context.Background()) +} + +func (d *memCacheClient) OpenAPIV3WithContext(ctx context.Context) openapi.ClientWithContext { + return d.openAPIV3(ctx) +} + +func (d *memCacheClient) openAPIV3(ctx context.Context) *cachedopenapi.Client { // Must take lock since Invalidate call may modify openapiClient d.lock.Lock() defer d.lock.Unlock() if d.openapiClient == nil { - d.openapiClient = cachedopenapi.NewClient(d.delegate.OpenAPIV3()) + d.openapiClient = cachedopenapi.NewClientWithContext(d.delegate.OpenAPIV3WithContext(ctx)) } return d.openapiClient } +// FreshWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use FreshWithContext instead. func (d *memCacheClient) Fresh() bool { + return d.FreshWithContext(context.Background()) +} + +func (d *memCacheClient) FreshWithContext(ctx context.Context) bool { d.lock.RLock() defer d.lock.RUnlock() // Return whether the cache is populated at all. It is still possible that @@ -217,7 +306,17 @@ func (d *memCacheClient) Fresh() bool { // Invalidate enforces that no cached data that is older than the current time // is used. +// +// InvalidateWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use InvalidateWithContext instead. func (d *memCacheClient) Invalidate() { + d.InvalidateWithContext(context.Background()) +} + +// InvalidateWithContext enforces that no cached data that is older than the current time +// is used. +func (d *memCacheClient) InvalidateWithContext(ctx context.Context) { d.lock.Lock() defer d.lock.Unlock() d.cacheValid = false @@ -225,24 +324,41 @@ func (d *memCacheClient) Invalidate() { d.groupList = nil d.openapiClient = nil d.receivedAggregatedDiscovery = false - if ad, ok := d.delegate.(discovery.CachedDiscoveryInterface); ok { - ad.Invalidate() + ad, ok := d.delegate.(discovery.CachedDiscoveryInterfaceWithContext) + if !ok { + //nolint:staticcheck // Intentionally using the old interface here. + ad2, ok2 := d.delegate.(discovery.CachedDiscoveryInterface) + if ok2 { + ad = discovery.ToCachedDiscoveryInterfaceWithContext(ad2) + ok = true + } + } + if ok { + ad.InvalidateWithContext(ctx) } } // refreshLocked refreshes the state of cache. The caller must hold d.lock for // writing. -func (d *memCacheClient) refreshLocked() error { +func (d *memCacheClient) refreshLocked(ctx context.Context) error { // TODO: Could this multiplicative set of calls be replaced by a single call // to ServerResources? If it's possible for more than one resulting // APIResourceList to have the same GroupVersion, the lists would need merged. var gl *metav1.APIGroupList var err error - if ad, ok := d.delegate.(discovery.AggregatedDiscoveryInterface); ok { + ad, ok := d.delegate.(discovery.AggregatedDiscoveryInterfaceWithContext) + if !ok { + //nolint:staticcheck // Intentionally using the old interface here. + if ad2, ok2 := d.delegate.(discovery.AggregatedDiscoveryInterface); ok2 { + ad = discovery.ToAggregatedDiscoveryInterfaceWithContext(ad2) + ok = true + } + } + if ok { var resources map[schema.GroupVersion]*metav1.APIResourceList var failedGVs map[schema.GroupVersion]error - gl, resources, failedGVs, err = ad.GroupsAndMaybeResources() + gl, resources, failedGVs, err = ad.GroupsAndMaybeResourcesWithContext(ctx) if resources != nil && err == nil { // Cache the resources. d.groupToServerResources = map[string]*cacheEntry{} @@ -259,10 +375,10 @@ func (d *memCacheClient) refreshLocked() error { return nil } } else { - gl, err = d.delegate.ServerGroups() + gl, err = d.delegate.ServerGroupsWithContext(ctx) } if err != nil || len(gl.Groups) == 0 { - utilruntime.HandleError(fmt.Errorf("couldn't get current server API group list: %v", err)) + utilruntime.HandleErrorWithContext(ctx, err, "Couldn't get current server API group list") return err } @@ -275,16 +391,16 @@ func (d *memCacheClient) refreshLocked() error { wg.Add(1) go func() { defer wg.Done() - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithContext(ctx) - r, err := d.serverResourcesForGroupVersion(gv) + r, err := d.serverResourcesForGroupVersion(ctx, gv) if err != nil { // Don't log "empty response" as an error; it is a common response for metrics. if _, emptyErr := err.(*emptyResponseError); emptyErr { // Log at same verbosity as disk cache. - klog.V(3).Infof("%v", err) + klog.FromContext(ctx).V(3).Info(err.Error()) } else { - utilruntime.HandleError(fmt.Errorf("couldn't get resource list for %v: %v", gv, err)) + utilruntime.HandleErrorWithContext(ctx, err, "Couldn't get resource list", "groupVersion", gv) } } @@ -301,8 +417,8 @@ func (d *memCacheClient) refreshLocked() error { return nil } -func (d *memCacheClient) serverResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error) { - r, err := d.delegate.ServerResourcesForGroupVersion(groupVersion) +func (d *memCacheClient) serverResourcesForGroupVersion(ctx context.Context, groupVersion string) (*metav1.APIResourceList, error) { + r, err := d.delegate.ServerResourcesForGroupVersionWithContext(ctx, groupVersion) if err != nil { return r, err } @@ -314,16 +430,43 @@ func (d *memCacheClient) serverResourcesForGroupVersion(groupVersion string) (*m // WithLegacy returns current memory-cached discovery client; // current client does not support legacy-only discovery. +// +// WithLegacyWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use WithLegacyWithContext instead. func (d *memCacheClient) WithLegacy() discovery.DiscoveryInterface { return d } +// WithLegacyWithContext returns current memory-cached discovery client; +// current client does not support legacy-only discovery. +func (d *memCacheClient) WithLegacyWithContext(ctx context.Context) discovery.DiscoveryInterfaceWithContext { + return d +} + // NewMemCacheClient creates a new CachedDiscoveryInterface which caches // discovery information in memory and will stay up-to-date if Invalidate is // called with regularity. // // NOTE: The client will NOT resort to live lookups on cache misses. +// +// NewMemCacheClientWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use NewMemCacheClientWithContext instead. func NewMemCacheClient(delegate discovery.DiscoveryInterface) discovery.CachedDiscoveryInterface { + return newMemCacheClient(discovery.ToDiscoveryInterfaceWithContext(delegate)) +} + +// NewMemCacheClientWithContext creates a new CachedDiscoveryInterfaceWithContext which caches +// discovery information in memory and will stay up-to-date if Invalidate is +// called with regularity. +// +// NOTE: The client will NOT resort to live lookups on cache misses. +func NewMemCacheClientWithContext(delegate discovery.DiscoveryInterfaceWithContext) discovery.CachedDiscoveryInterfaceWithContext { + return newMemCacheClient(delegate) +} + +func newMemCacheClient(delegate discovery.DiscoveryInterfaceWithContext) *memCacheClient { return &memCacheClient{ delegate: delegate, groupToServerResources: map[string]*cacheEntry{}, diff --git a/vendor/k8s.io/client-go/discovery/discovery_client.go b/vendor/k8s.io/client-go/discovery/discovery_client.go index aae94f9b8a..355c701939 100644 --- a/vendor/k8s.io/client-go/discovery/discovery_client.go +++ b/vendor/k8s.io/client-go/discovery/discovery_client.go @@ -33,7 +33,6 @@ import ( "google.golang.org/protobuf/proto" apidiscoveryv2 "k8s.io/api/apidiscovery/v2" - apidiscoveryv2beta1 "k8s.io/api/apidiscovery/v2beta1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -60,22 +59,24 @@ const ( defaultBurst = 300 AcceptV1 = runtime.ContentTypeJSON - // Aggregated discovery content-type (v2beta1). NOTE: content-type parameters + // Aggregated discovery content-type. NOTE: content-type parameters // MUST be ordered (g, v, as) for server in "Accept" header (BUT we are resilient // to ordering when comparing returned values in "Content-Type" header). - AcceptV2Beta1 = runtime.ContentTypeJSON + ";" + "g=apidiscovery.k8s.io;v=v2beta1;as=APIGroupDiscoveryList" AcceptV2 = runtime.ContentTypeJSON + ";" + "g=apidiscovery.k8s.io;v=v2;as=APIGroupDiscoveryList" AcceptV2NoPeer = runtime.ContentTypeJSON + ";" + "g=apidiscovery.k8s.io;v=v2;as=APIGroupDiscoveryList;profile=nopeer" // Prioritize aggregated discovery by placing first in the order of discovery accept types. - acceptDiscoveryFormats = AcceptV2 + "," + AcceptV2Beta1 + "," + AcceptV1 + acceptDiscoveryFormats = AcceptV2 + "," + AcceptV1 ) // Aggregated discovery content-type GVK. -var v2Beta1GVK = schema.GroupVersionKind{Group: "apidiscovery.k8s.io", Version: "v2beta1", Kind: "APIGroupDiscoveryList"} var v2GVK = schema.GroupVersionKind{Group: "apidiscovery.k8s.io", Version: "v2", Kind: "APIGroupDiscoveryList"} // DiscoveryInterface holds the methods that discover server-supported API groups, // versions and resources. +// +// DiscoveryInterfaceWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use DiscoveryInterfaceWithContext instead. type DiscoveryInterface interface { RESTClient() restclient.Interface ServerGroupsInterface @@ -86,22 +87,123 @@ type DiscoveryInterface interface { // Returns copy of current discovery client that will only // receive the legacy discovery format, or pointer to current // discovery client if it does not support legacy-only discovery. + // + // DiscoveryInterfaceWithContext.WithLegacyWithContext is a better alternative because it supports contextual logging and cancellation. + // + // Contextual logging: Use DiscoveryInterfaceWithContext.WithLegacyWithContext instead. WithLegacy() DiscoveryInterface } +// DiscoveryInterfaceWithContext holds the methods that discover server-supported API groups, +// versions and resources. +type DiscoveryInterfaceWithContext interface { + RESTClient() restclient.Interface + ServerGroupsInterfaceWithContext + ServerResourcesInterfaceWithContext + ServerVersionInterfaceWithContext + OpenAPISchemaInterfaceWithContext + OpenAPIV3SchemaInterfaceWithContext + // Returns copy of current discovery client that will only + // receive the legacy discovery format, or pointer to current + // discovery client if it does not support legacy-only discovery. + WithLegacyWithContext(ctx context.Context) DiscoveryInterfaceWithContext +} + +// DiscoveryInterfaces combines both interface variants. +type DiscoveryInterfaces interface { + DiscoveryInterface + DiscoveryInterfaceWithContext +} + +func ToDiscoveryInterfaceWithContext(i DiscoveryInterface) DiscoveryInterfaceWithContext { + if i == nil { + return nil + } + if i, ok := i.(DiscoveryInterfaceWithContext); ok { + return i + } + return &discoveryInterfaceWrapper{ + ServerGroupsInterfaceWithContext: ToServerGroupsInterfaceWithContext(i), + ServerResourcesInterfaceWithContext: ToServerResourcesInterfaceWithContext(i), + ServerVersionInterfaceWithContext: ToServerVersionInterfaceWithContext(i), + OpenAPISchemaInterfaceWithContext: ToOpenAPISchemaInterfaceWithContext(i), + OpenAPIV3SchemaInterfaceWithContext: OpenAPIV3ToSchemaInterfaceWithContext(i), + delegate: i, + } +} + +type discoveryInterfaceWrapper struct { + ServerGroupsInterfaceWithContext + ServerResourcesInterfaceWithContext + ServerVersionInterfaceWithContext + OpenAPISchemaInterfaceWithContext + OpenAPIV3SchemaInterfaceWithContext + delegate DiscoveryInterface +} + +func (i *discoveryInterfaceWrapper) RESTClient() restclient.Interface { + return i.delegate.RESTClient() +} + +func (i *discoveryInterfaceWrapper) WithLegacyWithContext(ctx context.Context) DiscoveryInterfaceWithContext { + return ToDiscoveryInterfaceWithContext(i.delegate.WithLegacy()) +} + // AggregatedDiscoveryInterface extends DiscoveryInterface to include a method to possibly // return discovery resources along with the discovery groups, which is what the newer // aggregated discovery format does (APIGroupDiscoveryList). +// +// AggregatedDiscoveryInterfaceWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use AggregatedDiscoveryInterfaceWithContext instead. type AggregatedDiscoveryInterface interface { DiscoveryInterface + // AggregatedDiscoveryInterfaceWithContext.GroupsAndMaybeResourcesWithContext is a better alternative because it supports contextual logging and cancellation. + // + // Contextual logging: Use AggregatedDiscoveryInterfaceWithContext.GroupsAndMaybeResourcesWithContext instead. GroupsAndMaybeResources() (*metav1.APIGroupList, map[schema.GroupVersion]*metav1.APIResourceList, map[schema.GroupVersion]error, error) } +// AggregatedDiscoveryInterfaceWithContext extends DiscoveryInterface to include a method to possibly +// return discovery resources along with the discovery groups, which is what the newer +// aggregated discovery format does (APIGroupDiscoveryList). +type AggregatedDiscoveryInterfaceWithContext interface { + DiscoveryInterfaceWithContext + + GroupsAndMaybeResourcesWithContext(ctx context.Context) (*metav1.APIGroupList, map[schema.GroupVersion]*metav1.APIResourceList, map[schema.GroupVersion]error, error) +} + +func ToAggregatedDiscoveryInterfaceWithContext(i AggregatedDiscoveryInterface) AggregatedDiscoveryInterfaceWithContext { + if i == nil { + return nil + } + if i, ok := i.(AggregatedDiscoveryInterfaceWithContext); ok { + return i + } + return &aggregatedDiscoveryInterfaceWrapper{ + DiscoveryInterfaceWithContext: ToDiscoveryInterfaceWithContext(i), + delegate: i, + } +} + +type aggregatedDiscoveryInterfaceWrapper struct { + DiscoveryInterfaceWithContext + delegate AggregatedDiscoveryInterface +} + +func (i *aggregatedDiscoveryInterfaceWrapper) GroupsAndMaybeResourcesWithContext(ctx context.Context) (*metav1.APIGroupList, map[schema.GroupVersion]*metav1.APIResourceList, map[schema.GroupVersion]error, error) { + return i.delegate.GroupsAndMaybeResources() +} + // CachedDiscoveryInterface is a DiscoveryInterface with cache invalidation and freshness. // Note that If the ServerResourcesForGroupVersion method returns a cache miss // error, the user needs to explicitly call Invalidate to clear the cache, // otherwise the same cache miss error will be returned next time. +// +// CachedDiscoveryInterfaceWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use CachedDiscoveryInterfaceWithContext instead. type CachedDiscoveryInterface interface { DiscoveryInterface // Fresh is supposed to tell the caller whether or not to retry if the cache @@ -109,58 +211,343 @@ type CachedDiscoveryInterface interface { // // TODO: this needs to be revisited, this interface can't be locked properly // and doesn't make a lot of sense. + // + // CachedDiscoveryInterfaceWithContext.FreshWithContext is a better alternative because it supports contextual logging and cancellation. + // + // Contextual logging: Use CachedDiscoveryInterfaceWithContext.FreshWithContext instead. Fresh() bool // Invalidate enforces that no cached data that is older than the current time // is used. + // + // CachedDiscoveryInterfaceWithContext.InvalidateWithContext is a better alternative because it supports contextual logging and cancellation. + // + // Contextual logging: Use CachedDiscoveryInterfaceWithContext.InvalidateWithContext instead. Invalidate() } +// CachedDiscoveryInterfaceWithContext is a DiscoveryInterfaceWithContext with cache invalidation and freshness. +// Note that If the ServerResourcesForGroupVersion method returns a cache miss +// error, the user needs to explicitly call Invalidate to clear the cache, +// otherwise the same cache miss error will be returned next time. +type CachedDiscoveryInterfaceWithContext interface { + DiscoveryInterfaceWithContext + // Fresh is supposed to tell the caller whether or not to retry if the cache + // fails to find something (false = retry, true = no need to retry). + // + // TODO: this needs to be revisited, this interface can't be locked properly + // and doesn't make a lot of sense. + FreshWithContext(ctx context.Context) bool + // Invalidate enforces that no cached data that is older than the current time + // is used. + InvalidateWithContext(ctx context.Context) +} + +func ToCachedDiscoveryInterfaceWithContext(i CachedDiscoveryInterface) CachedDiscoveryInterfaceWithContext { + if i == nil { + return nil + } + if i, ok := i.(CachedDiscoveryInterfaceWithContext); ok { + return i + } + return &cachedDiscoveryInterfaceWrapper{ + DiscoveryInterfaceWithContext: ToDiscoveryInterfaceWithContext(i), + delegate: i, + } +} + +type cachedDiscoveryInterfaceWrapper struct { + DiscoveryInterfaceWithContext + delegate CachedDiscoveryInterface +} + +func (i *cachedDiscoveryInterfaceWrapper) FreshWithContext(ctx context.Context) bool { + return i.delegate.Fresh() +} + +func (i *cachedDiscoveryInterfaceWrapper) InvalidateWithContext(ctx context.Context) { + i.delegate.Invalidate() +} + // ServerGroupsInterface has methods for obtaining supported groups on the API server +// +// ServerGroupsInterfaceWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerGroupsInterfaceWithContext instead. type ServerGroupsInterface interface { // ServerGroups returns the supported groups, with information like supported versions and the // preferred version. + // + // ServerGroupsInterfaceWithContext.ServerGroups is a better alternative because it supports contextual logging and cancellation. + // + // Contextual logging: Use ServerGroupsInterfaceWithContext.ServerGroups instead. ServerGroups() (*metav1.APIGroupList, error) } +// ServerGroupsInterfaceWithContext has methods for obtaining supported groups on the API server +type ServerGroupsInterfaceWithContext interface { + // ServerGroups returns the supported groups, with information like supported versions and the + // preferred version. + ServerGroupsWithContext(ctx context.Context) (*metav1.APIGroupList, error) +} + +func ToServerGroupsInterfaceWithContext(i ServerGroupsInterface) ServerGroupsInterfaceWithContext { + if i == nil { + return nil + } + if i, ok := i.(ServerGroupsInterfaceWithContext); ok { + return i + } + return &serverGroupsInterfaceWrapper{ + delegate: i, + } +} + +type serverGroupsInterfaceWrapper struct { + delegate ServerGroupsInterface +} + +func (i *serverGroupsInterfaceWrapper) ServerGroupsWithContext(ctx context.Context) (*metav1.APIGroupList, error) { + return i.delegate.ServerGroups() +} + // ServerResourcesInterface has methods for obtaining supported resources on the API server +// +// ServerGroupsAndResourcesWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerGroupsAndResourcesWithContext instead. type ServerResourcesInterface interface { // ServerResourcesForGroupVersion returns the supported resources for a group and version. + // + // ServerGroupsAndResourcesWithContext.ServerResourcesForGroupVersionWithContext is a better alternative because it supports contextual logging and cancellation. + // + // Contextual logging: Use ServerGroupsAndResourcesWithContext.ServerResourcesForGroupVersionWithContext instead. ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error) // ServerGroupsAndResources returns the supported groups and resources for all groups and versions. // // The returned group and resource lists might be non-nil with partial results even in the // case of non-nil error. + // + // ServerGroupsAndResourcesWithContext.ServerGroupsAndResourcesWithContext is a better alternative because it supports contextual logging and cancellation. + // + // Contextual logging: Use ServerGroupsAndResourcesWithContext.ServerGroupsAndResourcesWithContext instead. ServerGroupsAndResources() ([]*metav1.APIGroup, []*metav1.APIResourceList, error) // ServerPreferredResources returns the supported resources with the version preferred by the // server. // // The returned group and resource lists might be non-nil with partial results even in the // case of non-nil error. + // + // ServerResourcesInterfaceWithContext.ServerPreferredResourcesWithContext is a better alternative because it supports contextual logging and cancellation. + // + // Contextual logging: Use ServerResourcesInterfaceWithContext.ServerPreferredResourcesWithContext instead. ServerPreferredResources() ([]*metav1.APIResourceList, error) // ServerPreferredNamespacedResources returns the supported namespaced resources with the // version preferred by the server. // // The returned resource list might be non-nil with partial results even in the case of // non-nil error. + // + // ServerResourcesInterfaceWithContext.ServerPreferredNamespacedResourcesWithContext is a better alternative because it supports contextual logging and cancellation. + // + // Contextual logging: Use ServerResourcesInterfaceWithContext.ServerPreferredNamespacedResourcesWithContext instead. ServerPreferredNamespacedResources() ([]*metav1.APIResourceList, error) } +// ServerResourcesInterfaceWithContext has methods for obtaining supported resources on the API server +type ServerResourcesInterfaceWithContext interface { + // ServerResourcesForGroupVersionWithContext returns the supported resources for a group and version. + ServerResourcesForGroupVersionWithContext(ctx context.Context, groupVersion string) (*metav1.APIResourceList, error) + // ServerGroupsAndResourcesWithContext returns the supported groups and resources for all groups and versions. + // + // The returned group and resource lists might be non-nil with partial results even in the + // case of non-nil error. + ServerGroupsAndResourcesWithContext(ctx context.Context) ([]*metav1.APIGroup, []*metav1.APIResourceList, error) + // ServerPreferredResourcesWithContext returns the supported resources with the version preferred by the + // server. + // + // The returned group and resource lists might be non-nil with partial results even in the + // case of non-nil error. + ServerPreferredResourcesWithContext(ctx context.Context) ([]*metav1.APIResourceList, error) + // ServerPreferredNamespacedResourcesWithContext returns the supported namespaced resources with the + // version preferred by the server. + // + // The returned resource list might be non-nil with partial results even in the case of + // non-nil error. + ServerPreferredNamespacedResourcesWithContext(ctx context.Context) ([]*metav1.APIResourceList, error) +} + +func ToServerResourcesInterfaceWithContext(i ServerResourcesInterface) ServerResourcesInterfaceWithContext { + if i == nil { + return nil + } + if i, ok := i.(ServerResourcesInterfaceWithContext); ok { + return i + } + return &serverResourcesInterfaceWrapper{ + delegate: i, + } +} + +type serverResourcesInterfaceWrapper struct { + delegate ServerResourcesInterface +} + +func (i *serverResourcesInterfaceWrapper) ServerResourcesForGroupVersionWithContext(ctx context.Context, groupVersion string) (*metav1.APIResourceList, error) { + return i.delegate.ServerResourcesForGroupVersion(groupVersion) +} + +func (i *serverResourcesInterfaceWrapper) ServerGroupsAndResourcesWithContext(ctx context.Context) ([]*metav1.APIGroup, []*metav1.APIResourceList, error) { + return i.delegate.ServerGroupsAndResources() +} + +func (i *serverResourcesInterfaceWrapper) ServerPreferredResourcesWithContext(ctx context.Context) ([]*metav1.APIResourceList, error) { + return i.delegate.ServerPreferredResources() +} + +func (i *serverResourcesInterfaceWrapper) ServerPreferredNamespacedResourcesWithContext(ctx context.Context) ([]*metav1.APIResourceList, error) { + return i.delegate.ServerPreferredNamespacedResources() +} + // ServerVersionInterface has a method for retrieving the server's version. +// +// ServerVersionInterfaceWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerVersionInterfaceWithContext instead. type ServerVersionInterface interface { // ServerVersion retrieves and parses the server's version (git version). + // + // ServerVersionInterfaceWithContext.ServerVersionWithContext is a better alternative because it supports contextual logging and cancellation. + // + // Contextual logging: Use ServerVersionInterfaceWithContext.ServerVersionWithContext instead. ServerVersion() (*version.Info, error) } +// ServerVersionInterface has a method for retrieving the server's version. +type ServerVersionInterfaceWithContext interface { + // ServerVersion retrieves and parses the server's version (git version). + ServerVersionWithContext(ctx context.Context) (*version.Info, error) +} + +func ToServerVersionInterfaceWithContext(i ServerVersionInterface) ServerVersionInterfaceWithContext { + if i == nil { + return nil + } + if i, ok := i.(ServerVersionInterfaceWithContext); ok { + return i + } + return &serverVersionInterfaceWrapper{ + delegate: i, + } +} + +type serverVersionInterfaceWrapper struct { + delegate ServerVersionInterface +} + +func (i *serverVersionInterfaceWrapper) ServerVersionWithContext(ctx context.Context) (*version.Info, error) { + return i.delegate.ServerVersion() +} + // OpenAPISchemaInterface has a method to retrieve the open API schema. +// +// OpenAPISchemaInterfaceWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use OpenAPISchemaInterfaceWithContext instead. type OpenAPISchemaInterface interface { // OpenAPISchema retrieves and parses the swagger API schema the server supports. + // + // OpenAPISchemaInterfaceWithContext.OpenAPISchemaWithContext is a better alternative because it supports contextual logging and cancellation. + // + // Contextual logging: Use OpenAPISchemaInterfaceWithContext.OpenAPISchemaWithContext instead. OpenAPISchema() (*openapi_v2.Document, error) } +// OpenAPISchemaInterfaceWithContext has a method to retrieve the open API schema. +type OpenAPISchemaInterfaceWithContext interface { + // OpenAPISchemaWithContext retrieves and parses the swagger API schema the server supports. + OpenAPISchemaWithContext(ctx context.Context) (*openapi_v2.Document, error) +} + +func ToOpenAPISchemaInterfaceWithContext(i OpenAPISchemaInterface) OpenAPISchemaInterfaceWithContext { + if i == nil { + return nil + } + if i, ok := i.(OpenAPISchemaInterfaceWithContext); ok { + return i + } + return &openAPISchemaInterfaceWrapper{ + delegate: i, + } +} + +type openAPISchemaInterfaceWrapper struct { + delegate OpenAPISchemaInterface +} + +func (i *openAPISchemaInterfaceWrapper) OpenAPISchemaWithContext(ctx context.Context) (*openapi_v2.Document, error) { + return i.delegate.OpenAPISchema() +} + +// OpenAPIV3SchemaInterfaceWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use OpenAPIV3SchemaInterfaceWithContext instead. type OpenAPIV3SchemaInterface interface { + // OpenAPIV3SchemaInterfaceWithContext.OpenAPIV3WithContext is a better alternative because it supports contextual logging and cancellation. + // + // Contextual logging: Use OpenAPIV3SchemaInterfaceWithContext.OpenAPIV3WithContext instead. OpenAPIV3() openapi.Client } +type OpenAPIV3SchemaInterfaceWithContext interface { + OpenAPIV3WithContext(ctx context.Context) openapi.ClientWithContext +} + +func OpenAPIV3ToSchemaInterfaceWithContext(i OpenAPIV3SchemaInterface) OpenAPIV3SchemaInterfaceWithContext { + if i == nil { + return nil + } + if i, ok := i.(OpenAPIV3SchemaInterfaceWithContext); ok { + return i + } + return &openAPIV3SchemaInterfaceWrapper{ + delegate: i, + } +} + +type openAPIV3SchemaInterfaceWrapper struct { + delegate OpenAPIV3SchemaInterface +} + +func (i *openAPIV3SchemaInterfaceWrapper) OpenAPIV3WithContext(ctx context.Context) openapi.ClientWithContext { + return ToOpenAPIClientWithContext(i.delegate.OpenAPIV3()) +} + +func ToOpenAPIClientWithContext(i openapi.Client) openapi.ClientWithContext { //nolint:staticcheck // Intentionally using the old interface here. + if i == nil { + return nil + } + if i, ok := i.(openapi.ClientWithContext); ok { + return i + } + return &openAPIClientWrapper{ + delegate: i, + } +} + +type openAPIClientWrapper struct { + //nolint:staticcheck // Intentionally using the old interface here. + delegate openapi.Client +} + +func (i *openAPIClientWrapper) PathsWithContext(ctx context.Context) (map[string]openapi.GroupVersionWithContext, error) { + resultWithoutContext, err := i.delegate.Paths() + result := make(map[string]openapi.GroupVersionWithContext, len(resultWithoutContext)) + for key, entry := range resultWithoutContext { + result[key] = openapi.ToGroupVersionWithContext(entry) + } + return result, err +} + // DiscoveryClient implements the functions that discover server-supported API groups, // versions and resources. type DiscoveryClient struct { @@ -202,19 +589,42 @@ func apiVersionsToAPIGroup(apiVersions *metav1.APIVersions) (apiGroup metav1.API // as aggregated discovery format or legacy format. For safety, resources will only // be returned if both endpoints returned resources. Returned "failedGVs" can be // empty, but will only be nil in the case an error is returned. +// +// GroupsAndMaybeResourcesWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use GroupsAndMaybeResourcesWithContext instead. func (d *DiscoveryClient) GroupsAndMaybeResources() ( *metav1.APIGroupList, map[schema.GroupVersion]*metav1.APIResourceList, map[schema.GroupVersion]error, error) { + return d.GroupsAndMaybeResourcesWithContext(context.Background()) +} + +// GroupsAndMaybeResources returns the discovery groups, and (if new aggregated +// discovery format) the resources keyed by group/version. Merges discovery groups +// and resources from /api and /apis (either aggregated or not). Legacy groups +// must be ordered first. The server will either return both endpoints (/api, /apis) +// as aggregated discovery format or legacy format. For safety, resources will only +// be returned if both endpoints returned resources. Returned "failedGVs" can be +// empty, but will only be nil in the case an error is returned. +func (d *DiscoveryClient) GroupsAndMaybeResourcesWithContext(ctx context.Context) ( + *metav1.APIGroupList, + map[schema.GroupVersion]*metav1.APIResourceList, + map[schema.GroupVersion]error, + error) { + if err := ctx.Err(); err != nil { + return nil, nil, nil, err + } + // Legacy group ordered first (there is only one -- core/v1 group). Returned groups must // be non-nil, but it could be empty. Returned resources, apiResources map could be nil. - groups, resources, failedGVs, err := d.downloadLegacy() + groups, resources, failedGVs, err := d.downloadLegacy(ctx) if err != nil { return nil, nil, nil, err } // Discovery groups and (possibly) resources downloaded from /apis. - apiGroups, apiResources, failedApisGVs, aerr := d.downloadAPIs() + apiGroups, apiResources, failedApisGVs, aerr := d.downloadAPIs(ctx) if aerr != nil { return nil, nil, nil, aerr } @@ -242,7 +652,7 @@ func (d *DiscoveryClient) GroupsAndMaybeResources() ( // possible for the resource map to be nil if the server returned // the unaggregated discovery. Returned "failedGVs" can be empty, but // will only be nil in the case of a returned error. -func (d *DiscoveryClient) downloadLegacy() ( +func (d *DiscoveryClient) downloadLegacy(ctx context.Context) ( *metav1.APIGroupList, map[schema.GroupVersion]*metav1.APIResourceList, map[schema.GroupVersion]error, @@ -252,7 +662,7 @@ func (d *DiscoveryClient) downloadLegacy() ( body, err := d.restClient.Get(). AbsPath("/api"). SetHeader("Accept", accept). - Do(context.TODO()). + Do(ctx). ContentType(&responseContentType). Raw() apiGroupList := &metav1.APIGroupList{} @@ -277,13 +687,6 @@ func (d *DiscoveryClient) downloadLegacy() ( return nil, nil, nil, err } apiGroupList, resourcesByGV, failedGVs = SplitGroupsAndResources(aggregatedDiscovery) - } else if isGVK, _ := ContentTypeIsGVK(responseContentType, v2Beta1GVK); isGVK { - var aggregatedDiscovery apidiscoveryv2beta1.APIGroupDiscoveryList - err = json.Unmarshal(body, &aggregatedDiscovery) - if err != nil { - return nil, nil, nil, err - } - apiGroupList, resourcesByGV, failedGVs = SplitGroupsAndResourcesV2Beta1(aggregatedDiscovery) } else { // Default is unaggregated discovery v1. var v metav1.APIVersions @@ -305,7 +708,7 @@ func (d *DiscoveryClient) downloadLegacy() ( // discovery resources. The returned groups will always exist, but the // resources map may be nil. Returned "failedGVs" can be empty, but will // only be nil in the case of a returned error. -func (d *DiscoveryClient) downloadAPIs() ( +func (d *DiscoveryClient) downloadAPIs(ctx context.Context) ( *metav1.APIGroupList, map[schema.GroupVersion]*metav1.APIResourceList, map[schema.GroupVersion]error, @@ -315,7 +718,7 @@ func (d *DiscoveryClient) downloadAPIs() ( body, err := d.restClient.Get(). AbsPath("/apis"). SetHeader("Accept", accept). - Do(context.TODO()). + Do(ctx). ContentType(&responseContentType). Raw() if err != nil { @@ -333,13 +736,6 @@ func (d *DiscoveryClient) downloadAPIs() ( return nil, nil, nil, err } apiGroupList, resourcesByGV, failedGVs = SplitGroupsAndResources(aggregatedDiscovery) - } else if isGVK, _ := ContentTypeIsGVK(responseContentType, v2Beta1GVK); isGVK { - var aggregatedDiscovery apidiscoveryv2beta1.APIGroupDiscoveryList - err = json.Unmarshal(body, &aggregatedDiscovery) - if err != nil { - return nil, nil, nil, err - } - apiGroupList, resourcesByGV, failedGVs = SplitGroupsAndResourcesV2Beta1(aggregatedDiscovery) } else { // Default is unaggregated discovery v1. err = json.Unmarshal(body, apiGroupList) @@ -368,9 +764,9 @@ func selectDiscoveryAcceptHeader(useLegacy, nopeer bool) string { // content-type parameters, as well as parameters added by // intermediaries such as proxies or gateways. Examples: // -// ("application/json; g=apidiscovery.k8s.io;v=v2beta1;as=APIGroupDiscoveryList", {apidiscovery.k8s.io, v2beta1, APIGroupDiscoveryList}) = (true, nil) -// ("application/json; as=APIGroupDiscoveryList;v=v2beta1;g=apidiscovery.k8s.io", {apidiscovery.k8s.io, v2beta1, APIGroupDiscoveryList}) = (true, nil) -// ("application/json; as=APIGroupDiscoveryList;v=v2beta1;g=apidiscovery.k8s.io;charset=utf-8", {apidiscovery.k8s.io, v2beta1, APIGroupDiscoveryList}) = (true, nil) +// ("application/json; g=apidiscovery.k8s.io;v=v2;as=APIGroupDiscoveryList", {apidiscovery.k8s.io, v2, APIGroupDiscoveryList}) = (true, nil) +// ("application/json; as=APIGroupDiscoveryList;v=v2;g=apidiscovery.k8s.io", {apidiscovery.k8s.io, v2, APIGroupDiscoveryList}) = (true, nil) +// ("application/json; as=APIGroupDiscoveryList;v=v2;g=apidiscovery.k8s.io;charset=utf-8", {apidiscovery.k8s.io, v2, APIGroupDiscoveryList}) = (true, nil) // ("application/json", any GVK) = (false, nil) // ("application/json; charset=UTF-8", any GVK) = (false, nil) // ("malformed content type string", any GVK) = (false, error) @@ -388,8 +784,18 @@ func ContentTypeIsGVK(contentType string, gvk schema.GroupVersionKind) (bool, er // ServerGroups returns the supported groups, with information like supported versions and the // preferred version. +// +// ServerGroupsWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerGroupsWithContext instead. func (d *DiscoveryClient) ServerGroups() (*metav1.APIGroupList, error) { - groups, _, _, err := d.GroupsAndMaybeResources() + return d.ServerGroupsWithContext(context.Background()) +} + +// ServerGroupsWithContext returns the supported groups, with information like supported versions and the +// preferred version. +func (d *DiscoveryClient) ServerGroupsWithContext(ctx context.Context) (*metav1.APIGroupList, error) { + groups, _, _, err := d.GroupsAndMaybeResourcesWithContext(ctx) if err != nil { return nil, err } @@ -397,7 +803,16 @@ func (d *DiscoveryClient) ServerGroups() (*metav1.APIGroupList, error) { } // ServerResourcesForGroupVersion returns the supported resources for a group and version. +// +// ServerResourcesForGroupVersionWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerResourcesForGroupVersionWithContext instead. func (d *DiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (resources *metav1.APIResourceList, err error) { + return d.ServerResourcesForGroupVersionWithContext(context.Background(), groupVersion) +} + +// ServerResourcesForGroupVersionWithContext returns the supported resources for a group and version. +func (d *DiscoveryClient) ServerResourcesForGroupVersionWithContext(ctx context.Context, groupVersion string) (resources *metav1.APIResourceList, err error) { url := url.URL{} if len(groupVersion) == 0 { return nil, fmt.Errorf("groupVersion shouldn't be empty") @@ -410,7 +825,7 @@ func (d *DiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (r resources = &metav1.APIResourceList{ GroupVersion: groupVersion, } - err = d.restClient.Get().AbsPath(url.String()).Do(context.TODO()).Into(resources) + err = d.restClient.Get().AbsPath(url.String()).Do(ctx).Into(resources) if err != nil { // Tolerate core/v1 not found response by returning empty resource list; // this probably should not happen. But we should verify all callers are @@ -425,8 +840,13 @@ func (d *DiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (r // ServerGroupsAndResources returns the supported resources for all groups and versions. func (d *DiscoveryClient) ServerGroupsAndResources() ([]*metav1.APIGroup, []*metav1.APIResourceList, error) { - return withRetries(defaultRetries, func() ([]*metav1.APIGroup, []*metav1.APIResourceList, error) { - return ServerGroupsAndResources(d) + return d.ServerGroupsAndResourcesWithContext(context.Background()) +} + +// ServerGroupsAndResourcesWithContext returns the supported resources for all groups and versions. +func (d *DiscoveryClient) ServerGroupsAndResourcesWithContext(ctx context.Context) ([]*metav1.APIGroup, []*metav1.APIResourceList, error) { + return withRetries(ctx, defaultRetries, func() ([]*metav1.APIGroup, []*metav1.APIResourceList, error) { + return ServerGroupsAndResourcesWithContext(ctx, d) }) } @@ -469,7 +889,18 @@ func GroupDiscoveryFailedErrorGroups(err error) (map[schema.GroupVersion]error, return nil, false } +// ServerGroupsAndResourcesWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerGroupsAndResourcesWithContext instead. func ServerGroupsAndResources(d DiscoveryInterface) ([]*metav1.APIGroup, []*metav1.APIResourceList, error) { + return ServerGroupsAndResourcesWithContext(context.Background(), ToDiscoveryInterfaceWithContext(d)) +} + +func ServerGroupsAndResourcesWithContext(ctx context.Context, d DiscoveryInterfaceWithContext) ([]*metav1.APIGroup, []*metav1.APIResourceList, error) { + if err := ctx.Err(); err != nil { + return nil, nil, err + } + var sgs *metav1.APIGroupList var resources []*metav1.APIResourceList var failedGVs map[schema.GroupVersion]error @@ -477,14 +908,21 @@ func ServerGroupsAndResources(d DiscoveryInterface) ([]*metav1.APIGroup, []*meta // If the passed discovery object implements the wider AggregatedDiscoveryInterface, // then attempt to retrieve aggregated discovery with both groups and the resources. - if ad, ok := d.(AggregatedDiscoveryInterface); ok { + ad, ok := d.(AggregatedDiscoveryInterfaceWithContext) + if !ok { + if ad2, ok2 := d.(AggregatedDiscoveryInterface); ok2 { + ad = ToAggregatedDiscoveryInterfaceWithContext(ad2) + ok = true + } + } + if ok { var resourcesByGV map[schema.GroupVersion]*metav1.APIResourceList - sgs, resourcesByGV, failedGVs, err = ad.GroupsAndMaybeResources() + sgs, resourcesByGV, failedGVs, err = ad.GroupsAndMaybeResourcesWithContext(ctx) for _, resourceList := range resourcesByGV { resources = append(resources, resourceList) } } else { - sgs, err = d.ServerGroups() + sgs, err = d.ServerGroupsWithContext(ctx) } if sgs == nil { @@ -505,7 +943,7 @@ func ServerGroupsAndResources(d DiscoveryInterface) ([]*metav1.APIGroup, []*meta return resultGroups, resources, ferr } - groupVersionResources, failedGroups := fetchGroupVersionResources(d, sgs) + groupVersionResources, failedGroups := fetchGroupVersionResources(ctx, d, sgs) // order results by group/version discovery order result := []*metav1.APIResourceList{} @@ -526,7 +964,20 @@ func ServerGroupsAndResources(d DiscoveryInterface) ([]*metav1.APIGroup, []*meta } // ServerPreferredResources uses the provided discovery interface to look up preferred resources +// +// ServerPreferredResourcesWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerPreferredResourcesWithContext instead. func ServerPreferredResources(d DiscoveryInterface) ([]*metav1.APIResourceList, error) { + return ServerPreferredResourcesWithContext(context.Background(), ToDiscoveryInterfaceWithContext(d)) +} + +// ServerPreferredResourcesWithContext uses the provided discovery interface to look up preferred resources +func ServerPreferredResourcesWithContext(ctx context.Context, d DiscoveryInterfaceWithContext) ([]*metav1.APIResourceList, error) { + if err := ctx.Err(); err != nil { + return nil, err + } + var serverGroupList *metav1.APIGroupList var failedGroups map[schema.GroupVersion]error var groupVersionResources map[schema.GroupVersion]*metav1.APIResourceList @@ -535,18 +986,24 @@ func ServerPreferredResources(d DiscoveryInterface) ([]*metav1.APIResourceList, // If the passed discovery object implements the wider AggregatedDiscoveryInterface, // then it is attempt to retrieve both the groups and the resources. "failedGroups" // are Group/Versions returned as stale in AggregatedDiscovery format. - ad, ok := d.(AggregatedDiscoveryInterface) + ad, ok := d.(AggregatedDiscoveryInterfaceWithContext) + if !ok { + if ad2, ok2 := d.(AggregatedDiscoveryInterface); ok2 { + ad = ToAggregatedDiscoveryInterfaceWithContext(ad2) + ok = true + } + } if ok { - serverGroupList, groupVersionResources, failedGroups, err = ad.GroupsAndMaybeResources() + serverGroupList, groupVersionResources, failedGroups, err = ad.GroupsAndMaybeResourcesWithContext(ctx) } else { - serverGroupList, err = d.ServerGroups() + serverGroupList, err = d.ServerGroupsWithContext(ctx) } if err != nil { return nil, err } // Non-aggregated discovery must fetch resources from Groups. if groupVersionResources == nil { - groupVersionResources, failedGroups = fetchGroupVersionResources(d, serverGroupList) + groupVersionResources, failedGroups = fetchGroupVersionResources(ctx, d, serverGroupList) } result := []*metav1.APIResourceList{} @@ -602,7 +1059,7 @@ func ServerPreferredResources(d DiscoveryInterface) ([]*metav1.APIResourceList, } // fetchServerResourcesForGroupVersions uses the discovery client to fetch the resources for the specified groups in parallel. -func fetchGroupVersionResources(d DiscoveryInterface, apiGroups *metav1.APIGroupList) (map[schema.GroupVersion]*metav1.APIResourceList, map[schema.GroupVersion]error) { +func fetchGroupVersionResources(ctx context.Context, d DiscoveryInterfaceWithContext, apiGroups *metav1.APIGroupList) (map[schema.GroupVersion]*metav1.APIResourceList, map[schema.GroupVersion]error) { groupVersionResources := make(map[schema.GroupVersion]*metav1.APIResourceList) failedGroups := make(map[schema.GroupVersion]error) @@ -614,9 +1071,9 @@ func fetchGroupVersionResources(d DiscoveryInterface, apiGroups *metav1.APIGroup wg.Add(1) go func() { defer wg.Done() - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithContext(ctx) - apiResourceList, err := d.ServerResourcesForGroupVersion(groupVersion.String()) + apiResourceList, err := d.ServerResourcesForGroupVersionWithContext(ctx, groupVersion.String()) // lock to record results resultLock.Lock() @@ -640,23 +1097,56 @@ func fetchGroupVersionResources(d DiscoveryInterface, apiGroups *metav1.APIGroup // ServerPreferredResources returns the supported resources with the version preferred by the // server. +// +// ServerPreferredResourcesWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerPreferredResourcesWithContext instead. func (d *DiscoveryClient) ServerPreferredResources() ([]*metav1.APIResourceList, error) { - _, rs, err := withRetries(defaultRetries, func() ([]*metav1.APIGroup, []*metav1.APIResourceList, error) { + _, rs, err := withRetries(context.Background(), defaultRetries, func() ([]*metav1.APIGroup, []*metav1.APIResourceList, error) { rs, err := ServerPreferredResources(d) return nil, rs, err }) return rs, err } +// ServerPreferredResourcesWithContext returns the supported resources with the version preferred by the +// server. +func (d *DiscoveryClient) ServerPreferredResourcesWithContext(ctx context.Context) ([]*metav1.APIResourceList, error) { + _, rs, err := withRetries(ctx, defaultRetries, func() ([]*metav1.APIGroup, []*metav1.APIResourceList, error) { + rs, err := ServerPreferredResourcesWithContext(ctx, d) + return nil, rs, err + }) + return rs, err +} + // ServerPreferredNamespacedResources returns the supported namespaced resources with the // version preferred by the server. +// +// ServerPreferredNamespacedResourcesWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerPreferredNamespacedResourcesWithContext instead. func (d *DiscoveryClient) ServerPreferredNamespacedResources() ([]*metav1.APIResourceList, error) { return ServerPreferredNamespacedResources(d) } +// ServerPreferredNamespacedResources returns the supported namespaced resources with the +// version preferred by the server. +func (d *DiscoveryClient) ServerPreferredNamespacedResourcesWithContext(ctx context.Context) ([]*metav1.APIResourceList, error) { + return ServerPreferredNamespacedResourcesWithContext(ctx, d) +} + // ServerPreferredNamespacedResources uses the provided discovery interface to look up preferred namespaced resources +// +// ServerPreferredNamespacedResourcesWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerPreferredNamespacedResourcesWithContext instead. func ServerPreferredNamespacedResources(d DiscoveryInterface) ([]*metav1.APIResourceList, error) { - all, err := ServerPreferredResources(d) + return ServerPreferredNamespacedResourcesWithContext(context.Background(), ToDiscoveryInterfaceWithContext(d)) +} + +// ServerPreferredNamespacedResourcesWithContext uses the provided discovery interface to look up preferred namespaced resources +func ServerPreferredNamespacedResourcesWithContext(ctx context.Context, d DiscoveryInterfaceWithContext) ([]*metav1.APIResourceList, error) { + all, err := ServerPreferredResourcesWithContext(ctx, d) return FilteredBy(ResourcePredicateFunc(func(groupVersion string, r *metav1.APIResource) bool { return r.Namespaced }), all), err @@ -664,7 +1154,12 @@ func ServerPreferredNamespacedResources(d DiscoveryInterface) ([]*metav1.APIReso // ServerVersion retrieves and parses the server's version (git version). func (d *DiscoveryClient) ServerVersion() (*version.Info, error) { - body, err := d.restClient.Get().AbsPath("/version").Do(context.TODO()).Raw() + return d.ServerVersionWithContext(context.Background()) +} + +// ServerVersionWithContext retrieves and parses the server's version (git version). +func (d *DiscoveryClient) ServerVersionWithContext(ctx context.Context) (*version.Info, error) { + body, err := d.restClient.Get().AbsPath("/version").Do(ctx).Raw() if err != nil { return nil, err } @@ -678,7 +1173,12 @@ func (d *DiscoveryClient) ServerVersion() (*version.Info, error) { // OpenAPISchema fetches the open api v2 schema using a rest client and parses the proto. func (d *DiscoveryClient) OpenAPISchema() (*openapi_v2.Document, error) { - data, err := d.restClient.Get().AbsPath("/openapi/v2").SetHeader("Accept", openAPIV2mimePb).Do(context.TODO()).Raw() + return d.OpenAPISchemaWithContext(context.Background()) +} + +// OpenAPISchemaWithContext fetches the open api v2 schema using a rest client and parses the proto. +func (d *DiscoveryClient) OpenAPISchemaWithContext(ctx context.Context) (*openapi_v2.Document, error) { + data, err := d.restClient.Get().AbsPath("/openapi/v2").SetHeader("Accept", openAPIV2mimePb).Do(ctx).Raw() if err != nil { return nil, err } @@ -690,20 +1190,40 @@ func (d *DiscoveryClient) OpenAPISchema() (*openapi_v2.Document, error) { return document, nil } +// OpenAPIV3WithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use OpenAPIV3WithContext instead. func (d *DiscoveryClient) OpenAPIV3() openapi.Client { return openapi.NewClient(d.restClient) } +func (d *DiscoveryClient) OpenAPIV3WithContext(ctx context.Context) openapi.ClientWithContext { + return openapi.NewClientWithContext(d.restClient) +} + // WithLegacy returns copy of current discovery client that will only // receive the legacy discovery format. +// +// WithLegacyWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use WithLegacyWithContext instead. func (d *DiscoveryClient) WithLegacy() DiscoveryInterface { client := *d client.UseLegacyDiscovery = true return &client } +// WithLegacyWithContext returns copy of current discovery client that will only +// receive the legacy discovery format. +func (d *DiscoveryClient) WithLegacyWithContext(ctx context.Context) DiscoveryInterfaceWithContext { + client := *d + client.UseLegacyDiscovery = true + return &client +} + // withRetries retries the given recovery function in case the groups supported by the server change after ServerGroup() returns. -func withRetries(maxRetries int, f func() ([]*metav1.APIGroup, []*metav1.APIResourceList, error)) ([]*metav1.APIGroup, []*metav1.APIResourceList, error) { +// It retries only if the context isn't canceled. +func withRetries(ctx context.Context, maxRetries int, f func() ([]*metav1.APIGroup, []*metav1.APIResourceList, error)) ([]*metav1.APIGroup, []*metav1.APIResourceList, error) { var result []*metav1.APIResourceList var resultGroups []*metav1.APIGroup var err error @@ -715,6 +1235,10 @@ func withRetries(maxRetries int, f func() ([]*metav1.APIGroup, []*metav1.APIReso if _, ok := err.(*ErrGroupDiscoveryFailed); !ok { return nil, nil, err } + if ctx.Err() != nil { + // Give up retrying because of context cancellation and propagate the error returned by f. + return nil, nil, err + } } return resultGroups, result, err } diff --git a/vendor/k8s.io/client-go/discovery/fake/discovery.go b/vendor/k8s.io/client-go/discovery/fake/discovery.go index e5d9e7f800..02b2416e1f 100644 --- a/vendor/k8s.io/client-go/discovery/fake/discovery.go +++ b/vendor/k8s.io/client-go/discovery/fake/discovery.go @@ -17,6 +17,7 @@ limitations under the License. package fake import ( + "context" "fmt" "net/http" @@ -33,16 +34,33 @@ import ( "k8s.io/client-go/testing" ) -// FakeDiscovery implements discovery.DiscoveryInterface and sometimes calls testing.Fake.Invoke with an action, +// FakeDiscovery implements discovery.DiscoveryInterface and discovery.DiscoveryInterfaceWithContext. +// It sometimes calls testing.Fake.Invoke with an action, // but doesn't respect the return value if any. There is a way to fake static values like ServerVersion by using the Faked... fields on the struct. type FakeDiscovery struct { *testing.Fake FakedServerVersion *version.Info } +var ( + //nolint:staticcheck // Intentionally using the old interface here. + _ discovery.DiscoveryInterface = &FakeDiscovery{} + _ discovery.DiscoveryInterfaceWithContext = &FakeDiscovery{} +) + // ServerResourcesForGroupVersion returns the supported resources for a group // and version. +// +// ServerResourcesForGroupVersionWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerResourcesForGroupVersionWithContext instead. func (c *FakeDiscovery) ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error) { + return c.ServerResourcesForGroupVersionWithContext(context.Background(), groupVersion) +} + +// ServerResourcesForGroupVersionWithContext returns the supported resources for a group +// and version. +func (c *FakeDiscovery) ServerResourcesForGroupVersionWithContext(ctx context.Context, groupVersion string) (*metav1.APIResourceList, error) { action := testing.ActionImpl{ Verb: "get", Resource: schema.GroupVersionResource{Resource: "resource"}, @@ -65,8 +83,17 @@ func (c *FakeDiscovery) ServerResourcesForGroupVersion(groupVersion string) (*me } // ServerGroupsAndResources returns the supported groups and resources for all groups and versions. +// +// ServerGroupsAndResourcesWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerGroupsAndResourcesWithContext instead. func (c *FakeDiscovery) ServerGroupsAndResources() ([]*metav1.APIGroup, []*metav1.APIResourceList, error) { - sgs, err := c.ServerGroups() + return c.ServerGroupsAndResourcesWithContext(context.Background()) +} + +// ServerGroupsAndResourcesWithContext returns the supported groups and resources for all groups and versions. +func (c *FakeDiscovery) ServerGroupsAndResourcesWithContext(ctx context.Context) ([]*metav1.APIGroup, []*metav1.APIResourceList, error) { + sgs, err := c.ServerGroupsWithContext(ctx) if err != nil { return nil, nil, err } @@ -87,19 +114,49 @@ func (c *FakeDiscovery) ServerGroupsAndResources() ([]*metav1.APIGroup, []*metav // ServerPreferredResources returns the supported resources with the version // preferred by the server. +// +// ServerPreferredResourcesWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerPreferredResourcesWithContext instead. func (c *FakeDiscovery) ServerPreferredResources() ([]*metav1.APIResourceList, error) { + return c.ServerPreferredResourcesWithContext(context.Background()) +} + +// ServerPreferredResourcesWithContext returns the supported resources with the version +// preferred by the server. +func (c *FakeDiscovery) ServerPreferredResourcesWithContext(ctx context.Context) ([]*metav1.APIResourceList, error) { return nil, nil } // ServerPreferredNamespacedResources returns the supported namespaced resources // with the version preferred by the server. +// +// ServerPreferredNamespacedResourcesWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerPreferredNamespacedResourcesWithContext instead. func (c *FakeDiscovery) ServerPreferredNamespacedResources() ([]*metav1.APIResourceList, error) { + return c.ServerPreferredNamespacedResourcesWithContext(context.Background()) +} + +// ServerPreferredNamespacedResourcesWithContext returns the supported namespaced resources +// with the version preferred by the server. +func (c *FakeDiscovery) ServerPreferredNamespacedResourcesWithContext(ctx context.Context) ([]*metav1.APIResourceList, error) { return nil, nil } // ServerGroups returns the supported groups, with information like supported // versions and the preferred version. +// +// ServerGroupsWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerGroupsWithContext instead. func (c *FakeDiscovery) ServerGroups() (*metav1.APIGroupList, error) { + return c.ServerGroupsWithContext(context.Background()) +} + +// ServerGroupsWithContext returns the supported groups, with information like supported +// versions and the preferred version. +func (c *FakeDiscovery) ServerGroupsWithContext(ctx context.Context) (*metav1.APIGroupList, error) { action := testing.ActionImpl{ Verb: "get", Resource: schema.GroupVersionResource{Resource: "group"}, @@ -143,7 +200,16 @@ func (c *FakeDiscovery) ServerGroups() (*metav1.APIGroupList, error) { } // ServerVersion retrieves and parses the server's version. +// +// ServerVersionWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ServerVersionWithContext instead. func (c *FakeDiscovery) ServerVersion() (*version.Info, error) { + return c.ServerVersionWithContext(context.Background()) +} + +// ServerVersionWithContext retrieves and parses the server's version. +func (c *FakeDiscovery) ServerVersionWithContext(ctx context.Context) (*version.Info, error) { action := testing.ActionImpl{} action.Verb = "get" action.Resource = schema.GroupVersionResource{Resource: "version"} @@ -161,20 +227,43 @@ func (c *FakeDiscovery) ServerVersion() (*version.Info, error) { } // OpenAPISchema retrieves and parses the swagger API schema the server supports. +// +// OpenAPISchemaWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use OpenAPISchemaWithContext instead. func (c *FakeDiscovery) OpenAPISchema() (*openapi_v2.Document, error) { + return c.OpenAPISchemaWithContext(context.Background()) +} + +// OpenAPISchemaWithContext retrieves and parses the swagger API schema the server supports. +func (c *FakeDiscovery) OpenAPISchemaWithContext(ctx context.Context) (*openapi_v2.Document, error) { return &openapi_v2.Document{}, nil } +// OpenAPIV3WithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use OpenAPIV3WithContext instead. func (c *FakeDiscovery) OpenAPIV3() openapi.Client { panic("unimplemented") } +func (c *FakeDiscovery) OpenAPIV3WithContext(ctx context.Context) openapi.ClientWithContext { + panic("unimplemented") +} + // RESTClient returns a RESTClient that is used to communicate with API server // by this client implementation. func (c *FakeDiscovery) RESTClient() restclient.Interface { return nil } +// WithLegacyWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use WithLegacyWithContext instead. func (c *FakeDiscovery) WithLegacy() discovery.DiscoveryInterface { panic("unimplemented") } + +func (c *FakeDiscovery) WithLegacyWithContext(ctx context.Context) discovery.DiscoveryInterfaceWithContext { + panic("unimplemented") +} diff --git a/vendor/k8s.io/client-go/discovery/helper.go b/vendor/k8s.io/client-go/discovery/helper.go index e79f073b03..a58bae284a 100644 --- a/vendor/k8s.io/client-go/discovery/helper.go +++ b/vendor/k8s.io/client-go/discovery/helper.go @@ -71,7 +71,7 @@ func ServerSupportsVersion(client DiscoveryInterface, requiredGV schema.GroupVer return err } versions := metav1.ExtractGroupVersions(groups) - serverVersions := sets.String{} + serverVersions := sets.Set[string]{} for _, v := range versions { serverVersions.Insert(v) } diff --git a/vendor/k8s.io/client-go/dynamic/simple.go b/vendor/k8s.io/client-go/dynamic/simple.go index 2532329d05..add5b13777 100644 --- a/vendor/k8s.io/client-go/dynamic/simple.go +++ b/vendor/k8s.io/client-go/dynamic/simple.go @@ -19,6 +19,8 @@ package dynamic import ( "context" "fmt" + "net/http" + "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -28,7 +30,6 @@ import ( "k8s.io/client-go/features" "k8s.io/client-go/rest" "k8s.io/client-go/util/apply" - "net/http" ) type DynamicClient struct { diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/interface.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/interface.go index 4bfe9c4c6e..8e643aa185 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1/interface.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/interface.go @@ -25,17 +25,17 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // MutatingAdmissionPolicies returns a MutatingAdmissionPolicyInformer. - MutatingAdmissionPolicies() MutatingAdmissionPolicyInformer + MutatingAdmissionPolicies() TypedMutatingAdmissionPolicyInformer // MutatingAdmissionPolicyBindings returns a MutatingAdmissionPolicyBindingInformer. - MutatingAdmissionPolicyBindings() MutatingAdmissionPolicyBindingInformer + MutatingAdmissionPolicyBindings() TypedMutatingAdmissionPolicyBindingInformer // MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer. - MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer + MutatingWebhookConfigurations() TypedMutatingWebhookConfigurationInformer // ValidatingAdmissionPolicies returns a ValidatingAdmissionPolicyInformer. - ValidatingAdmissionPolicies() ValidatingAdmissionPolicyInformer + ValidatingAdmissionPolicies() TypedValidatingAdmissionPolicyInformer // ValidatingAdmissionPolicyBindings returns a ValidatingAdmissionPolicyBindingInformer. - ValidatingAdmissionPolicyBindings() ValidatingAdmissionPolicyBindingInformer + ValidatingAdmissionPolicyBindings() TypedValidatingAdmissionPolicyBindingInformer // ValidatingWebhookConfigurations returns a ValidatingWebhookConfigurationInformer. - ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInformer + ValidatingWebhookConfigurations() TypedValidatingWebhookConfigurationInformer } type version struct { @@ -49,32 +49,32 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// MutatingAdmissionPolicies returns a MutatingAdmissionPolicyInformer. -func (v *version) MutatingAdmissionPolicies() MutatingAdmissionPolicyInformer { +// MutatingAdmissionPolicies returns a TypedMutatingAdmissionPolicyInformer. +func (v *version) MutatingAdmissionPolicies() TypedMutatingAdmissionPolicyInformer { return &mutatingAdmissionPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// MutatingAdmissionPolicyBindings returns a MutatingAdmissionPolicyBindingInformer. -func (v *version) MutatingAdmissionPolicyBindings() MutatingAdmissionPolicyBindingInformer { +// MutatingAdmissionPolicyBindings returns a TypedMutatingAdmissionPolicyBindingInformer. +func (v *version) MutatingAdmissionPolicyBindings() TypedMutatingAdmissionPolicyBindingInformer { return &mutatingAdmissionPolicyBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer. -func (v *version) MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer { +// MutatingWebhookConfigurations returns a TypedMutatingWebhookConfigurationInformer. +func (v *version) MutatingWebhookConfigurations() TypedMutatingWebhookConfigurationInformer { return &mutatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// ValidatingAdmissionPolicies returns a ValidatingAdmissionPolicyInformer. -func (v *version) ValidatingAdmissionPolicies() ValidatingAdmissionPolicyInformer { +// ValidatingAdmissionPolicies returns a TypedValidatingAdmissionPolicyInformer. +func (v *version) ValidatingAdmissionPolicies() TypedValidatingAdmissionPolicyInformer { return &validatingAdmissionPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// ValidatingAdmissionPolicyBindings returns a ValidatingAdmissionPolicyBindingInformer. -func (v *version) ValidatingAdmissionPolicyBindings() ValidatingAdmissionPolicyBindingInformer { +// ValidatingAdmissionPolicyBindings returns a TypedValidatingAdmissionPolicyBindingInformer. +func (v *version) ValidatingAdmissionPolicyBindings() TypedValidatingAdmissionPolicyBindingInformer { return &validatingAdmissionPolicyBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// ValidatingWebhookConfigurations returns a ValidatingWebhookConfigurationInformer. -func (v *version) ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInformer { +// ValidatingWebhookConfigurations returns a TypedValidatingWebhookConfigurationInformer. +func (v *version) ValidatingWebhookConfigurations() TypedValidatingWebhookConfigurationInformer { return &validatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingadmissionpolicy.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingadmissionpolicy.go index 65df1905a5..8dbb9e8e44 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingadmissionpolicy.go @@ -34,12 +34,40 @@ import ( ) // MutatingAdmissionPolicyInformer provides access to a shared informer and lister for -// MutatingAdmissionPolicies. +// MutatingAdmissionPolicies. Prefer using the type-safe variant (see [TypedMutatingAdmissionPolicyInformer]). type MutatingAdmissionPolicyInformer interface { Informer() cache.SharedIndexInformer Lister() admissionregistrationv1.MutatingAdmissionPolicyLister } +// TypedMutatingAdmissionPolicyInformer provides access to a shared informer and lister for +// MutatingAdmissionPolicies, including the type-safe TypedInformer variant. +// It is a superset of MutatingAdmissionPolicyInformer. +type TypedMutatingAdmissionPolicyInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() MutatingAdmissionPolicyIndexInformer + Lister() admissionregistrationv1.MutatingAdmissionPolicyLister +} + +// MutatingAdmissionPolicyIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type MutatingAdmissionPolicyIndexInformer cache.TypedSharedIndexInformer[*apiadmissionregistrationv1.MutatingAdmissionPolicy] + +// MutatingAdmissionPolicyHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for MutatingAdmissionPolicy. +type MutatingAdmissionPolicyHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiadmissionregistrationv1.MutatingAdmissionPolicy] + +// MutatingAdmissionPolicyDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for MutatingAdmissionPolicy. +type MutatingAdmissionPolicyDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiadmissionregistrationv1.MutatingAdmissionPolicy] + +// MutatingAdmissionPolicyFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for MutatingAdmissionPolicy. +type MutatingAdmissionPolicyFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiadmissionregistrationv1.MutatingAdmissionPolicy] + +// MutatingAdmissionPolicyIndexers is a specialization of [cache.TypedIndexers] for MutatingAdmissionPolicy. +type MutatingAdmissionPolicyIndexers = cache.TypedIndexers[*apiadmissionregistrationv1.MutatingAdmissionPolicy] + +// DeletedMutatingAdmissionPolicy is a specialization of [cache.DeletedObject] for MutatingAdmissionPolicy. +type DeletedMutatingAdmissionPolicy = cache.DeletedObject[*apiadmissionregistrationv1.MutatingAdmissionPolicy] + type mutatingAdmissionPolicyInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type mutatingAdmissionPolicyInformer struct { // NewMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedMutatingAdmissionPolicyInformer]). func NewMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers MutatingAdmissionPolicyIndexers) MutatingAdmissionPolicyIndexInformer { + return NewTypedMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredMutatingAdmissionPolicyInformer]). func NewFilteredMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers MutatingAdmissionPolicyIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) MutatingAdmissionPolicyIndexInformer { + return NewTypedMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewMutatingAdmissionPolicyInformerWithOptions constructs a new informer for MutatingAdmissionPolicy type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedMutatingAdmissionPolicyInformerWithOptions]). func NewMutatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedMutatingAdmissionPolicyInformerWithOptions(client, options) +} + +// NewTypedMutatingAdmissionPolicyInformerWithOptions constructs a new informer for MutatingAdmissionPolicy type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedMutatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) MutatingAdmissionPolicyIndexInformer { gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1", Resource: "mutatingadmissionpolicys"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.MutatingAdmissionPolicy](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewMutatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *mutatingAdmissionPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *mutatingAdmissionPolicyInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiadmissionregistrationv1.MutatingAdmissionPolicy{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *mutatingAdmissionPolicyInformer) TypedInformer() MutatingAdmissionPolicyIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.MutatingAdmissionPolicy](f.factory.InformerFor(&apiadmissionregistrationv1.MutatingAdmissionPolicy{}, f.defaultInformer)) } func (f *mutatingAdmissionPolicyInformer) Lister() admissionregistrationv1.MutatingAdmissionPolicyLister { return admissionregistrationv1.NewMutatingAdmissionPolicyLister(f.Informer().GetIndexer()) } + +// ToTypedMutatingAdmissionPolicyInformer converts an untyped informer into a TypedMutatingAdmissionPolicyInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *MutatingAdmissionPolicy. If that is not the case, calling type-safe methods of the returned +// TypedMutatingAdmissionPolicyInformer leads to runtime panics. A safer alternative is to pass +// around a TypedMutatingAdmissionPolicyInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedMutatingAdmissionPolicyInformer(informer MutatingAdmissionPolicyInformer) TypedMutatingAdmissionPolicyInformer { + if informer, ok := informer.(TypedMutatingAdmissionPolicyInformer); ok { + return informer + } + return &mutatingAdmissionPolicyTypedInformerAdapter{informer} +} + +type mutatingAdmissionPolicyTypedInformerAdapter struct { + MutatingAdmissionPolicyInformer +} + +func (a *mutatingAdmissionPolicyTypedInformerAdapter) TypedInformer() MutatingAdmissionPolicyIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.MutatingAdmissionPolicy](a.Informer()) +} + +// ToMutatingAdmissionPolicyIndexInformer converts an untyped informer into a MutatingAdmissionPolicyIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *MutatingAdmissionPolicy. If that is not the case, calling type-safe methods of the returned +// MutatingAdmissionPolicyIndexInformer leads to runtime panics. A safer alternative is to pass +// around a MutatingAdmissionPolicyIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToMutatingAdmissionPolicyIndexInformer(informer cache.SharedIndexInformer) MutatingAdmissionPolicyIndexInformer { + if informer, ok := informer.(MutatingAdmissionPolicyIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.MutatingAdmissionPolicy](informer) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingadmissionpolicybinding.go index d06ca0b4e1..11da9c840c 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingadmissionpolicybinding.go @@ -34,12 +34,40 @@ import ( ) // MutatingAdmissionPolicyBindingInformer provides access to a shared informer and lister for -// MutatingAdmissionPolicyBindings. +// MutatingAdmissionPolicyBindings. Prefer using the type-safe variant (see [TypedMutatingAdmissionPolicyBindingInformer]). type MutatingAdmissionPolicyBindingInformer interface { Informer() cache.SharedIndexInformer Lister() admissionregistrationv1.MutatingAdmissionPolicyBindingLister } +// TypedMutatingAdmissionPolicyBindingInformer provides access to a shared informer and lister for +// MutatingAdmissionPolicyBindings, including the type-safe TypedInformer variant. +// It is a superset of MutatingAdmissionPolicyBindingInformer. +type TypedMutatingAdmissionPolicyBindingInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() MutatingAdmissionPolicyBindingIndexInformer + Lister() admissionregistrationv1.MutatingAdmissionPolicyBindingLister +} + +// MutatingAdmissionPolicyBindingIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type MutatingAdmissionPolicyBindingIndexInformer cache.TypedSharedIndexInformer[*apiadmissionregistrationv1.MutatingAdmissionPolicyBinding] + +// MutatingAdmissionPolicyBindingHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for MutatingAdmissionPolicyBinding. +type MutatingAdmissionPolicyBindingHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiadmissionregistrationv1.MutatingAdmissionPolicyBinding] + +// MutatingAdmissionPolicyBindingDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for MutatingAdmissionPolicyBinding. +type MutatingAdmissionPolicyBindingDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiadmissionregistrationv1.MutatingAdmissionPolicyBinding] + +// MutatingAdmissionPolicyBindingFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for MutatingAdmissionPolicyBinding. +type MutatingAdmissionPolicyBindingFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiadmissionregistrationv1.MutatingAdmissionPolicyBinding] + +// MutatingAdmissionPolicyBindingIndexers is a specialization of [cache.TypedIndexers] for MutatingAdmissionPolicyBinding. +type MutatingAdmissionPolicyBindingIndexers = cache.TypedIndexers[*apiadmissionregistrationv1.MutatingAdmissionPolicyBinding] + +// DeletedMutatingAdmissionPolicyBinding is a specialization of [cache.DeletedObject] for MutatingAdmissionPolicyBinding. +type DeletedMutatingAdmissionPolicyBinding = cache.DeletedObject[*apiadmissionregistrationv1.MutatingAdmissionPolicyBinding] + type mutatingAdmissionPolicyBindingInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type mutatingAdmissionPolicyBindingInformer struct { // NewMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedMutatingAdmissionPolicyBindingInformer]). func NewMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers MutatingAdmissionPolicyBindingIndexers) MutatingAdmissionPolicyBindingIndexInformer { + return NewTypedMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredMutatingAdmissionPolicyBindingInformer]). func NewFilteredMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers MutatingAdmissionPolicyBindingIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) MutatingAdmissionPolicyBindingIndexInformer { + return NewTypedMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewMutatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for MutatingAdmissionPolicyBinding type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedMutatingAdmissionPolicyBindingInformerWithOptions]). func NewMutatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedMutatingAdmissionPolicyBindingInformerWithOptions(client, options) +} + +// NewTypedMutatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for MutatingAdmissionPolicyBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedMutatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) MutatingAdmissionPolicyBindingIndexInformer { gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1", Resource: "mutatingadmissionpolicybindings"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.MutatingAdmissionPolicyBinding](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewMutatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Inte Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *mutatingAdmissionPolicyBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *mutatingAdmissionPolicyBindingInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiadmissionregistrationv1.MutatingAdmissionPolicyBinding{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *mutatingAdmissionPolicyBindingInformer) TypedInformer() MutatingAdmissionPolicyBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.MutatingAdmissionPolicyBinding](f.factory.InformerFor(&apiadmissionregistrationv1.MutatingAdmissionPolicyBinding{}, f.defaultInformer)) } func (f *mutatingAdmissionPolicyBindingInformer) Lister() admissionregistrationv1.MutatingAdmissionPolicyBindingLister { return admissionregistrationv1.NewMutatingAdmissionPolicyBindingLister(f.Informer().GetIndexer()) } + +// ToTypedMutatingAdmissionPolicyBindingInformer converts an untyped informer into a TypedMutatingAdmissionPolicyBindingInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *MutatingAdmissionPolicyBinding. If that is not the case, calling type-safe methods of the returned +// TypedMutatingAdmissionPolicyBindingInformer leads to runtime panics. A safer alternative is to pass +// around a TypedMutatingAdmissionPolicyBindingInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedMutatingAdmissionPolicyBindingInformer(informer MutatingAdmissionPolicyBindingInformer) TypedMutatingAdmissionPolicyBindingInformer { + if informer, ok := informer.(TypedMutatingAdmissionPolicyBindingInformer); ok { + return informer + } + return &mutatingAdmissionPolicyBindingTypedInformerAdapter{informer} +} + +type mutatingAdmissionPolicyBindingTypedInformerAdapter struct { + MutatingAdmissionPolicyBindingInformer +} + +func (a *mutatingAdmissionPolicyBindingTypedInformerAdapter) TypedInformer() MutatingAdmissionPolicyBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.MutatingAdmissionPolicyBinding](a.Informer()) +} + +// ToMutatingAdmissionPolicyBindingIndexInformer converts an untyped informer into a MutatingAdmissionPolicyBindingIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *MutatingAdmissionPolicyBinding. If that is not the case, calling type-safe methods of the returned +// MutatingAdmissionPolicyBindingIndexInformer leads to runtime panics. A safer alternative is to pass +// around a MutatingAdmissionPolicyBindingIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToMutatingAdmissionPolicyBindingIndexInformer(informer cache.SharedIndexInformer) MutatingAdmissionPolicyBindingIndexInformer { + if informer, ok := informer.(MutatingAdmissionPolicyBindingIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.MutatingAdmissionPolicyBinding](informer) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go index d7c48e78a6..32f005c250 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go @@ -34,12 +34,40 @@ import ( ) // MutatingWebhookConfigurationInformer provides access to a shared informer and lister for -// MutatingWebhookConfigurations. +// MutatingWebhookConfigurations. Prefer using the type-safe variant (see [TypedMutatingWebhookConfigurationInformer]). type MutatingWebhookConfigurationInformer interface { Informer() cache.SharedIndexInformer Lister() admissionregistrationv1.MutatingWebhookConfigurationLister } +// TypedMutatingWebhookConfigurationInformer provides access to a shared informer and lister for +// MutatingWebhookConfigurations, including the type-safe TypedInformer variant. +// It is a superset of MutatingWebhookConfigurationInformer. +type TypedMutatingWebhookConfigurationInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() MutatingWebhookConfigurationIndexInformer + Lister() admissionregistrationv1.MutatingWebhookConfigurationLister +} + +// MutatingWebhookConfigurationIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type MutatingWebhookConfigurationIndexInformer cache.TypedSharedIndexInformer[*apiadmissionregistrationv1.MutatingWebhookConfiguration] + +// MutatingWebhookConfigurationHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for MutatingWebhookConfiguration. +type MutatingWebhookConfigurationHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiadmissionregistrationv1.MutatingWebhookConfiguration] + +// MutatingWebhookConfigurationDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for MutatingWebhookConfiguration. +type MutatingWebhookConfigurationDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiadmissionregistrationv1.MutatingWebhookConfiguration] + +// MutatingWebhookConfigurationFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for MutatingWebhookConfiguration. +type MutatingWebhookConfigurationFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiadmissionregistrationv1.MutatingWebhookConfiguration] + +// MutatingWebhookConfigurationIndexers is a specialization of [cache.TypedIndexers] for MutatingWebhookConfiguration. +type MutatingWebhookConfigurationIndexers = cache.TypedIndexers[*apiadmissionregistrationv1.MutatingWebhookConfiguration] + +// DeletedMutatingWebhookConfiguration is a specialization of [cache.DeletedObject] for MutatingWebhookConfiguration. +type DeletedMutatingWebhookConfiguration = cache.DeletedObject[*apiadmissionregistrationv1.MutatingWebhookConfiguration] + type mutatingWebhookConfigurationInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type mutatingWebhookConfigurationInformer struct { // NewMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedMutatingWebhookConfigurationInformer]). func NewMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers MutatingWebhookConfigurationIndexers) MutatingWebhookConfigurationIndexInformer { + return NewTypedMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredMutatingWebhookConfigurationInformer]). func NewFilteredMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers MutatingWebhookConfigurationIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) MutatingWebhookConfigurationIndexInformer { + return NewTypedMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewMutatingWebhookConfigurationInformerWithOptions constructs a new informer for MutatingWebhookConfiguration type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedMutatingWebhookConfigurationInformerWithOptions]). func NewMutatingWebhookConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedMutatingWebhookConfigurationInformerWithOptions(client, options) +} + +// NewTypedMutatingWebhookConfigurationInformerWithOptions constructs a new informer for MutatingWebhookConfiguration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedMutatingWebhookConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) MutatingWebhookConfigurationIndexInformer { gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1", Resource: "mutatingwebhookconfigurations"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.MutatingWebhookConfiguration](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewMutatingWebhookConfigurationInformerWithOptions(client kubernetes.Interf Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *mutatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *mutatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiadmissionregistrationv1.MutatingWebhookConfiguration{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *mutatingWebhookConfigurationInformer) TypedInformer() MutatingWebhookConfigurationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.MutatingWebhookConfiguration](f.factory.InformerFor(&apiadmissionregistrationv1.MutatingWebhookConfiguration{}, f.defaultInformer)) } func (f *mutatingWebhookConfigurationInformer) Lister() admissionregistrationv1.MutatingWebhookConfigurationLister { return admissionregistrationv1.NewMutatingWebhookConfigurationLister(f.Informer().GetIndexer()) } + +// ToTypedMutatingWebhookConfigurationInformer converts an untyped informer into a TypedMutatingWebhookConfigurationInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *MutatingWebhookConfiguration. If that is not the case, calling type-safe methods of the returned +// TypedMutatingWebhookConfigurationInformer leads to runtime panics. A safer alternative is to pass +// around a TypedMutatingWebhookConfigurationInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedMutatingWebhookConfigurationInformer(informer MutatingWebhookConfigurationInformer) TypedMutatingWebhookConfigurationInformer { + if informer, ok := informer.(TypedMutatingWebhookConfigurationInformer); ok { + return informer + } + return &mutatingWebhookConfigurationTypedInformerAdapter{informer} +} + +type mutatingWebhookConfigurationTypedInformerAdapter struct { + MutatingWebhookConfigurationInformer +} + +func (a *mutatingWebhookConfigurationTypedInformerAdapter) TypedInformer() MutatingWebhookConfigurationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.MutatingWebhookConfiguration](a.Informer()) +} + +// ToMutatingWebhookConfigurationIndexInformer converts an untyped informer into a MutatingWebhookConfigurationIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *MutatingWebhookConfiguration. If that is not the case, calling type-safe methods of the returned +// MutatingWebhookConfigurationIndexInformer leads to runtime panics. A safer alternative is to pass +// around a MutatingWebhookConfigurationIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToMutatingWebhookConfigurationIndexInformer(informer cache.SharedIndexInformer) MutatingWebhookConfigurationIndexInformer { + if informer, ok := informer.(MutatingWebhookConfigurationIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.MutatingWebhookConfiguration](informer) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingadmissionpolicy.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingadmissionpolicy.go index bdc5c0b28a..84017947a7 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingadmissionpolicy.go @@ -34,12 +34,40 @@ import ( ) // ValidatingAdmissionPolicyInformer provides access to a shared informer and lister for -// ValidatingAdmissionPolicies. +// ValidatingAdmissionPolicies. Prefer using the type-safe variant (see [TypedValidatingAdmissionPolicyInformer]). type ValidatingAdmissionPolicyInformer interface { Informer() cache.SharedIndexInformer Lister() admissionregistrationv1.ValidatingAdmissionPolicyLister } +// TypedValidatingAdmissionPolicyInformer provides access to a shared informer and lister for +// ValidatingAdmissionPolicies, including the type-safe TypedInformer variant. +// It is a superset of ValidatingAdmissionPolicyInformer. +type TypedValidatingAdmissionPolicyInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ValidatingAdmissionPolicyIndexInformer + Lister() admissionregistrationv1.ValidatingAdmissionPolicyLister +} + +// ValidatingAdmissionPolicyIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ValidatingAdmissionPolicyIndexInformer cache.TypedSharedIndexInformer[*apiadmissionregistrationv1.ValidatingAdmissionPolicy] + +// ValidatingAdmissionPolicyHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ValidatingAdmissionPolicy. +type ValidatingAdmissionPolicyHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiadmissionregistrationv1.ValidatingAdmissionPolicy] + +// ValidatingAdmissionPolicyDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ValidatingAdmissionPolicy. +type ValidatingAdmissionPolicyDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiadmissionregistrationv1.ValidatingAdmissionPolicy] + +// ValidatingAdmissionPolicyFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ValidatingAdmissionPolicy. +type ValidatingAdmissionPolicyFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiadmissionregistrationv1.ValidatingAdmissionPolicy] + +// ValidatingAdmissionPolicyIndexers is a specialization of [cache.TypedIndexers] for ValidatingAdmissionPolicy. +type ValidatingAdmissionPolicyIndexers = cache.TypedIndexers[*apiadmissionregistrationv1.ValidatingAdmissionPolicy] + +// DeletedValidatingAdmissionPolicy is a specialization of [cache.DeletedObject] for ValidatingAdmissionPolicy. +type DeletedValidatingAdmissionPolicy = cache.DeletedObject[*apiadmissionregistrationv1.ValidatingAdmissionPolicy] + type validatingAdmissionPolicyInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type validatingAdmissionPolicyInformer struct { // NewValidatingAdmissionPolicyInformer constructs a new informer for ValidatingAdmissionPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedValidatingAdmissionPolicyInformer]). func NewValidatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedValidatingAdmissionPolicyInformer constructs a new informer for ValidatingAdmissionPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedValidatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ValidatingAdmissionPolicyIndexers) ValidatingAdmissionPolicyIndexInformer { + return NewTypedValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredValidatingAdmissionPolicyInformer constructs a new informer for ValidatingAdmissionPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredValidatingAdmissionPolicyInformer]). func NewFilteredValidatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredValidatingAdmissionPolicyInformer constructs a new informer for ValidatingAdmissionPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredValidatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ValidatingAdmissionPolicyIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ValidatingAdmissionPolicyIndexInformer { + return NewTypedValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewValidatingAdmissionPolicyInformerWithOptions constructs a new informer for ValidatingAdmissionPolicy type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedValidatingAdmissionPolicyInformerWithOptions]). func NewValidatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedValidatingAdmissionPolicyInformerWithOptions(client, options) +} + +// NewTypedValidatingAdmissionPolicyInformerWithOptions constructs a new informer for ValidatingAdmissionPolicy type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedValidatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ValidatingAdmissionPolicyIndexInformer { gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1", Resource: "validatingadmissionpolicys"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.ValidatingAdmissionPolicy](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewValidatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *validatingAdmissionPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *validatingAdmissionPolicyInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiadmissionregistrationv1.ValidatingAdmissionPolicy{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *validatingAdmissionPolicyInformer) TypedInformer() ValidatingAdmissionPolicyIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.ValidatingAdmissionPolicy](f.factory.InformerFor(&apiadmissionregistrationv1.ValidatingAdmissionPolicy{}, f.defaultInformer)) } func (f *validatingAdmissionPolicyInformer) Lister() admissionregistrationv1.ValidatingAdmissionPolicyLister { return admissionregistrationv1.NewValidatingAdmissionPolicyLister(f.Informer().GetIndexer()) } + +// ToTypedValidatingAdmissionPolicyInformer converts an untyped informer into a TypedValidatingAdmissionPolicyInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ValidatingAdmissionPolicy. If that is not the case, calling type-safe methods of the returned +// TypedValidatingAdmissionPolicyInformer leads to runtime panics. A safer alternative is to pass +// around a TypedValidatingAdmissionPolicyInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedValidatingAdmissionPolicyInformer(informer ValidatingAdmissionPolicyInformer) TypedValidatingAdmissionPolicyInformer { + if informer, ok := informer.(TypedValidatingAdmissionPolicyInformer); ok { + return informer + } + return &validatingAdmissionPolicyTypedInformerAdapter{informer} +} + +type validatingAdmissionPolicyTypedInformerAdapter struct { + ValidatingAdmissionPolicyInformer +} + +func (a *validatingAdmissionPolicyTypedInformerAdapter) TypedInformer() ValidatingAdmissionPolicyIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.ValidatingAdmissionPolicy](a.Informer()) +} + +// ToValidatingAdmissionPolicyIndexInformer converts an untyped informer into a ValidatingAdmissionPolicyIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ValidatingAdmissionPolicy. If that is not the case, calling type-safe methods of the returned +// ValidatingAdmissionPolicyIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ValidatingAdmissionPolicyIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToValidatingAdmissionPolicyIndexInformer(informer cache.SharedIndexInformer) ValidatingAdmissionPolicyIndexInformer { + if informer, ok := informer.(ValidatingAdmissionPolicyIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.ValidatingAdmissionPolicy](informer) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingadmissionpolicybinding.go index 1ecf9703a9..d79eaf5411 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingadmissionpolicybinding.go @@ -34,12 +34,40 @@ import ( ) // ValidatingAdmissionPolicyBindingInformer provides access to a shared informer and lister for -// ValidatingAdmissionPolicyBindings. +// ValidatingAdmissionPolicyBindings. Prefer using the type-safe variant (see [TypedValidatingAdmissionPolicyBindingInformer]). type ValidatingAdmissionPolicyBindingInformer interface { Informer() cache.SharedIndexInformer Lister() admissionregistrationv1.ValidatingAdmissionPolicyBindingLister } +// TypedValidatingAdmissionPolicyBindingInformer provides access to a shared informer and lister for +// ValidatingAdmissionPolicyBindings, including the type-safe TypedInformer variant. +// It is a superset of ValidatingAdmissionPolicyBindingInformer. +type TypedValidatingAdmissionPolicyBindingInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ValidatingAdmissionPolicyBindingIndexInformer + Lister() admissionregistrationv1.ValidatingAdmissionPolicyBindingLister +} + +// ValidatingAdmissionPolicyBindingIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ValidatingAdmissionPolicyBindingIndexInformer cache.TypedSharedIndexInformer[*apiadmissionregistrationv1.ValidatingAdmissionPolicyBinding] + +// ValidatingAdmissionPolicyBindingHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ValidatingAdmissionPolicyBinding. +type ValidatingAdmissionPolicyBindingHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiadmissionregistrationv1.ValidatingAdmissionPolicyBinding] + +// ValidatingAdmissionPolicyBindingDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ValidatingAdmissionPolicyBinding. +type ValidatingAdmissionPolicyBindingDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiadmissionregistrationv1.ValidatingAdmissionPolicyBinding] + +// ValidatingAdmissionPolicyBindingFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ValidatingAdmissionPolicyBinding. +type ValidatingAdmissionPolicyBindingFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiadmissionregistrationv1.ValidatingAdmissionPolicyBinding] + +// ValidatingAdmissionPolicyBindingIndexers is a specialization of [cache.TypedIndexers] for ValidatingAdmissionPolicyBinding. +type ValidatingAdmissionPolicyBindingIndexers = cache.TypedIndexers[*apiadmissionregistrationv1.ValidatingAdmissionPolicyBinding] + +// DeletedValidatingAdmissionPolicyBinding is a specialization of [cache.DeletedObject] for ValidatingAdmissionPolicyBinding. +type DeletedValidatingAdmissionPolicyBinding = cache.DeletedObject[*apiadmissionregistrationv1.ValidatingAdmissionPolicyBinding] + type validatingAdmissionPolicyBindingInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type validatingAdmissionPolicyBindingInformer struct { // NewValidatingAdmissionPolicyBindingInformer constructs a new informer for ValidatingAdmissionPolicyBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedValidatingAdmissionPolicyBindingInformer]). func NewValidatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedValidatingAdmissionPolicyBindingInformer constructs a new informer for ValidatingAdmissionPolicyBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedValidatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ValidatingAdmissionPolicyBindingIndexers) ValidatingAdmissionPolicyBindingIndexInformer { + return NewTypedValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredValidatingAdmissionPolicyBindingInformer constructs a new informer for ValidatingAdmissionPolicyBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredValidatingAdmissionPolicyBindingInformer]). func NewFilteredValidatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredValidatingAdmissionPolicyBindingInformer constructs a new informer for ValidatingAdmissionPolicyBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredValidatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ValidatingAdmissionPolicyBindingIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ValidatingAdmissionPolicyBindingIndexInformer { + return NewTypedValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewValidatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for ValidatingAdmissionPolicyBinding type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedValidatingAdmissionPolicyBindingInformerWithOptions]). func NewValidatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedValidatingAdmissionPolicyBindingInformerWithOptions(client, options) +} + +// NewTypedValidatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for ValidatingAdmissionPolicyBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedValidatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ValidatingAdmissionPolicyBindingIndexInformer { gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1", Resource: "validatingadmissionpolicybindings"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.ValidatingAdmissionPolicyBinding](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewValidatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.In Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *validatingAdmissionPolicyBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *validatingAdmissionPolicyBindingInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiadmissionregistrationv1.ValidatingAdmissionPolicyBinding{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *validatingAdmissionPolicyBindingInformer) TypedInformer() ValidatingAdmissionPolicyBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.ValidatingAdmissionPolicyBinding](f.factory.InformerFor(&apiadmissionregistrationv1.ValidatingAdmissionPolicyBinding{}, f.defaultInformer)) } func (f *validatingAdmissionPolicyBindingInformer) Lister() admissionregistrationv1.ValidatingAdmissionPolicyBindingLister { return admissionregistrationv1.NewValidatingAdmissionPolicyBindingLister(f.Informer().GetIndexer()) } + +// ToTypedValidatingAdmissionPolicyBindingInformer converts an untyped informer into a TypedValidatingAdmissionPolicyBindingInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ValidatingAdmissionPolicyBinding. If that is not the case, calling type-safe methods of the returned +// TypedValidatingAdmissionPolicyBindingInformer leads to runtime panics. A safer alternative is to pass +// around a TypedValidatingAdmissionPolicyBindingInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedValidatingAdmissionPolicyBindingInformer(informer ValidatingAdmissionPolicyBindingInformer) TypedValidatingAdmissionPolicyBindingInformer { + if informer, ok := informer.(TypedValidatingAdmissionPolicyBindingInformer); ok { + return informer + } + return &validatingAdmissionPolicyBindingTypedInformerAdapter{informer} +} + +type validatingAdmissionPolicyBindingTypedInformerAdapter struct { + ValidatingAdmissionPolicyBindingInformer +} + +func (a *validatingAdmissionPolicyBindingTypedInformerAdapter) TypedInformer() ValidatingAdmissionPolicyBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.ValidatingAdmissionPolicyBinding](a.Informer()) +} + +// ToValidatingAdmissionPolicyBindingIndexInformer converts an untyped informer into a ValidatingAdmissionPolicyBindingIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ValidatingAdmissionPolicyBinding. If that is not the case, calling type-safe methods of the returned +// ValidatingAdmissionPolicyBindingIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ValidatingAdmissionPolicyBindingIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToValidatingAdmissionPolicyBindingIndexInformer(informer cache.SharedIndexInformer) ValidatingAdmissionPolicyBindingIndexInformer { + if informer, ok := informer.(ValidatingAdmissionPolicyBindingIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.ValidatingAdmissionPolicyBinding](informer) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go index 07653c35ce..98ba6e012a 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go @@ -34,12 +34,40 @@ import ( ) // ValidatingWebhookConfigurationInformer provides access to a shared informer and lister for -// ValidatingWebhookConfigurations. +// ValidatingWebhookConfigurations. Prefer using the type-safe variant (see [TypedValidatingWebhookConfigurationInformer]). type ValidatingWebhookConfigurationInformer interface { Informer() cache.SharedIndexInformer Lister() admissionregistrationv1.ValidatingWebhookConfigurationLister } +// TypedValidatingWebhookConfigurationInformer provides access to a shared informer and lister for +// ValidatingWebhookConfigurations, including the type-safe TypedInformer variant. +// It is a superset of ValidatingWebhookConfigurationInformer. +type TypedValidatingWebhookConfigurationInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ValidatingWebhookConfigurationIndexInformer + Lister() admissionregistrationv1.ValidatingWebhookConfigurationLister +} + +// ValidatingWebhookConfigurationIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ValidatingWebhookConfigurationIndexInformer cache.TypedSharedIndexInformer[*apiadmissionregistrationv1.ValidatingWebhookConfiguration] + +// ValidatingWebhookConfigurationHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ValidatingWebhookConfiguration. +type ValidatingWebhookConfigurationHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiadmissionregistrationv1.ValidatingWebhookConfiguration] + +// ValidatingWebhookConfigurationDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ValidatingWebhookConfiguration. +type ValidatingWebhookConfigurationDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiadmissionregistrationv1.ValidatingWebhookConfiguration] + +// ValidatingWebhookConfigurationFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ValidatingWebhookConfiguration. +type ValidatingWebhookConfigurationFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiadmissionregistrationv1.ValidatingWebhookConfiguration] + +// ValidatingWebhookConfigurationIndexers is a specialization of [cache.TypedIndexers] for ValidatingWebhookConfiguration. +type ValidatingWebhookConfigurationIndexers = cache.TypedIndexers[*apiadmissionregistrationv1.ValidatingWebhookConfiguration] + +// DeletedValidatingWebhookConfiguration is a specialization of [cache.DeletedObject] for ValidatingWebhookConfiguration. +type DeletedValidatingWebhookConfiguration = cache.DeletedObject[*apiadmissionregistrationv1.ValidatingWebhookConfiguration] + type validatingWebhookConfigurationInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type validatingWebhookConfigurationInformer struct { // NewValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedValidatingWebhookConfigurationInformer]). func NewValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ValidatingWebhookConfigurationIndexers) ValidatingWebhookConfigurationIndexInformer { + return NewTypedValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredValidatingWebhookConfigurationInformer]). func NewFilteredValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ValidatingWebhookConfigurationIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ValidatingWebhookConfigurationIndexInformer { + return NewTypedValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewValidatingWebhookConfigurationInformerWithOptions constructs a new informer for ValidatingWebhookConfiguration type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedValidatingWebhookConfigurationInformerWithOptions]). func NewValidatingWebhookConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedValidatingWebhookConfigurationInformerWithOptions(client, options) +} + +// NewTypedValidatingWebhookConfigurationInformerWithOptions constructs a new informer for ValidatingWebhookConfiguration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedValidatingWebhookConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ValidatingWebhookConfigurationIndexInformer { gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1", Resource: "validatingwebhookconfigurations"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.ValidatingWebhookConfiguration](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewValidatingWebhookConfigurationInformerWithOptions(client kubernetes.Inte Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *validatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *validatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiadmissionregistrationv1.ValidatingWebhookConfiguration{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *validatingWebhookConfigurationInformer) TypedInformer() ValidatingWebhookConfigurationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.ValidatingWebhookConfiguration](f.factory.InformerFor(&apiadmissionregistrationv1.ValidatingWebhookConfiguration{}, f.defaultInformer)) } func (f *validatingWebhookConfigurationInformer) Lister() admissionregistrationv1.ValidatingWebhookConfigurationLister { return admissionregistrationv1.NewValidatingWebhookConfigurationLister(f.Informer().GetIndexer()) } + +// ToTypedValidatingWebhookConfigurationInformer converts an untyped informer into a TypedValidatingWebhookConfigurationInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ValidatingWebhookConfiguration. If that is not the case, calling type-safe methods of the returned +// TypedValidatingWebhookConfigurationInformer leads to runtime panics. A safer alternative is to pass +// around a TypedValidatingWebhookConfigurationInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedValidatingWebhookConfigurationInformer(informer ValidatingWebhookConfigurationInformer) TypedValidatingWebhookConfigurationInformer { + if informer, ok := informer.(TypedValidatingWebhookConfigurationInformer); ok { + return informer + } + return &validatingWebhookConfigurationTypedInformerAdapter{informer} +} + +type validatingWebhookConfigurationTypedInformerAdapter struct { + ValidatingWebhookConfigurationInformer +} + +func (a *validatingWebhookConfigurationTypedInformerAdapter) TypedInformer() ValidatingWebhookConfigurationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.ValidatingWebhookConfiguration](a.Informer()) +} + +// ToValidatingWebhookConfigurationIndexInformer converts an untyped informer into a ValidatingWebhookConfigurationIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ValidatingWebhookConfiguration. If that is not the case, calling type-safe methods of the returned +// ValidatingWebhookConfigurationIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ValidatingWebhookConfigurationIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToValidatingWebhookConfigurationIndexInformer(informer cache.SharedIndexInformer) ValidatingWebhookConfigurationIndexInformer { + if informer, ok := informer.(ValidatingWebhookConfigurationIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1.ValidatingWebhookConfiguration](informer) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/interface.go index 68ae4e25cb..43702bde93 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/interface.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/interface.go @@ -25,13 +25,13 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // MutatingAdmissionPolicies returns a MutatingAdmissionPolicyInformer. - MutatingAdmissionPolicies() MutatingAdmissionPolicyInformer + MutatingAdmissionPolicies() TypedMutatingAdmissionPolicyInformer // MutatingAdmissionPolicyBindings returns a MutatingAdmissionPolicyBindingInformer. - MutatingAdmissionPolicyBindings() MutatingAdmissionPolicyBindingInformer + MutatingAdmissionPolicyBindings() TypedMutatingAdmissionPolicyBindingInformer // ValidatingAdmissionPolicies returns a ValidatingAdmissionPolicyInformer. - ValidatingAdmissionPolicies() ValidatingAdmissionPolicyInformer + ValidatingAdmissionPolicies() TypedValidatingAdmissionPolicyInformer // ValidatingAdmissionPolicyBindings returns a ValidatingAdmissionPolicyBindingInformer. - ValidatingAdmissionPolicyBindings() ValidatingAdmissionPolicyBindingInformer + ValidatingAdmissionPolicyBindings() TypedValidatingAdmissionPolicyBindingInformer } type version struct { @@ -45,22 +45,22 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// MutatingAdmissionPolicies returns a MutatingAdmissionPolicyInformer. -func (v *version) MutatingAdmissionPolicies() MutatingAdmissionPolicyInformer { +// MutatingAdmissionPolicies returns a TypedMutatingAdmissionPolicyInformer. +func (v *version) MutatingAdmissionPolicies() TypedMutatingAdmissionPolicyInformer { return &mutatingAdmissionPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// MutatingAdmissionPolicyBindings returns a MutatingAdmissionPolicyBindingInformer. -func (v *version) MutatingAdmissionPolicyBindings() MutatingAdmissionPolicyBindingInformer { +// MutatingAdmissionPolicyBindings returns a TypedMutatingAdmissionPolicyBindingInformer. +func (v *version) MutatingAdmissionPolicyBindings() TypedMutatingAdmissionPolicyBindingInformer { return &mutatingAdmissionPolicyBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// ValidatingAdmissionPolicies returns a ValidatingAdmissionPolicyInformer. -func (v *version) ValidatingAdmissionPolicies() ValidatingAdmissionPolicyInformer { +// ValidatingAdmissionPolicies returns a TypedValidatingAdmissionPolicyInformer. +func (v *version) ValidatingAdmissionPolicies() TypedValidatingAdmissionPolicyInformer { return &validatingAdmissionPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// ValidatingAdmissionPolicyBindings returns a ValidatingAdmissionPolicyBindingInformer. -func (v *version) ValidatingAdmissionPolicyBindings() ValidatingAdmissionPolicyBindingInformer { +// ValidatingAdmissionPolicyBindings returns a TypedValidatingAdmissionPolicyBindingInformer. +func (v *version) ValidatingAdmissionPolicyBindings() TypedValidatingAdmissionPolicyBindingInformer { return &validatingAdmissionPolicyBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/mutatingadmissionpolicy.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/mutatingadmissionpolicy.go index 3441d6df44..387e8c9046 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/mutatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/mutatingadmissionpolicy.go @@ -34,12 +34,40 @@ import ( ) // MutatingAdmissionPolicyInformer provides access to a shared informer and lister for -// MutatingAdmissionPolicies. +// MutatingAdmissionPolicies. Prefer using the type-safe variant (see [TypedMutatingAdmissionPolicyInformer]). type MutatingAdmissionPolicyInformer interface { Informer() cache.SharedIndexInformer Lister() admissionregistrationv1alpha1.MutatingAdmissionPolicyLister } +// TypedMutatingAdmissionPolicyInformer provides access to a shared informer and lister for +// MutatingAdmissionPolicies, including the type-safe TypedInformer variant. +// It is a superset of MutatingAdmissionPolicyInformer. +type TypedMutatingAdmissionPolicyInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() MutatingAdmissionPolicyIndexInformer + Lister() admissionregistrationv1alpha1.MutatingAdmissionPolicyLister +} + +// MutatingAdmissionPolicyIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type MutatingAdmissionPolicyIndexInformer cache.TypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicy] + +// MutatingAdmissionPolicyHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for MutatingAdmissionPolicy. +type MutatingAdmissionPolicyHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicy] + +// MutatingAdmissionPolicyDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for MutatingAdmissionPolicy. +type MutatingAdmissionPolicyDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicy] + +// MutatingAdmissionPolicyFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for MutatingAdmissionPolicy. +type MutatingAdmissionPolicyFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicy] + +// MutatingAdmissionPolicyIndexers is a specialization of [cache.TypedIndexers] for MutatingAdmissionPolicy. +type MutatingAdmissionPolicyIndexers = cache.TypedIndexers[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicy] + +// DeletedMutatingAdmissionPolicy is a specialization of [cache.DeletedObject] for MutatingAdmissionPolicy. +type DeletedMutatingAdmissionPolicy = cache.DeletedObject[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicy] + type mutatingAdmissionPolicyInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type mutatingAdmissionPolicyInformer struct { // NewMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedMutatingAdmissionPolicyInformer]). func NewMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers MutatingAdmissionPolicyIndexers) MutatingAdmissionPolicyIndexInformer { + return NewTypedMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredMutatingAdmissionPolicyInformer]). func NewFilteredMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers MutatingAdmissionPolicyIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) MutatingAdmissionPolicyIndexInformer { + return NewTypedMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewMutatingAdmissionPolicyInformerWithOptions constructs a new informer for MutatingAdmissionPolicy type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedMutatingAdmissionPolicyInformerWithOptions]). func NewMutatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedMutatingAdmissionPolicyInformerWithOptions(client, options) +} + +// NewTypedMutatingAdmissionPolicyInformerWithOptions constructs a new informer for MutatingAdmissionPolicy type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedMutatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) MutatingAdmissionPolicyIndexInformer { gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Resource: "mutatingadmissionpolicys"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicy](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewMutatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *mutatingAdmissionPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *mutatingAdmissionPolicyInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiadmissionregistrationv1alpha1.MutatingAdmissionPolicy{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *mutatingAdmissionPolicyInformer) TypedInformer() MutatingAdmissionPolicyIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicy](f.factory.InformerFor(&apiadmissionregistrationv1alpha1.MutatingAdmissionPolicy{}, f.defaultInformer)) } func (f *mutatingAdmissionPolicyInformer) Lister() admissionregistrationv1alpha1.MutatingAdmissionPolicyLister { return admissionregistrationv1alpha1.NewMutatingAdmissionPolicyLister(f.Informer().GetIndexer()) } + +// ToTypedMutatingAdmissionPolicyInformer converts an untyped informer into a TypedMutatingAdmissionPolicyInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *MutatingAdmissionPolicy. If that is not the case, calling type-safe methods of the returned +// TypedMutatingAdmissionPolicyInformer leads to runtime panics. A safer alternative is to pass +// around a TypedMutatingAdmissionPolicyInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedMutatingAdmissionPolicyInformer(informer MutatingAdmissionPolicyInformer) TypedMutatingAdmissionPolicyInformer { + if informer, ok := informer.(TypedMutatingAdmissionPolicyInformer); ok { + return informer + } + return &mutatingAdmissionPolicyTypedInformerAdapter{informer} +} + +type mutatingAdmissionPolicyTypedInformerAdapter struct { + MutatingAdmissionPolicyInformer +} + +func (a *mutatingAdmissionPolicyTypedInformerAdapter) TypedInformer() MutatingAdmissionPolicyIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicy](a.Informer()) +} + +// ToMutatingAdmissionPolicyIndexInformer converts an untyped informer into a MutatingAdmissionPolicyIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *MutatingAdmissionPolicy. If that is not the case, calling type-safe methods of the returned +// MutatingAdmissionPolicyIndexInformer leads to runtime panics. A safer alternative is to pass +// around a MutatingAdmissionPolicyIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToMutatingAdmissionPolicyIndexInformer(informer cache.SharedIndexInformer) MutatingAdmissionPolicyIndexInformer { + if informer, ok := informer.(MutatingAdmissionPolicyIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicy](informer) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/mutatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/mutatingadmissionpolicybinding.go index 568c911159..b831a8d7a4 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/mutatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/mutatingadmissionpolicybinding.go @@ -34,12 +34,40 @@ import ( ) // MutatingAdmissionPolicyBindingInformer provides access to a shared informer and lister for -// MutatingAdmissionPolicyBindings. +// MutatingAdmissionPolicyBindings. Prefer using the type-safe variant (see [TypedMutatingAdmissionPolicyBindingInformer]). type MutatingAdmissionPolicyBindingInformer interface { Informer() cache.SharedIndexInformer Lister() admissionregistrationv1alpha1.MutatingAdmissionPolicyBindingLister } +// TypedMutatingAdmissionPolicyBindingInformer provides access to a shared informer and lister for +// MutatingAdmissionPolicyBindings, including the type-safe TypedInformer variant. +// It is a superset of MutatingAdmissionPolicyBindingInformer. +type TypedMutatingAdmissionPolicyBindingInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() MutatingAdmissionPolicyBindingIndexInformer + Lister() admissionregistrationv1alpha1.MutatingAdmissionPolicyBindingLister +} + +// MutatingAdmissionPolicyBindingIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type MutatingAdmissionPolicyBindingIndexInformer cache.TypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicyBinding] + +// MutatingAdmissionPolicyBindingHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for MutatingAdmissionPolicyBinding. +type MutatingAdmissionPolicyBindingHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicyBinding] + +// MutatingAdmissionPolicyBindingDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for MutatingAdmissionPolicyBinding. +type MutatingAdmissionPolicyBindingDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicyBinding] + +// MutatingAdmissionPolicyBindingFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for MutatingAdmissionPolicyBinding. +type MutatingAdmissionPolicyBindingFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicyBinding] + +// MutatingAdmissionPolicyBindingIndexers is a specialization of [cache.TypedIndexers] for MutatingAdmissionPolicyBinding. +type MutatingAdmissionPolicyBindingIndexers = cache.TypedIndexers[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicyBinding] + +// DeletedMutatingAdmissionPolicyBinding is a specialization of [cache.DeletedObject] for MutatingAdmissionPolicyBinding. +type DeletedMutatingAdmissionPolicyBinding = cache.DeletedObject[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicyBinding] + type mutatingAdmissionPolicyBindingInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type mutatingAdmissionPolicyBindingInformer struct { // NewMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedMutatingAdmissionPolicyBindingInformer]). func NewMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers MutatingAdmissionPolicyBindingIndexers) MutatingAdmissionPolicyBindingIndexInformer { + return NewTypedMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredMutatingAdmissionPolicyBindingInformer]). func NewFilteredMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers MutatingAdmissionPolicyBindingIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) MutatingAdmissionPolicyBindingIndexInformer { + return NewTypedMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewMutatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for MutatingAdmissionPolicyBinding type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedMutatingAdmissionPolicyBindingInformerWithOptions]). func NewMutatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedMutatingAdmissionPolicyBindingInformerWithOptions(client, options) +} + +// NewTypedMutatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for MutatingAdmissionPolicyBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedMutatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) MutatingAdmissionPolicyBindingIndexInformer { gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Resource: "mutatingadmissionpolicybindings"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicyBinding](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewMutatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Inte Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *mutatingAdmissionPolicyBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *mutatingAdmissionPolicyBindingInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiadmissionregistrationv1alpha1.MutatingAdmissionPolicyBinding{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *mutatingAdmissionPolicyBindingInformer) TypedInformer() MutatingAdmissionPolicyBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicyBinding](f.factory.InformerFor(&apiadmissionregistrationv1alpha1.MutatingAdmissionPolicyBinding{}, f.defaultInformer)) } func (f *mutatingAdmissionPolicyBindingInformer) Lister() admissionregistrationv1alpha1.MutatingAdmissionPolicyBindingLister { return admissionregistrationv1alpha1.NewMutatingAdmissionPolicyBindingLister(f.Informer().GetIndexer()) } + +// ToTypedMutatingAdmissionPolicyBindingInformer converts an untyped informer into a TypedMutatingAdmissionPolicyBindingInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *MutatingAdmissionPolicyBinding. If that is not the case, calling type-safe methods of the returned +// TypedMutatingAdmissionPolicyBindingInformer leads to runtime panics. A safer alternative is to pass +// around a TypedMutatingAdmissionPolicyBindingInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedMutatingAdmissionPolicyBindingInformer(informer MutatingAdmissionPolicyBindingInformer) TypedMutatingAdmissionPolicyBindingInformer { + if informer, ok := informer.(TypedMutatingAdmissionPolicyBindingInformer); ok { + return informer + } + return &mutatingAdmissionPolicyBindingTypedInformerAdapter{informer} +} + +type mutatingAdmissionPolicyBindingTypedInformerAdapter struct { + MutatingAdmissionPolicyBindingInformer +} + +func (a *mutatingAdmissionPolicyBindingTypedInformerAdapter) TypedInformer() MutatingAdmissionPolicyBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicyBinding](a.Informer()) +} + +// ToMutatingAdmissionPolicyBindingIndexInformer converts an untyped informer into a MutatingAdmissionPolicyBindingIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *MutatingAdmissionPolicyBinding. If that is not the case, calling type-safe methods of the returned +// MutatingAdmissionPolicyBindingIndexInformer leads to runtime panics. A safer alternative is to pass +// around a MutatingAdmissionPolicyBindingIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToMutatingAdmissionPolicyBindingIndexInformer(informer cache.SharedIndexInformer) MutatingAdmissionPolicyBindingIndexInformer { + if informer, ok := informer.(MutatingAdmissionPolicyBindingIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.MutatingAdmissionPolicyBinding](informer) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/validatingadmissionpolicy.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/validatingadmissionpolicy.go index c86ca6da62..db8efca26a 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/validatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/validatingadmissionpolicy.go @@ -34,12 +34,40 @@ import ( ) // ValidatingAdmissionPolicyInformer provides access to a shared informer and lister for -// ValidatingAdmissionPolicies. +// ValidatingAdmissionPolicies. Prefer using the type-safe variant (see [TypedValidatingAdmissionPolicyInformer]). type ValidatingAdmissionPolicyInformer interface { Informer() cache.SharedIndexInformer Lister() admissionregistrationv1alpha1.ValidatingAdmissionPolicyLister } +// TypedValidatingAdmissionPolicyInformer provides access to a shared informer and lister for +// ValidatingAdmissionPolicies, including the type-safe TypedInformer variant. +// It is a superset of ValidatingAdmissionPolicyInformer. +type TypedValidatingAdmissionPolicyInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ValidatingAdmissionPolicyIndexInformer + Lister() admissionregistrationv1alpha1.ValidatingAdmissionPolicyLister +} + +// ValidatingAdmissionPolicyIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ValidatingAdmissionPolicyIndexInformer cache.TypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicy] + +// ValidatingAdmissionPolicyHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ValidatingAdmissionPolicy. +type ValidatingAdmissionPolicyHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicy] + +// ValidatingAdmissionPolicyDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ValidatingAdmissionPolicy. +type ValidatingAdmissionPolicyDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicy] + +// ValidatingAdmissionPolicyFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ValidatingAdmissionPolicy. +type ValidatingAdmissionPolicyFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicy] + +// ValidatingAdmissionPolicyIndexers is a specialization of [cache.TypedIndexers] for ValidatingAdmissionPolicy. +type ValidatingAdmissionPolicyIndexers = cache.TypedIndexers[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicy] + +// DeletedValidatingAdmissionPolicy is a specialization of [cache.DeletedObject] for ValidatingAdmissionPolicy. +type DeletedValidatingAdmissionPolicy = cache.DeletedObject[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicy] + type validatingAdmissionPolicyInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type validatingAdmissionPolicyInformer struct { // NewValidatingAdmissionPolicyInformer constructs a new informer for ValidatingAdmissionPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedValidatingAdmissionPolicyInformer]). func NewValidatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedValidatingAdmissionPolicyInformer constructs a new informer for ValidatingAdmissionPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedValidatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ValidatingAdmissionPolicyIndexers) ValidatingAdmissionPolicyIndexInformer { + return NewTypedValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredValidatingAdmissionPolicyInformer constructs a new informer for ValidatingAdmissionPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredValidatingAdmissionPolicyInformer]). func NewFilteredValidatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredValidatingAdmissionPolicyInformer constructs a new informer for ValidatingAdmissionPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredValidatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ValidatingAdmissionPolicyIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ValidatingAdmissionPolicyIndexInformer { + return NewTypedValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewValidatingAdmissionPolicyInformerWithOptions constructs a new informer for ValidatingAdmissionPolicy type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedValidatingAdmissionPolicyInformerWithOptions]). func NewValidatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedValidatingAdmissionPolicyInformerWithOptions(client, options) +} + +// NewTypedValidatingAdmissionPolicyInformerWithOptions constructs a new informer for ValidatingAdmissionPolicy type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedValidatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ValidatingAdmissionPolicyIndexInformer { gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Resource: "validatingadmissionpolicys"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicy](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewValidatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *validatingAdmissionPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *validatingAdmissionPolicyInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicy{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *validatingAdmissionPolicyInformer) TypedInformer() ValidatingAdmissionPolicyIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicy](f.factory.InformerFor(&apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicy{}, f.defaultInformer)) } func (f *validatingAdmissionPolicyInformer) Lister() admissionregistrationv1alpha1.ValidatingAdmissionPolicyLister { return admissionregistrationv1alpha1.NewValidatingAdmissionPolicyLister(f.Informer().GetIndexer()) } + +// ToTypedValidatingAdmissionPolicyInformer converts an untyped informer into a TypedValidatingAdmissionPolicyInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ValidatingAdmissionPolicy. If that is not the case, calling type-safe methods of the returned +// TypedValidatingAdmissionPolicyInformer leads to runtime panics. A safer alternative is to pass +// around a TypedValidatingAdmissionPolicyInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedValidatingAdmissionPolicyInformer(informer ValidatingAdmissionPolicyInformer) TypedValidatingAdmissionPolicyInformer { + if informer, ok := informer.(TypedValidatingAdmissionPolicyInformer); ok { + return informer + } + return &validatingAdmissionPolicyTypedInformerAdapter{informer} +} + +type validatingAdmissionPolicyTypedInformerAdapter struct { + ValidatingAdmissionPolicyInformer +} + +func (a *validatingAdmissionPolicyTypedInformerAdapter) TypedInformer() ValidatingAdmissionPolicyIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicy](a.Informer()) +} + +// ToValidatingAdmissionPolicyIndexInformer converts an untyped informer into a ValidatingAdmissionPolicyIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ValidatingAdmissionPolicy. If that is not the case, calling type-safe methods of the returned +// ValidatingAdmissionPolicyIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ValidatingAdmissionPolicyIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToValidatingAdmissionPolicyIndexInformer(informer cache.SharedIndexInformer) ValidatingAdmissionPolicyIndexInformer { + if informer, ok := informer.(ValidatingAdmissionPolicyIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicy](informer) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/validatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/validatingadmissionpolicybinding.go index 224049a254..5e1c4accaa 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/validatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/validatingadmissionpolicybinding.go @@ -34,12 +34,40 @@ import ( ) // ValidatingAdmissionPolicyBindingInformer provides access to a shared informer and lister for -// ValidatingAdmissionPolicyBindings. +// ValidatingAdmissionPolicyBindings. Prefer using the type-safe variant (see [TypedValidatingAdmissionPolicyBindingInformer]). type ValidatingAdmissionPolicyBindingInformer interface { Informer() cache.SharedIndexInformer Lister() admissionregistrationv1alpha1.ValidatingAdmissionPolicyBindingLister } +// TypedValidatingAdmissionPolicyBindingInformer provides access to a shared informer and lister for +// ValidatingAdmissionPolicyBindings, including the type-safe TypedInformer variant. +// It is a superset of ValidatingAdmissionPolicyBindingInformer. +type TypedValidatingAdmissionPolicyBindingInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ValidatingAdmissionPolicyBindingIndexInformer + Lister() admissionregistrationv1alpha1.ValidatingAdmissionPolicyBindingLister +} + +// ValidatingAdmissionPolicyBindingIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ValidatingAdmissionPolicyBindingIndexInformer cache.TypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicyBinding] + +// ValidatingAdmissionPolicyBindingHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ValidatingAdmissionPolicyBinding. +type ValidatingAdmissionPolicyBindingHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicyBinding] + +// ValidatingAdmissionPolicyBindingDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ValidatingAdmissionPolicyBinding. +type ValidatingAdmissionPolicyBindingDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicyBinding] + +// ValidatingAdmissionPolicyBindingFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ValidatingAdmissionPolicyBinding. +type ValidatingAdmissionPolicyBindingFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicyBinding] + +// ValidatingAdmissionPolicyBindingIndexers is a specialization of [cache.TypedIndexers] for ValidatingAdmissionPolicyBinding. +type ValidatingAdmissionPolicyBindingIndexers = cache.TypedIndexers[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicyBinding] + +// DeletedValidatingAdmissionPolicyBinding is a specialization of [cache.DeletedObject] for ValidatingAdmissionPolicyBinding. +type DeletedValidatingAdmissionPolicyBinding = cache.DeletedObject[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicyBinding] + type validatingAdmissionPolicyBindingInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type validatingAdmissionPolicyBindingInformer struct { // NewValidatingAdmissionPolicyBindingInformer constructs a new informer for ValidatingAdmissionPolicyBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedValidatingAdmissionPolicyBindingInformer]). func NewValidatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedValidatingAdmissionPolicyBindingInformer constructs a new informer for ValidatingAdmissionPolicyBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedValidatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ValidatingAdmissionPolicyBindingIndexers) ValidatingAdmissionPolicyBindingIndexInformer { + return NewTypedValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredValidatingAdmissionPolicyBindingInformer constructs a new informer for ValidatingAdmissionPolicyBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredValidatingAdmissionPolicyBindingInformer]). func NewFilteredValidatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredValidatingAdmissionPolicyBindingInformer constructs a new informer for ValidatingAdmissionPolicyBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredValidatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ValidatingAdmissionPolicyBindingIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ValidatingAdmissionPolicyBindingIndexInformer { + return NewTypedValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewValidatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for ValidatingAdmissionPolicyBinding type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedValidatingAdmissionPolicyBindingInformerWithOptions]). func NewValidatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedValidatingAdmissionPolicyBindingInformerWithOptions(client, options) +} + +// NewTypedValidatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for ValidatingAdmissionPolicyBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedValidatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ValidatingAdmissionPolicyBindingIndexInformer { gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Resource: "validatingadmissionpolicybindings"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicyBinding](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewValidatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.In Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *validatingAdmissionPolicyBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *validatingAdmissionPolicyBindingInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicyBinding{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *validatingAdmissionPolicyBindingInformer) TypedInformer() ValidatingAdmissionPolicyBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicyBinding](f.factory.InformerFor(&apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicyBinding{}, f.defaultInformer)) } func (f *validatingAdmissionPolicyBindingInformer) Lister() admissionregistrationv1alpha1.ValidatingAdmissionPolicyBindingLister { return admissionregistrationv1alpha1.NewValidatingAdmissionPolicyBindingLister(f.Informer().GetIndexer()) } + +// ToTypedValidatingAdmissionPolicyBindingInformer converts an untyped informer into a TypedValidatingAdmissionPolicyBindingInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ValidatingAdmissionPolicyBinding. If that is not the case, calling type-safe methods of the returned +// TypedValidatingAdmissionPolicyBindingInformer leads to runtime panics. A safer alternative is to pass +// around a TypedValidatingAdmissionPolicyBindingInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedValidatingAdmissionPolicyBindingInformer(informer ValidatingAdmissionPolicyBindingInformer) TypedValidatingAdmissionPolicyBindingInformer { + if informer, ok := informer.(TypedValidatingAdmissionPolicyBindingInformer); ok { + return informer + } + return &validatingAdmissionPolicyBindingTypedInformerAdapter{informer} +} + +type validatingAdmissionPolicyBindingTypedInformerAdapter struct { + ValidatingAdmissionPolicyBindingInformer +} + +func (a *validatingAdmissionPolicyBindingTypedInformerAdapter) TypedInformer() ValidatingAdmissionPolicyBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicyBinding](a.Informer()) +} + +// ToValidatingAdmissionPolicyBindingIndexInformer converts an untyped informer into a ValidatingAdmissionPolicyBindingIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ValidatingAdmissionPolicyBinding. If that is not the case, calling type-safe methods of the returned +// ValidatingAdmissionPolicyBindingIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ValidatingAdmissionPolicyBindingIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToValidatingAdmissionPolicyBindingIndexInformer(informer cache.SharedIndexInformer) ValidatingAdmissionPolicyBindingIndexInformer { + if informer, ok := informer.(ValidatingAdmissionPolicyBindingIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicyBinding](informer) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/interface.go index 9174fd1c72..fa0818f41b 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/interface.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/interface.go @@ -25,17 +25,17 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // MutatingAdmissionPolicies returns a MutatingAdmissionPolicyInformer. - MutatingAdmissionPolicies() MutatingAdmissionPolicyInformer + MutatingAdmissionPolicies() TypedMutatingAdmissionPolicyInformer // MutatingAdmissionPolicyBindings returns a MutatingAdmissionPolicyBindingInformer. - MutatingAdmissionPolicyBindings() MutatingAdmissionPolicyBindingInformer + MutatingAdmissionPolicyBindings() TypedMutatingAdmissionPolicyBindingInformer // MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer. - MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer + MutatingWebhookConfigurations() TypedMutatingWebhookConfigurationInformer // ValidatingAdmissionPolicies returns a ValidatingAdmissionPolicyInformer. - ValidatingAdmissionPolicies() ValidatingAdmissionPolicyInformer + ValidatingAdmissionPolicies() TypedValidatingAdmissionPolicyInformer // ValidatingAdmissionPolicyBindings returns a ValidatingAdmissionPolicyBindingInformer. - ValidatingAdmissionPolicyBindings() ValidatingAdmissionPolicyBindingInformer + ValidatingAdmissionPolicyBindings() TypedValidatingAdmissionPolicyBindingInformer // ValidatingWebhookConfigurations returns a ValidatingWebhookConfigurationInformer. - ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInformer + ValidatingWebhookConfigurations() TypedValidatingWebhookConfigurationInformer } type version struct { @@ -49,32 +49,32 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// MutatingAdmissionPolicies returns a MutatingAdmissionPolicyInformer. -func (v *version) MutatingAdmissionPolicies() MutatingAdmissionPolicyInformer { +// MutatingAdmissionPolicies returns a TypedMutatingAdmissionPolicyInformer. +func (v *version) MutatingAdmissionPolicies() TypedMutatingAdmissionPolicyInformer { return &mutatingAdmissionPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// MutatingAdmissionPolicyBindings returns a MutatingAdmissionPolicyBindingInformer. -func (v *version) MutatingAdmissionPolicyBindings() MutatingAdmissionPolicyBindingInformer { +// MutatingAdmissionPolicyBindings returns a TypedMutatingAdmissionPolicyBindingInformer. +func (v *version) MutatingAdmissionPolicyBindings() TypedMutatingAdmissionPolicyBindingInformer { return &mutatingAdmissionPolicyBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer. -func (v *version) MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer { +// MutatingWebhookConfigurations returns a TypedMutatingWebhookConfigurationInformer. +func (v *version) MutatingWebhookConfigurations() TypedMutatingWebhookConfigurationInformer { return &mutatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// ValidatingAdmissionPolicies returns a ValidatingAdmissionPolicyInformer. -func (v *version) ValidatingAdmissionPolicies() ValidatingAdmissionPolicyInformer { +// ValidatingAdmissionPolicies returns a TypedValidatingAdmissionPolicyInformer. +func (v *version) ValidatingAdmissionPolicies() TypedValidatingAdmissionPolicyInformer { return &validatingAdmissionPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// ValidatingAdmissionPolicyBindings returns a ValidatingAdmissionPolicyBindingInformer. -func (v *version) ValidatingAdmissionPolicyBindings() ValidatingAdmissionPolicyBindingInformer { +// ValidatingAdmissionPolicyBindings returns a TypedValidatingAdmissionPolicyBindingInformer. +func (v *version) ValidatingAdmissionPolicyBindings() TypedValidatingAdmissionPolicyBindingInformer { return &validatingAdmissionPolicyBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// ValidatingWebhookConfigurations returns a ValidatingWebhookConfigurationInformer. -func (v *version) ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInformer { +// ValidatingWebhookConfigurations returns a TypedValidatingWebhookConfigurationInformer. +func (v *version) ValidatingWebhookConfigurations() TypedValidatingWebhookConfigurationInformer { return &validatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingadmissionpolicy.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingadmissionpolicy.go index edfe94417b..5eaff99898 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingadmissionpolicy.go @@ -34,12 +34,40 @@ import ( ) // MutatingAdmissionPolicyInformer provides access to a shared informer and lister for -// MutatingAdmissionPolicies. +// MutatingAdmissionPolicies. Prefer using the type-safe variant (see [TypedMutatingAdmissionPolicyInformer]). type MutatingAdmissionPolicyInformer interface { Informer() cache.SharedIndexInformer Lister() admissionregistrationv1beta1.MutatingAdmissionPolicyLister } +// TypedMutatingAdmissionPolicyInformer provides access to a shared informer and lister for +// MutatingAdmissionPolicies, including the type-safe TypedInformer variant. +// It is a superset of MutatingAdmissionPolicyInformer. +type TypedMutatingAdmissionPolicyInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() MutatingAdmissionPolicyIndexInformer + Lister() admissionregistrationv1beta1.MutatingAdmissionPolicyLister +} + +// MutatingAdmissionPolicyIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type MutatingAdmissionPolicyIndexInformer cache.TypedSharedIndexInformer[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicy] + +// MutatingAdmissionPolicyHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for MutatingAdmissionPolicy. +type MutatingAdmissionPolicyHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicy] + +// MutatingAdmissionPolicyDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for MutatingAdmissionPolicy. +type MutatingAdmissionPolicyDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicy] + +// MutatingAdmissionPolicyFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for MutatingAdmissionPolicy. +type MutatingAdmissionPolicyFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicy] + +// MutatingAdmissionPolicyIndexers is a specialization of [cache.TypedIndexers] for MutatingAdmissionPolicy. +type MutatingAdmissionPolicyIndexers = cache.TypedIndexers[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicy] + +// DeletedMutatingAdmissionPolicy is a specialization of [cache.DeletedObject] for MutatingAdmissionPolicy. +type DeletedMutatingAdmissionPolicy = cache.DeletedObject[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicy] + type mutatingAdmissionPolicyInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type mutatingAdmissionPolicyInformer struct { // NewMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedMutatingAdmissionPolicyInformer]). func NewMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers MutatingAdmissionPolicyIndexers) MutatingAdmissionPolicyIndexInformer { + return NewTypedMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredMutatingAdmissionPolicyInformer]). func NewFilteredMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers MutatingAdmissionPolicyIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) MutatingAdmissionPolicyIndexInformer { + return NewTypedMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewMutatingAdmissionPolicyInformerWithOptions constructs a new informer for MutatingAdmissionPolicy type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedMutatingAdmissionPolicyInformerWithOptions]). func NewMutatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedMutatingAdmissionPolicyInformerWithOptions(client, options) +} + +// NewTypedMutatingAdmissionPolicyInformerWithOptions constructs a new informer for MutatingAdmissionPolicy type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedMutatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) MutatingAdmissionPolicyIndexInformer { gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1beta1", Resource: "mutatingadmissionpolicys"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicy](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewMutatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *mutatingAdmissionPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *mutatingAdmissionPolicyInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiadmissionregistrationv1beta1.MutatingAdmissionPolicy{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *mutatingAdmissionPolicyInformer) TypedInformer() MutatingAdmissionPolicyIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicy](f.factory.InformerFor(&apiadmissionregistrationv1beta1.MutatingAdmissionPolicy{}, f.defaultInformer)) } func (f *mutatingAdmissionPolicyInformer) Lister() admissionregistrationv1beta1.MutatingAdmissionPolicyLister { return admissionregistrationv1beta1.NewMutatingAdmissionPolicyLister(f.Informer().GetIndexer()) } + +// ToTypedMutatingAdmissionPolicyInformer converts an untyped informer into a TypedMutatingAdmissionPolicyInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *MutatingAdmissionPolicy. If that is not the case, calling type-safe methods of the returned +// TypedMutatingAdmissionPolicyInformer leads to runtime panics. A safer alternative is to pass +// around a TypedMutatingAdmissionPolicyInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedMutatingAdmissionPolicyInformer(informer MutatingAdmissionPolicyInformer) TypedMutatingAdmissionPolicyInformer { + if informer, ok := informer.(TypedMutatingAdmissionPolicyInformer); ok { + return informer + } + return &mutatingAdmissionPolicyTypedInformerAdapter{informer} +} + +type mutatingAdmissionPolicyTypedInformerAdapter struct { + MutatingAdmissionPolicyInformer +} + +func (a *mutatingAdmissionPolicyTypedInformerAdapter) TypedInformer() MutatingAdmissionPolicyIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicy](a.Informer()) +} + +// ToMutatingAdmissionPolicyIndexInformer converts an untyped informer into a MutatingAdmissionPolicyIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *MutatingAdmissionPolicy. If that is not the case, calling type-safe methods of the returned +// MutatingAdmissionPolicyIndexInformer leads to runtime panics. A safer alternative is to pass +// around a MutatingAdmissionPolicyIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToMutatingAdmissionPolicyIndexInformer(informer cache.SharedIndexInformer) MutatingAdmissionPolicyIndexInformer { + if informer, ok := informer.(MutatingAdmissionPolicyIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicy](informer) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingadmissionpolicybinding.go index bb833f4447..6422d2f7fe 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingadmissionpolicybinding.go @@ -34,12 +34,40 @@ import ( ) // MutatingAdmissionPolicyBindingInformer provides access to a shared informer and lister for -// MutatingAdmissionPolicyBindings. +// MutatingAdmissionPolicyBindings. Prefer using the type-safe variant (see [TypedMutatingAdmissionPolicyBindingInformer]). type MutatingAdmissionPolicyBindingInformer interface { Informer() cache.SharedIndexInformer Lister() admissionregistrationv1beta1.MutatingAdmissionPolicyBindingLister } +// TypedMutatingAdmissionPolicyBindingInformer provides access to a shared informer and lister for +// MutatingAdmissionPolicyBindings, including the type-safe TypedInformer variant. +// It is a superset of MutatingAdmissionPolicyBindingInformer. +type TypedMutatingAdmissionPolicyBindingInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() MutatingAdmissionPolicyBindingIndexInformer + Lister() admissionregistrationv1beta1.MutatingAdmissionPolicyBindingLister +} + +// MutatingAdmissionPolicyBindingIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type MutatingAdmissionPolicyBindingIndexInformer cache.TypedSharedIndexInformer[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicyBinding] + +// MutatingAdmissionPolicyBindingHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for MutatingAdmissionPolicyBinding. +type MutatingAdmissionPolicyBindingHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicyBinding] + +// MutatingAdmissionPolicyBindingDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for MutatingAdmissionPolicyBinding. +type MutatingAdmissionPolicyBindingDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicyBinding] + +// MutatingAdmissionPolicyBindingFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for MutatingAdmissionPolicyBinding. +type MutatingAdmissionPolicyBindingFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicyBinding] + +// MutatingAdmissionPolicyBindingIndexers is a specialization of [cache.TypedIndexers] for MutatingAdmissionPolicyBinding. +type MutatingAdmissionPolicyBindingIndexers = cache.TypedIndexers[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicyBinding] + +// DeletedMutatingAdmissionPolicyBinding is a specialization of [cache.DeletedObject] for MutatingAdmissionPolicyBinding. +type DeletedMutatingAdmissionPolicyBinding = cache.DeletedObject[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicyBinding] + type mutatingAdmissionPolicyBindingInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type mutatingAdmissionPolicyBindingInformer struct { // NewMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedMutatingAdmissionPolicyBindingInformer]). func NewMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers MutatingAdmissionPolicyBindingIndexers) MutatingAdmissionPolicyBindingIndexInformer { + return NewTypedMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredMutatingAdmissionPolicyBindingInformer]). func NewFilteredMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers MutatingAdmissionPolicyBindingIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) MutatingAdmissionPolicyBindingIndexInformer { + return NewTypedMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewMutatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for MutatingAdmissionPolicyBinding type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedMutatingAdmissionPolicyBindingInformerWithOptions]). func NewMutatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedMutatingAdmissionPolicyBindingInformerWithOptions(client, options) +} + +// NewTypedMutatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for MutatingAdmissionPolicyBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedMutatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) MutatingAdmissionPolicyBindingIndexInformer { gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1beta1", Resource: "mutatingadmissionpolicybindings"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicyBinding](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewMutatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Inte Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *mutatingAdmissionPolicyBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *mutatingAdmissionPolicyBindingInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiadmissionregistrationv1beta1.MutatingAdmissionPolicyBinding{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *mutatingAdmissionPolicyBindingInformer) TypedInformer() MutatingAdmissionPolicyBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicyBinding](f.factory.InformerFor(&apiadmissionregistrationv1beta1.MutatingAdmissionPolicyBinding{}, f.defaultInformer)) } func (f *mutatingAdmissionPolicyBindingInformer) Lister() admissionregistrationv1beta1.MutatingAdmissionPolicyBindingLister { return admissionregistrationv1beta1.NewMutatingAdmissionPolicyBindingLister(f.Informer().GetIndexer()) } + +// ToTypedMutatingAdmissionPolicyBindingInformer converts an untyped informer into a TypedMutatingAdmissionPolicyBindingInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *MutatingAdmissionPolicyBinding. If that is not the case, calling type-safe methods of the returned +// TypedMutatingAdmissionPolicyBindingInformer leads to runtime panics. A safer alternative is to pass +// around a TypedMutatingAdmissionPolicyBindingInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedMutatingAdmissionPolicyBindingInformer(informer MutatingAdmissionPolicyBindingInformer) TypedMutatingAdmissionPolicyBindingInformer { + if informer, ok := informer.(TypedMutatingAdmissionPolicyBindingInformer); ok { + return informer + } + return &mutatingAdmissionPolicyBindingTypedInformerAdapter{informer} +} + +type mutatingAdmissionPolicyBindingTypedInformerAdapter struct { + MutatingAdmissionPolicyBindingInformer +} + +func (a *mutatingAdmissionPolicyBindingTypedInformerAdapter) TypedInformer() MutatingAdmissionPolicyBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicyBinding](a.Informer()) +} + +// ToMutatingAdmissionPolicyBindingIndexInformer converts an untyped informer into a MutatingAdmissionPolicyBindingIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *MutatingAdmissionPolicyBinding. If that is not the case, calling type-safe methods of the returned +// MutatingAdmissionPolicyBindingIndexInformer leads to runtime panics. A safer alternative is to pass +// around a MutatingAdmissionPolicyBindingIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToMutatingAdmissionPolicyBindingIndexInformer(informer cache.SharedIndexInformer) MutatingAdmissionPolicyBindingIndexInformer { + if informer, ok := informer.(MutatingAdmissionPolicyBindingIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.MutatingAdmissionPolicyBinding](informer) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go index bb077a1746..2aef3f2961 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go @@ -34,12 +34,40 @@ import ( ) // MutatingWebhookConfigurationInformer provides access to a shared informer and lister for -// MutatingWebhookConfigurations. +// MutatingWebhookConfigurations. Prefer using the type-safe variant (see [TypedMutatingWebhookConfigurationInformer]). type MutatingWebhookConfigurationInformer interface { Informer() cache.SharedIndexInformer Lister() admissionregistrationv1beta1.MutatingWebhookConfigurationLister } +// TypedMutatingWebhookConfigurationInformer provides access to a shared informer and lister for +// MutatingWebhookConfigurations, including the type-safe TypedInformer variant. +// It is a superset of MutatingWebhookConfigurationInformer. +type TypedMutatingWebhookConfigurationInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() MutatingWebhookConfigurationIndexInformer + Lister() admissionregistrationv1beta1.MutatingWebhookConfigurationLister +} + +// MutatingWebhookConfigurationIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type MutatingWebhookConfigurationIndexInformer cache.TypedSharedIndexInformer[*apiadmissionregistrationv1beta1.MutatingWebhookConfiguration] + +// MutatingWebhookConfigurationHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for MutatingWebhookConfiguration. +type MutatingWebhookConfigurationHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiadmissionregistrationv1beta1.MutatingWebhookConfiguration] + +// MutatingWebhookConfigurationDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for MutatingWebhookConfiguration. +type MutatingWebhookConfigurationDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiadmissionregistrationv1beta1.MutatingWebhookConfiguration] + +// MutatingWebhookConfigurationFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for MutatingWebhookConfiguration. +type MutatingWebhookConfigurationFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiadmissionregistrationv1beta1.MutatingWebhookConfiguration] + +// MutatingWebhookConfigurationIndexers is a specialization of [cache.TypedIndexers] for MutatingWebhookConfiguration. +type MutatingWebhookConfigurationIndexers = cache.TypedIndexers[*apiadmissionregistrationv1beta1.MutatingWebhookConfiguration] + +// DeletedMutatingWebhookConfiguration is a specialization of [cache.DeletedObject] for MutatingWebhookConfiguration. +type DeletedMutatingWebhookConfiguration = cache.DeletedObject[*apiadmissionregistrationv1beta1.MutatingWebhookConfiguration] + type mutatingWebhookConfigurationInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type mutatingWebhookConfigurationInformer struct { // NewMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedMutatingWebhookConfigurationInformer]). func NewMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers MutatingWebhookConfigurationIndexers) MutatingWebhookConfigurationIndexInformer { + return NewTypedMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredMutatingWebhookConfigurationInformer]). func NewFilteredMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers MutatingWebhookConfigurationIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) MutatingWebhookConfigurationIndexInformer { + return NewTypedMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewMutatingWebhookConfigurationInformerWithOptions constructs a new informer for MutatingWebhookConfiguration type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedMutatingWebhookConfigurationInformerWithOptions]). func NewMutatingWebhookConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedMutatingWebhookConfigurationInformerWithOptions(client, options) +} + +// NewTypedMutatingWebhookConfigurationInformerWithOptions constructs a new informer for MutatingWebhookConfiguration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedMutatingWebhookConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) MutatingWebhookConfigurationIndexInformer { gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1beta1", Resource: "mutatingwebhookconfigurations"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.MutatingWebhookConfiguration](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewMutatingWebhookConfigurationInformerWithOptions(client kubernetes.Interf Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *mutatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *mutatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiadmissionregistrationv1beta1.MutatingWebhookConfiguration{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *mutatingWebhookConfigurationInformer) TypedInformer() MutatingWebhookConfigurationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.MutatingWebhookConfiguration](f.factory.InformerFor(&apiadmissionregistrationv1beta1.MutatingWebhookConfiguration{}, f.defaultInformer)) } func (f *mutatingWebhookConfigurationInformer) Lister() admissionregistrationv1beta1.MutatingWebhookConfigurationLister { return admissionregistrationv1beta1.NewMutatingWebhookConfigurationLister(f.Informer().GetIndexer()) } + +// ToTypedMutatingWebhookConfigurationInformer converts an untyped informer into a TypedMutatingWebhookConfigurationInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *MutatingWebhookConfiguration. If that is not the case, calling type-safe methods of the returned +// TypedMutatingWebhookConfigurationInformer leads to runtime panics. A safer alternative is to pass +// around a TypedMutatingWebhookConfigurationInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedMutatingWebhookConfigurationInformer(informer MutatingWebhookConfigurationInformer) TypedMutatingWebhookConfigurationInformer { + if informer, ok := informer.(TypedMutatingWebhookConfigurationInformer); ok { + return informer + } + return &mutatingWebhookConfigurationTypedInformerAdapter{informer} +} + +type mutatingWebhookConfigurationTypedInformerAdapter struct { + MutatingWebhookConfigurationInformer +} + +func (a *mutatingWebhookConfigurationTypedInformerAdapter) TypedInformer() MutatingWebhookConfigurationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.MutatingWebhookConfiguration](a.Informer()) +} + +// ToMutatingWebhookConfigurationIndexInformer converts an untyped informer into a MutatingWebhookConfigurationIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *MutatingWebhookConfiguration. If that is not the case, calling type-safe methods of the returned +// MutatingWebhookConfigurationIndexInformer leads to runtime panics. A safer alternative is to pass +// around a MutatingWebhookConfigurationIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToMutatingWebhookConfigurationIndexInformer(informer cache.SharedIndexInformer) MutatingWebhookConfigurationIndexInformer { + if informer, ok := informer.(MutatingWebhookConfigurationIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.MutatingWebhookConfiguration](informer) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingadmissionpolicy.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingadmissionpolicy.go index a88a254d6f..2a4f9ad128 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingadmissionpolicy.go @@ -34,12 +34,40 @@ import ( ) // ValidatingAdmissionPolicyInformer provides access to a shared informer and lister for -// ValidatingAdmissionPolicies. +// ValidatingAdmissionPolicies. Prefer using the type-safe variant (see [TypedValidatingAdmissionPolicyInformer]). type ValidatingAdmissionPolicyInformer interface { Informer() cache.SharedIndexInformer Lister() admissionregistrationv1beta1.ValidatingAdmissionPolicyLister } +// TypedValidatingAdmissionPolicyInformer provides access to a shared informer and lister for +// ValidatingAdmissionPolicies, including the type-safe TypedInformer variant. +// It is a superset of ValidatingAdmissionPolicyInformer. +type TypedValidatingAdmissionPolicyInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ValidatingAdmissionPolicyIndexInformer + Lister() admissionregistrationv1beta1.ValidatingAdmissionPolicyLister +} + +// ValidatingAdmissionPolicyIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ValidatingAdmissionPolicyIndexInformer cache.TypedSharedIndexInformer[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicy] + +// ValidatingAdmissionPolicyHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ValidatingAdmissionPolicy. +type ValidatingAdmissionPolicyHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicy] + +// ValidatingAdmissionPolicyDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ValidatingAdmissionPolicy. +type ValidatingAdmissionPolicyDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicy] + +// ValidatingAdmissionPolicyFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ValidatingAdmissionPolicy. +type ValidatingAdmissionPolicyFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicy] + +// ValidatingAdmissionPolicyIndexers is a specialization of [cache.TypedIndexers] for ValidatingAdmissionPolicy. +type ValidatingAdmissionPolicyIndexers = cache.TypedIndexers[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicy] + +// DeletedValidatingAdmissionPolicy is a specialization of [cache.DeletedObject] for ValidatingAdmissionPolicy. +type DeletedValidatingAdmissionPolicy = cache.DeletedObject[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicy] + type validatingAdmissionPolicyInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type validatingAdmissionPolicyInformer struct { // NewValidatingAdmissionPolicyInformer constructs a new informer for ValidatingAdmissionPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedValidatingAdmissionPolicyInformer]). func NewValidatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedValidatingAdmissionPolicyInformer constructs a new informer for ValidatingAdmissionPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedValidatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ValidatingAdmissionPolicyIndexers) ValidatingAdmissionPolicyIndexInformer { + return NewTypedValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredValidatingAdmissionPolicyInformer constructs a new informer for ValidatingAdmissionPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredValidatingAdmissionPolicyInformer]). func NewFilteredValidatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredValidatingAdmissionPolicyInformer constructs a new informer for ValidatingAdmissionPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredValidatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ValidatingAdmissionPolicyIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ValidatingAdmissionPolicyIndexInformer { + return NewTypedValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewValidatingAdmissionPolicyInformerWithOptions constructs a new informer for ValidatingAdmissionPolicy type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedValidatingAdmissionPolicyInformerWithOptions]). func NewValidatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedValidatingAdmissionPolicyInformerWithOptions(client, options) +} + +// NewTypedValidatingAdmissionPolicyInformerWithOptions constructs a new informer for ValidatingAdmissionPolicy type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedValidatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ValidatingAdmissionPolicyIndexInformer { gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1beta1", Resource: "validatingadmissionpolicys"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicy](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewValidatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *validatingAdmissionPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *validatingAdmissionPolicyInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiadmissionregistrationv1beta1.ValidatingAdmissionPolicy{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *validatingAdmissionPolicyInformer) TypedInformer() ValidatingAdmissionPolicyIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicy](f.factory.InformerFor(&apiadmissionregistrationv1beta1.ValidatingAdmissionPolicy{}, f.defaultInformer)) } func (f *validatingAdmissionPolicyInformer) Lister() admissionregistrationv1beta1.ValidatingAdmissionPolicyLister { return admissionregistrationv1beta1.NewValidatingAdmissionPolicyLister(f.Informer().GetIndexer()) } + +// ToTypedValidatingAdmissionPolicyInformer converts an untyped informer into a TypedValidatingAdmissionPolicyInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ValidatingAdmissionPolicy. If that is not the case, calling type-safe methods of the returned +// TypedValidatingAdmissionPolicyInformer leads to runtime panics. A safer alternative is to pass +// around a TypedValidatingAdmissionPolicyInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedValidatingAdmissionPolicyInformer(informer ValidatingAdmissionPolicyInformer) TypedValidatingAdmissionPolicyInformer { + if informer, ok := informer.(TypedValidatingAdmissionPolicyInformer); ok { + return informer + } + return &validatingAdmissionPolicyTypedInformerAdapter{informer} +} + +type validatingAdmissionPolicyTypedInformerAdapter struct { + ValidatingAdmissionPolicyInformer +} + +func (a *validatingAdmissionPolicyTypedInformerAdapter) TypedInformer() ValidatingAdmissionPolicyIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicy](a.Informer()) +} + +// ToValidatingAdmissionPolicyIndexInformer converts an untyped informer into a ValidatingAdmissionPolicyIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ValidatingAdmissionPolicy. If that is not the case, calling type-safe methods of the returned +// ValidatingAdmissionPolicyIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ValidatingAdmissionPolicyIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToValidatingAdmissionPolicyIndexInformer(informer cache.SharedIndexInformer) ValidatingAdmissionPolicyIndexInformer { + if informer, ok := informer.(ValidatingAdmissionPolicyIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicy](informer) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingadmissionpolicybinding.go index d1df5a3f2f..2cbc29ac5a 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingadmissionpolicybinding.go @@ -34,12 +34,40 @@ import ( ) // ValidatingAdmissionPolicyBindingInformer provides access to a shared informer and lister for -// ValidatingAdmissionPolicyBindings. +// ValidatingAdmissionPolicyBindings. Prefer using the type-safe variant (see [TypedValidatingAdmissionPolicyBindingInformer]). type ValidatingAdmissionPolicyBindingInformer interface { Informer() cache.SharedIndexInformer Lister() admissionregistrationv1beta1.ValidatingAdmissionPolicyBindingLister } +// TypedValidatingAdmissionPolicyBindingInformer provides access to a shared informer and lister for +// ValidatingAdmissionPolicyBindings, including the type-safe TypedInformer variant. +// It is a superset of ValidatingAdmissionPolicyBindingInformer. +type TypedValidatingAdmissionPolicyBindingInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ValidatingAdmissionPolicyBindingIndexInformer + Lister() admissionregistrationv1beta1.ValidatingAdmissionPolicyBindingLister +} + +// ValidatingAdmissionPolicyBindingIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ValidatingAdmissionPolicyBindingIndexInformer cache.TypedSharedIndexInformer[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicyBinding] + +// ValidatingAdmissionPolicyBindingHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ValidatingAdmissionPolicyBinding. +type ValidatingAdmissionPolicyBindingHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicyBinding] + +// ValidatingAdmissionPolicyBindingDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ValidatingAdmissionPolicyBinding. +type ValidatingAdmissionPolicyBindingDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicyBinding] + +// ValidatingAdmissionPolicyBindingFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ValidatingAdmissionPolicyBinding. +type ValidatingAdmissionPolicyBindingFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicyBinding] + +// ValidatingAdmissionPolicyBindingIndexers is a specialization of [cache.TypedIndexers] for ValidatingAdmissionPolicyBinding. +type ValidatingAdmissionPolicyBindingIndexers = cache.TypedIndexers[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicyBinding] + +// DeletedValidatingAdmissionPolicyBinding is a specialization of [cache.DeletedObject] for ValidatingAdmissionPolicyBinding. +type DeletedValidatingAdmissionPolicyBinding = cache.DeletedObject[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicyBinding] + type validatingAdmissionPolicyBindingInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type validatingAdmissionPolicyBindingInformer struct { // NewValidatingAdmissionPolicyBindingInformer constructs a new informer for ValidatingAdmissionPolicyBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedValidatingAdmissionPolicyBindingInformer]). func NewValidatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedValidatingAdmissionPolicyBindingInformer constructs a new informer for ValidatingAdmissionPolicyBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedValidatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ValidatingAdmissionPolicyBindingIndexers) ValidatingAdmissionPolicyBindingIndexInformer { + return NewTypedValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredValidatingAdmissionPolicyBindingInformer constructs a new informer for ValidatingAdmissionPolicyBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredValidatingAdmissionPolicyBindingInformer]). func NewFilteredValidatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredValidatingAdmissionPolicyBindingInformer constructs a new informer for ValidatingAdmissionPolicyBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredValidatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ValidatingAdmissionPolicyBindingIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ValidatingAdmissionPolicyBindingIndexInformer { + return NewTypedValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewValidatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for ValidatingAdmissionPolicyBinding type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedValidatingAdmissionPolicyBindingInformerWithOptions]). func NewValidatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedValidatingAdmissionPolicyBindingInformerWithOptions(client, options) +} + +// NewTypedValidatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for ValidatingAdmissionPolicyBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedValidatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ValidatingAdmissionPolicyBindingIndexInformer { gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1beta1", Resource: "validatingadmissionpolicybindings"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicyBinding](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewValidatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.In Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *validatingAdmissionPolicyBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *validatingAdmissionPolicyBindingInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiadmissionregistrationv1beta1.ValidatingAdmissionPolicyBinding{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *validatingAdmissionPolicyBindingInformer) TypedInformer() ValidatingAdmissionPolicyBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicyBinding](f.factory.InformerFor(&apiadmissionregistrationv1beta1.ValidatingAdmissionPolicyBinding{}, f.defaultInformer)) } func (f *validatingAdmissionPolicyBindingInformer) Lister() admissionregistrationv1beta1.ValidatingAdmissionPolicyBindingLister { return admissionregistrationv1beta1.NewValidatingAdmissionPolicyBindingLister(f.Informer().GetIndexer()) } + +// ToTypedValidatingAdmissionPolicyBindingInformer converts an untyped informer into a TypedValidatingAdmissionPolicyBindingInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ValidatingAdmissionPolicyBinding. If that is not the case, calling type-safe methods of the returned +// TypedValidatingAdmissionPolicyBindingInformer leads to runtime panics. A safer alternative is to pass +// around a TypedValidatingAdmissionPolicyBindingInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedValidatingAdmissionPolicyBindingInformer(informer ValidatingAdmissionPolicyBindingInformer) TypedValidatingAdmissionPolicyBindingInformer { + if informer, ok := informer.(TypedValidatingAdmissionPolicyBindingInformer); ok { + return informer + } + return &validatingAdmissionPolicyBindingTypedInformerAdapter{informer} +} + +type validatingAdmissionPolicyBindingTypedInformerAdapter struct { + ValidatingAdmissionPolicyBindingInformer +} + +func (a *validatingAdmissionPolicyBindingTypedInformerAdapter) TypedInformer() ValidatingAdmissionPolicyBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicyBinding](a.Informer()) +} + +// ToValidatingAdmissionPolicyBindingIndexInformer converts an untyped informer into a ValidatingAdmissionPolicyBindingIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ValidatingAdmissionPolicyBinding. If that is not the case, calling type-safe methods of the returned +// ValidatingAdmissionPolicyBindingIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ValidatingAdmissionPolicyBindingIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToValidatingAdmissionPolicyBindingIndexInformer(informer cache.SharedIndexInformer) ValidatingAdmissionPolicyBindingIndexInformer { + if informer, ok := informer.(ValidatingAdmissionPolicyBindingIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.ValidatingAdmissionPolicyBinding](informer) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go index 41852cb03d..b7497aacab 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go @@ -34,12 +34,40 @@ import ( ) // ValidatingWebhookConfigurationInformer provides access to a shared informer and lister for -// ValidatingWebhookConfigurations. +// ValidatingWebhookConfigurations. Prefer using the type-safe variant (see [TypedValidatingWebhookConfigurationInformer]). type ValidatingWebhookConfigurationInformer interface { Informer() cache.SharedIndexInformer Lister() admissionregistrationv1beta1.ValidatingWebhookConfigurationLister } +// TypedValidatingWebhookConfigurationInformer provides access to a shared informer and lister for +// ValidatingWebhookConfigurations, including the type-safe TypedInformer variant. +// It is a superset of ValidatingWebhookConfigurationInformer. +type TypedValidatingWebhookConfigurationInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ValidatingWebhookConfigurationIndexInformer + Lister() admissionregistrationv1beta1.ValidatingWebhookConfigurationLister +} + +// ValidatingWebhookConfigurationIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ValidatingWebhookConfigurationIndexInformer cache.TypedSharedIndexInformer[*apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration] + +// ValidatingWebhookConfigurationHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ValidatingWebhookConfiguration. +type ValidatingWebhookConfigurationHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration] + +// ValidatingWebhookConfigurationDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ValidatingWebhookConfiguration. +type ValidatingWebhookConfigurationDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration] + +// ValidatingWebhookConfigurationFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ValidatingWebhookConfiguration. +type ValidatingWebhookConfigurationFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration] + +// ValidatingWebhookConfigurationIndexers is a specialization of [cache.TypedIndexers] for ValidatingWebhookConfiguration. +type ValidatingWebhookConfigurationIndexers = cache.TypedIndexers[*apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration] + +// DeletedValidatingWebhookConfiguration is a specialization of [cache.DeletedObject] for ValidatingWebhookConfiguration. +type DeletedValidatingWebhookConfiguration = cache.DeletedObject[*apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration] + type validatingWebhookConfigurationInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type validatingWebhookConfigurationInformer struct { // NewValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedValidatingWebhookConfigurationInformer]). func NewValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ValidatingWebhookConfigurationIndexers) ValidatingWebhookConfigurationIndexInformer { + return NewTypedValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredValidatingWebhookConfigurationInformer]). func NewFilteredValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ValidatingWebhookConfigurationIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ValidatingWebhookConfigurationIndexInformer { + return NewTypedValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewValidatingWebhookConfigurationInformerWithOptions constructs a new informer for ValidatingWebhookConfiguration type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedValidatingWebhookConfigurationInformerWithOptions]). func NewValidatingWebhookConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedValidatingWebhookConfigurationInformerWithOptions(client, options) +} + +// NewTypedValidatingWebhookConfigurationInformerWithOptions constructs a new informer for ValidatingWebhookConfiguration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedValidatingWebhookConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ValidatingWebhookConfigurationIndexInformer { gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1beta1", Resource: "validatingwebhookconfigurations"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewValidatingWebhookConfigurationInformerWithOptions(client kubernetes.Inte Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *validatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *validatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *validatingWebhookConfigurationInformer) TypedInformer() ValidatingWebhookConfigurationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration](f.factory.InformerFor(&apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration{}, f.defaultInformer)) } func (f *validatingWebhookConfigurationInformer) Lister() admissionregistrationv1beta1.ValidatingWebhookConfigurationLister { return admissionregistrationv1beta1.NewValidatingWebhookConfigurationLister(f.Informer().GetIndexer()) } + +// ToTypedValidatingWebhookConfigurationInformer converts an untyped informer into a TypedValidatingWebhookConfigurationInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ValidatingWebhookConfiguration. If that is not the case, calling type-safe methods of the returned +// TypedValidatingWebhookConfigurationInformer leads to runtime panics. A safer alternative is to pass +// around a TypedValidatingWebhookConfigurationInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedValidatingWebhookConfigurationInformer(informer ValidatingWebhookConfigurationInformer) TypedValidatingWebhookConfigurationInformer { + if informer, ok := informer.(TypedValidatingWebhookConfigurationInformer); ok { + return informer + } + return &validatingWebhookConfigurationTypedInformerAdapter{informer} +} + +type validatingWebhookConfigurationTypedInformerAdapter struct { + ValidatingWebhookConfigurationInformer +} + +func (a *validatingWebhookConfigurationTypedInformerAdapter) TypedInformer() ValidatingWebhookConfigurationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration](a.Informer()) +} + +// ToValidatingWebhookConfigurationIndexInformer converts an untyped informer into a ValidatingWebhookConfigurationIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ValidatingWebhookConfiguration. If that is not the case, calling type-safe methods of the returned +// ValidatingWebhookConfigurationIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ValidatingWebhookConfigurationIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToValidatingWebhookConfigurationIndexInformer(informer cache.SharedIndexInformer) ValidatingWebhookConfigurationIndexInformer { + if informer, ok := informer.(ValidatingWebhookConfigurationIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration](informer) +} diff --git a/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/interface.go index 9778325c65..5b6f5eafc6 100644 --- a/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/interface.go +++ b/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/interface.go @@ -25,7 +25,7 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // StorageVersions returns a StorageVersionInformer. - StorageVersions() StorageVersionInformer + StorageVersions() TypedStorageVersionInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// StorageVersions returns a StorageVersionInformer. -func (v *version) StorageVersions() StorageVersionInformer { +// StorageVersions returns a TypedStorageVersionInformer. +func (v *version) StorageVersions() TypedStorageVersionInformer { return &storageVersionInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go b/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go index 6d164a317c..c4ce84fb2a 100644 --- a/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go +++ b/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go @@ -34,12 +34,40 @@ import ( ) // StorageVersionInformer provides access to a shared informer and lister for -// StorageVersions. +// StorageVersions. Prefer using the type-safe variant (see [TypedStorageVersionInformer]). type StorageVersionInformer interface { Informer() cache.SharedIndexInformer Lister() apiserverinternalv1alpha1.StorageVersionLister } +// TypedStorageVersionInformer provides access to a shared informer and lister for +// StorageVersions, including the type-safe TypedInformer variant. +// It is a superset of StorageVersionInformer. +type TypedStorageVersionInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() StorageVersionIndexInformer + Lister() apiserverinternalv1alpha1.StorageVersionLister +} + +// StorageVersionIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type StorageVersionIndexInformer cache.TypedSharedIndexInformer[*apiapiserverinternalv1alpha1.StorageVersion] + +// StorageVersionHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for StorageVersion. +type StorageVersionHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiapiserverinternalv1alpha1.StorageVersion] + +// StorageVersionDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for StorageVersion. +type StorageVersionDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiapiserverinternalv1alpha1.StorageVersion] + +// StorageVersionFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for StorageVersion. +type StorageVersionFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiapiserverinternalv1alpha1.StorageVersion] + +// StorageVersionIndexers is a specialization of [cache.TypedIndexers] for StorageVersion. +type StorageVersionIndexers = cache.TypedIndexers[*apiapiserverinternalv1alpha1.StorageVersion] + +// DeletedStorageVersion is a specialization of [cache.DeletedObject] for StorageVersion. +type DeletedStorageVersion = cache.DeletedObject[*apiapiserverinternalv1alpha1.StorageVersion] + type storageVersionInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type storageVersionInformer struct { // NewStorageVersionInformer constructs a new informer for StorageVersion type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedStorageVersionInformer]). func NewStorageVersionInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewStorageVersionInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedStorageVersionInformer constructs a new informer for StorageVersion type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedStorageVersionInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers StorageVersionIndexers) StorageVersionIndexInformer { + return NewTypedStorageVersionInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredStorageVersionInformer constructs a new informer for StorageVersion type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredStorageVersionInformer]). func NewFilteredStorageVersionInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewStorageVersionInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedStorageVersionInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredStorageVersionInformer constructs a new informer for StorageVersion type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredStorageVersionInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers StorageVersionIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) StorageVersionIndexInformer { + return NewTypedStorageVersionInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewStorageVersionInformerWithOptions constructs a new informer for StorageVersion type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedStorageVersionInformerWithOptions]). func NewStorageVersionInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedStorageVersionInformerWithOptions(client, options) +} + +// NewTypedStorageVersionInformerWithOptions constructs a new informer for StorageVersion type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedStorageVersionInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) StorageVersionIndexInformer { gvr := schema.GroupVersionResource{Group: "internal.apiserver.k8s.io", Version: "v1alpha1", Resource: "storageversions"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiapiserverinternalv1alpha1.StorageVersion](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewStorageVersionInformerWithOptions(client kubernetes.Interface, options i Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *storageVersionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewStorageVersionInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedStorageVersionInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *storageVersionInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiapiserverinternalv1alpha1.StorageVersion{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *storageVersionInformer) TypedInformer() StorageVersionIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiapiserverinternalv1alpha1.StorageVersion](f.factory.InformerFor(&apiapiserverinternalv1alpha1.StorageVersion{}, f.defaultInformer)) } func (f *storageVersionInformer) Lister() apiserverinternalv1alpha1.StorageVersionLister { return apiserverinternalv1alpha1.NewStorageVersionLister(f.Informer().GetIndexer()) } + +// ToTypedStorageVersionInformer converts an untyped informer into a TypedStorageVersionInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *StorageVersion. If that is not the case, calling type-safe methods of the returned +// TypedStorageVersionInformer leads to runtime panics. A safer alternative is to pass +// around a TypedStorageVersionInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedStorageVersionInformer(informer StorageVersionInformer) TypedStorageVersionInformer { + if informer, ok := informer.(TypedStorageVersionInformer); ok { + return informer + } + return &storageVersionTypedInformerAdapter{informer} +} + +type storageVersionTypedInformerAdapter struct { + StorageVersionInformer +} + +func (a *storageVersionTypedInformerAdapter) TypedInformer() StorageVersionIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiapiserverinternalv1alpha1.StorageVersion](a.Informer()) +} + +// ToStorageVersionIndexInformer converts an untyped informer into a StorageVersionIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *StorageVersion. If that is not the case, calling type-safe methods of the returned +// StorageVersionIndexInformer leads to runtime panics. A safer alternative is to pass +// around a StorageVersionIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToStorageVersionIndexInformer(informer cache.SharedIndexInformer) StorageVersionIndexInformer { + if informer, ok := informer.(StorageVersionIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiapiserverinternalv1alpha1.StorageVersion](informer) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1/controllerrevision.go b/vendor/k8s.io/client-go/informers/apps/v1/controllerrevision.go index f58da53f18..86a7796c8d 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1/controllerrevision.go +++ b/vendor/k8s.io/client-go/informers/apps/v1/controllerrevision.go @@ -34,12 +34,40 @@ import ( ) // ControllerRevisionInformer provides access to a shared informer and lister for -// ControllerRevisions. +// ControllerRevisions. Prefer using the type-safe variant (see [TypedControllerRevisionInformer]). type ControllerRevisionInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1.ControllerRevisionLister } +// TypedControllerRevisionInformer provides access to a shared informer and lister for +// ControllerRevisions, including the type-safe TypedInformer variant. +// It is a superset of ControllerRevisionInformer. +type TypedControllerRevisionInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ControllerRevisionIndexInformer + Lister() appsv1.ControllerRevisionLister +} + +// ControllerRevisionIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ControllerRevisionIndexInformer cache.TypedSharedIndexInformer[*apiappsv1.ControllerRevision] + +// ControllerRevisionHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ControllerRevision. +type ControllerRevisionHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiappsv1.ControllerRevision] + +// ControllerRevisionDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ControllerRevision. +type ControllerRevisionDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiappsv1.ControllerRevision] + +// ControllerRevisionFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ControllerRevision. +type ControllerRevisionFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiappsv1.ControllerRevision] + +// ControllerRevisionIndexers is a specialization of [cache.TypedIndexers] for ControllerRevision. +type ControllerRevisionIndexers = cache.TypedIndexers[*apiappsv1.ControllerRevision] + +// DeletedControllerRevision is a specialization of [cache.DeletedObject] for ControllerRevision. +type DeletedControllerRevision = cache.DeletedObject[*apiappsv1.ControllerRevision] + type controllerRevisionInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type controllerRevisionInformer struct { // NewControllerRevisionInformer constructs a new informer for ControllerRevision type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedControllerRevisionInformer]). func NewControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ControllerRevisionIndexers) ControllerRevisionIndexInformer { + return NewTypedControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredControllerRevisionInformer]). func NewFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ControllerRevisionIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ControllerRevisionIndexInformer { + return NewTypedControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewControllerRevisionInformerWithOptions constructs a new informer for ControllerRevision type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedControllerRevisionInformerWithOptions]). func NewControllerRevisionInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedControllerRevisionInformerWithOptions(client, namespace, options) +} + +// NewTypedControllerRevisionInformerWithOptions constructs a new informer for ControllerRevision type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedControllerRevisionInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) ControllerRevisionIndexInformer { gvr := schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "controllerrevisions"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiappsv1.ControllerRevision](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewControllerRevisionInformerWithOptions(client kubernetes.Interface, names Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *controllerRevisionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewControllerRevisionInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedControllerRevisionInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiappsv1.ControllerRevision{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *controllerRevisionInformer) TypedInformer() ControllerRevisionIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1.ControllerRevision](f.factory.InformerFor(&apiappsv1.ControllerRevision{}, f.defaultInformer)) } func (f *controllerRevisionInformer) Lister() appsv1.ControllerRevisionLister { return appsv1.NewControllerRevisionLister(f.Informer().GetIndexer()) } + +// ToTypedControllerRevisionInformer converts an untyped informer into a TypedControllerRevisionInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ControllerRevision. If that is not the case, calling type-safe methods of the returned +// TypedControllerRevisionInformer leads to runtime panics. A safer alternative is to pass +// around a TypedControllerRevisionInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedControllerRevisionInformer(informer ControllerRevisionInformer) TypedControllerRevisionInformer { + if informer, ok := informer.(TypedControllerRevisionInformer); ok { + return informer + } + return &controllerRevisionTypedInformerAdapter{informer} +} + +type controllerRevisionTypedInformerAdapter struct { + ControllerRevisionInformer +} + +func (a *controllerRevisionTypedInformerAdapter) TypedInformer() ControllerRevisionIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1.ControllerRevision](a.Informer()) +} + +// ToControllerRevisionIndexInformer converts an untyped informer into a ControllerRevisionIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ControllerRevision. If that is not the case, calling type-safe methods of the returned +// ControllerRevisionIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ControllerRevisionIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToControllerRevisionIndexInformer(informer cache.SharedIndexInformer) ControllerRevisionIndexInformer { + if informer, ok := informer.(ControllerRevisionIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiappsv1.ControllerRevision](informer) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1/daemonset.go b/vendor/k8s.io/client-go/informers/apps/v1/daemonset.go index dbdc401242..110fbdbcc5 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1/daemonset.go +++ b/vendor/k8s.io/client-go/informers/apps/v1/daemonset.go @@ -34,12 +34,40 @@ import ( ) // DaemonSetInformer provides access to a shared informer and lister for -// DaemonSets. +// DaemonSets. Prefer using the type-safe variant (see [TypedDaemonSetInformer]). type DaemonSetInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1.DaemonSetLister } +// TypedDaemonSetInformer provides access to a shared informer and lister for +// DaemonSets, including the type-safe TypedInformer variant. +// It is a superset of DaemonSetInformer. +type TypedDaemonSetInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() DaemonSetIndexInformer + Lister() appsv1.DaemonSetLister +} + +// DaemonSetIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type DaemonSetIndexInformer cache.TypedSharedIndexInformer[*apiappsv1.DaemonSet] + +// DaemonSetHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for DaemonSet. +type DaemonSetHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiappsv1.DaemonSet] + +// DaemonSetDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for DaemonSet. +type DaemonSetDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiappsv1.DaemonSet] + +// DaemonSetFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for DaemonSet. +type DaemonSetFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiappsv1.DaemonSet] + +// DaemonSetIndexers is a specialization of [cache.TypedIndexers] for DaemonSet. +type DaemonSetIndexers = cache.TypedIndexers[*apiappsv1.DaemonSet] + +// DeletedDaemonSet is a specialization of [cache.DeletedObject] for DaemonSet. +type DeletedDaemonSet = cache.DeletedObject[*apiappsv1.DaemonSet] + type daemonSetInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type daemonSetInformer struct { // NewDaemonSetInformer constructs a new informer for DaemonSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDaemonSetInformer]). func NewDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers DaemonSetIndexers) DaemonSetIndexInformer { + return NewTypedDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredDaemonSetInformer constructs a new informer for DaemonSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredDaemonSetInformer]). func NewFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers DaemonSetIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) DaemonSetIndexInformer { + return NewTypedDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewDaemonSetInformerWithOptions constructs a new informer for DaemonSet type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDaemonSetInformerWithOptions]). func NewDaemonSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedDaemonSetInformerWithOptions(client, namespace, options) +} + +// NewTypedDaemonSetInformerWithOptions constructs a new informer for DaemonSet type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDaemonSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) DaemonSetIndexInformer { gvr := schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "daemonsets"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiappsv1.DaemonSet](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewDaemonSetInformerWithOptions(client kubernetes.Interface, namespace stri Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *daemonSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewDaemonSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedDaemonSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiappsv1.DaemonSet{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *daemonSetInformer) TypedInformer() DaemonSetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1.DaemonSet](f.factory.InformerFor(&apiappsv1.DaemonSet{}, f.defaultInformer)) } func (f *daemonSetInformer) Lister() appsv1.DaemonSetLister { return appsv1.NewDaemonSetLister(f.Informer().GetIndexer()) } + +// ToTypedDaemonSetInformer converts an untyped informer into a TypedDaemonSetInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *DaemonSet. If that is not the case, calling type-safe methods of the returned +// TypedDaemonSetInformer leads to runtime panics. A safer alternative is to pass +// around a TypedDaemonSetInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedDaemonSetInformer(informer DaemonSetInformer) TypedDaemonSetInformer { + if informer, ok := informer.(TypedDaemonSetInformer); ok { + return informer + } + return &daemonSetTypedInformerAdapter{informer} +} + +type daemonSetTypedInformerAdapter struct { + DaemonSetInformer +} + +func (a *daemonSetTypedInformerAdapter) TypedInformer() DaemonSetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1.DaemonSet](a.Informer()) +} + +// ToDaemonSetIndexInformer converts an untyped informer into a DaemonSetIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *DaemonSet. If that is not the case, calling type-safe methods of the returned +// DaemonSetIndexInformer leads to runtime panics. A safer alternative is to pass +// around a DaemonSetIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToDaemonSetIndexInformer(informer cache.SharedIndexInformer) DaemonSetIndexInformer { + if informer, ok := informer.(DaemonSetIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiappsv1.DaemonSet](informer) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1/deployment.go b/vendor/k8s.io/client-go/informers/apps/v1/deployment.go index dbf4df6a88..1079bc190b 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1/deployment.go +++ b/vendor/k8s.io/client-go/informers/apps/v1/deployment.go @@ -34,12 +34,40 @@ import ( ) // DeploymentInformer provides access to a shared informer and lister for -// Deployments. +// Deployments. Prefer using the type-safe variant (see [TypedDeploymentInformer]). type DeploymentInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1.DeploymentLister } +// TypedDeploymentInformer provides access to a shared informer and lister for +// Deployments, including the type-safe TypedInformer variant. +// It is a superset of DeploymentInformer. +type TypedDeploymentInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() DeploymentIndexInformer + Lister() appsv1.DeploymentLister +} + +// DeploymentIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type DeploymentIndexInformer cache.TypedSharedIndexInformer[*apiappsv1.Deployment] + +// DeploymentHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Deployment. +type DeploymentHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiappsv1.Deployment] + +// DeploymentDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Deployment. +type DeploymentDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiappsv1.Deployment] + +// DeploymentFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Deployment. +type DeploymentFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiappsv1.Deployment] + +// DeploymentIndexers is a specialization of [cache.TypedIndexers] for Deployment. +type DeploymentIndexers = cache.TypedIndexers[*apiappsv1.Deployment] + +// DeletedDeployment is a specialization of [cache.DeletedObject] for Deployment. +type DeletedDeployment = cache.DeletedObject[*apiappsv1.Deployment] + type deploymentInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type deploymentInformer struct { // NewDeploymentInformer constructs a new informer for Deployment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeploymentInformer]). func NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers DeploymentIndexers) DeploymentIndexInformer { + return NewTypedDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredDeploymentInformer constructs a new informer for Deployment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredDeploymentInformer]). func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers DeploymentIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) DeploymentIndexInformer { + return NewTypedDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewDeploymentInformerWithOptions constructs a new informer for Deployment type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeploymentInformerWithOptions]). func NewDeploymentInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedDeploymentInformerWithOptions(client, namespace, options) +} + +// NewTypedDeploymentInformerWithOptions constructs a new informer for Deployment type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeploymentInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) DeploymentIndexInformer { gvr := schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "deployments"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiappsv1.Deployment](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewDeploymentInformerWithOptions(client kubernetes.Interface, namespace str Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewDeploymentInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedDeploymentInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *deploymentInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiappsv1.Deployment{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *deploymentInformer) TypedInformer() DeploymentIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1.Deployment](f.factory.InformerFor(&apiappsv1.Deployment{}, f.defaultInformer)) } func (f *deploymentInformer) Lister() appsv1.DeploymentLister { return appsv1.NewDeploymentLister(f.Informer().GetIndexer()) } + +// ToTypedDeploymentInformer converts an untyped informer into a TypedDeploymentInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Deployment. If that is not the case, calling type-safe methods of the returned +// TypedDeploymentInformer leads to runtime panics. A safer alternative is to pass +// around a TypedDeploymentInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedDeploymentInformer(informer DeploymentInformer) TypedDeploymentInformer { + if informer, ok := informer.(TypedDeploymentInformer); ok { + return informer + } + return &deploymentTypedInformerAdapter{informer} +} + +type deploymentTypedInformerAdapter struct { + DeploymentInformer +} + +func (a *deploymentTypedInformerAdapter) TypedInformer() DeploymentIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1.Deployment](a.Informer()) +} + +// ToDeploymentIndexInformer converts an untyped informer into a DeploymentIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Deployment. If that is not the case, calling type-safe methods of the returned +// DeploymentIndexInformer leads to runtime panics. A safer alternative is to pass +// around a DeploymentIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToDeploymentIndexInformer(informer cache.SharedIndexInformer) DeploymentIndexInformer { + if informer, ok := informer.(DeploymentIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiappsv1.Deployment](informer) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1/interface.go b/vendor/k8s.io/client-go/informers/apps/v1/interface.go index fab1e76bd9..d8e4e3bf17 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1/interface.go +++ b/vendor/k8s.io/client-go/informers/apps/v1/interface.go @@ -25,15 +25,15 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // ControllerRevisions returns a ControllerRevisionInformer. - ControllerRevisions() ControllerRevisionInformer + ControllerRevisions() TypedControllerRevisionInformer // DaemonSets returns a DaemonSetInformer. - DaemonSets() DaemonSetInformer + DaemonSets() TypedDaemonSetInformer // Deployments returns a DeploymentInformer. - Deployments() DeploymentInformer + Deployments() TypedDeploymentInformer // ReplicaSets returns a ReplicaSetInformer. - ReplicaSets() ReplicaSetInformer + ReplicaSets() TypedReplicaSetInformer // StatefulSets returns a StatefulSetInformer. - StatefulSets() StatefulSetInformer + StatefulSets() TypedStatefulSetInformer } type version struct { @@ -47,27 +47,27 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// ControllerRevisions returns a ControllerRevisionInformer. -func (v *version) ControllerRevisions() ControllerRevisionInformer { +// ControllerRevisions returns a TypedControllerRevisionInformer. +func (v *version) ControllerRevisions() TypedControllerRevisionInformer { return &controllerRevisionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// DaemonSets returns a DaemonSetInformer. -func (v *version) DaemonSets() DaemonSetInformer { +// DaemonSets returns a TypedDaemonSetInformer. +func (v *version) DaemonSets() TypedDaemonSetInformer { return &daemonSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// Deployments returns a DeploymentInformer. -func (v *version) Deployments() DeploymentInformer { +// Deployments returns a TypedDeploymentInformer. +func (v *version) Deployments() TypedDeploymentInformer { return &deploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// ReplicaSets returns a ReplicaSetInformer. -func (v *version) ReplicaSets() ReplicaSetInformer { +// ReplicaSets returns a TypedReplicaSetInformer. +func (v *version) ReplicaSets() TypedReplicaSetInformer { return &replicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// StatefulSets returns a StatefulSetInformer. -func (v *version) StatefulSets() StatefulSetInformer { +// StatefulSets returns a TypedStatefulSetInformer. +func (v *version) StatefulSets() TypedStatefulSetInformer { return &statefulSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/apps/v1/replicaset.go b/vendor/k8s.io/client-go/informers/apps/v1/replicaset.go index 1115e5adcc..13983f2a7d 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1/replicaset.go +++ b/vendor/k8s.io/client-go/informers/apps/v1/replicaset.go @@ -34,12 +34,40 @@ import ( ) // ReplicaSetInformer provides access to a shared informer and lister for -// ReplicaSets. +// ReplicaSets. Prefer using the type-safe variant (see [TypedReplicaSetInformer]). type ReplicaSetInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1.ReplicaSetLister } +// TypedReplicaSetInformer provides access to a shared informer and lister for +// ReplicaSets, including the type-safe TypedInformer variant. +// It is a superset of ReplicaSetInformer. +type TypedReplicaSetInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ReplicaSetIndexInformer + Lister() appsv1.ReplicaSetLister +} + +// ReplicaSetIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ReplicaSetIndexInformer cache.TypedSharedIndexInformer[*apiappsv1.ReplicaSet] + +// ReplicaSetHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ReplicaSet. +type ReplicaSetHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiappsv1.ReplicaSet] + +// ReplicaSetDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ReplicaSet. +type ReplicaSetDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiappsv1.ReplicaSet] + +// ReplicaSetFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ReplicaSet. +type ReplicaSetFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiappsv1.ReplicaSet] + +// ReplicaSetIndexers is a specialization of [cache.TypedIndexers] for ReplicaSet. +type ReplicaSetIndexers = cache.TypedIndexers[*apiappsv1.ReplicaSet] + +// DeletedReplicaSet is a specialization of [cache.DeletedObject] for ReplicaSet. +type DeletedReplicaSet = cache.DeletedObject[*apiappsv1.ReplicaSet] + type replicaSetInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type replicaSetInformer struct { // NewReplicaSetInformer constructs a new informer for ReplicaSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedReplicaSetInformer]). func NewReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ReplicaSetIndexers) ReplicaSetIndexInformer { + return NewTypedReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredReplicaSetInformer]). func NewFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ReplicaSetIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ReplicaSetIndexInformer { + return NewTypedReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewReplicaSetInformerWithOptions constructs a new informer for ReplicaSet type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedReplicaSetInformerWithOptions]). func NewReplicaSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedReplicaSetInformerWithOptions(client, namespace, options) +} + +// NewTypedReplicaSetInformerWithOptions constructs a new informer for ReplicaSet type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedReplicaSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) ReplicaSetIndexInformer { gvr := schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "replicasets"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiappsv1.ReplicaSet](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewReplicaSetInformerWithOptions(client kubernetes.Interface, namespace str Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *replicaSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewReplicaSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedReplicaSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiappsv1.ReplicaSet{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *replicaSetInformer) TypedInformer() ReplicaSetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1.ReplicaSet](f.factory.InformerFor(&apiappsv1.ReplicaSet{}, f.defaultInformer)) } func (f *replicaSetInformer) Lister() appsv1.ReplicaSetLister { return appsv1.NewReplicaSetLister(f.Informer().GetIndexer()) } + +// ToTypedReplicaSetInformer converts an untyped informer into a TypedReplicaSetInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ReplicaSet. If that is not the case, calling type-safe methods of the returned +// TypedReplicaSetInformer leads to runtime panics. A safer alternative is to pass +// around a TypedReplicaSetInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedReplicaSetInformer(informer ReplicaSetInformer) TypedReplicaSetInformer { + if informer, ok := informer.(TypedReplicaSetInformer); ok { + return informer + } + return &replicaSetTypedInformerAdapter{informer} +} + +type replicaSetTypedInformerAdapter struct { + ReplicaSetInformer +} + +func (a *replicaSetTypedInformerAdapter) TypedInformer() ReplicaSetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1.ReplicaSet](a.Informer()) +} + +// ToReplicaSetIndexInformer converts an untyped informer into a ReplicaSetIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ReplicaSet. If that is not the case, calling type-safe methods of the returned +// ReplicaSetIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ReplicaSetIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToReplicaSetIndexInformer(informer cache.SharedIndexInformer) ReplicaSetIndexInformer { + if informer, ok := informer.(ReplicaSetIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiappsv1.ReplicaSet](informer) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1/statefulset.go b/vendor/k8s.io/client-go/informers/apps/v1/statefulset.go index 998251edee..64c766e153 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1/statefulset.go +++ b/vendor/k8s.io/client-go/informers/apps/v1/statefulset.go @@ -34,12 +34,40 @@ import ( ) // StatefulSetInformer provides access to a shared informer and lister for -// StatefulSets. +// StatefulSets. Prefer using the type-safe variant (see [TypedStatefulSetInformer]). type StatefulSetInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1.StatefulSetLister } +// TypedStatefulSetInformer provides access to a shared informer and lister for +// StatefulSets, including the type-safe TypedInformer variant. +// It is a superset of StatefulSetInformer. +type TypedStatefulSetInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() StatefulSetIndexInformer + Lister() appsv1.StatefulSetLister +} + +// StatefulSetIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type StatefulSetIndexInformer cache.TypedSharedIndexInformer[*apiappsv1.StatefulSet] + +// StatefulSetHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for StatefulSet. +type StatefulSetHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiappsv1.StatefulSet] + +// StatefulSetDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for StatefulSet. +type StatefulSetDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiappsv1.StatefulSet] + +// StatefulSetFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for StatefulSet. +type StatefulSetFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiappsv1.StatefulSet] + +// StatefulSetIndexers is a specialization of [cache.TypedIndexers] for StatefulSet. +type StatefulSetIndexers = cache.TypedIndexers[*apiappsv1.StatefulSet] + +// DeletedStatefulSet is a specialization of [cache.DeletedObject] for StatefulSet. +type DeletedStatefulSet = cache.DeletedObject[*apiappsv1.StatefulSet] + type statefulSetInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type statefulSetInformer struct { // NewStatefulSetInformer constructs a new informer for StatefulSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedStatefulSetInformer]). func NewStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers StatefulSetIndexers) StatefulSetIndexInformer { + return NewTypedStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredStatefulSetInformer constructs a new informer for StatefulSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredStatefulSetInformer]). func NewFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers StatefulSetIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) StatefulSetIndexInformer { + return NewTypedStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewStatefulSetInformerWithOptions constructs a new informer for StatefulSet type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedStatefulSetInformerWithOptions]). func NewStatefulSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedStatefulSetInformerWithOptions(client, namespace, options) +} + +// NewTypedStatefulSetInformerWithOptions constructs a new informer for StatefulSet type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedStatefulSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) StatefulSetIndexInformer { gvr := schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "statefulsets"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiappsv1.StatefulSet](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewStatefulSetInformerWithOptions(client kubernetes.Interface, namespace st Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *statefulSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewStatefulSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedStatefulSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiappsv1.StatefulSet{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *statefulSetInformer) TypedInformer() StatefulSetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1.StatefulSet](f.factory.InformerFor(&apiappsv1.StatefulSet{}, f.defaultInformer)) } func (f *statefulSetInformer) Lister() appsv1.StatefulSetLister { return appsv1.NewStatefulSetLister(f.Informer().GetIndexer()) } + +// ToTypedStatefulSetInformer converts an untyped informer into a TypedStatefulSetInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *StatefulSet. If that is not the case, calling type-safe methods of the returned +// TypedStatefulSetInformer leads to runtime panics. A safer alternative is to pass +// around a TypedStatefulSetInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedStatefulSetInformer(informer StatefulSetInformer) TypedStatefulSetInformer { + if informer, ok := informer.(TypedStatefulSetInformer); ok { + return informer + } + return &statefulSetTypedInformerAdapter{informer} +} + +type statefulSetTypedInformerAdapter struct { + StatefulSetInformer +} + +func (a *statefulSetTypedInformerAdapter) TypedInformer() StatefulSetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1.StatefulSet](a.Informer()) +} + +// ToStatefulSetIndexInformer converts an untyped informer into a StatefulSetIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *StatefulSet. If that is not the case, calling type-safe methods of the returned +// StatefulSetIndexInformer leads to runtime panics. A safer alternative is to pass +// around a StatefulSetIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToStatefulSetIndexInformer(informer cache.SharedIndexInformer) StatefulSetIndexInformer { + if informer, ok := informer.(StatefulSetIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiappsv1.StatefulSet](informer) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go b/vendor/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go index ee3b156e02..02215f9004 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go +++ b/vendor/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go @@ -34,12 +34,40 @@ import ( ) // ControllerRevisionInformer provides access to a shared informer and lister for -// ControllerRevisions. +// ControllerRevisions. Prefer using the type-safe variant (see [TypedControllerRevisionInformer]). type ControllerRevisionInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1beta1.ControllerRevisionLister } +// TypedControllerRevisionInformer provides access to a shared informer and lister for +// ControllerRevisions, including the type-safe TypedInformer variant. +// It is a superset of ControllerRevisionInformer. +type TypedControllerRevisionInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ControllerRevisionIndexInformer + Lister() appsv1beta1.ControllerRevisionLister +} + +// ControllerRevisionIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ControllerRevisionIndexInformer cache.TypedSharedIndexInformer[*apiappsv1beta1.ControllerRevision] + +// ControllerRevisionHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ControllerRevision. +type ControllerRevisionHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiappsv1beta1.ControllerRevision] + +// ControllerRevisionDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ControllerRevision. +type ControllerRevisionDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiappsv1beta1.ControllerRevision] + +// ControllerRevisionFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ControllerRevision. +type ControllerRevisionFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiappsv1beta1.ControllerRevision] + +// ControllerRevisionIndexers is a specialization of [cache.TypedIndexers] for ControllerRevision. +type ControllerRevisionIndexers = cache.TypedIndexers[*apiappsv1beta1.ControllerRevision] + +// DeletedControllerRevision is a specialization of [cache.DeletedObject] for ControllerRevision. +type DeletedControllerRevision = cache.DeletedObject[*apiappsv1beta1.ControllerRevision] + type controllerRevisionInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type controllerRevisionInformer struct { // NewControllerRevisionInformer constructs a new informer for ControllerRevision type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedControllerRevisionInformer]). func NewControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ControllerRevisionIndexers) ControllerRevisionIndexInformer { + return NewTypedControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredControllerRevisionInformer]). func NewFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ControllerRevisionIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ControllerRevisionIndexInformer { + return NewTypedControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewControllerRevisionInformerWithOptions constructs a new informer for ControllerRevision type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedControllerRevisionInformerWithOptions]). func NewControllerRevisionInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedControllerRevisionInformerWithOptions(client, namespace, options) +} + +// NewTypedControllerRevisionInformerWithOptions constructs a new informer for ControllerRevision type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedControllerRevisionInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) ControllerRevisionIndexInformer { gvr := schema.GroupVersionResource{Group: "apps", Version: "v1beta1", Resource: "controllerrevisions"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiappsv1beta1.ControllerRevision](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewControllerRevisionInformerWithOptions(client kubernetes.Interface, names Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *controllerRevisionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewControllerRevisionInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedControllerRevisionInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiappsv1beta1.ControllerRevision{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *controllerRevisionInformer) TypedInformer() ControllerRevisionIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1beta1.ControllerRevision](f.factory.InformerFor(&apiappsv1beta1.ControllerRevision{}, f.defaultInformer)) } func (f *controllerRevisionInformer) Lister() appsv1beta1.ControllerRevisionLister { return appsv1beta1.NewControllerRevisionLister(f.Informer().GetIndexer()) } + +// ToTypedControllerRevisionInformer converts an untyped informer into a TypedControllerRevisionInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ControllerRevision. If that is not the case, calling type-safe methods of the returned +// TypedControllerRevisionInformer leads to runtime panics. A safer alternative is to pass +// around a TypedControllerRevisionInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedControllerRevisionInformer(informer ControllerRevisionInformer) TypedControllerRevisionInformer { + if informer, ok := informer.(TypedControllerRevisionInformer); ok { + return informer + } + return &controllerRevisionTypedInformerAdapter{informer} +} + +type controllerRevisionTypedInformerAdapter struct { + ControllerRevisionInformer +} + +func (a *controllerRevisionTypedInformerAdapter) TypedInformer() ControllerRevisionIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1beta1.ControllerRevision](a.Informer()) +} + +// ToControllerRevisionIndexInformer converts an untyped informer into a ControllerRevisionIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ControllerRevision. If that is not the case, calling type-safe methods of the returned +// ControllerRevisionIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ControllerRevisionIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToControllerRevisionIndexInformer(informer cache.SharedIndexInformer) ControllerRevisionIndexInformer { + if informer, ok := informer.(ControllerRevisionIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiappsv1beta1.ControllerRevision](informer) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta1/deployment.go b/vendor/k8s.io/client-go/informers/apps/v1beta1/deployment.go index 699375e3e1..c29a3b39b6 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1beta1/deployment.go +++ b/vendor/k8s.io/client-go/informers/apps/v1beta1/deployment.go @@ -34,12 +34,40 @@ import ( ) // DeploymentInformer provides access to a shared informer and lister for -// Deployments. +// Deployments. Prefer using the type-safe variant (see [TypedDeploymentInformer]). type DeploymentInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1beta1.DeploymentLister } +// TypedDeploymentInformer provides access to a shared informer and lister for +// Deployments, including the type-safe TypedInformer variant. +// It is a superset of DeploymentInformer. +type TypedDeploymentInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() DeploymentIndexInformer + Lister() appsv1beta1.DeploymentLister +} + +// DeploymentIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type DeploymentIndexInformer cache.TypedSharedIndexInformer[*apiappsv1beta1.Deployment] + +// DeploymentHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Deployment. +type DeploymentHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiappsv1beta1.Deployment] + +// DeploymentDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Deployment. +type DeploymentDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiappsv1beta1.Deployment] + +// DeploymentFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Deployment. +type DeploymentFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiappsv1beta1.Deployment] + +// DeploymentIndexers is a specialization of [cache.TypedIndexers] for Deployment. +type DeploymentIndexers = cache.TypedIndexers[*apiappsv1beta1.Deployment] + +// DeletedDeployment is a specialization of [cache.DeletedObject] for Deployment. +type DeletedDeployment = cache.DeletedObject[*apiappsv1beta1.Deployment] + type deploymentInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type deploymentInformer struct { // NewDeploymentInformer constructs a new informer for Deployment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeploymentInformer]). func NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers DeploymentIndexers) DeploymentIndexInformer { + return NewTypedDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredDeploymentInformer constructs a new informer for Deployment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredDeploymentInformer]). func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers DeploymentIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) DeploymentIndexInformer { + return NewTypedDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewDeploymentInformerWithOptions constructs a new informer for Deployment type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeploymentInformerWithOptions]). func NewDeploymentInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedDeploymentInformerWithOptions(client, namespace, options) +} + +// NewTypedDeploymentInformerWithOptions constructs a new informer for Deployment type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeploymentInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) DeploymentIndexInformer { gvr := schema.GroupVersionResource{Group: "apps", Version: "v1beta1", Resource: "deployments"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiappsv1beta1.Deployment](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewDeploymentInformerWithOptions(client kubernetes.Interface, namespace str Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewDeploymentInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedDeploymentInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *deploymentInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiappsv1beta1.Deployment{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *deploymentInformer) TypedInformer() DeploymentIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1beta1.Deployment](f.factory.InformerFor(&apiappsv1beta1.Deployment{}, f.defaultInformer)) } func (f *deploymentInformer) Lister() appsv1beta1.DeploymentLister { return appsv1beta1.NewDeploymentLister(f.Informer().GetIndexer()) } + +// ToTypedDeploymentInformer converts an untyped informer into a TypedDeploymentInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Deployment. If that is not the case, calling type-safe methods of the returned +// TypedDeploymentInformer leads to runtime panics. A safer alternative is to pass +// around a TypedDeploymentInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedDeploymentInformer(informer DeploymentInformer) TypedDeploymentInformer { + if informer, ok := informer.(TypedDeploymentInformer); ok { + return informer + } + return &deploymentTypedInformerAdapter{informer} +} + +type deploymentTypedInformerAdapter struct { + DeploymentInformer +} + +func (a *deploymentTypedInformerAdapter) TypedInformer() DeploymentIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1beta1.Deployment](a.Informer()) +} + +// ToDeploymentIndexInformer converts an untyped informer into a DeploymentIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Deployment. If that is not the case, calling type-safe methods of the returned +// DeploymentIndexInformer leads to runtime panics. A safer alternative is to pass +// around a DeploymentIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToDeploymentIndexInformer(informer cache.SharedIndexInformer) DeploymentIndexInformer { + if informer, ok := informer.(DeploymentIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiappsv1beta1.Deployment](informer) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/apps/v1beta1/interface.go index 326939cd12..4a4d87e930 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1beta1/interface.go +++ b/vendor/k8s.io/client-go/informers/apps/v1beta1/interface.go @@ -25,11 +25,11 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // ControllerRevisions returns a ControllerRevisionInformer. - ControllerRevisions() ControllerRevisionInformer + ControllerRevisions() TypedControllerRevisionInformer // Deployments returns a DeploymentInformer. - Deployments() DeploymentInformer + Deployments() TypedDeploymentInformer // StatefulSets returns a StatefulSetInformer. - StatefulSets() StatefulSetInformer + StatefulSets() TypedStatefulSetInformer } type version struct { @@ -43,17 +43,17 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// ControllerRevisions returns a ControllerRevisionInformer. -func (v *version) ControllerRevisions() ControllerRevisionInformer { +// ControllerRevisions returns a TypedControllerRevisionInformer. +func (v *version) ControllerRevisions() TypedControllerRevisionInformer { return &controllerRevisionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// Deployments returns a DeploymentInformer. -func (v *version) Deployments() DeploymentInformer { +// Deployments returns a TypedDeploymentInformer. +func (v *version) Deployments() TypedDeploymentInformer { return &deploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// StatefulSets returns a StatefulSetInformer. -func (v *version) StatefulSets() StatefulSetInformer { +// StatefulSets returns a TypedStatefulSetInformer. +func (v *version) StatefulSets() TypedStatefulSetInformer { return &statefulSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta1/statefulset.go b/vendor/k8s.io/client-go/informers/apps/v1beta1/statefulset.go index 480e68f9d1..ad9dc2d3bd 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1beta1/statefulset.go +++ b/vendor/k8s.io/client-go/informers/apps/v1beta1/statefulset.go @@ -34,12 +34,40 @@ import ( ) // StatefulSetInformer provides access to a shared informer and lister for -// StatefulSets. +// StatefulSets. Prefer using the type-safe variant (see [TypedStatefulSetInformer]). type StatefulSetInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1beta1.StatefulSetLister } +// TypedStatefulSetInformer provides access to a shared informer and lister for +// StatefulSets, including the type-safe TypedInformer variant. +// It is a superset of StatefulSetInformer. +type TypedStatefulSetInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() StatefulSetIndexInformer + Lister() appsv1beta1.StatefulSetLister +} + +// StatefulSetIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type StatefulSetIndexInformer cache.TypedSharedIndexInformer[*apiappsv1beta1.StatefulSet] + +// StatefulSetHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for StatefulSet. +type StatefulSetHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiappsv1beta1.StatefulSet] + +// StatefulSetDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for StatefulSet. +type StatefulSetDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiappsv1beta1.StatefulSet] + +// StatefulSetFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for StatefulSet. +type StatefulSetFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiappsv1beta1.StatefulSet] + +// StatefulSetIndexers is a specialization of [cache.TypedIndexers] for StatefulSet. +type StatefulSetIndexers = cache.TypedIndexers[*apiappsv1beta1.StatefulSet] + +// DeletedStatefulSet is a specialization of [cache.DeletedObject] for StatefulSet. +type DeletedStatefulSet = cache.DeletedObject[*apiappsv1beta1.StatefulSet] + type statefulSetInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type statefulSetInformer struct { // NewStatefulSetInformer constructs a new informer for StatefulSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedStatefulSetInformer]). func NewStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers StatefulSetIndexers) StatefulSetIndexInformer { + return NewTypedStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredStatefulSetInformer constructs a new informer for StatefulSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredStatefulSetInformer]). func NewFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers StatefulSetIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) StatefulSetIndexInformer { + return NewTypedStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewStatefulSetInformerWithOptions constructs a new informer for StatefulSet type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedStatefulSetInformerWithOptions]). func NewStatefulSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedStatefulSetInformerWithOptions(client, namespace, options) +} + +// NewTypedStatefulSetInformerWithOptions constructs a new informer for StatefulSet type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedStatefulSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) StatefulSetIndexInformer { gvr := schema.GroupVersionResource{Group: "apps", Version: "v1beta1", Resource: "statefulsets"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiappsv1beta1.StatefulSet](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewStatefulSetInformerWithOptions(client kubernetes.Interface, namespace st Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *statefulSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewStatefulSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedStatefulSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiappsv1beta1.StatefulSet{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *statefulSetInformer) TypedInformer() StatefulSetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1beta1.StatefulSet](f.factory.InformerFor(&apiappsv1beta1.StatefulSet{}, f.defaultInformer)) } func (f *statefulSetInformer) Lister() appsv1beta1.StatefulSetLister { return appsv1beta1.NewStatefulSetLister(f.Informer().GetIndexer()) } + +// ToTypedStatefulSetInformer converts an untyped informer into a TypedStatefulSetInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *StatefulSet. If that is not the case, calling type-safe methods of the returned +// TypedStatefulSetInformer leads to runtime panics. A safer alternative is to pass +// around a TypedStatefulSetInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedStatefulSetInformer(informer StatefulSetInformer) TypedStatefulSetInformer { + if informer, ok := informer.(TypedStatefulSetInformer); ok { + return informer + } + return &statefulSetTypedInformerAdapter{informer} +} + +type statefulSetTypedInformerAdapter struct { + StatefulSetInformer +} + +func (a *statefulSetTypedInformerAdapter) TypedInformer() StatefulSetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1beta1.StatefulSet](a.Informer()) +} + +// ToStatefulSetIndexInformer converts an untyped informer into a StatefulSetIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *StatefulSet. If that is not the case, calling type-safe methods of the returned +// StatefulSetIndexInformer leads to runtime panics. A safer alternative is to pass +// around a StatefulSetIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToStatefulSetIndexInformer(informer cache.SharedIndexInformer) StatefulSetIndexInformer { + if informer, ok := informer.(StatefulSetIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiappsv1beta1.StatefulSet](informer) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go index 41e3bf1563..0d686ae442 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go @@ -34,12 +34,40 @@ import ( ) // ControllerRevisionInformer provides access to a shared informer and lister for -// ControllerRevisions. +// ControllerRevisions. Prefer using the type-safe variant (see [TypedControllerRevisionInformer]). type ControllerRevisionInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1beta2.ControllerRevisionLister } +// TypedControllerRevisionInformer provides access to a shared informer and lister for +// ControllerRevisions, including the type-safe TypedInformer variant. +// It is a superset of ControllerRevisionInformer. +type TypedControllerRevisionInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ControllerRevisionIndexInformer + Lister() appsv1beta2.ControllerRevisionLister +} + +// ControllerRevisionIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ControllerRevisionIndexInformer cache.TypedSharedIndexInformer[*apiappsv1beta2.ControllerRevision] + +// ControllerRevisionHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ControllerRevision. +type ControllerRevisionHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiappsv1beta2.ControllerRevision] + +// ControllerRevisionDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ControllerRevision. +type ControllerRevisionDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiappsv1beta2.ControllerRevision] + +// ControllerRevisionFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ControllerRevision. +type ControllerRevisionFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiappsv1beta2.ControllerRevision] + +// ControllerRevisionIndexers is a specialization of [cache.TypedIndexers] for ControllerRevision. +type ControllerRevisionIndexers = cache.TypedIndexers[*apiappsv1beta2.ControllerRevision] + +// DeletedControllerRevision is a specialization of [cache.DeletedObject] for ControllerRevision. +type DeletedControllerRevision = cache.DeletedObject[*apiappsv1beta2.ControllerRevision] + type controllerRevisionInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type controllerRevisionInformer struct { // NewControllerRevisionInformer constructs a new informer for ControllerRevision type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedControllerRevisionInformer]). func NewControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ControllerRevisionIndexers) ControllerRevisionIndexInformer { + return NewTypedControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredControllerRevisionInformer]). func NewFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ControllerRevisionIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ControllerRevisionIndexInformer { + return NewTypedControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewControllerRevisionInformerWithOptions constructs a new informer for ControllerRevision type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedControllerRevisionInformerWithOptions]). func NewControllerRevisionInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedControllerRevisionInformerWithOptions(client, namespace, options) +} + +// NewTypedControllerRevisionInformerWithOptions constructs a new informer for ControllerRevision type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedControllerRevisionInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) ControllerRevisionIndexInformer { gvr := schema.GroupVersionResource{Group: "apps", Version: "v1beta2", Resource: "controllerrevisions"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.ControllerRevision](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewControllerRevisionInformerWithOptions(client kubernetes.Interface, names Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *controllerRevisionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewControllerRevisionInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedControllerRevisionInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiappsv1beta2.ControllerRevision{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *controllerRevisionInformer) TypedInformer() ControllerRevisionIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.ControllerRevision](f.factory.InformerFor(&apiappsv1beta2.ControllerRevision{}, f.defaultInformer)) } func (f *controllerRevisionInformer) Lister() appsv1beta2.ControllerRevisionLister { return appsv1beta2.NewControllerRevisionLister(f.Informer().GetIndexer()) } + +// ToTypedControllerRevisionInformer converts an untyped informer into a TypedControllerRevisionInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ControllerRevision. If that is not the case, calling type-safe methods of the returned +// TypedControllerRevisionInformer leads to runtime panics. A safer alternative is to pass +// around a TypedControllerRevisionInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedControllerRevisionInformer(informer ControllerRevisionInformer) TypedControllerRevisionInformer { + if informer, ok := informer.(TypedControllerRevisionInformer); ok { + return informer + } + return &controllerRevisionTypedInformerAdapter{informer} +} + +type controllerRevisionTypedInformerAdapter struct { + ControllerRevisionInformer +} + +func (a *controllerRevisionTypedInformerAdapter) TypedInformer() ControllerRevisionIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.ControllerRevision](a.Informer()) +} + +// ToControllerRevisionIndexInformer converts an untyped informer into a ControllerRevisionIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ControllerRevision. If that is not the case, calling type-safe methods of the returned +// ControllerRevisionIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ControllerRevisionIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToControllerRevisionIndexInformer(informer cache.SharedIndexInformer) ControllerRevisionIndexInformer { + if informer, ok := informer.(ControllerRevisionIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.ControllerRevision](informer) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/daemonset.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/daemonset.go index 5c339a78a0..16c73e28fc 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1beta2/daemonset.go +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/daemonset.go @@ -34,12 +34,40 @@ import ( ) // DaemonSetInformer provides access to a shared informer and lister for -// DaemonSets. +// DaemonSets. Prefer using the type-safe variant (see [TypedDaemonSetInformer]). type DaemonSetInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1beta2.DaemonSetLister } +// TypedDaemonSetInformer provides access to a shared informer and lister for +// DaemonSets, including the type-safe TypedInformer variant. +// It is a superset of DaemonSetInformer. +type TypedDaemonSetInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() DaemonSetIndexInformer + Lister() appsv1beta2.DaemonSetLister +} + +// DaemonSetIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type DaemonSetIndexInformer cache.TypedSharedIndexInformer[*apiappsv1beta2.DaemonSet] + +// DaemonSetHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for DaemonSet. +type DaemonSetHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiappsv1beta2.DaemonSet] + +// DaemonSetDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for DaemonSet. +type DaemonSetDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiappsv1beta2.DaemonSet] + +// DaemonSetFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for DaemonSet. +type DaemonSetFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiappsv1beta2.DaemonSet] + +// DaemonSetIndexers is a specialization of [cache.TypedIndexers] for DaemonSet. +type DaemonSetIndexers = cache.TypedIndexers[*apiappsv1beta2.DaemonSet] + +// DeletedDaemonSet is a specialization of [cache.DeletedObject] for DaemonSet. +type DeletedDaemonSet = cache.DeletedObject[*apiappsv1beta2.DaemonSet] + type daemonSetInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type daemonSetInformer struct { // NewDaemonSetInformer constructs a new informer for DaemonSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDaemonSetInformer]). func NewDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers DaemonSetIndexers) DaemonSetIndexInformer { + return NewTypedDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredDaemonSetInformer constructs a new informer for DaemonSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredDaemonSetInformer]). func NewFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers DaemonSetIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) DaemonSetIndexInformer { + return NewTypedDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewDaemonSetInformerWithOptions constructs a new informer for DaemonSet type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDaemonSetInformerWithOptions]). func NewDaemonSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedDaemonSetInformerWithOptions(client, namespace, options) +} + +// NewTypedDaemonSetInformerWithOptions constructs a new informer for DaemonSet type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDaemonSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) DaemonSetIndexInformer { gvr := schema.GroupVersionResource{Group: "apps", Version: "v1beta2", Resource: "daemonsets"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.DaemonSet](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewDaemonSetInformerWithOptions(client kubernetes.Interface, namespace stri Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *daemonSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewDaemonSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedDaemonSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiappsv1beta2.DaemonSet{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *daemonSetInformer) TypedInformer() DaemonSetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.DaemonSet](f.factory.InformerFor(&apiappsv1beta2.DaemonSet{}, f.defaultInformer)) } func (f *daemonSetInformer) Lister() appsv1beta2.DaemonSetLister { return appsv1beta2.NewDaemonSetLister(f.Informer().GetIndexer()) } + +// ToTypedDaemonSetInformer converts an untyped informer into a TypedDaemonSetInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *DaemonSet. If that is not the case, calling type-safe methods of the returned +// TypedDaemonSetInformer leads to runtime panics. A safer alternative is to pass +// around a TypedDaemonSetInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedDaemonSetInformer(informer DaemonSetInformer) TypedDaemonSetInformer { + if informer, ok := informer.(TypedDaemonSetInformer); ok { + return informer + } + return &daemonSetTypedInformerAdapter{informer} +} + +type daemonSetTypedInformerAdapter struct { + DaemonSetInformer +} + +func (a *daemonSetTypedInformerAdapter) TypedInformer() DaemonSetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.DaemonSet](a.Informer()) +} + +// ToDaemonSetIndexInformer converts an untyped informer into a DaemonSetIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *DaemonSet. If that is not the case, calling type-safe methods of the returned +// DaemonSetIndexInformer leads to runtime panics. A safer alternative is to pass +// around a DaemonSetIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToDaemonSetIndexInformer(informer cache.SharedIndexInformer) DaemonSetIndexInformer { + if informer, ok := informer.(DaemonSetIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.DaemonSet](informer) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/deployment.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/deployment.go index 1e0b64cb28..04743e3276 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1beta2/deployment.go +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/deployment.go @@ -34,12 +34,40 @@ import ( ) // DeploymentInformer provides access to a shared informer and lister for -// Deployments. +// Deployments. Prefer using the type-safe variant (see [TypedDeploymentInformer]). type DeploymentInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1beta2.DeploymentLister } +// TypedDeploymentInformer provides access to a shared informer and lister for +// Deployments, including the type-safe TypedInformer variant. +// It is a superset of DeploymentInformer. +type TypedDeploymentInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() DeploymentIndexInformer + Lister() appsv1beta2.DeploymentLister +} + +// DeploymentIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type DeploymentIndexInformer cache.TypedSharedIndexInformer[*apiappsv1beta2.Deployment] + +// DeploymentHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Deployment. +type DeploymentHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiappsv1beta2.Deployment] + +// DeploymentDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Deployment. +type DeploymentDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiappsv1beta2.Deployment] + +// DeploymentFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Deployment. +type DeploymentFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiappsv1beta2.Deployment] + +// DeploymentIndexers is a specialization of [cache.TypedIndexers] for Deployment. +type DeploymentIndexers = cache.TypedIndexers[*apiappsv1beta2.Deployment] + +// DeletedDeployment is a specialization of [cache.DeletedObject] for Deployment. +type DeletedDeployment = cache.DeletedObject[*apiappsv1beta2.Deployment] + type deploymentInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type deploymentInformer struct { // NewDeploymentInformer constructs a new informer for Deployment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeploymentInformer]). func NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers DeploymentIndexers) DeploymentIndexInformer { + return NewTypedDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredDeploymentInformer constructs a new informer for Deployment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredDeploymentInformer]). func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers DeploymentIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) DeploymentIndexInformer { + return NewTypedDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewDeploymentInformerWithOptions constructs a new informer for Deployment type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeploymentInformerWithOptions]). func NewDeploymentInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedDeploymentInformerWithOptions(client, namespace, options) +} + +// NewTypedDeploymentInformerWithOptions constructs a new informer for Deployment type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeploymentInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) DeploymentIndexInformer { gvr := schema.GroupVersionResource{Group: "apps", Version: "v1beta2", Resource: "deployments"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.Deployment](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewDeploymentInformerWithOptions(client kubernetes.Interface, namespace str Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewDeploymentInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedDeploymentInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *deploymentInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiappsv1beta2.Deployment{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *deploymentInformer) TypedInformer() DeploymentIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.Deployment](f.factory.InformerFor(&apiappsv1beta2.Deployment{}, f.defaultInformer)) } func (f *deploymentInformer) Lister() appsv1beta2.DeploymentLister { return appsv1beta2.NewDeploymentLister(f.Informer().GetIndexer()) } + +// ToTypedDeploymentInformer converts an untyped informer into a TypedDeploymentInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Deployment. If that is not the case, calling type-safe methods of the returned +// TypedDeploymentInformer leads to runtime panics. A safer alternative is to pass +// around a TypedDeploymentInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedDeploymentInformer(informer DeploymentInformer) TypedDeploymentInformer { + if informer, ok := informer.(TypedDeploymentInformer); ok { + return informer + } + return &deploymentTypedInformerAdapter{informer} +} + +type deploymentTypedInformerAdapter struct { + DeploymentInformer +} + +func (a *deploymentTypedInformerAdapter) TypedInformer() DeploymentIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.Deployment](a.Informer()) +} + +// ToDeploymentIndexInformer converts an untyped informer into a DeploymentIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Deployment. If that is not the case, calling type-safe methods of the returned +// DeploymentIndexInformer leads to runtime panics. A safer alternative is to pass +// around a DeploymentIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToDeploymentIndexInformer(informer cache.SharedIndexInformer) DeploymentIndexInformer { + if informer, ok := informer.(DeploymentIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.Deployment](informer) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/interface.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/interface.go index ded89bd5be..b00e797b9a 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1beta2/interface.go +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/interface.go @@ -25,15 +25,15 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // ControllerRevisions returns a ControllerRevisionInformer. - ControllerRevisions() ControllerRevisionInformer + ControllerRevisions() TypedControllerRevisionInformer // DaemonSets returns a DaemonSetInformer. - DaemonSets() DaemonSetInformer + DaemonSets() TypedDaemonSetInformer // Deployments returns a DeploymentInformer. - Deployments() DeploymentInformer + Deployments() TypedDeploymentInformer // ReplicaSets returns a ReplicaSetInformer. - ReplicaSets() ReplicaSetInformer + ReplicaSets() TypedReplicaSetInformer // StatefulSets returns a StatefulSetInformer. - StatefulSets() StatefulSetInformer + StatefulSets() TypedStatefulSetInformer } type version struct { @@ -47,27 +47,27 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// ControllerRevisions returns a ControllerRevisionInformer. -func (v *version) ControllerRevisions() ControllerRevisionInformer { +// ControllerRevisions returns a TypedControllerRevisionInformer. +func (v *version) ControllerRevisions() TypedControllerRevisionInformer { return &controllerRevisionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// DaemonSets returns a DaemonSetInformer. -func (v *version) DaemonSets() DaemonSetInformer { +// DaemonSets returns a TypedDaemonSetInformer. +func (v *version) DaemonSets() TypedDaemonSetInformer { return &daemonSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// Deployments returns a DeploymentInformer. -func (v *version) Deployments() DeploymentInformer { +// Deployments returns a TypedDeploymentInformer. +func (v *version) Deployments() TypedDeploymentInformer { return &deploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// ReplicaSets returns a ReplicaSetInformer. -func (v *version) ReplicaSets() ReplicaSetInformer { +// ReplicaSets returns a TypedReplicaSetInformer. +func (v *version) ReplicaSets() TypedReplicaSetInformer { return &replicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// StatefulSets returns a StatefulSetInformer. -func (v *version) StatefulSets() StatefulSetInformer { +// StatefulSets returns a TypedStatefulSetInformer. +func (v *version) StatefulSets() TypedStatefulSetInformer { return &statefulSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/replicaset.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/replicaset.go index 425ad55333..3ee75c1621 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1beta2/replicaset.go +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/replicaset.go @@ -34,12 +34,40 @@ import ( ) // ReplicaSetInformer provides access to a shared informer and lister for -// ReplicaSets. +// ReplicaSets. Prefer using the type-safe variant (see [TypedReplicaSetInformer]). type ReplicaSetInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1beta2.ReplicaSetLister } +// TypedReplicaSetInformer provides access to a shared informer and lister for +// ReplicaSets, including the type-safe TypedInformer variant. +// It is a superset of ReplicaSetInformer. +type TypedReplicaSetInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ReplicaSetIndexInformer + Lister() appsv1beta2.ReplicaSetLister +} + +// ReplicaSetIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ReplicaSetIndexInformer cache.TypedSharedIndexInformer[*apiappsv1beta2.ReplicaSet] + +// ReplicaSetHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ReplicaSet. +type ReplicaSetHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiappsv1beta2.ReplicaSet] + +// ReplicaSetDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ReplicaSet. +type ReplicaSetDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiappsv1beta2.ReplicaSet] + +// ReplicaSetFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ReplicaSet. +type ReplicaSetFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiappsv1beta2.ReplicaSet] + +// ReplicaSetIndexers is a specialization of [cache.TypedIndexers] for ReplicaSet. +type ReplicaSetIndexers = cache.TypedIndexers[*apiappsv1beta2.ReplicaSet] + +// DeletedReplicaSet is a specialization of [cache.DeletedObject] for ReplicaSet. +type DeletedReplicaSet = cache.DeletedObject[*apiappsv1beta2.ReplicaSet] + type replicaSetInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type replicaSetInformer struct { // NewReplicaSetInformer constructs a new informer for ReplicaSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedReplicaSetInformer]). func NewReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ReplicaSetIndexers) ReplicaSetIndexInformer { + return NewTypedReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredReplicaSetInformer]). func NewFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ReplicaSetIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ReplicaSetIndexInformer { + return NewTypedReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewReplicaSetInformerWithOptions constructs a new informer for ReplicaSet type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedReplicaSetInformerWithOptions]). func NewReplicaSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedReplicaSetInformerWithOptions(client, namespace, options) +} + +// NewTypedReplicaSetInformerWithOptions constructs a new informer for ReplicaSet type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedReplicaSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) ReplicaSetIndexInformer { gvr := schema.GroupVersionResource{Group: "apps", Version: "v1beta2", Resource: "replicasets"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.ReplicaSet](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewReplicaSetInformerWithOptions(client kubernetes.Interface, namespace str Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *replicaSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewReplicaSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedReplicaSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiappsv1beta2.ReplicaSet{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *replicaSetInformer) TypedInformer() ReplicaSetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.ReplicaSet](f.factory.InformerFor(&apiappsv1beta2.ReplicaSet{}, f.defaultInformer)) } func (f *replicaSetInformer) Lister() appsv1beta2.ReplicaSetLister { return appsv1beta2.NewReplicaSetLister(f.Informer().GetIndexer()) } + +// ToTypedReplicaSetInformer converts an untyped informer into a TypedReplicaSetInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ReplicaSet. If that is not the case, calling type-safe methods of the returned +// TypedReplicaSetInformer leads to runtime panics. A safer alternative is to pass +// around a TypedReplicaSetInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedReplicaSetInformer(informer ReplicaSetInformer) TypedReplicaSetInformer { + if informer, ok := informer.(TypedReplicaSetInformer); ok { + return informer + } + return &replicaSetTypedInformerAdapter{informer} +} + +type replicaSetTypedInformerAdapter struct { + ReplicaSetInformer +} + +func (a *replicaSetTypedInformerAdapter) TypedInformer() ReplicaSetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.ReplicaSet](a.Informer()) +} + +// ToReplicaSetIndexInformer converts an untyped informer into a ReplicaSetIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ReplicaSet. If that is not the case, calling type-safe methods of the returned +// ReplicaSetIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ReplicaSetIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToReplicaSetIndexInformer(informer cache.SharedIndexInformer) ReplicaSetIndexInformer { + if informer, ok := informer.(ReplicaSetIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.ReplicaSet](informer) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/statefulset.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/statefulset.go index 0fb22661cf..4b449a9c32 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1beta2/statefulset.go +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/statefulset.go @@ -34,12 +34,40 @@ import ( ) // StatefulSetInformer provides access to a shared informer and lister for -// StatefulSets. +// StatefulSets. Prefer using the type-safe variant (see [TypedStatefulSetInformer]). type StatefulSetInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1beta2.StatefulSetLister } +// TypedStatefulSetInformer provides access to a shared informer and lister for +// StatefulSets, including the type-safe TypedInformer variant. +// It is a superset of StatefulSetInformer. +type TypedStatefulSetInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() StatefulSetIndexInformer + Lister() appsv1beta2.StatefulSetLister +} + +// StatefulSetIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type StatefulSetIndexInformer cache.TypedSharedIndexInformer[*apiappsv1beta2.StatefulSet] + +// StatefulSetHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for StatefulSet. +type StatefulSetHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiappsv1beta2.StatefulSet] + +// StatefulSetDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for StatefulSet. +type StatefulSetDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiappsv1beta2.StatefulSet] + +// StatefulSetFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for StatefulSet. +type StatefulSetFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiappsv1beta2.StatefulSet] + +// StatefulSetIndexers is a specialization of [cache.TypedIndexers] for StatefulSet. +type StatefulSetIndexers = cache.TypedIndexers[*apiappsv1beta2.StatefulSet] + +// DeletedStatefulSet is a specialization of [cache.DeletedObject] for StatefulSet. +type DeletedStatefulSet = cache.DeletedObject[*apiappsv1beta2.StatefulSet] + type statefulSetInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type statefulSetInformer struct { // NewStatefulSetInformer constructs a new informer for StatefulSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedStatefulSetInformer]). func NewStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers StatefulSetIndexers) StatefulSetIndexInformer { + return NewTypedStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredStatefulSetInformer constructs a new informer for StatefulSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredStatefulSetInformer]). func NewFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers StatefulSetIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) StatefulSetIndexInformer { + return NewTypedStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewStatefulSetInformerWithOptions constructs a new informer for StatefulSet type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedStatefulSetInformerWithOptions]). func NewStatefulSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedStatefulSetInformerWithOptions(client, namespace, options) +} + +// NewTypedStatefulSetInformerWithOptions constructs a new informer for StatefulSet type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedStatefulSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) StatefulSetIndexInformer { gvr := schema.GroupVersionResource{Group: "apps", Version: "v1beta2", Resource: "statefulsets"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.StatefulSet](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewStatefulSetInformerWithOptions(client kubernetes.Interface, namespace st Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *statefulSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewStatefulSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedStatefulSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiappsv1beta2.StatefulSet{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *statefulSetInformer) TypedInformer() StatefulSetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.StatefulSet](f.factory.InformerFor(&apiappsv1beta2.StatefulSet{}, f.defaultInformer)) } func (f *statefulSetInformer) Lister() appsv1beta2.StatefulSetLister { return appsv1beta2.NewStatefulSetLister(f.Informer().GetIndexer()) } + +// ToTypedStatefulSetInformer converts an untyped informer into a TypedStatefulSetInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *StatefulSet. If that is not the case, calling type-safe methods of the returned +// TypedStatefulSetInformer leads to runtime panics. A safer alternative is to pass +// around a TypedStatefulSetInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedStatefulSetInformer(informer StatefulSetInformer) TypedStatefulSetInformer { + if informer, ok := informer.(TypedStatefulSetInformer); ok { + return informer + } + return &statefulSetTypedInformerAdapter{informer} +} + +type statefulSetTypedInformerAdapter struct { + StatefulSetInformer +} + +func (a *statefulSetTypedInformerAdapter) TypedInformer() StatefulSetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.StatefulSet](a.Informer()) +} + +// ToStatefulSetIndexInformer converts an untyped informer into a StatefulSetIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *StatefulSet. If that is not the case, calling type-safe methods of the returned +// StatefulSetIndexInformer leads to runtime panics. A safer alternative is to pass +// around a StatefulSetIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToStatefulSetIndexInformer(informer cache.SharedIndexInformer) StatefulSetIndexInformer { + if informer, ok := informer.(StatefulSetIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiappsv1beta2.StatefulSet](informer) +} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go index e49b035242..e8b5eb54f7 100644 --- a/vendor/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go +++ b/vendor/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go @@ -34,12 +34,40 @@ import ( ) // HorizontalPodAutoscalerInformer provides access to a shared informer and lister for -// HorizontalPodAutoscalers. +// HorizontalPodAutoscalers. Prefer using the type-safe variant (see [TypedHorizontalPodAutoscalerInformer]). type HorizontalPodAutoscalerInformer interface { Informer() cache.SharedIndexInformer Lister() autoscalingv1.HorizontalPodAutoscalerLister } +// TypedHorizontalPodAutoscalerInformer provides access to a shared informer and lister for +// HorizontalPodAutoscalers, including the type-safe TypedInformer variant. +// It is a superset of HorizontalPodAutoscalerInformer. +type TypedHorizontalPodAutoscalerInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() HorizontalPodAutoscalerIndexInformer + Lister() autoscalingv1.HorizontalPodAutoscalerLister +} + +// HorizontalPodAutoscalerIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type HorizontalPodAutoscalerIndexInformer cache.TypedSharedIndexInformer[*apiautoscalingv1.HorizontalPodAutoscaler] + +// HorizontalPodAutoscalerHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for HorizontalPodAutoscaler. +type HorizontalPodAutoscalerHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiautoscalingv1.HorizontalPodAutoscaler] + +// HorizontalPodAutoscalerDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for HorizontalPodAutoscaler. +type HorizontalPodAutoscalerDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiautoscalingv1.HorizontalPodAutoscaler] + +// HorizontalPodAutoscalerFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for HorizontalPodAutoscaler. +type HorizontalPodAutoscalerFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiautoscalingv1.HorizontalPodAutoscaler] + +// HorizontalPodAutoscalerIndexers is a specialization of [cache.TypedIndexers] for HorizontalPodAutoscaler. +type HorizontalPodAutoscalerIndexers = cache.TypedIndexers[*apiautoscalingv1.HorizontalPodAutoscaler] + +// DeletedHorizontalPodAutoscaler is a specialization of [cache.DeletedObject] for HorizontalPodAutoscaler. +type DeletedHorizontalPodAutoscaler = cache.DeletedObject[*apiautoscalingv1.HorizontalPodAutoscaler] + type horizontalPodAutoscalerInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type horizontalPodAutoscalerInformer struct { // NewHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedHorizontalPodAutoscalerInformer]). func NewHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewHorizontalPodAutoscalerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers HorizontalPodAutoscalerIndexers) HorizontalPodAutoscalerIndexInformer { + return NewTypedHorizontalPodAutoscalerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredHorizontalPodAutoscalerInformer]). func NewFilteredHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewHorizontalPodAutoscalerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedHorizontalPodAutoscalerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers HorizontalPodAutoscalerIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) HorizontalPodAutoscalerIndexInformer { + return NewTypedHorizontalPodAutoscalerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewHorizontalPodAutoscalerInformerWithOptions constructs a new informer for HorizontalPodAutoscaler type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedHorizontalPodAutoscalerInformerWithOptions]). func NewHorizontalPodAutoscalerInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedHorizontalPodAutoscalerInformerWithOptions(client, namespace, options) +} + +// NewTypedHorizontalPodAutoscalerInformerWithOptions constructs a new informer for HorizontalPodAutoscaler type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedHorizontalPodAutoscalerInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) HorizontalPodAutoscalerIndexInformer { gvr := schema.GroupVersionResource{Group: "autoscaling", Version: "v1", Resource: "horizontalpodautoscalers"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiautoscalingv1.HorizontalPodAutoscaler](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewHorizontalPodAutoscalerInformerWithOptions(client kubernetes.Interface, Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *horizontalPodAutoscalerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewHorizontalPodAutoscalerInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedHorizontalPodAutoscalerInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *horizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiautoscalingv1.HorizontalPodAutoscaler{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *horizontalPodAutoscalerInformer) TypedInformer() HorizontalPodAutoscalerIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiautoscalingv1.HorizontalPodAutoscaler](f.factory.InformerFor(&apiautoscalingv1.HorizontalPodAutoscaler{}, f.defaultInformer)) } func (f *horizontalPodAutoscalerInformer) Lister() autoscalingv1.HorizontalPodAutoscalerLister { return autoscalingv1.NewHorizontalPodAutoscalerLister(f.Informer().GetIndexer()) } + +// ToTypedHorizontalPodAutoscalerInformer converts an untyped informer into a TypedHorizontalPodAutoscalerInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *HorizontalPodAutoscaler. If that is not the case, calling type-safe methods of the returned +// TypedHorizontalPodAutoscalerInformer leads to runtime panics. A safer alternative is to pass +// around a TypedHorizontalPodAutoscalerInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedHorizontalPodAutoscalerInformer(informer HorizontalPodAutoscalerInformer) TypedHorizontalPodAutoscalerInformer { + if informer, ok := informer.(TypedHorizontalPodAutoscalerInformer); ok { + return informer + } + return &horizontalPodAutoscalerTypedInformerAdapter{informer} +} + +type horizontalPodAutoscalerTypedInformerAdapter struct { + HorizontalPodAutoscalerInformer +} + +func (a *horizontalPodAutoscalerTypedInformerAdapter) TypedInformer() HorizontalPodAutoscalerIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiautoscalingv1.HorizontalPodAutoscaler](a.Informer()) +} + +// ToHorizontalPodAutoscalerIndexInformer converts an untyped informer into a HorizontalPodAutoscalerIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *HorizontalPodAutoscaler. If that is not the case, calling type-safe methods of the returned +// HorizontalPodAutoscalerIndexInformer leads to runtime panics. A safer alternative is to pass +// around a HorizontalPodAutoscalerIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToHorizontalPodAutoscalerIndexInformer(informer cache.SharedIndexInformer) HorizontalPodAutoscalerIndexInformer { + if informer, ok := informer.(HorizontalPodAutoscalerIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiautoscalingv1.HorizontalPodAutoscaler](informer) +} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v1/interface.go b/vendor/k8s.io/client-go/informers/autoscaling/v1/interface.go index 601d0f77f1..730ca89c2a 100644 --- a/vendor/k8s.io/client-go/informers/autoscaling/v1/interface.go +++ b/vendor/k8s.io/client-go/informers/autoscaling/v1/interface.go @@ -25,7 +25,7 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. - HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer + HorizontalPodAutoscalers() TypedHorizontalPodAutoscalerInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. -func (v *version) HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer { +// HorizontalPodAutoscalers returns a TypedHorizontalPodAutoscalerInformer. +func (v *version) HorizontalPodAutoscalers() TypedHorizontalPodAutoscalerInformer { return &horizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v2/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/informers/autoscaling/v2/horizontalpodautoscaler.go index 3605718d08..dbdac3f6d4 100644 --- a/vendor/k8s.io/client-go/informers/autoscaling/v2/horizontalpodautoscaler.go +++ b/vendor/k8s.io/client-go/informers/autoscaling/v2/horizontalpodautoscaler.go @@ -34,12 +34,40 @@ import ( ) // HorizontalPodAutoscalerInformer provides access to a shared informer and lister for -// HorizontalPodAutoscalers. +// HorizontalPodAutoscalers. Prefer using the type-safe variant (see [TypedHorizontalPodAutoscalerInformer]). type HorizontalPodAutoscalerInformer interface { Informer() cache.SharedIndexInformer Lister() autoscalingv2.HorizontalPodAutoscalerLister } +// TypedHorizontalPodAutoscalerInformer provides access to a shared informer and lister for +// HorizontalPodAutoscalers, including the type-safe TypedInformer variant. +// It is a superset of HorizontalPodAutoscalerInformer. +type TypedHorizontalPodAutoscalerInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() HorizontalPodAutoscalerIndexInformer + Lister() autoscalingv2.HorizontalPodAutoscalerLister +} + +// HorizontalPodAutoscalerIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type HorizontalPodAutoscalerIndexInformer cache.TypedSharedIndexInformer[*apiautoscalingv2.HorizontalPodAutoscaler] + +// HorizontalPodAutoscalerHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for HorizontalPodAutoscaler. +type HorizontalPodAutoscalerHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiautoscalingv2.HorizontalPodAutoscaler] + +// HorizontalPodAutoscalerDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for HorizontalPodAutoscaler. +type HorizontalPodAutoscalerDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiautoscalingv2.HorizontalPodAutoscaler] + +// HorizontalPodAutoscalerFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for HorizontalPodAutoscaler. +type HorizontalPodAutoscalerFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiautoscalingv2.HorizontalPodAutoscaler] + +// HorizontalPodAutoscalerIndexers is a specialization of [cache.TypedIndexers] for HorizontalPodAutoscaler. +type HorizontalPodAutoscalerIndexers = cache.TypedIndexers[*apiautoscalingv2.HorizontalPodAutoscaler] + +// DeletedHorizontalPodAutoscaler is a specialization of [cache.DeletedObject] for HorizontalPodAutoscaler. +type DeletedHorizontalPodAutoscaler = cache.DeletedObject[*apiautoscalingv2.HorizontalPodAutoscaler] + type horizontalPodAutoscalerInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type horizontalPodAutoscalerInformer struct { // NewHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedHorizontalPodAutoscalerInformer]). func NewHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewHorizontalPodAutoscalerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers HorizontalPodAutoscalerIndexers) HorizontalPodAutoscalerIndexInformer { + return NewTypedHorizontalPodAutoscalerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredHorizontalPodAutoscalerInformer]). func NewFilteredHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewHorizontalPodAutoscalerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedHorizontalPodAutoscalerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers HorizontalPodAutoscalerIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) HorizontalPodAutoscalerIndexInformer { + return NewTypedHorizontalPodAutoscalerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewHorizontalPodAutoscalerInformerWithOptions constructs a new informer for HorizontalPodAutoscaler type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedHorizontalPodAutoscalerInformerWithOptions]). func NewHorizontalPodAutoscalerInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedHorizontalPodAutoscalerInformerWithOptions(client, namespace, options) +} + +// NewTypedHorizontalPodAutoscalerInformerWithOptions constructs a new informer for HorizontalPodAutoscaler type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedHorizontalPodAutoscalerInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) HorizontalPodAutoscalerIndexInformer { gvr := schema.GroupVersionResource{Group: "autoscaling", Version: "v2", Resource: "horizontalpodautoscalers"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiautoscalingv2.HorizontalPodAutoscaler](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewHorizontalPodAutoscalerInformerWithOptions(client kubernetes.Interface, Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *horizontalPodAutoscalerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewHorizontalPodAutoscalerInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedHorizontalPodAutoscalerInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *horizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiautoscalingv2.HorizontalPodAutoscaler{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *horizontalPodAutoscalerInformer) TypedInformer() HorizontalPodAutoscalerIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiautoscalingv2.HorizontalPodAutoscaler](f.factory.InformerFor(&apiautoscalingv2.HorizontalPodAutoscaler{}, f.defaultInformer)) } func (f *horizontalPodAutoscalerInformer) Lister() autoscalingv2.HorizontalPodAutoscalerLister { return autoscalingv2.NewHorizontalPodAutoscalerLister(f.Informer().GetIndexer()) } + +// ToTypedHorizontalPodAutoscalerInformer converts an untyped informer into a TypedHorizontalPodAutoscalerInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *HorizontalPodAutoscaler. If that is not the case, calling type-safe methods of the returned +// TypedHorizontalPodAutoscalerInformer leads to runtime panics. A safer alternative is to pass +// around a TypedHorizontalPodAutoscalerInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedHorizontalPodAutoscalerInformer(informer HorizontalPodAutoscalerInformer) TypedHorizontalPodAutoscalerInformer { + if informer, ok := informer.(TypedHorizontalPodAutoscalerInformer); ok { + return informer + } + return &horizontalPodAutoscalerTypedInformerAdapter{informer} +} + +type horizontalPodAutoscalerTypedInformerAdapter struct { + HorizontalPodAutoscalerInformer +} + +func (a *horizontalPodAutoscalerTypedInformerAdapter) TypedInformer() HorizontalPodAutoscalerIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiautoscalingv2.HorizontalPodAutoscaler](a.Informer()) +} + +// ToHorizontalPodAutoscalerIndexInformer converts an untyped informer into a HorizontalPodAutoscalerIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *HorizontalPodAutoscaler. If that is not the case, calling type-safe methods of the returned +// HorizontalPodAutoscalerIndexInformer leads to runtime panics. A safer alternative is to pass +// around a HorizontalPodAutoscalerIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToHorizontalPodAutoscalerIndexInformer(informer cache.SharedIndexInformer) HorizontalPodAutoscalerIndexInformer { + if informer, ok := informer.(HorizontalPodAutoscalerIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiautoscalingv2.HorizontalPodAutoscaler](informer) +} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v2/interface.go b/vendor/k8s.io/client-go/informers/autoscaling/v2/interface.go index 2c71908e40..e8b2d14934 100644 --- a/vendor/k8s.io/client-go/informers/autoscaling/v2/interface.go +++ b/vendor/k8s.io/client-go/informers/autoscaling/v2/interface.go @@ -25,7 +25,7 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. - HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer + HorizontalPodAutoscalers() TypedHorizontalPodAutoscalerInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. -func (v *version) HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer { +// HorizontalPodAutoscalers returns a TypedHorizontalPodAutoscalerInformer. +func (v *version) HorizontalPodAutoscalers() TypedHorizontalPodAutoscalerInformer { return &horizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/batch/v1/cronjob.go b/vendor/k8s.io/client-go/informers/batch/v1/cronjob.go index 022710011b..bbd8ebf642 100644 --- a/vendor/k8s.io/client-go/informers/batch/v1/cronjob.go +++ b/vendor/k8s.io/client-go/informers/batch/v1/cronjob.go @@ -34,12 +34,40 @@ import ( ) // CronJobInformer provides access to a shared informer and lister for -// CronJobs. +// CronJobs. Prefer using the type-safe variant (see [TypedCronJobInformer]). type CronJobInformer interface { Informer() cache.SharedIndexInformer Lister() batchv1.CronJobLister } +// TypedCronJobInformer provides access to a shared informer and lister for +// CronJobs, including the type-safe TypedInformer variant. +// It is a superset of CronJobInformer. +type TypedCronJobInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() CronJobIndexInformer + Lister() batchv1.CronJobLister +} + +// CronJobIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type CronJobIndexInformer cache.TypedSharedIndexInformer[*apibatchv1.CronJob] + +// CronJobHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for CronJob. +type CronJobHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apibatchv1.CronJob] + +// CronJobDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for CronJob. +type CronJobDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apibatchv1.CronJob] + +// CronJobFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for CronJob. +type CronJobFilteringHandler = cache.TypedFilteringResourceEventHandler[*apibatchv1.CronJob] + +// CronJobIndexers is a specialization of [cache.TypedIndexers] for CronJob. +type CronJobIndexers = cache.TypedIndexers[*apibatchv1.CronJob] + +// DeletedCronJob is a specialization of [cache.DeletedObject] for CronJob. +type DeletedCronJob = cache.DeletedObject[*apibatchv1.CronJob] + type cronJobInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type cronJobInformer struct { // NewCronJobInformer constructs a new informer for CronJob type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCronJobInformer]). func NewCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewCronJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedCronJobInformer constructs a new informer for CronJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers CronJobIndexers) CronJobIndexInformer { + return NewTypedCronJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredCronJobInformer constructs a new informer for CronJob type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredCronJobInformer]). func NewFilteredCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewCronJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedCronJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredCronJobInformer constructs a new informer for CronJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers CronJobIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) CronJobIndexInformer { + return NewTypedCronJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewCronJobInformerWithOptions constructs a new informer for CronJob type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCronJobInformerWithOptions]). func NewCronJobInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedCronJobInformerWithOptions(client, namespace, options) +} + +// NewTypedCronJobInformerWithOptions constructs a new informer for CronJob type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCronJobInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) CronJobIndexInformer { gvr := schema.GroupVersionResource{Group: "batch", Version: "v1", Resource: "cronjobs"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apibatchv1.CronJob](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewCronJobInformerWithOptions(client kubernetes.Interface, namespace string Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *cronJobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewCronJobInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedCronJobInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *cronJobInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apibatchv1.CronJob{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *cronJobInformer) TypedInformer() CronJobIndexInformer { + return cache.NewTypedSharedIndexInformer[*apibatchv1.CronJob](f.factory.InformerFor(&apibatchv1.CronJob{}, f.defaultInformer)) } func (f *cronJobInformer) Lister() batchv1.CronJobLister { return batchv1.NewCronJobLister(f.Informer().GetIndexer()) } + +// ToTypedCronJobInformer converts an untyped informer into a TypedCronJobInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CronJob. If that is not the case, calling type-safe methods of the returned +// TypedCronJobInformer leads to runtime panics. A safer alternative is to pass +// around a TypedCronJobInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedCronJobInformer(informer CronJobInformer) TypedCronJobInformer { + if informer, ok := informer.(TypedCronJobInformer); ok { + return informer + } + return &cronJobTypedInformerAdapter{informer} +} + +type cronJobTypedInformerAdapter struct { + CronJobInformer +} + +func (a *cronJobTypedInformerAdapter) TypedInformer() CronJobIndexInformer { + return cache.NewTypedSharedIndexInformer[*apibatchv1.CronJob](a.Informer()) +} + +// ToCronJobIndexInformer converts an untyped informer into a CronJobIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CronJob. If that is not the case, calling type-safe methods of the returned +// CronJobIndexInformer leads to runtime panics. A safer alternative is to pass +// around a CronJobIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToCronJobIndexInformer(informer cache.SharedIndexInformer) CronJobIndexInformer { + if informer, ok := informer.(CronJobIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apibatchv1.CronJob](informer) +} diff --git a/vendor/k8s.io/client-go/informers/batch/v1/interface.go b/vendor/k8s.io/client-go/informers/batch/v1/interface.go index 84567fb592..4308f08cb2 100644 --- a/vendor/k8s.io/client-go/informers/batch/v1/interface.go +++ b/vendor/k8s.io/client-go/informers/batch/v1/interface.go @@ -25,9 +25,9 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // CronJobs returns a CronJobInformer. - CronJobs() CronJobInformer + CronJobs() TypedCronJobInformer // Jobs returns a JobInformer. - Jobs() JobInformer + Jobs() TypedJobInformer } type version struct { @@ -41,12 +41,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// CronJobs returns a CronJobInformer. -func (v *version) CronJobs() CronJobInformer { +// CronJobs returns a TypedCronJobInformer. +func (v *version) CronJobs() TypedCronJobInformer { return &cronJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// Jobs returns a JobInformer. -func (v *version) Jobs() JobInformer { +// Jobs returns a TypedJobInformer. +func (v *version) Jobs() TypedJobInformer { return &jobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/batch/v1/job.go b/vendor/k8s.io/client-go/informers/batch/v1/job.go index 97e88927bf..31d9244c1a 100644 --- a/vendor/k8s.io/client-go/informers/batch/v1/job.go +++ b/vendor/k8s.io/client-go/informers/batch/v1/job.go @@ -34,12 +34,40 @@ import ( ) // JobInformer provides access to a shared informer and lister for -// Jobs. +// Jobs. Prefer using the type-safe variant (see [TypedJobInformer]). type JobInformer interface { Informer() cache.SharedIndexInformer Lister() batchv1.JobLister } +// TypedJobInformer provides access to a shared informer and lister for +// Jobs, including the type-safe TypedInformer variant. +// It is a superset of JobInformer. +type TypedJobInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() JobIndexInformer + Lister() batchv1.JobLister +} + +// JobIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type JobIndexInformer cache.TypedSharedIndexInformer[*apibatchv1.Job] + +// JobHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Job. +type JobHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apibatchv1.Job] + +// JobDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Job. +type JobDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apibatchv1.Job] + +// JobFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Job. +type JobFilteringHandler = cache.TypedFilteringResourceEventHandler[*apibatchv1.Job] + +// JobIndexers is a specialization of [cache.TypedIndexers] for Job. +type JobIndexers = cache.TypedIndexers[*apibatchv1.Job] + +// DeletedJob is a specialization of [cache.DeletedObject] for Job. +type DeletedJob = cache.DeletedObject[*apibatchv1.Job] + type jobInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type jobInformer struct { // NewJobInformer constructs a new informer for Job type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedJobInformer]). func NewJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedJobInformer constructs a new informer for Job type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers JobIndexers) JobIndexInformer { + return NewTypedJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredJobInformer constructs a new informer for Job type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredJobInformer]). func NewFilteredJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredJobInformer constructs a new informer for Job type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers JobIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) JobIndexInformer { + return NewTypedJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewJobInformerWithOptions constructs a new informer for Job type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedJobInformerWithOptions]). func NewJobInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedJobInformerWithOptions(client, namespace, options) +} + +// NewTypedJobInformerWithOptions constructs a new informer for Job type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedJobInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) JobIndexInformer { gvr := schema.GroupVersionResource{Group: "batch", Version: "v1", Resource: "jobs"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apibatchv1.Job](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewJobInformerWithOptions(client kubernetes.Interface, namespace string, op Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *jobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewJobInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedJobInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *jobInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apibatchv1.Job{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *jobInformer) TypedInformer() JobIndexInformer { + return cache.NewTypedSharedIndexInformer[*apibatchv1.Job](f.factory.InformerFor(&apibatchv1.Job{}, f.defaultInformer)) } func (f *jobInformer) Lister() batchv1.JobLister { return batchv1.NewJobLister(f.Informer().GetIndexer()) } + +// ToTypedJobInformer converts an untyped informer into a TypedJobInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Job. If that is not the case, calling type-safe methods of the returned +// TypedJobInformer leads to runtime panics. A safer alternative is to pass +// around a TypedJobInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedJobInformer(informer JobInformer) TypedJobInformer { + if informer, ok := informer.(TypedJobInformer); ok { + return informer + } + return &jobTypedInformerAdapter{informer} +} + +type jobTypedInformerAdapter struct { + JobInformer +} + +func (a *jobTypedInformerAdapter) TypedInformer() JobIndexInformer { + return cache.NewTypedSharedIndexInformer[*apibatchv1.Job](a.Informer()) +} + +// ToJobIndexInformer converts an untyped informer into a JobIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Job. If that is not the case, calling type-safe methods of the returned +// JobIndexInformer leads to runtime panics. A safer alternative is to pass +// around a JobIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToJobIndexInformer(informer cache.SharedIndexInformer) JobIndexInformer { + if informer, ok := informer.(JobIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apibatchv1.Job](informer) +} diff --git a/vendor/k8s.io/client-go/informers/batch/v1beta1/cronjob.go b/vendor/k8s.io/client-go/informers/batch/v1beta1/cronjob.go index 5d2129323b..9043856ab0 100644 --- a/vendor/k8s.io/client-go/informers/batch/v1beta1/cronjob.go +++ b/vendor/k8s.io/client-go/informers/batch/v1beta1/cronjob.go @@ -34,12 +34,40 @@ import ( ) // CronJobInformer provides access to a shared informer and lister for -// CronJobs. +// CronJobs. Prefer using the type-safe variant (see [TypedCronJobInformer]). type CronJobInformer interface { Informer() cache.SharedIndexInformer Lister() batchv1beta1.CronJobLister } +// TypedCronJobInformer provides access to a shared informer and lister for +// CronJobs, including the type-safe TypedInformer variant. +// It is a superset of CronJobInformer. +type TypedCronJobInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() CronJobIndexInformer + Lister() batchv1beta1.CronJobLister +} + +// CronJobIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type CronJobIndexInformer cache.TypedSharedIndexInformer[*apibatchv1beta1.CronJob] + +// CronJobHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for CronJob. +type CronJobHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apibatchv1beta1.CronJob] + +// CronJobDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for CronJob. +type CronJobDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apibatchv1beta1.CronJob] + +// CronJobFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for CronJob. +type CronJobFilteringHandler = cache.TypedFilteringResourceEventHandler[*apibatchv1beta1.CronJob] + +// CronJobIndexers is a specialization of [cache.TypedIndexers] for CronJob. +type CronJobIndexers = cache.TypedIndexers[*apibatchv1beta1.CronJob] + +// DeletedCronJob is a specialization of [cache.DeletedObject] for CronJob. +type DeletedCronJob = cache.DeletedObject[*apibatchv1beta1.CronJob] + type cronJobInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type cronJobInformer struct { // NewCronJobInformer constructs a new informer for CronJob type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCronJobInformer]). func NewCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewCronJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedCronJobInformer constructs a new informer for CronJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers CronJobIndexers) CronJobIndexInformer { + return NewTypedCronJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredCronJobInformer constructs a new informer for CronJob type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredCronJobInformer]). func NewFilteredCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewCronJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedCronJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredCronJobInformer constructs a new informer for CronJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers CronJobIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) CronJobIndexInformer { + return NewTypedCronJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewCronJobInformerWithOptions constructs a new informer for CronJob type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCronJobInformerWithOptions]). func NewCronJobInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedCronJobInformerWithOptions(client, namespace, options) +} + +// NewTypedCronJobInformerWithOptions constructs a new informer for CronJob type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCronJobInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) CronJobIndexInformer { gvr := schema.GroupVersionResource{Group: "batch", Version: "v1beta1", Resource: "cronjobs"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apibatchv1beta1.CronJob](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewCronJobInformerWithOptions(client kubernetes.Interface, namespace string Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *cronJobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewCronJobInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedCronJobInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *cronJobInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apibatchv1beta1.CronJob{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *cronJobInformer) TypedInformer() CronJobIndexInformer { + return cache.NewTypedSharedIndexInformer[*apibatchv1beta1.CronJob](f.factory.InformerFor(&apibatchv1beta1.CronJob{}, f.defaultInformer)) } func (f *cronJobInformer) Lister() batchv1beta1.CronJobLister { return batchv1beta1.NewCronJobLister(f.Informer().GetIndexer()) } + +// ToTypedCronJobInformer converts an untyped informer into a TypedCronJobInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CronJob. If that is not the case, calling type-safe methods of the returned +// TypedCronJobInformer leads to runtime panics. A safer alternative is to pass +// around a TypedCronJobInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedCronJobInformer(informer CronJobInformer) TypedCronJobInformer { + if informer, ok := informer.(TypedCronJobInformer); ok { + return informer + } + return &cronJobTypedInformerAdapter{informer} +} + +type cronJobTypedInformerAdapter struct { + CronJobInformer +} + +func (a *cronJobTypedInformerAdapter) TypedInformer() CronJobIndexInformer { + return cache.NewTypedSharedIndexInformer[*apibatchv1beta1.CronJob](a.Informer()) +} + +// ToCronJobIndexInformer converts an untyped informer into a CronJobIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CronJob. If that is not the case, calling type-safe methods of the returned +// CronJobIndexInformer leads to runtime panics. A safer alternative is to pass +// around a CronJobIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToCronJobIndexInformer(informer cache.SharedIndexInformer) CronJobIndexInformer { + if informer, ok := informer.(CronJobIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apibatchv1beta1.CronJob](informer) +} diff --git a/vendor/k8s.io/client-go/informers/batch/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/batch/v1beta1/interface.go index 76cae22d68..bfe75d8a1c 100644 --- a/vendor/k8s.io/client-go/informers/batch/v1beta1/interface.go +++ b/vendor/k8s.io/client-go/informers/batch/v1beta1/interface.go @@ -25,7 +25,7 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // CronJobs returns a CronJobInformer. - CronJobs() CronJobInformer + CronJobs() TypedCronJobInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// CronJobs returns a CronJobInformer. -func (v *version) CronJobs() CronJobInformer { +// CronJobs returns a TypedCronJobInformer. +func (v *version) CronJobs() TypedCronJobInformer { return &cronJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go b/vendor/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go index 0e0706893c..4aa2b549e5 100644 --- a/vendor/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go +++ b/vendor/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go @@ -34,12 +34,40 @@ import ( ) // CertificateSigningRequestInformer provides access to a shared informer and lister for -// CertificateSigningRequests. +// CertificateSigningRequests. Prefer using the type-safe variant (see [TypedCertificateSigningRequestInformer]). type CertificateSigningRequestInformer interface { Informer() cache.SharedIndexInformer Lister() certificatesv1.CertificateSigningRequestLister } +// TypedCertificateSigningRequestInformer provides access to a shared informer and lister for +// CertificateSigningRequests, including the type-safe TypedInformer variant. +// It is a superset of CertificateSigningRequestInformer. +type TypedCertificateSigningRequestInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() CertificateSigningRequestIndexInformer + Lister() certificatesv1.CertificateSigningRequestLister +} + +// CertificateSigningRequestIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type CertificateSigningRequestIndexInformer cache.TypedSharedIndexInformer[*apicertificatesv1.CertificateSigningRequest] + +// CertificateSigningRequestHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for CertificateSigningRequest. +type CertificateSigningRequestHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicertificatesv1.CertificateSigningRequest] + +// CertificateSigningRequestDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for CertificateSigningRequest. +type CertificateSigningRequestDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicertificatesv1.CertificateSigningRequest] + +// CertificateSigningRequestFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for CertificateSigningRequest. +type CertificateSigningRequestFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicertificatesv1.CertificateSigningRequest] + +// CertificateSigningRequestIndexers is a specialization of [cache.TypedIndexers] for CertificateSigningRequest. +type CertificateSigningRequestIndexers = cache.TypedIndexers[*apicertificatesv1.CertificateSigningRequest] + +// DeletedCertificateSigningRequest is a specialization of [cache.DeletedObject] for CertificateSigningRequest. +type DeletedCertificateSigningRequest = cache.DeletedObject[*apicertificatesv1.CertificateSigningRequest] + type certificateSigningRequestInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type certificateSigningRequestInformer struct { // NewCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCertificateSigningRequestInformer]). func NewCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers CertificateSigningRequestIndexers) CertificateSigningRequestIndexInformer { + return NewTypedCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredCertificateSigningRequestInformer]). func NewFilteredCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers CertificateSigningRequestIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) CertificateSigningRequestIndexInformer { + return NewTypedCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewCertificateSigningRequestInformerWithOptions constructs a new informer for CertificateSigningRequest type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCertificateSigningRequestInformerWithOptions]). func NewCertificateSigningRequestInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedCertificateSigningRequestInformerWithOptions(client, options) +} + +// NewTypedCertificateSigningRequestInformerWithOptions constructs a new informer for CertificateSigningRequest type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCertificateSigningRequestInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) CertificateSigningRequestIndexInformer { gvr := schema.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1", Resource: "certificatesigningrequests"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicertificatesv1.CertificateSigningRequest](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewCertificateSigningRequestInformerWithOptions(client kubernetes.Interface Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *certificateSigningRequestInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *certificateSigningRequestInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicertificatesv1.CertificateSigningRequest{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *certificateSigningRequestInformer) TypedInformer() CertificateSigningRequestIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicertificatesv1.CertificateSigningRequest](f.factory.InformerFor(&apicertificatesv1.CertificateSigningRequest{}, f.defaultInformer)) } func (f *certificateSigningRequestInformer) Lister() certificatesv1.CertificateSigningRequestLister { return certificatesv1.NewCertificateSigningRequestLister(f.Informer().GetIndexer()) } + +// ToTypedCertificateSigningRequestInformer converts an untyped informer into a TypedCertificateSigningRequestInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CertificateSigningRequest. If that is not the case, calling type-safe methods of the returned +// TypedCertificateSigningRequestInformer leads to runtime panics. A safer alternative is to pass +// around a TypedCertificateSigningRequestInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedCertificateSigningRequestInformer(informer CertificateSigningRequestInformer) TypedCertificateSigningRequestInformer { + if informer, ok := informer.(TypedCertificateSigningRequestInformer); ok { + return informer + } + return &certificateSigningRequestTypedInformerAdapter{informer} +} + +type certificateSigningRequestTypedInformerAdapter struct { + CertificateSigningRequestInformer +} + +func (a *certificateSigningRequestTypedInformerAdapter) TypedInformer() CertificateSigningRequestIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicertificatesv1.CertificateSigningRequest](a.Informer()) +} + +// ToCertificateSigningRequestIndexInformer converts an untyped informer into a CertificateSigningRequestIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CertificateSigningRequest. If that is not the case, calling type-safe methods of the returned +// CertificateSigningRequestIndexInformer leads to runtime panics. A safer alternative is to pass +// around a CertificateSigningRequestIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToCertificateSigningRequestIndexInformer(informer cache.SharedIndexInformer) CertificateSigningRequestIndexInformer { + if informer, ok := informer.(CertificateSigningRequestIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicertificatesv1.CertificateSigningRequest](informer) +} diff --git a/vendor/k8s.io/client-go/informers/certificates/v1/clustertrustbundle.go b/vendor/k8s.io/client-go/informers/certificates/v1/clustertrustbundle.go new file mode 100644 index 0000000000..e24a1aed5d --- /dev/null +++ b/vendor/k8s.io/client-go/informers/certificates/v1/clustertrustbundle.go @@ -0,0 +1,207 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + time "time" + + apicertificatesv1 "k8s.io/api/certificates/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + certificatesv1 "k8s.io/client-go/listers/certificates/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterTrustBundleInformer provides access to a shared informer and lister for +// ClusterTrustBundles. Prefer using the type-safe variant (see [TypedClusterTrustBundleInformer]). +type ClusterTrustBundleInformer interface { + Informer() cache.SharedIndexInformer + Lister() certificatesv1.ClusterTrustBundleLister +} + +// TypedClusterTrustBundleInformer provides access to a shared informer and lister for +// ClusterTrustBundles, including the type-safe TypedInformer variant. +// It is a superset of ClusterTrustBundleInformer. +type TypedClusterTrustBundleInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ClusterTrustBundleIndexInformer + Lister() certificatesv1.ClusterTrustBundleLister +} + +// ClusterTrustBundleIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ClusterTrustBundleIndexInformer cache.TypedSharedIndexInformer[*apicertificatesv1.ClusterTrustBundle] + +// ClusterTrustBundleHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ClusterTrustBundle. +type ClusterTrustBundleHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicertificatesv1.ClusterTrustBundle] + +// ClusterTrustBundleDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ClusterTrustBundle. +type ClusterTrustBundleDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicertificatesv1.ClusterTrustBundle] + +// ClusterTrustBundleFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ClusterTrustBundle. +type ClusterTrustBundleFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicertificatesv1.ClusterTrustBundle] + +// ClusterTrustBundleIndexers is a specialization of [cache.TypedIndexers] for ClusterTrustBundle. +type ClusterTrustBundleIndexers = cache.TypedIndexers[*apicertificatesv1.ClusterTrustBundle] + +// DeletedClusterTrustBundle is a specialization of [cache.DeletedObject] for ClusterTrustBundle. +type DeletedClusterTrustBundle = cache.DeletedObject[*apicertificatesv1.ClusterTrustBundle] + +type clusterTrustBundleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterTrustBundleInformer constructs a new informer for ClusterTrustBundle type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTrustBundleInformer]). +func NewClusterTrustBundleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewTypedClusterTrustBundleInformer constructs a new informer for ClusterTrustBundle type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTrustBundleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ClusterTrustBundleIndexers) ClusterTrustBundleIndexInformer { + return NewTypedClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + +// NewFilteredClusterTrustBundleInformer constructs a new informer for ClusterTrustBundle type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredClusterTrustBundleInformer]). +func NewFilteredClusterTrustBundleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewTypedClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredClusterTrustBundleInformer constructs a new informer for ClusterTrustBundle type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredClusterTrustBundleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ClusterTrustBundleIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterTrustBundleIndexInformer { + return NewTypedClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) +} + +// NewClusterTrustBundleInformerWithOptions constructs a new informer for ClusterTrustBundle type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTrustBundleInformerWithOptions]). +func NewClusterTrustBundleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedClusterTrustBundleInformerWithOptions(client, options) +} + +// NewTypedClusterTrustBundleInformerWithOptions constructs a new informer for ClusterTrustBundle type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTrustBundleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ClusterTrustBundleIndexInformer { + gvr := schema.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1", Resource: "clustertrustbundles"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewTypedSharedIndexInformer[*apicertificatesv1.ClusterTrustBundle](cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.CertificatesV1().ClusterTrustBundles().List(context.Background(), opts) + }, + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.CertificatesV1().ClusterTrustBundles().Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.CertificatesV1().ClusterTrustBundles().List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.CertificatesV1().ClusterTrustBundles().Watch(ctx, opts) + }, + }, client), + &apicertificatesv1.ClusterTrustBundle{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + )) +} + +func (f *clusterTrustBundleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewTypedClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *clusterTrustBundleInformer) Informer() cache.SharedIndexInformer { + return f.TypedInformer() +} + +func (f *clusterTrustBundleInformer) TypedInformer() ClusterTrustBundleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicertificatesv1.ClusterTrustBundle](f.factory.InformerFor(&apicertificatesv1.ClusterTrustBundle{}, f.defaultInformer)) +} + +func (f *clusterTrustBundleInformer) Lister() certificatesv1.ClusterTrustBundleLister { + return certificatesv1.NewClusterTrustBundleLister(f.Informer().GetIndexer()) +} + +// ToTypedClusterTrustBundleInformer converts an untyped informer into a TypedClusterTrustBundleInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTrustBundle. If that is not the case, calling type-safe methods of the returned +// TypedClusterTrustBundleInformer leads to runtime panics. A safer alternative is to pass +// around a TypedClusterTrustBundleInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedClusterTrustBundleInformer(informer ClusterTrustBundleInformer) TypedClusterTrustBundleInformer { + if informer, ok := informer.(TypedClusterTrustBundleInformer); ok { + return informer + } + return &clusterTrustBundleTypedInformerAdapter{informer} +} + +type clusterTrustBundleTypedInformerAdapter struct { + ClusterTrustBundleInformer +} + +func (a *clusterTrustBundleTypedInformerAdapter) TypedInformer() ClusterTrustBundleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicertificatesv1.ClusterTrustBundle](a.Informer()) +} + +// ToClusterTrustBundleIndexInformer converts an untyped informer into a ClusterTrustBundleIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTrustBundle. If that is not the case, calling type-safe methods of the returned +// ClusterTrustBundleIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ClusterTrustBundleIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToClusterTrustBundleIndexInformer(informer cache.SharedIndexInformer) ClusterTrustBundleIndexInformer { + if informer, ok := informer.(ClusterTrustBundleIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicertificatesv1.ClusterTrustBundle](informer) +} diff --git a/vendor/k8s.io/client-go/informers/certificates/v1/interface.go b/vendor/k8s.io/client-go/informers/certificates/v1/interface.go index 91ccfb715d..b0e1ecc608 100644 --- a/vendor/k8s.io/client-go/informers/certificates/v1/interface.go +++ b/vendor/k8s.io/client-go/informers/certificates/v1/interface.go @@ -25,7 +25,11 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // CertificateSigningRequests returns a CertificateSigningRequestInformer. - CertificateSigningRequests() CertificateSigningRequestInformer + CertificateSigningRequests() TypedCertificateSigningRequestInformer + // ClusterTrustBundles returns a ClusterTrustBundleInformer. + ClusterTrustBundles() TypedClusterTrustBundleInformer + // PodCertificateRequests returns a PodCertificateRequestInformer. + PodCertificateRequests() TypedPodCertificateRequestInformer } type version struct { @@ -39,7 +43,17 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// CertificateSigningRequests returns a CertificateSigningRequestInformer. -func (v *version) CertificateSigningRequests() CertificateSigningRequestInformer { +// CertificateSigningRequests returns a TypedCertificateSigningRequestInformer. +func (v *version) CertificateSigningRequests() TypedCertificateSigningRequestInformer { return &certificateSigningRequestInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } + +// ClusterTrustBundles returns a TypedClusterTrustBundleInformer. +func (v *version) ClusterTrustBundles() TypedClusterTrustBundleInformer { + return &clusterTrustBundleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// PodCertificateRequests returns a TypedPodCertificateRequestInformer. +func (v *version) PodCertificateRequests() TypedPodCertificateRequestInformer { + return &podCertificateRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/certificates/v1/podcertificaterequest.go b/vendor/k8s.io/client-go/informers/certificates/v1/podcertificaterequest.go new file mode 100644 index 0000000000..364740b0db --- /dev/null +++ b/vendor/k8s.io/client-go/informers/certificates/v1/podcertificaterequest.go @@ -0,0 +1,208 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + time "time" + + apicertificatesv1 "k8s.io/api/certificates/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + certificatesv1 "k8s.io/client-go/listers/certificates/v1" + cache "k8s.io/client-go/tools/cache" +) + +// PodCertificateRequestInformer provides access to a shared informer and lister for +// PodCertificateRequests. Prefer using the type-safe variant (see [TypedPodCertificateRequestInformer]). +type PodCertificateRequestInformer interface { + Informer() cache.SharedIndexInformer + Lister() certificatesv1.PodCertificateRequestLister +} + +// TypedPodCertificateRequestInformer provides access to a shared informer and lister for +// PodCertificateRequests, including the type-safe TypedInformer variant. +// It is a superset of PodCertificateRequestInformer. +type TypedPodCertificateRequestInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() PodCertificateRequestIndexInformer + Lister() certificatesv1.PodCertificateRequestLister +} + +// PodCertificateRequestIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type PodCertificateRequestIndexInformer cache.TypedSharedIndexInformer[*apicertificatesv1.PodCertificateRequest] + +// PodCertificateRequestHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for PodCertificateRequest. +type PodCertificateRequestHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicertificatesv1.PodCertificateRequest] + +// PodCertificateRequestDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for PodCertificateRequest. +type PodCertificateRequestDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicertificatesv1.PodCertificateRequest] + +// PodCertificateRequestFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for PodCertificateRequest. +type PodCertificateRequestFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicertificatesv1.PodCertificateRequest] + +// PodCertificateRequestIndexers is a specialization of [cache.TypedIndexers] for PodCertificateRequest. +type PodCertificateRequestIndexers = cache.TypedIndexers[*apicertificatesv1.PodCertificateRequest] + +// DeletedPodCertificateRequest is a specialization of [cache.DeletedObject] for PodCertificateRequest. +type DeletedPodCertificateRequest = cache.DeletedObject[*apicertificatesv1.PodCertificateRequest] + +type podCertificateRequestInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodCertificateRequestInformer constructs a new informer for PodCertificateRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPodCertificateRequestInformer]). +func NewPodCertificateRequestInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewPodCertificateRequestInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewTypedPodCertificateRequestInformer constructs a new informer for PodCertificateRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPodCertificateRequestInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers PodCertificateRequestIndexers) PodCertificateRequestIndexInformer { + return NewTypedPodCertificateRequestInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + +// NewFilteredPodCertificateRequestInformer constructs a new informer for PodCertificateRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredPodCertificateRequestInformer]). +func NewFilteredPodCertificateRequestInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewTypedPodCertificateRequestInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredPodCertificateRequestInformer constructs a new informer for PodCertificateRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredPodCertificateRequestInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers PodCertificateRequestIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) PodCertificateRequestIndexInformer { + return NewTypedPodCertificateRequestInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) +} + +// NewPodCertificateRequestInformerWithOptions constructs a new informer for PodCertificateRequest type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPodCertificateRequestInformerWithOptions]). +func NewPodCertificateRequestInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedPodCertificateRequestInformerWithOptions(client, namespace, options) +} + +// NewTypedPodCertificateRequestInformerWithOptions constructs a new informer for PodCertificateRequest type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPodCertificateRequestInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) PodCertificateRequestIndexInformer { + gvr := schema.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1", Resource: "podcertificaterequests"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewTypedSharedIndexInformer[*apicertificatesv1.PodCertificateRequest](cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.CertificatesV1().PodCertificateRequests(namespace).List(context.Background(), opts) + }, + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.CertificatesV1().PodCertificateRequests(namespace).Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.CertificatesV1().PodCertificateRequests(namespace).List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.CertificatesV1().PodCertificateRequests(namespace).Watch(ctx, opts) + }, + }, client), + &apicertificatesv1.PodCertificateRequest{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + )) +} + +func (f *podCertificateRequestInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewTypedPodCertificateRequestInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *podCertificateRequestInformer) Informer() cache.SharedIndexInformer { + return f.TypedInformer() +} + +func (f *podCertificateRequestInformer) TypedInformer() PodCertificateRequestIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicertificatesv1.PodCertificateRequest](f.factory.InformerFor(&apicertificatesv1.PodCertificateRequest{}, f.defaultInformer)) +} + +func (f *podCertificateRequestInformer) Lister() certificatesv1.PodCertificateRequestLister { + return certificatesv1.NewPodCertificateRequestLister(f.Informer().GetIndexer()) +} + +// ToTypedPodCertificateRequestInformer converts an untyped informer into a TypedPodCertificateRequestInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PodCertificateRequest. If that is not the case, calling type-safe methods of the returned +// TypedPodCertificateRequestInformer leads to runtime panics. A safer alternative is to pass +// around a TypedPodCertificateRequestInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedPodCertificateRequestInformer(informer PodCertificateRequestInformer) TypedPodCertificateRequestInformer { + if informer, ok := informer.(TypedPodCertificateRequestInformer); ok { + return informer + } + return &podCertificateRequestTypedInformerAdapter{informer} +} + +type podCertificateRequestTypedInformerAdapter struct { + PodCertificateRequestInformer +} + +func (a *podCertificateRequestTypedInformerAdapter) TypedInformer() PodCertificateRequestIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicertificatesv1.PodCertificateRequest](a.Informer()) +} + +// ToPodCertificateRequestIndexInformer converts an untyped informer into a PodCertificateRequestIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PodCertificateRequest. If that is not the case, calling type-safe methods of the returned +// PodCertificateRequestIndexInformer leads to runtime panics. A safer alternative is to pass +// around a PodCertificateRequestIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToPodCertificateRequestIndexInformer(informer cache.SharedIndexInformer) PodCertificateRequestIndexInformer { + if informer, ok := informer.(PodCertificateRequestIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicertificatesv1.PodCertificateRequest](informer) +} diff --git a/vendor/k8s.io/client-go/informers/certificates/v1alpha1/clustertrustbundle.go b/vendor/k8s.io/client-go/informers/certificates/v1alpha1/clustertrustbundle.go index 637cfd71da..da71ca3ba0 100644 --- a/vendor/k8s.io/client-go/informers/certificates/v1alpha1/clustertrustbundle.go +++ b/vendor/k8s.io/client-go/informers/certificates/v1alpha1/clustertrustbundle.go @@ -34,12 +34,40 @@ import ( ) // ClusterTrustBundleInformer provides access to a shared informer and lister for -// ClusterTrustBundles. +// ClusterTrustBundles. Prefer using the type-safe variant (see [TypedClusterTrustBundleInformer]). type ClusterTrustBundleInformer interface { Informer() cache.SharedIndexInformer Lister() certificatesv1alpha1.ClusterTrustBundleLister } +// TypedClusterTrustBundleInformer provides access to a shared informer and lister for +// ClusterTrustBundles, including the type-safe TypedInformer variant. +// It is a superset of ClusterTrustBundleInformer. +type TypedClusterTrustBundleInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ClusterTrustBundleIndexInformer + Lister() certificatesv1alpha1.ClusterTrustBundleLister +} + +// ClusterTrustBundleIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ClusterTrustBundleIndexInformer cache.TypedSharedIndexInformer[*apicertificatesv1alpha1.ClusterTrustBundle] + +// ClusterTrustBundleHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ClusterTrustBundle. +type ClusterTrustBundleHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicertificatesv1alpha1.ClusterTrustBundle] + +// ClusterTrustBundleDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ClusterTrustBundle. +type ClusterTrustBundleDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicertificatesv1alpha1.ClusterTrustBundle] + +// ClusterTrustBundleFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ClusterTrustBundle. +type ClusterTrustBundleFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicertificatesv1alpha1.ClusterTrustBundle] + +// ClusterTrustBundleIndexers is a specialization of [cache.TypedIndexers] for ClusterTrustBundle. +type ClusterTrustBundleIndexers = cache.TypedIndexers[*apicertificatesv1alpha1.ClusterTrustBundle] + +// DeletedClusterTrustBundle is a specialization of [cache.DeletedObject] for ClusterTrustBundle. +type DeletedClusterTrustBundle = cache.DeletedObject[*apicertificatesv1alpha1.ClusterTrustBundle] + type clusterTrustBundleInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type clusterTrustBundleInformer struct { // NewClusterTrustBundleInformer constructs a new informer for ClusterTrustBundle type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTrustBundleInformer]). func NewClusterTrustBundleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedClusterTrustBundleInformer constructs a new informer for ClusterTrustBundle type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTrustBundleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ClusterTrustBundleIndexers) ClusterTrustBundleIndexInformer { + return NewTypedClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredClusterTrustBundleInformer constructs a new informer for ClusterTrustBundle type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredClusterTrustBundleInformer]). func NewFilteredClusterTrustBundleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredClusterTrustBundleInformer constructs a new informer for ClusterTrustBundle type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredClusterTrustBundleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ClusterTrustBundleIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterTrustBundleIndexInformer { + return NewTypedClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewClusterTrustBundleInformerWithOptions constructs a new informer for ClusterTrustBundle type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTrustBundleInformerWithOptions]). func NewClusterTrustBundleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedClusterTrustBundleInformerWithOptions(client, options) +} + +// NewTypedClusterTrustBundleInformerWithOptions constructs a new informer for ClusterTrustBundle type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTrustBundleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ClusterTrustBundleIndexInformer { gvr := schema.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1alpha1", Resource: "clustertrustbundles"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicertificatesv1alpha1.ClusterTrustBundle](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewClusterTrustBundleInformerWithOptions(client kubernetes.Interface, optio Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *clusterTrustBundleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterTrustBundleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicertificatesv1alpha1.ClusterTrustBundle{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *clusterTrustBundleInformer) TypedInformer() ClusterTrustBundleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicertificatesv1alpha1.ClusterTrustBundle](f.factory.InformerFor(&apicertificatesv1alpha1.ClusterTrustBundle{}, f.defaultInformer)) } func (f *clusterTrustBundleInformer) Lister() certificatesv1alpha1.ClusterTrustBundleLister { return certificatesv1alpha1.NewClusterTrustBundleLister(f.Informer().GetIndexer()) } + +// ToTypedClusterTrustBundleInformer converts an untyped informer into a TypedClusterTrustBundleInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTrustBundle. If that is not the case, calling type-safe methods of the returned +// TypedClusterTrustBundleInformer leads to runtime panics. A safer alternative is to pass +// around a TypedClusterTrustBundleInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedClusterTrustBundleInformer(informer ClusterTrustBundleInformer) TypedClusterTrustBundleInformer { + if informer, ok := informer.(TypedClusterTrustBundleInformer); ok { + return informer + } + return &clusterTrustBundleTypedInformerAdapter{informer} +} + +type clusterTrustBundleTypedInformerAdapter struct { + ClusterTrustBundleInformer +} + +func (a *clusterTrustBundleTypedInformerAdapter) TypedInformer() ClusterTrustBundleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicertificatesv1alpha1.ClusterTrustBundle](a.Informer()) +} + +// ToClusterTrustBundleIndexInformer converts an untyped informer into a ClusterTrustBundleIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTrustBundle. If that is not the case, calling type-safe methods of the returned +// ClusterTrustBundleIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ClusterTrustBundleIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToClusterTrustBundleIndexInformer(informer cache.SharedIndexInformer) ClusterTrustBundleIndexInformer { + if informer, ok := informer.(ClusterTrustBundleIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicertificatesv1alpha1.ClusterTrustBundle](informer) +} diff --git a/vendor/k8s.io/client-go/informers/certificates/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/certificates/v1alpha1/interface.go index 40ce8f42db..8741155be8 100644 --- a/vendor/k8s.io/client-go/informers/certificates/v1alpha1/interface.go +++ b/vendor/k8s.io/client-go/informers/certificates/v1alpha1/interface.go @@ -25,7 +25,7 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // ClusterTrustBundles returns a ClusterTrustBundleInformer. - ClusterTrustBundles() ClusterTrustBundleInformer + ClusterTrustBundles() TypedClusterTrustBundleInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// ClusterTrustBundles returns a ClusterTrustBundleInformer. -func (v *version) ClusterTrustBundles() ClusterTrustBundleInformer { +// ClusterTrustBundles returns a TypedClusterTrustBundleInformer. +func (v *version) ClusterTrustBundles() TypedClusterTrustBundleInformer { return &clusterTrustBundleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go b/vendor/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go index 4d4408d906..bac26740ba 100644 --- a/vendor/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go +++ b/vendor/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go @@ -34,12 +34,40 @@ import ( ) // CertificateSigningRequestInformer provides access to a shared informer and lister for -// CertificateSigningRequests. +// CertificateSigningRequests. Prefer using the type-safe variant (see [TypedCertificateSigningRequestInformer]). type CertificateSigningRequestInformer interface { Informer() cache.SharedIndexInformer Lister() certificatesv1beta1.CertificateSigningRequestLister } +// TypedCertificateSigningRequestInformer provides access to a shared informer and lister for +// CertificateSigningRequests, including the type-safe TypedInformer variant. +// It is a superset of CertificateSigningRequestInformer. +type TypedCertificateSigningRequestInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() CertificateSigningRequestIndexInformer + Lister() certificatesv1beta1.CertificateSigningRequestLister +} + +// CertificateSigningRequestIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type CertificateSigningRequestIndexInformer cache.TypedSharedIndexInformer[*apicertificatesv1beta1.CertificateSigningRequest] + +// CertificateSigningRequestHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for CertificateSigningRequest. +type CertificateSigningRequestHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicertificatesv1beta1.CertificateSigningRequest] + +// CertificateSigningRequestDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for CertificateSigningRequest. +type CertificateSigningRequestDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicertificatesv1beta1.CertificateSigningRequest] + +// CertificateSigningRequestFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for CertificateSigningRequest. +type CertificateSigningRequestFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicertificatesv1beta1.CertificateSigningRequest] + +// CertificateSigningRequestIndexers is a specialization of [cache.TypedIndexers] for CertificateSigningRequest. +type CertificateSigningRequestIndexers = cache.TypedIndexers[*apicertificatesv1beta1.CertificateSigningRequest] + +// DeletedCertificateSigningRequest is a specialization of [cache.DeletedObject] for CertificateSigningRequest. +type DeletedCertificateSigningRequest = cache.DeletedObject[*apicertificatesv1beta1.CertificateSigningRequest] + type certificateSigningRequestInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type certificateSigningRequestInformer struct { // NewCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCertificateSigningRequestInformer]). func NewCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers CertificateSigningRequestIndexers) CertificateSigningRequestIndexInformer { + return NewTypedCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredCertificateSigningRequestInformer]). func NewFilteredCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers CertificateSigningRequestIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) CertificateSigningRequestIndexInformer { + return NewTypedCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewCertificateSigningRequestInformerWithOptions constructs a new informer for CertificateSigningRequest type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCertificateSigningRequestInformerWithOptions]). func NewCertificateSigningRequestInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedCertificateSigningRequestInformerWithOptions(client, options) +} + +// NewTypedCertificateSigningRequestInformerWithOptions constructs a new informer for CertificateSigningRequest type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCertificateSigningRequestInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) CertificateSigningRequestIndexInformer { gvr := schema.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1beta1", Resource: "certificatesigningrequests"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicertificatesv1beta1.CertificateSigningRequest](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewCertificateSigningRequestInformerWithOptions(client kubernetes.Interface Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *certificateSigningRequestInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *certificateSigningRequestInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicertificatesv1beta1.CertificateSigningRequest{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *certificateSigningRequestInformer) TypedInformer() CertificateSigningRequestIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicertificatesv1beta1.CertificateSigningRequest](f.factory.InformerFor(&apicertificatesv1beta1.CertificateSigningRequest{}, f.defaultInformer)) } func (f *certificateSigningRequestInformer) Lister() certificatesv1beta1.CertificateSigningRequestLister { return certificatesv1beta1.NewCertificateSigningRequestLister(f.Informer().GetIndexer()) } + +// ToTypedCertificateSigningRequestInformer converts an untyped informer into a TypedCertificateSigningRequestInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CertificateSigningRequest. If that is not the case, calling type-safe methods of the returned +// TypedCertificateSigningRequestInformer leads to runtime panics. A safer alternative is to pass +// around a TypedCertificateSigningRequestInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedCertificateSigningRequestInformer(informer CertificateSigningRequestInformer) TypedCertificateSigningRequestInformer { + if informer, ok := informer.(TypedCertificateSigningRequestInformer); ok { + return informer + } + return &certificateSigningRequestTypedInformerAdapter{informer} +} + +type certificateSigningRequestTypedInformerAdapter struct { + CertificateSigningRequestInformer +} + +func (a *certificateSigningRequestTypedInformerAdapter) TypedInformer() CertificateSigningRequestIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicertificatesv1beta1.CertificateSigningRequest](a.Informer()) +} + +// ToCertificateSigningRequestIndexInformer converts an untyped informer into a CertificateSigningRequestIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CertificateSigningRequest. If that is not the case, calling type-safe methods of the returned +// CertificateSigningRequestIndexInformer leads to runtime panics. A safer alternative is to pass +// around a CertificateSigningRequestIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToCertificateSigningRequestIndexInformer(informer cache.SharedIndexInformer) CertificateSigningRequestIndexInformer { + if informer, ok := informer.(CertificateSigningRequestIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicertificatesv1beta1.CertificateSigningRequest](informer) +} diff --git a/vendor/k8s.io/client-go/informers/certificates/v1beta1/clustertrustbundle.go b/vendor/k8s.io/client-go/informers/certificates/v1beta1/clustertrustbundle.go index f665d0b739..4415e589a2 100644 --- a/vendor/k8s.io/client-go/informers/certificates/v1beta1/clustertrustbundle.go +++ b/vendor/k8s.io/client-go/informers/certificates/v1beta1/clustertrustbundle.go @@ -34,12 +34,40 @@ import ( ) // ClusterTrustBundleInformer provides access to a shared informer and lister for -// ClusterTrustBundles. +// ClusterTrustBundles. Prefer using the type-safe variant (see [TypedClusterTrustBundleInformer]). type ClusterTrustBundleInformer interface { Informer() cache.SharedIndexInformer Lister() certificatesv1beta1.ClusterTrustBundleLister } +// TypedClusterTrustBundleInformer provides access to a shared informer and lister for +// ClusterTrustBundles, including the type-safe TypedInformer variant. +// It is a superset of ClusterTrustBundleInformer. +type TypedClusterTrustBundleInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ClusterTrustBundleIndexInformer + Lister() certificatesv1beta1.ClusterTrustBundleLister +} + +// ClusterTrustBundleIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ClusterTrustBundleIndexInformer cache.TypedSharedIndexInformer[*apicertificatesv1beta1.ClusterTrustBundle] + +// ClusterTrustBundleHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ClusterTrustBundle. +type ClusterTrustBundleHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicertificatesv1beta1.ClusterTrustBundle] + +// ClusterTrustBundleDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ClusterTrustBundle. +type ClusterTrustBundleDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicertificatesv1beta1.ClusterTrustBundle] + +// ClusterTrustBundleFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ClusterTrustBundle. +type ClusterTrustBundleFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicertificatesv1beta1.ClusterTrustBundle] + +// ClusterTrustBundleIndexers is a specialization of [cache.TypedIndexers] for ClusterTrustBundle. +type ClusterTrustBundleIndexers = cache.TypedIndexers[*apicertificatesv1beta1.ClusterTrustBundle] + +// DeletedClusterTrustBundle is a specialization of [cache.DeletedObject] for ClusterTrustBundle. +type DeletedClusterTrustBundle = cache.DeletedObject[*apicertificatesv1beta1.ClusterTrustBundle] + type clusterTrustBundleInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type clusterTrustBundleInformer struct { // NewClusterTrustBundleInformer constructs a new informer for ClusterTrustBundle type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTrustBundleInformer]). func NewClusterTrustBundleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedClusterTrustBundleInformer constructs a new informer for ClusterTrustBundle type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTrustBundleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ClusterTrustBundleIndexers) ClusterTrustBundleIndexInformer { + return NewTypedClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredClusterTrustBundleInformer constructs a new informer for ClusterTrustBundle type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredClusterTrustBundleInformer]). func NewFilteredClusterTrustBundleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredClusterTrustBundleInformer constructs a new informer for ClusterTrustBundle type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredClusterTrustBundleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ClusterTrustBundleIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterTrustBundleIndexInformer { + return NewTypedClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewClusterTrustBundleInformerWithOptions constructs a new informer for ClusterTrustBundle type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTrustBundleInformerWithOptions]). func NewClusterTrustBundleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedClusterTrustBundleInformerWithOptions(client, options) +} + +// NewTypedClusterTrustBundleInformerWithOptions constructs a new informer for ClusterTrustBundle type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTrustBundleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ClusterTrustBundleIndexInformer { gvr := schema.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1beta1", Resource: "clustertrustbundles"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicertificatesv1beta1.ClusterTrustBundle](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewClusterTrustBundleInformerWithOptions(client kubernetes.Interface, optio Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *clusterTrustBundleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterTrustBundleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicertificatesv1beta1.ClusterTrustBundle{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *clusterTrustBundleInformer) TypedInformer() ClusterTrustBundleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicertificatesv1beta1.ClusterTrustBundle](f.factory.InformerFor(&apicertificatesv1beta1.ClusterTrustBundle{}, f.defaultInformer)) } func (f *clusterTrustBundleInformer) Lister() certificatesv1beta1.ClusterTrustBundleLister { return certificatesv1beta1.NewClusterTrustBundleLister(f.Informer().GetIndexer()) } + +// ToTypedClusterTrustBundleInformer converts an untyped informer into a TypedClusterTrustBundleInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTrustBundle. If that is not the case, calling type-safe methods of the returned +// TypedClusterTrustBundleInformer leads to runtime panics. A safer alternative is to pass +// around a TypedClusterTrustBundleInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedClusterTrustBundleInformer(informer ClusterTrustBundleInformer) TypedClusterTrustBundleInformer { + if informer, ok := informer.(TypedClusterTrustBundleInformer); ok { + return informer + } + return &clusterTrustBundleTypedInformerAdapter{informer} +} + +type clusterTrustBundleTypedInformerAdapter struct { + ClusterTrustBundleInformer +} + +func (a *clusterTrustBundleTypedInformerAdapter) TypedInformer() ClusterTrustBundleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicertificatesv1beta1.ClusterTrustBundle](a.Informer()) +} + +// ToClusterTrustBundleIndexInformer converts an untyped informer into a ClusterTrustBundleIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTrustBundle. If that is not the case, calling type-safe methods of the returned +// ClusterTrustBundleIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ClusterTrustBundleIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToClusterTrustBundleIndexInformer(informer cache.SharedIndexInformer) ClusterTrustBundleIndexInformer { + if informer, ok := informer.(ClusterTrustBundleIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicertificatesv1beta1.ClusterTrustBundle](informer) +} diff --git a/vendor/k8s.io/client-go/informers/certificates/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/certificates/v1beta1/interface.go index b2d39e2068..95bce3fa3b 100644 --- a/vendor/k8s.io/client-go/informers/certificates/v1beta1/interface.go +++ b/vendor/k8s.io/client-go/informers/certificates/v1beta1/interface.go @@ -25,11 +25,11 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // CertificateSigningRequests returns a CertificateSigningRequestInformer. - CertificateSigningRequests() CertificateSigningRequestInformer + CertificateSigningRequests() TypedCertificateSigningRequestInformer // ClusterTrustBundles returns a ClusterTrustBundleInformer. - ClusterTrustBundles() ClusterTrustBundleInformer + ClusterTrustBundles() TypedClusterTrustBundleInformer // PodCertificateRequests returns a PodCertificateRequestInformer. - PodCertificateRequests() PodCertificateRequestInformer + PodCertificateRequests() TypedPodCertificateRequestInformer } type version struct { @@ -43,17 +43,17 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// CertificateSigningRequests returns a CertificateSigningRequestInformer. -func (v *version) CertificateSigningRequests() CertificateSigningRequestInformer { +// CertificateSigningRequests returns a TypedCertificateSigningRequestInformer. +func (v *version) CertificateSigningRequests() TypedCertificateSigningRequestInformer { return &certificateSigningRequestInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// ClusterTrustBundles returns a ClusterTrustBundleInformer. -func (v *version) ClusterTrustBundles() ClusterTrustBundleInformer { +// ClusterTrustBundles returns a TypedClusterTrustBundleInformer. +func (v *version) ClusterTrustBundles() TypedClusterTrustBundleInformer { return &clusterTrustBundleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// PodCertificateRequests returns a PodCertificateRequestInformer. -func (v *version) PodCertificateRequests() PodCertificateRequestInformer { +// PodCertificateRequests returns a TypedPodCertificateRequestInformer. +func (v *version) PodCertificateRequests() TypedPodCertificateRequestInformer { return &podCertificateRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/certificates/v1beta1/podcertificaterequest.go b/vendor/k8s.io/client-go/informers/certificates/v1beta1/podcertificaterequest.go index 03f7816cfd..546a8a3eae 100644 --- a/vendor/k8s.io/client-go/informers/certificates/v1beta1/podcertificaterequest.go +++ b/vendor/k8s.io/client-go/informers/certificates/v1beta1/podcertificaterequest.go @@ -34,12 +34,40 @@ import ( ) // PodCertificateRequestInformer provides access to a shared informer and lister for -// PodCertificateRequests. +// PodCertificateRequests. Prefer using the type-safe variant (see [TypedPodCertificateRequestInformer]). type PodCertificateRequestInformer interface { Informer() cache.SharedIndexInformer Lister() certificatesv1beta1.PodCertificateRequestLister } +// TypedPodCertificateRequestInformer provides access to a shared informer and lister for +// PodCertificateRequests, including the type-safe TypedInformer variant. +// It is a superset of PodCertificateRequestInformer. +type TypedPodCertificateRequestInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() PodCertificateRequestIndexInformer + Lister() certificatesv1beta1.PodCertificateRequestLister +} + +// PodCertificateRequestIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type PodCertificateRequestIndexInformer cache.TypedSharedIndexInformer[*apicertificatesv1beta1.PodCertificateRequest] + +// PodCertificateRequestHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for PodCertificateRequest. +type PodCertificateRequestHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicertificatesv1beta1.PodCertificateRequest] + +// PodCertificateRequestDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for PodCertificateRequest. +type PodCertificateRequestDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicertificatesv1beta1.PodCertificateRequest] + +// PodCertificateRequestFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for PodCertificateRequest. +type PodCertificateRequestFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicertificatesv1beta1.PodCertificateRequest] + +// PodCertificateRequestIndexers is a specialization of [cache.TypedIndexers] for PodCertificateRequest. +type PodCertificateRequestIndexers = cache.TypedIndexers[*apicertificatesv1beta1.PodCertificateRequest] + +// DeletedPodCertificateRequest is a specialization of [cache.DeletedObject] for PodCertificateRequest. +type DeletedPodCertificateRequest = cache.DeletedObject[*apicertificatesv1beta1.PodCertificateRequest] + type podCertificateRequestInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type podCertificateRequestInformer struct { // NewPodCertificateRequestInformer constructs a new informer for PodCertificateRequest type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPodCertificateRequestInformer]). func NewPodCertificateRequestInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewPodCertificateRequestInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedPodCertificateRequestInformer constructs a new informer for PodCertificateRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPodCertificateRequestInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers PodCertificateRequestIndexers) PodCertificateRequestIndexInformer { + return NewTypedPodCertificateRequestInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredPodCertificateRequestInformer constructs a new informer for PodCertificateRequest type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredPodCertificateRequestInformer]). func NewFilteredPodCertificateRequestInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewPodCertificateRequestInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedPodCertificateRequestInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredPodCertificateRequestInformer constructs a new informer for PodCertificateRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredPodCertificateRequestInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers PodCertificateRequestIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) PodCertificateRequestIndexInformer { + return NewTypedPodCertificateRequestInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewPodCertificateRequestInformerWithOptions constructs a new informer for PodCertificateRequest type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPodCertificateRequestInformerWithOptions]). func NewPodCertificateRequestInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedPodCertificateRequestInformerWithOptions(client, namespace, options) +} + +// NewTypedPodCertificateRequestInformerWithOptions constructs a new informer for PodCertificateRequest type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPodCertificateRequestInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) PodCertificateRequestIndexInformer { gvr := schema.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1beta1", Resource: "podcertificaterequests"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicertificatesv1beta1.PodCertificateRequest](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewPodCertificateRequestInformerWithOptions(client kubernetes.Interface, na Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *podCertificateRequestInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewPodCertificateRequestInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedPodCertificateRequestInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *podCertificateRequestInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicertificatesv1beta1.PodCertificateRequest{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *podCertificateRequestInformer) TypedInformer() PodCertificateRequestIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicertificatesv1beta1.PodCertificateRequest](f.factory.InformerFor(&apicertificatesv1beta1.PodCertificateRequest{}, f.defaultInformer)) } func (f *podCertificateRequestInformer) Lister() certificatesv1beta1.PodCertificateRequestLister { return certificatesv1beta1.NewPodCertificateRequestLister(f.Informer().GetIndexer()) } + +// ToTypedPodCertificateRequestInformer converts an untyped informer into a TypedPodCertificateRequestInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PodCertificateRequest. If that is not the case, calling type-safe methods of the returned +// TypedPodCertificateRequestInformer leads to runtime panics. A safer alternative is to pass +// around a TypedPodCertificateRequestInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedPodCertificateRequestInformer(informer PodCertificateRequestInformer) TypedPodCertificateRequestInformer { + if informer, ok := informer.(TypedPodCertificateRequestInformer); ok { + return informer + } + return &podCertificateRequestTypedInformerAdapter{informer} +} + +type podCertificateRequestTypedInformerAdapter struct { + PodCertificateRequestInformer +} + +func (a *podCertificateRequestTypedInformerAdapter) TypedInformer() PodCertificateRequestIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicertificatesv1beta1.PodCertificateRequest](a.Informer()) +} + +// ToPodCertificateRequestIndexInformer converts an untyped informer into a PodCertificateRequestIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PodCertificateRequest. If that is not the case, calling type-safe methods of the returned +// PodCertificateRequestIndexInformer leads to runtime panics. A safer alternative is to pass +// around a PodCertificateRequestIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToPodCertificateRequestIndexInformer(informer cache.SharedIndexInformer) PodCertificateRequestIndexInformer { + if informer, ok := informer.(PodCertificateRequestIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicertificatesv1beta1.PodCertificateRequest](informer) +} diff --git a/vendor/k8s.io/client-go/informers/coordination/v1/interface.go b/vendor/k8s.io/client-go/informers/coordination/v1/interface.go index 05c4acbef8..9451e71256 100644 --- a/vendor/k8s.io/client-go/informers/coordination/v1/interface.go +++ b/vendor/k8s.io/client-go/informers/coordination/v1/interface.go @@ -25,7 +25,7 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // Leases returns a LeaseInformer. - Leases() LeaseInformer + Leases() TypedLeaseInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// Leases returns a LeaseInformer. -func (v *version) Leases() LeaseInformer { +// Leases returns a TypedLeaseInformer. +func (v *version) Leases() TypedLeaseInformer { return &leaseInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/coordination/v1/lease.go b/vendor/k8s.io/client-go/informers/coordination/v1/lease.go index cce8ab4d13..feec290441 100644 --- a/vendor/k8s.io/client-go/informers/coordination/v1/lease.go +++ b/vendor/k8s.io/client-go/informers/coordination/v1/lease.go @@ -34,12 +34,40 @@ import ( ) // LeaseInformer provides access to a shared informer and lister for -// Leases. +// Leases. Prefer using the type-safe variant (see [TypedLeaseInformer]). type LeaseInformer interface { Informer() cache.SharedIndexInformer Lister() coordinationv1.LeaseLister } +// TypedLeaseInformer provides access to a shared informer and lister for +// Leases, including the type-safe TypedInformer variant. +// It is a superset of LeaseInformer. +type TypedLeaseInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() LeaseIndexInformer + Lister() coordinationv1.LeaseLister +} + +// LeaseIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type LeaseIndexInformer cache.TypedSharedIndexInformer[*apicoordinationv1.Lease] + +// LeaseHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Lease. +type LeaseHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicoordinationv1.Lease] + +// LeaseDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Lease. +type LeaseDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicoordinationv1.Lease] + +// LeaseFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Lease. +type LeaseFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicoordinationv1.Lease] + +// LeaseIndexers is a specialization of [cache.TypedIndexers] for Lease. +type LeaseIndexers = cache.TypedIndexers[*apicoordinationv1.Lease] + +// DeletedLease is a specialization of [cache.DeletedObject] for Lease. +type DeletedLease = cache.DeletedObject[*apicoordinationv1.Lease] + type leaseInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type leaseInformer struct { // NewLeaseInformer constructs a new informer for Lease type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedLeaseInformer]). func NewLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewLeaseInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedLeaseInformer constructs a new informer for Lease type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers LeaseIndexers) LeaseIndexInformer { + return NewTypedLeaseInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredLeaseInformer constructs a new informer for Lease type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredLeaseInformer]). func NewFilteredLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewLeaseInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedLeaseInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredLeaseInformer constructs a new informer for Lease type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers LeaseIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) LeaseIndexInformer { + return NewTypedLeaseInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewLeaseInformerWithOptions constructs a new informer for Lease type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedLeaseInformerWithOptions]). func NewLeaseInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedLeaseInformerWithOptions(client, namespace, options) +} + +// NewTypedLeaseInformerWithOptions constructs a new informer for Lease type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedLeaseInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) LeaseIndexInformer { gvr := schema.GroupVersionResource{Group: "coordination.k8s.io", Version: "v1", Resource: "leases"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicoordinationv1.Lease](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewLeaseInformerWithOptions(client kubernetes.Interface, namespace string, Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *leaseInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewLeaseInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedLeaseInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *leaseInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicoordinationv1.Lease{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *leaseInformer) TypedInformer() LeaseIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicoordinationv1.Lease](f.factory.InformerFor(&apicoordinationv1.Lease{}, f.defaultInformer)) } func (f *leaseInformer) Lister() coordinationv1.LeaseLister { return coordinationv1.NewLeaseLister(f.Informer().GetIndexer()) } + +// ToTypedLeaseInformer converts an untyped informer into a TypedLeaseInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Lease. If that is not the case, calling type-safe methods of the returned +// TypedLeaseInformer leads to runtime panics. A safer alternative is to pass +// around a TypedLeaseInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedLeaseInformer(informer LeaseInformer) TypedLeaseInformer { + if informer, ok := informer.(TypedLeaseInformer); ok { + return informer + } + return &leaseTypedInformerAdapter{informer} +} + +type leaseTypedInformerAdapter struct { + LeaseInformer +} + +func (a *leaseTypedInformerAdapter) TypedInformer() LeaseIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicoordinationv1.Lease](a.Informer()) +} + +// ToLeaseIndexInformer converts an untyped informer into a LeaseIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Lease. If that is not the case, calling type-safe methods of the returned +// LeaseIndexInformer leads to runtime panics. A safer alternative is to pass +// around a LeaseIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToLeaseIndexInformer(informer cache.SharedIndexInformer) LeaseIndexInformer { + if informer, ok := informer.(LeaseIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicoordinationv1.Lease](informer) +} diff --git a/vendor/k8s.io/client-go/informers/coordination/v1alpha2/interface.go b/vendor/k8s.io/client-go/informers/coordination/v1alpha2/interface.go index ba83768ade..13aea61e78 100644 --- a/vendor/k8s.io/client-go/informers/coordination/v1alpha2/interface.go +++ b/vendor/k8s.io/client-go/informers/coordination/v1alpha2/interface.go @@ -25,7 +25,7 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // LeaseCandidates returns a LeaseCandidateInformer. - LeaseCandidates() LeaseCandidateInformer + LeaseCandidates() TypedLeaseCandidateInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// LeaseCandidates returns a LeaseCandidateInformer. -func (v *version) LeaseCandidates() LeaseCandidateInformer { +// LeaseCandidates returns a TypedLeaseCandidateInformer. +func (v *version) LeaseCandidates() TypedLeaseCandidateInformer { return &leaseCandidateInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/coordination/v1alpha2/leasecandidate.go b/vendor/k8s.io/client-go/informers/coordination/v1alpha2/leasecandidate.go index 5aa0ff3ae2..55071de0f8 100644 --- a/vendor/k8s.io/client-go/informers/coordination/v1alpha2/leasecandidate.go +++ b/vendor/k8s.io/client-go/informers/coordination/v1alpha2/leasecandidate.go @@ -34,12 +34,40 @@ import ( ) // LeaseCandidateInformer provides access to a shared informer and lister for -// LeaseCandidates. +// LeaseCandidates. Prefer using the type-safe variant (see [TypedLeaseCandidateInformer]). type LeaseCandidateInformer interface { Informer() cache.SharedIndexInformer Lister() coordinationv1alpha2.LeaseCandidateLister } +// TypedLeaseCandidateInformer provides access to a shared informer and lister for +// LeaseCandidates, including the type-safe TypedInformer variant. +// It is a superset of LeaseCandidateInformer. +type TypedLeaseCandidateInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() LeaseCandidateIndexInformer + Lister() coordinationv1alpha2.LeaseCandidateLister +} + +// LeaseCandidateIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type LeaseCandidateIndexInformer cache.TypedSharedIndexInformer[*apicoordinationv1alpha2.LeaseCandidate] + +// LeaseCandidateHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for LeaseCandidate. +type LeaseCandidateHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicoordinationv1alpha2.LeaseCandidate] + +// LeaseCandidateDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for LeaseCandidate. +type LeaseCandidateDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicoordinationv1alpha2.LeaseCandidate] + +// LeaseCandidateFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for LeaseCandidate. +type LeaseCandidateFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicoordinationv1alpha2.LeaseCandidate] + +// LeaseCandidateIndexers is a specialization of [cache.TypedIndexers] for LeaseCandidate. +type LeaseCandidateIndexers = cache.TypedIndexers[*apicoordinationv1alpha2.LeaseCandidate] + +// DeletedLeaseCandidate is a specialization of [cache.DeletedObject] for LeaseCandidate. +type DeletedLeaseCandidate = cache.DeletedObject[*apicoordinationv1alpha2.LeaseCandidate] + type leaseCandidateInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type leaseCandidateInformer struct { // NewLeaseCandidateInformer constructs a new informer for LeaseCandidate type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedLeaseCandidateInformer]). func NewLeaseCandidateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewLeaseCandidateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedLeaseCandidateInformer constructs a new informer for LeaseCandidate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedLeaseCandidateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers LeaseCandidateIndexers) LeaseCandidateIndexInformer { + return NewTypedLeaseCandidateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredLeaseCandidateInformer constructs a new informer for LeaseCandidate type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredLeaseCandidateInformer]). func NewFilteredLeaseCandidateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewLeaseCandidateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedLeaseCandidateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredLeaseCandidateInformer constructs a new informer for LeaseCandidate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredLeaseCandidateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers LeaseCandidateIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) LeaseCandidateIndexInformer { + return NewTypedLeaseCandidateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewLeaseCandidateInformerWithOptions constructs a new informer for LeaseCandidate type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedLeaseCandidateInformerWithOptions]). func NewLeaseCandidateInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedLeaseCandidateInformerWithOptions(client, namespace, options) +} + +// NewTypedLeaseCandidateInformerWithOptions constructs a new informer for LeaseCandidate type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedLeaseCandidateInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) LeaseCandidateIndexInformer { gvr := schema.GroupVersionResource{Group: "coordination.k8s.io", Version: "v1alpha2", Resource: "leasecandidates"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicoordinationv1alpha2.LeaseCandidate](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewLeaseCandidateInformerWithOptions(client kubernetes.Interface, namespace Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *leaseCandidateInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewLeaseCandidateInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedLeaseCandidateInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *leaseCandidateInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicoordinationv1alpha2.LeaseCandidate{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *leaseCandidateInformer) TypedInformer() LeaseCandidateIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicoordinationv1alpha2.LeaseCandidate](f.factory.InformerFor(&apicoordinationv1alpha2.LeaseCandidate{}, f.defaultInformer)) } func (f *leaseCandidateInformer) Lister() coordinationv1alpha2.LeaseCandidateLister { return coordinationv1alpha2.NewLeaseCandidateLister(f.Informer().GetIndexer()) } + +// ToTypedLeaseCandidateInformer converts an untyped informer into a TypedLeaseCandidateInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *LeaseCandidate. If that is not the case, calling type-safe methods of the returned +// TypedLeaseCandidateInformer leads to runtime panics. A safer alternative is to pass +// around a TypedLeaseCandidateInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedLeaseCandidateInformer(informer LeaseCandidateInformer) TypedLeaseCandidateInformer { + if informer, ok := informer.(TypedLeaseCandidateInformer); ok { + return informer + } + return &leaseCandidateTypedInformerAdapter{informer} +} + +type leaseCandidateTypedInformerAdapter struct { + LeaseCandidateInformer +} + +func (a *leaseCandidateTypedInformerAdapter) TypedInformer() LeaseCandidateIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicoordinationv1alpha2.LeaseCandidate](a.Informer()) +} + +// ToLeaseCandidateIndexInformer converts an untyped informer into a LeaseCandidateIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *LeaseCandidate. If that is not the case, calling type-safe methods of the returned +// LeaseCandidateIndexInformer leads to runtime panics. A safer alternative is to pass +// around a LeaseCandidateIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToLeaseCandidateIndexInformer(informer cache.SharedIndexInformer) LeaseCandidateIndexInformer { + if informer, ok := informer.(LeaseCandidateIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicoordinationv1alpha2.LeaseCandidate](informer) +} diff --git a/vendor/k8s.io/client-go/informers/coordination/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/coordination/v1beta1/interface.go index 707e510869..41af125913 100644 --- a/vendor/k8s.io/client-go/informers/coordination/v1beta1/interface.go +++ b/vendor/k8s.io/client-go/informers/coordination/v1beta1/interface.go @@ -25,9 +25,9 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // Leases returns a LeaseInformer. - Leases() LeaseInformer + Leases() TypedLeaseInformer // LeaseCandidates returns a LeaseCandidateInformer. - LeaseCandidates() LeaseCandidateInformer + LeaseCandidates() TypedLeaseCandidateInformer } type version struct { @@ -41,12 +41,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// Leases returns a LeaseInformer. -func (v *version) Leases() LeaseInformer { +// Leases returns a TypedLeaseInformer. +func (v *version) Leases() TypedLeaseInformer { return &leaseInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// LeaseCandidates returns a LeaseCandidateInformer. -func (v *version) LeaseCandidates() LeaseCandidateInformer { +// LeaseCandidates returns a TypedLeaseCandidateInformer. +func (v *version) LeaseCandidates() TypedLeaseCandidateInformer { return &leaseCandidateInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go b/vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go index 66802fd949..458e2ce48d 100644 --- a/vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go +++ b/vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go @@ -34,12 +34,40 @@ import ( ) // LeaseInformer provides access to a shared informer and lister for -// Leases. +// Leases. Prefer using the type-safe variant (see [TypedLeaseInformer]). type LeaseInformer interface { Informer() cache.SharedIndexInformer Lister() coordinationv1beta1.LeaseLister } +// TypedLeaseInformer provides access to a shared informer and lister for +// Leases, including the type-safe TypedInformer variant. +// It is a superset of LeaseInformer. +type TypedLeaseInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() LeaseIndexInformer + Lister() coordinationv1beta1.LeaseLister +} + +// LeaseIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type LeaseIndexInformer cache.TypedSharedIndexInformer[*apicoordinationv1beta1.Lease] + +// LeaseHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Lease. +type LeaseHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicoordinationv1beta1.Lease] + +// LeaseDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Lease. +type LeaseDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicoordinationv1beta1.Lease] + +// LeaseFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Lease. +type LeaseFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicoordinationv1beta1.Lease] + +// LeaseIndexers is a specialization of [cache.TypedIndexers] for Lease. +type LeaseIndexers = cache.TypedIndexers[*apicoordinationv1beta1.Lease] + +// DeletedLease is a specialization of [cache.DeletedObject] for Lease. +type DeletedLease = cache.DeletedObject[*apicoordinationv1beta1.Lease] + type leaseInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type leaseInformer struct { // NewLeaseInformer constructs a new informer for Lease type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedLeaseInformer]). func NewLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewLeaseInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedLeaseInformer constructs a new informer for Lease type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers LeaseIndexers) LeaseIndexInformer { + return NewTypedLeaseInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredLeaseInformer constructs a new informer for Lease type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredLeaseInformer]). func NewFilteredLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewLeaseInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedLeaseInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredLeaseInformer constructs a new informer for Lease type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers LeaseIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) LeaseIndexInformer { + return NewTypedLeaseInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewLeaseInformerWithOptions constructs a new informer for Lease type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedLeaseInformerWithOptions]). func NewLeaseInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedLeaseInformerWithOptions(client, namespace, options) +} + +// NewTypedLeaseInformerWithOptions constructs a new informer for Lease type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedLeaseInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) LeaseIndexInformer { gvr := schema.GroupVersionResource{Group: "coordination.k8s.io", Version: "v1beta1", Resource: "leases"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicoordinationv1beta1.Lease](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewLeaseInformerWithOptions(client kubernetes.Interface, namespace string, Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *leaseInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewLeaseInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedLeaseInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *leaseInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicoordinationv1beta1.Lease{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *leaseInformer) TypedInformer() LeaseIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicoordinationv1beta1.Lease](f.factory.InformerFor(&apicoordinationv1beta1.Lease{}, f.defaultInformer)) } func (f *leaseInformer) Lister() coordinationv1beta1.LeaseLister { return coordinationv1beta1.NewLeaseLister(f.Informer().GetIndexer()) } + +// ToTypedLeaseInformer converts an untyped informer into a TypedLeaseInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Lease. If that is not the case, calling type-safe methods of the returned +// TypedLeaseInformer leads to runtime panics. A safer alternative is to pass +// around a TypedLeaseInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedLeaseInformer(informer LeaseInformer) TypedLeaseInformer { + if informer, ok := informer.(TypedLeaseInformer); ok { + return informer + } + return &leaseTypedInformerAdapter{informer} +} + +type leaseTypedInformerAdapter struct { + LeaseInformer +} + +func (a *leaseTypedInformerAdapter) TypedInformer() LeaseIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicoordinationv1beta1.Lease](a.Informer()) +} + +// ToLeaseIndexInformer converts an untyped informer into a LeaseIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Lease. If that is not the case, calling type-safe methods of the returned +// LeaseIndexInformer leads to runtime panics. A safer alternative is to pass +// around a LeaseIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToLeaseIndexInformer(informer cache.SharedIndexInformer) LeaseIndexInformer { + if informer, ok := informer.(LeaseIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicoordinationv1beta1.Lease](informer) +} diff --git a/vendor/k8s.io/client-go/informers/coordination/v1beta1/leasecandidate.go b/vendor/k8s.io/client-go/informers/coordination/v1beta1/leasecandidate.go index ee83397f4c..05cdf9a82f 100644 --- a/vendor/k8s.io/client-go/informers/coordination/v1beta1/leasecandidate.go +++ b/vendor/k8s.io/client-go/informers/coordination/v1beta1/leasecandidate.go @@ -34,12 +34,40 @@ import ( ) // LeaseCandidateInformer provides access to a shared informer and lister for -// LeaseCandidates. +// LeaseCandidates. Prefer using the type-safe variant (see [TypedLeaseCandidateInformer]). type LeaseCandidateInformer interface { Informer() cache.SharedIndexInformer Lister() coordinationv1beta1.LeaseCandidateLister } +// TypedLeaseCandidateInformer provides access to a shared informer and lister for +// LeaseCandidates, including the type-safe TypedInformer variant. +// It is a superset of LeaseCandidateInformer. +type TypedLeaseCandidateInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() LeaseCandidateIndexInformer + Lister() coordinationv1beta1.LeaseCandidateLister +} + +// LeaseCandidateIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type LeaseCandidateIndexInformer cache.TypedSharedIndexInformer[*apicoordinationv1beta1.LeaseCandidate] + +// LeaseCandidateHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for LeaseCandidate. +type LeaseCandidateHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicoordinationv1beta1.LeaseCandidate] + +// LeaseCandidateDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for LeaseCandidate. +type LeaseCandidateDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicoordinationv1beta1.LeaseCandidate] + +// LeaseCandidateFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for LeaseCandidate. +type LeaseCandidateFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicoordinationv1beta1.LeaseCandidate] + +// LeaseCandidateIndexers is a specialization of [cache.TypedIndexers] for LeaseCandidate. +type LeaseCandidateIndexers = cache.TypedIndexers[*apicoordinationv1beta1.LeaseCandidate] + +// DeletedLeaseCandidate is a specialization of [cache.DeletedObject] for LeaseCandidate. +type DeletedLeaseCandidate = cache.DeletedObject[*apicoordinationv1beta1.LeaseCandidate] + type leaseCandidateInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type leaseCandidateInformer struct { // NewLeaseCandidateInformer constructs a new informer for LeaseCandidate type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedLeaseCandidateInformer]). func NewLeaseCandidateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewLeaseCandidateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedLeaseCandidateInformer constructs a new informer for LeaseCandidate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedLeaseCandidateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers LeaseCandidateIndexers) LeaseCandidateIndexInformer { + return NewTypedLeaseCandidateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredLeaseCandidateInformer constructs a new informer for LeaseCandidate type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredLeaseCandidateInformer]). func NewFilteredLeaseCandidateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewLeaseCandidateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedLeaseCandidateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredLeaseCandidateInformer constructs a new informer for LeaseCandidate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredLeaseCandidateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers LeaseCandidateIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) LeaseCandidateIndexInformer { + return NewTypedLeaseCandidateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewLeaseCandidateInformerWithOptions constructs a new informer for LeaseCandidate type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedLeaseCandidateInformerWithOptions]). func NewLeaseCandidateInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedLeaseCandidateInformerWithOptions(client, namespace, options) +} + +// NewTypedLeaseCandidateInformerWithOptions constructs a new informer for LeaseCandidate type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedLeaseCandidateInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) LeaseCandidateIndexInformer { gvr := schema.GroupVersionResource{Group: "coordination.k8s.io", Version: "v1beta1", Resource: "leasecandidates"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicoordinationv1beta1.LeaseCandidate](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewLeaseCandidateInformerWithOptions(client kubernetes.Interface, namespace Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *leaseCandidateInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewLeaseCandidateInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedLeaseCandidateInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *leaseCandidateInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicoordinationv1beta1.LeaseCandidate{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *leaseCandidateInformer) TypedInformer() LeaseCandidateIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicoordinationv1beta1.LeaseCandidate](f.factory.InformerFor(&apicoordinationv1beta1.LeaseCandidate{}, f.defaultInformer)) } func (f *leaseCandidateInformer) Lister() coordinationv1beta1.LeaseCandidateLister { return coordinationv1beta1.NewLeaseCandidateLister(f.Informer().GetIndexer()) } + +// ToTypedLeaseCandidateInformer converts an untyped informer into a TypedLeaseCandidateInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *LeaseCandidate. If that is not the case, calling type-safe methods of the returned +// TypedLeaseCandidateInformer leads to runtime panics. A safer alternative is to pass +// around a TypedLeaseCandidateInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedLeaseCandidateInformer(informer LeaseCandidateInformer) TypedLeaseCandidateInformer { + if informer, ok := informer.(TypedLeaseCandidateInformer); ok { + return informer + } + return &leaseCandidateTypedInformerAdapter{informer} +} + +type leaseCandidateTypedInformerAdapter struct { + LeaseCandidateInformer +} + +func (a *leaseCandidateTypedInformerAdapter) TypedInformer() LeaseCandidateIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicoordinationv1beta1.LeaseCandidate](a.Informer()) +} + +// ToLeaseCandidateIndexInformer converts an untyped informer into a LeaseCandidateIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *LeaseCandidate. If that is not the case, calling type-safe methods of the returned +// LeaseCandidateIndexInformer leads to runtime panics. A safer alternative is to pass +// around a LeaseCandidateIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToLeaseCandidateIndexInformer(informer cache.SharedIndexInformer) LeaseCandidateIndexInformer { + if informer, ok := informer.(LeaseCandidateIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicoordinationv1beta1.LeaseCandidate](informer) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/componentstatus.go b/vendor/k8s.io/client-go/informers/core/v1/componentstatus.go index 5b6f6556c3..97dbda2b43 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/componentstatus.go +++ b/vendor/k8s.io/client-go/informers/core/v1/componentstatus.go @@ -34,12 +34,40 @@ import ( ) // ComponentStatusInformer provides access to a shared informer and lister for -// ComponentStatuses. +// ComponentStatuses. Prefer using the type-safe variant (see [TypedComponentStatusInformer]). type ComponentStatusInformer interface { Informer() cache.SharedIndexInformer Lister() corev1.ComponentStatusLister } +// TypedComponentStatusInformer provides access to a shared informer and lister for +// ComponentStatuses, including the type-safe TypedInformer variant. +// It is a superset of ComponentStatusInformer. +type TypedComponentStatusInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ComponentStatusIndexInformer + Lister() corev1.ComponentStatusLister +} + +// ComponentStatusIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ComponentStatusIndexInformer cache.TypedSharedIndexInformer[*apicorev1.ComponentStatus] + +// ComponentStatusHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ComponentStatus. +type ComponentStatusHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicorev1.ComponentStatus] + +// ComponentStatusDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ComponentStatus. +type ComponentStatusDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicorev1.ComponentStatus] + +// ComponentStatusFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ComponentStatus. +type ComponentStatusFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicorev1.ComponentStatus] + +// ComponentStatusIndexers is a specialization of [cache.TypedIndexers] for ComponentStatus. +type ComponentStatusIndexers = cache.TypedIndexers[*apicorev1.ComponentStatus] + +// DeletedComponentStatus is a specialization of [cache.DeletedObject] for ComponentStatus. +type DeletedComponentStatus = cache.DeletedObject[*apicorev1.ComponentStatus] + type componentStatusInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type componentStatusInformer struct { // NewComponentStatusInformer constructs a new informer for ComponentStatus type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedComponentStatusInformer]). func NewComponentStatusInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewComponentStatusInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedComponentStatusInformer constructs a new informer for ComponentStatus type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedComponentStatusInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ComponentStatusIndexers) ComponentStatusIndexInformer { + return NewTypedComponentStatusInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredComponentStatusInformer constructs a new informer for ComponentStatus type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredComponentStatusInformer]). func NewFilteredComponentStatusInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewComponentStatusInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedComponentStatusInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredComponentStatusInformer constructs a new informer for ComponentStatus type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredComponentStatusInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ComponentStatusIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ComponentStatusIndexInformer { + return NewTypedComponentStatusInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewComponentStatusInformerWithOptions constructs a new informer for ComponentStatus type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedComponentStatusInformerWithOptions]). func NewComponentStatusInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedComponentStatusInformerWithOptions(client, options) +} + +// NewTypedComponentStatusInformerWithOptions constructs a new informer for ComponentStatus type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedComponentStatusInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ComponentStatusIndexInformer { gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "componentstatuss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicorev1.ComponentStatus](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewComponentStatusInformerWithOptions(client kubernetes.Interface, options Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *componentStatusInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewComponentStatusInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedComponentStatusInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *componentStatusInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicorev1.ComponentStatus{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *componentStatusInformer) TypedInformer() ComponentStatusIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.ComponentStatus](f.factory.InformerFor(&apicorev1.ComponentStatus{}, f.defaultInformer)) } func (f *componentStatusInformer) Lister() corev1.ComponentStatusLister { return corev1.NewComponentStatusLister(f.Informer().GetIndexer()) } + +// ToTypedComponentStatusInformer converts an untyped informer into a TypedComponentStatusInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ComponentStatus. If that is not the case, calling type-safe methods of the returned +// TypedComponentStatusInformer leads to runtime panics. A safer alternative is to pass +// around a TypedComponentStatusInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedComponentStatusInformer(informer ComponentStatusInformer) TypedComponentStatusInformer { + if informer, ok := informer.(TypedComponentStatusInformer); ok { + return informer + } + return &componentStatusTypedInformerAdapter{informer} +} + +type componentStatusTypedInformerAdapter struct { + ComponentStatusInformer +} + +func (a *componentStatusTypedInformerAdapter) TypedInformer() ComponentStatusIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.ComponentStatus](a.Informer()) +} + +// ToComponentStatusIndexInformer converts an untyped informer into a ComponentStatusIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ComponentStatus. If that is not the case, calling type-safe methods of the returned +// ComponentStatusIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ComponentStatusIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToComponentStatusIndexInformer(informer cache.SharedIndexInformer) ComponentStatusIndexInformer { + if informer, ok := informer.(ComponentStatusIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicorev1.ComponentStatus](informer) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/configmap.go b/vendor/k8s.io/client-go/informers/core/v1/configmap.go index 5b6389884b..db84d29736 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/configmap.go +++ b/vendor/k8s.io/client-go/informers/core/v1/configmap.go @@ -34,12 +34,40 @@ import ( ) // ConfigMapInformer provides access to a shared informer and lister for -// ConfigMaps. +// ConfigMaps. Prefer using the type-safe variant (see [TypedConfigMapInformer]). type ConfigMapInformer interface { Informer() cache.SharedIndexInformer Lister() corev1.ConfigMapLister } +// TypedConfigMapInformer provides access to a shared informer and lister for +// ConfigMaps, including the type-safe TypedInformer variant. +// It is a superset of ConfigMapInformer. +type TypedConfigMapInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ConfigMapIndexInformer + Lister() corev1.ConfigMapLister +} + +// ConfigMapIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ConfigMapIndexInformer cache.TypedSharedIndexInformer[*apicorev1.ConfigMap] + +// ConfigMapHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ConfigMap. +type ConfigMapHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicorev1.ConfigMap] + +// ConfigMapDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ConfigMap. +type ConfigMapDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicorev1.ConfigMap] + +// ConfigMapFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ConfigMap. +type ConfigMapFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicorev1.ConfigMap] + +// ConfigMapIndexers is a specialization of [cache.TypedIndexers] for ConfigMap. +type ConfigMapIndexers = cache.TypedIndexers[*apicorev1.ConfigMap] + +// DeletedConfigMap is a specialization of [cache.DeletedObject] for ConfigMap. +type DeletedConfigMap = cache.DeletedObject[*apicorev1.ConfigMap] + type configMapInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type configMapInformer struct { // NewConfigMapInformer constructs a new informer for ConfigMap type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedConfigMapInformer]). func NewConfigMapInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewConfigMapInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedConfigMapInformer constructs a new informer for ConfigMap type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedConfigMapInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ConfigMapIndexers) ConfigMapIndexInformer { + return NewTypedConfigMapInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredConfigMapInformer constructs a new informer for ConfigMap type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredConfigMapInformer]). func NewFilteredConfigMapInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewConfigMapInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedConfigMapInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredConfigMapInformer constructs a new informer for ConfigMap type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredConfigMapInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ConfigMapIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ConfigMapIndexInformer { + return NewTypedConfigMapInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewConfigMapInformerWithOptions constructs a new informer for ConfigMap type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedConfigMapInformerWithOptions]). func NewConfigMapInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedConfigMapInformerWithOptions(client, namespace, options) +} + +// NewTypedConfigMapInformerWithOptions constructs a new informer for ConfigMap type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedConfigMapInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) ConfigMapIndexInformer { gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "configmaps"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicorev1.ConfigMap](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewConfigMapInformerWithOptions(client kubernetes.Interface, namespace stri Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *configMapInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewConfigMapInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedConfigMapInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *configMapInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicorev1.ConfigMap{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *configMapInformer) TypedInformer() ConfigMapIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.ConfigMap](f.factory.InformerFor(&apicorev1.ConfigMap{}, f.defaultInformer)) } func (f *configMapInformer) Lister() corev1.ConfigMapLister { return corev1.NewConfigMapLister(f.Informer().GetIndexer()) } + +// ToTypedConfigMapInformer converts an untyped informer into a TypedConfigMapInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ConfigMap. If that is not the case, calling type-safe methods of the returned +// TypedConfigMapInformer leads to runtime panics. A safer alternative is to pass +// around a TypedConfigMapInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedConfigMapInformer(informer ConfigMapInformer) TypedConfigMapInformer { + if informer, ok := informer.(TypedConfigMapInformer); ok { + return informer + } + return &configMapTypedInformerAdapter{informer} +} + +type configMapTypedInformerAdapter struct { + ConfigMapInformer +} + +func (a *configMapTypedInformerAdapter) TypedInformer() ConfigMapIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.ConfigMap](a.Informer()) +} + +// ToConfigMapIndexInformer converts an untyped informer into a ConfigMapIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ConfigMap. If that is not the case, calling type-safe methods of the returned +// ConfigMapIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ConfigMapIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToConfigMapIndexInformer(informer cache.SharedIndexInformer) ConfigMapIndexInformer { + if informer, ok := informer.(ConfigMapIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicorev1.ConfigMap](informer) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/endpoints.go b/vendor/k8s.io/client-go/informers/core/v1/endpoints.go index 1609ce7f7e..240967c3e4 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/endpoints.go +++ b/vendor/k8s.io/client-go/informers/core/v1/endpoints.go @@ -34,12 +34,40 @@ import ( ) // EndpointsInformer provides access to a shared informer and lister for -// Endpoints. +// Endpoints. Prefer using the type-safe variant (see [TypedEndpointsInformer]). type EndpointsInformer interface { Informer() cache.SharedIndexInformer Lister() corev1.EndpointsLister } +// TypedEndpointsInformer provides access to a shared informer and lister for +// Endpoints, including the type-safe TypedInformer variant. +// It is a superset of EndpointsInformer. +type TypedEndpointsInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() EndpointsIndexInformer + Lister() corev1.EndpointsLister +} + +// EndpointsIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type EndpointsIndexInformer cache.TypedSharedIndexInformer[*apicorev1.Endpoints] + +// EndpointsHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Endpoints. +type EndpointsHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicorev1.Endpoints] + +// EndpointsDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Endpoints. +type EndpointsDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicorev1.Endpoints] + +// EndpointsFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Endpoints. +type EndpointsFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicorev1.Endpoints] + +// EndpointsIndexers is a specialization of [cache.TypedIndexers] for Endpoints. +type EndpointsIndexers = cache.TypedIndexers[*apicorev1.Endpoints] + +// DeletedEndpoints is a specialization of [cache.DeletedObject] for Endpoints. +type DeletedEndpoints = cache.DeletedObject[*apicorev1.Endpoints] + type endpointsInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type endpointsInformer struct { // NewEndpointsInformer constructs a new informer for Endpoints type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedEndpointsInformer]). func NewEndpointsInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewEndpointsInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedEndpointsInformer constructs a new informer for Endpoints type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedEndpointsInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers EndpointsIndexers) EndpointsIndexInformer { + return NewTypedEndpointsInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredEndpointsInformer constructs a new informer for Endpoints type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredEndpointsInformer]). func NewFilteredEndpointsInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewEndpointsInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedEndpointsInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredEndpointsInformer constructs a new informer for Endpoints type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredEndpointsInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers EndpointsIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) EndpointsIndexInformer { + return NewTypedEndpointsInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewEndpointsInformerWithOptions constructs a new informer for Endpoints type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedEndpointsInformerWithOptions]). func NewEndpointsInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedEndpointsInformerWithOptions(client, namespace, options) +} + +// NewTypedEndpointsInformerWithOptions constructs a new informer for Endpoints type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedEndpointsInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) EndpointsIndexInformer { gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "endpointss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicorev1.Endpoints](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewEndpointsInformerWithOptions(client kubernetes.Interface, namespace stri Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *endpointsInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewEndpointsInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedEndpointsInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *endpointsInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicorev1.Endpoints{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *endpointsInformer) TypedInformer() EndpointsIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.Endpoints](f.factory.InformerFor(&apicorev1.Endpoints{}, f.defaultInformer)) } func (f *endpointsInformer) Lister() corev1.EndpointsLister { return corev1.NewEndpointsLister(f.Informer().GetIndexer()) } + +// ToTypedEndpointsInformer converts an untyped informer into a TypedEndpointsInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Endpoints. If that is not the case, calling type-safe methods of the returned +// TypedEndpointsInformer leads to runtime panics. A safer alternative is to pass +// around a TypedEndpointsInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedEndpointsInformer(informer EndpointsInformer) TypedEndpointsInformer { + if informer, ok := informer.(TypedEndpointsInformer); ok { + return informer + } + return &endpointsTypedInformerAdapter{informer} +} + +type endpointsTypedInformerAdapter struct { + EndpointsInformer +} + +func (a *endpointsTypedInformerAdapter) TypedInformer() EndpointsIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.Endpoints](a.Informer()) +} + +// ToEndpointsIndexInformer converts an untyped informer into a EndpointsIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Endpoints. If that is not the case, calling type-safe methods of the returned +// EndpointsIndexInformer leads to runtime panics. A safer alternative is to pass +// around a EndpointsIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToEndpointsIndexInformer(informer cache.SharedIndexInformer) EndpointsIndexInformer { + if informer, ok := informer.(EndpointsIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicorev1.Endpoints](informer) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/event.go b/vendor/k8s.io/client-go/informers/core/v1/event.go index ff9c3c5847..65c078565a 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/event.go +++ b/vendor/k8s.io/client-go/informers/core/v1/event.go @@ -34,12 +34,40 @@ import ( ) // EventInformer provides access to a shared informer and lister for -// Events. +// Events. Prefer using the type-safe variant (see [TypedEventInformer]). type EventInformer interface { Informer() cache.SharedIndexInformer Lister() corev1.EventLister } +// TypedEventInformer provides access to a shared informer and lister for +// Events, including the type-safe TypedInformer variant. +// It is a superset of EventInformer. +type TypedEventInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() EventIndexInformer + Lister() corev1.EventLister +} + +// EventIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type EventIndexInformer cache.TypedSharedIndexInformer[*apicorev1.Event] + +// EventHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Event. +type EventHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicorev1.Event] + +// EventDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Event. +type EventDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicorev1.Event] + +// EventFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Event. +type EventFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicorev1.Event] + +// EventIndexers is a specialization of [cache.TypedIndexers] for Event. +type EventIndexers = cache.TypedIndexers[*apicorev1.Event] + +// DeletedEvent is a specialization of [cache.DeletedObject] for Event. +type DeletedEvent = cache.DeletedObject[*apicorev1.Event] + type eventInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type eventInformer struct { // NewEventInformer constructs a new informer for Event type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedEventInformer]). func NewEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers EventIndexers) EventIndexInformer { + return NewTypedEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredEventInformer constructs a new informer for Event type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredEventInformer]). func NewFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers EventIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) EventIndexInformer { + return NewTypedEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewEventInformerWithOptions constructs a new informer for Event type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedEventInformerWithOptions]). func NewEventInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedEventInformerWithOptions(client, namespace, options) +} + +// NewTypedEventInformerWithOptions constructs a new informer for Event type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedEventInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) EventIndexInformer { gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "events"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicorev1.Event](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewEventInformerWithOptions(client kubernetes.Interface, namespace string, Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *eventInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewEventInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedEventInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *eventInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicorev1.Event{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *eventInformer) TypedInformer() EventIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.Event](f.factory.InformerFor(&apicorev1.Event{}, f.defaultInformer)) } func (f *eventInformer) Lister() corev1.EventLister { return corev1.NewEventLister(f.Informer().GetIndexer()) } + +// ToTypedEventInformer converts an untyped informer into a TypedEventInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Event. If that is not the case, calling type-safe methods of the returned +// TypedEventInformer leads to runtime panics. A safer alternative is to pass +// around a TypedEventInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedEventInformer(informer EventInformer) TypedEventInformer { + if informer, ok := informer.(TypedEventInformer); ok { + return informer + } + return &eventTypedInformerAdapter{informer} +} + +type eventTypedInformerAdapter struct { + EventInformer +} + +func (a *eventTypedInformerAdapter) TypedInformer() EventIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.Event](a.Informer()) +} + +// ToEventIndexInformer converts an untyped informer into a EventIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Event. If that is not the case, calling type-safe methods of the returned +// EventIndexInformer leads to runtime panics. A safer alternative is to pass +// around a EventIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToEventIndexInformer(informer cache.SharedIndexInformer) EventIndexInformer { + if informer, ok := informer.(EventIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicorev1.Event](informer) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/interface.go b/vendor/k8s.io/client-go/informers/core/v1/interface.go index b2216a05c8..a951b30bd1 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/interface.go +++ b/vendor/k8s.io/client-go/informers/core/v1/interface.go @@ -25,37 +25,37 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // ComponentStatuses returns a ComponentStatusInformer. - ComponentStatuses() ComponentStatusInformer + ComponentStatuses() TypedComponentStatusInformer // ConfigMaps returns a ConfigMapInformer. - ConfigMaps() ConfigMapInformer + ConfigMaps() TypedConfigMapInformer // Endpoints returns a EndpointsInformer. - Endpoints() EndpointsInformer + Endpoints() TypedEndpointsInformer // Events returns a EventInformer. - Events() EventInformer + Events() TypedEventInformer // LimitRanges returns a LimitRangeInformer. - LimitRanges() LimitRangeInformer + LimitRanges() TypedLimitRangeInformer // Namespaces returns a NamespaceInformer. - Namespaces() NamespaceInformer + Namespaces() TypedNamespaceInformer // Nodes returns a NodeInformer. - Nodes() NodeInformer + Nodes() TypedNodeInformer // PersistentVolumes returns a PersistentVolumeInformer. - PersistentVolumes() PersistentVolumeInformer + PersistentVolumes() TypedPersistentVolumeInformer // PersistentVolumeClaims returns a PersistentVolumeClaimInformer. - PersistentVolumeClaims() PersistentVolumeClaimInformer + PersistentVolumeClaims() TypedPersistentVolumeClaimInformer // Pods returns a PodInformer. - Pods() PodInformer + Pods() TypedPodInformer // PodTemplates returns a PodTemplateInformer. - PodTemplates() PodTemplateInformer + PodTemplates() TypedPodTemplateInformer // ReplicationControllers returns a ReplicationControllerInformer. - ReplicationControllers() ReplicationControllerInformer + ReplicationControllers() TypedReplicationControllerInformer // ResourceQuotas returns a ResourceQuotaInformer. - ResourceQuotas() ResourceQuotaInformer + ResourceQuotas() TypedResourceQuotaInformer // Secrets returns a SecretInformer. - Secrets() SecretInformer + Secrets() TypedSecretInformer // Services returns a ServiceInformer. - Services() ServiceInformer + Services() TypedServiceInformer // ServiceAccounts returns a ServiceAccountInformer. - ServiceAccounts() ServiceAccountInformer + ServiceAccounts() TypedServiceAccountInformer } type version struct { @@ -69,82 +69,82 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// ComponentStatuses returns a ComponentStatusInformer. -func (v *version) ComponentStatuses() ComponentStatusInformer { +// ComponentStatuses returns a TypedComponentStatusInformer. +func (v *version) ComponentStatuses() TypedComponentStatusInformer { return &componentStatusInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// ConfigMaps returns a ConfigMapInformer. -func (v *version) ConfigMaps() ConfigMapInformer { +// ConfigMaps returns a TypedConfigMapInformer. +func (v *version) ConfigMaps() TypedConfigMapInformer { return &configMapInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// Endpoints returns a EndpointsInformer. -func (v *version) Endpoints() EndpointsInformer { +// Endpoints returns a TypedEndpointsInformer. +func (v *version) Endpoints() TypedEndpointsInformer { return &endpointsInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// Events returns a EventInformer. -func (v *version) Events() EventInformer { +// Events returns a TypedEventInformer. +func (v *version) Events() TypedEventInformer { return &eventInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// LimitRanges returns a LimitRangeInformer. -func (v *version) LimitRanges() LimitRangeInformer { +// LimitRanges returns a TypedLimitRangeInformer. +func (v *version) LimitRanges() TypedLimitRangeInformer { return &limitRangeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// Namespaces returns a NamespaceInformer. -func (v *version) Namespaces() NamespaceInformer { +// Namespaces returns a TypedNamespaceInformer. +func (v *version) Namespaces() TypedNamespaceInformer { return &namespaceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// Nodes returns a NodeInformer. -func (v *version) Nodes() NodeInformer { +// Nodes returns a TypedNodeInformer. +func (v *version) Nodes() TypedNodeInformer { return &nodeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// PersistentVolumes returns a PersistentVolumeInformer. -func (v *version) PersistentVolumes() PersistentVolumeInformer { +// PersistentVolumes returns a TypedPersistentVolumeInformer. +func (v *version) PersistentVolumes() TypedPersistentVolumeInformer { return &persistentVolumeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// PersistentVolumeClaims returns a PersistentVolumeClaimInformer. -func (v *version) PersistentVolumeClaims() PersistentVolumeClaimInformer { +// PersistentVolumeClaims returns a TypedPersistentVolumeClaimInformer. +func (v *version) PersistentVolumeClaims() TypedPersistentVolumeClaimInformer { return &persistentVolumeClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// Pods returns a PodInformer. -func (v *version) Pods() PodInformer { +// Pods returns a TypedPodInformer. +func (v *version) Pods() TypedPodInformer { return &podInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// PodTemplates returns a PodTemplateInformer. -func (v *version) PodTemplates() PodTemplateInformer { +// PodTemplates returns a TypedPodTemplateInformer. +func (v *version) PodTemplates() TypedPodTemplateInformer { return &podTemplateInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// ReplicationControllers returns a ReplicationControllerInformer. -func (v *version) ReplicationControllers() ReplicationControllerInformer { +// ReplicationControllers returns a TypedReplicationControllerInformer. +func (v *version) ReplicationControllers() TypedReplicationControllerInformer { return &replicationControllerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// ResourceQuotas returns a ResourceQuotaInformer. -func (v *version) ResourceQuotas() ResourceQuotaInformer { +// ResourceQuotas returns a TypedResourceQuotaInformer. +func (v *version) ResourceQuotas() TypedResourceQuotaInformer { return &resourceQuotaInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// Secrets returns a SecretInformer. -func (v *version) Secrets() SecretInformer { +// Secrets returns a TypedSecretInformer. +func (v *version) Secrets() TypedSecretInformer { return &secretInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// Services returns a ServiceInformer. -func (v *version) Services() ServiceInformer { +// Services returns a TypedServiceInformer. +func (v *version) Services() TypedServiceInformer { return &serviceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// ServiceAccounts returns a ServiceAccountInformer. -func (v *version) ServiceAccounts() ServiceAccountInformer { +// ServiceAccounts returns a TypedServiceAccountInformer. +func (v *version) ServiceAccounts() TypedServiceAccountInformer { return &serviceAccountInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/core/v1/limitrange.go b/vendor/k8s.io/client-go/informers/core/v1/limitrange.go index a3a01de6dc..a71e4496bc 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/limitrange.go +++ b/vendor/k8s.io/client-go/informers/core/v1/limitrange.go @@ -34,12 +34,40 @@ import ( ) // LimitRangeInformer provides access to a shared informer and lister for -// LimitRanges. +// LimitRanges. Prefer using the type-safe variant (see [TypedLimitRangeInformer]). type LimitRangeInformer interface { Informer() cache.SharedIndexInformer Lister() corev1.LimitRangeLister } +// TypedLimitRangeInformer provides access to a shared informer and lister for +// LimitRanges, including the type-safe TypedInformer variant. +// It is a superset of LimitRangeInformer. +type TypedLimitRangeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() LimitRangeIndexInformer + Lister() corev1.LimitRangeLister +} + +// LimitRangeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type LimitRangeIndexInformer cache.TypedSharedIndexInformer[*apicorev1.LimitRange] + +// LimitRangeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for LimitRange. +type LimitRangeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicorev1.LimitRange] + +// LimitRangeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for LimitRange. +type LimitRangeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicorev1.LimitRange] + +// LimitRangeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for LimitRange. +type LimitRangeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicorev1.LimitRange] + +// LimitRangeIndexers is a specialization of [cache.TypedIndexers] for LimitRange. +type LimitRangeIndexers = cache.TypedIndexers[*apicorev1.LimitRange] + +// DeletedLimitRange is a specialization of [cache.DeletedObject] for LimitRange. +type DeletedLimitRange = cache.DeletedObject[*apicorev1.LimitRange] + type limitRangeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type limitRangeInformer struct { // NewLimitRangeInformer constructs a new informer for LimitRange type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedLimitRangeInformer]). func NewLimitRangeInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewLimitRangeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedLimitRangeInformer constructs a new informer for LimitRange type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedLimitRangeInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers LimitRangeIndexers) LimitRangeIndexInformer { + return NewTypedLimitRangeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredLimitRangeInformer constructs a new informer for LimitRange type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredLimitRangeInformer]). func NewFilteredLimitRangeInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewLimitRangeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedLimitRangeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredLimitRangeInformer constructs a new informer for LimitRange type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredLimitRangeInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers LimitRangeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) LimitRangeIndexInformer { + return NewTypedLimitRangeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewLimitRangeInformerWithOptions constructs a new informer for LimitRange type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedLimitRangeInformerWithOptions]). func NewLimitRangeInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedLimitRangeInformerWithOptions(client, namespace, options) +} + +// NewTypedLimitRangeInformerWithOptions constructs a new informer for LimitRange type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedLimitRangeInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) LimitRangeIndexInformer { gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "limitranges"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicorev1.LimitRange](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewLimitRangeInformerWithOptions(client kubernetes.Interface, namespace str Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *limitRangeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewLimitRangeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedLimitRangeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *limitRangeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicorev1.LimitRange{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *limitRangeInformer) TypedInformer() LimitRangeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.LimitRange](f.factory.InformerFor(&apicorev1.LimitRange{}, f.defaultInformer)) } func (f *limitRangeInformer) Lister() corev1.LimitRangeLister { return corev1.NewLimitRangeLister(f.Informer().GetIndexer()) } + +// ToTypedLimitRangeInformer converts an untyped informer into a TypedLimitRangeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *LimitRange. If that is not the case, calling type-safe methods of the returned +// TypedLimitRangeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedLimitRangeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedLimitRangeInformer(informer LimitRangeInformer) TypedLimitRangeInformer { + if informer, ok := informer.(TypedLimitRangeInformer); ok { + return informer + } + return &limitRangeTypedInformerAdapter{informer} +} + +type limitRangeTypedInformerAdapter struct { + LimitRangeInformer +} + +func (a *limitRangeTypedInformerAdapter) TypedInformer() LimitRangeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.LimitRange](a.Informer()) +} + +// ToLimitRangeIndexInformer converts an untyped informer into a LimitRangeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *LimitRange. If that is not the case, calling type-safe methods of the returned +// LimitRangeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a LimitRangeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToLimitRangeIndexInformer(informer cache.SharedIndexInformer) LimitRangeIndexInformer { + if informer, ok := informer.(LimitRangeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicorev1.LimitRange](informer) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/namespace.go b/vendor/k8s.io/client-go/informers/core/v1/namespace.go index c2a9894417..38d12c9b37 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/namespace.go +++ b/vendor/k8s.io/client-go/informers/core/v1/namespace.go @@ -34,12 +34,40 @@ import ( ) // NamespaceInformer provides access to a shared informer and lister for -// Namespaces. +// Namespaces. Prefer using the type-safe variant (see [TypedNamespaceInformer]). type NamespaceInformer interface { Informer() cache.SharedIndexInformer Lister() corev1.NamespaceLister } +// TypedNamespaceInformer provides access to a shared informer and lister for +// Namespaces, including the type-safe TypedInformer variant. +// It is a superset of NamespaceInformer. +type TypedNamespaceInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() NamespaceIndexInformer + Lister() corev1.NamespaceLister +} + +// NamespaceIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type NamespaceIndexInformer cache.TypedSharedIndexInformer[*apicorev1.Namespace] + +// NamespaceHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Namespace. +type NamespaceHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicorev1.Namespace] + +// NamespaceDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Namespace. +type NamespaceDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicorev1.Namespace] + +// NamespaceFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Namespace. +type NamespaceFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicorev1.Namespace] + +// NamespaceIndexers is a specialization of [cache.TypedIndexers] for Namespace. +type NamespaceIndexers = cache.TypedIndexers[*apicorev1.Namespace] + +// DeletedNamespace is a specialization of [cache.DeletedObject] for Namespace. +type DeletedNamespace = cache.DeletedObject[*apicorev1.Namespace] + type namespaceInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type namespaceInformer struct { // NewNamespaceInformer constructs a new informer for Namespace type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedNamespaceInformer]). func NewNamespaceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewNamespaceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedNamespaceInformer constructs a new informer for Namespace type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedNamespaceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers NamespaceIndexers) NamespaceIndexInformer { + return NewTypedNamespaceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredNamespaceInformer constructs a new informer for Namespace type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredNamespaceInformer]). func NewFilteredNamespaceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewNamespaceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedNamespaceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredNamespaceInformer constructs a new informer for Namespace type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredNamespaceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers NamespaceIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) NamespaceIndexInformer { + return NewTypedNamespaceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewNamespaceInformerWithOptions constructs a new informer for Namespace type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedNamespaceInformerWithOptions]). func NewNamespaceInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedNamespaceInformerWithOptions(client, options) +} + +// NewTypedNamespaceInformerWithOptions constructs a new informer for Namespace type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedNamespaceInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) NamespaceIndexInformer { gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "namespaces"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicorev1.Namespace](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewNamespaceInformerWithOptions(client kubernetes.Interface, options intern Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *namespaceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewNamespaceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedNamespaceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *namespaceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicorev1.Namespace{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *namespaceInformer) TypedInformer() NamespaceIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.Namespace](f.factory.InformerFor(&apicorev1.Namespace{}, f.defaultInformer)) } func (f *namespaceInformer) Lister() corev1.NamespaceLister { return corev1.NewNamespaceLister(f.Informer().GetIndexer()) } + +// ToTypedNamespaceInformer converts an untyped informer into a TypedNamespaceInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Namespace. If that is not the case, calling type-safe methods of the returned +// TypedNamespaceInformer leads to runtime panics. A safer alternative is to pass +// around a TypedNamespaceInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedNamespaceInformer(informer NamespaceInformer) TypedNamespaceInformer { + if informer, ok := informer.(TypedNamespaceInformer); ok { + return informer + } + return &namespaceTypedInformerAdapter{informer} +} + +type namespaceTypedInformerAdapter struct { + NamespaceInformer +} + +func (a *namespaceTypedInformerAdapter) TypedInformer() NamespaceIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.Namespace](a.Informer()) +} + +// ToNamespaceIndexInformer converts an untyped informer into a NamespaceIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Namespace. If that is not the case, calling type-safe methods of the returned +// NamespaceIndexInformer leads to runtime panics. A safer alternative is to pass +// around a NamespaceIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToNamespaceIndexInformer(informer cache.SharedIndexInformer) NamespaceIndexInformer { + if informer, ok := informer.(NamespaceIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicorev1.Namespace](informer) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/node.go b/vendor/k8s.io/client-go/informers/core/v1/node.go index 48e8d7d6aa..9e706202f3 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/node.go +++ b/vendor/k8s.io/client-go/informers/core/v1/node.go @@ -34,12 +34,40 @@ import ( ) // NodeInformer provides access to a shared informer and lister for -// Nodes. +// Nodes. Prefer using the type-safe variant (see [TypedNodeInformer]). type NodeInformer interface { Informer() cache.SharedIndexInformer Lister() corev1.NodeLister } +// TypedNodeInformer provides access to a shared informer and lister for +// Nodes, including the type-safe TypedInformer variant. +// It is a superset of NodeInformer. +type TypedNodeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() NodeIndexInformer + Lister() corev1.NodeLister +} + +// NodeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type NodeIndexInformer cache.TypedSharedIndexInformer[*apicorev1.Node] + +// NodeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Node. +type NodeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicorev1.Node] + +// NodeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Node. +type NodeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicorev1.Node] + +// NodeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Node. +type NodeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicorev1.Node] + +// NodeIndexers is a specialization of [cache.TypedIndexers] for Node. +type NodeIndexers = cache.TypedIndexers[*apicorev1.Node] + +// DeletedNode is a specialization of [cache.DeletedObject] for Node. +type DeletedNode = cache.DeletedObject[*apicorev1.Node] + type nodeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type nodeInformer struct { // NewNodeInformer constructs a new informer for Node type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedNodeInformer]). func NewNodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewNodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedNodeInformer constructs a new informer for Node type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedNodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers NodeIndexers) NodeIndexInformer { + return NewTypedNodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredNodeInformer constructs a new informer for Node type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredNodeInformer]). func NewFilteredNodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewNodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedNodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredNodeInformer constructs a new informer for Node type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredNodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers NodeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) NodeIndexInformer { + return NewTypedNodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewNodeInformerWithOptions constructs a new informer for Node type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedNodeInformerWithOptions]). func NewNodeInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedNodeInformerWithOptions(client, options) +} + +// NewTypedNodeInformerWithOptions constructs a new informer for Node type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedNodeInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) NodeIndexInformer { gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "nodes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicorev1.Node](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewNodeInformerWithOptions(client kubernetes.Interface, options internalint Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *nodeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewNodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedNodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *nodeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicorev1.Node{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *nodeInformer) TypedInformer() NodeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.Node](f.factory.InformerFor(&apicorev1.Node{}, f.defaultInformer)) } func (f *nodeInformer) Lister() corev1.NodeLister { return corev1.NewNodeLister(f.Informer().GetIndexer()) } + +// ToTypedNodeInformer converts an untyped informer into a TypedNodeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Node. If that is not the case, calling type-safe methods of the returned +// TypedNodeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedNodeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedNodeInformer(informer NodeInformer) TypedNodeInformer { + if informer, ok := informer.(TypedNodeInformer); ok { + return informer + } + return &nodeTypedInformerAdapter{informer} +} + +type nodeTypedInformerAdapter struct { + NodeInformer +} + +func (a *nodeTypedInformerAdapter) TypedInformer() NodeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.Node](a.Informer()) +} + +// ToNodeIndexInformer converts an untyped informer into a NodeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Node. If that is not the case, calling type-safe methods of the returned +// NodeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a NodeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToNodeIndexInformer(informer cache.SharedIndexInformer) NodeIndexInformer { + if informer, ok := informer.(NodeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicorev1.Node](informer) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/persistentvolume.go b/vendor/k8s.io/client-go/informers/core/v1/persistentvolume.go index aebe7ffa81..d55333ce82 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/persistentvolume.go +++ b/vendor/k8s.io/client-go/informers/core/v1/persistentvolume.go @@ -34,12 +34,40 @@ import ( ) // PersistentVolumeInformer provides access to a shared informer and lister for -// PersistentVolumes. +// PersistentVolumes. Prefer using the type-safe variant (see [TypedPersistentVolumeInformer]). type PersistentVolumeInformer interface { Informer() cache.SharedIndexInformer Lister() corev1.PersistentVolumeLister } +// TypedPersistentVolumeInformer provides access to a shared informer and lister for +// PersistentVolumes, including the type-safe TypedInformer variant. +// It is a superset of PersistentVolumeInformer. +type TypedPersistentVolumeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() PersistentVolumeIndexInformer + Lister() corev1.PersistentVolumeLister +} + +// PersistentVolumeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type PersistentVolumeIndexInformer cache.TypedSharedIndexInformer[*apicorev1.PersistentVolume] + +// PersistentVolumeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for PersistentVolume. +type PersistentVolumeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicorev1.PersistentVolume] + +// PersistentVolumeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for PersistentVolume. +type PersistentVolumeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicorev1.PersistentVolume] + +// PersistentVolumeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for PersistentVolume. +type PersistentVolumeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicorev1.PersistentVolume] + +// PersistentVolumeIndexers is a specialization of [cache.TypedIndexers] for PersistentVolume. +type PersistentVolumeIndexers = cache.TypedIndexers[*apicorev1.PersistentVolume] + +// DeletedPersistentVolume is a specialization of [cache.DeletedObject] for PersistentVolume. +type DeletedPersistentVolume = cache.DeletedObject[*apicorev1.PersistentVolume] + type persistentVolumeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type persistentVolumeInformer struct { // NewPersistentVolumeInformer constructs a new informer for PersistentVolume type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPersistentVolumeInformer]). func NewPersistentVolumeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewPersistentVolumeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedPersistentVolumeInformer constructs a new informer for PersistentVolume type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPersistentVolumeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers PersistentVolumeIndexers) PersistentVolumeIndexInformer { + return NewTypedPersistentVolumeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredPersistentVolumeInformer constructs a new informer for PersistentVolume type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredPersistentVolumeInformer]). func NewFilteredPersistentVolumeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewPersistentVolumeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedPersistentVolumeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredPersistentVolumeInformer constructs a new informer for PersistentVolume type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredPersistentVolumeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers PersistentVolumeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) PersistentVolumeIndexInformer { + return NewTypedPersistentVolumeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewPersistentVolumeInformerWithOptions constructs a new informer for PersistentVolume type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPersistentVolumeInformerWithOptions]). func NewPersistentVolumeInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedPersistentVolumeInformerWithOptions(client, options) +} + +// NewTypedPersistentVolumeInformerWithOptions constructs a new informer for PersistentVolume type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPersistentVolumeInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) PersistentVolumeIndexInformer { gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "persistentvolumes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicorev1.PersistentVolume](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewPersistentVolumeInformerWithOptions(client kubernetes.Interface, options Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *persistentVolumeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewPersistentVolumeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedPersistentVolumeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *persistentVolumeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicorev1.PersistentVolume{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *persistentVolumeInformer) TypedInformer() PersistentVolumeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.PersistentVolume](f.factory.InformerFor(&apicorev1.PersistentVolume{}, f.defaultInformer)) } func (f *persistentVolumeInformer) Lister() corev1.PersistentVolumeLister { return corev1.NewPersistentVolumeLister(f.Informer().GetIndexer()) } + +// ToTypedPersistentVolumeInformer converts an untyped informer into a TypedPersistentVolumeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PersistentVolume. If that is not the case, calling type-safe methods of the returned +// TypedPersistentVolumeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedPersistentVolumeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedPersistentVolumeInformer(informer PersistentVolumeInformer) TypedPersistentVolumeInformer { + if informer, ok := informer.(TypedPersistentVolumeInformer); ok { + return informer + } + return &persistentVolumeTypedInformerAdapter{informer} +} + +type persistentVolumeTypedInformerAdapter struct { + PersistentVolumeInformer +} + +func (a *persistentVolumeTypedInformerAdapter) TypedInformer() PersistentVolumeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.PersistentVolume](a.Informer()) +} + +// ToPersistentVolumeIndexInformer converts an untyped informer into a PersistentVolumeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PersistentVolume. If that is not the case, calling type-safe methods of the returned +// PersistentVolumeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a PersistentVolumeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToPersistentVolumeIndexInformer(informer cache.SharedIndexInformer) PersistentVolumeIndexInformer { + if informer, ok := informer.(PersistentVolumeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicorev1.PersistentVolume](informer) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go b/vendor/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go index 973b5571ed..c14ab0d8eb 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go +++ b/vendor/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go @@ -34,12 +34,40 @@ import ( ) // PersistentVolumeClaimInformer provides access to a shared informer and lister for -// PersistentVolumeClaims. +// PersistentVolumeClaims. Prefer using the type-safe variant (see [TypedPersistentVolumeClaimInformer]). type PersistentVolumeClaimInformer interface { Informer() cache.SharedIndexInformer Lister() corev1.PersistentVolumeClaimLister } +// TypedPersistentVolumeClaimInformer provides access to a shared informer and lister for +// PersistentVolumeClaims, including the type-safe TypedInformer variant. +// It is a superset of PersistentVolumeClaimInformer. +type TypedPersistentVolumeClaimInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() PersistentVolumeClaimIndexInformer + Lister() corev1.PersistentVolumeClaimLister +} + +// PersistentVolumeClaimIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type PersistentVolumeClaimIndexInformer cache.TypedSharedIndexInformer[*apicorev1.PersistentVolumeClaim] + +// PersistentVolumeClaimHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for PersistentVolumeClaim. +type PersistentVolumeClaimHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicorev1.PersistentVolumeClaim] + +// PersistentVolumeClaimDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for PersistentVolumeClaim. +type PersistentVolumeClaimDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicorev1.PersistentVolumeClaim] + +// PersistentVolumeClaimFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for PersistentVolumeClaim. +type PersistentVolumeClaimFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicorev1.PersistentVolumeClaim] + +// PersistentVolumeClaimIndexers is a specialization of [cache.TypedIndexers] for PersistentVolumeClaim. +type PersistentVolumeClaimIndexers = cache.TypedIndexers[*apicorev1.PersistentVolumeClaim] + +// DeletedPersistentVolumeClaim is a specialization of [cache.DeletedObject] for PersistentVolumeClaim. +type DeletedPersistentVolumeClaim = cache.DeletedObject[*apicorev1.PersistentVolumeClaim] + type persistentVolumeClaimInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type persistentVolumeClaimInformer struct { // NewPersistentVolumeClaimInformer constructs a new informer for PersistentVolumeClaim type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPersistentVolumeClaimInformer]). func NewPersistentVolumeClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewPersistentVolumeClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedPersistentVolumeClaimInformer constructs a new informer for PersistentVolumeClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPersistentVolumeClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers PersistentVolumeClaimIndexers) PersistentVolumeClaimIndexInformer { + return NewTypedPersistentVolumeClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredPersistentVolumeClaimInformer constructs a new informer for PersistentVolumeClaim type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredPersistentVolumeClaimInformer]). func NewFilteredPersistentVolumeClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewPersistentVolumeClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedPersistentVolumeClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredPersistentVolumeClaimInformer constructs a new informer for PersistentVolumeClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredPersistentVolumeClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers PersistentVolumeClaimIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) PersistentVolumeClaimIndexInformer { + return NewTypedPersistentVolumeClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewPersistentVolumeClaimInformerWithOptions constructs a new informer for PersistentVolumeClaim type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPersistentVolumeClaimInformerWithOptions]). func NewPersistentVolumeClaimInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedPersistentVolumeClaimInformerWithOptions(client, namespace, options) +} + +// NewTypedPersistentVolumeClaimInformerWithOptions constructs a new informer for PersistentVolumeClaim type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPersistentVolumeClaimInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) PersistentVolumeClaimIndexInformer { gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "persistentvolumeclaims"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicorev1.PersistentVolumeClaim](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewPersistentVolumeClaimInformerWithOptions(client kubernetes.Interface, na Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *persistentVolumeClaimInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewPersistentVolumeClaimInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedPersistentVolumeClaimInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *persistentVolumeClaimInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicorev1.PersistentVolumeClaim{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *persistentVolumeClaimInformer) TypedInformer() PersistentVolumeClaimIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.PersistentVolumeClaim](f.factory.InformerFor(&apicorev1.PersistentVolumeClaim{}, f.defaultInformer)) } func (f *persistentVolumeClaimInformer) Lister() corev1.PersistentVolumeClaimLister { return corev1.NewPersistentVolumeClaimLister(f.Informer().GetIndexer()) } + +// ToTypedPersistentVolumeClaimInformer converts an untyped informer into a TypedPersistentVolumeClaimInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PersistentVolumeClaim. If that is not the case, calling type-safe methods of the returned +// TypedPersistentVolumeClaimInformer leads to runtime panics. A safer alternative is to pass +// around a TypedPersistentVolumeClaimInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedPersistentVolumeClaimInformer(informer PersistentVolumeClaimInformer) TypedPersistentVolumeClaimInformer { + if informer, ok := informer.(TypedPersistentVolumeClaimInformer); ok { + return informer + } + return &persistentVolumeClaimTypedInformerAdapter{informer} +} + +type persistentVolumeClaimTypedInformerAdapter struct { + PersistentVolumeClaimInformer +} + +func (a *persistentVolumeClaimTypedInformerAdapter) TypedInformer() PersistentVolumeClaimIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.PersistentVolumeClaim](a.Informer()) +} + +// ToPersistentVolumeClaimIndexInformer converts an untyped informer into a PersistentVolumeClaimIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PersistentVolumeClaim. If that is not the case, calling type-safe methods of the returned +// PersistentVolumeClaimIndexInformer leads to runtime panics. A safer alternative is to pass +// around a PersistentVolumeClaimIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToPersistentVolumeClaimIndexInformer(informer cache.SharedIndexInformer) PersistentVolumeClaimIndexInformer { + if informer, ok := informer.(PersistentVolumeClaimIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicorev1.PersistentVolumeClaim](informer) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/pod.go b/vendor/k8s.io/client-go/informers/core/v1/pod.go index f49dee3dee..dac8c6d0c6 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/pod.go +++ b/vendor/k8s.io/client-go/informers/core/v1/pod.go @@ -34,12 +34,40 @@ import ( ) // PodInformer provides access to a shared informer and lister for -// Pods. +// Pods. Prefer using the type-safe variant (see [TypedPodInformer]). type PodInformer interface { Informer() cache.SharedIndexInformer Lister() corev1.PodLister } +// TypedPodInformer provides access to a shared informer and lister for +// Pods, including the type-safe TypedInformer variant. +// It is a superset of PodInformer. +type TypedPodInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() PodIndexInformer + Lister() corev1.PodLister +} + +// PodIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type PodIndexInformer cache.TypedSharedIndexInformer[*apicorev1.Pod] + +// PodHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Pod. +type PodHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicorev1.Pod] + +// PodDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Pod. +type PodDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicorev1.Pod] + +// PodFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Pod. +type PodFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicorev1.Pod] + +// PodIndexers is a specialization of [cache.TypedIndexers] for Pod. +type PodIndexers = cache.TypedIndexers[*apicorev1.Pod] + +// DeletedPod is a specialization of [cache.DeletedObject] for Pod. +type DeletedPod = cache.DeletedObject[*apicorev1.Pod] + type podInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type podInformer struct { // NewPodInformer constructs a new informer for Pod type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPodInformer]). func NewPodInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewPodInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedPodInformer constructs a new informer for Pod type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPodInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers PodIndexers) PodIndexInformer { + return NewTypedPodInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredPodInformer constructs a new informer for Pod type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredPodInformer]). func NewFilteredPodInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewPodInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedPodInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredPodInformer constructs a new informer for Pod type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredPodInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers PodIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) PodIndexInformer { + return NewTypedPodInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewPodInformerWithOptions constructs a new informer for Pod type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPodInformerWithOptions]). func NewPodInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedPodInformerWithOptions(client, namespace, options) +} + +// NewTypedPodInformerWithOptions constructs a new informer for Pod type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPodInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) PodIndexInformer { gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicorev1.Pod](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewPodInformerWithOptions(client kubernetes.Interface, namespace string, op Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *podInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewPodInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedPodInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *podInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicorev1.Pod{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *podInformer) TypedInformer() PodIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.Pod](f.factory.InformerFor(&apicorev1.Pod{}, f.defaultInformer)) } func (f *podInformer) Lister() corev1.PodLister { return corev1.NewPodLister(f.Informer().GetIndexer()) } + +// ToTypedPodInformer converts an untyped informer into a TypedPodInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Pod. If that is not the case, calling type-safe methods of the returned +// TypedPodInformer leads to runtime panics. A safer alternative is to pass +// around a TypedPodInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedPodInformer(informer PodInformer) TypedPodInformer { + if informer, ok := informer.(TypedPodInformer); ok { + return informer + } + return &podTypedInformerAdapter{informer} +} + +type podTypedInformerAdapter struct { + PodInformer +} + +func (a *podTypedInformerAdapter) TypedInformer() PodIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.Pod](a.Informer()) +} + +// ToPodIndexInformer converts an untyped informer into a PodIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Pod. If that is not the case, calling type-safe methods of the returned +// PodIndexInformer leads to runtime panics. A safer alternative is to pass +// around a PodIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToPodIndexInformer(informer cache.SharedIndexInformer) PodIndexInformer { + if informer, ok := informer.(PodIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicorev1.Pod](informer) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/podtemplate.go b/vendor/k8s.io/client-go/informers/core/v1/podtemplate.go index 940ae25999..4b705902a6 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/podtemplate.go +++ b/vendor/k8s.io/client-go/informers/core/v1/podtemplate.go @@ -34,12 +34,40 @@ import ( ) // PodTemplateInformer provides access to a shared informer and lister for -// PodTemplates. +// PodTemplates. Prefer using the type-safe variant (see [TypedPodTemplateInformer]). type PodTemplateInformer interface { Informer() cache.SharedIndexInformer Lister() corev1.PodTemplateLister } +// TypedPodTemplateInformer provides access to a shared informer and lister for +// PodTemplates, including the type-safe TypedInformer variant. +// It is a superset of PodTemplateInformer. +type TypedPodTemplateInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() PodTemplateIndexInformer + Lister() corev1.PodTemplateLister +} + +// PodTemplateIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type PodTemplateIndexInformer cache.TypedSharedIndexInformer[*apicorev1.PodTemplate] + +// PodTemplateHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for PodTemplate. +type PodTemplateHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicorev1.PodTemplate] + +// PodTemplateDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for PodTemplate. +type PodTemplateDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicorev1.PodTemplate] + +// PodTemplateFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for PodTemplate. +type PodTemplateFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicorev1.PodTemplate] + +// PodTemplateIndexers is a specialization of [cache.TypedIndexers] for PodTemplate. +type PodTemplateIndexers = cache.TypedIndexers[*apicorev1.PodTemplate] + +// DeletedPodTemplate is a specialization of [cache.DeletedObject] for PodTemplate. +type DeletedPodTemplate = cache.DeletedObject[*apicorev1.PodTemplate] + type podTemplateInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type podTemplateInformer struct { // NewPodTemplateInformer constructs a new informer for PodTemplate type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPodTemplateInformer]). func NewPodTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewPodTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedPodTemplateInformer constructs a new informer for PodTemplate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPodTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers PodTemplateIndexers) PodTemplateIndexInformer { + return NewTypedPodTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredPodTemplateInformer constructs a new informer for PodTemplate type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredPodTemplateInformer]). func NewFilteredPodTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewPodTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedPodTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredPodTemplateInformer constructs a new informer for PodTemplate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredPodTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers PodTemplateIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) PodTemplateIndexInformer { + return NewTypedPodTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewPodTemplateInformerWithOptions constructs a new informer for PodTemplate type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPodTemplateInformerWithOptions]). func NewPodTemplateInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedPodTemplateInformerWithOptions(client, namespace, options) +} + +// NewTypedPodTemplateInformerWithOptions constructs a new informer for PodTemplate type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPodTemplateInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) PodTemplateIndexInformer { gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "podtemplates"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicorev1.PodTemplate](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewPodTemplateInformerWithOptions(client kubernetes.Interface, namespace st Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *podTemplateInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewPodTemplateInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedPodTemplateInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *podTemplateInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicorev1.PodTemplate{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *podTemplateInformer) TypedInformer() PodTemplateIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.PodTemplate](f.factory.InformerFor(&apicorev1.PodTemplate{}, f.defaultInformer)) } func (f *podTemplateInformer) Lister() corev1.PodTemplateLister { return corev1.NewPodTemplateLister(f.Informer().GetIndexer()) } + +// ToTypedPodTemplateInformer converts an untyped informer into a TypedPodTemplateInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PodTemplate. If that is not the case, calling type-safe methods of the returned +// TypedPodTemplateInformer leads to runtime panics. A safer alternative is to pass +// around a TypedPodTemplateInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedPodTemplateInformer(informer PodTemplateInformer) TypedPodTemplateInformer { + if informer, ok := informer.(TypedPodTemplateInformer); ok { + return informer + } + return &podTemplateTypedInformerAdapter{informer} +} + +type podTemplateTypedInformerAdapter struct { + PodTemplateInformer +} + +func (a *podTemplateTypedInformerAdapter) TypedInformer() PodTemplateIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.PodTemplate](a.Informer()) +} + +// ToPodTemplateIndexInformer converts an untyped informer into a PodTemplateIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PodTemplate. If that is not the case, calling type-safe methods of the returned +// PodTemplateIndexInformer leads to runtime panics. A safer alternative is to pass +// around a PodTemplateIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToPodTemplateIndexInformer(informer cache.SharedIndexInformer) PodTemplateIndexInformer { + if informer, ok := informer.(PodTemplateIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicorev1.PodTemplate](informer) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/replicationcontroller.go b/vendor/k8s.io/client-go/informers/core/v1/replicationcontroller.go index ec323d3c63..8612653d11 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/replicationcontroller.go +++ b/vendor/k8s.io/client-go/informers/core/v1/replicationcontroller.go @@ -34,12 +34,40 @@ import ( ) // ReplicationControllerInformer provides access to a shared informer and lister for -// ReplicationControllers. +// ReplicationControllers. Prefer using the type-safe variant (see [TypedReplicationControllerInformer]). type ReplicationControllerInformer interface { Informer() cache.SharedIndexInformer Lister() corev1.ReplicationControllerLister } +// TypedReplicationControllerInformer provides access to a shared informer and lister for +// ReplicationControllers, including the type-safe TypedInformer variant. +// It is a superset of ReplicationControllerInformer. +type TypedReplicationControllerInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ReplicationControllerIndexInformer + Lister() corev1.ReplicationControllerLister +} + +// ReplicationControllerIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ReplicationControllerIndexInformer cache.TypedSharedIndexInformer[*apicorev1.ReplicationController] + +// ReplicationControllerHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ReplicationController. +type ReplicationControllerHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicorev1.ReplicationController] + +// ReplicationControllerDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ReplicationController. +type ReplicationControllerDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicorev1.ReplicationController] + +// ReplicationControllerFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ReplicationController. +type ReplicationControllerFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicorev1.ReplicationController] + +// ReplicationControllerIndexers is a specialization of [cache.TypedIndexers] for ReplicationController. +type ReplicationControllerIndexers = cache.TypedIndexers[*apicorev1.ReplicationController] + +// DeletedReplicationController is a specialization of [cache.DeletedObject] for ReplicationController. +type DeletedReplicationController = cache.DeletedObject[*apicorev1.ReplicationController] + type replicationControllerInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type replicationControllerInformer struct { // NewReplicationControllerInformer constructs a new informer for ReplicationController type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedReplicationControllerInformer]). func NewReplicationControllerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewReplicationControllerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedReplicationControllerInformer constructs a new informer for ReplicationController type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedReplicationControllerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ReplicationControllerIndexers) ReplicationControllerIndexInformer { + return NewTypedReplicationControllerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredReplicationControllerInformer constructs a new informer for ReplicationController type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredReplicationControllerInformer]). func NewFilteredReplicationControllerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewReplicationControllerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedReplicationControllerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredReplicationControllerInformer constructs a new informer for ReplicationController type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredReplicationControllerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ReplicationControllerIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ReplicationControllerIndexInformer { + return NewTypedReplicationControllerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewReplicationControllerInformerWithOptions constructs a new informer for ReplicationController type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedReplicationControllerInformerWithOptions]). func NewReplicationControllerInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedReplicationControllerInformerWithOptions(client, namespace, options) +} + +// NewTypedReplicationControllerInformerWithOptions constructs a new informer for ReplicationController type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedReplicationControllerInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) ReplicationControllerIndexInformer { gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "replicationcontrollers"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicorev1.ReplicationController](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewReplicationControllerInformerWithOptions(client kubernetes.Interface, na Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *replicationControllerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewReplicationControllerInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedReplicationControllerInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *replicationControllerInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicorev1.ReplicationController{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *replicationControllerInformer) TypedInformer() ReplicationControllerIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.ReplicationController](f.factory.InformerFor(&apicorev1.ReplicationController{}, f.defaultInformer)) } func (f *replicationControllerInformer) Lister() corev1.ReplicationControllerLister { return corev1.NewReplicationControllerLister(f.Informer().GetIndexer()) } + +// ToTypedReplicationControllerInformer converts an untyped informer into a TypedReplicationControllerInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ReplicationController. If that is not the case, calling type-safe methods of the returned +// TypedReplicationControllerInformer leads to runtime panics. A safer alternative is to pass +// around a TypedReplicationControllerInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedReplicationControllerInformer(informer ReplicationControllerInformer) TypedReplicationControllerInformer { + if informer, ok := informer.(TypedReplicationControllerInformer); ok { + return informer + } + return &replicationControllerTypedInformerAdapter{informer} +} + +type replicationControllerTypedInformerAdapter struct { + ReplicationControllerInformer +} + +func (a *replicationControllerTypedInformerAdapter) TypedInformer() ReplicationControllerIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.ReplicationController](a.Informer()) +} + +// ToReplicationControllerIndexInformer converts an untyped informer into a ReplicationControllerIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ReplicationController. If that is not the case, calling type-safe methods of the returned +// ReplicationControllerIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ReplicationControllerIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToReplicationControllerIndexInformer(informer cache.SharedIndexInformer) ReplicationControllerIndexInformer { + if informer, ok := informer.(ReplicationControllerIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicorev1.ReplicationController](informer) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/resourcequota.go b/vendor/k8s.io/client-go/informers/core/v1/resourcequota.go index 490a31212b..5726e484c0 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/resourcequota.go +++ b/vendor/k8s.io/client-go/informers/core/v1/resourcequota.go @@ -34,12 +34,40 @@ import ( ) // ResourceQuotaInformer provides access to a shared informer and lister for -// ResourceQuotas. +// ResourceQuotas. Prefer using the type-safe variant (see [TypedResourceQuotaInformer]). type ResourceQuotaInformer interface { Informer() cache.SharedIndexInformer Lister() corev1.ResourceQuotaLister } +// TypedResourceQuotaInformer provides access to a shared informer and lister for +// ResourceQuotas, including the type-safe TypedInformer variant. +// It is a superset of ResourceQuotaInformer. +type TypedResourceQuotaInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ResourceQuotaIndexInformer + Lister() corev1.ResourceQuotaLister +} + +// ResourceQuotaIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ResourceQuotaIndexInformer cache.TypedSharedIndexInformer[*apicorev1.ResourceQuota] + +// ResourceQuotaHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ResourceQuota. +type ResourceQuotaHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicorev1.ResourceQuota] + +// ResourceQuotaDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ResourceQuota. +type ResourceQuotaDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicorev1.ResourceQuota] + +// ResourceQuotaFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ResourceQuota. +type ResourceQuotaFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicorev1.ResourceQuota] + +// ResourceQuotaIndexers is a specialization of [cache.TypedIndexers] for ResourceQuota. +type ResourceQuotaIndexers = cache.TypedIndexers[*apicorev1.ResourceQuota] + +// DeletedResourceQuota is a specialization of [cache.DeletedObject] for ResourceQuota. +type DeletedResourceQuota = cache.DeletedObject[*apicorev1.ResourceQuota] + type resourceQuotaInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type resourceQuotaInformer struct { // NewResourceQuotaInformer constructs a new informer for ResourceQuota type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceQuotaInformer]). func NewResourceQuotaInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewResourceQuotaInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedResourceQuotaInformer constructs a new informer for ResourceQuota type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceQuotaInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ResourceQuotaIndexers) ResourceQuotaIndexInformer { + return NewTypedResourceQuotaInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredResourceQuotaInformer constructs a new informer for ResourceQuota type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredResourceQuotaInformer]). func NewFilteredResourceQuotaInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewResourceQuotaInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedResourceQuotaInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredResourceQuotaInformer constructs a new informer for ResourceQuota type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredResourceQuotaInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ResourceQuotaIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ResourceQuotaIndexInformer { + return NewTypedResourceQuotaInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewResourceQuotaInformerWithOptions constructs a new informer for ResourceQuota type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceQuotaInformerWithOptions]). func NewResourceQuotaInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedResourceQuotaInformerWithOptions(client, namespace, options) +} + +// NewTypedResourceQuotaInformerWithOptions constructs a new informer for ResourceQuota type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceQuotaInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) ResourceQuotaIndexInformer { gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "resourcequotas"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicorev1.ResourceQuota](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewResourceQuotaInformerWithOptions(client kubernetes.Interface, namespace Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *resourceQuotaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewResourceQuotaInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedResourceQuotaInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceQuotaInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicorev1.ResourceQuota{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *resourceQuotaInformer) TypedInformer() ResourceQuotaIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.ResourceQuota](f.factory.InformerFor(&apicorev1.ResourceQuota{}, f.defaultInformer)) } func (f *resourceQuotaInformer) Lister() corev1.ResourceQuotaLister { return corev1.NewResourceQuotaLister(f.Informer().GetIndexer()) } + +// ToTypedResourceQuotaInformer converts an untyped informer into a TypedResourceQuotaInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceQuota. If that is not the case, calling type-safe methods of the returned +// TypedResourceQuotaInformer leads to runtime panics. A safer alternative is to pass +// around a TypedResourceQuotaInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedResourceQuotaInformer(informer ResourceQuotaInformer) TypedResourceQuotaInformer { + if informer, ok := informer.(TypedResourceQuotaInformer); ok { + return informer + } + return &resourceQuotaTypedInformerAdapter{informer} +} + +type resourceQuotaTypedInformerAdapter struct { + ResourceQuotaInformer +} + +func (a *resourceQuotaTypedInformerAdapter) TypedInformer() ResourceQuotaIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.ResourceQuota](a.Informer()) +} + +// ToResourceQuotaIndexInformer converts an untyped informer into a ResourceQuotaIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceQuota. If that is not the case, calling type-safe methods of the returned +// ResourceQuotaIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ResourceQuotaIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToResourceQuotaIndexInformer(informer cache.SharedIndexInformer) ResourceQuotaIndexInformer { + if informer, ok := informer.(ResourceQuotaIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicorev1.ResourceQuota](informer) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/secret.go b/vendor/k8s.io/client-go/informers/core/v1/secret.go index 86458285d9..ae75b7d22c 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/secret.go +++ b/vendor/k8s.io/client-go/informers/core/v1/secret.go @@ -34,12 +34,40 @@ import ( ) // SecretInformer provides access to a shared informer and lister for -// Secrets. +// Secrets. Prefer using the type-safe variant (see [TypedSecretInformer]). type SecretInformer interface { Informer() cache.SharedIndexInformer Lister() corev1.SecretLister } +// TypedSecretInformer provides access to a shared informer and lister for +// Secrets, including the type-safe TypedInformer variant. +// It is a superset of SecretInformer. +type TypedSecretInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() SecretIndexInformer + Lister() corev1.SecretLister +} + +// SecretIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type SecretIndexInformer cache.TypedSharedIndexInformer[*apicorev1.Secret] + +// SecretHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Secret. +type SecretHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicorev1.Secret] + +// SecretDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Secret. +type SecretDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicorev1.Secret] + +// SecretFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Secret. +type SecretFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicorev1.Secret] + +// SecretIndexers is a specialization of [cache.TypedIndexers] for Secret. +type SecretIndexers = cache.TypedIndexers[*apicorev1.Secret] + +// DeletedSecret is a specialization of [cache.DeletedObject] for Secret. +type DeletedSecret = cache.DeletedObject[*apicorev1.Secret] + type secretInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type secretInformer struct { // NewSecretInformer constructs a new informer for Secret type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedSecretInformer]). func NewSecretInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewSecretInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedSecretInformer constructs a new informer for Secret type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedSecretInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers SecretIndexers) SecretIndexInformer { + return NewTypedSecretInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredSecretInformer constructs a new informer for Secret type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredSecretInformer]). func NewFilteredSecretInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewSecretInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedSecretInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredSecretInformer constructs a new informer for Secret type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredSecretInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers SecretIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) SecretIndexInformer { + return NewTypedSecretInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewSecretInformerWithOptions constructs a new informer for Secret type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedSecretInformerWithOptions]). func NewSecretInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedSecretInformerWithOptions(client, namespace, options) +} + +// NewTypedSecretInformerWithOptions constructs a new informer for Secret type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedSecretInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) SecretIndexInformer { gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "secrets"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicorev1.Secret](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewSecretInformerWithOptions(client kubernetes.Interface, namespace string, Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *secretInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewSecretInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedSecretInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *secretInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicorev1.Secret{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *secretInformer) TypedInformer() SecretIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.Secret](f.factory.InformerFor(&apicorev1.Secret{}, f.defaultInformer)) } func (f *secretInformer) Lister() corev1.SecretLister { return corev1.NewSecretLister(f.Informer().GetIndexer()) } + +// ToTypedSecretInformer converts an untyped informer into a TypedSecretInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Secret. If that is not the case, calling type-safe methods of the returned +// TypedSecretInformer leads to runtime panics. A safer alternative is to pass +// around a TypedSecretInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedSecretInformer(informer SecretInformer) TypedSecretInformer { + if informer, ok := informer.(TypedSecretInformer); ok { + return informer + } + return &secretTypedInformerAdapter{informer} +} + +type secretTypedInformerAdapter struct { + SecretInformer +} + +func (a *secretTypedInformerAdapter) TypedInformer() SecretIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.Secret](a.Informer()) +} + +// ToSecretIndexInformer converts an untyped informer into a SecretIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Secret. If that is not the case, calling type-safe methods of the returned +// SecretIndexInformer leads to runtime panics. A safer alternative is to pass +// around a SecretIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToSecretIndexInformer(informer cache.SharedIndexInformer) SecretIndexInformer { + if informer, ok := informer.(SecretIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicorev1.Secret](informer) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/service.go b/vendor/k8s.io/client-go/informers/core/v1/service.go index 4ec10b3227..0c804c0220 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/service.go +++ b/vendor/k8s.io/client-go/informers/core/v1/service.go @@ -34,12 +34,40 @@ import ( ) // ServiceInformer provides access to a shared informer and lister for -// Services. +// Services. Prefer using the type-safe variant (see [TypedServiceInformer]). type ServiceInformer interface { Informer() cache.SharedIndexInformer Lister() corev1.ServiceLister } +// TypedServiceInformer provides access to a shared informer and lister for +// Services, including the type-safe TypedInformer variant. +// It is a superset of ServiceInformer. +type TypedServiceInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ServiceIndexInformer + Lister() corev1.ServiceLister +} + +// ServiceIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ServiceIndexInformer cache.TypedSharedIndexInformer[*apicorev1.Service] + +// ServiceHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Service. +type ServiceHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicorev1.Service] + +// ServiceDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Service. +type ServiceDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicorev1.Service] + +// ServiceFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Service. +type ServiceFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicorev1.Service] + +// ServiceIndexers is a specialization of [cache.TypedIndexers] for Service. +type ServiceIndexers = cache.TypedIndexers[*apicorev1.Service] + +// DeletedService is a specialization of [cache.DeletedObject] for Service. +type DeletedService = cache.DeletedObject[*apicorev1.Service] + type serviceInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type serviceInformer struct { // NewServiceInformer constructs a new informer for Service type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedServiceInformer]). func NewServiceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewServiceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedServiceInformer constructs a new informer for Service type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedServiceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ServiceIndexers) ServiceIndexInformer { + return NewTypedServiceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredServiceInformer constructs a new informer for Service type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredServiceInformer]). func NewFilteredServiceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewServiceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedServiceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredServiceInformer constructs a new informer for Service type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredServiceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ServiceIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ServiceIndexInformer { + return NewTypedServiceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewServiceInformerWithOptions constructs a new informer for Service type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedServiceInformerWithOptions]). func NewServiceInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedServiceInformerWithOptions(client, namespace, options) +} + +// NewTypedServiceInformerWithOptions constructs a new informer for Service type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedServiceInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) ServiceIndexInformer { gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "services"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicorev1.Service](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewServiceInformerWithOptions(client kubernetes.Interface, namespace string Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *serviceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewServiceInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedServiceInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *serviceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicorev1.Service{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *serviceInformer) TypedInformer() ServiceIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.Service](f.factory.InformerFor(&apicorev1.Service{}, f.defaultInformer)) } func (f *serviceInformer) Lister() corev1.ServiceLister { return corev1.NewServiceLister(f.Informer().GetIndexer()) } + +// ToTypedServiceInformer converts an untyped informer into a TypedServiceInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Service. If that is not the case, calling type-safe methods of the returned +// TypedServiceInformer leads to runtime panics. A safer alternative is to pass +// around a TypedServiceInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedServiceInformer(informer ServiceInformer) TypedServiceInformer { + if informer, ok := informer.(TypedServiceInformer); ok { + return informer + } + return &serviceTypedInformerAdapter{informer} +} + +type serviceTypedInformerAdapter struct { + ServiceInformer +} + +func (a *serviceTypedInformerAdapter) TypedInformer() ServiceIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.Service](a.Informer()) +} + +// ToServiceIndexInformer converts an untyped informer into a ServiceIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Service. If that is not the case, calling type-safe methods of the returned +// ServiceIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ServiceIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToServiceIndexInformer(informer cache.SharedIndexInformer) ServiceIndexInformer { + if informer, ok := informer.(ServiceIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicorev1.Service](informer) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/serviceaccount.go b/vendor/k8s.io/client-go/informers/core/v1/serviceaccount.go index 32751b6a38..6ca3cf6856 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/serviceaccount.go +++ b/vendor/k8s.io/client-go/informers/core/v1/serviceaccount.go @@ -34,12 +34,40 @@ import ( ) // ServiceAccountInformer provides access to a shared informer and lister for -// ServiceAccounts. +// ServiceAccounts. Prefer using the type-safe variant (see [TypedServiceAccountInformer]). type ServiceAccountInformer interface { Informer() cache.SharedIndexInformer Lister() corev1.ServiceAccountLister } +// TypedServiceAccountInformer provides access to a shared informer and lister for +// ServiceAccounts, including the type-safe TypedInformer variant. +// It is a superset of ServiceAccountInformer. +type TypedServiceAccountInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ServiceAccountIndexInformer + Lister() corev1.ServiceAccountLister +} + +// ServiceAccountIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ServiceAccountIndexInformer cache.TypedSharedIndexInformer[*apicorev1.ServiceAccount] + +// ServiceAccountHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ServiceAccount. +type ServiceAccountHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apicorev1.ServiceAccount] + +// ServiceAccountDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ServiceAccount. +type ServiceAccountDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apicorev1.ServiceAccount] + +// ServiceAccountFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ServiceAccount. +type ServiceAccountFilteringHandler = cache.TypedFilteringResourceEventHandler[*apicorev1.ServiceAccount] + +// ServiceAccountIndexers is a specialization of [cache.TypedIndexers] for ServiceAccount. +type ServiceAccountIndexers = cache.TypedIndexers[*apicorev1.ServiceAccount] + +// DeletedServiceAccount is a specialization of [cache.DeletedObject] for ServiceAccount. +type DeletedServiceAccount = cache.DeletedObject[*apicorev1.ServiceAccount] + type serviceAccountInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type serviceAccountInformer struct { // NewServiceAccountInformer constructs a new informer for ServiceAccount type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedServiceAccountInformer]). func NewServiceAccountInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewServiceAccountInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedServiceAccountInformer constructs a new informer for ServiceAccount type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedServiceAccountInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ServiceAccountIndexers) ServiceAccountIndexInformer { + return NewTypedServiceAccountInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredServiceAccountInformer constructs a new informer for ServiceAccount type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredServiceAccountInformer]). func NewFilteredServiceAccountInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewServiceAccountInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedServiceAccountInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredServiceAccountInformer constructs a new informer for ServiceAccount type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredServiceAccountInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ServiceAccountIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ServiceAccountIndexInformer { + return NewTypedServiceAccountInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewServiceAccountInformerWithOptions constructs a new informer for ServiceAccount type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedServiceAccountInformerWithOptions]). func NewServiceAccountInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedServiceAccountInformerWithOptions(client, namespace, options) +} + +// NewTypedServiceAccountInformerWithOptions constructs a new informer for ServiceAccount type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedServiceAccountInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) ServiceAccountIndexInformer { gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "serviceaccounts"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apicorev1.ServiceAccount](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewServiceAccountInformerWithOptions(client kubernetes.Interface, namespace Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *serviceAccountInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewServiceAccountInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedServiceAccountInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *serviceAccountInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apicorev1.ServiceAccount{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *serviceAccountInformer) TypedInformer() ServiceAccountIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.ServiceAccount](f.factory.InformerFor(&apicorev1.ServiceAccount{}, f.defaultInformer)) } func (f *serviceAccountInformer) Lister() corev1.ServiceAccountLister { return corev1.NewServiceAccountLister(f.Informer().GetIndexer()) } + +// ToTypedServiceAccountInformer converts an untyped informer into a TypedServiceAccountInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ServiceAccount. If that is not the case, calling type-safe methods of the returned +// TypedServiceAccountInformer leads to runtime panics. A safer alternative is to pass +// around a TypedServiceAccountInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedServiceAccountInformer(informer ServiceAccountInformer) TypedServiceAccountInformer { + if informer, ok := informer.(TypedServiceAccountInformer); ok { + return informer + } + return &serviceAccountTypedInformerAdapter{informer} +} + +type serviceAccountTypedInformerAdapter struct { + ServiceAccountInformer +} + +func (a *serviceAccountTypedInformerAdapter) TypedInformer() ServiceAccountIndexInformer { + return cache.NewTypedSharedIndexInformer[*apicorev1.ServiceAccount](a.Informer()) +} + +// ToServiceAccountIndexInformer converts an untyped informer into a ServiceAccountIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ServiceAccount. If that is not the case, calling type-safe methods of the returned +// ServiceAccountIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ServiceAccountIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToServiceAccountIndexInformer(informer cache.SharedIndexInformer) ServiceAccountIndexInformer { + if informer, ok := informer.(ServiceAccountIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apicorev1.ServiceAccount](informer) +} diff --git a/vendor/k8s.io/client-go/informers/discovery/v1/endpointslice.go b/vendor/k8s.io/client-go/informers/discovery/v1/endpointslice.go index 999d514598..f037770867 100644 --- a/vendor/k8s.io/client-go/informers/discovery/v1/endpointslice.go +++ b/vendor/k8s.io/client-go/informers/discovery/v1/endpointslice.go @@ -34,12 +34,40 @@ import ( ) // EndpointSliceInformer provides access to a shared informer and lister for -// EndpointSlices. +// EndpointSlices. Prefer using the type-safe variant (see [TypedEndpointSliceInformer]). type EndpointSliceInformer interface { Informer() cache.SharedIndexInformer Lister() discoveryv1.EndpointSliceLister } +// TypedEndpointSliceInformer provides access to a shared informer and lister for +// EndpointSlices, including the type-safe TypedInformer variant. +// It is a superset of EndpointSliceInformer. +type TypedEndpointSliceInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() EndpointSliceIndexInformer + Lister() discoveryv1.EndpointSliceLister +} + +// EndpointSliceIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type EndpointSliceIndexInformer cache.TypedSharedIndexInformer[*apidiscoveryv1.EndpointSlice] + +// EndpointSliceHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for EndpointSlice. +type EndpointSliceHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apidiscoveryv1.EndpointSlice] + +// EndpointSliceDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for EndpointSlice. +type EndpointSliceDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apidiscoveryv1.EndpointSlice] + +// EndpointSliceFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for EndpointSlice. +type EndpointSliceFilteringHandler = cache.TypedFilteringResourceEventHandler[*apidiscoveryv1.EndpointSlice] + +// EndpointSliceIndexers is a specialization of [cache.TypedIndexers] for EndpointSlice. +type EndpointSliceIndexers = cache.TypedIndexers[*apidiscoveryv1.EndpointSlice] + +// DeletedEndpointSlice is a specialization of [cache.DeletedObject] for EndpointSlice. +type DeletedEndpointSlice = cache.DeletedObject[*apidiscoveryv1.EndpointSlice] + type endpointSliceInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type endpointSliceInformer struct { // NewEndpointSliceInformer constructs a new informer for EndpointSlice type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedEndpointSliceInformer]). func NewEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewEndpointSliceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedEndpointSliceInformer constructs a new informer for EndpointSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers EndpointSliceIndexers) EndpointSliceIndexInformer { + return NewTypedEndpointSliceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredEndpointSliceInformer constructs a new informer for EndpointSlice type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredEndpointSliceInformer]). func NewFilteredEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewEndpointSliceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedEndpointSliceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredEndpointSliceInformer constructs a new informer for EndpointSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers EndpointSliceIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) EndpointSliceIndexInformer { + return NewTypedEndpointSliceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewEndpointSliceInformerWithOptions constructs a new informer for EndpointSlice type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedEndpointSliceInformerWithOptions]). func NewEndpointSliceInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedEndpointSliceInformerWithOptions(client, namespace, options) +} + +// NewTypedEndpointSliceInformerWithOptions constructs a new informer for EndpointSlice type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedEndpointSliceInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) EndpointSliceIndexInformer { gvr := schema.GroupVersionResource{Group: "discovery.k8s.io", Version: "v1", Resource: "endpointslices"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apidiscoveryv1.EndpointSlice](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewEndpointSliceInformerWithOptions(client kubernetes.Interface, namespace Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *endpointSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewEndpointSliceInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedEndpointSliceInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *endpointSliceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apidiscoveryv1.EndpointSlice{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *endpointSliceInformer) TypedInformer() EndpointSliceIndexInformer { + return cache.NewTypedSharedIndexInformer[*apidiscoveryv1.EndpointSlice](f.factory.InformerFor(&apidiscoveryv1.EndpointSlice{}, f.defaultInformer)) } func (f *endpointSliceInformer) Lister() discoveryv1.EndpointSliceLister { return discoveryv1.NewEndpointSliceLister(f.Informer().GetIndexer()) } + +// ToTypedEndpointSliceInformer converts an untyped informer into a TypedEndpointSliceInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *EndpointSlice. If that is not the case, calling type-safe methods of the returned +// TypedEndpointSliceInformer leads to runtime panics. A safer alternative is to pass +// around a TypedEndpointSliceInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedEndpointSliceInformer(informer EndpointSliceInformer) TypedEndpointSliceInformer { + if informer, ok := informer.(TypedEndpointSliceInformer); ok { + return informer + } + return &endpointSliceTypedInformerAdapter{informer} +} + +type endpointSliceTypedInformerAdapter struct { + EndpointSliceInformer +} + +func (a *endpointSliceTypedInformerAdapter) TypedInformer() EndpointSliceIndexInformer { + return cache.NewTypedSharedIndexInformer[*apidiscoveryv1.EndpointSlice](a.Informer()) +} + +// ToEndpointSliceIndexInformer converts an untyped informer into a EndpointSliceIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *EndpointSlice. If that is not the case, calling type-safe methods of the returned +// EndpointSliceIndexInformer leads to runtime panics. A safer alternative is to pass +// around a EndpointSliceIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToEndpointSliceIndexInformer(informer cache.SharedIndexInformer) EndpointSliceIndexInformer { + if informer, ok := informer.(EndpointSliceIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apidiscoveryv1.EndpointSlice](informer) +} diff --git a/vendor/k8s.io/client-go/informers/discovery/v1/interface.go b/vendor/k8s.io/client-go/informers/discovery/v1/interface.go index d90c63c0a9..889b917e05 100644 --- a/vendor/k8s.io/client-go/informers/discovery/v1/interface.go +++ b/vendor/k8s.io/client-go/informers/discovery/v1/interface.go @@ -25,7 +25,7 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // EndpointSlices returns a EndpointSliceInformer. - EndpointSlices() EndpointSliceInformer + EndpointSlices() TypedEndpointSliceInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// EndpointSlices returns a EndpointSliceInformer. -func (v *version) EndpointSlices() EndpointSliceInformer { +// EndpointSlices returns a TypedEndpointSliceInformer. +func (v *version) EndpointSlices() TypedEndpointSliceInformer { return &endpointSliceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go b/vendor/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go index 918e30485f..5fa7068782 100644 --- a/vendor/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go +++ b/vendor/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go @@ -34,12 +34,40 @@ import ( ) // EndpointSliceInformer provides access to a shared informer and lister for -// EndpointSlices. +// EndpointSlices. Prefer using the type-safe variant (see [TypedEndpointSliceInformer]). type EndpointSliceInformer interface { Informer() cache.SharedIndexInformer Lister() discoveryv1beta1.EndpointSliceLister } +// TypedEndpointSliceInformer provides access to a shared informer and lister for +// EndpointSlices, including the type-safe TypedInformer variant. +// It is a superset of EndpointSliceInformer. +type TypedEndpointSliceInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() EndpointSliceIndexInformer + Lister() discoveryv1beta1.EndpointSliceLister +} + +// EndpointSliceIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type EndpointSliceIndexInformer cache.TypedSharedIndexInformer[*apidiscoveryv1beta1.EndpointSlice] + +// EndpointSliceHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for EndpointSlice. +type EndpointSliceHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apidiscoveryv1beta1.EndpointSlice] + +// EndpointSliceDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for EndpointSlice. +type EndpointSliceDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apidiscoveryv1beta1.EndpointSlice] + +// EndpointSliceFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for EndpointSlice. +type EndpointSliceFilteringHandler = cache.TypedFilteringResourceEventHandler[*apidiscoveryv1beta1.EndpointSlice] + +// EndpointSliceIndexers is a specialization of [cache.TypedIndexers] for EndpointSlice. +type EndpointSliceIndexers = cache.TypedIndexers[*apidiscoveryv1beta1.EndpointSlice] + +// DeletedEndpointSlice is a specialization of [cache.DeletedObject] for EndpointSlice. +type DeletedEndpointSlice = cache.DeletedObject[*apidiscoveryv1beta1.EndpointSlice] + type endpointSliceInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type endpointSliceInformer struct { // NewEndpointSliceInformer constructs a new informer for EndpointSlice type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedEndpointSliceInformer]). func NewEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewEndpointSliceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedEndpointSliceInformer constructs a new informer for EndpointSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers EndpointSliceIndexers) EndpointSliceIndexInformer { + return NewTypedEndpointSliceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredEndpointSliceInformer constructs a new informer for EndpointSlice type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredEndpointSliceInformer]). func NewFilteredEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewEndpointSliceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedEndpointSliceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredEndpointSliceInformer constructs a new informer for EndpointSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers EndpointSliceIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) EndpointSliceIndexInformer { + return NewTypedEndpointSliceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewEndpointSliceInformerWithOptions constructs a new informer for EndpointSlice type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedEndpointSliceInformerWithOptions]). func NewEndpointSliceInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedEndpointSliceInformerWithOptions(client, namespace, options) +} + +// NewTypedEndpointSliceInformerWithOptions constructs a new informer for EndpointSlice type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedEndpointSliceInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) EndpointSliceIndexInformer { gvr := schema.GroupVersionResource{Group: "discovery.k8s.io", Version: "v1beta1", Resource: "endpointslices"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apidiscoveryv1beta1.EndpointSlice](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewEndpointSliceInformerWithOptions(client kubernetes.Interface, namespace Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *endpointSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewEndpointSliceInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedEndpointSliceInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *endpointSliceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apidiscoveryv1beta1.EndpointSlice{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *endpointSliceInformer) TypedInformer() EndpointSliceIndexInformer { + return cache.NewTypedSharedIndexInformer[*apidiscoveryv1beta1.EndpointSlice](f.factory.InformerFor(&apidiscoveryv1beta1.EndpointSlice{}, f.defaultInformer)) } func (f *endpointSliceInformer) Lister() discoveryv1beta1.EndpointSliceLister { return discoveryv1beta1.NewEndpointSliceLister(f.Informer().GetIndexer()) } + +// ToTypedEndpointSliceInformer converts an untyped informer into a TypedEndpointSliceInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *EndpointSlice. If that is not the case, calling type-safe methods of the returned +// TypedEndpointSliceInformer leads to runtime panics. A safer alternative is to pass +// around a TypedEndpointSliceInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedEndpointSliceInformer(informer EndpointSliceInformer) TypedEndpointSliceInformer { + if informer, ok := informer.(TypedEndpointSliceInformer); ok { + return informer + } + return &endpointSliceTypedInformerAdapter{informer} +} + +type endpointSliceTypedInformerAdapter struct { + EndpointSliceInformer +} + +func (a *endpointSliceTypedInformerAdapter) TypedInformer() EndpointSliceIndexInformer { + return cache.NewTypedSharedIndexInformer[*apidiscoveryv1beta1.EndpointSlice](a.Informer()) +} + +// ToEndpointSliceIndexInformer converts an untyped informer into a EndpointSliceIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *EndpointSlice. If that is not the case, calling type-safe methods of the returned +// EndpointSliceIndexInformer leads to runtime panics. A safer alternative is to pass +// around a EndpointSliceIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToEndpointSliceIndexInformer(informer cache.SharedIndexInformer) EndpointSliceIndexInformer { + if informer, ok := informer.(EndpointSliceIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apidiscoveryv1beta1.EndpointSlice](informer) +} diff --git a/vendor/k8s.io/client-go/informers/discovery/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/discovery/v1beta1/interface.go index 4661646e01..f0866a4ff6 100644 --- a/vendor/k8s.io/client-go/informers/discovery/v1beta1/interface.go +++ b/vendor/k8s.io/client-go/informers/discovery/v1beta1/interface.go @@ -25,7 +25,7 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // EndpointSlices returns a EndpointSliceInformer. - EndpointSlices() EndpointSliceInformer + EndpointSlices() TypedEndpointSliceInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// EndpointSlices returns a EndpointSliceInformer. -func (v *version) EndpointSlices() EndpointSliceInformer { +// EndpointSlices returns a TypedEndpointSliceInformer. +func (v *version) EndpointSlices() TypedEndpointSliceInformer { return &endpointSliceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/events/v1/event.go b/vendor/k8s.io/client-go/informers/events/v1/event.go index 23aaa68479..d0bd73b500 100644 --- a/vendor/k8s.io/client-go/informers/events/v1/event.go +++ b/vendor/k8s.io/client-go/informers/events/v1/event.go @@ -34,12 +34,40 @@ import ( ) // EventInformer provides access to a shared informer and lister for -// Events. +// Events. Prefer using the type-safe variant (see [TypedEventInformer]). type EventInformer interface { Informer() cache.SharedIndexInformer Lister() eventsv1.EventLister } +// TypedEventInformer provides access to a shared informer and lister for +// Events, including the type-safe TypedInformer variant. +// It is a superset of EventInformer. +type TypedEventInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() EventIndexInformer + Lister() eventsv1.EventLister +} + +// EventIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type EventIndexInformer cache.TypedSharedIndexInformer[*apieventsv1.Event] + +// EventHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Event. +type EventHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apieventsv1.Event] + +// EventDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Event. +type EventDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apieventsv1.Event] + +// EventFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Event. +type EventFilteringHandler = cache.TypedFilteringResourceEventHandler[*apieventsv1.Event] + +// EventIndexers is a specialization of [cache.TypedIndexers] for Event. +type EventIndexers = cache.TypedIndexers[*apieventsv1.Event] + +// DeletedEvent is a specialization of [cache.DeletedObject] for Event. +type DeletedEvent = cache.DeletedObject[*apieventsv1.Event] + type eventInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type eventInformer struct { // NewEventInformer constructs a new informer for Event type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedEventInformer]). func NewEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers EventIndexers) EventIndexInformer { + return NewTypedEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredEventInformer constructs a new informer for Event type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredEventInformer]). func NewFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers EventIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) EventIndexInformer { + return NewTypedEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewEventInformerWithOptions constructs a new informer for Event type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedEventInformerWithOptions]). func NewEventInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedEventInformerWithOptions(client, namespace, options) +} + +// NewTypedEventInformerWithOptions constructs a new informer for Event type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedEventInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) EventIndexInformer { gvr := schema.GroupVersionResource{Group: "events.k8s.io", Version: "v1", Resource: "events"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apieventsv1.Event](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewEventInformerWithOptions(client kubernetes.Interface, namespace string, Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *eventInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewEventInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedEventInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *eventInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apieventsv1.Event{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *eventInformer) TypedInformer() EventIndexInformer { + return cache.NewTypedSharedIndexInformer[*apieventsv1.Event](f.factory.InformerFor(&apieventsv1.Event{}, f.defaultInformer)) } func (f *eventInformer) Lister() eventsv1.EventLister { return eventsv1.NewEventLister(f.Informer().GetIndexer()) } + +// ToTypedEventInformer converts an untyped informer into a TypedEventInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Event. If that is not the case, calling type-safe methods of the returned +// TypedEventInformer leads to runtime panics. A safer alternative is to pass +// around a TypedEventInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedEventInformer(informer EventInformer) TypedEventInformer { + if informer, ok := informer.(TypedEventInformer); ok { + return informer + } + return &eventTypedInformerAdapter{informer} +} + +type eventTypedInformerAdapter struct { + EventInformer +} + +func (a *eventTypedInformerAdapter) TypedInformer() EventIndexInformer { + return cache.NewTypedSharedIndexInformer[*apieventsv1.Event](a.Informer()) +} + +// ToEventIndexInformer converts an untyped informer into a EventIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Event. If that is not the case, calling type-safe methods of the returned +// EventIndexInformer leads to runtime panics. A safer alternative is to pass +// around a EventIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToEventIndexInformer(informer cache.SharedIndexInformer) EventIndexInformer { + if informer, ok := informer.(EventIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apieventsv1.Event](informer) +} diff --git a/vendor/k8s.io/client-go/informers/events/v1/interface.go b/vendor/k8s.io/client-go/informers/events/v1/interface.go index cd06e23359..8b2571298b 100644 --- a/vendor/k8s.io/client-go/informers/events/v1/interface.go +++ b/vendor/k8s.io/client-go/informers/events/v1/interface.go @@ -25,7 +25,7 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // Events returns a EventInformer. - Events() EventInformer + Events() TypedEventInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// Events returns a EventInformer. -func (v *version) Events() EventInformer { +// Events returns a TypedEventInformer. +func (v *version) Events() TypedEventInformer { return &eventInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/events/v1beta1/event.go b/vendor/k8s.io/client-go/informers/events/v1beta1/event.go index ea0117eaca..fc3d7203dc 100644 --- a/vendor/k8s.io/client-go/informers/events/v1beta1/event.go +++ b/vendor/k8s.io/client-go/informers/events/v1beta1/event.go @@ -34,12 +34,40 @@ import ( ) // EventInformer provides access to a shared informer and lister for -// Events. +// Events. Prefer using the type-safe variant (see [TypedEventInformer]). type EventInformer interface { Informer() cache.SharedIndexInformer Lister() eventsv1beta1.EventLister } +// TypedEventInformer provides access to a shared informer and lister for +// Events, including the type-safe TypedInformer variant. +// It is a superset of EventInformer. +type TypedEventInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() EventIndexInformer + Lister() eventsv1beta1.EventLister +} + +// EventIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type EventIndexInformer cache.TypedSharedIndexInformer[*apieventsv1beta1.Event] + +// EventHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Event. +type EventHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apieventsv1beta1.Event] + +// EventDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Event. +type EventDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apieventsv1beta1.Event] + +// EventFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Event. +type EventFilteringHandler = cache.TypedFilteringResourceEventHandler[*apieventsv1beta1.Event] + +// EventIndexers is a specialization of [cache.TypedIndexers] for Event. +type EventIndexers = cache.TypedIndexers[*apieventsv1beta1.Event] + +// DeletedEvent is a specialization of [cache.DeletedObject] for Event. +type DeletedEvent = cache.DeletedObject[*apieventsv1beta1.Event] + type eventInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type eventInformer struct { // NewEventInformer constructs a new informer for Event type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedEventInformer]). func NewEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers EventIndexers) EventIndexInformer { + return NewTypedEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredEventInformer constructs a new informer for Event type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredEventInformer]). func NewFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers EventIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) EventIndexInformer { + return NewTypedEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewEventInformerWithOptions constructs a new informer for Event type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedEventInformerWithOptions]). func NewEventInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedEventInformerWithOptions(client, namespace, options) +} + +// NewTypedEventInformerWithOptions constructs a new informer for Event type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedEventInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) EventIndexInformer { gvr := schema.GroupVersionResource{Group: "events.k8s.io", Version: "v1beta1", Resource: "events"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apieventsv1beta1.Event](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewEventInformerWithOptions(client kubernetes.Interface, namespace string, Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *eventInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewEventInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedEventInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *eventInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apieventsv1beta1.Event{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *eventInformer) TypedInformer() EventIndexInformer { + return cache.NewTypedSharedIndexInformer[*apieventsv1beta1.Event](f.factory.InformerFor(&apieventsv1beta1.Event{}, f.defaultInformer)) } func (f *eventInformer) Lister() eventsv1beta1.EventLister { return eventsv1beta1.NewEventLister(f.Informer().GetIndexer()) } + +// ToTypedEventInformer converts an untyped informer into a TypedEventInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Event. If that is not the case, calling type-safe methods of the returned +// TypedEventInformer leads to runtime panics. A safer alternative is to pass +// around a TypedEventInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedEventInformer(informer EventInformer) TypedEventInformer { + if informer, ok := informer.(TypedEventInformer); ok { + return informer + } + return &eventTypedInformerAdapter{informer} +} + +type eventTypedInformerAdapter struct { + EventInformer +} + +func (a *eventTypedInformerAdapter) TypedInformer() EventIndexInformer { + return cache.NewTypedSharedIndexInformer[*apieventsv1beta1.Event](a.Informer()) +} + +// ToEventIndexInformer converts an untyped informer into a EventIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Event. If that is not the case, calling type-safe methods of the returned +// EventIndexInformer leads to runtime panics. A safer alternative is to pass +// around a EventIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToEventIndexInformer(informer cache.SharedIndexInformer) EventIndexInformer { + if informer, ok := informer.(EventIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apieventsv1beta1.Event](informer) +} diff --git a/vendor/k8s.io/client-go/informers/events/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/events/v1beta1/interface.go index c71888c9a4..9b69ebe28e 100644 --- a/vendor/k8s.io/client-go/informers/events/v1beta1/interface.go +++ b/vendor/k8s.io/client-go/informers/events/v1beta1/interface.go @@ -25,7 +25,7 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // Events returns a EventInformer. - Events() EventInformer + Events() TypedEventInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// Events returns a EventInformer. -func (v *version) Events() EventInformer { +// Events returns a TypedEventInformer. +func (v *version) Events() TypedEventInformer { return &eventInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go index ed8b023038..1c3e4f7ac5 100644 --- a/vendor/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go @@ -34,12 +34,40 @@ import ( ) // DaemonSetInformer provides access to a shared informer and lister for -// DaemonSets. +// DaemonSets. Prefer using the type-safe variant (see [TypedDaemonSetInformer]). type DaemonSetInformer interface { Informer() cache.SharedIndexInformer Lister() extensionsv1beta1.DaemonSetLister } +// TypedDaemonSetInformer provides access to a shared informer and lister for +// DaemonSets, including the type-safe TypedInformer variant. +// It is a superset of DaemonSetInformer. +type TypedDaemonSetInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() DaemonSetIndexInformer + Lister() extensionsv1beta1.DaemonSetLister +} + +// DaemonSetIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type DaemonSetIndexInformer cache.TypedSharedIndexInformer[*apiextensionsv1beta1.DaemonSet] + +// DaemonSetHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for DaemonSet. +type DaemonSetHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiextensionsv1beta1.DaemonSet] + +// DaemonSetDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for DaemonSet. +type DaemonSetDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiextensionsv1beta1.DaemonSet] + +// DaemonSetFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for DaemonSet. +type DaemonSetFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiextensionsv1beta1.DaemonSet] + +// DaemonSetIndexers is a specialization of [cache.TypedIndexers] for DaemonSet. +type DaemonSetIndexers = cache.TypedIndexers[*apiextensionsv1beta1.DaemonSet] + +// DeletedDaemonSet is a specialization of [cache.DeletedObject] for DaemonSet. +type DeletedDaemonSet = cache.DeletedObject[*apiextensionsv1beta1.DaemonSet] + type daemonSetInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type daemonSetInformer struct { // NewDaemonSetInformer constructs a new informer for DaemonSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDaemonSetInformer]). func NewDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers DaemonSetIndexers) DaemonSetIndexInformer { + return NewTypedDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredDaemonSetInformer constructs a new informer for DaemonSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredDaemonSetInformer]). func NewFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers DaemonSetIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) DaemonSetIndexInformer { + return NewTypedDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewDaemonSetInformerWithOptions constructs a new informer for DaemonSet type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDaemonSetInformerWithOptions]). func NewDaemonSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedDaemonSetInformerWithOptions(client, namespace, options) +} + +// NewTypedDaemonSetInformerWithOptions constructs a new informer for DaemonSet type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDaemonSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) DaemonSetIndexInformer { gvr := schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "daemonsets"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.DaemonSet](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewDaemonSetInformerWithOptions(client kubernetes.Interface, namespace stri Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *daemonSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewDaemonSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedDaemonSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiextensionsv1beta1.DaemonSet{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *daemonSetInformer) TypedInformer() DaemonSetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.DaemonSet](f.factory.InformerFor(&apiextensionsv1beta1.DaemonSet{}, f.defaultInformer)) } func (f *daemonSetInformer) Lister() extensionsv1beta1.DaemonSetLister { return extensionsv1beta1.NewDaemonSetLister(f.Informer().GetIndexer()) } + +// ToTypedDaemonSetInformer converts an untyped informer into a TypedDaemonSetInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *DaemonSet. If that is not the case, calling type-safe methods of the returned +// TypedDaemonSetInformer leads to runtime panics. A safer alternative is to pass +// around a TypedDaemonSetInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedDaemonSetInformer(informer DaemonSetInformer) TypedDaemonSetInformer { + if informer, ok := informer.(TypedDaemonSetInformer); ok { + return informer + } + return &daemonSetTypedInformerAdapter{informer} +} + +type daemonSetTypedInformerAdapter struct { + DaemonSetInformer +} + +func (a *daemonSetTypedInformerAdapter) TypedInformer() DaemonSetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.DaemonSet](a.Informer()) +} + +// ToDaemonSetIndexInformer converts an untyped informer into a DaemonSetIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *DaemonSet. If that is not the case, calling type-safe methods of the returned +// DaemonSetIndexInformer leads to runtime panics. A safer alternative is to pass +// around a DaemonSetIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToDaemonSetIndexInformer(informer cache.SharedIndexInformer) DaemonSetIndexInformer { + if informer, ok := informer.(DaemonSetIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.DaemonSet](informer) +} diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/deployment.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/deployment.go index ee328bb517..331298be94 100644 --- a/vendor/k8s.io/client-go/informers/extensions/v1beta1/deployment.go +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/deployment.go @@ -34,12 +34,40 @@ import ( ) // DeploymentInformer provides access to a shared informer and lister for -// Deployments. +// Deployments. Prefer using the type-safe variant (see [TypedDeploymentInformer]). type DeploymentInformer interface { Informer() cache.SharedIndexInformer Lister() extensionsv1beta1.DeploymentLister } +// TypedDeploymentInformer provides access to a shared informer and lister for +// Deployments, including the type-safe TypedInformer variant. +// It is a superset of DeploymentInformer. +type TypedDeploymentInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() DeploymentIndexInformer + Lister() extensionsv1beta1.DeploymentLister +} + +// DeploymentIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type DeploymentIndexInformer cache.TypedSharedIndexInformer[*apiextensionsv1beta1.Deployment] + +// DeploymentHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Deployment. +type DeploymentHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiextensionsv1beta1.Deployment] + +// DeploymentDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Deployment. +type DeploymentDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiextensionsv1beta1.Deployment] + +// DeploymentFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Deployment. +type DeploymentFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiextensionsv1beta1.Deployment] + +// DeploymentIndexers is a specialization of [cache.TypedIndexers] for Deployment. +type DeploymentIndexers = cache.TypedIndexers[*apiextensionsv1beta1.Deployment] + +// DeletedDeployment is a specialization of [cache.DeletedObject] for Deployment. +type DeletedDeployment = cache.DeletedObject[*apiextensionsv1beta1.Deployment] + type deploymentInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type deploymentInformer struct { // NewDeploymentInformer constructs a new informer for Deployment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeploymentInformer]). func NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers DeploymentIndexers) DeploymentIndexInformer { + return NewTypedDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredDeploymentInformer constructs a new informer for Deployment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredDeploymentInformer]). func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers DeploymentIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) DeploymentIndexInformer { + return NewTypedDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewDeploymentInformerWithOptions constructs a new informer for Deployment type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeploymentInformerWithOptions]). func NewDeploymentInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedDeploymentInformerWithOptions(client, namespace, options) +} + +// NewTypedDeploymentInformerWithOptions constructs a new informer for Deployment type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeploymentInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) DeploymentIndexInformer { gvr := schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "deployments"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.Deployment](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewDeploymentInformerWithOptions(client kubernetes.Interface, namespace str Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewDeploymentInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedDeploymentInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *deploymentInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiextensionsv1beta1.Deployment{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *deploymentInformer) TypedInformer() DeploymentIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.Deployment](f.factory.InformerFor(&apiextensionsv1beta1.Deployment{}, f.defaultInformer)) } func (f *deploymentInformer) Lister() extensionsv1beta1.DeploymentLister { return extensionsv1beta1.NewDeploymentLister(f.Informer().GetIndexer()) } + +// ToTypedDeploymentInformer converts an untyped informer into a TypedDeploymentInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Deployment. If that is not the case, calling type-safe methods of the returned +// TypedDeploymentInformer leads to runtime panics. A safer alternative is to pass +// around a TypedDeploymentInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedDeploymentInformer(informer DeploymentInformer) TypedDeploymentInformer { + if informer, ok := informer.(TypedDeploymentInformer); ok { + return informer + } + return &deploymentTypedInformerAdapter{informer} +} + +type deploymentTypedInformerAdapter struct { + DeploymentInformer +} + +func (a *deploymentTypedInformerAdapter) TypedInformer() DeploymentIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.Deployment](a.Informer()) +} + +// ToDeploymentIndexInformer converts an untyped informer into a DeploymentIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Deployment. If that is not the case, calling type-safe methods of the returned +// DeploymentIndexInformer leads to runtime panics. A safer alternative is to pass +// around a DeploymentIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToDeploymentIndexInformer(informer cache.SharedIndexInformer) DeploymentIndexInformer { + if informer, ok := informer.(DeploymentIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.Deployment](informer) +} diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/ingress.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/ingress.go index 852238a481..31fa5723f2 100644 --- a/vendor/k8s.io/client-go/informers/extensions/v1beta1/ingress.go +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/ingress.go @@ -34,12 +34,40 @@ import ( ) // IngressInformer provides access to a shared informer and lister for -// Ingresses. +// Ingresses. Prefer using the type-safe variant (see [TypedIngressInformer]). type IngressInformer interface { Informer() cache.SharedIndexInformer Lister() extensionsv1beta1.IngressLister } +// TypedIngressInformer provides access to a shared informer and lister for +// Ingresses, including the type-safe TypedInformer variant. +// It is a superset of IngressInformer. +type TypedIngressInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() IngressIndexInformer + Lister() extensionsv1beta1.IngressLister +} + +// IngressIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type IngressIndexInformer cache.TypedSharedIndexInformer[*apiextensionsv1beta1.Ingress] + +// IngressHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Ingress. +type IngressHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiextensionsv1beta1.Ingress] + +// IngressDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Ingress. +type IngressDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiextensionsv1beta1.Ingress] + +// IngressFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Ingress. +type IngressFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiextensionsv1beta1.Ingress] + +// IngressIndexers is a specialization of [cache.TypedIndexers] for Ingress. +type IngressIndexers = cache.TypedIndexers[*apiextensionsv1beta1.Ingress] + +// DeletedIngress is a specialization of [cache.DeletedObject] for Ingress. +type DeletedIngress = cache.DeletedObject[*apiextensionsv1beta1.Ingress] + type ingressInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type ingressInformer struct { // NewIngressInformer constructs a new informer for Ingress type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedIngressInformer]). func NewIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers IngressIndexers) IngressIndexInformer { + return NewTypedIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredIngressInformer constructs a new informer for Ingress type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredIngressInformer]). func NewFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers IngressIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) IngressIndexInformer { + return NewTypedIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewIngressInformerWithOptions constructs a new informer for Ingress type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedIngressInformerWithOptions]). func NewIngressInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedIngressInformerWithOptions(client, namespace, options) +} + +// NewTypedIngressInformerWithOptions constructs a new informer for Ingress type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedIngressInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) IngressIndexInformer { gvr := schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "ingresss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.Ingress](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewIngressInformerWithOptions(client kubernetes.Interface, namespace string Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *ingressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewIngressInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedIngressInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *ingressInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiextensionsv1beta1.Ingress{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *ingressInformer) TypedInformer() IngressIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.Ingress](f.factory.InformerFor(&apiextensionsv1beta1.Ingress{}, f.defaultInformer)) } func (f *ingressInformer) Lister() extensionsv1beta1.IngressLister { return extensionsv1beta1.NewIngressLister(f.Informer().GetIndexer()) } + +// ToTypedIngressInformer converts an untyped informer into a TypedIngressInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Ingress. If that is not the case, calling type-safe methods of the returned +// TypedIngressInformer leads to runtime panics. A safer alternative is to pass +// around a TypedIngressInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedIngressInformer(informer IngressInformer) TypedIngressInformer { + if informer, ok := informer.(TypedIngressInformer); ok { + return informer + } + return &ingressTypedInformerAdapter{informer} +} + +type ingressTypedInformerAdapter struct { + IngressInformer +} + +func (a *ingressTypedInformerAdapter) TypedInformer() IngressIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.Ingress](a.Informer()) +} + +// ToIngressIndexInformer converts an untyped informer into a IngressIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Ingress. If that is not the case, calling type-safe methods of the returned +// IngressIndexInformer leads to runtime panics. A safer alternative is to pass +// around a IngressIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToIngressIndexInformer(informer cache.SharedIndexInformer) IngressIndexInformer { + if informer, ok := informer.(IngressIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.Ingress](informer) +} diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/interface.go index 600741e3a2..7c56361720 100644 --- a/vendor/k8s.io/client-go/informers/extensions/v1beta1/interface.go +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/interface.go @@ -25,15 +25,15 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // DaemonSets returns a DaemonSetInformer. - DaemonSets() DaemonSetInformer + DaemonSets() TypedDaemonSetInformer // Deployments returns a DeploymentInformer. - Deployments() DeploymentInformer + Deployments() TypedDeploymentInformer // Ingresses returns a IngressInformer. - Ingresses() IngressInformer + Ingresses() TypedIngressInformer // NetworkPolicies returns a NetworkPolicyInformer. - NetworkPolicies() NetworkPolicyInformer + NetworkPolicies() TypedNetworkPolicyInformer // ReplicaSets returns a ReplicaSetInformer. - ReplicaSets() ReplicaSetInformer + ReplicaSets() TypedReplicaSetInformer } type version struct { @@ -47,27 +47,27 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// DaemonSets returns a DaemonSetInformer. -func (v *version) DaemonSets() DaemonSetInformer { +// DaemonSets returns a TypedDaemonSetInformer. +func (v *version) DaemonSets() TypedDaemonSetInformer { return &daemonSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// Deployments returns a DeploymentInformer. -func (v *version) Deployments() DeploymentInformer { +// Deployments returns a TypedDeploymentInformer. +func (v *version) Deployments() TypedDeploymentInformer { return &deploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// Ingresses returns a IngressInformer. -func (v *version) Ingresses() IngressInformer { +// Ingresses returns a TypedIngressInformer. +func (v *version) Ingresses() TypedIngressInformer { return &ingressInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// NetworkPolicies returns a NetworkPolicyInformer. -func (v *version) NetworkPolicies() NetworkPolicyInformer { +// NetworkPolicies returns a TypedNetworkPolicyInformer. +func (v *version) NetworkPolicies() TypedNetworkPolicyInformer { return &networkPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// ReplicaSets returns a ReplicaSetInformer. -func (v *version) ReplicaSets() ReplicaSetInformer { +// ReplicaSets returns a TypedReplicaSetInformer. +func (v *version) ReplicaSets() TypedReplicaSetInformer { return &replicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go index fda46c1d96..2bec16ad2b 100644 --- a/vendor/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go @@ -34,12 +34,40 @@ import ( ) // NetworkPolicyInformer provides access to a shared informer and lister for -// NetworkPolicies. +// NetworkPolicies. Prefer using the type-safe variant (see [TypedNetworkPolicyInformer]). type NetworkPolicyInformer interface { Informer() cache.SharedIndexInformer Lister() extensionsv1beta1.NetworkPolicyLister } +// TypedNetworkPolicyInformer provides access to a shared informer and lister for +// NetworkPolicies, including the type-safe TypedInformer variant. +// It is a superset of NetworkPolicyInformer. +type TypedNetworkPolicyInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() NetworkPolicyIndexInformer + Lister() extensionsv1beta1.NetworkPolicyLister +} + +// NetworkPolicyIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type NetworkPolicyIndexInformer cache.TypedSharedIndexInformer[*apiextensionsv1beta1.NetworkPolicy] + +// NetworkPolicyHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for NetworkPolicy. +type NetworkPolicyHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiextensionsv1beta1.NetworkPolicy] + +// NetworkPolicyDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for NetworkPolicy. +type NetworkPolicyDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiextensionsv1beta1.NetworkPolicy] + +// NetworkPolicyFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for NetworkPolicy. +type NetworkPolicyFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiextensionsv1beta1.NetworkPolicy] + +// NetworkPolicyIndexers is a specialization of [cache.TypedIndexers] for NetworkPolicy. +type NetworkPolicyIndexers = cache.TypedIndexers[*apiextensionsv1beta1.NetworkPolicy] + +// DeletedNetworkPolicy is a specialization of [cache.DeletedObject] for NetworkPolicy. +type DeletedNetworkPolicy = cache.DeletedObject[*apiextensionsv1beta1.NetworkPolicy] + type networkPolicyInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type networkPolicyInformer struct { // NewNetworkPolicyInformer constructs a new informer for NetworkPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedNetworkPolicyInformer]). func NewNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewNetworkPolicyInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedNetworkPolicyInformer constructs a new informer for NetworkPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers NetworkPolicyIndexers) NetworkPolicyIndexInformer { + return NewTypedNetworkPolicyInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredNetworkPolicyInformer constructs a new informer for NetworkPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredNetworkPolicyInformer]). func NewFilteredNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewNetworkPolicyInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedNetworkPolicyInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredNetworkPolicyInformer constructs a new informer for NetworkPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers NetworkPolicyIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) NetworkPolicyIndexInformer { + return NewTypedNetworkPolicyInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewNetworkPolicyInformerWithOptions constructs a new informer for NetworkPolicy type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedNetworkPolicyInformerWithOptions]). func NewNetworkPolicyInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedNetworkPolicyInformerWithOptions(client, namespace, options) +} + +// NewTypedNetworkPolicyInformerWithOptions constructs a new informer for NetworkPolicy type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedNetworkPolicyInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) NetworkPolicyIndexInformer { gvr := schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "networkpolicys"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.NetworkPolicy](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewNetworkPolicyInformerWithOptions(client kubernetes.Interface, namespace Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *networkPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewNetworkPolicyInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedNetworkPolicyInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *networkPolicyInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiextensionsv1beta1.NetworkPolicy{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *networkPolicyInformer) TypedInformer() NetworkPolicyIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.NetworkPolicy](f.factory.InformerFor(&apiextensionsv1beta1.NetworkPolicy{}, f.defaultInformer)) } func (f *networkPolicyInformer) Lister() extensionsv1beta1.NetworkPolicyLister { return extensionsv1beta1.NewNetworkPolicyLister(f.Informer().GetIndexer()) } + +// ToTypedNetworkPolicyInformer converts an untyped informer into a TypedNetworkPolicyInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *NetworkPolicy. If that is not the case, calling type-safe methods of the returned +// TypedNetworkPolicyInformer leads to runtime panics. A safer alternative is to pass +// around a TypedNetworkPolicyInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedNetworkPolicyInformer(informer NetworkPolicyInformer) TypedNetworkPolicyInformer { + if informer, ok := informer.(TypedNetworkPolicyInformer); ok { + return informer + } + return &networkPolicyTypedInformerAdapter{informer} +} + +type networkPolicyTypedInformerAdapter struct { + NetworkPolicyInformer +} + +func (a *networkPolicyTypedInformerAdapter) TypedInformer() NetworkPolicyIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.NetworkPolicy](a.Informer()) +} + +// ToNetworkPolicyIndexInformer converts an untyped informer into a NetworkPolicyIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *NetworkPolicy. If that is not the case, calling type-safe methods of the returned +// NetworkPolicyIndexInformer leads to runtime panics. A safer alternative is to pass +// around a NetworkPolicyIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToNetworkPolicyIndexInformer(informer cache.SharedIndexInformer) NetworkPolicyIndexInformer { + if informer, ok := informer.(NetworkPolicyIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.NetworkPolicy](informer) +} diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go index eb0685147f..cc8ba5c76e 100644 --- a/vendor/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go @@ -34,12 +34,40 @@ import ( ) // ReplicaSetInformer provides access to a shared informer and lister for -// ReplicaSets. +// ReplicaSets. Prefer using the type-safe variant (see [TypedReplicaSetInformer]). type ReplicaSetInformer interface { Informer() cache.SharedIndexInformer Lister() extensionsv1beta1.ReplicaSetLister } +// TypedReplicaSetInformer provides access to a shared informer and lister for +// ReplicaSets, including the type-safe TypedInformer variant. +// It is a superset of ReplicaSetInformer. +type TypedReplicaSetInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ReplicaSetIndexInformer + Lister() extensionsv1beta1.ReplicaSetLister +} + +// ReplicaSetIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ReplicaSetIndexInformer cache.TypedSharedIndexInformer[*apiextensionsv1beta1.ReplicaSet] + +// ReplicaSetHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ReplicaSet. +type ReplicaSetHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiextensionsv1beta1.ReplicaSet] + +// ReplicaSetDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ReplicaSet. +type ReplicaSetDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiextensionsv1beta1.ReplicaSet] + +// ReplicaSetFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ReplicaSet. +type ReplicaSetFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiextensionsv1beta1.ReplicaSet] + +// ReplicaSetIndexers is a specialization of [cache.TypedIndexers] for ReplicaSet. +type ReplicaSetIndexers = cache.TypedIndexers[*apiextensionsv1beta1.ReplicaSet] + +// DeletedReplicaSet is a specialization of [cache.DeletedObject] for ReplicaSet. +type DeletedReplicaSet = cache.DeletedObject[*apiextensionsv1beta1.ReplicaSet] + type replicaSetInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type replicaSetInformer struct { // NewReplicaSetInformer constructs a new informer for ReplicaSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedReplicaSetInformer]). func NewReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ReplicaSetIndexers) ReplicaSetIndexInformer { + return NewTypedReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredReplicaSetInformer]). func NewFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ReplicaSetIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ReplicaSetIndexInformer { + return NewTypedReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewReplicaSetInformerWithOptions constructs a new informer for ReplicaSet type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedReplicaSetInformerWithOptions]). func NewReplicaSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedReplicaSetInformerWithOptions(client, namespace, options) +} + +// NewTypedReplicaSetInformerWithOptions constructs a new informer for ReplicaSet type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedReplicaSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) ReplicaSetIndexInformer { gvr := schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "replicasets"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.ReplicaSet](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewReplicaSetInformerWithOptions(client kubernetes.Interface, namespace str Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *replicaSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewReplicaSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedReplicaSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiextensionsv1beta1.ReplicaSet{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *replicaSetInformer) TypedInformer() ReplicaSetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.ReplicaSet](f.factory.InformerFor(&apiextensionsv1beta1.ReplicaSet{}, f.defaultInformer)) } func (f *replicaSetInformer) Lister() extensionsv1beta1.ReplicaSetLister { return extensionsv1beta1.NewReplicaSetLister(f.Informer().GetIndexer()) } + +// ToTypedReplicaSetInformer converts an untyped informer into a TypedReplicaSetInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ReplicaSet. If that is not the case, calling type-safe methods of the returned +// TypedReplicaSetInformer leads to runtime panics. A safer alternative is to pass +// around a TypedReplicaSetInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedReplicaSetInformer(informer ReplicaSetInformer) TypedReplicaSetInformer { + if informer, ok := informer.(TypedReplicaSetInformer); ok { + return informer + } + return &replicaSetTypedInformerAdapter{informer} +} + +type replicaSetTypedInformerAdapter struct { + ReplicaSetInformer +} + +func (a *replicaSetTypedInformerAdapter) TypedInformer() ReplicaSetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.ReplicaSet](a.Informer()) +} + +// ToReplicaSetIndexInformer converts an untyped informer into a ReplicaSetIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ReplicaSet. If that is not the case, calling type-safe methods of the returned +// ReplicaSetIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ReplicaSetIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToReplicaSetIndexInformer(informer cache.SharedIndexInformer) ReplicaSetIndexInformer { + if informer, ok := informer.(ReplicaSetIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiextensionsv1beta1.ReplicaSet](informer) +} diff --git a/vendor/k8s.io/client-go/informers/factory.go b/vendor/k8s.io/client-go/informers/factory.go index 19901079f8..4886f84653 100644 --- a/vendor/k8s.io/client-go/informers/factory.go +++ b/vendor/k8s.io/client-go/informers/factory.go @@ -41,6 +41,7 @@ import ( extensions "k8s.io/client-go/informers/extensions" flowcontrol "k8s.io/client-go/informers/flowcontrol" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + lifecycle "k8s.io/client-go/informers/lifecycle" networking "k8s.io/client-go/informers/networking" node "k8s.io/client-go/informers/node" policy "k8s.io/client-go/informers/policy" @@ -272,7 +273,7 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal // ctx, cancel := context.WithCancel(context.Background()) // defer cancel() // factory := NewSharedInformerFactory(client, resyncPeriod) -// defer factory.WaitForStop() // Returns immediately if nothing was started. +// defer factory.Shutdown() // Returns immediately if nothing was started. // genericInformer := factory.ForResource(resource) // typedInformer := factory.SomeAPIGroup().V1().SomeType() // handle, err := typeInformer.Informer().AddEventHandler(...) @@ -330,7 +331,7 @@ type SharedInformerFactory interface { // WaitForCacheSync blocks until all started informers' caches were synced // or the stop channel gets closed. // - // Contextual logging: WaitForCacheSync should be used instead of WaitForCacheSync in code which supports contextual logging. It also returns a more useful result. + // Contextual logging: WaitForCacheSyncWithContext should be used instead of WaitForCacheSync in code which supports contextual logging. It also returns a more useful result. WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool // WaitForCacheSyncWithContext blocks until all started informers' caches were synced @@ -356,6 +357,7 @@ type SharedInformerFactory interface { Events() events.Interface Extensions() extensions.Interface Flowcontrol() flowcontrol.Interface + Lifecycle() lifecycle.Interface Networking() networking.Interface Node() node.Interface Policy() policy.Interface @@ -414,6 +416,10 @@ func (f *sharedInformerFactory) Flowcontrol() flowcontrol.Interface { return flowcontrol.New(f, f.namespace, f.tweakListOptions) } +func (f *sharedInformerFactory) Lifecycle() lifecycle.Interface { + return lifecycle.New(f, f.namespace, f.tweakListOptions) +} + func (f *sharedInformerFactory) Networking() networking.Interface { return networking.New(f, f.namespace, f.tweakListOptions) } diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1/flowschema.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1/flowschema.go index 624c2f5d6d..429ac3a9ac 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1/flowschema.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1/flowschema.go @@ -34,12 +34,40 @@ import ( ) // FlowSchemaInformer provides access to a shared informer and lister for -// FlowSchemas. +// FlowSchemas. Prefer using the type-safe variant (see [TypedFlowSchemaInformer]). type FlowSchemaInformer interface { Informer() cache.SharedIndexInformer Lister() flowcontrolv1.FlowSchemaLister } +// TypedFlowSchemaInformer provides access to a shared informer and lister for +// FlowSchemas, including the type-safe TypedInformer variant. +// It is a superset of FlowSchemaInformer. +type TypedFlowSchemaInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() FlowSchemaIndexInformer + Lister() flowcontrolv1.FlowSchemaLister +} + +// FlowSchemaIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type FlowSchemaIndexInformer cache.TypedSharedIndexInformer[*apiflowcontrolv1.FlowSchema] + +// FlowSchemaHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for FlowSchema. +type FlowSchemaHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiflowcontrolv1.FlowSchema] + +// FlowSchemaDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for FlowSchema. +type FlowSchemaDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiflowcontrolv1.FlowSchema] + +// FlowSchemaFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for FlowSchema. +type FlowSchemaFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiflowcontrolv1.FlowSchema] + +// FlowSchemaIndexers is a specialization of [cache.TypedIndexers] for FlowSchema. +type FlowSchemaIndexers = cache.TypedIndexers[*apiflowcontrolv1.FlowSchema] + +// DeletedFlowSchema is a specialization of [cache.DeletedObject] for FlowSchema. +type DeletedFlowSchema = cache.DeletedObject[*apiflowcontrolv1.FlowSchema] + type flowSchemaInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type flowSchemaInformer struct { // NewFlowSchemaInformer constructs a new informer for FlowSchema type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFlowSchemaInformer]). func NewFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers FlowSchemaIndexers) FlowSchemaIndexInformer { + return NewTypedFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredFlowSchemaInformer]). func NewFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers FlowSchemaIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) FlowSchemaIndexInformer { + return NewTypedFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewFlowSchemaInformerWithOptions constructs a new informer for FlowSchema type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFlowSchemaInformerWithOptions]). func NewFlowSchemaInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedFlowSchemaInformerWithOptions(client, options) +} + +// NewTypedFlowSchemaInformerWithOptions constructs a new informer for FlowSchema type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFlowSchemaInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) FlowSchemaIndexInformer { gvr := schema.GroupVersionResource{Group: "flowcontrol.apiserver.k8s.io", Version: "v1", Resource: "flowschemas"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1.FlowSchema](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewFlowSchemaInformerWithOptions(client kubernetes.Interface, options inter Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *flowSchemaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *flowSchemaInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiflowcontrolv1.FlowSchema{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *flowSchemaInformer) TypedInformer() FlowSchemaIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1.FlowSchema](f.factory.InformerFor(&apiflowcontrolv1.FlowSchema{}, f.defaultInformer)) } func (f *flowSchemaInformer) Lister() flowcontrolv1.FlowSchemaLister { return flowcontrolv1.NewFlowSchemaLister(f.Informer().GetIndexer()) } + +// ToTypedFlowSchemaInformer converts an untyped informer into a TypedFlowSchemaInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *FlowSchema. If that is not the case, calling type-safe methods of the returned +// TypedFlowSchemaInformer leads to runtime panics. A safer alternative is to pass +// around a TypedFlowSchemaInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedFlowSchemaInformer(informer FlowSchemaInformer) TypedFlowSchemaInformer { + if informer, ok := informer.(TypedFlowSchemaInformer); ok { + return informer + } + return &flowSchemaTypedInformerAdapter{informer} +} + +type flowSchemaTypedInformerAdapter struct { + FlowSchemaInformer +} + +func (a *flowSchemaTypedInformerAdapter) TypedInformer() FlowSchemaIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1.FlowSchema](a.Informer()) +} + +// ToFlowSchemaIndexInformer converts an untyped informer into a FlowSchemaIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *FlowSchema. If that is not the case, calling type-safe methods of the returned +// FlowSchemaIndexInformer leads to runtime panics. A safer alternative is to pass +// around a FlowSchemaIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToFlowSchemaIndexInformer(informer cache.SharedIndexInformer) FlowSchemaIndexInformer { + if informer, ok := informer.(FlowSchemaIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1.FlowSchema](informer) +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1/interface.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1/interface.go index 3de934900f..2c4a8465c7 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1/interface.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1/interface.go @@ -25,9 +25,9 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // FlowSchemas returns a FlowSchemaInformer. - FlowSchemas() FlowSchemaInformer + FlowSchemas() TypedFlowSchemaInformer // PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. - PriorityLevelConfigurations() PriorityLevelConfigurationInformer + PriorityLevelConfigurations() TypedPriorityLevelConfigurationInformer } type version struct { @@ -41,12 +41,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// FlowSchemas returns a FlowSchemaInformer. -func (v *version) FlowSchemas() FlowSchemaInformer { +// FlowSchemas returns a TypedFlowSchemaInformer. +func (v *version) FlowSchemas() TypedFlowSchemaInformer { return &flowSchemaInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. -func (v *version) PriorityLevelConfigurations() PriorityLevelConfigurationInformer { +// PriorityLevelConfigurations returns a TypedPriorityLevelConfigurationInformer. +func (v *version) PriorityLevelConfigurations() TypedPriorityLevelConfigurationInformer { return &priorityLevelConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1/prioritylevelconfiguration.go index 5a42509553..7fd72aa9b8 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1/prioritylevelconfiguration.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1/prioritylevelconfiguration.go @@ -34,12 +34,40 @@ import ( ) // PriorityLevelConfigurationInformer provides access to a shared informer and lister for -// PriorityLevelConfigurations. +// PriorityLevelConfigurations. Prefer using the type-safe variant (see [TypedPriorityLevelConfigurationInformer]). type PriorityLevelConfigurationInformer interface { Informer() cache.SharedIndexInformer Lister() flowcontrolv1.PriorityLevelConfigurationLister } +// TypedPriorityLevelConfigurationInformer provides access to a shared informer and lister for +// PriorityLevelConfigurations, including the type-safe TypedInformer variant. +// It is a superset of PriorityLevelConfigurationInformer. +type TypedPriorityLevelConfigurationInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() PriorityLevelConfigurationIndexInformer + Lister() flowcontrolv1.PriorityLevelConfigurationLister +} + +// PriorityLevelConfigurationIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type PriorityLevelConfigurationIndexInformer cache.TypedSharedIndexInformer[*apiflowcontrolv1.PriorityLevelConfiguration] + +// PriorityLevelConfigurationHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for PriorityLevelConfiguration. +type PriorityLevelConfigurationHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiflowcontrolv1.PriorityLevelConfiguration] + +// PriorityLevelConfigurationDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for PriorityLevelConfiguration. +type PriorityLevelConfigurationDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiflowcontrolv1.PriorityLevelConfiguration] + +// PriorityLevelConfigurationFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for PriorityLevelConfiguration. +type PriorityLevelConfigurationFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiflowcontrolv1.PriorityLevelConfiguration] + +// PriorityLevelConfigurationIndexers is a specialization of [cache.TypedIndexers] for PriorityLevelConfiguration. +type PriorityLevelConfigurationIndexers = cache.TypedIndexers[*apiflowcontrolv1.PriorityLevelConfiguration] + +// DeletedPriorityLevelConfiguration is a specialization of [cache.DeletedObject] for PriorityLevelConfiguration. +type DeletedPriorityLevelConfiguration = cache.DeletedObject[*apiflowcontrolv1.PriorityLevelConfiguration] + type priorityLevelConfigurationInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type priorityLevelConfigurationInformer struct { // NewPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPriorityLevelConfigurationInformer]). func NewPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers PriorityLevelConfigurationIndexers) PriorityLevelConfigurationIndexInformer { + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredPriorityLevelConfigurationInformer]). func NewFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers PriorityLevelConfigurationIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) PriorityLevelConfigurationIndexInformer { + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewPriorityLevelConfigurationInformerWithOptions constructs a new informer for PriorityLevelConfiguration type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPriorityLevelConfigurationInformerWithOptions]). func NewPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, options) +} + +// NewTypedPriorityLevelConfigurationInformerWithOptions constructs a new informer for PriorityLevelConfiguration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) PriorityLevelConfigurationIndexInformer { gvr := schema.GroupVersionResource{Group: "flowcontrol.apiserver.k8s.io", Version: "v1", Resource: "prioritylevelconfigurations"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1.PriorityLevelConfiguration](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interfac Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *priorityLevelConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *priorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiflowcontrolv1.PriorityLevelConfiguration{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *priorityLevelConfigurationInformer) TypedInformer() PriorityLevelConfigurationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1.PriorityLevelConfiguration](f.factory.InformerFor(&apiflowcontrolv1.PriorityLevelConfiguration{}, f.defaultInformer)) } func (f *priorityLevelConfigurationInformer) Lister() flowcontrolv1.PriorityLevelConfigurationLister { return flowcontrolv1.NewPriorityLevelConfigurationLister(f.Informer().GetIndexer()) } + +// ToTypedPriorityLevelConfigurationInformer converts an untyped informer into a TypedPriorityLevelConfigurationInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PriorityLevelConfiguration. If that is not the case, calling type-safe methods of the returned +// TypedPriorityLevelConfigurationInformer leads to runtime panics. A safer alternative is to pass +// around a TypedPriorityLevelConfigurationInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedPriorityLevelConfigurationInformer(informer PriorityLevelConfigurationInformer) TypedPriorityLevelConfigurationInformer { + if informer, ok := informer.(TypedPriorityLevelConfigurationInformer); ok { + return informer + } + return &priorityLevelConfigurationTypedInformerAdapter{informer} +} + +type priorityLevelConfigurationTypedInformerAdapter struct { + PriorityLevelConfigurationInformer +} + +func (a *priorityLevelConfigurationTypedInformerAdapter) TypedInformer() PriorityLevelConfigurationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1.PriorityLevelConfiguration](a.Informer()) +} + +// ToPriorityLevelConfigurationIndexInformer converts an untyped informer into a PriorityLevelConfigurationIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PriorityLevelConfiguration. If that is not the case, calling type-safe methods of the returned +// PriorityLevelConfigurationIndexInformer leads to runtime panics. A safer alternative is to pass +// around a PriorityLevelConfigurationIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToPriorityLevelConfigurationIndexInformer(informer cache.SharedIndexInformer) PriorityLevelConfigurationIndexInformer { + if informer, ok := informer.(PriorityLevelConfigurationIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1.PriorityLevelConfiguration](informer) +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go index 2e0098e664..d0d8778b3c 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go @@ -34,12 +34,40 @@ import ( ) // FlowSchemaInformer provides access to a shared informer and lister for -// FlowSchemas. +// FlowSchemas. Prefer using the type-safe variant (see [TypedFlowSchemaInformer]). type FlowSchemaInformer interface { Informer() cache.SharedIndexInformer Lister() flowcontrolv1beta1.FlowSchemaLister } +// TypedFlowSchemaInformer provides access to a shared informer and lister for +// FlowSchemas, including the type-safe TypedInformer variant. +// It is a superset of FlowSchemaInformer. +type TypedFlowSchemaInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() FlowSchemaIndexInformer + Lister() flowcontrolv1beta1.FlowSchemaLister +} + +// FlowSchemaIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type FlowSchemaIndexInformer cache.TypedSharedIndexInformer[*apiflowcontrolv1beta1.FlowSchema] + +// FlowSchemaHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for FlowSchema. +type FlowSchemaHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiflowcontrolv1beta1.FlowSchema] + +// FlowSchemaDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for FlowSchema. +type FlowSchemaDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiflowcontrolv1beta1.FlowSchema] + +// FlowSchemaFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for FlowSchema. +type FlowSchemaFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiflowcontrolv1beta1.FlowSchema] + +// FlowSchemaIndexers is a specialization of [cache.TypedIndexers] for FlowSchema. +type FlowSchemaIndexers = cache.TypedIndexers[*apiflowcontrolv1beta1.FlowSchema] + +// DeletedFlowSchema is a specialization of [cache.DeletedObject] for FlowSchema. +type DeletedFlowSchema = cache.DeletedObject[*apiflowcontrolv1beta1.FlowSchema] + type flowSchemaInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type flowSchemaInformer struct { // NewFlowSchemaInformer constructs a new informer for FlowSchema type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFlowSchemaInformer]). func NewFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers FlowSchemaIndexers) FlowSchemaIndexInformer { + return NewTypedFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredFlowSchemaInformer]). func NewFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers FlowSchemaIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) FlowSchemaIndexInformer { + return NewTypedFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewFlowSchemaInformerWithOptions constructs a new informer for FlowSchema type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFlowSchemaInformerWithOptions]). func NewFlowSchemaInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedFlowSchemaInformerWithOptions(client, options) +} + +// NewTypedFlowSchemaInformerWithOptions constructs a new informer for FlowSchema type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFlowSchemaInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) FlowSchemaIndexInformer { gvr := schema.GroupVersionResource{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta1", Resource: "flowschemas"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta1.FlowSchema](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewFlowSchemaInformerWithOptions(client kubernetes.Interface, options inter Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *flowSchemaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *flowSchemaInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiflowcontrolv1beta1.FlowSchema{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *flowSchemaInformer) TypedInformer() FlowSchemaIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta1.FlowSchema](f.factory.InformerFor(&apiflowcontrolv1beta1.FlowSchema{}, f.defaultInformer)) } func (f *flowSchemaInformer) Lister() flowcontrolv1beta1.FlowSchemaLister { return flowcontrolv1beta1.NewFlowSchemaLister(f.Informer().GetIndexer()) } + +// ToTypedFlowSchemaInformer converts an untyped informer into a TypedFlowSchemaInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *FlowSchema. If that is not the case, calling type-safe methods of the returned +// TypedFlowSchemaInformer leads to runtime panics. A safer alternative is to pass +// around a TypedFlowSchemaInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedFlowSchemaInformer(informer FlowSchemaInformer) TypedFlowSchemaInformer { + if informer, ok := informer.(TypedFlowSchemaInformer); ok { + return informer + } + return &flowSchemaTypedInformerAdapter{informer} +} + +type flowSchemaTypedInformerAdapter struct { + FlowSchemaInformer +} + +func (a *flowSchemaTypedInformerAdapter) TypedInformer() FlowSchemaIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta1.FlowSchema](a.Informer()) +} + +// ToFlowSchemaIndexInformer converts an untyped informer into a FlowSchemaIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *FlowSchema. If that is not the case, calling type-safe methods of the returned +// FlowSchemaIndexInformer leads to runtime panics. A safer alternative is to pass +// around a FlowSchemaIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToFlowSchemaIndexInformer(informer cache.SharedIndexInformer) FlowSchemaIndexInformer { + if informer, ok := informer.(FlowSchemaIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta1.FlowSchema](informer) +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/interface.go index 50329bb0ac..576d8de678 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/interface.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/interface.go @@ -25,9 +25,9 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // FlowSchemas returns a FlowSchemaInformer. - FlowSchemas() FlowSchemaInformer + FlowSchemas() TypedFlowSchemaInformer // PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. - PriorityLevelConfigurations() PriorityLevelConfigurationInformer + PriorityLevelConfigurations() TypedPriorityLevelConfigurationInformer } type version struct { @@ -41,12 +41,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// FlowSchemas returns a FlowSchemaInformer. -func (v *version) FlowSchemas() FlowSchemaInformer { +// FlowSchemas returns a TypedFlowSchemaInformer. +func (v *version) FlowSchemas() TypedFlowSchemaInformer { return &flowSchemaInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. -func (v *version) PriorityLevelConfigurations() PriorityLevelConfigurationInformer { +// PriorityLevelConfigurations returns a TypedPriorityLevelConfigurationInformer. +func (v *version) PriorityLevelConfigurations() TypedPriorityLevelConfigurationInformer { return &priorityLevelConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go index 9c94839a1a..2b5cb8832f 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go @@ -34,12 +34,40 @@ import ( ) // PriorityLevelConfigurationInformer provides access to a shared informer and lister for -// PriorityLevelConfigurations. +// PriorityLevelConfigurations. Prefer using the type-safe variant (see [TypedPriorityLevelConfigurationInformer]). type PriorityLevelConfigurationInformer interface { Informer() cache.SharedIndexInformer Lister() flowcontrolv1beta1.PriorityLevelConfigurationLister } +// TypedPriorityLevelConfigurationInformer provides access to a shared informer and lister for +// PriorityLevelConfigurations, including the type-safe TypedInformer variant. +// It is a superset of PriorityLevelConfigurationInformer. +type TypedPriorityLevelConfigurationInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() PriorityLevelConfigurationIndexInformer + Lister() flowcontrolv1beta1.PriorityLevelConfigurationLister +} + +// PriorityLevelConfigurationIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type PriorityLevelConfigurationIndexInformer cache.TypedSharedIndexInformer[*apiflowcontrolv1beta1.PriorityLevelConfiguration] + +// PriorityLevelConfigurationHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for PriorityLevelConfiguration. +type PriorityLevelConfigurationHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiflowcontrolv1beta1.PriorityLevelConfiguration] + +// PriorityLevelConfigurationDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for PriorityLevelConfiguration. +type PriorityLevelConfigurationDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiflowcontrolv1beta1.PriorityLevelConfiguration] + +// PriorityLevelConfigurationFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for PriorityLevelConfiguration. +type PriorityLevelConfigurationFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiflowcontrolv1beta1.PriorityLevelConfiguration] + +// PriorityLevelConfigurationIndexers is a specialization of [cache.TypedIndexers] for PriorityLevelConfiguration. +type PriorityLevelConfigurationIndexers = cache.TypedIndexers[*apiflowcontrolv1beta1.PriorityLevelConfiguration] + +// DeletedPriorityLevelConfiguration is a specialization of [cache.DeletedObject] for PriorityLevelConfiguration. +type DeletedPriorityLevelConfiguration = cache.DeletedObject[*apiflowcontrolv1beta1.PriorityLevelConfiguration] + type priorityLevelConfigurationInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type priorityLevelConfigurationInformer struct { // NewPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPriorityLevelConfigurationInformer]). func NewPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers PriorityLevelConfigurationIndexers) PriorityLevelConfigurationIndexInformer { + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredPriorityLevelConfigurationInformer]). func NewFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers PriorityLevelConfigurationIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) PriorityLevelConfigurationIndexInformer { + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewPriorityLevelConfigurationInformerWithOptions constructs a new informer for PriorityLevelConfiguration type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPriorityLevelConfigurationInformerWithOptions]). func NewPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, options) +} + +// NewTypedPriorityLevelConfigurationInformerWithOptions constructs a new informer for PriorityLevelConfiguration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) PriorityLevelConfigurationIndexInformer { gvr := schema.GroupVersionResource{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta1", Resource: "prioritylevelconfigurations"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta1.PriorityLevelConfiguration](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interfac Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *priorityLevelConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *priorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiflowcontrolv1beta1.PriorityLevelConfiguration{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *priorityLevelConfigurationInformer) TypedInformer() PriorityLevelConfigurationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta1.PriorityLevelConfiguration](f.factory.InformerFor(&apiflowcontrolv1beta1.PriorityLevelConfiguration{}, f.defaultInformer)) } func (f *priorityLevelConfigurationInformer) Lister() flowcontrolv1beta1.PriorityLevelConfigurationLister { return flowcontrolv1beta1.NewPriorityLevelConfigurationLister(f.Informer().GetIndexer()) } + +// ToTypedPriorityLevelConfigurationInformer converts an untyped informer into a TypedPriorityLevelConfigurationInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PriorityLevelConfiguration. If that is not the case, calling type-safe methods of the returned +// TypedPriorityLevelConfigurationInformer leads to runtime panics. A safer alternative is to pass +// around a TypedPriorityLevelConfigurationInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedPriorityLevelConfigurationInformer(informer PriorityLevelConfigurationInformer) TypedPriorityLevelConfigurationInformer { + if informer, ok := informer.(TypedPriorityLevelConfigurationInformer); ok { + return informer + } + return &priorityLevelConfigurationTypedInformerAdapter{informer} +} + +type priorityLevelConfigurationTypedInformerAdapter struct { + PriorityLevelConfigurationInformer +} + +func (a *priorityLevelConfigurationTypedInformerAdapter) TypedInformer() PriorityLevelConfigurationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta1.PriorityLevelConfiguration](a.Informer()) +} + +// ToPriorityLevelConfigurationIndexInformer converts an untyped informer into a PriorityLevelConfigurationIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PriorityLevelConfiguration. If that is not the case, calling type-safe methods of the returned +// PriorityLevelConfigurationIndexInformer leads to runtime panics. A safer alternative is to pass +// around a PriorityLevelConfigurationIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToPriorityLevelConfigurationIndexInformer(informer cache.SharedIndexInformer) PriorityLevelConfigurationIndexInformer { + if informer, ok := informer.(PriorityLevelConfigurationIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta1.PriorityLevelConfiguration](informer) +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/flowschema.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/flowschema.go index aba4d712af..39cb1fbdfb 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/flowschema.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/flowschema.go @@ -34,12 +34,40 @@ import ( ) // FlowSchemaInformer provides access to a shared informer and lister for -// FlowSchemas. +// FlowSchemas. Prefer using the type-safe variant (see [TypedFlowSchemaInformer]). type FlowSchemaInformer interface { Informer() cache.SharedIndexInformer Lister() flowcontrolv1beta2.FlowSchemaLister } +// TypedFlowSchemaInformer provides access to a shared informer and lister for +// FlowSchemas, including the type-safe TypedInformer variant. +// It is a superset of FlowSchemaInformer. +type TypedFlowSchemaInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() FlowSchemaIndexInformer + Lister() flowcontrolv1beta2.FlowSchemaLister +} + +// FlowSchemaIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type FlowSchemaIndexInformer cache.TypedSharedIndexInformer[*apiflowcontrolv1beta2.FlowSchema] + +// FlowSchemaHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for FlowSchema. +type FlowSchemaHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiflowcontrolv1beta2.FlowSchema] + +// FlowSchemaDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for FlowSchema. +type FlowSchemaDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiflowcontrolv1beta2.FlowSchema] + +// FlowSchemaFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for FlowSchema. +type FlowSchemaFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiflowcontrolv1beta2.FlowSchema] + +// FlowSchemaIndexers is a specialization of [cache.TypedIndexers] for FlowSchema. +type FlowSchemaIndexers = cache.TypedIndexers[*apiflowcontrolv1beta2.FlowSchema] + +// DeletedFlowSchema is a specialization of [cache.DeletedObject] for FlowSchema. +type DeletedFlowSchema = cache.DeletedObject[*apiflowcontrolv1beta2.FlowSchema] + type flowSchemaInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type flowSchemaInformer struct { // NewFlowSchemaInformer constructs a new informer for FlowSchema type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFlowSchemaInformer]). func NewFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers FlowSchemaIndexers) FlowSchemaIndexInformer { + return NewTypedFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredFlowSchemaInformer]). func NewFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers FlowSchemaIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) FlowSchemaIndexInformer { + return NewTypedFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewFlowSchemaInformerWithOptions constructs a new informer for FlowSchema type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFlowSchemaInformerWithOptions]). func NewFlowSchemaInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedFlowSchemaInformerWithOptions(client, options) +} + +// NewTypedFlowSchemaInformerWithOptions constructs a new informer for FlowSchema type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFlowSchemaInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) FlowSchemaIndexInformer { gvr := schema.GroupVersionResource{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta2", Resource: "flowschemas"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta2.FlowSchema](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewFlowSchemaInformerWithOptions(client kubernetes.Interface, options inter Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *flowSchemaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *flowSchemaInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiflowcontrolv1beta2.FlowSchema{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *flowSchemaInformer) TypedInformer() FlowSchemaIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta2.FlowSchema](f.factory.InformerFor(&apiflowcontrolv1beta2.FlowSchema{}, f.defaultInformer)) } func (f *flowSchemaInformer) Lister() flowcontrolv1beta2.FlowSchemaLister { return flowcontrolv1beta2.NewFlowSchemaLister(f.Informer().GetIndexer()) } + +// ToTypedFlowSchemaInformer converts an untyped informer into a TypedFlowSchemaInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *FlowSchema. If that is not the case, calling type-safe methods of the returned +// TypedFlowSchemaInformer leads to runtime panics. A safer alternative is to pass +// around a TypedFlowSchemaInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedFlowSchemaInformer(informer FlowSchemaInformer) TypedFlowSchemaInformer { + if informer, ok := informer.(TypedFlowSchemaInformer); ok { + return informer + } + return &flowSchemaTypedInformerAdapter{informer} +} + +type flowSchemaTypedInformerAdapter struct { + FlowSchemaInformer +} + +func (a *flowSchemaTypedInformerAdapter) TypedInformer() FlowSchemaIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta2.FlowSchema](a.Informer()) +} + +// ToFlowSchemaIndexInformer converts an untyped informer into a FlowSchemaIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *FlowSchema. If that is not the case, calling type-safe methods of the returned +// FlowSchemaIndexInformer leads to runtime panics. A safer alternative is to pass +// around a FlowSchemaIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToFlowSchemaIndexInformer(informer cache.SharedIndexInformer) FlowSchemaIndexInformer { + if informer, ok := informer.(FlowSchemaIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta2.FlowSchema](informer) +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/interface.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/interface.go index 142d552896..f362f533ba 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/interface.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/interface.go @@ -25,9 +25,9 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // FlowSchemas returns a FlowSchemaInformer. - FlowSchemas() FlowSchemaInformer + FlowSchemas() TypedFlowSchemaInformer // PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. - PriorityLevelConfigurations() PriorityLevelConfigurationInformer + PriorityLevelConfigurations() TypedPriorityLevelConfigurationInformer } type version struct { @@ -41,12 +41,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// FlowSchemas returns a FlowSchemaInformer. -func (v *version) FlowSchemas() FlowSchemaInformer { +// FlowSchemas returns a TypedFlowSchemaInformer. +func (v *version) FlowSchemas() TypedFlowSchemaInformer { return &flowSchemaInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. -func (v *version) PriorityLevelConfigurations() PriorityLevelConfigurationInformer { +// PriorityLevelConfigurations returns a TypedPriorityLevelConfigurationInformer. +func (v *version) PriorityLevelConfigurations() TypedPriorityLevelConfigurationInformer { return &priorityLevelConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/prioritylevelconfiguration.go index 0ce811759a..9915275498 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/prioritylevelconfiguration.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/prioritylevelconfiguration.go @@ -34,12 +34,40 @@ import ( ) // PriorityLevelConfigurationInformer provides access to a shared informer and lister for -// PriorityLevelConfigurations. +// PriorityLevelConfigurations. Prefer using the type-safe variant (see [TypedPriorityLevelConfigurationInformer]). type PriorityLevelConfigurationInformer interface { Informer() cache.SharedIndexInformer Lister() flowcontrolv1beta2.PriorityLevelConfigurationLister } +// TypedPriorityLevelConfigurationInformer provides access to a shared informer and lister for +// PriorityLevelConfigurations, including the type-safe TypedInformer variant. +// It is a superset of PriorityLevelConfigurationInformer. +type TypedPriorityLevelConfigurationInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() PriorityLevelConfigurationIndexInformer + Lister() flowcontrolv1beta2.PriorityLevelConfigurationLister +} + +// PriorityLevelConfigurationIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type PriorityLevelConfigurationIndexInformer cache.TypedSharedIndexInformer[*apiflowcontrolv1beta2.PriorityLevelConfiguration] + +// PriorityLevelConfigurationHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for PriorityLevelConfiguration. +type PriorityLevelConfigurationHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiflowcontrolv1beta2.PriorityLevelConfiguration] + +// PriorityLevelConfigurationDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for PriorityLevelConfiguration. +type PriorityLevelConfigurationDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiflowcontrolv1beta2.PriorityLevelConfiguration] + +// PriorityLevelConfigurationFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for PriorityLevelConfiguration. +type PriorityLevelConfigurationFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiflowcontrolv1beta2.PriorityLevelConfiguration] + +// PriorityLevelConfigurationIndexers is a specialization of [cache.TypedIndexers] for PriorityLevelConfiguration. +type PriorityLevelConfigurationIndexers = cache.TypedIndexers[*apiflowcontrolv1beta2.PriorityLevelConfiguration] + +// DeletedPriorityLevelConfiguration is a specialization of [cache.DeletedObject] for PriorityLevelConfiguration. +type DeletedPriorityLevelConfiguration = cache.DeletedObject[*apiflowcontrolv1beta2.PriorityLevelConfiguration] + type priorityLevelConfigurationInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type priorityLevelConfigurationInformer struct { // NewPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPriorityLevelConfigurationInformer]). func NewPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers PriorityLevelConfigurationIndexers) PriorityLevelConfigurationIndexInformer { + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredPriorityLevelConfigurationInformer]). func NewFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers PriorityLevelConfigurationIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) PriorityLevelConfigurationIndexInformer { + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewPriorityLevelConfigurationInformerWithOptions constructs a new informer for PriorityLevelConfiguration type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPriorityLevelConfigurationInformerWithOptions]). func NewPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, options) +} + +// NewTypedPriorityLevelConfigurationInformerWithOptions constructs a new informer for PriorityLevelConfiguration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) PriorityLevelConfigurationIndexInformer { gvr := schema.GroupVersionResource{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta2", Resource: "prioritylevelconfigurations"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta2.PriorityLevelConfiguration](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interfac Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *priorityLevelConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *priorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiflowcontrolv1beta2.PriorityLevelConfiguration{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *priorityLevelConfigurationInformer) TypedInformer() PriorityLevelConfigurationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta2.PriorityLevelConfiguration](f.factory.InformerFor(&apiflowcontrolv1beta2.PriorityLevelConfiguration{}, f.defaultInformer)) } func (f *priorityLevelConfigurationInformer) Lister() flowcontrolv1beta2.PriorityLevelConfigurationLister { return flowcontrolv1beta2.NewPriorityLevelConfigurationLister(f.Informer().GetIndexer()) } + +// ToTypedPriorityLevelConfigurationInformer converts an untyped informer into a TypedPriorityLevelConfigurationInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PriorityLevelConfiguration. If that is not the case, calling type-safe methods of the returned +// TypedPriorityLevelConfigurationInformer leads to runtime panics. A safer alternative is to pass +// around a TypedPriorityLevelConfigurationInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedPriorityLevelConfigurationInformer(informer PriorityLevelConfigurationInformer) TypedPriorityLevelConfigurationInformer { + if informer, ok := informer.(TypedPriorityLevelConfigurationInformer); ok { + return informer + } + return &priorityLevelConfigurationTypedInformerAdapter{informer} +} + +type priorityLevelConfigurationTypedInformerAdapter struct { + PriorityLevelConfigurationInformer +} + +func (a *priorityLevelConfigurationTypedInformerAdapter) TypedInformer() PriorityLevelConfigurationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta2.PriorityLevelConfiguration](a.Informer()) +} + +// ToPriorityLevelConfigurationIndexInformer converts an untyped informer into a PriorityLevelConfigurationIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PriorityLevelConfiguration. If that is not the case, calling type-safe methods of the returned +// PriorityLevelConfigurationIndexInformer leads to runtime panics. A safer alternative is to pass +// around a PriorityLevelConfigurationIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToPriorityLevelConfigurationIndexInformer(informer cache.SharedIndexInformer) PriorityLevelConfigurationIndexInformer { + if informer, ok := informer.(PriorityLevelConfigurationIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta2.PriorityLevelConfiguration](informer) +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/flowschema.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/flowschema.go index 16ce2ba23c..30bd5e341f 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/flowschema.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/flowschema.go @@ -34,12 +34,40 @@ import ( ) // FlowSchemaInformer provides access to a shared informer and lister for -// FlowSchemas. +// FlowSchemas. Prefer using the type-safe variant (see [TypedFlowSchemaInformer]). type FlowSchemaInformer interface { Informer() cache.SharedIndexInformer Lister() flowcontrolv1beta3.FlowSchemaLister } +// TypedFlowSchemaInformer provides access to a shared informer and lister for +// FlowSchemas, including the type-safe TypedInformer variant. +// It is a superset of FlowSchemaInformer. +type TypedFlowSchemaInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() FlowSchemaIndexInformer + Lister() flowcontrolv1beta3.FlowSchemaLister +} + +// FlowSchemaIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type FlowSchemaIndexInformer cache.TypedSharedIndexInformer[*apiflowcontrolv1beta3.FlowSchema] + +// FlowSchemaHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for FlowSchema. +type FlowSchemaHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiflowcontrolv1beta3.FlowSchema] + +// FlowSchemaDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for FlowSchema. +type FlowSchemaDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiflowcontrolv1beta3.FlowSchema] + +// FlowSchemaFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for FlowSchema. +type FlowSchemaFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiflowcontrolv1beta3.FlowSchema] + +// FlowSchemaIndexers is a specialization of [cache.TypedIndexers] for FlowSchema. +type FlowSchemaIndexers = cache.TypedIndexers[*apiflowcontrolv1beta3.FlowSchema] + +// DeletedFlowSchema is a specialization of [cache.DeletedObject] for FlowSchema. +type DeletedFlowSchema = cache.DeletedObject[*apiflowcontrolv1beta3.FlowSchema] + type flowSchemaInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type flowSchemaInformer struct { // NewFlowSchemaInformer constructs a new informer for FlowSchema type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFlowSchemaInformer]). func NewFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers FlowSchemaIndexers) FlowSchemaIndexInformer { + return NewTypedFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredFlowSchemaInformer]). func NewFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers FlowSchemaIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) FlowSchemaIndexInformer { + return NewTypedFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewFlowSchemaInformerWithOptions constructs a new informer for FlowSchema type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFlowSchemaInformerWithOptions]). func NewFlowSchemaInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedFlowSchemaInformerWithOptions(client, options) +} + +// NewTypedFlowSchemaInformerWithOptions constructs a new informer for FlowSchema type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFlowSchemaInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) FlowSchemaIndexInformer { gvr := schema.GroupVersionResource{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta3", Resource: "flowschemas"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta3.FlowSchema](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewFlowSchemaInformerWithOptions(client kubernetes.Interface, options inter Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *flowSchemaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *flowSchemaInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiflowcontrolv1beta3.FlowSchema{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *flowSchemaInformer) TypedInformer() FlowSchemaIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta3.FlowSchema](f.factory.InformerFor(&apiflowcontrolv1beta3.FlowSchema{}, f.defaultInformer)) } func (f *flowSchemaInformer) Lister() flowcontrolv1beta3.FlowSchemaLister { return flowcontrolv1beta3.NewFlowSchemaLister(f.Informer().GetIndexer()) } + +// ToTypedFlowSchemaInformer converts an untyped informer into a TypedFlowSchemaInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *FlowSchema. If that is not the case, calling type-safe methods of the returned +// TypedFlowSchemaInformer leads to runtime panics. A safer alternative is to pass +// around a TypedFlowSchemaInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedFlowSchemaInformer(informer FlowSchemaInformer) TypedFlowSchemaInformer { + if informer, ok := informer.(TypedFlowSchemaInformer); ok { + return informer + } + return &flowSchemaTypedInformerAdapter{informer} +} + +type flowSchemaTypedInformerAdapter struct { + FlowSchemaInformer +} + +func (a *flowSchemaTypedInformerAdapter) TypedInformer() FlowSchemaIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta3.FlowSchema](a.Informer()) +} + +// ToFlowSchemaIndexInformer converts an untyped informer into a FlowSchemaIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *FlowSchema. If that is not the case, calling type-safe methods of the returned +// FlowSchemaIndexInformer leads to runtime panics. A safer alternative is to pass +// around a FlowSchemaIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToFlowSchemaIndexInformer(informer cache.SharedIndexInformer) FlowSchemaIndexInformer { + if informer, ok := informer.(FlowSchemaIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta3.FlowSchema](informer) +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/interface.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/interface.go index 54c5414a2b..cff3a94cb2 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/interface.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/interface.go @@ -25,9 +25,9 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // FlowSchemas returns a FlowSchemaInformer. - FlowSchemas() FlowSchemaInformer + FlowSchemas() TypedFlowSchemaInformer // PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. - PriorityLevelConfigurations() PriorityLevelConfigurationInformer + PriorityLevelConfigurations() TypedPriorityLevelConfigurationInformer } type version struct { @@ -41,12 +41,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// FlowSchemas returns a FlowSchemaInformer. -func (v *version) FlowSchemas() FlowSchemaInformer { +// FlowSchemas returns a TypedFlowSchemaInformer. +func (v *version) FlowSchemas() TypedFlowSchemaInformer { return &flowSchemaInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. -func (v *version) PriorityLevelConfigurations() PriorityLevelConfigurationInformer { +// PriorityLevelConfigurations returns a TypedPriorityLevelConfigurationInformer. +func (v *version) PriorityLevelConfigurations() TypedPriorityLevelConfigurationInformer { return &priorityLevelConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/prioritylevelconfiguration.go index ab63c8e62b..0402662b81 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/prioritylevelconfiguration.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/prioritylevelconfiguration.go @@ -34,12 +34,40 @@ import ( ) // PriorityLevelConfigurationInformer provides access to a shared informer and lister for -// PriorityLevelConfigurations. +// PriorityLevelConfigurations. Prefer using the type-safe variant (see [TypedPriorityLevelConfigurationInformer]). type PriorityLevelConfigurationInformer interface { Informer() cache.SharedIndexInformer Lister() flowcontrolv1beta3.PriorityLevelConfigurationLister } +// TypedPriorityLevelConfigurationInformer provides access to a shared informer and lister for +// PriorityLevelConfigurations, including the type-safe TypedInformer variant. +// It is a superset of PriorityLevelConfigurationInformer. +type TypedPriorityLevelConfigurationInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() PriorityLevelConfigurationIndexInformer + Lister() flowcontrolv1beta3.PriorityLevelConfigurationLister +} + +// PriorityLevelConfigurationIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type PriorityLevelConfigurationIndexInformer cache.TypedSharedIndexInformer[*apiflowcontrolv1beta3.PriorityLevelConfiguration] + +// PriorityLevelConfigurationHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for PriorityLevelConfiguration. +type PriorityLevelConfigurationHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiflowcontrolv1beta3.PriorityLevelConfiguration] + +// PriorityLevelConfigurationDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for PriorityLevelConfiguration. +type PriorityLevelConfigurationDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiflowcontrolv1beta3.PriorityLevelConfiguration] + +// PriorityLevelConfigurationFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for PriorityLevelConfiguration. +type PriorityLevelConfigurationFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiflowcontrolv1beta3.PriorityLevelConfiguration] + +// PriorityLevelConfigurationIndexers is a specialization of [cache.TypedIndexers] for PriorityLevelConfiguration. +type PriorityLevelConfigurationIndexers = cache.TypedIndexers[*apiflowcontrolv1beta3.PriorityLevelConfiguration] + +// DeletedPriorityLevelConfiguration is a specialization of [cache.DeletedObject] for PriorityLevelConfiguration. +type DeletedPriorityLevelConfiguration = cache.DeletedObject[*apiflowcontrolv1beta3.PriorityLevelConfiguration] + type priorityLevelConfigurationInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type priorityLevelConfigurationInformer struct { // NewPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPriorityLevelConfigurationInformer]). func NewPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers PriorityLevelConfigurationIndexers) PriorityLevelConfigurationIndexInformer { + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredPriorityLevelConfigurationInformer]). func NewFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers PriorityLevelConfigurationIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) PriorityLevelConfigurationIndexInformer { + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewPriorityLevelConfigurationInformerWithOptions constructs a new informer for PriorityLevelConfiguration type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPriorityLevelConfigurationInformerWithOptions]). func NewPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, options) +} + +// NewTypedPriorityLevelConfigurationInformerWithOptions constructs a new informer for PriorityLevelConfiguration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) PriorityLevelConfigurationIndexInformer { gvr := schema.GroupVersionResource{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta3", Resource: "prioritylevelconfigurations"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta3.PriorityLevelConfiguration](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interfac Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *priorityLevelConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *priorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiflowcontrolv1beta3.PriorityLevelConfiguration{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *priorityLevelConfigurationInformer) TypedInformer() PriorityLevelConfigurationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta3.PriorityLevelConfiguration](f.factory.InformerFor(&apiflowcontrolv1beta3.PriorityLevelConfiguration{}, f.defaultInformer)) } func (f *priorityLevelConfigurationInformer) Lister() flowcontrolv1beta3.PriorityLevelConfigurationLister { return flowcontrolv1beta3.NewPriorityLevelConfigurationLister(f.Informer().GetIndexer()) } + +// ToTypedPriorityLevelConfigurationInformer converts an untyped informer into a TypedPriorityLevelConfigurationInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PriorityLevelConfiguration. If that is not the case, calling type-safe methods of the returned +// TypedPriorityLevelConfigurationInformer leads to runtime panics. A safer alternative is to pass +// around a TypedPriorityLevelConfigurationInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedPriorityLevelConfigurationInformer(informer PriorityLevelConfigurationInformer) TypedPriorityLevelConfigurationInformer { + if informer, ok := informer.(TypedPriorityLevelConfigurationInformer); ok { + return informer + } + return &priorityLevelConfigurationTypedInformerAdapter{informer} +} + +type priorityLevelConfigurationTypedInformerAdapter struct { + PriorityLevelConfigurationInformer +} + +func (a *priorityLevelConfigurationTypedInformerAdapter) TypedInformer() PriorityLevelConfigurationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta3.PriorityLevelConfiguration](a.Informer()) +} + +// ToPriorityLevelConfigurationIndexInformer converts an untyped informer into a PriorityLevelConfigurationIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PriorityLevelConfiguration. If that is not the case, calling type-safe methods of the returned +// PriorityLevelConfigurationIndexInformer leads to runtime panics. A safer alternative is to pass +// around a PriorityLevelConfigurationIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToPriorityLevelConfigurationIndexInformer(informer cache.SharedIndexInformer) PriorityLevelConfigurationIndexInformer { + if informer, ok := informer.(PriorityLevelConfigurationIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiflowcontrolv1beta3.PriorityLevelConfiguration](informer) +} diff --git a/vendor/k8s.io/client-go/informers/generic.go b/vendor/k8s.io/client-go/informers/generic.go index 03c45c71cf..ab966b9490 100644 --- a/vendor/k8s.io/client-go/informers/generic.go +++ b/vendor/k8s.io/client-go/informers/generic.go @@ -48,6 +48,7 @@ import ( flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" v1beta3 "k8s.io/api/flowcontrol/v1beta3" + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" networkingv1 "k8s.io/api/networking/v1" networkingv1beta1 "k8s.io/api/networking/v1beta1" nodev1 "k8s.io/api/node/v1" @@ -63,11 +64,12 @@ import ( resourcev1beta1 "k8s.io/api/resource/v1beta1" resourcev1beta2 "k8s.io/api/resource/v1beta2" schedulingv1 "k8s.io/api/scheduling/v1" - schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" storagev1 "k8s.io/api/storage/v1" storagev1alpha1 "k8s.io/api/storage/v1alpha1" storagev1beta1 "k8s.io/api/storage/v1beta1" + storagemigrationv1 "k8s.io/api/storagemigration/v1" storagemigrationv1beta1 "k8s.io/api/storagemigration/v1beta1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" @@ -190,6 +192,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // Group=certificates.k8s.io, Version=v1 case certificatesv1.SchemeGroupVersion.WithResource("certificatesigningrequests"): return &genericInformer{resource: resource.GroupResource(), informer: f.Certificates().V1().CertificateSigningRequests().Informer()}, nil + case certificatesv1.SchemeGroupVersion.WithResource("clustertrustbundles"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Certificates().V1().ClusterTrustBundles().Informer()}, nil + case certificatesv1.SchemeGroupVersion.WithResource("podcertificaterequests"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Certificates().V1().PodCertificateRequests().Informer()}, nil // Group=certificates.k8s.io, Version=v1alpha1 case certificatesv1alpha1.SchemeGroupVersion.WithResource("clustertrustbundles"): @@ -307,6 +313,12 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case apiserverinternalv1alpha1.SchemeGroupVersion.WithResource("storageversions"): return &genericInformer{resource: resource.GroupResource(), informer: f.Internal().V1alpha1().StorageVersions().Informer()}, nil + // Group=lifecycle.k8s.io, Version=v1alpha1 + case lifecyclev1alpha1.SchemeGroupVersion.WithResource("evictions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Lifecycle().V1alpha1().Evictions().Informer()}, nil + case lifecyclev1alpha1.SchemeGroupVersion.WithResource("evictionrequests"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Lifecycle().V1alpha1().EvictionRequests().Informer()}, nil + // Group=networking.k8s.io, Version=v1 case networkingv1.SchemeGroupVersion.WithResource("ipaddresses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().IPAddresses().Informer()}, nil @@ -382,6 +394,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // Group=resource.k8s.io, Version=v1 case resourcev1.SchemeGroupVersion.WithResource("deviceclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1().DeviceClasses().Informer()}, nil + case resourcev1.SchemeGroupVersion.WithResource("devicetaintrules"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1().DeviceTaintRules().Informer()}, nil case resourcev1.SchemeGroupVersion.WithResource("resourceclaims"): return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1().ResourceClaims().Informer()}, nil case resourcev1.SchemeGroupVersion.WithResource("resourceclaimtemplates"): @@ -421,15 +435,21 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case schedulingv1.SchemeGroupVersion.WithResource("priorityclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1().PriorityClasses().Informer()}, nil - // Group=scheduling.k8s.io, Version=v1alpha2 - case schedulingv1alpha2.SchemeGroupVersion.WithResource("podgroups"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha2().PodGroups().Informer()}, nil - case schedulingv1alpha2.SchemeGroupVersion.WithResource("workloads"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha2().Workloads().Informer()}, nil + // Group=scheduling.k8s.io, Version=v1alpha3 + case schedulingv1alpha3.SchemeGroupVersion.WithResource("compositepodgroups"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha3().CompositePodGroups().Informer()}, nil + case schedulingv1alpha3.SchemeGroupVersion.WithResource("podgroups"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha3().PodGroups().Informer()}, nil + case schedulingv1alpha3.SchemeGroupVersion.WithResource("workloads"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha3().Workloads().Informer()}, nil // Group=scheduling.k8s.io, Version=v1beta1 + case schedulingv1beta1.SchemeGroupVersion.WithResource("podgroups"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1beta1().PodGroups().Informer()}, nil case schedulingv1beta1.SchemeGroupVersion.WithResource("priorityclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1beta1().PriorityClasses().Informer()}, nil + case schedulingv1beta1.SchemeGroupVersion.WithResource("workloads"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1beta1().Workloads().Informer()}, nil // Group=storage.k8s.io, Version=v1 case storagev1.SchemeGroupVersion.WithResource("csidrivers"): @@ -467,6 +487,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case storagev1beta1.SchemeGroupVersion.WithResource("volumeattributesclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().VolumeAttributesClasses().Informer()}, nil + // Group=storagemigration.k8s.io, Version=v1 + case storagemigrationv1.SchemeGroupVersion.WithResource("storageversionmigrations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storagemigration().V1().StorageVersionMigrations().Informer()}, nil + // Group=storagemigration.k8s.io, Version=v1beta1 case storagemigrationv1beta1.SchemeGroupVersion.WithResource("storageversionmigrations"): return &genericInformer{resource: resource.GroupResource(), informer: f.Storagemigration().V1beta1().StorageVersionMigrations().Informer()}, nil diff --git a/vendor/k8s.io/client-go/informers/lifecycle/interface.go b/vendor/k8s.io/client-go/informers/lifecycle/interface.go new file mode 100644 index 0000000000..c9b3e3476f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/lifecycle/interface.go @@ -0,0 +1,46 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package lifecycle + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1alpha1 "k8s.io/client-go/informers/lifecycle/v1alpha1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/lifecycle/v1alpha1/eviction.go b/vendor/k8s.io/client-go/informers/lifecycle/v1alpha1/eviction.go new file mode 100644 index 0000000000..bf408957fa --- /dev/null +++ b/vendor/k8s.io/client-go/informers/lifecycle/v1alpha1/eviction.go @@ -0,0 +1,208 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + time "time" + + apilifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + lifecyclev1alpha1 "k8s.io/client-go/listers/lifecycle/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// EvictionInformer provides access to a shared informer and lister for +// Evictions. Prefer using the type-safe variant (see [TypedEvictionInformer]). +type EvictionInformer interface { + Informer() cache.SharedIndexInformer + Lister() lifecyclev1alpha1.EvictionLister +} + +// TypedEvictionInformer provides access to a shared informer and lister for +// Evictions, including the type-safe TypedInformer variant. +// It is a superset of EvictionInformer. +type TypedEvictionInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() EvictionIndexInformer + Lister() lifecyclev1alpha1.EvictionLister +} + +// EvictionIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type EvictionIndexInformer cache.TypedSharedIndexInformer[*apilifecyclev1alpha1.Eviction] + +// EvictionHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Eviction. +type EvictionHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apilifecyclev1alpha1.Eviction] + +// EvictionDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Eviction. +type EvictionDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apilifecyclev1alpha1.Eviction] + +// EvictionFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Eviction. +type EvictionFilteringHandler = cache.TypedFilteringResourceEventHandler[*apilifecyclev1alpha1.Eviction] + +// EvictionIndexers is a specialization of [cache.TypedIndexers] for Eviction. +type EvictionIndexers = cache.TypedIndexers[*apilifecyclev1alpha1.Eviction] + +// DeletedEviction is a specialization of [cache.DeletedObject] for Eviction. +type DeletedEviction = cache.DeletedObject[*apilifecyclev1alpha1.Eviction] + +type evictionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEvictionInformer constructs a new informer for Eviction type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedEvictionInformer]). +func NewEvictionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewEvictionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewTypedEvictionInformer constructs a new informer for Eviction type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedEvictionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers EvictionIndexers) EvictionIndexInformer { + return NewTypedEvictionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + +// NewFilteredEvictionInformer constructs a new informer for Eviction type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredEvictionInformer]). +func NewFilteredEvictionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewTypedEvictionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredEvictionInformer constructs a new informer for Eviction type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredEvictionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers EvictionIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) EvictionIndexInformer { + return NewTypedEvictionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) +} + +// NewEvictionInformerWithOptions constructs a new informer for Eviction type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedEvictionInformerWithOptions]). +func NewEvictionInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedEvictionInformerWithOptions(client, namespace, options) +} + +// NewTypedEvictionInformerWithOptions constructs a new informer for Eviction type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedEvictionInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) EvictionIndexInformer { + gvr := schema.GroupVersionResource{Group: "lifecycle.k8s.io", Version: "v1alpha1", Resource: "evictions"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewTypedSharedIndexInformer[*apilifecyclev1alpha1.Eviction](cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.LifecycleV1alpha1().Evictions(namespace).List(context.Background(), opts) + }, + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.LifecycleV1alpha1().Evictions(namespace).Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.LifecycleV1alpha1().Evictions(namespace).List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.LifecycleV1alpha1().Evictions(namespace).Watch(ctx, opts) + }, + }, client), + &apilifecyclev1alpha1.Eviction{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + )) +} + +func (f *evictionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewTypedEvictionInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *evictionInformer) Informer() cache.SharedIndexInformer { + return f.TypedInformer() +} + +func (f *evictionInformer) TypedInformer() EvictionIndexInformer { + return cache.NewTypedSharedIndexInformer[*apilifecyclev1alpha1.Eviction](f.factory.InformerFor(&apilifecyclev1alpha1.Eviction{}, f.defaultInformer)) +} + +func (f *evictionInformer) Lister() lifecyclev1alpha1.EvictionLister { + return lifecyclev1alpha1.NewEvictionLister(f.Informer().GetIndexer()) +} + +// ToTypedEvictionInformer converts an untyped informer into a TypedEvictionInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Eviction. If that is not the case, calling type-safe methods of the returned +// TypedEvictionInformer leads to runtime panics. A safer alternative is to pass +// around a TypedEvictionInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedEvictionInformer(informer EvictionInformer) TypedEvictionInformer { + if informer, ok := informer.(TypedEvictionInformer); ok { + return informer + } + return &evictionTypedInformerAdapter{informer} +} + +type evictionTypedInformerAdapter struct { + EvictionInformer +} + +func (a *evictionTypedInformerAdapter) TypedInformer() EvictionIndexInformer { + return cache.NewTypedSharedIndexInformer[*apilifecyclev1alpha1.Eviction](a.Informer()) +} + +// ToEvictionIndexInformer converts an untyped informer into a EvictionIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Eviction. If that is not the case, calling type-safe methods of the returned +// EvictionIndexInformer leads to runtime panics. A safer alternative is to pass +// around a EvictionIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToEvictionIndexInformer(informer cache.SharedIndexInformer) EvictionIndexInformer { + if informer, ok := informer.(EvictionIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apilifecyclev1alpha1.Eviction](informer) +} diff --git a/vendor/k8s.io/client-go/informers/lifecycle/v1alpha1/evictionrequest.go b/vendor/k8s.io/client-go/informers/lifecycle/v1alpha1/evictionrequest.go new file mode 100644 index 0000000000..2e76157404 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/lifecycle/v1alpha1/evictionrequest.go @@ -0,0 +1,208 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + time "time" + + apilifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + lifecyclev1alpha1 "k8s.io/client-go/listers/lifecycle/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// EvictionRequestInformer provides access to a shared informer and lister for +// EvictionRequests. Prefer using the type-safe variant (see [TypedEvictionRequestInformer]). +type EvictionRequestInformer interface { + Informer() cache.SharedIndexInformer + Lister() lifecyclev1alpha1.EvictionRequestLister +} + +// TypedEvictionRequestInformer provides access to a shared informer and lister for +// EvictionRequests, including the type-safe TypedInformer variant. +// It is a superset of EvictionRequestInformer. +type TypedEvictionRequestInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() EvictionRequestIndexInformer + Lister() lifecyclev1alpha1.EvictionRequestLister +} + +// EvictionRequestIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type EvictionRequestIndexInformer cache.TypedSharedIndexInformer[*apilifecyclev1alpha1.EvictionRequest] + +// EvictionRequestHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for EvictionRequest. +type EvictionRequestHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apilifecyclev1alpha1.EvictionRequest] + +// EvictionRequestDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for EvictionRequest. +type EvictionRequestDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apilifecyclev1alpha1.EvictionRequest] + +// EvictionRequestFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for EvictionRequest. +type EvictionRequestFilteringHandler = cache.TypedFilteringResourceEventHandler[*apilifecyclev1alpha1.EvictionRequest] + +// EvictionRequestIndexers is a specialization of [cache.TypedIndexers] for EvictionRequest. +type EvictionRequestIndexers = cache.TypedIndexers[*apilifecyclev1alpha1.EvictionRequest] + +// DeletedEvictionRequest is a specialization of [cache.DeletedObject] for EvictionRequest. +type DeletedEvictionRequest = cache.DeletedObject[*apilifecyclev1alpha1.EvictionRequest] + +type evictionRequestInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEvictionRequestInformer constructs a new informer for EvictionRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedEvictionRequestInformer]). +func NewEvictionRequestInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewEvictionRequestInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewTypedEvictionRequestInformer constructs a new informer for EvictionRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedEvictionRequestInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers EvictionRequestIndexers) EvictionRequestIndexInformer { + return NewTypedEvictionRequestInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + +// NewFilteredEvictionRequestInformer constructs a new informer for EvictionRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredEvictionRequestInformer]). +func NewFilteredEvictionRequestInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewTypedEvictionRequestInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredEvictionRequestInformer constructs a new informer for EvictionRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredEvictionRequestInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers EvictionRequestIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) EvictionRequestIndexInformer { + return NewTypedEvictionRequestInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) +} + +// NewEvictionRequestInformerWithOptions constructs a new informer for EvictionRequest type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedEvictionRequestInformerWithOptions]). +func NewEvictionRequestInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedEvictionRequestInformerWithOptions(client, namespace, options) +} + +// NewTypedEvictionRequestInformerWithOptions constructs a new informer for EvictionRequest type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedEvictionRequestInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) EvictionRequestIndexInformer { + gvr := schema.GroupVersionResource{Group: "lifecycle.k8s.io", Version: "v1alpha1", Resource: "evictionrequests"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewTypedSharedIndexInformer[*apilifecyclev1alpha1.EvictionRequest](cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.LifecycleV1alpha1().EvictionRequests(namespace).List(context.Background(), opts) + }, + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.LifecycleV1alpha1().EvictionRequests(namespace).Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.LifecycleV1alpha1().EvictionRequests(namespace).List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.LifecycleV1alpha1().EvictionRequests(namespace).Watch(ctx, opts) + }, + }, client), + &apilifecyclev1alpha1.EvictionRequest{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + )) +} + +func (f *evictionRequestInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewTypedEvictionRequestInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *evictionRequestInformer) Informer() cache.SharedIndexInformer { + return f.TypedInformer() +} + +func (f *evictionRequestInformer) TypedInformer() EvictionRequestIndexInformer { + return cache.NewTypedSharedIndexInformer[*apilifecyclev1alpha1.EvictionRequest](f.factory.InformerFor(&apilifecyclev1alpha1.EvictionRequest{}, f.defaultInformer)) +} + +func (f *evictionRequestInformer) Lister() lifecyclev1alpha1.EvictionRequestLister { + return lifecyclev1alpha1.NewEvictionRequestLister(f.Informer().GetIndexer()) +} + +// ToTypedEvictionRequestInformer converts an untyped informer into a TypedEvictionRequestInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *EvictionRequest. If that is not the case, calling type-safe methods of the returned +// TypedEvictionRequestInformer leads to runtime panics. A safer alternative is to pass +// around a TypedEvictionRequestInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedEvictionRequestInformer(informer EvictionRequestInformer) TypedEvictionRequestInformer { + if informer, ok := informer.(TypedEvictionRequestInformer); ok { + return informer + } + return &evictionRequestTypedInformerAdapter{informer} +} + +type evictionRequestTypedInformerAdapter struct { + EvictionRequestInformer +} + +func (a *evictionRequestTypedInformerAdapter) TypedInformer() EvictionRequestIndexInformer { + return cache.NewTypedSharedIndexInformer[*apilifecyclev1alpha1.EvictionRequest](a.Informer()) +} + +// ToEvictionRequestIndexInformer converts an untyped informer into a EvictionRequestIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *EvictionRequest. If that is not the case, calling type-safe methods of the returned +// EvictionRequestIndexInformer leads to runtime panics. A safer alternative is to pass +// around a EvictionRequestIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToEvictionRequestIndexInformer(informer cache.SharedIndexInformer) EvictionRequestIndexInformer { + if informer, ok := informer.(EvictionRequestIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apilifecyclev1alpha1.EvictionRequest](informer) +} diff --git a/vendor/k8s.io/client-go/informers/lifecycle/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/lifecycle/v1alpha1/interface.go new file mode 100644 index 0000000000..81141bb1c1 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/lifecycle/v1alpha1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Evictions returns a EvictionInformer. + Evictions() TypedEvictionInformer + // EvictionRequests returns a EvictionRequestInformer. + EvictionRequests() TypedEvictionRequestInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Evictions returns a TypedEvictionInformer. +func (v *version) Evictions() TypedEvictionInformer { + return &evictionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// EvictionRequests returns a TypedEvictionRequestInformer. +func (v *version) EvictionRequests() TypedEvictionRequestInformer { + return &evictionRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1/ingress.go b/vendor/k8s.io/client-go/informers/networking/v1/ingress.go index 65be7320d1..9ec5a53dc4 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1/ingress.go +++ b/vendor/k8s.io/client-go/informers/networking/v1/ingress.go @@ -34,12 +34,40 @@ import ( ) // IngressInformer provides access to a shared informer and lister for -// Ingresses. +// Ingresses. Prefer using the type-safe variant (see [TypedIngressInformer]). type IngressInformer interface { Informer() cache.SharedIndexInformer Lister() networkingv1.IngressLister } +// TypedIngressInformer provides access to a shared informer and lister for +// Ingresses, including the type-safe TypedInformer variant. +// It is a superset of IngressInformer. +type TypedIngressInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() IngressIndexInformer + Lister() networkingv1.IngressLister +} + +// IngressIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type IngressIndexInformer cache.TypedSharedIndexInformer[*apinetworkingv1.Ingress] + +// IngressHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Ingress. +type IngressHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apinetworkingv1.Ingress] + +// IngressDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Ingress. +type IngressDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apinetworkingv1.Ingress] + +// IngressFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Ingress. +type IngressFilteringHandler = cache.TypedFilteringResourceEventHandler[*apinetworkingv1.Ingress] + +// IngressIndexers is a specialization of [cache.TypedIndexers] for Ingress. +type IngressIndexers = cache.TypedIndexers[*apinetworkingv1.Ingress] + +// DeletedIngress is a specialization of [cache.DeletedObject] for Ingress. +type DeletedIngress = cache.DeletedObject[*apinetworkingv1.Ingress] + type ingressInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type ingressInformer struct { // NewIngressInformer constructs a new informer for Ingress type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedIngressInformer]). func NewIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers IngressIndexers) IngressIndexInformer { + return NewTypedIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredIngressInformer constructs a new informer for Ingress type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredIngressInformer]). func NewFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers IngressIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) IngressIndexInformer { + return NewTypedIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewIngressInformerWithOptions constructs a new informer for Ingress type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedIngressInformerWithOptions]). func NewIngressInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedIngressInformerWithOptions(client, namespace, options) +} + +// NewTypedIngressInformerWithOptions constructs a new informer for Ingress type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedIngressInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) IngressIndexInformer { gvr := schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1", Resource: "ingresss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.Ingress](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewIngressInformerWithOptions(client kubernetes.Interface, namespace string Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *ingressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewIngressInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedIngressInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *ingressInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apinetworkingv1.Ingress{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *ingressInformer) TypedInformer() IngressIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.Ingress](f.factory.InformerFor(&apinetworkingv1.Ingress{}, f.defaultInformer)) } func (f *ingressInformer) Lister() networkingv1.IngressLister { return networkingv1.NewIngressLister(f.Informer().GetIndexer()) } + +// ToTypedIngressInformer converts an untyped informer into a TypedIngressInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Ingress. If that is not the case, calling type-safe methods of the returned +// TypedIngressInformer leads to runtime panics. A safer alternative is to pass +// around a TypedIngressInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedIngressInformer(informer IngressInformer) TypedIngressInformer { + if informer, ok := informer.(TypedIngressInformer); ok { + return informer + } + return &ingressTypedInformerAdapter{informer} +} + +type ingressTypedInformerAdapter struct { + IngressInformer +} + +func (a *ingressTypedInformerAdapter) TypedInformer() IngressIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.Ingress](a.Informer()) +} + +// ToIngressIndexInformer converts an untyped informer into a IngressIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Ingress. If that is not the case, calling type-safe methods of the returned +// IngressIndexInformer leads to runtime panics. A safer alternative is to pass +// around a IngressIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToIngressIndexInformer(informer cache.SharedIndexInformer) IngressIndexInformer { + if informer, ok := informer.(IngressIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.Ingress](informer) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1/ingressclass.go b/vendor/k8s.io/client-go/informers/networking/v1/ingressclass.go index bcb118f991..9174877fe4 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1/ingressclass.go +++ b/vendor/k8s.io/client-go/informers/networking/v1/ingressclass.go @@ -34,12 +34,40 @@ import ( ) // IngressClassInformer provides access to a shared informer and lister for -// IngressClasses. +// IngressClasses. Prefer using the type-safe variant (see [TypedIngressClassInformer]). type IngressClassInformer interface { Informer() cache.SharedIndexInformer Lister() networkingv1.IngressClassLister } +// TypedIngressClassInformer provides access to a shared informer and lister for +// IngressClasses, including the type-safe TypedInformer variant. +// It is a superset of IngressClassInformer. +type TypedIngressClassInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() IngressClassIndexInformer + Lister() networkingv1.IngressClassLister +} + +// IngressClassIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type IngressClassIndexInformer cache.TypedSharedIndexInformer[*apinetworkingv1.IngressClass] + +// IngressClassHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for IngressClass. +type IngressClassHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apinetworkingv1.IngressClass] + +// IngressClassDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for IngressClass. +type IngressClassDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apinetworkingv1.IngressClass] + +// IngressClassFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for IngressClass. +type IngressClassFilteringHandler = cache.TypedFilteringResourceEventHandler[*apinetworkingv1.IngressClass] + +// IngressClassIndexers is a specialization of [cache.TypedIndexers] for IngressClass. +type IngressClassIndexers = cache.TypedIndexers[*apinetworkingv1.IngressClass] + +// DeletedIngressClass is a specialization of [cache.DeletedObject] for IngressClass. +type DeletedIngressClass = cache.DeletedObject[*apinetworkingv1.IngressClass] + type ingressClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type ingressClassInformer struct { // NewIngressClassInformer constructs a new informer for IngressClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedIngressClassInformer]). func NewIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedIngressClassInformer constructs a new informer for IngressClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers IngressClassIndexers) IngressClassIndexInformer { + return NewTypedIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredIngressClassInformer constructs a new informer for IngressClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredIngressClassInformer]). func NewFilteredIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredIngressClassInformer constructs a new informer for IngressClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers IngressClassIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) IngressClassIndexInformer { + return NewTypedIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewIngressClassInformerWithOptions constructs a new informer for IngressClass type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedIngressClassInformerWithOptions]). func NewIngressClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedIngressClassInformerWithOptions(client, options) +} + +// NewTypedIngressClassInformerWithOptions constructs a new informer for IngressClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedIngressClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) IngressClassIndexInformer { gvr := schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1", Resource: "ingressclasss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.IngressClass](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewIngressClassInformerWithOptions(client kubernetes.Interface, options int Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *ingressClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *ingressClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apinetworkingv1.IngressClass{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *ingressClassInformer) TypedInformer() IngressClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.IngressClass](f.factory.InformerFor(&apinetworkingv1.IngressClass{}, f.defaultInformer)) } func (f *ingressClassInformer) Lister() networkingv1.IngressClassLister { return networkingv1.NewIngressClassLister(f.Informer().GetIndexer()) } + +// ToTypedIngressClassInformer converts an untyped informer into a TypedIngressClassInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *IngressClass. If that is not the case, calling type-safe methods of the returned +// TypedIngressClassInformer leads to runtime panics. A safer alternative is to pass +// around a TypedIngressClassInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedIngressClassInformer(informer IngressClassInformer) TypedIngressClassInformer { + if informer, ok := informer.(TypedIngressClassInformer); ok { + return informer + } + return &ingressClassTypedInformerAdapter{informer} +} + +type ingressClassTypedInformerAdapter struct { + IngressClassInformer +} + +func (a *ingressClassTypedInformerAdapter) TypedInformer() IngressClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.IngressClass](a.Informer()) +} + +// ToIngressClassIndexInformer converts an untyped informer into a IngressClassIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *IngressClass. If that is not the case, calling type-safe methods of the returned +// IngressClassIndexInformer leads to runtime panics. A safer alternative is to pass +// around a IngressClassIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToIngressClassIndexInformer(informer cache.SharedIndexInformer) IngressClassIndexInformer { + if informer, ok := informer.(IngressClassIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.IngressClass](informer) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1/interface.go b/vendor/k8s.io/client-go/informers/networking/v1/interface.go index 09634929b3..6fecd84d6c 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1/interface.go +++ b/vendor/k8s.io/client-go/informers/networking/v1/interface.go @@ -25,15 +25,15 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // IPAddresses returns a IPAddressInformer. - IPAddresses() IPAddressInformer + IPAddresses() TypedIPAddressInformer // Ingresses returns a IngressInformer. - Ingresses() IngressInformer + Ingresses() TypedIngressInformer // IngressClasses returns a IngressClassInformer. - IngressClasses() IngressClassInformer + IngressClasses() TypedIngressClassInformer // NetworkPolicies returns a NetworkPolicyInformer. - NetworkPolicies() NetworkPolicyInformer + NetworkPolicies() TypedNetworkPolicyInformer // ServiceCIDRs returns a ServiceCIDRInformer. - ServiceCIDRs() ServiceCIDRInformer + ServiceCIDRs() TypedServiceCIDRInformer } type version struct { @@ -47,27 +47,27 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// IPAddresses returns a IPAddressInformer. -func (v *version) IPAddresses() IPAddressInformer { +// IPAddresses returns a TypedIPAddressInformer. +func (v *version) IPAddresses() TypedIPAddressInformer { return &iPAddressInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// Ingresses returns a IngressInformer. -func (v *version) Ingresses() IngressInformer { +// Ingresses returns a TypedIngressInformer. +func (v *version) Ingresses() TypedIngressInformer { return &ingressInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// IngressClasses returns a IngressClassInformer. -func (v *version) IngressClasses() IngressClassInformer { +// IngressClasses returns a TypedIngressClassInformer. +func (v *version) IngressClasses() TypedIngressClassInformer { return &ingressClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// NetworkPolicies returns a NetworkPolicyInformer. -func (v *version) NetworkPolicies() NetworkPolicyInformer { +// NetworkPolicies returns a TypedNetworkPolicyInformer. +func (v *version) NetworkPolicies() TypedNetworkPolicyInformer { return &networkPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// ServiceCIDRs returns a ServiceCIDRInformer. -func (v *version) ServiceCIDRs() ServiceCIDRInformer { +// ServiceCIDRs returns a TypedServiceCIDRInformer. +func (v *version) ServiceCIDRs() TypedServiceCIDRInformer { return &serviceCIDRInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/networking/v1/ipaddress.go b/vendor/k8s.io/client-go/informers/networking/v1/ipaddress.go index ea4bb280c8..45d85ae872 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1/ipaddress.go +++ b/vendor/k8s.io/client-go/informers/networking/v1/ipaddress.go @@ -34,12 +34,40 @@ import ( ) // IPAddressInformer provides access to a shared informer and lister for -// IPAddresses. +// IPAddresses. Prefer using the type-safe variant (see [TypedIPAddressInformer]). type IPAddressInformer interface { Informer() cache.SharedIndexInformer Lister() networkingv1.IPAddressLister } +// TypedIPAddressInformer provides access to a shared informer and lister for +// IPAddresses, including the type-safe TypedInformer variant. +// It is a superset of IPAddressInformer. +type TypedIPAddressInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() IPAddressIndexInformer + Lister() networkingv1.IPAddressLister +} + +// IPAddressIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type IPAddressIndexInformer cache.TypedSharedIndexInformer[*apinetworkingv1.IPAddress] + +// IPAddressHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for IPAddress. +type IPAddressHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apinetworkingv1.IPAddress] + +// IPAddressDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for IPAddress. +type IPAddressDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apinetworkingv1.IPAddress] + +// IPAddressFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for IPAddress. +type IPAddressFilteringHandler = cache.TypedFilteringResourceEventHandler[*apinetworkingv1.IPAddress] + +// IPAddressIndexers is a specialization of [cache.TypedIndexers] for IPAddress. +type IPAddressIndexers = cache.TypedIndexers[*apinetworkingv1.IPAddress] + +// DeletedIPAddress is a specialization of [cache.DeletedObject] for IPAddress. +type DeletedIPAddress = cache.DeletedObject[*apinetworkingv1.IPAddress] + type iPAddressInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type iPAddressInformer struct { // NewIPAddressInformer constructs a new informer for IPAddress type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedIPAddressInformer]). func NewIPAddressInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedIPAddressInformer constructs a new informer for IPAddress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedIPAddressInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers IPAddressIndexers) IPAddressIndexInformer { + return NewTypedIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredIPAddressInformer constructs a new informer for IPAddress type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredIPAddressInformer]). func NewFilteredIPAddressInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredIPAddressInformer constructs a new informer for IPAddress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredIPAddressInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers IPAddressIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) IPAddressIndexInformer { + return NewTypedIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewIPAddressInformerWithOptions constructs a new informer for IPAddress type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedIPAddressInformerWithOptions]). func NewIPAddressInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedIPAddressInformerWithOptions(client, options) +} + +// NewTypedIPAddressInformerWithOptions constructs a new informer for IPAddress type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedIPAddressInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) IPAddressIndexInformer { gvr := schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1", Resource: "ipaddresss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.IPAddress](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewIPAddressInformerWithOptions(client kubernetes.Interface, options intern Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *iPAddressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *iPAddressInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apinetworkingv1.IPAddress{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *iPAddressInformer) TypedInformer() IPAddressIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.IPAddress](f.factory.InformerFor(&apinetworkingv1.IPAddress{}, f.defaultInformer)) } func (f *iPAddressInformer) Lister() networkingv1.IPAddressLister { return networkingv1.NewIPAddressLister(f.Informer().GetIndexer()) } + +// ToTypedIPAddressInformer converts an untyped informer into a TypedIPAddressInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *IPAddress. If that is not the case, calling type-safe methods of the returned +// TypedIPAddressInformer leads to runtime panics. A safer alternative is to pass +// around a TypedIPAddressInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedIPAddressInformer(informer IPAddressInformer) TypedIPAddressInformer { + if informer, ok := informer.(TypedIPAddressInformer); ok { + return informer + } + return &iPAddressTypedInformerAdapter{informer} +} + +type iPAddressTypedInformerAdapter struct { + IPAddressInformer +} + +func (a *iPAddressTypedInformerAdapter) TypedInformer() IPAddressIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.IPAddress](a.Informer()) +} + +// ToIPAddressIndexInformer converts an untyped informer into a IPAddressIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *IPAddress. If that is not the case, calling type-safe methods of the returned +// IPAddressIndexInformer leads to runtime panics. A safer alternative is to pass +// around a IPAddressIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToIPAddressIndexInformer(informer cache.SharedIndexInformer) IPAddressIndexInformer { + if informer, ok := informer.(IPAddressIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.IPAddress](informer) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1/networkpolicy.go b/vendor/k8s.io/client-go/informers/networking/v1/networkpolicy.go index 237fe6266d..41586c52ab 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1/networkpolicy.go +++ b/vendor/k8s.io/client-go/informers/networking/v1/networkpolicy.go @@ -34,12 +34,40 @@ import ( ) // NetworkPolicyInformer provides access to a shared informer and lister for -// NetworkPolicies. +// NetworkPolicies. Prefer using the type-safe variant (see [TypedNetworkPolicyInformer]). type NetworkPolicyInformer interface { Informer() cache.SharedIndexInformer Lister() networkingv1.NetworkPolicyLister } +// TypedNetworkPolicyInformer provides access to a shared informer and lister for +// NetworkPolicies, including the type-safe TypedInformer variant. +// It is a superset of NetworkPolicyInformer. +type TypedNetworkPolicyInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() NetworkPolicyIndexInformer + Lister() networkingv1.NetworkPolicyLister +} + +// NetworkPolicyIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type NetworkPolicyIndexInformer cache.TypedSharedIndexInformer[*apinetworkingv1.NetworkPolicy] + +// NetworkPolicyHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for NetworkPolicy. +type NetworkPolicyHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apinetworkingv1.NetworkPolicy] + +// NetworkPolicyDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for NetworkPolicy. +type NetworkPolicyDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apinetworkingv1.NetworkPolicy] + +// NetworkPolicyFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for NetworkPolicy. +type NetworkPolicyFilteringHandler = cache.TypedFilteringResourceEventHandler[*apinetworkingv1.NetworkPolicy] + +// NetworkPolicyIndexers is a specialization of [cache.TypedIndexers] for NetworkPolicy. +type NetworkPolicyIndexers = cache.TypedIndexers[*apinetworkingv1.NetworkPolicy] + +// DeletedNetworkPolicy is a specialization of [cache.DeletedObject] for NetworkPolicy. +type DeletedNetworkPolicy = cache.DeletedObject[*apinetworkingv1.NetworkPolicy] + type networkPolicyInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type networkPolicyInformer struct { // NewNetworkPolicyInformer constructs a new informer for NetworkPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedNetworkPolicyInformer]). func NewNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewNetworkPolicyInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedNetworkPolicyInformer constructs a new informer for NetworkPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers NetworkPolicyIndexers) NetworkPolicyIndexInformer { + return NewTypedNetworkPolicyInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredNetworkPolicyInformer constructs a new informer for NetworkPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredNetworkPolicyInformer]). func NewFilteredNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewNetworkPolicyInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedNetworkPolicyInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredNetworkPolicyInformer constructs a new informer for NetworkPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers NetworkPolicyIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) NetworkPolicyIndexInformer { + return NewTypedNetworkPolicyInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewNetworkPolicyInformerWithOptions constructs a new informer for NetworkPolicy type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedNetworkPolicyInformerWithOptions]). func NewNetworkPolicyInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedNetworkPolicyInformerWithOptions(client, namespace, options) +} + +// NewTypedNetworkPolicyInformerWithOptions constructs a new informer for NetworkPolicy type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedNetworkPolicyInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) NetworkPolicyIndexInformer { gvr := schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1", Resource: "networkpolicys"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.NetworkPolicy](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewNetworkPolicyInformerWithOptions(client kubernetes.Interface, namespace Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *networkPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewNetworkPolicyInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedNetworkPolicyInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *networkPolicyInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apinetworkingv1.NetworkPolicy{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *networkPolicyInformer) TypedInformer() NetworkPolicyIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.NetworkPolicy](f.factory.InformerFor(&apinetworkingv1.NetworkPolicy{}, f.defaultInformer)) } func (f *networkPolicyInformer) Lister() networkingv1.NetworkPolicyLister { return networkingv1.NewNetworkPolicyLister(f.Informer().GetIndexer()) } + +// ToTypedNetworkPolicyInformer converts an untyped informer into a TypedNetworkPolicyInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *NetworkPolicy. If that is not the case, calling type-safe methods of the returned +// TypedNetworkPolicyInformer leads to runtime panics. A safer alternative is to pass +// around a TypedNetworkPolicyInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedNetworkPolicyInformer(informer NetworkPolicyInformer) TypedNetworkPolicyInformer { + if informer, ok := informer.(TypedNetworkPolicyInformer); ok { + return informer + } + return &networkPolicyTypedInformerAdapter{informer} +} + +type networkPolicyTypedInformerAdapter struct { + NetworkPolicyInformer +} + +func (a *networkPolicyTypedInformerAdapter) TypedInformer() NetworkPolicyIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.NetworkPolicy](a.Informer()) +} + +// ToNetworkPolicyIndexInformer converts an untyped informer into a NetworkPolicyIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *NetworkPolicy. If that is not the case, calling type-safe methods of the returned +// NetworkPolicyIndexInformer leads to runtime panics. A safer alternative is to pass +// around a NetworkPolicyIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToNetworkPolicyIndexInformer(informer cache.SharedIndexInformer) NetworkPolicyIndexInformer { + if informer, ok := informer.(NetworkPolicyIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.NetworkPolicy](informer) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1/servicecidr.go b/vendor/k8s.io/client-go/informers/networking/v1/servicecidr.go index ee1810f817..e78ac8908b 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1/servicecidr.go +++ b/vendor/k8s.io/client-go/informers/networking/v1/servicecidr.go @@ -34,12 +34,40 @@ import ( ) // ServiceCIDRInformer provides access to a shared informer and lister for -// ServiceCIDRs. +// ServiceCIDRs. Prefer using the type-safe variant (see [TypedServiceCIDRInformer]). type ServiceCIDRInformer interface { Informer() cache.SharedIndexInformer Lister() networkingv1.ServiceCIDRLister } +// TypedServiceCIDRInformer provides access to a shared informer and lister for +// ServiceCIDRs, including the type-safe TypedInformer variant. +// It is a superset of ServiceCIDRInformer. +type TypedServiceCIDRInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ServiceCIDRIndexInformer + Lister() networkingv1.ServiceCIDRLister +} + +// ServiceCIDRIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ServiceCIDRIndexInformer cache.TypedSharedIndexInformer[*apinetworkingv1.ServiceCIDR] + +// ServiceCIDRHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ServiceCIDR. +type ServiceCIDRHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apinetworkingv1.ServiceCIDR] + +// ServiceCIDRDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ServiceCIDR. +type ServiceCIDRDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apinetworkingv1.ServiceCIDR] + +// ServiceCIDRFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ServiceCIDR. +type ServiceCIDRFilteringHandler = cache.TypedFilteringResourceEventHandler[*apinetworkingv1.ServiceCIDR] + +// ServiceCIDRIndexers is a specialization of [cache.TypedIndexers] for ServiceCIDR. +type ServiceCIDRIndexers = cache.TypedIndexers[*apinetworkingv1.ServiceCIDR] + +// DeletedServiceCIDR is a specialization of [cache.DeletedObject] for ServiceCIDR. +type DeletedServiceCIDR = cache.DeletedObject[*apinetworkingv1.ServiceCIDR] + type serviceCIDRInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type serviceCIDRInformer struct { // NewServiceCIDRInformer constructs a new informer for ServiceCIDR type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedServiceCIDRInformer]). func NewServiceCIDRInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedServiceCIDRInformer constructs a new informer for ServiceCIDR type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedServiceCIDRInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ServiceCIDRIndexers) ServiceCIDRIndexInformer { + return NewTypedServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredServiceCIDRInformer constructs a new informer for ServiceCIDR type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredServiceCIDRInformer]). func NewFilteredServiceCIDRInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredServiceCIDRInformer constructs a new informer for ServiceCIDR type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredServiceCIDRInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ServiceCIDRIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ServiceCIDRIndexInformer { + return NewTypedServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewServiceCIDRInformerWithOptions constructs a new informer for ServiceCIDR type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedServiceCIDRInformerWithOptions]). func NewServiceCIDRInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedServiceCIDRInformerWithOptions(client, options) +} + +// NewTypedServiceCIDRInformerWithOptions constructs a new informer for ServiceCIDR type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedServiceCIDRInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ServiceCIDRIndexInformer { gvr := schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1", Resource: "servicecidrs"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.ServiceCIDR](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewServiceCIDRInformerWithOptions(client kubernetes.Interface, options inte Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *serviceCIDRInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *serviceCIDRInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apinetworkingv1.ServiceCIDR{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *serviceCIDRInformer) TypedInformer() ServiceCIDRIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.ServiceCIDR](f.factory.InformerFor(&apinetworkingv1.ServiceCIDR{}, f.defaultInformer)) } func (f *serviceCIDRInformer) Lister() networkingv1.ServiceCIDRLister { return networkingv1.NewServiceCIDRLister(f.Informer().GetIndexer()) } + +// ToTypedServiceCIDRInformer converts an untyped informer into a TypedServiceCIDRInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ServiceCIDR. If that is not the case, calling type-safe methods of the returned +// TypedServiceCIDRInformer leads to runtime panics. A safer alternative is to pass +// around a TypedServiceCIDRInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedServiceCIDRInformer(informer ServiceCIDRInformer) TypedServiceCIDRInformer { + if informer, ok := informer.(TypedServiceCIDRInformer); ok { + return informer + } + return &serviceCIDRTypedInformerAdapter{informer} +} + +type serviceCIDRTypedInformerAdapter struct { + ServiceCIDRInformer +} + +func (a *serviceCIDRTypedInformerAdapter) TypedInformer() ServiceCIDRIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.ServiceCIDR](a.Informer()) +} + +// ToServiceCIDRIndexInformer converts an untyped informer into a ServiceCIDRIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ServiceCIDR. If that is not the case, calling type-safe methods of the returned +// ServiceCIDRIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ServiceCIDRIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToServiceCIDRIndexInformer(informer cache.SharedIndexInformer) ServiceCIDRIndexInformer { + if informer, ok := informer.(ServiceCIDRIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apinetworkingv1.ServiceCIDR](informer) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1beta1/ingress.go b/vendor/k8s.io/client-go/informers/networking/v1beta1/ingress.go index ba35b8ac70..60ca6fb847 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1beta1/ingress.go +++ b/vendor/k8s.io/client-go/informers/networking/v1beta1/ingress.go @@ -34,12 +34,40 @@ import ( ) // IngressInformer provides access to a shared informer and lister for -// Ingresses. +// Ingresses. Prefer using the type-safe variant (see [TypedIngressInformer]). type IngressInformer interface { Informer() cache.SharedIndexInformer Lister() networkingv1beta1.IngressLister } +// TypedIngressInformer provides access to a shared informer and lister for +// Ingresses, including the type-safe TypedInformer variant. +// It is a superset of IngressInformer. +type TypedIngressInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() IngressIndexInformer + Lister() networkingv1beta1.IngressLister +} + +// IngressIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type IngressIndexInformer cache.TypedSharedIndexInformer[*apinetworkingv1beta1.Ingress] + +// IngressHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Ingress. +type IngressHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apinetworkingv1beta1.Ingress] + +// IngressDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Ingress. +type IngressDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apinetworkingv1beta1.Ingress] + +// IngressFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Ingress. +type IngressFilteringHandler = cache.TypedFilteringResourceEventHandler[*apinetworkingv1beta1.Ingress] + +// IngressIndexers is a specialization of [cache.TypedIndexers] for Ingress. +type IngressIndexers = cache.TypedIndexers[*apinetworkingv1beta1.Ingress] + +// DeletedIngress is a specialization of [cache.DeletedObject] for Ingress. +type DeletedIngress = cache.DeletedObject[*apinetworkingv1beta1.Ingress] + type ingressInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type ingressInformer struct { // NewIngressInformer constructs a new informer for Ingress type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedIngressInformer]). func NewIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers IngressIndexers) IngressIndexInformer { + return NewTypedIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredIngressInformer constructs a new informer for Ingress type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredIngressInformer]). func NewFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers IngressIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) IngressIndexInformer { + return NewTypedIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewIngressInformerWithOptions constructs a new informer for Ingress type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedIngressInformerWithOptions]). func NewIngressInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedIngressInformerWithOptions(client, namespace, options) +} + +// NewTypedIngressInformerWithOptions constructs a new informer for Ingress type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedIngressInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) IngressIndexInformer { gvr := schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1beta1", Resource: "ingresss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apinetworkingv1beta1.Ingress](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewIngressInformerWithOptions(client kubernetes.Interface, namespace string Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *ingressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewIngressInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedIngressInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *ingressInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apinetworkingv1beta1.Ingress{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *ingressInformer) TypedInformer() IngressIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinetworkingv1beta1.Ingress](f.factory.InformerFor(&apinetworkingv1beta1.Ingress{}, f.defaultInformer)) } func (f *ingressInformer) Lister() networkingv1beta1.IngressLister { return networkingv1beta1.NewIngressLister(f.Informer().GetIndexer()) } + +// ToTypedIngressInformer converts an untyped informer into a TypedIngressInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Ingress. If that is not the case, calling type-safe methods of the returned +// TypedIngressInformer leads to runtime panics. A safer alternative is to pass +// around a TypedIngressInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedIngressInformer(informer IngressInformer) TypedIngressInformer { + if informer, ok := informer.(TypedIngressInformer); ok { + return informer + } + return &ingressTypedInformerAdapter{informer} +} + +type ingressTypedInformerAdapter struct { + IngressInformer +} + +func (a *ingressTypedInformerAdapter) TypedInformer() IngressIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinetworkingv1beta1.Ingress](a.Informer()) +} + +// ToIngressIndexInformer converts an untyped informer into a IngressIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Ingress. If that is not the case, calling type-safe methods of the returned +// IngressIndexInformer leads to runtime panics. A safer alternative is to pass +// around a IngressIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToIngressIndexInformer(informer cache.SharedIndexInformer) IngressIndexInformer { + if informer, ok := informer.(IngressIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apinetworkingv1beta1.Ingress](informer) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go b/vendor/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go index 97d761a633..71ccdad0c0 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go +++ b/vendor/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go @@ -34,12 +34,40 @@ import ( ) // IngressClassInformer provides access to a shared informer and lister for -// IngressClasses. +// IngressClasses. Prefer using the type-safe variant (see [TypedIngressClassInformer]). type IngressClassInformer interface { Informer() cache.SharedIndexInformer Lister() networkingv1beta1.IngressClassLister } +// TypedIngressClassInformer provides access to a shared informer and lister for +// IngressClasses, including the type-safe TypedInformer variant. +// It is a superset of IngressClassInformer. +type TypedIngressClassInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() IngressClassIndexInformer + Lister() networkingv1beta1.IngressClassLister +} + +// IngressClassIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type IngressClassIndexInformer cache.TypedSharedIndexInformer[*apinetworkingv1beta1.IngressClass] + +// IngressClassHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for IngressClass. +type IngressClassHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apinetworkingv1beta1.IngressClass] + +// IngressClassDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for IngressClass. +type IngressClassDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apinetworkingv1beta1.IngressClass] + +// IngressClassFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for IngressClass. +type IngressClassFilteringHandler = cache.TypedFilteringResourceEventHandler[*apinetworkingv1beta1.IngressClass] + +// IngressClassIndexers is a specialization of [cache.TypedIndexers] for IngressClass. +type IngressClassIndexers = cache.TypedIndexers[*apinetworkingv1beta1.IngressClass] + +// DeletedIngressClass is a specialization of [cache.DeletedObject] for IngressClass. +type DeletedIngressClass = cache.DeletedObject[*apinetworkingv1beta1.IngressClass] + type ingressClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type ingressClassInformer struct { // NewIngressClassInformer constructs a new informer for IngressClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedIngressClassInformer]). func NewIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedIngressClassInformer constructs a new informer for IngressClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers IngressClassIndexers) IngressClassIndexInformer { + return NewTypedIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredIngressClassInformer constructs a new informer for IngressClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredIngressClassInformer]). func NewFilteredIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredIngressClassInformer constructs a new informer for IngressClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers IngressClassIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) IngressClassIndexInformer { + return NewTypedIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewIngressClassInformerWithOptions constructs a new informer for IngressClass type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedIngressClassInformerWithOptions]). func NewIngressClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedIngressClassInformerWithOptions(client, options) +} + +// NewTypedIngressClassInformerWithOptions constructs a new informer for IngressClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedIngressClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) IngressClassIndexInformer { gvr := schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1beta1", Resource: "ingressclasss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apinetworkingv1beta1.IngressClass](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewIngressClassInformerWithOptions(client kubernetes.Interface, options int Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *ingressClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *ingressClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apinetworkingv1beta1.IngressClass{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *ingressClassInformer) TypedInformer() IngressClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinetworkingv1beta1.IngressClass](f.factory.InformerFor(&apinetworkingv1beta1.IngressClass{}, f.defaultInformer)) } func (f *ingressClassInformer) Lister() networkingv1beta1.IngressClassLister { return networkingv1beta1.NewIngressClassLister(f.Informer().GetIndexer()) } + +// ToTypedIngressClassInformer converts an untyped informer into a TypedIngressClassInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *IngressClass. If that is not the case, calling type-safe methods of the returned +// TypedIngressClassInformer leads to runtime panics. A safer alternative is to pass +// around a TypedIngressClassInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedIngressClassInformer(informer IngressClassInformer) TypedIngressClassInformer { + if informer, ok := informer.(TypedIngressClassInformer); ok { + return informer + } + return &ingressClassTypedInformerAdapter{informer} +} + +type ingressClassTypedInformerAdapter struct { + IngressClassInformer +} + +func (a *ingressClassTypedInformerAdapter) TypedInformer() IngressClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinetworkingv1beta1.IngressClass](a.Informer()) +} + +// ToIngressClassIndexInformer converts an untyped informer into a IngressClassIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *IngressClass. If that is not the case, calling type-safe methods of the returned +// IngressClassIndexInformer leads to runtime panics. A safer alternative is to pass +// around a IngressClassIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToIngressClassIndexInformer(informer cache.SharedIndexInformer) IngressClassIndexInformer { + if informer, ok := informer.(IngressClassIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apinetworkingv1beta1.IngressClass](informer) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/networking/v1beta1/interface.go index 974a8fd5bf..f6489bd5d7 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1beta1/interface.go +++ b/vendor/k8s.io/client-go/informers/networking/v1beta1/interface.go @@ -25,13 +25,13 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // IPAddresses returns a IPAddressInformer. - IPAddresses() IPAddressInformer + IPAddresses() TypedIPAddressInformer // Ingresses returns a IngressInformer. - Ingresses() IngressInformer + Ingresses() TypedIngressInformer // IngressClasses returns a IngressClassInformer. - IngressClasses() IngressClassInformer + IngressClasses() TypedIngressClassInformer // ServiceCIDRs returns a ServiceCIDRInformer. - ServiceCIDRs() ServiceCIDRInformer + ServiceCIDRs() TypedServiceCIDRInformer } type version struct { @@ -45,22 +45,22 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// IPAddresses returns a IPAddressInformer. -func (v *version) IPAddresses() IPAddressInformer { +// IPAddresses returns a TypedIPAddressInformer. +func (v *version) IPAddresses() TypedIPAddressInformer { return &iPAddressInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// Ingresses returns a IngressInformer. -func (v *version) Ingresses() IngressInformer { +// Ingresses returns a TypedIngressInformer. +func (v *version) Ingresses() TypedIngressInformer { return &ingressInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// IngressClasses returns a IngressClassInformer. -func (v *version) IngressClasses() IngressClassInformer { +// IngressClasses returns a TypedIngressClassInformer. +func (v *version) IngressClasses() TypedIngressClassInformer { return &ingressClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// ServiceCIDRs returns a ServiceCIDRInformer. -func (v *version) ServiceCIDRs() ServiceCIDRInformer { +// ServiceCIDRs returns a TypedServiceCIDRInformer. +func (v *version) ServiceCIDRs() TypedServiceCIDRInformer { return &serviceCIDRInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/networking/v1beta1/ipaddress.go b/vendor/k8s.io/client-go/informers/networking/v1beta1/ipaddress.go index fd94392393..b63d156d76 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1beta1/ipaddress.go +++ b/vendor/k8s.io/client-go/informers/networking/v1beta1/ipaddress.go @@ -34,12 +34,40 @@ import ( ) // IPAddressInformer provides access to a shared informer and lister for -// IPAddresses. +// IPAddresses. Prefer using the type-safe variant (see [TypedIPAddressInformer]). type IPAddressInformer interface { Informer() cache.SharedIndexInformer Lister() networkingv1beta1.IPAddressLister } +// TypedIPAddressInformer provides access to a shared informer and lister for +// IPAddresses, including the type-safe TypedInformer variant. +// It is a superset of IPAddressInformer. +type TypedIPAddressInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() IPAddressIndexInformer + Lister() networkingv1beta1.IPAddressLister +} + +// IPAddressIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type IPAddressIndexInformer cache.TypedSharedIndexInformer[*apinetworkingv1beta1.IPAddress] + +// IPAddressHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for IPAddress. +type IPAddressHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apinetworkingv1beta1.IPAddress] + +// IPAddressDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for IPAddress. +type IPAddressDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apinetworkingv1beta1.IPAddress] + +// IPAddressFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for IPAddress. +type IPAddressFilteringHandler = cache.TypedFilteringResourceEventHandler[*apinetworkingv1beta1.IPAddress] + +// IPAddressIndexers is a specialization of [cache.TypedIndexers] for IPAddress. +type IPAddressIndexers = cache.TypedIndexers[*apinetworkingv1beta1.IPAddress] + +// DeletedIPAddress is a specialization of [cache.DeletedObject] for IPAddress. +type DeletedIPAddress = cache.DeletedObject[*apinetworkingv1beta1.IPAddress] + type iPAddressInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type iPAddressInformer struct { // NewIPAddressInformer constructs a new informer for IPAddress type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedIPAddressInformer]). func NewIPAddressInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedIPAddressInformer constructs a new informer for IPAddress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedIPAddressInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers IPAddressIndexers) IPAddressIndexInformer { + return NewTypedIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredIPAddressInformer constructs a new informer for IPAddress type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredIPAddressInformer]). func NewFilteredIPAddressInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredIPAddressInformer constructs a new informer for IPAddress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredIPAddressInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers IPAddressIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) IPAddressIndexInformer { + return NewTypedIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewIPAddressInformerWithOptions constructs a new informer for IPAddress type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedIPAddressInformerWithOptions]). func NewIPAddressInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedIPAddressInformerWithOptions(client, options) +} + +// NewTypedIPAddressInformerWithOptions constructs a new informer for IPAddress type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedIPAddressInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) IPAddressIndexInformer { gvr := schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1beta1", Resource: "ipaddresss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apinetworkingv1beta1.IPAddress](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewIPAddressInformerWithOptions(client kubernetes.Interface, options intern Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *iPAddressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *iPAddressInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apinetworkingv1beta1.IPAddress{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *iPAddressInformer) TypedInformer() IPAddressIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinetworkingv1beta1.IPAddress](f.factory.InformerFor(&apinetworkingv1beta1.IPAddress{}, f.defaultInformer)) } func (f *iPAddressInformer) Lister() networkingv1beta1.IPAddressLister { return networkingv1beta1.NewIPAddressLister(f.Informer().GetIndexer()) } + +// ToTypedIPAddressInformer converts an untyped informer into a TypedIPAddressInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *IPAddress. If that is not the case, calling type-safe methods of the returned +// TypedIPAddressInformer leads to runtime panics. A safer alternative is to pass +// around a TypedIPAddressInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedIPAddressInformer(informer IPAddressInformer) TypedIPAddressInformer { + if informer, ok := informer.(TypedIPAddressInformer); ok { + return informer + } + return &iPAddressTypedInformerAdapter{informer} +} + +type iPAddressTypedInformerAdapter struct { + IPAddressInformer +} + +func (a *iPAddressTypedInformerAdapter) TypedInformer() IPAddressIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinetworkingv1beta1.IPAddress](a.Informer()) +} + +// ToIPAddressIndexInformer converts an untyped informer into a IPAddressIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *IPAddress. If that is not the case, calling type-safe methods of the returned +// IPAddressIndexInformer leads to runtime panics. A safer alternative is to pass +// around a IPAddressIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToIPAddressIndexInformer(informer cache.SharedIndexInformer) IPAddressIndexInformer { + if informer, ok := informer.(IPAddressIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apinetworkingv1beta1.IPAddress](informer) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1beta1/servicecidr.go b/vendor/k8s.io/client-go/informers/networking/v1beta1/servicecidr.go index 6fe8c3bd11..538ef31327 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1beta1/servicecidr.go +++ b/vendor/k8s.io/client-go/informers/networking/v1beta1/servicecidr.go @@ -34,12 +34,40 @@ import ( ) // ServiceCIDRInformer provides access to a shared informer and lister for -// ServiceCIDRs. +// ServiceCIDRs. Prefer using the type-safe variant (see [TypedServiceCIDRInformer]). type ServiceCIDRInformer interface { Informer() cache.SharedIndexInformer Lister() networkingv1beta1.ServiceCIDRLister } +// TypedServiceCIDRInformer provides access to a shared informer and lister for +// ServiceCIDRs, including the type-safe TypedInformer variant. +// It is a superset of ServiceCIDRInformer. +type TypedServiceCIDRInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ServiceCIDRIndexInformer + Lister() networkingv1beta1.ServiceCIDRLister +} + +// ServiceCIDRIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ServiceCIDRIndexInformer cache.TypedSharedIndexInformer[*apinetworkingv1beta1.ServiceCIDR] + +// ServiceCIDRHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ServiceCIDR. +type ServiceCIDRHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apinetworkingv1beta1.ServiceCIDR] + +// ServiceCIDRDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ServiceCIDR. +type ServiceCIDRDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apinetworkingv1beta1.ServiceCIDR] + +// ServiceCIDRFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ServiceCIDR. +type ServiceCIDRFilteringHandler = cache.TypedFilteringResourceEventHandler[*apinetworkingv1beta1.ServiceCIDR] + +// ServiceCIDRIndexers is a specialization of [cache.TypedIndexers] for ServiceCIDR. +type ServiceCIDRIndexers = cache.TypedIndexers[*apinetworkingv1beta1.ServiceCIDR] + +// DeletedServiceCIDR is a specialization of [cache.DeletedObject] for ServiceCIDR. +type DeletedServiceCIDR = cache.DeletedObject[*apinetworkingv1beta1.ServiceCIDR] + type serviceCIDRInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type serviceCIDRInformer struct { // NewServiceCIDRInformer constructs a new informer for ServiceCIDR type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedServiceCIDRInformer]). func NewServiceCIDRInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedServiceCIDRInformer constructs a new informer for ServiceCIDR type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedServiceCIDRInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ServiceCIDRIndexers) ServiceCIDRIndexInformer { + return NewTypedServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredServiceCIDRInformer constructs a new informer for ServiceCIDR type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredServiceCIDRInformer]). func NewFilteredServiceCIDRInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredServiceCIDRInformer constructs a new informer for ServiceCIDR type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredServiceCIDRInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ServiceCIDRIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ServiceCIDRIndexInformer { + return NewTypedServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewServiceCIDRInformerWithOptions constructs a new informer for ServiceCIDR type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedServiceCIDRInformerWithOptions]). func NewServiceCIDRInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedServiceCIDRInformerWithOptions(client, options) +} + +// NewTypedServiceCIDRInformerWithOptions constructs a new informer for ServiceCIDR type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedServiceCIDRInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ServiceCIDRIndexInformer { gvr := schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1beta1", Resource: "servicecidrs"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apinetworkingv1beta1.ServiceCIDR](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewServiceCIDRInformerWithOptions(client kubernetes.Interface, options inte Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *serviceCIDRInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *serviceCIDRInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apinetworkingv1beta1.ServiceCIDR{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *serviceCIDRInformer) TypedInformer() ServiceCIDRIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinetworkingv1beta1.ServiceCIDR](f.factory.InformerFor(&apinetworkingv1beta1.ServiceCIDR{}, f.defaultInformer)) } func (f *serviceCIDRInformer) Lister() networkingv1beta1.ServiceCIDRLister { return networkingv1beta1.NewServiceCIDRLister(f.Informer().GetIndexer()) } + +// ToTypedServiceCIDRInformer converts an untyped informer into a TypedServiceCIDRInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ServiceCIDR. If that is not the case, calling type-safe methods of the returned +// TypedServiceCIDRInformer leads to runtime panics. A safer alternative is to pass +// around a TypedServiceCIDRInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedServiceCIDRInformer(informer ServiceCIDRInformer) TypedServiceCIDRInformer { + if informer, ok := informer.(TypedServiceCIDRInformer); ok { + return informer + } + return &serviceCIDRTypedInformerAdapter{informer} +} + +type serviceCIDRTypedInformerAdapter struct { + ServiceCIDRInformer +} + +func (a *serviceCIDRTypedInformerAdapter) TypedInformer() ServiceCIDRIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinetworkingv1beta1.ServiceCIDR](a.Informer()) +} + +// ToServiceCIDRIndexInformer converts an untyped informer into a ServiceCIDRIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ServiceCIDR. If that is not the case, calling type-safe methods of the returned +// ServiceCIDRIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ServiceCIDRIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToServiceCIDRIndexInformer(informer cache.SharedIndexInformer) ServiceCIDRIndexInformer { + if informer, ok := informer.(ServiceCIDRIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apinetworkingv1beta1.ServiceCIDR](informer) +} diff --git a/vendor/k8s.io/client-go/informers/node/v1/interface.go b/vendor/k8s.io/client-go/informers/node/v1/interface.go index 913fec4aca..53a4abd92e 100644 --- a/vendor/k8s.io/client-go/informers/node/v1/interface.go +++ b/vendor/k8s.io/client-go/informers/node/v1/interface.go @@ -25,7 +25,7 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // RuntimeClasses returns a RuntimeClassInformer. - RuntimeClasses() RuntimeClassInformer + RuntimeClasses() TypedRuntimeClassInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// RuntimeClasses returns a RuntimeClassInformer. -func (v *version) RuntimeClasses() RuntimeClassInformer { +// RuntimeClasses returns a TypedRuntimeClassInformer. +func (v *version) RuntimeClasses() TypedRuntimeClassInformer { return &runtimeClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/node/v1/runtimeclass.go b/vendor/k8s.io/client-go/informers/node/v1/runtimeclass.go index 3b7d4a25d2..4fe4065465 100644 --- a/vendor/k8s.io/client-go/informers/node/v1/runtimeclass.go +++ b/vendor/k8s.io/client-go/informers/node/v1/runtimeclass.go @@ -34,12 +34,40 @@ import ( ) // RuntimeClassInformer provides access to a shared informer and lister for -// RuntimeClasses. +// RuntimeClasses. Prefer using the type-safe variant (see [TypedRuntimeClassInformer]). type RuntimeClassInformer interface { Informer() cache.SharedIndexInformer Lister() nodev1.RuntimeClassLister } +// TypedRuntimeClassInformer provides access to a shared informer and lister for +// RuntimeClasses, including the type-safe TypedInformer variant. +// It is a superset of RuntimeClassInformer. +type TypedRuntimeClassInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() RuntimeClassIndexInformer + Lister() nodev1.RuntimeClassLister +} + +// RuntimeClassIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type RuntimeClassIndexInformer cache.TypedSharedIndexInformer[*apinodev1.RuntimeClass] + +// RuntimeClassHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for RuntimeClass. +type RuntimeClassHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apinodev1.RuntimeClass] + +// RuntimeClassDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for RuntimeClass. +type RuntimeClassDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apinodev1.RuntimeClass] + +// RuntimeClassFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for RuntimeClass. +type RuntimeClassFilteringHandler = cache.TypedFilteringResourceEventHandler[*apinodev1.RuntimeClass] + +// RuntimeClassIndexers is a specialization of [cache.TypedIndexers] for RuntimeClass. +type RuntimeClassIndexers = cache.TypedIndexers[*apinodev1.RuntimeClass] + +// DeletedRuntimeClass is a specialization of [cache.DeletedObject] for RuntimeClass. +type DeletedRuntimeClass = cache.DeletedObject[*apinodev1.RuntimeClass] + type runtimeClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type runtimeClassInformer struct { // NewRuntimeClassInformer constructs a new informer for RuntimeClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedRuntimeClassInformer]). func NewRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers RuntimeClassIndexers) RuntimeClassIndexInformer { + return NewTypedRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredRuntimeClassInformer]). func NewFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers RuntimeClassIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) RuntimeClassIndexInformer { + return NewTypedRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewRuntimeClassInformerWithOptions constructs a new informer for RuntimeClass type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedRuntimeClassInformerWithOptions]). func NewRuntimeClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedRuntimeClassInformerWithOptions(client, options) +} + +// NewTypedRuntimeClassInformerWithOptions constructs a new informer for RuntimeClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedRuntimeClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) RuntimeClassIndexInformer { gvr := schema.GroupVersionResource{Group: "node.k8s.io", Version: "v1", Resource: "runtimeclasss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apinodev1.RuntimeClass](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewRuntimeClassInformerWithOptions(client kubernetes.Interface, options int Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *runtimeClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *runtimeClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apinodev1.RuntimeClass{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *runtimeClassInformer) TypedInformer() RuntimeClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinodev1.RuntimeClass](f.factory.InformerFor(&apinodev1.RuntimeClass{}, f.defaultInformer)) } func (f *runtimeClassInformer) Lister() nodev1.RuntimeClassLister { return nodev1.NewRuntimeClassLister(f.Informer().GetIndexer()) } + +// ToTypedRuntimeClassInformer converts an untyped informer into a TypedRuntimeClassInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *RuntimeClass. If that is not the case, calling type-safe methods of the returned +// TypedRuntimeClassInformer leads to runtime panics. A safer alternative is to pass +// around a TypedRuntimeClassInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedRuntimeClassInformer(informer RuntimeClassInformer) TypedRuntimeClassInformer { + if informer, ok := informer.(TypedRuntimeClassInformer); ok { + return informer + } + return &runtimeClassTypedInformerAdapter{informer} +} + +type runtimeClassTypedInformerAdapter struct { + RuntimeClassInformer +} + +func (a *runtimeClassTypedInformerAdapter) TypedInformer() RuntimeClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinodev1.RuntimeClass](a.Informer()) +} + +// ToRuntimeClassIndexInformer converts an untyped informer into a RuntimeClassIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *RuntimeClass. If that is not the case, calling type-safe methods of the returned +// RuntimeClassIndexInformer leads to runtime panics. A safer alternative is to pass +// around a RuntimeClassIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToRuntimeClassIndexInformer(informer cache.SharedIndexInformer) RuntimeClassIndexInformer { + if informer, ok := informer.(RuntimeClassIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apinodev1.RuntimeClass](informer) +} diff --git a/vendor/k8s.io/client-go/informers/node/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/node/v1alpha1/interface.go index c56442957e..402674241c 100644 --- a/vendor/k8s.io/client-go/informers/node/v1alpha1/interface.go +++ b/vendor/k8s.io/client-go/informers/node/v1alpha1/interface.go @@ -25,7 +25,7 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // RuntimeClasses returns a RuntimeClassInformer. - RuntimeClasses() RuntimeClassInformer + RuntimeClasses() TypedRuntimeClassInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// RuntimeClasses returns a RuntimeClassInformer. -func (v *version) RuntimeClasses() RuntimeClassInformer { +// RuntimeClasses returns a TypedRuntimeClassInformer. +func (v *version) RuntimeClasses() TypedRuntimeClassInformer { return &runtimeClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go b/vendor/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go index 1907a122d2..d264133fef 100644 --- a/vendor/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go +++ b/vendor/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go @@ -34,12 +34,40 @@ import ( ) // RuntimeClassInformer provides access to a shared informer and lister for -// RuntimeClasses. +// RuntimeClasses. Prefer using the type-safe variant (see [TypedRuntimeClassInformer]). type RuntimeClassInformer interface { Informer() cache.SharedIndexInformer Lister() nodev1alpha1.RuntimeClassLister } +// TypedRuntimeClassInformer provides access to a shared informer and lister for +// RuntimeClasses, including the type-safe TypedInformer variant. +// It is a superset of RuntimeClassInformer. +type TypedRuntimeClassInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() RuntimeClassIndexInformer + Lister() nodev1alpha1.RuntimeClassLister +} + +// RuntimeClassIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type RuntimeClassIndexInformer cache.TypedSharedIndexInformer[*apinodev1alpha1.RuntimeClass] + +// RuntimeClassHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for RuntimeClass. +type RuntimeClassHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apinodev1alpha1.RuntimeClass] + +// RuntimeClassDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for RuntimeClass. +type RuntimeClassDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apinodev1alpha1.RuntimeClass] + +// RuntimeClassFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for RuntimeClass. +type RuntimeClassFilteringHandler = cache.TypedFilteringResourceEventHandler[*apinodev1alpha1.RuntimeClass] + +// RuntimeClassIndexers is a specialization of [cache.TypedIndexers] for RuntimeClass. +type RuntimeClassIndexers = cache.TypedIndexers[*apinodev1alpha1.RuntimeClass] + +// DeletedRuntimeClass is a specialization of [cache.DeletedObject] for RuntimeClass. +type DeletedRuntimeClass = cache.DeletedObject[*apinodev1alpha1.RuntimeClass] + type runtimeClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type runtimeClassInformer struct { // NewRuntimeClassInformer constructs a new informer for RuntimeClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedRuntimeClassInformer]). func NewRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers RuntimeClassIndexers) RuntimeClassIndexInformer { + return NewTypedRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredRuntimeClassInformer]). func NewFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers RuntimeClassIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) RuntimeClassIndexInformer { + return NewTypedRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewRuntimeClassInformerWithOptions constructs a new informer for RuntimeClass type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedRuntimeClassInformerWithOptions]). func NewRuntimeClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedRuntimeClassInformerWithOptions(client, options) +} + +// NewTypedRuntimeClassInformerWithOptions constructs a new informer for RuntimeClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedRuntimeClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) RuntimeClassIndexInformer { gvr := schema.GroupVersionResource{Group: "node.k8s.io", Version: "v1alpha1", Resource: "runtimeclasss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apinodev1alpha1.RuntimeClass](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewRuntimeClassInformerWithOptions(client kubernetes.Interface, options int Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *runtimeClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *runtimeClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apinodev1alpha1.RuntimeClass{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *runtimeClassInformer) TypedInformer() RuntimeClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinodev1alpha1.RuntimeClass](f.factory.InformerFor(&apinodev1alpha1.RuntimeClass{}, f.defaultInformer)) } func (f *runtimeClassInformer) Lister() nodev1alpha1.RuntimeClassLister { return nodev1alpha1.NewRuntimeClassLister(f.Informer().GetIndexer()) } + +// ToTypedRuntimeClassInformer converts an untyped informer into a TypedRuntimeClassInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *RuntimeClass. If that is not the case, calling type-safe methods of the returned +// TypedRuntimeClassInformer leads to runtime panics. A safer alternative is to pass +// around a TypedRuntimeClassInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedRuntimeClassInformer(informer RuntimeClassInformer) TypedRuntimeClassInformer { + if informer, ok := informer.(TypedRuntimeClassInformer); ok { + return informer + } + return &runtimeClassTypedInformerAdapter{informer} +} + +type runtimeClassTypedInformerAdapter struct { + RuntimeClassInformer +} + +func (a *runtimeClassTypedInformerAdapter) TypedInformer() RuntimeClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinodev1alpha1.RuntimeClass](a.Informer()) +} + +// ToRuntimeClassIndexInformer converts an untyped informer into a RuntimeClassIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *RuntimeClass. If that is not the case, calling type-safe methods of the returned +// RuntimeClassIndexInformer leads to runtime panics. A safer alternative is to pass +// around a RuntimeClassIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToRuntimeClassIndexInformer(informer cache.SharedIndexInformer) RuntimeClassIndexInformer { + if informer, ok := informer.(RuntimeClassIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apinodev1alpha1.RuntimeClass](informer) +} diff --git a/vendor/k8s.io/client-go/informers/node/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/node/v1beta1/interface.go index 44a1defb6b..6e81a66e4e 100644 --- a/vendor/k8s.io/client-go/informers/node/v1beta1/interface.go +++ b/vendor/k8s.io/client-go/informers/node/v1beta1/interface.go @@ -25,7 +25,7 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // RuntimeClasses returns a RuntimeClassInformer. - RuntimeClasses() RuntimeClassInformer + RuntimeClasses() TypedRuntimeClassInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// RuntimeClasses returns a RuntimeClassInformer. -func (v *version) RuntimeClasses() RuntimeClassInformer { +// RuntimeClasses returns a TypedRuntimeClassInformer. +func (v *version) RuntimeClasses() TypedRuntimeClassInformer { return &runtimeClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go b/vendor/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go index ca7e9307ac..58d602da20 100644 --- a/vendor/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go +++ b/vendor/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go @@ -34,12 +34,40 @@ import ( ) // RuntimeClassInformer provides access to a shared informer and lister for -// RuntimeClasses. +// RuntimeClasses. Prefer using the type-safe variant (see [TypedRuntimeClassInformer]). type RuntimeClassInformer interface { Informer() cache.SharedIndexInformer Lister() nodev1beta1.RuntimeClassLister } +// TypedRuntimeClassInformer provides access to a shared informer and lister for +// RuntimeClasses, including the type-safe TypedInformer variant. +// It is a superset of RuntimeClassInformer. +type TypedRuntimeClassInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() RuntimeClassIndexInformer + Lister() nodev1beta1.RuntimeClassLister +} + +// RuntimeClassIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type RuntimeClassIndexInformer cache.TypedSharedIndexInformer[*apinodev1beta1.RuntimeClass] + +// RuntimeClassHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for RuntimeClass. +type RuntimeClassHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apinodev1beta1.RuntimeClass] + +// RuntimeClassDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for RuntimeClass. +type RuntimeClassDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apinodev1beta1.RuntimeClass] + +// RuntimeClassFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for RuntimeClass. +type RuntimeClassFilteringHandler = cache.TypedFilteringResourceEventHandler[*apinodev1beta1.RuntimeClass] + +// RuntimeClassIndexers is a specialization of [cache.TypedIndexers] for RuntimeClass. +type RuntimeClassIndexers = cache.TypedIndexers[*apinodev1beta1.RuntimeClass] + +// DeletedRuntimeClass is a specialization of [cache.DeletedObject] for RuntimeClass. +type DeletedRuntimeClass = cache.DeletedObject[*apinodev1beta1.RuntimeClass] + type runtimeClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type runtimeClassInformer struct { // NewRuntimeClassInformer constructs a new informer for RuntimeClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedRuntimeClassInformer]). func NewRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers RuntimeClassIndexers) RuntimeClassIndexInformer { + return NewTypedRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredRuntimeClassInformer]). func NewFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers RuntimeClassIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) RuntimeClassIndexInformer { + return NewTypedRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewRuntimeClassInformerWithOptions constructs a new informer for RuntimeClass type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedRuntimeClassInformerWithOptions]). func NewRuntimeClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedRuntimeClassInformerWithOptions(client, options) +} + +// NewTypedRuntimeClassInformerWithOptions constructs a new informer for RuntimeClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedRuntimeClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) RuntimeClassIndexInformer { gvr := schema.GroupVersionResource{Group: "node.k8s.io", Version: "v1beta1", Resource: "runtimeclasss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apinodev1beta1.RuntimeClass](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewRuntimeClassInformerWithOptions(client kubernetes.Interface, options int Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *runtimeClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *runtimeClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apinodev1beta1.RuntimeClass{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *runtimeClassInformer) TypedInformer() RuntimeClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinodev1beta1.RuntimeClass](f.factory.InformerFor(&apinodev1beta1.RuntimeClass{}, f.defaultInformer)) } func (f *runtimeClassInformer) Lister() nodev1beta1.RuntimeClassLister { return nodev1beta1.NewRuntimeClassLister(f.Informer().GetIndexer()) } + +// ToTypedRuntimeClassInformer converts an untyped informer into a TypedRuntimeClassInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *RuntimeClass. If that is not the case, calling type-safe methods of the returned +// TypedRuntimeClassInformer leads to runtime panics. A safer alternative is to pass +// around a TypedRuntimeClassInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedRuntimeClassInformer(informer RuntimeClassInformer) TypedRuntimeClassInformer { + if informer, ok := informer.(TypedRuntimeClassInformer); ok { + return informer + } + return &runtimeClassTypedInformerAdapter{informer} +} + +type runtimeClassTypedInformerAdapter struct { + RuntimeClassInformer +} + +func (a *runtimeClassTypedInformerAdapter) TypedInformer() RuntimeClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apinodev1beta1.RuntimeClass](a.Informer()) +} + +// ToRuntimeClassIndexInformer converts an untyped informer into a RuntimeClassIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *RuntimeClass. If that is not the case, calling type-safe methods of the returned +// RuntimeClassIndexInformer leads to runtime panics. A safer alternative is to pass +// around a RuntimeClassIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToRuntimeClassIndexInformer(informer cache.SharedIndexInformer) RuntimeClassIndexInformer { + if informer, ok := informer.(RuntimeClassIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apinodev1beta1.RuntimeClass](informer) +} diff --git a/vendor/k8s.io/client-go/informers/policy/v1/interface.go b/vendor/k8s.io/client-go/informers/policy/v1/interface.go index 2c42e1993c..2035254dc1 100644 --- a/vendor/k8s.io/client-go/informers/policy/v1/interface.go +++ b/vendor/k8s.io/client-go/informers/policy/v1/interface.go @@ -25,7 +25,7 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // PodDisruptionBudgets returns a PodDisruptionBudgetInformer. - PodDisruptionBudgets() PodDisruptionBudgetInformer + PodDisruptionBudgets() TypedPodDisruptionBudgetInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// PodDisruptionBudgets returns a PodDisruptionBudgetInformer. -func (v *version) PodDisruptionBudgets() PodDisruptionBudgetInformer { +// PodDisruptionBudgets returns a TypedPodDisruptionBudgetInformer. +func (v *version) PodDisruptionBudgets() TypedPodDisruptionBudgetInformer { return &podDisruptionBudgetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go b/vendor/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go index 2945e543d7..24ed2870df 100644 --- a/vendor/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go +++ b/vendor/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go @@ -34,12 +34,40 @@ import ( ) // PodDisruptionBudgetInformer provides access to a shared informer and lister for -// PodDisruptionBudgets. +// PodDisruptionBudgets. Prefer using the type-safe variant (see [TypedPodDisruptionBudgetInformer]). type PodDisruptionBudgetInformer interface { Informer() cache.SharedIndexInformer Lister() policyv1.PodDisruptionBudgetLister } +// TypedPodDisruptionBudgetInformer provides access to a shared informer and lister for +// PodDisruptionBudgets, including the type-safe TypedInformer variant. +// It is a superset of PodDisruptionBudgetInformer. +type TypedPodDisruptionBudgetInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() PodDisruptionBudgetIndexInformer + Lister() policyv1.PodDisruptionBudgetLister +} + +// PodDisruptionBudgetIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type PodDisruptionBudgetIndexInformer cache.TypedSharedIndexInformer[*apipolicyv1.PodDisruptionBudget] + +// PodDisruptionBudgetHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for PodDisruptionBudget. +type PodDisruptionBudgetHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apipolicyv1.PodDisruptionBudget] + +// PodDisruptionBudgetDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for PodDisruptionBudget. +type PodDisruptionBudgetDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apipolicyv1.PodDisruptionBudget] + +// PodDisruptionBudgetFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for PodDisruptionBudget. +type PodDisruptionBudgetFilteringHandler = cache.TypedFilteringResourceEventHandler[*apipolicyv1.PodDisruptionBudget] + +// PodDisruptionBudgetIndexers is a specialization of [cache.TypedIndexers] for PodDisruptionBudget. +type PodDisruptionBudgetIndexers = cache.TypedIndexers[*apipolicyv1.PodDisruptionBudget] + +// DeletedPodDisruptionBudget is a specialization of [cache.DeletedObject] for PodDisruptionBudget. +type DeletedPodDisruptionBudget = cache.DeletedObject[*apipolicyv1.PodDisruptionBudget] + type podDisruptionBudgetInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type podDisruptionBudgetInformer struct { // NewPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPodDisruptionBudgetInformer]). func NewPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewPodDisruptionBudgetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers PodDisruptionBudgetIndexers) PodDisruptionBudgetIndexInformer { + return NewTypedPodDisruptionBudgetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredPodDisruptionBudgetInformer]). func NewFilteredPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewPodDisruptionBudgetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedPodDisruptionBudgetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers PodDisruptionBudgetIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) PodDisruptionBudgetIndexInformer { + return NewTypedPodDisruptionBudgetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewPodDisruptionBudgetInformerWithOptions constructs a new informer for PodDisruptionBudget type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPodDisruptionBudgetInformerWithOptions]). func NewPodDisruptionBudgetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedPodDisruptionBudgetInformerWithOptions(client, namespace, options) +} + +// NewTypedPodDisruptionBudgetInformerWithOptions constructs a new informer for PodDisruptionBudget type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPodDisruptionBudgetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) PodDisruptionBudgetIndexInformer { gvr := schema.GroupVersionResource{Group: "policy", Version: "v1", Resource: "poddisruptionbudgets"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apipolicyv1.PodDisruptionBudget](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewPodDisruptionBudgetInformerWithOptions(client kubernetes.Interface, name Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *podDisruptionBudgetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewPodDisruptionBudgetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedPodDisruptionBudgetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *podDisruptionBudgetInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apipolicyv1.PodDisruptionBudget{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *podDisruptionBudgetInformer) TypedInformer() PodDisruptionBudgetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apipolicyv1.PodDisruptionBudget](f.factory.InformerFor(&apipolicyv1.PodDisruptionBudget{}, f.defaultInformer)) } func (f *podDisruptionBudgetInformer) Lister() policyv1.PodDisruptionBudgetLister { return policyv1.NewPodDisruptionBudgetLister(f.Informer().GetIndexer()) } + +// ToTypedPodDisruptionBudgetInformer converts an untyped informer into a TypedPodDisruptionBudgetInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PodDisruptionBudget. If that is not the case, calling type-safe methods of the returned +// TypedPodDisruptionBudgetInformer leads to runtime panics. A safer alternative is to pass +// around a TypedPodDisruptionBudgetInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedPodDisruptionBudgetInformer(informer PodDisruptionBudgetInformer) TypedPodDisruptionBudgetInformer { + if informer, ok := informer.(TypedPodDisruptionBudgetInformer); ok { + return informer + } + return &podDisruptionBudgetTypedInformerAdapter{informer} +} + +type podDisruptionBudgetTypedInformerAdapter struct { + PodDisruptionBudgetInformer +} + +func (a *podDisruptionBudgetTypedInformerAdapter) TypedInformer() PodDisruptionBudgetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apipolicyv1.PodDisruptionBudget](a.Informer()) +} + +// ToPodDisruptionBudgetIndexInformer converts an untyped informer into a PodDisruptionBudgetIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PodDisruptionBudget. If that is not the case, calling type-safe methods of the returned +// PodDisruptionBudgetIndexInformer leads to runtime panics. A safer alternative is to pass +// around a PodDisruptionBudgetIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToPodDisruptionBudgetIndexInformer(informer cache.SharedIndexInformer) PodDisruptionBudgetIndexInformer { + if informer, ok := informer.(PodDisruptionBudgetIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apipolicyv1.PodDisruptionBudget](informer) +} diff --git a/vendor/k8s.io/client-go/informers/policy/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/policy/v1beta1/interface.go index 055c8adc55..31c09bc17b 100644 --- a/vendor/k8s.io/client-go/informers/policy/v1beta1/interface.go +++ b/vendor/k8s.io/client-go/informers/policy/v1beta1/interface.go @@ -25,7 +25,7 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // PodDisruptionBudgets returns a PodDisruptionBudgetInformer. - PodDisruptionBudgets() PodDisruptionBudgetInformer + PodDisruptionBudgets() TypedPodDisruptionBudgetInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// PodDisruptionBudgets returns a PodDisruptionBudgetInformer. -func (v *version) PodDisruptionBudgets() PodDisruptionBudgetInformer { +// PodDisruptionBudgets returns a TypedPodDisruptionBudgetInformer. +func (v *version) PodDisruptionBudgets() TypedPodDisruptionBudgetInformer { return &podDisruptionBudgetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go b/vendor/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go index 70c79683fe..8069aad312 100644 --- a/vendor/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go +++ b/vendor/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go @@ -34,12 +34,40 @@ import ( ) // PodDisruptionBudgetInformer provides access to a shared informer and lister for -// PodDisruptionBudgets. +// PodDisruptionBudgets. Prefer using the type-safe variant (see [TypedPodDisruptionBudgetInformer]). type PodDisruptionBudgetInformer interface { Informer() cache.SharedIndexInformer Lister() policyv1beta1.PodDisruptionBudgetLister } +// TypedPodDisruptionBudgetInformer provides access to a shared informer and lister for +// PodDisruptionBudgets, including the type-safe TypedInformer variant. +// It is a superset of PodDisruptionBudgetInformer. +type TypedPodDisruptionBudgetInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() PodDisruptionBudgetIndexInformer + Lister() policyv1beta1.PodDisruptionBudgetLister +} + +// PodDisruptionBudgetIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type PodDisruptionBudgetIndexInformer cache.TypedSharedIndexInformer[*apipolicyv1beta1.PodDisruptionBudget] + +// PodDisruptionBudgetHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for PodDisruptionBudget. +type PodDisruptionBudgetHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apipolicyv1beta1.PodDisruptionBudget] + +// PodDisruptionBudgetDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for PodDisruptionBudget. +type PodDisruptionBudgetDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apipolicyv1beta1.PodDisruptionBudget] + +// PodDisruptionBudgetFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for PodDisruptionBudget. +type PodDisruptionBudgetFilteringHandler = cache.TypedFilteringResourceEventHandler[*apipolicyv1beta1.PodDisruptionBudget] + +// PodDisruptionBudgetIndexers is a specialization of [cache.TypedIndexers] for PodDisruptionBudget. +type PodDisruptionBudgetIndexers = cache.TypedIndexers[*apipolicyv1beta1.PodDisruptionBudget] + +// DeletedPodDisruptionBudget is a specialization of [cache.DeletedObject] for PodDisruptionBudget. +type DeletedPodDisruptionBudget = cache.DeletedObject[*apipolicyv1beta1.PodDisruptionBudget] + type podDisruptionBudgetInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type podDisruptionBudgetInformer struct { // NewPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPodDisruptionBudgetInformer]). func NewPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewPodDisruptionBudgetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers PodDisruptionBudgetIndexers) PodDisruptionBudgetIndexInformer { + return NewTypedPodDisruptionBudgetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredPodDisruptionBudgetInformer]). func NewFilteredPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewPodDisruptionBudgetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedPodDisruptionBudgetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers PodDisruptionBudgetIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) PodDisruptionBudgetIndexInformer { + return NewTypedPodDisruptionBudgetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewPodDisruptionBudgetInformerWithOptions constructs a new informer for PodDisruptionBudget type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPodDisruptionBudgetInformerWithOptions]). func NewPodDisruptionBudgetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedPodDisruptionBudgetInformerWithOptions(client, namespace, options) +} + +// NewTypedPodDisruptionBudgetInformerWithOptions constructs a new informer for PodDisruptionBudget type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPodDisruptionBudgetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) PodDisruptionBudgetIndexInformer { gvr := schema.GroupVersionResource{Group: "policy", Version: "v1beta1", Resource: "poddisruptionbudgets"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apipolicyv1beta1.PodDisruptionBudget](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewPodDisruptionBudgetInformerWithOptions(client kubernetes.Interface, name Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *podDisruptionBudgetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewPodDisruptionBudgetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedPodDisruptionBudgetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *podDisruptionBudgetInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apipolicyv1beta1.PodDisruptionBudget{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *podDisruptionBudgetInformer) TypedInformer() PodDisruptionBudgetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apipolicyv1beta1.PodDisruptionBudget](f.factory.InformerFor(&apipolicyv1beta1.PodDisruptionBudget{}, f.defaultInformer)) } func (f *podDisruptionBudgetInformer) Lister() policyv1beta1.PodDisruptionBudgetLister { return policyv1beta1.NewPodDisruptionBudgetLister(f.Informer().GetIndexer()) } + +// ToTypedPodDisruptionBudgetInformer converts an untyped informer into a TypedPodDisruptionBudgetInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PodDisruptionBudget. If that is not the case, calling type-safe methods of the returned +// TypedPodDisruptionBudgetInformer leads to runtime panics. A safer alternative is to pass +// around a TypedPodDisruptionBudgetInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedPodDisruptionBudgetInformer(informer PodDisruptionBudgetInformer) TypedPodDisruptionBudgetInformer { + if informer, ok := informer.(TypedPodDisruptionBudgetInformer); ok { + return informer + } + return &podDisruptionBudgetTypedInformerAdapter{informer} +} + +type podDisruptionBudgetTypedInformerAdapter struct { + PodDisruptionBudgetInformer +} + +func (a *podDisruptionBudgetTypedInformerAdapter) TypedInformer() PodDisruptionBudgetIndexInformer { + return cache.NewTypedSharedIndexInformer[*apipolicyv1beta1.PodDisruptionBudget](a.Informer()) +} + +// ToPodDisruptionBudgetIndexInformer converts an untyped informer into a PodDisruptionBudgetIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PodDisruptionBudget. If that is not the case, calling type-safe methods of the returned +// PodDisruptionBudgetIndexInformer leads to runtime panics. A safer alternative is to pass +// around a PodDisruptionBudgetIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToPodDisruptionBudgetIndexInformer(informer cache.SharedIndexInformer) PodDisruptionBudgetIndexInformer { + if informer, ok := informer.(PodDisruptionBudgetIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apipolicyv1beta1.PodDisruptionBudget](informer) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/clusterrole.go b/vendor/k8s.io/client-go/informers/rbac/v1/clusterrole.go index d938be79ee..3c0bc9e125 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1/clusterrole.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1/clusterrole.go @@ -34,12 +34,40 @@ import ( ) // ClusterRoleInformer provides access to a shared informer and lister for -// ClusterRoles. +// ClusterRoles. Prefer using the type-safe variant (see [TypedClusterRoleInformer]). type ClusterRoleInformer interface { Informer() cache.SharedIndexInformer Lister() rbacv1.ClusterRoleLister } +// TypedClusterRoleInformer provides access to a shared informer and lister for +// ClusterRoles, including the type-safe TypedInformer variant. +// It is a superset of ClusterRoleInformer. +type TypedClusterRoleInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ClusterRoleIndexInformer + Lister() rbacv1.ClusterRoleLister +} + +// ClusterRoleIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ClusterRoleIndexInformer cache.TypedSharedIndexInformer[*apirbacv1.ClusterRole] + +// ClusterRoleHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ClusterRole. +type ClusterRoleHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apirbacv1.ClusterRole] + +// ClusterRoleDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ClusterRole. +type ClusterRoleDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apirbacv1.ClusterRole] + +// ClusterRoleFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ClusterRole. +type ClusterRoleFilteringHandler = cache.TypedFilteringResourceEventHandler[*apirbacv1.ClusterRole] + +// ClusterRoleIndexers is a specialization of [cache.TypedIndexers] for ClusterRole. +type ClusterRoleIndexers = cache.TypedIndexers[*apirbacv1.ClusterRole] + +// DeletedClusterRole is a specialization of [cache.DeletedObject] for ClusterRole. +type DeletedClusterRole = cache.DeletedObject[*apirbacv1.ClusterRole] + type clusterRoleInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type clusterRoleInformer struct { // NewClusterRoleInformer constructs a new informer for ClusterRole type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterRoleInformer]). func NewClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ClusterRoleIndexers) ClusterRoleIndexInformer { + return NewTypedClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredClusterRoleInformer constructs a new informer for ClusterRole type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredClusterRoleInformer]). func NewFilteredClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ClusterRoleIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterRoleIndexInformer { + return NewTypedClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewClusterRoleInformerWithOptions constructs a new informer for ClusterRole type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterRoleInformerWithOptions]). func NewClusterRoleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedClusterRoleInformerWithOptions(client, options) +} + +// NewTypedClusterRoleInformerWithOptions constructs a new informer for ClusterRole type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterRoleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ClusterRoleIndexInformer { gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1", Resource: "clusterroles"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apirbacv1.ClusterRole](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewClusterRoleInformerWithOptions(client kubernetes.Interface, options inte Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *clusterRoleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterRoleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apirbacv1.ClusterRole{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *clusterRoleInformer) TypedInformer() ClusterRoleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1.ClusterRole](f.factory.InformerFor(&apirbacv1.ClusterRole{}, f.defaultInformer)) } func (f *clusterRoleInformer) Lister() rbacv1.ClusterRoleLister { return rbacv1.NewClusterRoleLister(f.Informer().GetIndexer()) } + +// ToTypedClusterRoleInformer converts an untyped informer into a TypedClusterRoleInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterRole. If that is not the case, calling type-safe methods of the returned +// TypedClusterRoleInformer leads to runtime panics. A safer alternative is to pass +// around a TypedClusterRoleInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedClusterRoleInformer(informer ClusterRoleInformer) TypedClusterRoleInformer { + if informer, ok := informer.(TypedClusterRoleInformer); ok { + return informer + } + return &clusterRoleTypedInformerAdapter{informer} +} + +type clusterRoleTypedInformerAdapter struct { + ClusterRoleInformer +} + +func (a *clusterRoleTypedInformerAdapter) TypedInformer() ClusterRoleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1.ClusterRole](a.Informer()) +} + +// ToClusterRoleIndexInformer converts an untyped informer into a ClusterRoleIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterRole. If that is not the case, calling type-safe methods of the returned +// ClusterRoleIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ClusterRoleIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToClusterRoleIndexInformer(informer cache.SharedIndexInformer) ClusterRoleIndexInformer { + if informer, ok := informer.(ClusterRoleIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apirbacv1.ClusterRole](informer) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go index 72fe655da8..34dde5197e 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go @@ -34,12 +34,40 @@ import ( ) // ClusterRoleBindingInformer provides access to a shared informer and lister for -// ClusterRoleBindings. +// ClusterRoleBindings. Prefer using the type-safe variant (see [TypedClusterRoleBindingInformer]). type ClusterRoleBindingInformer interface { Informer() cache.SharedIndexInformer Lister() rbacv1.ClusterRoleBindingLister } +// TypedClusterRoleBindingInformer provides access to a shared informer and lister for +// ClusterRoleBindings, including the type-safe TypedInformer variant. +// It is a superset of ClusterRoleBindingInformer. +type TypedClusterRoleBindingInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ClusterRoleBindingIndexInformer + Lister() rbacv1.ClusterRoleBindingLister +} + +// ClusterRoleBindingIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ClusterRoleBindingIndexInformer cache.TypedSharedIndexInformer[*apirbacv1.ClusterRoleBinding] + +// ClusterRoleBindingHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ClusterRoleBinding. +type ClusterRoleBindingHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apirbacv1.ClusterRoleBinding] + +// ClusterRoleBindingDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ClusterRoleBinding. +type ClusterRoleBindingDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apirbacv1.ClusterRoleBinding] + +// ClusterRoleBindingFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ClusterRoleBinding. +type ClusterRoleBindingFilteringHandler = cache.TypedFilteringResourceEventHandler[*apirbacv1.ClusterRoleBinding] + +// ClusterRoleBindingIndexers is a specialization of [cache.TypedIndexers] for ClusterRoleBinding. +type ClusterRoleBindingIndexers = cache.TypedIndexers[*apirbacv1.ClusterRoleBinding] + +// DeletedClusterRoleBinding is a specialization of [cache.DeletedObject] for ClusterRoleBinding. +type DeletedClusterRoleBinding = cache.DeletedObject[*apirbacv1.ClusterRoleBinding] + type clusterRoleBindingInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type clusterRoleBindingInformer struct { // NewClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterRoleBindingInformer]). func NewClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ClusterRoleBindingIndexers) ClusterRoleBindingIndexInformer { + return NewTypedClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredClusterRoleBindingInformer]). func NewFilteredClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ClusterRoleBindingIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterRoleBindingIndexInformer { + return NewTypedClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewClusterRoleBindingInformerWithOptions constructs a new informer for ClusterRoleBinding type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterRoleBindingInformerWithOptions]). func NewClusterRoleBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedClusterRoleBindingInformerWithOptions(client, options) +} + +// NewTypedClusterRoleBindingInformerWithOptions constructs a new informer for ClusterRoleBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterRoleBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ClusterRoleBindingIndexInformer { gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1", Resource: "clusterrolebindings"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apirbacv1.ClusterRoleBinding](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewClusterRoleBindingInformerWithOptions(client kubernetes.Interface, optio Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *clusterRoleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterRoleBindingInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apirbacv1.ClusterRoleBinding{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *clusterRoleBindingInformer) TypedInformer() ClusterRoleBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1.ClusterRoleBinding](f.factory.InformerFor(&apirbacv1.ClusterRoleBinding{}, f.defaultInformer)) } func (f *clusterRoleBindingInformer) Lister() rbacv1.ClusterRoleBindingLister { return rbacv1.NewClusterRoleBindingLister(f.Informer().GetIndexer()) } + +// ToTypedClusterRoleBindingInformer converts an untyped informer into a TypedClusterRoleBindingInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterRoleBinding. If that is not the case, calling type-safe methods of the returned +// TypedClusterRoleBindingInformer leads to runtime panics. A safer alternative is to pass +// around a TypedClusterRoleBindingInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedClusterRoleBindingInformer(informer ClusterRoleBindingInformer) TypedClusterRoleBindingInformer { + if informer, ok := informer.(TypedClusterRoleBindingInformer); ok { + return informer + } + return &clusterRoleBindingTypedInformerAdapter{informer} +} + +type clusterRoleBindingTypedInformerAdapter struct { + ClusterRoleBindingInformer +} + +func (a *clusterRoleBindingTypedInformerAdapter) TypedInformer() ClusterRoleBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1.ClusterRoleBinding](a.Informer()) +} + +// ToClusterRoleBindingIndexInformer converts an untyped informer into a ClusterRoleBindingIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterRoleBinding. If that is not the case, calling type-safe methods of the returned +// ClusterRoleBindingIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ClusterRoleBindingIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToClusterRoleBindingIndexInformer(informer cache.SharedIndexInformer) ClusterRoleBindingIndexInformer { + if informer, ok := informer.(ClusterRoleBindingIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apirbacv1.ClusterRoleBinding](informer) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/interface.go b/vendor/k8s.io/client-go/informers/rbac/v1/interface.go index 7f99c9454b..829564c283 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1/interface.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1/interface.go @@ -25,13 +25,13 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // ClusterRoles returns a ClusterRoleInformer. - ClusterRoles() ClusterRoleInformer + ClusterRoles() TypedClusterRoleInformer // ClusterRoleBindings returns a ClusterRoleBindingInformer. - ClusterRoleBindings() ClusterRoleBindingInformer + ClusterRoleBindings() TypedClusterRoleBindingInformer // Roles returns a RoleInformer. - Roles() RoleInformer + Roles() TypedRoleInformer // RoleBindings returns a RoleBindingInformer. - RoleBindings() RoleBindingInformer + RoleBindings() TypedRoleBindingInformer } type version struct { @@ -45,22 +45,22 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// ClusterRoles returns a ClusterRoleInformer. -func (v *version) ClusterRoles() ClusterRoleInformer { +// ClusterRoles returns a TypedClusterRoleInformer. +func (v *version) ClusterRoles() TypedClusterRoleInformer { return &clusterRoleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// ClusterRoleBindings returns a ClusterRoleBindingInformer. -func (v *version) ClusterRoleBindings() ClusterRoleBindingInformer { +// ClusterRoleBindings returns a TypedClusterRoleBindingInformer. +func (v *version) ClusterRoleBindings() TypedClusterRoleBindingInformer { return &clusterRoleBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// Roles returns a RoleInformer. -func (v *version) Roles() RoleInformer { +// Roles returns a TypedRoleInformer. +func (v *version) Roles() TypedRoleInformer { return &roleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// RoleBindings returns a RoleBindingInformer. -func (v *version) RoleBindings() RoleBindingInformer { +// RoleBindings returns a TypedRoleBindingInformer. +func (v *version) RoleBindings() TypedRoleBindingInformer { return &roleBindingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/role.go b/vendor/k8s.io/client-go/informers/rbac/v1/role.go index f66decf040..0e288582b3 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1/role.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1/role.go @@ -34,12 +34,40 @@ import ( ) // RoleInformer provides access to a shared informer and lister for -// Roles. +// Roles. Prefer using the type-safe variant (see [TypedRoleInformer]). type RoleInformer interface { Informer() cache.SharedIndexInformer Lister() rbacv1.RoleLister } +// TypedRoleInformer provides access to a shared informer and lister for +// Roles, including the type-safe TypedInformer variant. +// It is a superset of RoleInformer. +type TypedRoleInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() RoleIndexInformer + Lister() rbacv1.RoleLister +} + +// RoleIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type RoleIndexInformer cache.TypedSharedIndexInformer[*apirbacv1.Role] + +// RoleHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Role. +type RoleHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apirbacv1.Role] + +// RoleDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Role. +type RoleDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apirbacv1.Role] + +// RoleFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Role. +type RoleFilteringHandler = cache.TypedFilteringResourceEventHandler[*apirbacv1.Role] + +// RoleIndexers is a specialization of [cache.TypedIndexers] for Role. +type RoleIndexers = cache.TypedIndexers[*apirbacv1.Role] + +// DeletedRole is a specialization of [cache.DeletedObject] for Role. +type DeletedRole = cache.DeletedObject[*apirbacv1.Role] + type roleInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type roleInformer struct { // NewRoleInformer constructs a new informer for Role type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedRoleInformer]). func NewRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers RoleIndexers) RoleIndexInformer { + return NewTypedRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredRoleInformer constructs a new informer for Role type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredRoleInformer]). func NewFilteredRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers RoleIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) RoleIndexInformer { + return NewTypedRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewRoleInformerWithOptions constructs a new informer for Role type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedRoleInformerWithOptions]). func NewRoleInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedRoleInformerWithOptions(client, namespace, options) +} + +// NewTypedRoleInformerWithOptions constructs a new informer for Role type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedRoleInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) RoleIndexInformer { gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1", Resource: "roles"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apirbacv1.Role](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewRoleInformerWithOptions(client kubernetes.Interface, namespace string, o Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *roleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewRoleInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedRoleInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *roleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apirbacv1.Role{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *roleInformer) TypedInformer() RoleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1.Role](f.factory.InformerFor(&apirbacv1.Role{}, f.defaultInformer)) } func (f *roleInformer) Lister() rbacv1.RoleLister { return rbacv1.NewRoleLister(f.Informer().GetIndexer()) } + +// ToTypedRoleInformer converts an untyped informer into a TypedRoleInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Role. If that is not the case, calling type-safe methods of the returned +// TypedRoleInformer leads to runtime panics. A safer alternative is to pass +// around a TypedRoleInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedRoleInformer(informer RoleInformer) TypedRoleInformer { + if informer, ok := informer.(TypedRoleInformer); ok { + return informer + } + return &roleTypedInformerAdapter{informer} +} + +type roleTypedInformerAdapter struct { + RoleInformer +} + +func (a *roleTypedInformerAdapter) TypedInformer() RoleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1.Role](a.Informer()) +} + +// ToRoleIndexInformer converts an untyped informer into a RoleIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Role. If that is not the case, calling type-safe methods of the returned +// RoleIndexInformer leads to runtime panics. A safer alternative is to pass +// around a RoleIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToRoleIndexInformer(informer cache.SharedIndexInformer) RoleIndexInformer { + if informer, ok := informer.(RoleIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apirbacv1.Role](informer) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/rolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1/rolebinding.go index c17b1c474f..261a1d03ae 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1/rolebinding.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1/rolebinding.go @@ -34,12 +34,40 @@ import ( ) // RoleBindingInformer provides access to a shared informer and lister for -// RoleBindings. +// RoleBindings. Prefer using the type-safe variant (see [TypedRoleBindingInformer]). type RoleBindingInformer interface { Informer() cache.SharedIndexInformer Lister() rbacv1.RoleBindingLister } +// TypedRoleBindingInformer provides access to a shared informer and lister for +// RoleBindings, including the type-safe TypedInformer variant. +// It is a superset of RoleBindingInformer. +type TypedRoleBindingInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() RoleBindingIndexInformer + Lister() rbacv1.RoleBindingLister +} + +// RoleBindingIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type RoleBindingIndexInformer cache.TypedSharedIndexInformer[*apirbacv1.RoleBinding] + +// RoleBindingHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for RoleBinding. +type RoleBindingHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apirbacv1.RoleBinding] + +// RoleBindingDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for RoleBinding. +type RoleBindingDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apirbacv1.RoleBinding] + +// RoleBindingFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for RoleBinding. +type RoleBindingFilteringHandler = cache.TypedFilteringResourceEventHandler[*apirbacv1.RoleBinding] + +// RoleBindingIndexers is a specialization of [cache.TypedIndexers] for RoleBinding. +type RoleBindingIndexers = cache.TypedIndexers[*apirbacv1.RoleBinding] + +// DeletedRoleBinding is a specialization of [cache.DeletedObject] for RoleBinding. +type DeletedRoleBinding = cache.DeletedObject[*apirbacv1.RoleBinding] + type roleBindingInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type roleBindingInformer struct { // NewRoleBindingInformer constructs a new informer for RoleBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedRoleBindingInformer]). func NewRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers RoleBindingIndexers) RoleBindingIndexInformer { + return NewTypedRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredRoleBindingInformer constructs a new informer for RoleBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredRoleBindingInformer]). func NewFilteredRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers RoleBindingIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) RoleBindingIndexInformer { + return NewTypedRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewRoleBindingInformerWithOptions constructs a new informer for RoleBinding type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedRoleBindingInformerWithOptions]). func NewRoleBindingInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedRoleBindingInformerWithOptions(client, namespace, options) +} + +// NewTypedRoleBindingInformerWithOptions constructs a new informer for RoleBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedRoleBindingInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) RoleBindingIndexInformer { gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1", Resource: "rolebindings"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apirbacv1.RoleBinding](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewRoleBindingInformerWithOptions(client kubernetes.Interface, namespace st Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *roleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewRoleBindingInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedRoleBindingInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *roleBindingInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apirbacv1.RoleBinding{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *roleBindingInformer) TypedInformer() RoleBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1.RoleBinding](f.factory.InformerFor(&apirbacv1.RoleBinding{}, f.defaultInformer)) } func (f *roleBindingInformer) Lister() rbacv1.RoleBindingLister { return rbacv1.NewRoleBindingLister(f.Informer().GetIndexer()) } + +// ToTypedRoleBindingInformer converts an untyped informer into a TypedRoleBindingInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *RoleBinding. If that is not the case, calling type-safe methods of the returned +// TypedRoleBindingInformer leads to runtime panics. A safer alternative is to pass +// around a TypedRoleBindingInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedRoleBindingInformer(informer RoleBindingInformer) TypedRoleBindingInformer { + if informer, ok := informer.(TypedRoleBindingInformer); ok { + return informer + } + return &roleBindingTypedInformerAdapter{informer} +} + +type roleBindingTypedInformerAdapter struct { + RoleBindingInformer +} + +func (a *roleBindingTypedInformerAdapter) TypedInformer() RoleBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1.RoleBinding](a.Informer()) +} + +// ToRoleBindingIndexInformer converts an untyped informer into a RoleBindingIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *RoleBinding. If that is not the case, calling type-safe methods of the returned +// RoleBindingIndexInformer leads to runtime panics. A safer alternative is to pass +// around a RoleBindingIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToRoleBindingIndexInformer(informer cache.SharedIndexInformer) RoleBindingIndexInformer { + if informer, ok := informer.(RoleBindingIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apirbacv1.RoleBinding](informer) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go index cac4ba05b9..2fbc6c2f72 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go @@ -34,12 +34,40 @@ import ( ) // ClusterRoleInformer provides access to a shared informer and lister for -// ClusterRoles. +// ClusterRoles. Prefer using the type-safe variant (see [TypedClusterRoleInformer]). type ClusterRoleInformer interface { Informer() cache.SharedIndexInformer Lister() rbacv1alpha1.ClusterRoleLister } +// TypedClusterRoleInformer provides access to a shared informer and lister for +// ClusterRoles, including the type-safe TypedInformer variant. +// It is a superset of ClusterRoleInformer. +type TypedClusterRoleInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ClusterRoleIndexInformer + Lister() rbacv1alpha1.ClusterRoleLister +} + +// ClusterRoleIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ClusterRoleIndexInformer cache.TypedSharedIndexInformer[*apirbacv1alpha1.ClusterRole] + +// ClusterRoleHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ClusterRole. +type ClusterRoleHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apirbacv1alpha1.ClusterRole] + +// ClusterRoleDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ClusterRole. +type ClusterRoleDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apirbacv1alpha1.ClusterRole] + +// ClusterRoleFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ClusterRole. +type ClusterRoleFilteringHandler = cache.TypedFilteringResourceEventHandler[*apirbacv1alpha1.ClusterRole] + +// ClusterRoleIndexers is a specialization of [cache.TypedIndexers] for ClusterRole. +type ClusterRoleIndexers = cache.TypedIndexers[*apirbacv1alpha1.ClusterRole] + +// DeletedClusterRole is a specialization of [cache.DeletedObject] for ClusterRole. +type DeletedClusterRole = cache.DeletedObject[*apirbacv1alpha1.ClusterRole] + type clusterRoleInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type clusterRoleInformer struct { // NewClusterRoleInformer constructs a new informer for ClusterRole type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterRoleInformer]). func NewClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ClusterRoleIndexers) ClusterRoleIndexInformer { + return NewTypedClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredClusterRoleInformer constructs a new informer for ClusterRole type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredClusterRoleInformer]). func NewFilteredClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ClusterRoleIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterRoleIndexInformer { + return NewTypedClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewClusterRoleInformerWithOptions constructs a new informer for ClusterRole type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterRoleInformerWithOptions]). func NewClusterRoleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedClusterRoleInformerWithOptions(client, options) +} + +// NewTypedClusterRoleInformerWithOptions constructs a new informer for ClusterRole type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterRoleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ClusterRoleIndexInformer { gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "clusterroles"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apirbacv1alpha1.ClusterRole](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewClusterRoleInformerWithOptions(client kubernetes.Interface, options inte Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *clusterRoleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterRoleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apirbacv1alpha1.ClusterRole{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *clusterRoleInformer) TypedInformer() ClusterRoleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1alpha1.ClusterRole](f.factory.InformerFor(&apirbacv1alpha1.ClusterRole{}, f.defaultInformer)) } func (f *clusterRoleInformer) Lister() rbacv1alpha1.ClusterRoleLister { return rbacv1alpha1.NewClusterRoleLister(f.Informer().GetIndexer()) } + +// ToTypedClusterRoleInformer converts an untyped informer into a TypedClusterRoleInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterRole. If that is not the case, calling type-safe methods of the returned +// TypedClusterRoleInformer leads to runtime panics. A safer alternative is to pass +// around a TypedClusterRoleInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedClusterRoleInformer(informer ClusterRoleInformer) TypedClusterRoleInformer { + if informer, ok := informer.(TypedClusterRoleInformer); ok { + return informer + } + return &clusterRoleTypedInformerAdapter{informer} +} + +type clusterRoleTypedInformerAdapter struct { + ClusterRoleInformer +} + +func (a *clusterRoleTypedInformerAdapter) TypedInformer() ClusterRoleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1alpha1.ClusterRole](a.Informer()) +} + +// ToClusterRoleIndexInformer converts an untyped informer into a ClusterRoleIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterRole. If that is not the case, calling type-safe methods of the returned +// ClusterRoleIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ClusterRoleIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToClusterRoleIndexInformer(informer cache.SharedIndexInformer) ClusterRoleIndexInformer { + if informer, ok := informer.(ClusterRoleIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apirbacv1alpha1.ClusterRole](informer) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go index 944e16cef6..1932c1ef4b 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go @@ -34,12 +34,40 @@ import ( ) // ClusterRoleBindingInformer provides access to a shared informer and lister for -// ClusterRoleBindings. +// ClusterRoleBindings. Prefer using the type-safe variant (see [TypedClusterRoleBindingInformer]). type ClusterRoleBindingInformer interface { Informer() cache.SharedIndexInformer Lister() rbacv1alpha1.ClusterRoleBindingLister } +// TypedClusterRoleBindingInformer provides access to a shared informer and lister for +// ClusterRoleBindings, including the type-safe TypedInformer variant. +// It is a superset of ClusterRoleBindingInformer. +type TypedClusterRoleBindingInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ClusterRoleBindingIndexInformer + Lister() rbacv1alpha1.ClusterRoleBindingLister +} + +// ClusterRoleBindingIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ClusterRoleBindingIndexInformer cache.TypedSharedIndexInformer[*apirbacv1alpha1.ClusterRoleBinding] + +// ClusterRoleBindingHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ClusterRoleBinding. +type ClusterRoleBindingHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apirbacv1alpha1.ClusterRoleBinding] + +// ClusterRoleBindingDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ClusterRoleBinding. +type ClusterRoleBindingDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apirbacv1alpha1.ClusterRoleBinding] + +// ClusterRoleBindingFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ClusterRoleBinding. +type ClusterRoleBindingFilteringHandler = cache.TypedFilteringResourceEventHandler[*apirbacv1alpha1.ClusterRoleBinding] + +// ClusterRoleBindingIndexers is a specialization of [cache.TypedIndexers] for ClusterRoleBinding. +type ClusterRoleBindingIndexers = cache.TypedIndexers[*apirbacv1alpha1.ClusterRoleBinding] + +// DeletedClusterRoleBinding is a specialization of [cache.DeletedObject] for ClusterRoleBinding. +type DeletedClusterRoleBinding = cache.DeletedObject[*apirbacv1alpha1.ClusterRoleBinding] + type clusterRoleBindingInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type clusterRoleBindingInformer struct { // NewClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterRoleBindingInformer]). func NewClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ClusterRoleBindingIndexers) ClusterRoleBindingIndexInformer { + return NewTypedClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredClusterRoleBindingInformer]). func NewFilteredClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ClusterRoleBindingIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterRoleBindingIndexInformer { + return NewTypedClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewClusterRoleBindingInformerWithOptions constructs a new informer for ClusterRoleBinding type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterRoleBindingInformerWithOptions]). func NewClusterRoleBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedClusterRoleBindingInformerWithOptions(client, options) +} + +// NewTypedClusterRoleBindingInformerWithOptions constructs a new informer for ClusterRoleBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterRoleBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ClusterRoleBindingIndexInformer { gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "clusterrolebindings"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apirbacv1alpha1.ClusterRoleBinding](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewClusterRoleBindingInformerWithOptions(client kubernetes.Interface, optio Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *clusterRoleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterRoleBindingInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apirbacv1alpha1.ClusterRoleBinding{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *clusterRoleBindingInformer) TypedInformer() ClusterRoleBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1alpha1.ClusterRoleBinding](f.factory.InformerFor(&apirbacv1alpha1.ClusterRoleBinding{}, f.defaultInformer)) } func (f *clusterRoleBindingInformer) Lister() rbacv1alpha1.ClusterRoleBindingLister { return rbacv1alpha1.NewClusterRoleBindingLister(f.Informer().GetIndexer()) } + +// ToTypedClusterRoleBindingInformer converts an untyped informer into a TypedClusterRoleBindingInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterRoleBinding. If that is not the case, calling type-safe methods of the returned +// TypedClusterRoleBindingInformer leads to runtime panics. A safer alternative is to pass +// around a TypedClusterRoleBindingInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedClusterRoleBindingInformer(informer ClusterRoleBindingInformer) TypedClusterRoleBindingInformer { + if informer, ok := informer.(TypedClusterRoleBindingInformer); ok { + return informer + } + return &clusterRoleBindingTypedInformerAdapter{informer} +} + +type clusterRoleBindingTypedInformerAdapter struct { + ClusterRoleBindingInformer +} + +func (a *clusterRoleBindingTypedInformerAdapter) TypedInformer() ClusterRoleBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1alpha1.ClusterRoleBinding](a.Informer()) +} + +// ToClusterRoleBindingIndexInformer converts an untyped informer into a ClusterRoleBindingIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterRoleBinding. If that is not the case, calling type-safe methods of the returned +// ClusterRoleBindingIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ClusterRoleBindingIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToClusterRoleBindingIndexInformer(informer cache.SharedIndexInformer) ClusterRoleBindingIndexInformer { + if informer, ok := informer.(ClusterRoleBindingIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apirbacv1alpha1.ClusterRoleBinding](informer) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/interface.go index d27c79987f..fcfc9d232c 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/interface.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/interface.go @@ -25,13 +25,13 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // ClusterRoles returns a ClusterRoleInformer. - ClusterRoles() ClusterRoleInformer + ClusterRoles() TypedClusterRoleInformer // ClusterRoleBindings returns a ClusterRoleBindingInformer. - ClusterRoleBindings() ClusterRoleBindingInformer + ClusterRoleBindings() TypedClusterRoleBindingInformer // Roles returns a RoleInformer. - Roles() RoleInformer + Roles() TypedRoleInformer // RoleBindings returns a RoleBindingInformer. - RoleBindings() RoleBindingInformer + RoleBindings() TypedRoleBindingInformer } type version struct { @@ -45,22 +45,22 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// ClusterRoles returns a ClusterRoleInformer. -func (v *version) ClusterRoles() ClusterRoleInformer { +// ClusterRoles returns a TypedClusterRoleInformer. +func (v *version) ClusterRoles() TypedClusterRoleInformer { return &clusterRoleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// ClusterRoleBindings returns a ClusterRoleBindingInformer. -func (v *version) ClusterRoleBindings() ClusterRoleBindingInformer { +// ClusterRoleBindings returns a TypedClusterRoleBindingInformer. +func (v *version) ClusterRoleBindings() TypedClusterRoleBindingInformer { return &clusterRoleBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// Roles returns a RoleInformer. -func (v *version) Roles() RoleInformer { +// Roles returns a TypedRoleInformer. +func (v *version) Roles() TypedRoleInformer { return &roleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// RoleBindings returns a RoleBindingInformer. -func (v *version) RoleBindings() RoleBindingInformer { +// RoleBindings returns a TypedRoleBindingInformer. +func (v *version) RoleBindings() TypedRoleBindingInformer { return &roleBindingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/role.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/role.go index c4e2a6cf6c..f50036840c 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/role.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/role.go @@ -34,12 +34,40 @@ import ( ) // RoleInformer provides access to a shared informer and lister for -// Roles. +// Roles. Prefer using the type-safe variant (see [TypedRoleInformer]). type RoleInformer interface { Informer() cache.SharedIndexInformer Lister() rbacv1alpha1.RoleLister } +// TypedRoleInformer provides access to a shared informer and lister for +// Roles, including the type-safe TypedInformer variant. +// It is a superset of RoleInformer. +type TypedRoleInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() RoleIndexInformer + Lister() rbacv1alpha1.RoleLister +} + +// RoleIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type RoleIndexInformer cache.TypedSharedIndexInformer[*apirbacv1alpha1.Role] + +// RoleHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Role. +type RoleHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apirbacv1alpha1.Role] + +// RoleDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Role. +type RoleDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apirbacv1alpha1.Role] + +// RoleFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Role. +type RoleFilteringHandler = cache.TypedFilteringResourceEventHandler[*apirbacv1alpha1.Role] + +// RoleIndexers is a specialization of [cache.TypedIndexers] for Role. +type RoleIndexers = cache.TypedIndexers[*apirbacv1alpha1.Role] + +// DeletedRole is a specialization of [cache.DeletedObject] for Role. +type DeletedRole = cache.DeletedObject[*apirbacv1alpha1.Role] + type roleInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type roleInformer struct { // NewRoleInformer constructs a new informer for Role type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedRoleInformer]). func NewRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers RoleIndexers) RoleIndexInformer { + return NewTypedRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredRoleInformer constructs a new informer for Role type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredRoleInformer]). func NewFilteredRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers RoleIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) RoleIndexInformer { + return NewTypedRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewRoleInformerWithOptions constructs a new informer for Role type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedRoleInformerWithOptions]). func NewRoleInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedRoleInformerWithOptions(client, namespace, options) +} + +// NewTypedRoleInformerWithOptions constructs a new informer for Role type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedRoleInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) RoleIndexInformer { gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "roles"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apirbacv1alpha1.Role](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewRoleInformerWithOptions(client kubernetes.Interface, namespace string, o Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *roleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewRoleInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedRoleInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *roleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apirbacv1alpha1.Role{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *roleInformer) TypedInformer() RoleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1alpha1.Role](f.factory.InformerFor(&apirbacv1alpha1.Role{}, f.defaultInformer)) } func (f *roleInformer) Lister() rbacv1alpha1.RoleLister { return rbacv1alpha1.NewRoleLister(f.Informer().GetIndexer()) } + +// ToTypedRoleInformer converts an untyped informer into a TypedRoleInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Role. If that is not the case, calling type-safe methods of the returned +// TypedRoleInformer leads to runtime panics. A safer alternative is to pass +// around a TypedRoleInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedRoleInformer(informer RoleInformer) TypedRoleInformer { + if informer, ok := informer.(TypedRoleInformer); ok { + return informer + } + return &roleTypedInformerAdapter{informer} +} + +type roleTypedInformerAdapter struct { + RoleInformer +} + +func (a *roleTypedInformerAdapter) TypedInformer() RoleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1alpha1.Role](a.Informer()) +} + +// ToRoleIndexInformer converts an untyped informer into a RoleIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Role. If that is not the case, calling type-safe methods of the returned +// RoleIndexInformer leads to runtime panics. A safer alternative is to pass +// around a RoleIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToRoleIndexInformer(informer cache.SharedIndexInformer) RoleIndexInformer { + if informer, ok := informer.(RoleIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apirbacv1alpha1.Role](informer) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go index ef1e246f5b..64b5b257fb 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go @@ -34,12 +34,40 @@ import ( ) // RoleBindingInformer provides access to a shared informer and lister for -// RoleBindings. +// RoleBindings. Prefer using the type-safe variant (see [TypedRoleBindingInformer]). type RoleBindingInformer interface { Informer() cache.SharedIndexInformer Lister() rbacv1alpha1.RoleBindingLister } +// TypedRoleBindingInformer provides access to a shared informer and lister for +// RoleBindings, including the type-safe TypedInformer variant. +// It is a superset of RoleBindingInformer. +type TypedRoleBindingInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() RoleBindingIndexInformer + Lister() rbacv1alpha1.RoleBindingLister +} + +// RoleBindingIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type RoleBindingIndexInformer cache.TypedSharedIndexInformer[*apirbacv1alpha1.RoleBinding] + +// RoleBindingHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for RoleBinding. +type RoleBindingHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apirbacv1alpha1.RoleBinding] + +// RoleBindingDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for RoleBinding. +type RoleBindingDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apirbacv1alpha1.RoleBinding] + +// RoleBindingFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for RoleBinding. +type RoleBindingFilteringHandler = cache.TypedFilteringResourceEventHandler[*apirbacv1alpha1.RoleBinding] + +// RoleBindingIndexers is a specialization of [cache.TypedIndexers] for RoleBinding. +type RoleBindingIndexers = cache.TypedIndexers[*apirbacv1alpha1.RoleBinding] + +// DeletedRoleBinding is a specialization of [cache.DeletedObject] for RoleBinding. +type DeletedRoleBinding = cache.DeletedObject[*apirbacv1alpha1.RoleBinding] + type roleBindingInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type roleBindingInformer struct { // NewRoleBindingInformer constructs a new informer for RoleBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedRoleBindingInformer]). func NewRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers RoleBindingIndexers) RoleBindingIndexInformer { + return NewTypedRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredRoleBindingInformer constructs a new informer for RoleBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredRoleBindingInformer]). func NewFilteredRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers RoleBindingIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) RoleBindingIndexInformer { + return NewTypedRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewRoleBindingInformerWithOptions constructs a new informer for RoleBinding type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedRoleBindingInformerWithOptions]). func NewRoleBindingInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedRoleBindingInformerWithOptions(client, namespace, options) +} + +// NewTypedRoleBindingInformerWithOptions constructs a new informer for RoleBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedRoleBindingInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) RoleBindingIndexInformer { gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "rolebindings"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apirbacv1alpha1.RoleBinding](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewRoleBindingInformerWithOptions(client kubernetes.Interface, namespace st Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *roleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewRoleBindingInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedRoleBindingInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *roleBindingInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apirbacv1alpha1.RoleBinding{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *roleBindingInformer) TypedInformer() RoleBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1alpha1.RoleBinding](f.factory.InformerFor(&apirbacv1alpha1.RoleBinding{}, f.defaultInformer)) } func (f *roleBindingInformer) Lister() rbacv1alpha1.RoleBindingLister { return rbacv1alpha1.NewRoleBindingLister(f.Informer().GetIndexer()) } + +// ToTypedRoleBindingInformer converts an untyped informer into a TypedRoleBindingInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *RoleBinding. If that is not the case, calling type-safe methods of the returned +// TypedRoleBindingInformer leads to runtime panics. A safer alternative is to pass +// around a TypedRoleBindingInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedRoleBindingInformer(informer RoleBindingInformer) TypedRoleBindingInformer { + if informer, ok := informer.(TypedRoleBindingInformer); ok { + return informer + } + return &roleBindingTypedInformerAdapter{informer} +} + +type roleBindingTypedInformerAdapter struct { + RoleBindingInformer +} + +func (a *roleBindingTypedInformerAdapter) TypedInformer() RoleBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1alpha1.RoleBinding](a.Informer()) +} + +// ToRoleBindingIndexInformer converts an untyped informer into a RoleBindingIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *RoleBinding. If that is not the case, calling type-safe methods of the returned +// RoleBindingIndexInformer leads to runtime panics. A safer alternative is to pass +// around a RoleBindingIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToRoleBindingIndexInformer(informer cache.SharedIndexInformer) RoleBindingIndexInformer { + if informer, ok := informer.(RoleBindingIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apirbacv1alpha1.RoleBinding](informer) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go index df87d468ca..20261642d4 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go @@ -34,12 +34,40 @@ import ( ) // ClusterRoleInformer provides access to a shared informer and lister for -// ClusterRoles. +// ClusterRoles. Prefer using the type-safe variant (see [TypedClusterRoleInformer]). type ClusterRoleInformer interface { Informer() cache.SharedIndexInformer Lister() rbacv1beta1.ClusterRoleLister } +// TypedClusterRoleInformer provides access to a shared informer and lister for +// ClusterRoles, including the type-safe TypedInformer variant. +// It is a superset of ClusterRoleInformer. +type TypedClusterRoleInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ClusterRoleIndexInformer + Lister() rbacv1beta1.ClusterRoleLister +} + +// ClusterRoleIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ClusterRoleIndexInformer cache.TypedSharedIndexInformer[*apirbacv1beta1.ClusterRole] + +// ClusterRoleHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ClusterRole. +type ClusterRoleHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apirbacv1beta1.ClusterRole] + +// ClusterRoleDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ClusterRole. +type ClusterRoleDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apirbacv1beta1.ClusterRole] + +// ClusterRoleFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ClusterRole. +type ClusterRoleFilteringHandler = cache.TypedFilteringResourceEventHandler[*apirbacv1beta1.ClusterRole] + +// ClusterRoleIndexers is a specialization of [cache.TypedIndexers] for ClusterRole. +type ClusterRoleIndexers = cache.TypedIndexers[*apirbacv1beta1.ClusterRole] + +// DeletedClusterRole is a specialization of [cache.DeletedObject] for ClusterRole. +type DeletedClusterRole = cache.DeletedObject[*apirbacv1beta1.ClusterRole] + type clusterRoleInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type clusterRoleInformer struct { // NewClusterRoleInformer constructs a new informer for ClusterRole type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterRoleInformer]). func NewClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ClusterRoleIndexers) ClusterRoleIndexInformer { + return NewTypedClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredClusterRoleInformer constructs a new informer for ClusterRole type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredClusterRoleInformer]). func NewFilteredClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ClusterRoleIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterRoleIndexInformer { + return NewTypedClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewClusterRoleInformerWithOptions constructs a new informer for ClusterRole type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterRoleInformerWithOptions]). func NewClusterRoleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedClusterRoleInformerWithOptions(client, options) +} + +// NewTypedClusterRoleInformerWithOptions constructs a new informer for ClusterRole type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterRoleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ClusterRoleIndexInformer { gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Resource: "clusterroles"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apirbacv1beta1.ClusterRole](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewClusterRoleInformerWithOptions(client kubernetes.Interface, options inte Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *clusterRoleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterRoleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apirbacv1beta1.ClusterRole{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *clusterRoleInformer) TypedInformer() ClusterRoleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1beta1.ClusterRole](f.factory.InformerFor(&apirbacv1beta1.ClusterRole{}, f.defaultInformer)) } func (f *clusterRoleInformer) Lister() rbacv1beta1.ClusterRoleLister { return rbacv1beta1.NewClusterRoleLister(f.Informer().GetIndexer()) } + +// ToTypedClusterRoleInformer converts an untyped informer into a TypedClusterRoleInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterRole. If that is not the case, calling type-safe methods of the returned +// TypedClusterRoleInformer leads to runtime panics. A safer alternative is to pass +// around a TypedClusterRoleInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedClusterRoleInformer(informer ClusterRoleInformer) TypedClusterRoleInformer { + if informer, ok := informer.(TypedClusterRoleInformer); ok { + return informer + } + return &clusterRoleTypedInformerAdapter{informer} +} + +type clusterRoleTypedInformerAdapter struct { + ClusterRoleInformer +} + +func (a *clusterRoleTypedInformerAdapter) TypedInformer() ClusterRoleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1beta1.ClusterRole](a.Informer()) +} + +// ToClusterRoleIndexInformer converts an untyped informer into a ClusterRoleIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterRole. If that is not the case, calling type-safe methods of the returned +// ClusterRoleIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ClusterRoleIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToClusterRoleIndexInformer(informer cache.SharedIndexInformer) ClusterRoleIndexInformer { + if informer, ok := informer.(ClusterRoleIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apirbacv1beta1.ClusterRole](informer) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go index 9f14c10daf..a454f0c643 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go @@ -34,12 +34,40 @@ import ( ) // ClusterRoleBindingInformer provides access to a shared informer and lister for -// ClusterRoleBindings. +// ClusterRoleBindings. Prefer using the type-safe variant (see [TypedClusterRoleBindingInformer]). type ClusterRoleBindingInformer interface { Informer() cache.SharedIndexInformer Lister() rbacv1beta1.ClusterRoleBindingLister } +// TypedClusterRoleBindingInformer provides access to a shared informer and lister for +// ClusterRoleBindings, including the type-safe TypedInformer variant. +// It is a superset of ClusterRoleBindingInformer. +type TypedClusterRoleBindingInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ClusterRoleBindingIndexInformer + Lister() rbacv1beta1.ClusterRoleBindingLister +} + +// ClusterRoleBindingIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ClusterRoleBindingIndexInformer cache.TypedSharedIndexInformer[*apirbacv1beta1.ClusterRoleBinding] + +// ClusterRoleBindingHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ClusterRoleBinding. +type ClusterRoleBindingHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apirbacv1beta1.ClusterRoleBinding] + +// ClusterRoleBindingDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ClusterRoleBinding. +type ClusterRoleBindingDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apirbacv1beta1.ClusterRoleBinding] + +// ClusterRoleBindingFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ClusterRoleBinding. +type ClusterRoleBindingFilteringHandler = cache.TypedFilteringResourceEventHandler[*apirbacv1beta1.ClusterRoleBinding] + +// ClusterRoleBindingIndexers is a specialization of [cache.TypedIndexers] for ClusterRoleBinding. +type ClusterRoleBindingIndexers = cache.TypedIndexers[*apirbacv1beta1.ClusterRoleBinding] + +// DeletedClusterRoleBinding is a specialization of [cache.DeletedObject] for ClusterRoleBinding. +type DeletedClusterRoleBinding = cache.DeletedObject[*apirbacv1beta1.ClusterRoleBinding] + type clusterRoleBindingInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type clusterRoleBindingInformer struct { // NewClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterRoleBindingInformer]). func NewClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ClusterRoleBindingIndexers) ClusterRoleBindingIndexInformer { + return NewTypedClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredClusterRoleBindingInformer]). func NewFilteredClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ClusterRoleBindingIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterRoleBindingIndexInformer { + return NewTypedClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewClusterRoleBindingInformerWithOptions constructs a new informer for ClusterRoleBinding type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterRoleBindingInformerWithOptions]). func NewClusterRoleBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedClusterRoleBindingInformerWithOptions(client, options) +} + +// NewTypedClusterRoleBindingInformerWithOptions constructs a new informer for ClusterRoleBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterRoleBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ClusterRoleBindingIndexInformer { gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Resource: "clusterrolebindings"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apirbacv1beta1.ClusterRoleBinding](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewClusterRoleBindingInformerWithOptions(client kubernetes.Interface, optio Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *clusterRoleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterRoleBindingInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apirbacv1beta1.ClusterRoleBinding{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *clusterRoleBindingInformer) TypedInformer() ClusterRoleBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1beta1.ClusterRoleBinding](f.factory.InformerFor(&apirbacv1beta1.ClusterRoleBinding{}, f.defaultInformer)) } func (f *clusterRoleBindingInformer) Lister() rbacv1beta1.ClusterRoleBindingLister { return rbacv1beta1.NewClusterRoleBindingLister(f.Informer().GetIndexer()) } + +// ToTypedClusterRoleBindingInformer converts an untyped informer into a TypedClusterRoleBindingInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterRoleBinding. If that is not the case, calling type-safe methods of the returned +// TypedClusterRoleBindingInformer leads to runtime panics. A safer alternative is to pass +// around a TypedClusterRoleBindingInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedClusterRoleBindingInformer(informer ClusterRoleBindingInformer) TypedClusterRoleBindingInformer { + if informer, ok := informer.(TypedClusterRoleBindingInformer); ok { + return informer + } + return &clusterRoleBindingTypedInformerAdapter{informer} +} + +type clusterRoleBindingTypedInformerAdapter struct { + ClusterRoleBindingInformer +} + +func (a *clusterRoleBindingTypedInformerAdapter) TypedInformer() ClusterRoleBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1beta1.ClusterRoleBinding](a.Informer()) +} + +// ToClusterRoleBindingIndexInformer converts an untyped informer into a ClusterRoleBindingIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterRoleBinding. If that is not the case, calling type-safe methods of the returned +// ClusterRoleBindingIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ClusterRoleBindingIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToClusterRoleBindingIndexInformer(informer cache.SharedIndexInformer) ClusterRoleBindingIndexInformer { + if informer, ok := informer.(ClusterRoleBindingIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apirbacv1beta1.ClusterRoleBinding](informer) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/interface.go index 04add43afa..af356b40e2 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1beta1/interface.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/interface.go @@ -25,13 +25,13 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // ClusterRoles returns a ClusterRoleInformer. - ClusterRoles() ClusterRoleInformer + ClusterRoles() TypedClusterRoleInformer // ClusterRoleBindings returns a ClusterRoleBindingInformer. - ClusterRoleBindings() ClusterRoleBindingInformer + ClusterRoleBindings() TypedClusterRoleBindingInformer // Roles returns a RoleInformer. - Roles() RoleInformer + Roles() TypedRoleInformer // RoleBindings returns a RoleBindingInformer. - RoleBindings() RoleBindingInformer + RoleBindings() TypedRoleBindingInformer } type version struct { @@ -45,22 +45,22 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// ClusterRoles returns a ClusterRoleInformer. -func (v *version) ClusterRoles() ClusterRoleInformer { +// ClusterRoles returns a TypedClusterRoleInformer. +func (v *version) ClusterRoles() TypedClusterRoleInformer { return &clusterRoleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// ClusterRoleBindings returns a ClusterRoleBindingInformer. -func (v *version) ClusterRoleBindings() ClusterRoleBindingInformer { +// ClusterRoleBindings returns a TypedClusterRoleBindingInformer. +func (v *version) ClusterRoleBindings() TypedClusterRoleBindingInformer { return &clusterRoleBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// Roles returns a RoleInformer. -func (v *version) Roles() RoleInformer { +// Roles returns a TypedRoleInformer. +func (v *version) Roles() TypedRoleInformer { return &roleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// RoleBindings returns a RoleBindingInformer. -func (v *version) RoleBindings() RoleBindingInformer { +// RoleBindings returns a TypedRoleBindingInformer. +func (v *version) RoleBindings() TypedRoleBindingInformer { return &roleBindingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/role.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/role.go index 4dd948f167..fe0d4acf9a 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1beta1/role.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/role.go @@ -34,12 +34,40 @@ import ( ) // RoleInformer provides access to a shared informer and lister for -// Roles. +// Roles. Prefer using the type-safe variant (see [TypedRoleInformer]). type RoleInformer interface { Informer() cache.SharedIndexInformer Lister() rbacv1beta1.RoleLister } +// TypedRoleInformer provides access to a shared informer and lister for +// Roles, including the type-safe TypedInformer variant. +// It is a superset of RoleInformer. +type TypedRoleInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() RoleIndexInformer + Lister() rbacv1beta1.RoleLister +} + +// RoleIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type RoleIndexInformer cache.TypedSharedIndexInformer[*apirbacv1beta1.Role] + +// RoleHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Role. +type RoleHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apirbacv1beta1.Role] + +// RoleDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Role. +type RoleDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apirbacv1beta1.Role] + +// RoleFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Role. +type RoleFilteringHandler = cache.TypedFilteringResourceEventHandler[*apirbacv1beta1.Role] + +// RoleIndexers is a specialization of [cache.TypedIndexers] for Role. +type RoleIndexers = cache.TypedIndexers[*apirbacv1beta1.Role] + +// DeletedRole is a specialization of [cache.DeletedObject] for Role. +type DeletedRole = cache.DeletedObject[*apirbacv1beta1.Role] + type roleInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type roleInformer struct { // NewRoleInformer constructs a new informer for Role type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedRoleInformer]). func NewRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers RoleIndexers) RoleIndexInformer { + return NewTypedRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredRoleInformer constructs a new informer for Role type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredRoleInformer]). func NewFilteredRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers RoleIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) RoleIndexInformer { + return NewTypedRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewRoleInformerWithOptions constructs a new informer for Role type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedRoleInformerWithOptions]). func NewRoleInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedRoleInformerWithOptions(client, namespace, options) +} + +// NewTypedRoleInformerWithOptions constructs a new informer for Role type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedRoleInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) RoleIndexInformer { gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Resource: "roles"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apirbacv1beta1.Role](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewRoleInformerWithOptions(client kubernetes.Interface, namespace string, o Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *roleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewRoleInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedRoleInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *roleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apirbacv1beta1.Role{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *roleInformer) TypedInformer() RoleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1beta1.Role](f.factory.InformerFor(&apirbacv1beta1.Role{}, f.defaultInformer)) } func (f *roleInformer) Lister() rbacv1beta1.RoleLister { return rbacv1beta1.NewRoleLister(f.Informer().GetIndexer()) } + +// ToTypedRoleInformer converts an untyped informer into a TypedRoleInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Role. If that is not the case, calling type-safe methods of the returned +// TypedRoleInformer leads to runtime panics. A safer alternative is to pass +// around a TypedRoleInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedRoleInformer(informer RoleInformer) TypedRoleInformer { + if informer, ok := informer.(TypedRoleInformer); ok { + return informer + } + return &roleTypedInformerAdapter{informer} +} + +type roleTypedInformerAdapter struct { + RoleInformer +} + +func (a *roleTypedInformerAdapter) TypedInformer() RoleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1beta1.Role](a.Informer()) +} + +// ToRoleIndexInformer converts an untyped informer into a RoleIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Role. If that is not the case, calling type-safe methods of the returned +// RoleIndexInformer leads to runtime panics. A safer alternative is to pass +// around a RoleIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToRoleIndexInformer(informer cache.SharedIndexInformer) RoleIndexInformer { + if informer, ok := informer.(RoleIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apirbacv1beta1.Role](informer) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go index 882d59471e..dc92e5433c 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go @@ -34,12 +34,40 @@ import ( ) // RoleBindingInformer provides access to a shared informer and lister for -// RoleBindings. +// RoleBindings. Prefer using the type-safe variant (see [TypedRoleBindingInformer]). type RoleBindingInformer interface { Informer() cache.SharedIndexInformer Lister() rbacv1beta1.RoleBindingLister } +// TypedRoleBindingInformer provides access to a shared informer and lister for +// RoleBindings, including the type-safe TypedInformer variant. +// It is a superset of RoleBindingInformer. +type TypedRoleBindingInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() RoleBindingIndexInformer + Lister() rbacv1beta1.RoleBindingLister +} + +// RoleBindingIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type RoleBindingIndexInformer cache.TypedSharedIndexInformer[*apirbacv1beta1.RoleBinding] + +// RoleBindingHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for RoleBinding. +type RoleBindingHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apirbacv1beta1.RoleBinding] + +// RoleBindingDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for RoleBinding. +type RoleBindingDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apirbacv1beta1.RoleBinding] + +// RoleBindingFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for RoleBinding. +type RoleBindingFilteringHandler = cache.TypedFilteringResourceEventHandler[*apirbacv1beta1.RoleBinding] + +// RoleBindingIndexers is a specialization of [cache.TypedIndexers] for RoleBinding. +type RoleBindingIndexers = cache.TypedIndexers[*apirbacv1beta1.RoleBinding] + +// DeletedRoleBinding is a specialization of [cache.DeletedObject] for RoleBinding. +type DeletedRoleBinding = cache.DeletedObject[*apirbacv1beta1.RoleBinding] + type roleBindingInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type roleBindingInformer struct { // NewRoleBindingInformer constructs a new informer for RoleBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedRoleBindingInformer]). func NewRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers RoleBindingIndexers) RoleBindingIndexInformer { + return NewTypedRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredRoleBindingInformer constructs a new informer for RoleBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredRoleBindingInformer]). func NewFilteredRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers RoleBindingIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) RoleBindingIndexInformer { + return NewTypedRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewRoleBindingInformerWithOptions constructs a new informer for RoleBinding type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedRoleBindingInformerWithOptions]). func NewRoleBindingInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedRoleBindingInformerWithOptions(client, namespace, options) +} + +// NewTypedRoleBindingInformerWithOptions constructs a new informer for RoleBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedRoleBindingInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) RoleBindingIndexInformer { gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Resource: "rolebindings"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apirbacv1beta1.RoleBinding](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewRoleBindingInformerWithOptions(client kubernetes.Interface, namespace st Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *roleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewRoleBindingInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedRoleBindingInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *roleBindingInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apirbacv1beta1.RoleBinding{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *roleBindingInformer) TypedInformer() RoleBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1beta1.RoleBinding](f.factory.InformerFor(&apirbacv1beta1.RoleBinding{}, f.defaultInformer)) } func (f *roleBindingInformer) Lister() rbacv1beta1.RoleBindingLister { return rbacv1beta1.NewRoleBindingLister(f.Informer().GetIndexer()) } + +// ToTypedRoleBindingInformer converts an untyped informer into a TypedRoleBindingInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *RoleBinding. If that is not the case, calling type-safe methods of the returned +// TypedRoleBindingInformer leads to runtime panics. A safer alternative is to pass +// around a TypedRoleBindingInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedRoleBindingInformer(informer RoleBindingInformer) TypedRoleBindingInformer { + if informer, ok := informer.(TypedRoleBindingInformer); ok { + return informer + } + return &roleBindingTypedInformerAdapter{informer} +} + +type roleBindingTypedInformerAdapter struct { + RoleBindingInformer +} + +func (a *roleBindingTypedInformerAdapter) TypedInformer() RoleBindingIndexInformer { + return cache.NewTypedSharedIndexInformer[*apirbacv1beta1.RoleBinding](a.Informer()) +} + +// ToRoleBindingIndexInformer converts an untyped informer into a RoleBindingIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *RoleBinding. If that is not the case, calling type-safe methods of the returned +// RoleBindingIndexInformer leads to runtime panics. A safer alternative is to pass +// around a RoleBindingIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToRoleBindingIndexInformer(informer cache.SharedIndexInformer) RoleBindingIndexInformer { + if informer, ok := informer.(RoleBindingIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apirbacv1beta1.RoleBinding](informer) +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1/deviceclass.go b/vendor/k8s.io/client-go/informers/resource/v1/deviceclass.go index bacc65a28f..807a8f946b 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1/deviceclass.go +++ b/vendor/k8s.io/client-go/informers/resource/v1/deviceclass.go @@ -34,12 +34,40 @@ import ( ) // DeviceClassInformer provides access to a shared informer and lister for -// DeviceClasses. +// DeviceClasses. Prefer using the type-safe variant (see [TypedDeviceClassInformer]). type DeviceClassInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1.DeviceClassLister } +// TypedDeviceClassInformer provides access to a shared informer and lister for +// DeviceClasses, including the type-safe TypedInformer variant. +// It is a superset of DeviceClassInformer. +type TypedDeviceClassInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() DeviceClassIndexInformer + Lister() resourcev1.DeviceClassLister +} + +// DeviceClassIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type DeviceClassIndexInformer cache.TypedSharedIndexInformer[*apiresourcev1.DeviceClass] + +// DeviceClassHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for DeviceClass. +type DeviceClassHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiresourcev1.DeviceClass] + +// DeviceClassDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for DeviceClass. +type DeviceClassDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiresourcev1.DeviceClass] + +// DeviceClassFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for DeviceClass. +type DeviceClassFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiresourcev1.DeviceClass] + +// DeviceClassIndexers is a specialization of [cache.TypedIndexers] for DeviceClass. +type DeviceClassIndexers = cache.TypedIndexers[*apiresourcev1.DeviceClass] + +// DeletedDeviceClass is a specialization of [cache.DeletedObject] for DeviceClass. +type DeletedDeviceClass = cache.DeletedObject[*apiresourcev1.DeviceClass] + type deviceClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type deviceClassInformer struct { // NewDeviceClassInformer constructs a new informer for DeviceClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeviceClassInformer]). func NewDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedDeviceClassInformer constructs a new informer for DeviceClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers DeviceClassIndexers) DeviceClassIndexInformer { + return NewTypedDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredDeviceClassInformer constructs a new informer for DeviceClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredDeviceClassInformer]). func NewFilteredDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredDeviceClassInformer constructs a new informer for DeviceClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers DeviceClassIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) DeviceClassIndexInformer { + return NewTypedDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewDeviceClassInformerWithOptions constructs a new informer for DeviceClass type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeviceClassInformerWithOptions]). func NewDeviceClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedDeviceClassInformerWithOptions(client, options) +} + +// NewTypedDeviceClassInformerWithOptions constructs a new informer for DeviceClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeviceClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) DeviceClassIndexInformer { gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1", Resource: "deviceclasss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiresourcev1.DeviceClass](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewDeviceClassInformerWithOptions(client kubernetes.Interface, options inte Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *deviceClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *deviceClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1.DeviceClass{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *deviceClassInformer) TypedInformer() DeviceClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1.DeviceClass](f.factory.InformerFor(&apiresourcev1.DeviceClass{}, f.defaultInformer)) } func (f *deviceClassInformer) Lister() resourcev1.DeviceClassLister { return resourcev1.NewDeviceClassLister(f.Informer().GetIndexer()) } + +// ToTypedDeviceClassInformer converts an untyped informer into a TypedDeviceClassInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *DeviceClass. If that is not the case, calling type-safe methods of the returned +// TypedDeviceClassInformer leads to runtime panics. A safer alternative is to pass +// around a TypedDeviceClassInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedDeviceClassInformer(informer DeviceClassInformer) TypedDeviceClassInformer { + if informer, ok := informer.(TypedDeviceClassInformer); ok { + return informer + } + return &deviceClassTypedInformerAdapter{informer} +} + +type deviceClassTypedInformerAdapter struct { + DeviceClassInformer +} + +func (a *deviceClassTypedInformerAdapter) TypedInformer() DeviceClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1.DeviceClass](a.Informer()) +} + +// ToDeviceClassIndexInformer converts an untyped informer into a DeviceClassIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *DeviceClass. If that is not the case, calling type-safe methods of the returned +// DeviceClassIndexInformer leads to runtime panics. A safer alternative is to pass +// around a DeviceClassIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToDeviceClassIndexInformer(informer cache.SharedIndexInformer) DeviceClassIndexInformer { + if informer, ok := informer.(DeviceClassIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiresourcev1.DeviceClass](informer) +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1/devicetaintrule.go b/vendor/k8s.io/client-go/informers/resource/v1/devicetaintrule.go new file mode 100644 index 0000000000..c0776f5fb8 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/resource/v1/devicetaintrule.go @@ -0,0 +1,207 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + time "time" + + apiresourcev1 "k8s.io/api/resource/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + resourcev1 "k8s.io/client-go/listers/resource/v1" + cache "k8s.io/client-go/tools/cache" +) + +// DeviceTaintRuleInformer provides access to a shared informer and lister for +// DeviceTaintRules. Prefer using the type-safe variant (see [TypedDeviceTaintRuleInformer]). +type DeviceTaintRuleInformer interface { + Informer() cache.SharedIndexInformer + Lister() resourcev1.DeviceTaintRuleLister +} + +// TypedDeviceTaintRuleInformer provides access to a shared informer and lister for +// DeviceTaintRules, including the type-safe TypedInformer variant. +// It is a superset of DeviceTaintRuleInformer. +type TypedDeviceTaintRuleInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() DeviceTaintRuleIndexInformer + Lister() resourcev1.DeviceTaintRuleLister +} + +// DeviceTaintRuleIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type DeviceTaintRuleIndexInformer cache.TypedSharedIndexInformer[*apiresourcev1.DeviceTaintRule] + +// DeviceTaintRuleHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for DeviceTaintRule. +type DeviceTaintRuleHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiresourcev1.DeviceTaintRule] + +// DeviceTaintRuleDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for DeviceTaintRule. +type DeviceTaintRuleDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiresourcev1.DeviceTaintRule] + +// DeviceTaintRuleFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for DeviceTaintRule. +type DeviceTaintRuleFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiresourcev1.DeviceTaintRule] + +// DeviceTaintRuleIndexers is a specialization of [cache.TypedIndexers] for DeviceTaintRule. +type DeviceTaintRuleIndexers = cache.TypedIndexers[*apiresourcev1.DeviceTaintRule] + +// DeletedDeviceTaintRule is a specialization of [cache.DeletedObject] for DeviceTaintRule. +type DeletedDeviceTaintRule = cache.DeletedObject[*apiresourcev1.DeviceTaintRule] + +type deviceTaintRuleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewDeviceTaintRuleInformer constructs a new informer for DeviceTaintRule type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeviceTaintRuleInformer]). +func NewDeviceTaintRuleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewTypedDeviceTaintRuleInformer constructs a new informer for DeviceTaintRule type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeviceTaintRuleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers DeviceTaintRuleIndexers) DeviceTaintRuleIndexInformer { + return NewTypedDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + +// NewFilteredDeviceTaintRuleInformer constructs a new informer for DeviceTaintRule type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredDeviceTaintRuleInformer]). +func NewFilteredDeviceTaintRuleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewTypedDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredDeviceTaintRuleInformer constructs a new informer for DeviceTaintRule type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredDeviceTaintRuleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers DeviceTaintRuleIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) DeviceTaintRuleIndexInformer { + return NewTypedDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) +} + +// NewDeviceTaintRuleInformerWithOptions constructs a new informer for DeviceTaintRule type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeviceTaintRuleInformerWithOptions]). +func NewDeviceTaintRuleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedDeviceTaintRuleInformerWithOptions(client, options) +} + +// NewTypedDeviceTaintRuleInformerWithOptions constructs a new informer for DeviceTaintRule type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeviceTaintRuleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) DeviceTaintRuleIndexInformer { + gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1", Resource: "devicetaintrules"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewTypedSharedIndexInformer[*apiresourcev1.DeviceTaintRule](cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.ResourceV1().DeviceTaintRules().List(context.Background(), opts) + }, + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.ResourceV1().DeviceTaintRules().Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.ResourceV1().DeviceTaintRules().List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.ResourceV1().DeviceTaintRules().Watch(ctx, opts) + }, + }, client), + &apiresourcev1.DeviceTaintRule{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + )) +} + +func (f *deviceTaintRuleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewTypedDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *deviceTaintRuleInformer) Informer() cache.SharedIndexInformer { + return f.TypedInformer() +} + +func (f *deviceTaintRuleInformer) TypedInformer() DeviceTaintRuleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1.DeviceTaintRule](f.factory.InformerFor(&apiresourcev1.DeviceTaintRule{}, f.defaultInformer)) +} + +func (f *deviceTaintRuleInformer) Lister() resourcev1.DeviceTaintRuleLister { + return resourcev1.NewDeviceTaintRuleLister(f.Informer().GetIndexer()) +} + +// ToTypedDeviceTaintRuleInformer converts an untyped informer into a TypedDeviceTaintRuleInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *DeviceTaintRule. If that is not the case, calling type-safe methods of the returned +// TypedDeviceTaintRuleInformer leads to runtime panics. A safer alternative is to pass +// around a TypedDeviceTaintRuleInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedDeviceTaintRuleInformer(informer DeviceTaintRuleInformer) TypedDeviceTaintRuleInformer { + if informer, ok := informer.(TypedDeviceTaintRuleInformer); ok { + return informer + } + return &deviceTaintRuleTypedInformerAdapter{informer} +} + +type deviceTaintRuleTypedInformerAdapter struct { + DeviceTaintRuleInformer +} + +func (a *deviceTaintRuleTypedInformerAdapter) TypedInformer() DeviceTaintRuleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1.DeviceTaintRule](a.Informer()) +} + +// ToDeviceTaintRuleIndexInformer converts an untyped informer into a DeviceTaintRuleIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *DeviceTaintRule. If that is not the case, calling type-safe methods of the returned +// DeviceTaintRuleIndexInformer leads to runtime panics. A safer alternative is to pass +// around a DeviceTaintRuleIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToDeviceTaintRuleIndexInformer(informer cache.SharedIndexInformer) DeviceTaintRuleIndexInformer { + if informer, ok := informer.(DeviceTaintRuleIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiresourcev1.DeviceTaintRule](informer) +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1/interface.go b/vendor/k8s.io/client-go/informers/resource/v1/interface.go index 4b409fbba1..c0456078ff 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1/interface.go +++ b/vendor/k8s.io/client-go/informers/resource/v1/interface.go @@ -25,13 +25,15 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // DeviceClasses returns a DeviceClassInformer. - DeviceClasses() DeviceClassInformer + DeviceClasses() TypedDeviceClassInformer + // DeviceTaintRules returns a DeviceTaintRuleInformer. + DeviceTaintRules() TypedDeviceTaintRuleInformer // ResourceClaims returns a ResourceClaimInformer. - ResourceClaims() ResourceClaimInformer + ResourceClaims() TypedResourceClaimInformer // ResourceClaimTemplates returns a ResourceClaimTemplateInformer. - ResourceClaimTemplates() ResourceClaimTemplateInformer + ResourceClaimTemplates() TypedResourceClaimTemplateInformer // ResourceSlices returns a ResourceSliceInformer. - ResourceSlices() ResourceSliceInformer + ResourceSlices() TypedResourceSliceInformer } type version struct { @@ -45,22 +47,27 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// DeviceClasses returns a DeviceClassInformer. -func (v *version) DeviceClasses() DeviceClassInformer { +// DeviceClasses returns a TypedDeviceClassInformer. +func (v *version) DeviceClasses() TypedDeviceClassInformer { return &deviceClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// ResourceClaims returns a ResourceClaimInformer. -func (v *version) ResourceClaims() ResourceClaimInformer { +// DeviceTaintRules returns a TypedDeviceTaintRuleInformer. +func (v *version) DeviceTaintRules() TypedDeviceTaintRuleInformer { + return &deviceTaintRuleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ResourceClaims returns a TypedResourceClaimInformer. +func (v *version) ResourceClaims() TypedResourceClaimInformer { return &resourceClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// ResourceClaimTemplates returns a ResourceClaimTemplateInformer. -func (v *version) ResourceClaimTemplates() ResourceClaimTemplateInformer { +// ResourceClaimTemplates returns a TypedResourceClaimTemplateInformer. +func (v *version) ResourceClaimTemplates() TypedResourceClaimTemplateInformer { return &resourceClaimTemplateInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// ResourceSlices returns a ResourceSliceInformer. -func (v *version) ResourceSlices() ResourceSliceInformer { +// ResourceSlices returns a TypedResourceSliceInformer. +func (v *version) ResourceSlices() TypedResourceSliceInformer { return &resourceSliceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/resource/v1/resourceclaim.go b/vendor/k8s.io/client-go/informers/resource/v1/resourceclaim.go index 996cc77f61..cd54867391 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1/resourceclaim.go +++ b/vendor/k8s.io/client-go/informers/resource/v1/resourceclaim.go @@ -34,12 +34,40 @@ import ( ) // ResourceClaimInformer provides access to a shared informer and lister for -// ResourceClaims. +// ResourceClaims. Prefer using the type-safe variant (see [TypedResourceClaimInformer]). type ResourceClaimInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1.ResourceClaimLister } +// TypedResourceClaimInformer provides access to a shared informer and lister for +// ResourceClaims, including the type-safe TypedInformer variant. +// It is a superset of ResourceClaimInformer. +type TypedResourceClaimInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ResourceClaimIndexInformer + Lister() resourcev1.ResourceClaimLister +} + +// ResourceClaimIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ResourceClaimIndexInformer cache.TypedSharedIndexInformer[*apiresourcev1.ResourceClaim] + +// ResourceClaimHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ResourceClaim. +type ResourceClaimHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiresourcev1.ResourceClaim] + +// ResourceClaimDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ResourceClaim. +type ResourceClaimDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiresourcev1.ResourceClaim] + +// ResourceClaimFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ResourceClaim. +type ResourceClaimFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiresourcev1.ResourceClaim] + +// ResourceClaimIndexers is a specialization of [cache.TypedIndexers] for ResourceClaim. +type ResourceClaimIndexers = cache.TypedIndexers[*apiresourcev1.ResourceClaim] + +// DeletedResourceClaim is a specialization of [cache.DeletedObject] for ResourceClaim. +type DeletedResourceClaim = cache.DeletedObject[*apiresourcev1.ResourceClaim] + type resourceClaimInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type resourceClaimInformer struct { // NewResourceClaimInformer constructs a new informer for ResourceClaim type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceClaimInformer]). func NewResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedResourceClaimInformer constructs a new informer for ResourceClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ResourceClaimIndexers) ResourceClaimIndexInformer { + return NewTypedResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredResourceClaimInformer constructs a new informer for ResourceClaim type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredResourceClaimInformer]). func NewFilteredResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredResourceClaimInformer constructs a new informer for ResourceClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ResourceClaimIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ResourceClaimIndexInformer { + return NewTypedResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewResourceClaimInformerWithOptions constructs a new informer for ResourceClaim type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceClaimInformerWithOptions]). func NewResourceClaimInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedResourceClaimInformerWithOptions(client, namespace, options) +} + +// NewTypedResourceClaimInformerWithOptions constructs a new informer for ResourceClaim type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceClaimInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) ResourceClaimIndexInformer { gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1", Resource: "resourceclaims"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiresourcev1.ResourceClaim](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewResourceClaimInformerWithOptions(client kubernetes.Interface, namespace Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *resourceClaimInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewResourceClaimInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedResourceClaimInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceClaimInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1.ResourceClaim{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *resourceClaimInformer) TypedInformer() ResourceClaimIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1.ResourceClaim](f.factory.InformerFor(&apiresourcev1.ResourceClaim{}, f.defaultInformer)) } func (f *resourceClaimInformer) Lister() resourcev1.ResourceClaimLister { return resourcev1.NewResourceClaimLister(f.Informer().GetIndexer()) } + +// ToTypedResourceClaimInformer converts an untyped informer into a TypedResourceClaimInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceClaim. If that is not the case, calling type-safe methods of the returned +// TypedResourceClaimInformer leads to runtime panics. A safer alternative is to pass +// around a TypedResourceClaimInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedResourceClaimInformer(informer ResourceClaimInformer) TypedResourceClaimInformer { + if informer, ok := informer.(TypedResourceClaimInformer); ok { + return informer + } + return &resourceClaimTypedInformerAdapter{informer} +} + +type resourceClaimTypedInformerAdapter struct { + ResourceClaimInformer +} + +func (a *resourceClaimTypedInformerAdapter) TypedInformer() ResourceClaimIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1.ResourceClaim](a.Informer()) +} + +// ToResourceClaimIndexInformer converts an untyped informer into a ResourceClaimIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceClaim. If that is not the case, calling type-safe methods of the returned +// ResourceClaimIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ResourceClaimIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToResourceClaimIndexInformer(informer cache.SharedIndexInformer) ResourceClaimIndexInformer { + if informer, ok := informer.(ResourceClaimIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiresourcev1.ResourceClaim](informer) +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1/resourceclaimtemplate.go b/vendor/k8s.io/client-go/informers/resource/v1/resourceclaimtemplate.go index e562314dc1..9e2925ec27 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1/resourceclaimtemplate.go +++ b/vendor/k8s.io/client-go/informers/resource/v1/resourceclaimtemplate.go @@ -34,12 +34,40 @@ import ( ) // ResourceClaimTemplateInformer provides access to a shared informer and lister for -// ResourceClaimTemplates. +// ResourceClaimTemplates. Prefer using the type-safe variant (see [TypedResourceClaimTemplateInformer]). type ResourceClaimTemplateInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1.ResourceClaimTemplateLister } +// TypedResourceClaimTemplateInformer provides access to a shared informer and lister for +// ResourceClaimTemplates, including the type-safe TypedInformer variant. +// It is a superset of ResourceClaimTemplateInformer. +type TypedResourceClaimTemplateInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ResourceClaimTemplateIndexInformer + Lister() resourcev1.ResourceClaimTemplateLister +} + +// ResourceClaimTemplateIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ResourceClaimTemplateIndexInformer cache.TypedSharedIndexInformer[*apiresourcev1.ResourceClaimTemplate] + +// ResourceClaimTemplateHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ResourceClaimTemplate. +type ResourceClaimTemplateHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiresourcev1.ResourceClaimTemplate] + +// ResourceClaimTemplateDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ResourceClaimTemplate. +type ResourceClaimTemplateDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiresourcev1.ResourceClaimTemplate] + +// ResourceClaimTemplateFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ResourceClaimTemplate. +type ResourceClaimTemplateFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiresourcev1.ResourceClaimTemplate] + +// ResourceClaimTemplateIndexers is a specialization of [cache.TypedIndexers] for ResourceClaimTemplate. +type ResourceClaimTemplateIndexers = cache.TypedIndexers[*apiresourcev1.ResourceClaimTemplate] + +// DeletedResourceClaimTemplate is a specialization of [cache.DeletedObject] for ResourceClaimTemplate. +type DeletedResourceClaimTemplate = cache.DeletedObject[*apiresourcev1.ResourceClaimTemplate] + type resourceClaimTemplateInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type resourceClaimTemplateInformer struct { // NewResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceClaimTemplateInformer]). func NewResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ResourceClaimTemplateIndexers) ResourceClaimTemplateIndexInformer { + return NewTypedResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredResourceClaimTemplateInformer]). func NewFilteredResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ResourceClaimTemplateIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ResourceClaimTemplateIndexInformer { + return NewTypedResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewResourceClaimTemplateInformerWithOptions constructs a new informer for ResourceClaimTemplate type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceClaimTemplateInformerWithOptions]). func NewResourceClaimTemplateInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedResourceClaimTemplateInformerWithOptions(client, namespace, options) +} + +// NewTypedResourceClaimTemplateInformerWithOptions constructs a new informer for ResourceClaimTemplate type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceClaimTemplateInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) ResourceClaimTemplateIndexInformer { gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1", Resource: "resourceclaimtemplates"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiresourcev1.ResourceClaimTemplate](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewResourceClaimTemplateInformerWithOptions(client kubernetes.Interface, na Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *resourceClaimTemplateInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewResourceClaimTemplateInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedResourceClaimTemplateInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceClaimTemplateInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1.ResourceClaimTemplate{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *resourceClaimTemplateInformer) TypedInformer() ResourceClaimTemplateIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1.ResourceClaimTemplate](f.factory.InformerFor(&apiresourcev1.ResourceClaimTemplate{}, f.defaultInformer)) } func (f *resourceClaimTemplateInformer) Lister() resourcev1.ResourceClaimTemplateLister { return resourcev1.NewResourceClaimTemplateLister(f.Informer().GetIndexer()) } + +// ToTypedResourceClaimTemplateInformer converts an untyped informer into a TypedResourceClaimTemplateInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceClaimTemplate. If that is not the case, calling type-safe methods of the returned +// TypedResourceClaimTemplateInformer leads to runtime panics. A safer alternative is to pass +// around a TypedResourceClaimTemplateInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedResourceClaimTemplateInformer(informer ResourceClaimTemplateInformer) TypedResourceClaimTemplateInformer { + if informer, ok := informer.(TypedResourceClaimTemplateInformer); ok { + return informer + } + return &resourceClaimTemplateTypedInformerAdapter{informer} +} + +type resourceClaimTemplateTypedInformerAdapter struct { + ResourceClaimTemplateInformer +} + +func (a *resourceClaimTemplateTypedInformerAdapter) TypedInformer() ResourceClaimTemplateIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1.ResourceClaimTemplate](a.Informer()) +} + +// ToResourceClaimTemplateIndexInformer converts an untyped informer into a ResourceClaimTemplateIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceClaimTemplate. If that is not the case, calling type-safe methods of the returned +// ResourceClaimTemplateIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ResourceClaimTemplateIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToResourceClaimTemplateIndexInformer(informer cache.SharedIndexInformer) ResourceClaimTemplateIndexInformer { + if informer, ok := informer.(ResourceClaimTemplateIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiresourcev1.ResourceClaimTemplate](informer) +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1/resourceslice.go b/vendor/k8s.io/client-go/informers/resource/v1/resourceslice.go index 85c877f803..b03bc1b723 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1/resourceslice.go +++ b/vendor/k8s.io/client-go/informers/resource/v1/resourceslice.go @@ -34,12 +34,40 @@ import ( ) // ResourceSliceInformer provides access to a shared informer and lister for -// ResourceSlices. +// ResourceSlices. Prefer using the type-safe variant (see [TypedResourceSliceInformer]). type ResourceSliceInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1.ResourceSliceLister } +// TypedResourceSliceInformer provides access to a shared informer and lister for +// ResourceSlices, including the type-safe TypedInformer variant. +// It is a superset of ResourceSliceInformer. +type TypedResourceSliceInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ResourceSliceIndexInformer + Lister() resourcev1.ResourceSliceLister +} + +// ResourceSliceIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ResourceSliceIndexInformer cache.TypedSharedIndexInformer[*apiresourcev1.ResourceSlice] + +// ResourceSliceHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ResourceSlice. +type ResourceSliceHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiresourcev1.ResourceSlice] + +// ResourceSliceDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ResourceSlice. +type ResourceSliceDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiresourcev1.ResourceSlice] + +// ResourceSliceFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ResourceSlice. +type ResourceSliceFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiresourcev1.ResourceSlice] + +// ResourceSliceIndexers is a specialization of [cache.TypedIndexers] for ResourceSlice. +type ResourceSliceIndexers = cache.TypedIndexers[*apiresourcev1.ResourceSlice] + +// DeletedResourceSlice is a specialization of [cache.DeletedObject] for ResourceSlice. +type DeletedResourceSlice = cache.DeletedObject[*apiresourcev1.ResourceSlice] + type resourceSliceInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type resourceSliceInformer struct { // NewResourceSliceInformer constructs a new informer for ResourceSlice type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceSliceInformer]). func NewResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedResourceSliceInformer constructs a new informer for ResourceSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ResourceSliceIndexers) ResourceSliceIndexInformer { + return NewTypedResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredResourceSliceInformer constructs a new informer for ResourceSlice type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredResourceSliceInformer]). func NewFilteredResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredResourceSliceInformer constructs a new informer for ResourceSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ResourceSliceIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ResourceSliceIndexInformer { + return NewTypedResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewResourceSliceInformerWithOptions constructs a new informer for ResourceSlice type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceSliceInformerWithOptions]). func NewResourceSliceInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedResourceSliceInformerWithOptions(client, options) +} + +// NewTypedResourceSliceInformerWithOptions constructs a new informer for ResourceSlice type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceSliceInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ResourceSliceIndexInformer { gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1", Resource: "resourceslices"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiresourcev1.ResourceSlice](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewResourceSliceInformerWithOptions(client kubernetes.Interface, options in Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *resourceSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceSliceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1.ResourceSlice{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *resourceSliceInformer) TypedInformer() ResourceSliceIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1.ResourceSlice](f.factory.InformerFor(&apiresourcev1.ResourceSlice{}, f.defaultInformer)) } func (f *resourceSliceInformer) Lister() resourcev1.ResourceSliceLister { return resourcev1.NewResourceSliceLister(f.Informer().GetIndexer()) } + +// ToTypedResourceSliceInformer converts an untyped informer into a TypedResourceSliceInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceSlice. If that is not the case, calling type-safe methods of the returned +// TypedResourceSliceInformer leads to runtime panics. A safer alternative is to pass +// around a TypedResourceSliceInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedResourceSliceInformer(informer ResourceSliceInformer) TypedResourceSliceInformer { + if informer, ok := informer.(TypedResourceSliceInformer); ok { + return informer + } + return &resourceSliceTypedInformerAdapter{informer} +} + +type resourceSliceTypedInformerAdapter struct { + ResourceSliceInformer +} + +func (a *resourceSliceTypedInformerAdapter) TypedInformer() ResourceSliceIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1.ResourceSlice](a.Informer()) +} + +// ToResourceSliceIndexInformer converts an untyped informer into a ResourceSliceIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceSlice. If that is not the case, calling type-safe methods of the returned +// ResourceSliceIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ResourceSliceIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToResourceSliceIndexInformer(informer cache.SharedIndexInformer) ResourceSliceIndexInformer { + if informer, ok := informer.(ResourceSliceIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiresourcev1.ResourceSlice](informer) +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1alpha3/devicetaintrule.go b/vendor/k8s.io/client-go/informers/resource/v1alpha3/devicetaintrule.go index 0b0029ab54..a8775bd885 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1alpha3/devicetaintrule.go +++ b/vendor/k8s.io/client-go/informers/resource/v1alpha3/devicetaintrule.go @@ -34,12 +34,40 @@ import ( ) // DeviceTaintRuleInformer provides access to a shared informer and lister for -// DeviceTaintRules. +// DeviceTaintRules. Prefer using the type-safe variant (see [TypedDeviceTaintRuleInformer]). type DeviceTaintRuleInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1alpha3.DeviceTaintRuleLister } +// TypedDeviceTaintRuleInformer provides access to a shared informer and lister for +// DeviceTaintRules, including the type-safe TypedInformer variant. +// It is a superset of DeviceTaintRuleInformer. +type TypedDeviceTaintRuleInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() DeviceTaintRuleIndexInformer + Lister() resourcev1alpha3.DeviceTaintRuleLister +} + +// DeviceTaintRuleIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type DeviceTaintRuleIndexInformer cache.TypedSharedIndexInformer[*apiresourcev1alpha3.DeviceTaintRule] + +// DeviceTaintRuleHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for DeviceTaintRule. +type DeviceTaintRuleHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiresourcev1alpha3.DeviceTaintRule] + +// DeviceTaintRuleDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for DeviceTaintRule. +type DeviceTaintRuleDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiresourcev1alpha3.DeviceTaintRule] + +// DeviceTaintRuleFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for DeviceTaintRule. +type DeviceTaintRuleFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiresourcev1alpha3.DeviceTaintRule] + +// DeviceTaintRuleIndexers is a specialization of [cache.TypedIndexers] for DeviceTaintRule. +type DeviceTaintRuleIndexers = cache.TypedIndexers[*apiresourcev1alpha3.DeviceTaintRule] + +// DeletedDeviceTaintRule is a specialization of [cache.DeletedObject] for DeviceTaintRule. +type DeletedDeviceTaintRule = cache.DeletedObject[*apiresourcev1alpha3.DeviceTaintRule] + type deviceTaintRuleInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type deviceTaintRuleInformer struct { // NewDeviceTaintRuleInformer constructs a new informer for DeviceTaintRule type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeviceTaintRuleInformer]). func NewDeviceTaintRuleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedDeviceTaintRuleInformer constructs a new informer for DeviceTaintRule type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeviceTaintRuleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers DeviceTaintRuleIndexers) DeviceTaintRuleIndexInformer { + return NewTypedDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredDeviceTaintRuleInformer constructs a new informer for DeviceTaintRule type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredDeviceTaintRuleInformer]). func NewFilteredDeviceTaintRuleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredDeviceTaintRuleInformer constructs a new informer for DeviceTaintRule type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredDeviceTaintRuleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers DeviceTaintRuleIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) DeviceTaintRuleIndexInformer { + return NewTypedDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewDeviceTaintRuleInformerWithOptions constructs a new informer for DeviceTaintRule type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeviceTaintRuleInformerWithOptions]). func NewDeviceTaintRuleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedDeviceTaintRuleInformerWithOptions(client, options) +} + +// NewTypedDeviceTaintRuleInformerWithOptions constructs a new informer for DeviceTaintRule type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeviceTaintRuleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) DeviceTaintRuleIndexInformer { gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1alpha3", Resource: "devicetaintrules"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiresourcev1alpha3.DeviceTaintRule](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewDeviceTaintRuleInformerWithOptions(client kubernetes.Interface, options Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *deviceTaintRuleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *deviceTaintRuleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1alpha3.DeviceTaintRule{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *deviceTaintRuleInformer) TypedInformer() DeviceTaintRuleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1alpha3.DeviceTaintRule](f.factory.InformerFor(&apiresourcev1alpha3.DeviceTaintRule{}, f.defaultInformer)) } func (f *deviceTaintRuleInformer) Lister() resourcev1alpha3.DeviceTaintRuleLister { return resourcev1alpha3.NewDeviceTaintRuleLister(f.Informer().GetIndexer()) } + +// ToTypedDeviceTaintRuleInformer converts an untyped informer into a TypedDeviceTaintRuleInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *DeviceTaintRule. If that is not the case, calling type-safe methods of the returned +// TypedDeviceTaintRuleInformer leads to runtime panics. A safer alternative is to pass +// around a TypedDeviceTaintRuleInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedDeviceTaintRuleInformer(informer DeviceTaintRuleInformer) TypedDeviceTaintRuleInformer { + if informer, ok := informer.(TypedDeviceTaintRuleInformer); ok { + return informer + } + return &deviceTaintRuleTypedInformerAdapter{informer} +} + +type deviceTaintRuleTypedInformerAdapter struct { + DeviceTaintRuleInformer +} + +func (a *deviceTaintRuleTypedInformerAdapter) TypedInformer() DeviceTaintRuleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1alpha3.DeviceTaintRule](a.Informer()) +} + +// ToDeviceTaintRuleIndexInformer converts an untyped informer into a DeviceTaintRuleIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *DeviceTaintRule. If that is not the case, calling type-safe methods of the returned +// DeviceTaintRuleIndexInformer leads to runtime panics. A safer alternative is to pass +// around a DeviceTaintRuleIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToDeviceTaintRuleIndexInformer(informer cache.SharedIndexInformer) DeviceTaintRuleIndexInformer { + if informer, ok := informer.(DeviceTaintRuleIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiresourcev1alpha3.DeviceTaintRule](informer) +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1alpha3/interface.go b/vendor/k8s.io/client-go/informers/resource/v1alpha3/interface.go index b305681236..46bdb3b162 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1alpha3/interface.go +++ b/vendor/k8s.io/client-go/informers/resource/v1alpha3/interface.go @@ -25,9 +25,9 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // DeviceTaintRules returns a DeviceTaintRuleInformer. - DeviceTaintRules() DeviceTaintRuleInformer + DeviceTaintRules() TypedDeviceTaintRuleInformer // ResourcePoolStatusRequests returns a ResourcePoolStatusRequestInformer. - ResourcePoolStatusRequests() ResourcePoolStatusRequestInformer + ResourcePoolStatusRequests() TypedResourcePoolStatusRequestInformer } type version struct { @@ -41,12 +41,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// DeviceTaintRules returns a DeviceTaintRuleInformer. -func (v *version) DeviceTaintRules() DeviceTaintRuleInformer { +// DeviceTaintRules returns a TypedDeviceTaintRuleInformer. +func (v *version) DeviceTaintRules() TypedDeviceTaintRuleInformer { return &deviceTaintRuleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// ResourcePoolStatusRequests returns a ResourcePoolStatusRequestInformer. -func (v *version) ResourcePoolStatusRequests() ResourcePoolStatusRequestInformer { +// ResourcePoolStatusRequests returns a TypedResourcePoolStatusRequestInformer. +func (v *version) ResourcePoolStatusRequests() TypedResourcePoolStatusRequestInformer { return &resourcePoolStatusRequestInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/resource/v1alpha3/resourcepoolstatusrequest.go b/vendor/k8s.io/client-go/informers/resource/v1alpha3/resourcepoolstatusrequest.go index f34d57e138..87842dfbeb 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1alpha3/resourcepoolstatusrequest.go +++ b/vendor/k8s.io/client-go/informers/resource/v1alpha3/resourcepoolstatusrequest.go @@ -34,12 +34,40 @@ import ( ) // ResourcePoolStatusRequestInformer provides access to a shared informer and lister for -// ResourcePoolStatusRequests. +// ResourcePoolStatusRequests. Prefer using the type-safe variant (see [TypedResourcePoolStatusRequestInformer]). type ResourcePoolStatusRequestInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1alpha3.ResourcePoolStatusRequestLister } +// TypedResourcePoolStatusRequestInformer provides access to a shared informer and lister for +// ResourcePoolStatusRequests, including the type-safe TypedInformer variant. +// It is a superset of ResourcePoolStatusRequestInformer. +type TypedResourcePoolStatusRequestInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ResourcePoolStatusRequestIndexInformer + Lister() resourcev1alpha3.ResourcePoolStatusRequestLister +} + +// ResourcePoolStatusRequestIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ResourcePoolStatusRequestIndexInformer cache.TypedSharedIndexInformer[*apiresourcev1alpha3.ResourcePoolStatusRequest] + +// ResourcePoolStatusRequestHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ResourcePoolStatusRequest. +type ResourcePoolStatusRequestHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiresourcev1alpha3.ResourcePoolStatusRequest] + +// ResourcePoolStatusRequestDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ResourcePoolStatusRequest. +type ResourcePoolStatusRequestDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiresourcev1alpha3.ResourcePoolStatusRequest] + +// ResourcePoolStatusRequestFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ResourcePoolStatusRequest. +type ResourcePoolStatusRequestFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiresourcev1alpha3.ResourcePoolStatusRequest] + +// ResourcePoolStatusRequestIndexers is a specialization of [cache.TypedIndexers] for ResourcePoolStatusRequest. +type ResourcePoolStatusRequestIndexers = cache.TypedIndexers[*apiresourcev1alpha3.ResourcePoolStatusRequest] + +// DeletedResourcePoolStatusRequest is a specialization of [cache.DeletedObject] for ResourcePoolStatusRequest. +type DeletedResourcePoolStatusRequest = cache.DeletedObject[*apiresourcev1alpha3.ResourcePoolStatusRequest] + type resourcePoolStatusRequestInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type resourcePoolStatusRequestInformer struct { // NewResourcePoolStatusRequestInformer constructs a new informer for ResourcePoolStatusRequest type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourcePoolStatusRequestInformer]). func NewResourcePoolStatusRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewResourcePoolStatusRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedResourcePoolStatusRequestInformer constructs a new informer for ResourcePoolStatusRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourcePoolStatusRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ResourcePoolStatusRequestIndexers) ResourcePoolStatusRequestIndexInformer { + return NewTypedResourcePoolStatusRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredResourcePoolStatusRequestInformer constructs a new informer for ResourcePoolStatusRequest type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredResourcePoolStatusRequestInformer]). func NewFilteredResourcePoolStatusRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewResourcePoolStatusRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedResourcePoolStatusRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredResourcePoolStatusRequestInformer constructs a new informer for ResourcePoolStatusRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredResourcePoolStatusRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ResourcePoolStatusRequestIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ResourcePoolStatusRequestIndexInformer { + return NewTypedResourcePoolStatusRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewResourcePoolStatusRequestInformerWithOptions constructs a new informer for ResourcePoolStatusRequest type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourcePoolStatusRequestInformerWithOptions]). func NewResourcePoolStatusRequestInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedResourcePoolStatusRequestInformerWithOptions(client, options) +} + +// NewTypedResourcePoolStatusRequestInformerWithOptions constructs a new informer for ResourcePoolStatusRequest type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourcePoolStatusRequestInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ResourcePoolStatusRequestIndexInformer { gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1alpha3", Resource: "resourcepoolstatusrequests"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiresourcev1alpha3.ResourcePoolStatusRequest](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewResourcePoolStatusRequestInformerWithOptions(client kubernetes.Interface Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *resourcePoolStatusRequestInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewResourcePoolStatusRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedResourcePoolStatusRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourcePoolStatusRequestInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1alpha3.ResourcePoolStatusRequest{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *resourcePoolStatusRequestInformer) TypedInformer() ResourcePoolStatusRequestIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1alpha3.ResourcePoolStatusRequest](f.factory.InformerFor(&apiresourcev1alpha3.ResourcePoolStatusRequest{}, f.defaultInformer)) } func (f *resourcePoolStatusRequestInformer) Lister() resourcev1alpha3.ResourcePoolStatusRequestLister { return resourcev1alpha3.NewResourcePoolStatusRequestLister(f.Informer().GetIndexer()) } + +// ToTypedResourcePoolStatusRequestInformer converts an untyped informer into a TypedResourcePoolStatusRequestInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourcePoolStatusRequest. If that is not the case, calling type-safe methods of the returned +// TypedResourcePoolStatusRequestInformer leads to runtime panics. A safer alternative is to pass +// around a TypedResourcePoolStatusRequestInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedResourcePoolStatusRequestInformer(informer ResourcePoolStatusRequestInformer) TypedResourcePoolStatusRequestInformer { + if informer, ok := informer.(TypedResourcePoolStatusRequestInformer); ok { + return informer + } + return &resourcePoolStatusRequestTypedInformerAdapter{informer} +} + +type resourcePoolStatusRequestTypedInformerAdapter struct { + ResourcePoolStatusRequestInformer +} + +func (a *resourcePoolStatusRequestTypedInformerAdapter) TypedInformer() ResourcePoolStatusRequestIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1alpha3.ResourcePoolStatusRequest](a.Informer()) +} + +// ToResourcePoolStatusRequestIndexInformer converts an untyped informer into a ResourcePoolStatusRequestIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourcePoolStatusRequest. If that is not the case, calling type-safe methods of the returned +// ResourcePoolStatusRequestIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ResourcePoolStatusRequestIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToResourcePoolStatusRequestIndexInformer(informer cache.SharedIndexInformer) ResourcePoolStatusRequestIndexInformer { + if informer, ok := informer.(ResourcePoolStatusRequestIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiresourcev1alpha3.ResourcePoolStatusRequest](informer) +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta1/deviceclass.go b/vendor/k8s.io/client-go/informers/resource/v1beta1/deviceclass.go index 0a4d4bea64..bbc371bd27 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta1/deviceclass.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta1/deviceclass.go @@ -34,12 +34,40 @@ import ( ) // DeviceClassInformer provides access to a shared informer and lister for -// DeviceClasses. +// DeviceClasses. Prefer using the type-safe variant (see [TypedDeviceClassInformer]). type DeviceClassInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1beta1.DeviceClassLister } +// TypedDeviceClassInformer provides access to a shared informer and lister for +// DeviceClasses, including the type-safe TypedInformer variant. +// It is a superset of DeviceClassInformer. +type TypedDeviceClassInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() DeviceClassIndexInformer + Lister() resourcev1beta1.DeviceClassLister +} + +// DeviceClassIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type DeviceClassIndexInformer cache.TypedSharedIndexInformer[*apiresourcev1beta1.DeviceClass] + +// DeviceClassHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for DeviceClass. +type DeviceClassHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiresourcev1beta1.DeviceClass] + +// DeviceClassDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for DeviceClass. +type DeviceClassDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiresourcev1beta1.DeviceClass] + +// DeviceClassFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for DeviceClass. +type DeviceClassFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiresourcev1beta1.DeviceClass] + +// DeviceClassIndexers is a specialization of [cache.TypedIndexers] for DeviceClass. +type DeviceClassIndexers = cache.TypedIndexers[*apiresourcev1beta1.DeviceClass] + +// DeletedDeviceClass is a specialization of [cache.DeletedObject] for DeviceClass. +type DeletedDeviceClass = cache.DeletedObject[*apiresourcev1beta1.DeviceClass] + type deviceClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type deviceClassInformer struct { // NewDeviceClassInformer constructs a new informer for DeviceClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeviceClassInformer]). func NewDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedDeviceClassInformer constructs a new informer for DeviceClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers DeviceClassIndexers) DeviceClassIndexInformer { + return NewTypedDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredDeviceClassInformer constructs a new informer for DeviceClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredDeviceClassInformer]). func NewFilteredDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredDeviceClassInformer constructs a new informer for DeviceClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers DeviceClassIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) DeviceClassIndexInformer { + return NewTypedDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewDeviceClassInformerWithOptions constructs a new informer for DeviceClass type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeviceClassInformerWithOptions]). func NewDeviceClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedDeviceClassInformerWithOptions(client, options) +} + +// NewTypedDeviceClassInformerWithOptions constructs a new informer for DeviceClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeviceClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) DeviceClassIndexInformer { gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta1", Resource: "deviceclasss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta1.DeviceClass](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewDeviceClassInformerWithOptions(client kubernetes.Interface, options inte Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *deviceClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *deviceClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1beta1.DeviceClass{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *deviceClassInformer) TypedInformer() DeviceClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta1.DeviceClass](f.factory.InformerFor(&apiresourcev1beta1.DeviceClass{}, f.defaultInformer)) } func (f *deviceClassInformer) Lister() resourcev1beta1.DeviceClassLister { return resourcev1beta1.NewDeviceClassLister(f.Informer().GetIndexer()) } + +// ToTypedDeviceClassInformer converts an untyped informer into a TypedDeviceClassInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *DeviceClass. If that is not the case, calling type-safe methods of the returned +// TypedDeviceClassInformer leads to runtime panics. A safer alternative is to pass +// around a TypedDeviceClassInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedDeviceClassInformer(informer DeviceClassInformer) TypedDeviceClassInformer { + if informer, ok := informer.(TypedDeviceClassInformer); ok { + return informer + } + return &deviceClassTypedInformerAdapter{informer} +} + +type deviceClassTypedInformerAdapter struct { + DeviceClassInformer +} + +func (a *deviceClassTypedInformerAdapter) TypedInformer() DeviceClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta1.DeviceClass](a.Informer()) +} + +// ToDeviceClassIndexInformer converts an untyped informer into a DeviceClassIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *DeviceClass. If that is not the case, calling type-safe methods of the returned +// DeviceClassIndexInformer leads to runtime panics. A safer alternative is to pass +// around a DeviceClassIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToDeviceClassIndexInformer(informer cache.SharedIndexInformer) DeviceClassIndexInformer { + if informer, ok := informer.(DeviceClassIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta1.DeviceClass](informer) +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/resource/v1beta1/interface.go index 07330763ba..6cddfa8f42 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta1/interface.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta1/interface.go @@ -25,13 +25,13 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // DeviceClasses returns a DeviceClassInformer. - DeviceClasses() DeviceClassInformer + DeviceClasses() TypedDeviceClassInformer // ResourceClaims returns a ResourceClaimInformer. - ResourceClaims() ResourceClaimInformer + ResourceClaims() TypedResourceClaimInformer // ResourceClaimTemplates returns a ResourceClaimTemplateInformer. - ResourceClaimTemplates() ResourceClaimTemplateInformer + ResourceClaimTemplates() TypedResourceClaimTemplateInformer // ResourceSlices returns a ResourceSliceInformer. - ResourceSlices() ResourceSliceInformer + ResourceSlices() TypedResourceSliceInformer } type version struct { @@ -45,22 +45,22 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// DeviceClasses returns a DeviceClassInformer. -func (v *version) DeviceClasses() DeviceClassInformer { +// DeviceClasses returns a TypedDeviceClassInformer. +func (v *version) DeviceClasses() TypedDeviceClassInformer { return &deviceClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// ResourceClaims returns a ResourceClaimInformer. -func (v *version) ResourceClaims() ResourceClaimInformer { +// ResourceClaims returns a TypedResourceClaimInformer. +func (v *version) ResourceClaims() TypedResourceClaimInformer { return &resourceClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// ResourceClaimTemplates returns a ResourceClaimTemplateInformer. -func (v *version) ResourceClaimTemplates() ResourceClaimTemplateInformer { +// ResourceClaimTemplates returns a TypedResourceClaimTemplateInformer. +func (v *version) ResourceClaimTemplates() TypedResourceClaimTemplateInformer { return &resourceClaimTemplateInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// ResourceSlices returns a ResourceSliceInformer. -func (v *version) ResourceSlices() ResourceSliceInformer { +// ResourceSlices returns a TypedResourceSliceInformer. +func (v *version) ResourceSlices() TypedResourceSliceInformer { return &resourceSliceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaim.go b/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaim.go index 9ec1ece317..31f1dec80a 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaim.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaim.go @@ -34,12 +34,40 @@ import ( ) // ResourceClaimInformer provides access to a shared informer and lister for -// ResourceClaims. +// ResourceClaims. Prefer using the type-safe variant (see [TypedResourceClaimInformer]). type ResourceClaimInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1beta1.ResourceClaimLister } +// TypedResourceClaimInformer provides access to a shared informer and lister for +// ResourceClaims, including the type-safe TypedInformer variant. +// It is a superset of ResourceClaimInformer. +type TypedResourceClaimInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ResourceClaimIndexInformer + Lister() resourcev1beta1.ResourceClaimLister +} + +// ResourceClaimIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ResourceClaimIndexInformer cache.TypedSharedIndexInformer[*apiresourcev1beta1.ResourceClaim] + +// ResourceClaimHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ResourceClaim. +type ResourceClaimHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiresourcev1beta1.ResourceClaim] + +// ResourceClaimDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ResourceClaim. +type ResourceClaimDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiresourcev1beta1.ResourceClaim] + +// ResourceClaimFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ResourceClaim. +type ResourceClaimFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiresourcev1beta1.ResourceClaim] + +// ResourceClaimIndexers is a specialization of [cache.TypedIndexers] for ResourceClaim. +type ResourceClaimIndexers = cache.TypedIndexers[*apiresourcev1beta1.ResourceClaim] + +// DeletedResourceClaim is a specialization of [cache.DeletedObject] for ResourceClaim. +type DeletedResourceClaim = cache.DeletedObject[*apiresourcev1beta1.ResourceClaim] + type resourceClaimInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type resourceClaimInformer struct { // NewResourceClaimInformer constructs a new informer for ResourceClaim type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceClaimInformer]). func NewResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedResourceClaimInformer constructs a new informer for ResourceClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ResourceClaimIndexers) ResourceClaimIndexInformer { + return NewTypedResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredResourceClaimInformer constructs a new informer for ResourceClaim type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredResourceClaimInformer]). func NewFilteredResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredResourceClaimInformer constructs a new informer for ResourceClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ResourceClaimIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ResourceClaimIndexInformer { + return NewTypedResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewResourceClaimInformerWithOptions constructs a new informer for ResourceClaim type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceClaimInformerWithOptions]). func NewResourceClaimInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedResourceClaimInformerWithOptions(client, namespace, options) +} + +// NewTypedResourceClaimInformerWithOptions constructs a new informer for ResourceClaim type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceClaimInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) ResourceClaimIndexInformer { gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta1", Resource: "resourceclaims"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta1.ResourceClaim](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewResourceClaimInformerWithOptions(client kubernetes.Interface, namespace Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *resourceClaimInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewResourceClaimInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedResourceClaimInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceClaimInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1beta1.ResourceClaim{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *resourceClaimInformer) TypedInformer() ResourceClaimIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta1.ResourceClaim](f.factory.InformerFor(&apiresourcev1beta1.ResourceClaim{}, f.defaultInformer)) } func (f *resourceClaimInformer) Lister() resourcev1beta1.ResourceClaimLister { return resourcev1beta1.NewResourceClaimLister(f.Informer().GetIndexer()) } + +// ToTypedResourceClaimInformer converts an untyped informer into a TypedResourceClaimInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceClaim. If that is not the case, calling type-safe methods of the returned +// TypedResourceClaimInformer leads to runtime panics. A safer alternative is to pass +// around a TypedResourceClaimInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedResourceClaimInformer(informer ResourceClaimInformer) TypedResourceClaimInformer { + if informer, ok := informer.(TypedResourceClaimInformer); ok { + return informer + } + return &resourceClaimTypedInformerAdapter{informer} +} + +type resourceClaimTypedInformerAdapter struct { + ResourceClaimInformer +} + +func (a *resourceClaimTypedInformerAdapter) TypedInformer() ResourceClaimIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta1.ResourceClaim](a.Informer()) +} + +// ToResourceClaimIndexInformer converts an untyped informer into a ResourceClaimIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceClaim. If that is not the case, calling type-safe methods of the returned +// ResourceClaimIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ResourceClaimIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToResourceClaimIndexInformer(informer cache.SharedIndexInformer) ResourceClaimIndexInformer { + if informer, ok := informer.(ResourceClaimIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta1.ResourceClaim](informer) +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaimtemplate.go b/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaimtemplate.go index b6aa9cb919..ff00567105 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaimtemplate.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaimtemplate.go @@ -34,12 +34,40 @@ import ( ) // ResourceClaimTemplateInformer provides access to a shared informer and lister for -// ResourceClaimTemplates. +// ResourceClaimTemplates. Prefer using the type-safe variant (see [TypedResourceClaimTemplateInformer]). type ResourceClaimTemplateInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1beta1.ResourceClaimTemplateLister } +// TypedResourceClaimTemplateInformer provides access to a shared informer and lister for +// ResourceClaimTemplates, including the type-safe TypedInformer variant. +// It is a superset of ResourceClaimTemplateInformer. +type TypedResourceClaimTemplateInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ResourceClaimTemplateIndexInformer + Lister() resourcev1beta1.ResourceClaimTemplateLister +} + +// ResourceClaimTemplateIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ResourceClaimTemplateIndexInformer cache.TypedSharedIndexInformer[*apiresourcev1beta1.ResourceClaimTemplate] + +// ResourceClaimTemplateHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ResourceClaimTemplate. +type ResourceClaimTemplateHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiresourcev1beta1.ResourceClaimTemplate] + +// ResourceClaimTemplateDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ResourceClaimTemplate. +type ResourceClaimTemplateDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiresourcev1beta1.ResourceClaimTemplate] + +// ResourceClaimTemplateFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ResourceClaimTemplate. +type ResourceClaimTemplateFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiresourcev1beta1.ResourceClaimTemplate] + +// ResourceClaimTemplateIndexers is a specialization of [cache.TypedIndexers] for ResourceClaimTemplate. +type ResourceClaimTemplateIndexers = cache.TypedIndexers[*apiresourcev1beta1.ResourceClaimTemplate] + +// DeletedResourceClaimTemplate is a specialization of [cache.DeletedObject] for ResourceClaimTemplate. +type DeletedResourceClaimTemplate = cache.DeletedObject[*apiresourcev1beta1.ResourceClaimTemplate] + type resourceClaimTemplateInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type resourceClaimTemplateInformer struct { // NewResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceClaimTemplateInformer]). func NewResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ResourceClaimTemplateIndexers) ResourceClaimTemplateIndexInformer { + return NewTypedResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredResourceClaimTemplateInformer]). func NewFilteredResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ResourceClaimTemplateIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ResourceClaimTemplateIndexInformer { + return NewTypedResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewResourceClaimTemplateInformerWithOptions constructs a new informer for ResourceClaimTemplate type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceClaimTemplateInformerWithOptions]). func NewResourceClaimTemplateInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedResourceClaimTemplateInformerWithOptions(client, namespace, options) +} + +// NewTypedResourceClaimTemplateInformerWithOptions constructs a new informer for ResourceClaimTemplate type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceClaimTemplateInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) ResourceClaimTemplateIndexInformer { gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta1", Resource: "resourceclaimtemplates"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta1.ResourceClaimTemplate](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewResourceClaimTemplateInformerWithOptions(client kubernetes.Interface, na Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *resourceClaimTemplateInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewResourceClaimTemplateInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedResourceClaimTemplateInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceClaimTemplateInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1beta1.ResourceClaimTemplate{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *resourceClaimTemplateInformer) TypedInformer() ResourceClaimTemplateIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta1.ResourceClaimTemplate](f.factory.InformerFor(&apiresourcev1beta1.ResourceClaimTemplate{}, f.defaultInformer)) } func (f *resourceClaimTemplateInformer) Lister() resourcev1beta1.ResourceClaimTemplateLister { return resourcev1beta1.NewResourceClaimTemplateLister(f.Informer().GetIndexer()) } + +// ToTypedResourceClaimTemplateInformer converts an untyped informer into a TypedResourceClaimTemplateInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceClaimTemplate. If that is not the case, calling type-safe methods of the returned +// TypedResourceClaimTemplateInformer leads to runtime panics. A safer alternative is to pass +// around a TypedResourceClaimTemplateInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedResourceClaimTemplateInformer(informer ResourceClaimTemplateInformer) TypedResourceClaimTemplateInformer { + if informer, ok := informer.(TypedResourceClaimTemplateInformer); ok { + return informer + } + return &resourceClaimTemplateTypedInformerAdapter{informer} +} + +type resourceClaimTemplateTypedInformerAdapter struct { + ResourceClaimTemplateInformer +} + +func (a *resourceClaimTemplateTypedInformerAdapter) TypedInformer() ResourceClaimTemplateIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta1.ResourceClaimTemplate](a.Informer()) +} + +// ToResourceClaimTemplateIndexInformer converts an untyped informer into a ResourceClaimTemplateIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceClaimTemplate. If that is not the case, calling type-safe methods of the returned +// ResourceClaimTemplateIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ResourceClaimTemplateIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToResourceClaimTemplateIndexInformer(informer cache.SharedIndexInformer) ResourceClaimTemplateIndexInformer { + if informer, ok := informer.(ResourceClaimTemplateIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta1.ResourceClaimTemplate](informer) +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceslice.go b/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceslice.go index 39e971aec2..72cc3062b1 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceslice.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceslice.go @@ -34,12 +34,40 @@ import ( ) // ResourceSliceInformer provides access to a shared informer and lister for -// ResourceSlices. +// ResourceSlices. Prefer using the type-safe variant (see [TypedResourceSliceInformer]). type ResourceSliceInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1beta1.ResourceSliceLister } +// TypedResourceSliceInformer provides access to a shared informer and lister for +// ResourceSlices, including the type-safe TypedInformer variant. +// It is a superset of ResourceSliceInformer. +type TypedResourceSliceInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ResourceSliceIndexInformer + Lister() resourcev1beta1.ResourceSliceLister +} + +// ResourceSliceIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ResourceSliceIndexInformer cache.TypedSharedIndexInformer[*apiresourcev1beta1.ResourceSlice] + +// ResourceSliceHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ResourceSlice. +type ResourceSliceHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiresourcev1beta1.ResourceSlice] + +// ResourceSliceDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ResourceSlice. +type ResourceSliceDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiresourcev1beta1.ResourceSlice] + +// ResourceSliceFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ResourceSlice. +type ResourceSliceFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiresourcev1beta1.ResourceSlice] + +// ResourceSliceIndexers is a specialization of [cache.TypedIndexers] for ResourceSlice. +type ResourceSliceIndexers = cache.TypedIndexers[*apiresourcev1beta1.ResourceSlice] + +// DeletedResourceSlice is a specialization of [cache.DeletedObject] for ResourceSlice. +type DeletedResourceSlice = cache.DeletedObject[*apiresourcev1beta1.ResourceSlice] + type resourceSliceInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type resourceSliceInformer struct { // NewResourceSliceInformer constructs a new informer for ResourceSlice type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceSliceInformer]). func NewResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedResourceSliceInformer constructs a new informer for ResourceSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ResourceSliceIndexers) ResourceSliceIndexInformer { + return NewTypedResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredResourceSliceInformer constructs a new informer for ResourceSlice type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredResourceSliceInformer]). func NewFilteredResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredResourceSliceInformer constructs a new informer for ResourceSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ResourceSliceIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ResourceSliceIndexInformer { + return NewTypedResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewResourceSliceInformerWithOptions constructs a new informer for ResourceSlice type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceSliceInformerWithOptions]). func NewResourceSliceInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedResourceSliceInformerWithOptions(client, options) +} + +// NewTypedResourceSliceInformerWithOptions constructs a new informer for ResourceSlice type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceSliceInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ResourceSliceIndexInformer { gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta1", Resource: "resourceslices"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta1.ResourceSlice](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewResourceSliceInformerWithOptions(client kubernetes.Interface, options in Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *resourceSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceSliceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1beta1.ResourceSlice{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *resourceSliceInformer) TypedInformer() ResourceSliceIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta1.ResourceSlice](f.factory.InformerFor(&apiresourcev1beta1.ResourceSlice{}, f.defaultInformer)) } func (f *resourceSliceInformer) Lister() resourcev1beta1.ResourceSliceLister { return resourcev1beta1.NewResourceSliceLister(f.Informer().GetIndexer()) } + +// ToTypedResourceSliceInformer converts an untyped informer into a TypedResourceSliceInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceSlice. If that is not the case, calling type-safe methods of the returned +// TypedResourceSliceInformer leads to runtime panics. A safer alternative is to pass +// around a TypedResourceSliceInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedResourceSliceInformer(informer ResourceSliceInformer) TypedResourceSliceInformer { + if informer, ok := informer.(TypedResourceSliceInformer); ok { + return informer + } + return &resourceSliceTypedInformerAdapter{informer} +} + +type resourceSliceTypedInformerAdapter struct { + ResourceSliceInformer +} + +func (a *resourceSliceTypedInformerAdapter) TypedInformer() ResourceSliceIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta1.ResourceSlice](a.Informer()) +} + +// ToResourceSliceIndexInformer converts an untyped informer into a ResourceSliceIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceSlice. If that is not the case, calling type-safe methods of the returned +// ResourceSliceIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ResourceSliceIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToResourceSliceIndexInformer(informer cache.SharedIndexInformer) ResourceSliceIndexInformer { + if informer, ok := informer.(ResourceSliceIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta1.ResourceSlice](informer) +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta2/deviceclass.go b/vendor/k8s.io/client-go/informers/resource/v1beta2/deviceclass.go index d98b4d658e..7108cba10a 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta2/deviceclass.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta2/deviceclass.go @@ -34,12 +34,40 @@ import ( ) // DeviceClassInformer provides access to a shared informer and lister for -// DeviceClasses. +// DeviceClasses. Prefer using the type-safe variant (see [TypedDeviceClassInformer]). type DeviceClassInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1beta2.DeviceClassLister } +// TypedDeviceClassInformer provides access to a shared informer and lister for +// DeviceClasses, including the type-safe TypedInformer variant. +// It is a superset of DeviceClassInformer. +type TypedDeviceClassInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() DeviceClassIndexInformer + Lister() resourcev1beta2.DeviceClassLister +} + +// DeviceClassIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type DeviceClassIndexInformer cache.TypedSharedIndexInformer[*apiresourcev1beta2.DeviceClass] + +// DeviceClassHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for DeviceClass. +type DeviceClassHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiresourcev1beta2.DeviceClass] + +// DeviceClassDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for DeviceClass. +type DeviceClassDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiresourcev1beta2.DeviceClass] + +// DeviceClassFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for DeviceClass. +type DeviceClassFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiresourcev1beta2.DeviceClass] + +// DeviceClassIndexers is a specialization of [cache.TypedIndexers] for DeviceClass. +type DeviceClassIndexers = cache.TypedIndexers[*apiresourcev1beta2.DeviceClass] + +// DeletedDeviceClass is a specialization of [cache.DeletedObject] for DeviceClass. +type DeletedDeviceClass = cache.DeletedObject[*apiresourcev1beta2.DeviceClass] + type deviceClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type deviceClassInformer struct { // NewDeviceClassInformer constructs a new informer for DeviceClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeviceClassInformer]). func NewDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedDeviceClassInformer constructs a new informer for DeviceClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers DeviceClassIndexers) DeviceClassIndexInformer { + return NewTypedDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredDeviceClassInformer constructs a new informer for DeviceClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredDeviceClassInformer]). func NewFilteredDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredDeviceClassInformer constructs a new informer for DeviceClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers DeviceClassIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) DeviceClassIndexInformer { + return NewTypedDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewDeviceClassInformerWithOptions constructs a new informer for DeviceClass type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeviceClassInformerWithOptions]). func NewDeviceClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedDeviceClassInformerWithOptions(client, options) +} + +// NewTypedDeviceClassInformerWithOptions constructs a new informer for DeviceClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeviceClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) DeviceClassIndexInformer { gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta2", Resource: "deviceclasss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.DeviceClass](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewDeviceClassInformerWithOptions(client kubernetes.Interface, options inte Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *deviceClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *deviceClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1beta2.DeviceClass{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *deviceClassInformer) TypedInformer() DeviceClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.DeviceClass](f.factory.InformerFor(&apiresourcev1beta2.DeviceClass{}, f.defaultInformer)) } func (f *deviceClassInformer) Lister() resourcev1beta2.DeviceClassLister { return resourcev1beta2.NewDeviceClassLister(f.Informer().GetIndexer()) } + +// ToTypedDeviceClassInformer converts an untyped informer into a TypedDeviceClassInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *DeviceClass. If that is not the case, calling type-safe methods of the returned +// TypedDeviceClassInformer leads to runtime panics. A safer alternative is to pass +// around a TypedDeviceClassInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedDeviceClassInformer(informer DeviceClassInformer) TypedDeviceClassInformer { + if informer, ok := informer.(TypedDeviceClassInformer); ok { + return informer + } + return &deviceClassTypedInformerAdapter{informer} +} + +type deviceClassTypedInformerAdapter struct { + DeviceClassInformer +} + +func (a *deviceClassTypedInformerAdapter) TypedInformer() DeviceClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.DeviceClass](a.Informer()) +} + +// ToDeviceClassIndexInformer converts an untyped informer into a DeviceClassIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *DeviceClass. If that is not the case, calling type-safe methods of the returned +// DeviceClassIndexInformer leads to runtime panics. A safer alternative is to pass +// around a DeviceClassIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToDeviceClassIndexInformer(informer cache.SharedIndexInformer) DeviceClassIndexInformer { + if informer, ok := informer.(DeviceClassIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.DeviceClass](informer) +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta2/devicetaintrule.go b/vendor/k8s.io/client-go/informers/resource/v1beta2/devicetaintrule.go index 328a9c3939..7bc04a161f 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta2/devicetaintrule.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta2/devicetaintrule.go @@ -34,12 +34,40 @@ import ( ) // DeviceTaintRuleInformer provides access to a shared informer and lister for -// DeviceTaintRules. +// DeviceTaintRules. Prefer using the type-safe variant (see [TypedDeviceTaintRuleInformer]). type DeviceTaintRuleInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1beta2.DeviceTaintRuleLister } +// TypedDeviceTaintRuleInformer provides access to a shared informer and lister for +// DeviceTaintRules, including the type-safe TypedInformer variant. +// It is a superset of DeviceTaintRuleInformer. +type TypedDeviceTaintRuleInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() DeviceTaintRuleIndexInformer + Lister() resourcev1beta2.DeviceTaintRuleLister +} + +// DeviceTaintRuleIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type DeviceTaintRuleIndexInformer cache.TypedSharedIndexInformer[*apiresourcev1beta2.DeviceTaintRule] + +// DeviceTaintRuleHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for DeviceTaintRule. +type DeviceTaintRuleHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiresourcev1beta2.DeviceTaintRule] + +// DeviceTaintRuleDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for DeviceTaintRule. +type DeviceTaintRuleDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiresourcev1beta2.DeviceTaintRule] + +// DeviceTaintRuleFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for DeviceTaintRule. +type DeviceTaintRuleFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiresourcev1beta2.DeviceTaintRule] + +// DeviceTaintRuleIndexers is a specialization of [cache.TypedIndexers] for DeviceTaintRule. +type DeviceTaintRuleIndexers = cache.TypedIndexers[*apiresourcev1beta2.DeviceTaintRule] + +// DeletedDeviceTaintRule is a specialization of [cache.DeletedObject] for DeviceTaintRule. +type DeletedDeviceTaintRule = cache.DeletedObject[*apiresourcev1beta2.DeviceTaintRule] + type deviceTaintRuleInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type deviceTaintRuleInformer struct { // NewDeviceTaintRuleInformer constructs a new informer for DeviceTaintRule type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeviceTaintRuleInformer]). func NewDeviceTaintRuleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedDeviceTaintRuleInformer constructs a new informer for DeviceTaintRule type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeviceTaintRuleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers DeviceTaintRuleIndexers) DeviceTaintRuleIndexInformer { + return NewTypedDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredDeviceTaintRuleInformer constructs a new informer for DeviceTaintRule type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredDeviceTaintRuleInformer]). func NewFilteredDeviceTaintRuleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredDeviceTaintRuleInformer constructs a new informer for DeviceTaintRule type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredDeviceTaintRuleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers DeviceTaintRuleIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) DeviceTaintRuleIndexInformer { + return NewTypedDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewDeviceTaintRuleInformerWithOptions constructs a new informer for DeviceTaintRule type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedDeviceTaintRuleInformerWithOptions]). func NewDeviceTaintRuleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedDeviceTaintRuleInformerWithOptions(client, options) +} + +// NewTypedDeviceTaintRuleInformerWithOptions constructs a new informer for DeviceTaintRule type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedDeviceTaintRuleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) DeviceTaintRuleIndexInformer { gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta2", Resource: "devicetaintrules"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.DeviceTaintRule](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewDeviceTaintRuleInformerWithOptions(client kubernetes.Interface, options Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *deviceTaintRuleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *deviceTaintRuleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1beta2.DeviceTaintRule{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *deviceTaintRuleInformer) TypedInformer() DeviceTaintRuleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.DeviceTaintRule](f.factory.InformerFor(&apiresourcev1beta2.DeviceTaintRule{}, f.defaultInformer)) } func (f *deviceTaintRuleInformer) Lister() resourcev1beta2.DeviceTaintRuleLister { return resourcev1beta2.NewDeviceTaintRuleLister(f.Informer().GetIndexer()) } + +// ToTypedDeviceTaintRuleInformer converts an untyped informer into a TypedDeviceTaintRuleInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *DeviceTaintRule. If that is not the case, calling type-safe methods of the returned +// TypedDeviceTaintRuleInformer leads to runtime panics. A safer alternative is to pass +// around a TypedDeviceTaintRuleInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedDeviceTaintRuleInformer(informer DeviceTaintRuleInformer) TypedDeviceTaintRuleInformer { + if informer, ok := informer.(TypedDeviceTaintRuleInformer); ok { + return informer + } + return &deviceTaintRuleTypedInformerAdapter{informer} +} + +type deviceTaintRuleTypedInformerAdapter struct { + DeviceTaintRuleInformer +} + +func (a *deviceTaintRuleTypedInformerAdapter) TypedInformer() DeviceTaintRuleIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.DeviceTaintRule](a.Informer()) +} + +// ToDeviceTaintRuleIndexInformer converts an untyped informer into a DeviceTaintRuleIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *DeviceTaintRule. If that is not the case, calling type-safe methods of the returned +// DeviceTaintRuleIndexInformer leads to runtime panics. A safer alternative is to pass +// around a DeviceTaintRuleIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToDeviceTaintRuleIndexInformer(informer cache.SharedIndexInformer) DeviceTaintRuleIndexInformer { + if informer, ok := informer.(DeviceTaintRuleIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.DeviceTaintRule](informer) +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta2/interface.go b/vendor/k8s.io/client-go/informers/resource/v1beta2/interface.go index a05e518e2e..29ac4b38f1 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta2/interface.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta2/interface.go @@ -25,15 +25,15 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // DeviceClasses returns a DeviceClassInformer. - DeviceClasses() DeviceClassInformer + DeviceClasses() TypedDeviceClassInformer // DeviceTaintRules returns a DeviceTaintRuleInformer. - DeviceTaintRules() DeviceTaintRuleInformer + DeviceTaintRules() TypedDeviceTaintRuleInformer // ResourceClaims returns a ResourceClaimInformer. - ResourceClaims() ResourceClaimInformer + ResourceClaims() TypedResourceClaimInformer // ResourceClaimTemplates returns a ResourceClaimTemplateInformer. - ResourceClaimTemplates() ResourceClaimTemplateInformer + ResourceClaimTemplates() TypedResourceClaimTemplateInformer // ResourceSlices returns a ResourceSliceInformer. - ResourceSlices() ResourceSliceInformer + ResourceSlices() TypedResourceSliceInformer } type version struct { @@ -47,27 +47,27 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// DeviceClasses returns a DeviceClassInformer. -func (v *version) DeviceClasses() DeviceClassInformer { +// DeviceClasses returns a TypedDeviceClassInformer. +func (v *version) DeviceClasses() TypedDeviceClassInformer { return &deviceClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// DeviceTaintRules returns a DeviceTaintRuleInformer. -func (v *version) DeviceTaintRules() DeviceTaintRuleInformer { +// DeviceTaintRules returns a TypedDeviceTaintRuleInformer. +func (v *version) DeviceTaintRules() TypedDeviceTaintRuleInformer { return &deviceTaintRuleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// ResourceClaims returns a ResourceClaimInformer. -func (v *version) ResourceClaims() ResourceClaimInformer { +// ResourceClaims returns a TypedResourceClaimInformer. +func (v *version) ResourceClaims() TypedResourceClaimInformer { return &resourceClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// ResourceClaimTemplates returns a ResourceClaimTemplateInformer. -func (v *version) ResourceClaimTemplates() ResourceClaimTemplateInformer { +// ResourceClaimTemplates returns a TypedResourceClaimTemplateInformer. +func (v *version) ResourceClaimTemplates() TypedResourceClaimTemplateInformer { return &resourceClaimTemplateInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// ResourceSlices returns a ResourceSliceInformer. -func (v *version) ResourceSlices() ResourceSliceInformer { +// ResourceSlices returns a TypedResourceSliceInformer. +func (v *version) ResourceSlices() TypedResourceSliceInformer { return &resourceSliceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceclaim.go b/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceclaim.go index 61dc6db17d..afea5d0d94 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceclaim.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceclaim.go @@ -34,12 +34,40 @@ import ( ) // ResourceClaimInformer provides access to a shared informer and lister for -// ResourceClaims. +// ResourceClaims. Prefer using the type-safe variant (see [TypedResourceClaimInformer]). type ResourceClaimInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1beta2.ResourceClaimLister } +// TypedResourceClaimInformer provides access to a shared informer and lister for +// ResourceClaims, including the type-safe TypedInformer variant. +// It is a superset of ResourceClaimInformer. +type TypedResourceClaimInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ResourceClaimIndexInformer + Lister() resourcev1beta2.ResourceClaimLister +} + +// ResourceClaimIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ResourceClaimIndexInformer cache.TypedSharedIndexInformer[*apiresourcev1beta2.ResourceClaim] + +// ResourceClaimHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ResourceClaim. +type ResourceClaimHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiresourcev1beta2.ResourceClaim] + +// ResourceClaimDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ResourceClaim. +type ResourceClaimDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiresourcev1beta2.ResourceClaim] + +// ResourceClaimFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ResourceClaim. +type ResourceClaimFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiresourcev1beta2.ResourceClaim] + +// ResourceClaimIndexers is a specialization of [cache.TypedIndexers] for ResourceClaim. +type ResourceClaimIndexers = cache.TypedIndexers[*apiresourcev1beta2.ResourceClaim] + +// DeletedResourceClaim is a specialization of [cache.DeletedObject] for ResourceClaim. +type DeletedResourceClaim = cache.DeletedObject[*apiresourcev1beta2.ResourceClaim] + type resourceClaimInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type resourceClaimInformer struct { // NewResourceClaimInformer constructs a new informer for ResourceClaim type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceClaimInformer]). func NewResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedResourceClaimInformer constructs a new informer for ResourceClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ResourceClaimIndexers) ResourceClaimIndexInformer { + return NewTypedResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredResourceClaimInformer constructs a new informer for ResourceClaim type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredResourceClaimInformer]). func NewFilteredResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredResourceClaimInformer constructs a new informer for ResourceClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ResourceClaimIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ResourceClaimIndexInformer { + return NewTypedResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewResourceClaimInformerWithOptions constructs a new informer for ResourceClaim type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceClaimInformerWithOptions]). func NewResourceClaimInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedResourceClaimInformerWithOptions(client, namespace, options) +} + +// NewTypedResourceClaimInformerWithOptions constructs a new informer for ResourceClaim type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceClaimInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) ResourceClaimIndexInformer { gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta2", Resource: "resourceclaims"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.ResourceClaim](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewResourceClaimInformerWithOptions(client kubernetes.Interface, namespace Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *resourceClaimInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewResourceClaimInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedResourceClaimInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceClaimInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1beta2.ResourceClaim{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *resourceClaimInformer) TypedInformer() ResourceClaimIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.ResourceClaim](f.factory.InformerFor(&apiresourcev1beta2.ResourceClaim{}, f.defaultInformer)) } func (f *resourceClaimInformer) Lister() resourcev1beta2.ResourceClaimLister { return resourcev1beta2.NewResourceClaimLister(f.Informer().GetIndexer()) } + +// ToTypedResourceClaimInformer converts an untyped informer into a TypedResourceClaimInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceClaim. If that is not the case, calling type-safe methods of the returned +// TypedResourceClaimInformer leads to runtime panics. A safer alternative is to pass +// around a TypedResourceClaimInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedResourceClaimInformer(informer ResourceClaimInformer) TypedResourceClaimInformer { + if informer, ok := informer.(TypedResourceClaimInformer); ok { + return informer + } + return &resourceClaimTypedInformerAdapter{informer} +} + +type resourceClaimTypedInformerAdapter struct { + ResourceClaimInformer +} + +func (a *resourceClaimTypedInformerAdapter) TypedInformer() ResourceClaimIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.ResourceClaim](a.Informer()) +} + +// ToResourceClaimIndexInformer converts an untyped informer into a ResourceClaimIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceClaim. If that is not the case, calling type-safe methods of the returned +// ResourceClaimIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ResourceClaimIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToResourceClaimIndexInformer(informer cache.SharedIndexInformer) ResourceClaimIndexInformer { + if informer, ok := informer.(ResourceClaimIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.ResourceClaim](informer) +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceclaimtemplate.go b/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceclaimtemplate.go index ee22977a39..c7ee33df62 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceclaimtemplate.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceclaimtemplate.go @@ -34,12 +34,40 @@ import ( ) // ResourceClaimTemplateInformer provides access to a shared informer and lister for -// ResourceClaimTemplates. +// ResourceClaimTemplates. Prefer using the type-safe variant (see [TypedResourceClaimTemplateInformer]). type ResourceClaimTemplateInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1beta2.ResourceClaimTemplateLister } +// TypedResourceClaimTemplateInformer provides access to a shared informer and lister for +// ResourceClaimTemplates, including the type-safe TypedInformer variant. +// It is a superset of ResourceClaimTemplateInformer. +type TypedResourceClaimTemplateInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ResourceClaimTemplateIndexInformer + Lister() resourcev1beta2.ResourceClaimTemplateLister +} + +// ResourceClaimTemplateIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ResourceClaimTemplateIndexInformer cache.TypedSharedIndexInformer[*apiresourcev1beta2.ResourceClaimTemplate] + +// ResourceClaimTemplateHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ResourceClaimTemplate. +type ResourceClaimTemplateHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiresourcev1beta2.ResourceClaimTemplate] + +// ResourceClaimTemplateDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ResourceClaimTemplate. +type ResourceClaimTemplateDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiresourcev1beta2.ResourceClaimTemplate] + +// ResourceClaimTemplateFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ResourceClaimTemplate. +type ResourceClaimTemplateFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiresourcev1beta2.ResourceClaimTemplate] + +// ResourceClaimTemplateIndexers is a specialization of [cache.TypedIndexers] for ResourceClaimTemplate. +type ResourceClaimTemplateIndexers = cache.TypedIndexers[*apiresourcev1beta2.ResourceClaimTemplate] + +// DeletedResourceClaimTemplate is a specialization of [cache.DeletedObject] for ResourceClaimTemplate. +type DeletedResourceClaimTemplate = cache.DeletedObject[*apiresourcev1beta2.ResourceClaimTemplate] + type resourceClaimTemplateInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type resourceClaimTemplateInformer struct { // NewResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceClaimTemplateInformer]). func NewResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ResourceClaimTemplateIndexers) ResourceClaimTemplateIndexInformer { + return NewTypedResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredResourceClaimTemplateInformer]). func NewFilteredResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers ResourceClaimTemplateIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ResourceClaimTemplateIndexInformer { + return NewTypedResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewResourceClaimTemplateInformerWithOptions constructs a new informer for ResourceClaimTemplate type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceClaimTemplateInformerWithOptions]). func NewResourceClaimTemplateInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedResourceClaimTemplateInformerWithOptions(client, namespace, options) +} + +// NewTypedResourceClaimTemplateInformerWithOptions constructs a new informer for ResourceClaimTemplate type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceClaimTemplateInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) ResourceClaimTemplateIndexInformer { gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta2", Resource: "resourceclaimtemplates"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.ResourceClaimTemplate](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewResourceClaimTemplateInformerWithOptions(client kubernetes.Interface, na Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *resourceClaimTemplateInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewResourceClaimTemplateInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedResourceClaimTemplateInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceClaimTemplateInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1beta2.ResourceClaimTemplate{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *resourceClaimTemplateInformer) TypedInformer() ResourceClaimTemplateIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.ResourceClaimTemplate](f.factory.InformerFor(&apiresourcev1beta2.ResourceClaimTemplate{}, f.defaultInformer)) } func (f *resourceClaimTemplateInformer) Lister() resourcev1beta2.ResourceClaimTemplateLister { return resourcev1beta2.NewResourceClaimTemplateLister(f.Informer().GetIndexer()) } + +// ToTypedResourceClaimTemplateInformer converts an untyped informer into a TypedResourceClaimTemplateInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceClaimTemplate. If that is not the case, calling type-safe methods of the returned +// TypedResourceClaimTemplateInformer leads to runtime panics. A safer alternative is to pass +// around a TypedResourceClaimTemplateInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedResourceClaimTemplateInformer(informer ResourceClaimTemplateInformer) TypedResourceClaimTemplateInformer { + if informer, ok := informer.(TypedResourceClaimTemplateInformer); ok { + return informer + } + return &resourceClaimTemplateTypedInformerAdapter{informer} +} + +type resourceClaimTemplateTypedInformerAdapter struct { + ResourceClaimTemplateInformer +} + +func (a *resourceClaimTemplateTypedInformerAdapter) TypedInformer() ResourceClaimTemplateIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.ResourceClaimTemplate](a.Informer()) +} + +// ToResourceClaimTemplateIndexInformer converts an untyped informer into a ResourceClaimTemplateIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceClaimTemplate. If that is not the case, calling type-safe methods of the returned +// ResourceClaimTemplateIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ResourceClaimTemplateIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToResourceClaimTemplateIndexInformer(informer cache.SharedIndexInformer) ResourceClaimTemplateIndexInformer { + if informer, ok := informer.(ResourceClaimTemplateIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.ResourceClaimTemplate](informer) +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceslice.go b/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceslice.go index 7a8027886e..248ad44786 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceslice.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceslice.go @@ -34,12 +34,40 @@ import ( ) // ResourceSliceInformer provides access to a shared informer and lister for -// ResourceSlices. +// ResourceSlices. Prefer using the type-safe variant (see [TypedResourceSliceInformer]). type ResourceSliceInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1beta2.ResourceSliceLister } +// TypedResourceSliceInformer provides access to a shared informer and lister for +// ResourceSlices, including the type-safe TypedInformer variant. +// It is a superset of ResourceSliceInformer. +type TypedResourceSliceInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ResourceSliceIndexInformer + Lister() resourcev1beta2.ResourceSliceLister +} + +// ResourceSliceIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ResourceSliceIndexInformer cache.TypedSharedIndexInformer[*apiresourcev1beta2.ResourceSlice] + +// ResourceSliceHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ResourceSlice. +type ResourceSliceHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apiresourcev1beta2.ResourceSlice] + +// ResourceSliceDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ResourceSlice. +type ResourceSliceDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apiresourcev1beta2.ResourceSlice] + +// ResourceSliceFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ResourceSlice. +type ResourceSliceFilteringHandler = cache.TypedFilteringResourceEventHandler[*apiresourcev1beta2.ResourceSlice] + +// ResourceSliceIndexers is a specialization of [cache.TypedIndexers] for ResourceSlice. +type ResourceSliceIndexers = cache.TypedIndexers[*apiresourcev1beta2.ResourceSlice] + +// DeletedResourceSlice is a specialization of [cache.DeletedObject] for ResourceSlice. +type DeletedResourceSlice = cache.DeletedObject[*apiresourcev1beta2.ResourceSlice] + type resourceSliceInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type resourceSliceInformer struct { // NewResourceSliceInformer constructs a new informer for ResourceSlice type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceSliceInformer]). func NewResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedResourceSliceInformer constructs a new informer for ResourceSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ResourceSliceIndexers) ResourceSliceIndexInformer { + return NewTypedResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredResourceSliceInformer constructs a new informer for ResourceSlice type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredResourceSliceInformer]). func NewFilteredResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredResourceSliceInformer constructs a new informer for ResourceSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers ResourceSliceIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ResourceSliceIndexInformer { + return NewTypedResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewResourceSliceInformerWithOptions constructs a new informer for ResourceSlice type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedResourceSliceInformerWithOptions]). func NewResourceSliceInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedResourceSliceInformerWithOptions(client, options) +} + +// NewTypedResourceSliceInformerWithOptions constructs a new informer for ResourceSlice type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedResourceSliceInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) ResourceSliceIndexInformer { gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta2", Resource: "resourceslices"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.ResourceSlice](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewResourceSliceInformerWithOptions(client kubernetes.Interface, options in Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *resourceSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceSliceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1beta2.ResourceSlice{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *resourceSliceInformer) TypedInformer() ResourceSliceIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.ResourceSlice](f.factory.InformerFor(&apiresourcev1beta2.ResourceSlice{}, f.defaultInformer)) } func (f *resourceSliceInformer) Lister() resourcev1beta2.ResourceSliceLister { return resourcev1beta2.NewResourceSliceLister(f.Informer().GetIndexer()) } + +// ToTypedResourceSliceInformer converts an untyped informer into a TypedResourceSliceInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceSlice. If that is not the case, calling type-safe methods of the returned +// TypedResourceSliceInformer leads to runtime panics. A safer alternative is to pass +// around a TypedResourceSliceInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedResourceSliceInformer(informer ResourceSliceInformer) TypedResourceSliceInformer { + if informer, ok := informer.(TypedResourceSliceInformer); ok { + return informer + } + return &resourceSliceTypedInformerAdapter{informer} +} + +type resourceSliceTypedInformerAdapter struct { + ResourceSliceInformer +} + +func (a *resourceSliceTypedInformerAdapter) TypedInformer() ResourceSliceIndexInformer { + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.ResourceSlice](a.Informer()) +} + +// ToResourceSliceIndexInformer converts an untyped informer into a ResourceSliceIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ResourceSlice. If that is not the case, calling type-safe methods of the returned +// ResourceSliceIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ResourceSliceIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToResourceSliceIndexInformer(informer cache.SharedIndexInformer) ResourceSliceIndexInformer { + if informer, ok := informer.(ResourceSliceIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apiresourcev1beta2.ResourceSlice](informer) +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/interface.go b/vendor/k8s.io/client-go/informers/scheduling/interface.go index e55a8410d1..bd66d6c3ab 100644 --- a/vendor/k8s.io/client-go/informers/scheduling/interface.go +++ b/vendor/k8s.io/client-go/informers/scheduling/interface.go @@ -21,7 +21,7 @@ package scheduling import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" v1 "k8s.io/client-go/informers/scheduling/v1" - v1alpha2 "k8s.io/client-go/informers/scheduling/v1alpha2" + v1alpha3 "k8s.io/client-go/informers/scheduling/v1alpha3" v1beta1 "k8s.io/client-go/informers/scheduling/v1beta1" ) @@ -29,8 +29,8 @@ import ( type Interface interface { // V1 provides access to shared informers for resources in V1. V1() v1.Interface - // V1alpha2 provides access to shared informers for resources in V1alpha2. - V1alpha2() v1alpha2.Interface + // V1alpha3 provides access to shared informers for resources in V1alpha3. + V1alpha3() v1alpha3.Interface // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface } @@ -51,9 +51,9 @@ func (g *group) V1() v1.Interface { return v1.New(g.factory, g.namespace, g.tweakListOptions) } -// V1alpha2 returns a new v1alpha2.Interface. -func (g *group) V1alpha2() v1alpha2.Interface { - return v1alpha2.New(g.factory, g.namespace, g.tweakListOptions) +// V1alpha3 returns a new v1alpha3.Interface. +func (g *group) V1alpha3() v1alpha3.Interface { + return v1alpha3.New(g.factory, g.namespace, g.tweakListOptions) } // V1beta1 returns a new v1beta1.Interface. diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1/interface.go b/vendor/k8s.io/client-go/informers/scheduling/v1/interface.go index fd7931f34a..fd3b20d969 100644 --- a/vendor/k8s.io/client-go/informers/scheduling/v1/interface.go +++ b/vendor/k8s.io/client-go/informers/scheduling/v1/interface.go @@ -25,7 +25,7 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // PriorityClasses returns a PriorityClassInformer. - PriorityClasses() PriorityClassInformer + PriorityClasses() TypedPriorityClassInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// PriorityClasses returns a PriorityClassInformer. -func (v *version) PriorityClasses() PriorityClassInformer { +// PriorityClasses returns a TypedPriorityClassInformer. +func (v *version) PriorityClasses() TypedPriorityClassInformer { return &priorityClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go b/vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go index f1d18f2a01..8b4daf5caa 100644 --- a/vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go +++ b/vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go @@ -34,12 +34,40 @@ import ( ) // PriorityClassInformer provides access to a shared informer and lister for -// PriorityClasses. +// PriorityClasses. Prefer using the type-safe variant (see [TypedPriorityClassInformer]). type PriorityClassInformer interface { Informer() cache.SharedIndexInformer Lister() schedulingv1.PriorityClassLister } +// TypedPriorityClassInformer provides access to a shared informer and lister for +// PriorityClasses, including the type-safe TypedInformer variant. +// It is a superset of PriorityClassInformer. +type TypedPriorityClassInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() PriorityClassIndexInformer + Lister() schedulingv1.PriorityClassLister +} + +// PriorityClassIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type PriorityClassIndexInformer cache.TypedSharedIndexInformer[*apischedulingv1.PriorityClass] + +// PriorityClassHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for PriorityClass. +type PriorityClassHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apischedulingv1.PriorityClass] + +// PriorityClassDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for PriorityClass. +type PriorityClassDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apischedulingv1.PriorityClass] + +// PriorityClassFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for PriorityClass. +type PriorityClassFilteringHandler = cache.TypedFilteringResourceEventHandler[*apischedulingv1.PriorityClass] + +// PriorityClassIndexers is a specialization of [cache.TypedIndexers] for PriorityClass. +type PriorityClassIndexers = cache.TypedIndexers[*apischedulingv1.PriorityClass] + +// DeletedPriorityClass is a specialization of [cache.DeletedObject] for PriorityClass. +type DeletedPriorityClass = cache.DeletedObject[*apischedulingv1.PriorityClass] + type priorityClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type priorityClassInformer struct { // NewPriorityClassInformer constructs a new informer for PriorityClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPriorityClassInformer]). func NewPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers PriorityClassIndexers) PriorityClassIndexInformer { + return NewTypedPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredPriorityClassInformer constructs a new informer for PriorityClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredPriorityClassInformer]). func NewFilteredPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers PriorityClassIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) PriorityClassIndexInformer { + return NewTypedPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewPriorityClassInformerWithOptions constructs a new informer for PriorityClass type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPriorityClassInformerWithOptions]). func NewPriorityClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedPriorityClassInformerWithOptions(client, options) +} + +// NewTypedPriorityClassInformerWithOptions constructs a new informer for PriorityClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPriorityClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) PriorityClassIndexInformer { gvr := schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1", Resource: "priorityclasss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apischedulingv1.PriorityClass](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewPriorityClassInformerWithOptions(client kubernetes.Interface, options in Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *priorityClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *priorityClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apischedulingv1.PriorityClass{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *priorityClassInformer) TypedInformer() PriorityClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apischedulingv1.PriorityClass](f.factory.InformerFor(&apischedulingv1.PriorityClass{}, f.defaultInformer)) } func (f *priorityClassInformer) Lister() schedulingv1.PriorityClassLister { return schedulingv1.NewPriorityClassLister(f.Informer().GetIndexer()) } + +// ToTypedPriorityClassInformer converts an untyped informer into a TypedPriorityClassInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PriorityClass. If that is not the case, calling type-safe methods of the returned +// TypedPriorityClassInformer leads to runtime panics. A safer alternative is to pass +// around a TypedPriorityClassInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedPriorityClassInformer(informer PriorityClassInformer) TypedPriorityClassInformer { + if informer, ok := informer.(TypedPriorityClassInformer); ok { + return informer + } + return &priorityClassTypedInformerAdapter{informer} +} + +type priorityClassTypedInformerAdapter struct { + PriorityClassInformer +} + +func (a *priorityClassTypedInformerAdapter) TypedInformer() PriorityClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apischedulingv1.PriorityClass](a.Informer()) +} + +// ToPriorityClassIndexInformer converts an untyped informer into a PriorityClassIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PriorityClass. If that is not the case, calling type-safe methods of the returned +// PriorityClassIndexInformer leads to runtime panics. A safer alternative is to pass +// around a PriorityClassIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToPriorityClassIndexInformer(informer cache.SharedIndexInformer) PriorityClassIndexInformer { + if informer, ok := informer.(PriorityClassIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apischedulingv1.PriorityClass](informer) +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1alpha2/podgroup.go b/vendor/k8s.io/client-go/informers/scheduling/v1alpha2/podgroup.go deleted file mode 100644 index 5f39858c65..0000000000 --- a/vendor/k8s.io/client-go/informers/scheduling/v1alpha2/podgroup.go +++ /dev/null @@ -1,116 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - context "context" - time "time" - - apischedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - watch "k8s.io/apimachinery/pkg/watch" - internalinterfaces "k8s.io/client-go/informers/internalinterfaces" - kubernetes "k8s.io/client-go/kubernetes" - schedulingv1alpha2 "k8s.io/client-go/listers/scheduling/v1alpha2" - cache "k8s.io/client-go/tools/cache" -) - -// PodGroupInformer provides access to a shared informer and lister for -// PodGroups. -type PodGroupInformer interface { - Informer() cache.SharedIndexInformer - Lister() schedulingv1alpha2.PodGroupLister -} - -type podGroupInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewPodGroupInformer constructs a new informer for PodGroup type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewPodGroupInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewPodGroupInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) -} - -// NewFilteredPodGroupInformer constructs a new informer for PodGroup type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredPodGroupInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewPodGroupInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) -} - -// NewPodGroupInformerWithOptions constructs a new informer for PodGroup type with additional options. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewPodGroupInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { - gvr := schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1alpha2", Resource: "podgroups"} - identifier := options.InformerName.WithResource(gvr) - tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( - cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&opts) - } - return client.SchedulingV1alpha2().PodGroups(namespace).List(context.Background(), opts) - }, - WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&opts) - } - return client.SchedulingV1alpha2().PodGroups(namespace).Watch(context.Background(), opts) - }, - ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&opts) - } - return client.SchedulingV1alpha2().PodGroups(namespace).List(ctx, opts) - }, - WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&opts) - } - return client.SchedulingV1alpha2().PodGroups(namespace).Watch(ctx, opts) - }, - }, client), - &apischedulingv1alpha2.PodGroup{}, - cache.SharedIndexInformerOptions{ - ResyncPeriod: options.ResyncPeriod, - Indexers: options.Indexers, - Identifier: identifier, - }, - ) -} - -func (f *podGroupInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewPodGroupInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) -} - -func (f *podGroupInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apischedulingv1alpha2.PodGroup{}, f.defaultInformer) -} - -func (f *podGroupInformer) Lister() schedulingv1alpha2.PodGroupLister { - return schedulingv1alpha2.NewPodGroupLister(f.Informer().GetIndexer()) -} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1alpha2/workload.go b/vendor/k8s.io/client-go/informers/scheduling/v1alpha2/workload.go deleted file mode 100644 index ffe2f4ece7..0000000000 --- a/vendor/k8s.io/client-go/informers/scheduling/v1alpha2/workload.go +++ /dev/null @@ -1,116 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - context "context" - time "time" - - apischedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - watch "k8s.io/apimachinery/pkg/watch" - internalinterfaces "k8s.io/client-go/informers/internalinterfaces" - kubernetes "k8s.io/client-go/kubernetes" - schedulingv1alpha2 "k8s.io/client-go/listers/scheduling/v1alpha2" - cache "k8s.io/client-go/tools/cache" -) - -// WorkloadInformer provides access to a shared informer and lister for -// Workloads. -type WorkloadInformer interface { - Informer() cache.SharedIndexInformer - Lister() schedulingv1alpha2.WorkloadLister -} - -type workloadInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewWorkloadInformer constructs a new informer for Workload type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewWorkloadInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewWorkloadInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) -} - -// NewFilteredWorkloadInformer constructs a new informer for Workload type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredWorkloadInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewWorkloadInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) -} - -// NewWorkloadInformerWithOptions constructs a new informer for Workload type with additional options. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewWorkloadInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { - gvr := schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1alpha2", Resource: "workloads"} - identifier := options.InformerName.WithResource(gvr) - tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( - cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&opts) - } - return client.SchedulingV1alpha2().Workloads(namespace).List(context.Background(), opts) - }, - WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&opts) - } - return client.SchedulingV1alpha2().Workloads(namespace).Watch(context.Background(), opts) - }, - ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&opts) - } - return client.SchedulingV1alpha2().Workloads(namespace).List(ctx, opts) - }, - WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&opts) - } - return client.SchedulingV1alpha2().Workloads(namespace).Watch(ctx, opts) - }, - }, client), - &apischedulingv1alpha2.Workload{}, - cache.SharedIndexInformerOptions{ - ResyncPeriod: options.ResyncPeriod, - Indexers: options.Indexers, - Identifier: identifier, - }, - ) -} - -func (f *workloadInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewWorkloadInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) -} - -func (f *workloadInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apischedulingv1alpha2.Workload{}, f.defaultInformer) -} - -func (f *workloadInformer) Lister() schedulingv1alpha2.WorkloadLister { - return schedulingv1alpha2.NewWorkloadLister(f.Informer().GetIndexer()) -} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1alpha3/compositepodgroup.go b/vendor/k8s.io/client-go/informers/scheduling/v1alpha3/compositepodgroup.go new file mode 100644 index 0000000000..9556755dc9 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1alpha3/compositepodgroup.go @@ -0,0 +1,208 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + context "context" + time "time" + + apischedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + schedulingv1alpha3 "k8s.io/client-go/listers/scheduling/v1alpha3" + cache "k8s.io/client-go/tools/cache" +) + +// CompositePodGroupInformer provides access to a shared informer and lister for +// CompositePodGroups. Prefer using the type-safe variant (see [TypedCompositePodGroupInformer]). +type CompositePodGroupInformer interface { + Informer() cache.SharedIndexInformer + Lister() schedulingv1alpha3.CompositePodGroupLister +} + +// TypedCompositePodGroupInformer provides access to a shared informer and lister for +// CompositePodGroups, including the type-safe TypedInformer variant. +// It is a superset of CompositePodGroupInformer. +type TypedCompositePodGroupInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() CompositePodGroupIndexInformer + Lister() schedulingv1alpha3.CompositePodGroupLister +} + +// CompositePodGroupIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type CompositePodGroupIndexInformer cache.TypedSharedIndexInformer[*apischedulingv1alpha3.CompositePodGroup] + +// CompositePodGroupHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for CompositePodGroup. +type CompositePodGroupHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apischedulingv1alpha3.CompositePodGroup] + +// CompositePodGroupDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for CompositePodGroup. +type CompositePodGroupDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apischedulingv1alpha3.CompositePodGroup] + +// CompositePodGroupFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for CompositePodGroup. +type CompositePodGroupFilteringHandler = cache.TypedFilteringResourceEventHandler[*apischedulingv1alpha3.CompositePodGroup] + +// CompositePodGroupIndexers is a specialization of [cache.TypedIndexers] for CompositePodGroup. +type CompositePodGroupIndexers = cache.TypedIndexers[*apischedulingv1alpha3.CompositePodGroup] + +// DeletedCompositePodGroup is a specialization of [cache.DeletedObject] for CompositePodGroup. +type DeletedCompositePodGroup = cache.DeletedObject[*apischedulingv1alpha3.CompositePodGroup] + +type compositePodGroupInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCompositePodGroupInformer constructs a new informer for CompositePodGroup type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCompositePodGroupInformer]). +func NewCompositePodGroupInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewCompositePodGroupInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewTypedCompositePodGroupInformer constructs a new informer for CompositePodGroup type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCompositePodGroupInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers CompositePodGroupIndexers) CompositePodGroupIndexInformer { + return NewTypedCompositePodGroupInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + +// NewFilteredCompositePodGroupInformer constructs a new informer for CompositePodGroup type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredCompositePodGroupInformer]). +func NewFilteredCompositePodGroupInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewTypedCompositePodGroupInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredCompositePodGroupInformer constructs a new informer for CompositePodGroup type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredCompositePodGroupInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers CompositePodGroupIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) CompositePodGroupIndexInformer { + return NewTypedCompositePodGroupInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) +} + +// NewCompositePodGroupInformerWithOptions constructs a new informer for CompositePodGroup type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCompositePodGroupInformerWithOptions]). +func NewCompositePodGroupInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedCompositePodGroupInformerWithOptions(client, namespace, options) +} + +// NewTypedCompositePodGroupInformerWithOptions constructs a new informer for CompositePodGroup type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCompositePodGroupInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) CompositePodGroupIndexInformer { + gvr := schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1alpha3", Resource: "compositepodgroups"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewTypedSharedIndexInformer[*apischedulingv1alpha3.CompositePodGroup](cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha3().CompositePodGroups(namespace).List(context.Background(), opts) + }, + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha3().CompositePodGroups(namespace).Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha3().CompositePodGroups(namespace).List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha3().CompositePodGroups(namespace).Watch(ctx, opts) + }, + }, client), + &apischedulingv1alpha3.CompositePodGroup{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + )) +} + +func (f *compositePodGroupInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewTypedCompositePodGroupInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *compositePodGroupInformer) Informer() cache.SharedIndexInformer { + return f.TypedInformer() +} + +func (f *compositePodGroupInformer) TypedInformer() CompositePodGroupIndexInformer { + return cache.NewTypedSharedIndexInformer[*apischedulingv1alpha3.CompositePodGroup](f.factory.InformerFor(&apischedulingv1alpha3.CompositePodGroup{}, f.defaultInformer)) +} + +func (f *compositePodGroupInformer) Lister() schedulingv1alpha3.CompositePodGroupLister { + return schedulingv1alpha3.NewCompositePodGroupLister(f.Informer().GetIndexer()) +} + +// ToTypedCompositePodGroupInformer converts an untyped informer into a TypedCompositePodGroupInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CompositePodGroup. If that is not the case, calling type-safe methods of the returned +// TypedCompositePodGroupInformer leads to runtime panics. A safer alternative is to pass +// around a TypedCompositePodGroupInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedCompositePodGroupInformer(informer CompositePodGroupInformer) TypedCompositePodGroupInformer { + if informer, ok := informer.(TypedCompositePodGroupInformer); ok { + return informer + } + return &compositePodGroupTypedInformerAdapter{informer} +} + +type compositePodGroupTypedInformerAdapter struct { + CompositePodGroupInformer +} + +func (a *compositePodGroupTypedInformerAdapter) TypedInformer() CompositePodGroupIndexInformer { + return cache.NewTypedSharedIndexInformer[*apischedulingv1alpha3.CompositePodGroup](a.Informer()) +} + +// ToCompositePodGroupIndexInformer converts an untyped informer into a CompositePodGroupIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CompositePodGroup. If that is not the case, calling type-safe methods of the returned +// CompositePodGroupIndexInformer leads to runtime panics. A safer alternative is to pass +// around a CompositePodGroupIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToCompositePodGroupIndexInformer(informer cache.SharedIndexInformer) CompositePodGroupIndexInformer { + if informer, ok := informer.(CompositePodGroupIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apischedulingv1alpha3.CompositePodGroup](informer) +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1alpha2/interface.go b/vendor/k8s.io/client-go/informers/scheduling/v1alpha3/interface.go similarity index 70% rename from vendor/k8s.io/client-go/informers/scheduling/v1alpha2/interface.go rename to vendor/k8s.io/client-go/informers/scheduling/v1alpha3/interface.go index 8edc498b67..1471eb3d5b 100644 --- a/vendor/k8s.io/client-go/informers/scheduling/v1alpha2/interface.go +++ b/vendor/k8s.io/client-go/informers/scheduling/v1alpha3/interface.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" @@ -24,10 +24,12 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { + // CompositePodGroups returns a CompositePodGroupInformer. + CompositePodGroups() TypedCompositePodGroupInformer // PodGroups returns a PodGroupInformer. - PodGroups() PodGroupInformer + PodGroups() TypedPodGroupInformer // Workloads returns a WorkloadInformer. - Workloads() WorkloadInformer + Workloads() TypedWorkloadInformer } type version struct { @@ -41,12 +43,17 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// PodGroups returns a PodGroupInformer. -func (v *version) PodGroups() PodGroupInformer { +// CompositePodGroups returns a TypedCompositePodGroupInformer. +func (v *version) CompositePodGroups() TypedCompositePodGroupInformer { + return &compositePodGroupInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// PodGroups returns a TypedPodGroupInformer. +func (v *version) PodGroups() TypedPodGroupInformer { return &podGroupInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// Workloads returns a WorkloadInformer. -func (v *version) Workloads() WorkloadInformer { +// Workloads returns a TypedWorkloadInformer. +func (v *version) Workloads() TypedWorkloadInformer { return &workloadInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1alpha3/podgroup.go b/vendor/k8s.io/client-go/informers/scheduling/v1alpha3/podgroup.go new file mode 100644 index 0000000000..3b0c4d8315 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1alpha3/podgroup.go @@ -0,0 +1,208 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + context "context" + time "time" + + apischedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + schedulingv1alpha3 "k8s.io/client-go/listers/scheduling/v1alpha3" + cache "k8s.io/client-go/tools/cache" +) + +// PodGroupInformer provides access to a shared informer and lister for +// PodGroups. Prefer using the type-safe variant (see [TypedPodGroupInformer]). +type PodGroupInformer interface { + Informer() cache.SharedIndexInformer + Lister() schedulingv1alpha3.PodGroupLister +} + +// TypedPodGroupInformer provides access to a shared informer and lister for +// PodGroups, including the type-safe TypedInformer variant. +// It is a superset of PodGroupInformer. +type TypedPodGroupInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() PodGroupIndexInformer + Lister() schedulingv1alpha3.PodGroupLister +} + +// PodGroupIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type PodGroupIndexInformer cache.TypedSharedIndexInformer[*apischedulingv1alpha3.PodGroup] + +// PodGroupHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for PodGroup. +type PodGroupHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apischedulingv1alpha3.PodGroup] + +// PodGroupDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for PodGroup. +type PodGroupDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apischedulingv1alpha3.PodGroup] + +// PodGroupFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for PodGroup. +type PodGroupFilteringHandler = cache.TypedFilteringResourceEventHandler[*apischedulingv1alpha3.PodGroup] + +// PodGroupIndexers is a specialization of [cache.TypedIndexers] for PodGroup. +type PodGroupIndexers = cache.TypedIndexers[*apischedulingv1alpha3.PodGroup] + +// DeletedPodGroup is a specialization of [cache.DeletedObject] for PodGroup. +type DeletedPodGroup = cache.DeletedObject[*apischedulingv1alpha3.PodGroup] + +type podGroupInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodGroupInformer constructs a new informer for PodGroup type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPodGroupInformer]). +func NewPodGroupInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewPodGroupInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewTypedPodGroupInformer constructs a new informer for PodGroup type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPodGroupInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers PodGroupIndexers) PodGroupIndexInformer { + return NewTypedPodGroupInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + +// NewFilteredPodGroupInformer constructs a new informer for PodGroup type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredPodGroupInformer]). +func NewFilteredPodGroupInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewTypedPodGroupInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredPodGroupInformer constructs a new informer for PodGroup type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredPodGroupInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers PodGroupIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) PodGroupIndexInformer { + return NewTypedPodGroupInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) +} + +// NewPodGroupInformerWithOptions constructs a new informer for PodGroup type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPodGroupInformerWithOptions]). +func NewPodGroupInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedPodGroupInformerWithOptions(client, namespace, options) +} + +// NewTypedPodGroupInformerWithOptions constructs a new informer for PodGroup type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPodGroupInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) PodGroupIndexInformer { + gvr := schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1alpha3", Resource: "podgroups"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewTypedSharedIndexInformer[*apischedulingv1alpha3.PodGroup](cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha3().PodGroups(namespace).List(context.Background(), opts) + }, + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha3().PodGroups(namespace).Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha3().PodGroups(namespace).List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha3().PodGroups(namespace).Watch(ctx, opts) + }, + }, client), + &apischedulingv1alpha3.PodGroup{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + )) +} + +func (f *podGroupInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewTypedPodGroupInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *podGroupInformer) Informer() cache.SharedIndexInformer { + return f.TypedInformer() +} + +func (f *podGroupInformer) TypedInformer() PodGroupIndexInformer { + return cache.NewTypedSharedIndexInformer[*apischedulingv1alpha3.PodGroup](f.factory.InformerFor(&apischedulingv1alpha3.PodGroup{}, f.defaultInformer)) +} + +func (f *podGroupInformer) Lister() schedulingv1alpha3.PodGroupLister { + return schedulingv1alpha3.NewPodGroupLister(f.Informer().GetIndexer()) +} + +// ToTypedPodGroupInformer converts an untyped informer into a TypedPodGroupInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PodGroup. If that is not the case, calling type-safe methods of the returned +// TypedPodGroupInformer leads to runtime panics. A safer alternative is to pass +// around a TypedPodGroupInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedPodGroupInformer(informer PodGroupInformer) TypedPodGroupInformer { + if informer, ok := informer.(TypedPodGroupInformer); ok { + return informer + } + return &podGroupTypedInformerAdapter{informer} +} + +type podGroupTypedInformerAdapter struct { + PodGroupInformer +} + +func (a *podGroupTypedInformerAdapter) TypedInformer() PodGroupIndexInformer { + return cache.NewTypedSharedIndexInformer[*apischedulingv1alpha3.PodGroup](a.Informer()) +} + +// ToPodGroupIndexInformer converts an untyped informer into a PodGroupIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PodGroup. If that is not the case, calling type-safe methods of the returned +// PodGroupIndexInformer leads to runtime panics. A safer alternative is to pass +// around a PodGroupIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToPodGroupIndexInformer(informer cache.SharedIndexInformer) PodGroupIndexInformer { + if informer, ok := informer.(PodGroupIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apischedulingv1alpha3.PodGroup](informer) +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1alpha3/workload.go b/vendor/k8s.io/client-go/informers/scheduling/v1alpha3/workload.go new file mode 100644 index 0000000000..9917620161 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1alpha3/workload.go @@ -0,0 +1,208 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + context "context" + time "time" + + apischedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + schedulingv1alpha3 "k8s.io/client-go/listers/scheduling/v1alpha3" + cache "k8s.io/client-go/tools/cache" +) + +// WorkloadInformer provides access to a shared informer and lister for +// Workloads. Prefer using the type-safe variant (see [TypedWorkloadInformer]). +type WorkloadInformer interface { + Informer() cache.SharedIndexInformer + Lister() schedulingv1alpha3.WorkloadLister +} + +// TypedWorkloadInformer provides access to a shared informer and lister for +// Workloads, including the type-safe TypedInformer variant. +// It is a superset of WorkloadInformer. +type TypedWorkloadInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() WorkloadIndexInformer + Lister() schedulingv1alpha3.WorkloadLister +} + +// WorkloadIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type WorkloadIndexInformer cache.TypedSharedIndexInformer[*apischedulingv1alpha3.Workload] + +// WorkloadHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Workload. +type WorkloadHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apischedulingv1alpha3.Workload] + +// WorkloadDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Workload. +type WorkloadDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apischedulingv1alpha3.Workload] + +// WorkloadFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Workload. +type WorkloadFilteringHandler = cache.TypedFilteringResourceEventHandler[*apischedulingv1alpha3.Workload] + +// WorkloadIndexers is a specialization of [cache.TypedIndexers] for Workload. +type WorkloadIndexers = cache.TypedIndexers[*apischedulingv1alpha3.Workload] + +// DeletedWorkload is a specialization of [cache.DeletedObject] for Workload. +type DeletedWorkload = cache.DeletedObject[*apischedulingv1alpha3.Workload] + +type workloadInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewWorkloadInformer constructs a new informer for Workload type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedWorkloadInformer]). +func NewWorkloadInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewWorkloadInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewTypedWorkloadInformer constructs a new informer for Workload type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedWorkloadInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers WorkloadIndexers) WorkloadIndexInformer { + return NewTypedWorkloadInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + +// NewFilteredWorkloadInformer constructs a new informer for Workload type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredWorkloadInformer]). +func NewFilteredWorkloadInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewTypedWorkloadInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredWorkloadInformer constructs a new informer for Workload type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredWorkloadInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers WorkloadIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) WorkloadIndexInformer { + return NewTypedWorkloadInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) +} + +// NewWorkloadInformerWithOptions constructs a new informer for Workload type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedWorkloadInformerWithOptions]). +func NewWorkloadInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedWorkloadInformerWithOptions(client, namespace, options) +} + +// NewTypedWorkloadInformerWithOptions constructs a new informer for Workload type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedWorkloadInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) WorkloadIndexInformer { + gvr := schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1alpha3", Resource: "workloads"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewTypedSharedIndexInformer[*apischedulingv1alpha3.Workload](cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha3().Workloads(namespace).List(context.Background(), opts) + }, + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha3().Workloads(namespace).Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha3().Workloads(namespace).List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha3().Workloads(namespace).Watch(ctx, opts) + }, + }, client), + &apischedulingv1alpha3.Workload{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + )) +} + +func (f *workloadInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewTypedWorkloadInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *workloadInformer) Informer() cache.SharedIndexInformer { + return f.TypedInformer() +} + +func (f *workloadInformer) TypedInformer() WorkloadIndexInformer { + return cache.NewTypedSharedIndexInformer[*apischedulingv1alpha3.Workload](f.factory.InformerFor(&apischedulingv1alpha3.Workload{}, f.defaultInformer)) +} + +func (f *workloadInformer) Lister() schedulingv1alpha3.WorkloadLister { + return schedulingv1alpha3.NewWorkloadLister(f.Informer().GetIndexer()) +} + +// ToTypedWorkloadInformer converts an untyped informer into a TypedWorkloadInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Workload. If that is not the case, calling type-safe methods of the returned +// TypedWorkloadInformer leads to runtime panics. A safer alternative is to pass +// around a TypedWorkloadInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedWorkloadInformer(informer WorkloadInformer) TypedWorkloadInformer { + if informer, ok := informer.(TypedWorkloadInformer); ok { + return informer + } + return &workloadTypedInformerAdapter{informer} +} + +type workloadTypedInformerAdapter struct { + WorkloadInformer +} + +func (a *workloadTypedInformerAdapter) TypedInformer() WorkloadIndexInformer { + return cache.NewTypedSharedIndexInformer[*apischedulingv1alpha3.Workload](a.Informer()) +} + +// ToWorkloadIndexInformer converts an untyped informer into a WorkloadIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Workload. If that is not the case, calling type-safe methods of the returned +// WorkloadIndexInformer leads to runtime panics. A safer alternative is to pass +// around a WorkloadIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToWorkloadIndexInformer(informer cache.SharedIndexInformer) WorkloadIndexInformer { + if informer, ok := informer.(WorkloadIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apischedulingv1alpha3.Workload](informer) +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/scheduling/v1beta1/interface.go index 52840a9cee..f57d050b18 100644 --- a/vendor/k8s.io/client-go/informers/scheduling/v1beta1/interface.go +++ b/vendor/k8s.io/client-go/informers/scheduling/v1beta1/interface.go @@ -24,8 +24,12 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { + // PodGroups returns a PodGroupInformer. + PodGroups() TypedPodGroupInformer // PriorityClasses returns a PriorityClassInformer. - PriorityClasses() PriorityClassInformer + PriorityClasses() TypedPriorityClassInformer + // Workloads returns a WorkloadInformer. + Workloads() TypedWorkloadInformer } type version struct { @@ -39,7 +43,17 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// PriorityClasses returns a PriorityClassInformer. -func (v *version) PriorityClasses() PriorityClassInformer { +// PodGroups returns a TypedPodGroupInformer. +func (v *version) PodGroups() TypedPodGroupInformer { + return &podGroupInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// PriorityClasses returns a TypedPriorityClassInformer. +func (v *version) PriorityClasses() TypedPriorityClassInformer { return &priorityClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } + +// Workloads returns a TypedWorkloadInformer. +func (v *version) Workloads() TypedWorkloadInformer { + return &workloadInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1beta1/podgroup.go b/vendor/k8s.io/client-go/informers/scheduling/v1beta1/podgroup.go new file mode 100644 index 0000000000..ed77beccd9 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1beta1/podgroup.go @@ -0,0 +1,208 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + context "context" + time "time" + + apischedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + schedulingv1beta1 "k8s.io/client-go/listers/scheduling/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// PodGroupInformer provides access to a shared informer and lister for +// PodGroups. Prefer using the type-safe variant (see [TypedPodGroupInformer]). +type PodGroupInformer interface { + Informer() cache.SharedIndexInformer + Lister() schedulingv1beta1.PodGroupLister +} + +// TypedPodGroupInformer provides access to a shared informer and lister for +// PodGroups, including the type-safe TypedInformer variant. +// It is a superset of PodGroupInformer. +type TypedPodGroupInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() PodGroupIndexInformer + Lister() schedulingv1beta1.PodGroupLister +} + +// PodGroupIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type PodGroupIndexInformer cache.TypedSharedIndexInformer[*apischedulingv1beta1.PodGroup] + +// PodGroupHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for PodGroup. +type PodGroupHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apischedulingv1beta1.PodGroup] + +// PodGroupDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for PodGroup. +type PodGroupDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apischedulingv1beta1.PodGroup] + +// PodGroupFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for PodGroup. +type PodGroupFilteringHandler = cache.TypedFilteringResourceEventHandler[*apischedulingv1beta1.PodGroup] + +// PodGroupIndexers is a specialization of [cache.TypedIndexers] for PodGroup. +type PodGroupIndexers = cache.TypedIndexers[*apischedulingv1beta1.PodGroup] + +// DeletedPodGroup is a specialization of [cache.DeletedObject] for PodGroup. +type DeletedPodGroup = cache.DeletedObject[*apischedulingv1beta1.PodGroup] + +type podGroupInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodGroupInformer constructs a new informer for PodGroup type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPodGroupInformer]). +func NewPodGroupInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewPodGroupInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewTypedPodGroupInformer constructs a new informer for PodGroup type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPodGroupInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers PodGroupIndexers) PodGroupIndexInformer { + return NewTypedPodGroupInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + +// NewFilteredPodGroupInformer constructs a new informer for PodGroup type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredPodGroupInformer]). +func NewFilteredPodGroupInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewTypedPodGroupInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredPodGroupInformer constructs a new informer for PodGroup type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredPodGroupInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers PodGroupIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) PodGroupIndexInformer { + return NewTypedPodGroupInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) +} + +// NewPodGroupInformerWithOptions constructs a new informer for PodGroup type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPodGroupInformerWithOptions]). +func NewPodGroupInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedPodGroupInformerWithOptions(client, namespace, options) +} + +// NewTypedPodGroupInformerWithOptions constructs a new informer for PodGroup type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPodGroupInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) PodGroupIndexInformer { + gvr := schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1beta1", Resource: "podgroups"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewTypedSharedIndexInformer[*apischedulingv1beta1.PodGroup](cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1beta1().PodGroups(namespace).List(context.Background(), opts) + }, + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1beta1().PodGroups(namespace).Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1beta1().PodGroups(namespace).List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1beta1().PodGroups(namespace).Watch(ctx, opts) + }, + }, client), + &apischedulingv1beta1.PodGroup{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + )) +} + +func (f *podGroupInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewTypedPodGroupInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *podGroupInformer) Informer() cache.SharedIndexInformer { + return f.TypedInformer() +} + +func (f *podGroupInformer) TypedInformer() PodGroupIndexInformer { + return cache.NewTypedSharedIndexInformer[*apischedulingv1beta1.PodGroup](f.factory.InformerFor(&apischedulingv1beta1.PodGroup{}, f.defaultInformer)) +} + +func (f *podGroupInformer) Lister() schedulingv1beta1.PodGroupLister { + return schedulingv1beta1.NewPodGroupLister(f.Informer().GetIndexer()) +} + +// ToTypedPodGroupInformer converts an untyped informer into a TypedPodGroupInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PodGroup. If that is not the case, calling type-safe methods of the returned +// TypedPodGroupInformer leads to runtime panics. A safer alternative is to pass +// around a TypedPodGroupInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedPodGroupInformer(informer PodGroupInformer) TypedPodGroupInformer { + if informer, ok := informer.(TypedPodGroupInformer); ok { + return informer + } + return &podGroupTypedInformerAdapter{informer} +} + +type podGroupTypedInformerAdapter struct { + PodGroupInformer +} + +func (a *podGroupTypedInformerAdapter) TypedInformer() PodGroupIndexInformer { + return cache.NewTypedSharedIndexInformer[*apischedulingv1beta1.PodGroup](a.Informer()) +} + +// ToPodGroupIndexInformer converts an untyped informer into a PodGroupIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PodGroup. If that is not the case, calling type-safe methods of the returned +// PodGroupIndexInformer leads to runtime panics. A safer alternative is to pass +// around a PodGroupIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToPodGroupIndexInformer(informer cache.SharedIndexInformer) PodGroupIndexInformer { + if informer, ok := informer.(PodGroupIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apischedulingv1beta1.PodGroup](informer) +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go b/vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go index a5cae3ea56..74b968d26e 100644 --- a/vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go +++ b/vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go @@ -34,12 +34,40 @@ import ( ) // PriorityClassInformer provides access to a shared informer and lister for -// PriorityClasses. +// PriorityClasses. Prefer using the type-safe variant (see [TypedPriorityClassInformer]). type PriorityClassInformer interface { Informer() cache.SharedIndexInformer Lister() schedulingv1beta1.PriorityClassLister } +// TypedPriorityClassInformer provides access to a shared informer and lister for +// PriorityClasses, including the type-safe TypedInformer variant. +// It is a superset of PriorityClassInformer. +type TypedPriorityClassInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() PriorityClassIndexInformer + Lister() schedulingv1beta1.PriorityClassLister +} + +// PriorityClassIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type PriorityClassIndexInformer cache.TypedSharedIndexInformer[*apischedulingv1beta1.PriorityClass] + +// PriorityClassHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for PriorityClass. +type PriorityClassHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apischedulingv1beta1.PriorityClass] + +// PriorityClassDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for PriorityClass. +type PriorityClassDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apischedulingv1beta1.PriorityClass] + +// PriorityClassFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for PriorityClass. +type PriorityClassFilteringHandler = cache.TypedFilteringResourceEventHandler[*apischedulingv1beta1.PriorityClass] + +// PriorityClassIndexers is a specialization of [cache.TypedIndexers] for PriorityClass. +type PriorityClassIndexers = cache.TypedIndexers[*apischedulingv1beta1.PriorityClass] + +// DeletedPriorityClass is a specialization of [cache.DeletedObject] for PriorityClass. +type DeletedPriorityClass = cache.DeletedObject[*apischedulingv1beta1.PriorityClass] + type priorityClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type priorityClassInformer struct { // NewPriorityClassInformer constructs a new informer for PriorityClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPriorityClassInformer]). func NewPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers PriorityClassIndexers) PriorityClassIndexInformer { + return NewTypedPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredPriorityClassInformer constructs a new informer for PriorityClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredPriorityClassInformer]). func NewFilteredPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers PriorityClassIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) PriorityClassIndexInformer { + return NewTypedPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewPriorityClassInformerWithOptions constructs a new informer for PriorityClass type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedPriorityClassInformerWithOptions]). func NewPriorityClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedPriorityClassInformerWithOptions(client, options) +} + +// NewTypedPriorityClassInformerWithOptions constructs a new informer for PriorityClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedPriorityClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) PriorityClassIndexInformer { gvr := schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1beta1", Resource: "priorityclasss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apischedulingv1beta1.PriorityClass](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewPriorityClassInformerWithOptions(client kubernetes.Interface, options in Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *priorityClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *priorityClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apischedulingv1beta1.PriorityClass{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *priorityClassInformer) TypedInformer() PriorityClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apischedulingv1beta1.PriorityClass](f.factory.InformerFor(&apischedulingv1beta1.PriorityClass{}, f.defaultInformer)) } func (f *priorityClassInformer) Lister() schedulingv1beta1.PriorityClassLister { return schedulingv1beta1.NewPriorityClassLister(f.Informer().GetIndexer()) } + +// ToTypedPriorityClassInformer converts an untyped informer into a TypedPriorityClassInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PriorityClass. If that is not the case, calling type-safe methods of the returned +// TypedPriorityClassInformer leads to runtime panics. A safer alternative is to pass +// around a TypedPriorityClassInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedPriorityClassInformer(informer PriorityClassInformer) TypedPriorityClassInformer { + if informer, ok := informer.(TypedPriorityClassInformer); ok { + return informer + } + return &priorityClassTypedInformerAdapter{informer} +} + +type priorityClassTypedInformerAdapter struct { + PriorityClassInformer +} + +func (a *priorityClassTypedInformerAdapter) TypedInformer() PriorityClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apischedulingv1beta1.PriorityClass](a.Informer()) +} + +// ToPriorityClassIndexInformer converts an untyped informer into a PriorityClassIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *PriorityClass. If that is not the case, calling type-safe methods of the returned +// PriorityClassIndexInformer leads to runtime panics. A safer alternative is to pass +// around a PriorityClassIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToPriorityClassIndexInformer(informer cache.SharedIndexInformer) PriorityClassIndexInformer { + if informer, ok := informer.(PriorityClassIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apischedulingv1beta1.PriorityClass](informer) +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1beta1/workload.go b/vendor/k8s.io/client-go/informers/scheduling/v1beta1/workload.go new file mode 100644 index 0000000000..86c30f27ea --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1beta1/workload.go @@ -0,0 +1,208 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + context "context" + time "time" + + apischedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + schedulingv1beta1 "k8s.io/client-go/listers/scheduling/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// WorkloadInformer provides access to a shared informer and lister for +// Workloads. Prefer using the type-safe variant (see [TypedWorkloadInformer]). +type WorkloadInformer interface { + Informer() cache.SharedIndexInformer + Lister() schedulingv1beta1.WorkloadLister +} + +// TypedWorkloadInformer provides access to a shared informer and lister for +// Workloads, including the type-safe TypedInformer variant. +// It is a superset of WorkloadInformer. +type TypedWorkloadInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() WorkloadIndexInformer + Lister() schedulingv1beta1.WorkloadLister +} + +// WorkloadIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type WorkloadIndexInformer cache.TypedSharedIndexInformer[*apischedulingv1beta1.Workload] + +// WorkloadHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for Workload. +type WorkloadHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apischedulingv1beta1.Workload] + +// WorkloadDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for Workload. +type WorkloadDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apischedulingv1beta1.Workload] + +// WorkloadFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for Workload. +type WorkloadFilteringHandler = cache.TypedFilteringResourceEventHandler[*apischedulingv1beta1.Workload] + +// WorkloadIndexers is a specialization of [cache.TypedIndexers] for Workload. +type WorkloadIndexers = cache.TypedIndexers[*apischedulingv1beta1.Workload] + +// DeletedWorkload is a specialization of [cache.DeletedObject] for Workload. +type DeletedWorkload = cache.DeletedObject[*apischedulingv1beta1.Workload] + +type workloadInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewWorkloadInformer constructs a new informer for Workload type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedWorkloadInformer]). +func NewWorkloadInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewWorkloadInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewTypedWorkloadInformer constructs a new informer for Workload type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedWorkloadInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers WorkloadIndexers) WorkloadIndexInformer { + return NewTypedWorkloadInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + +// NewFilteredWorkloadInformer constructs a new informer for Workload type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredWorkloadInformer]). +func NewFilteredWorkloadInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewTypedWorkloadInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredWorkloadInformer constructs a new informer for Workload type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredWorkloadInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers WorkloadIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) WorkloadIndexInformer { + return NewTypedWorkloadInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) +} + +// NewWorkloadInformerWithOptions constructs a new informer for Workload type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedWorkloadInformerWithOptions]). +func NewWorkloadInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedWorkloadInformerWithOptions(client, namespace, options) +} + +// NewTypedWorkloadInformerWithOptions constructs a new informer for Workload type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedWorkloadInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) WorkloadIndexInformer { + gvr := schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1beta1", Resource: "workloads"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewTypedSharedIndexInformer[*apischedulingv1beta1.Workload](cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1beta1().Workloads(namespace).List(context.Background(), opts) + }, + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1beta1().Workloads(namespace).Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1beta1().Workloads(namespace).List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1beta1().Workloads(namespace).Watch(ctx, opts) + }, + }, client), + &apischedulingv1beta1.Workload{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + )) +} + +func (f *workloadInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewTypedWorkloadInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *workloadInformer) Informer() cache.SharedIndexInformer { + return f.TypedInformer() +} + +func (f *workloadInformer) TypedInformer() WorkloadIndexInformer { + return cache.NewTypedSharedIndexInformer[*apischedulingv1beta1.Workload](f.factory.InformerFor(&apischedulingv1beta1.Workload{}, f.defaultInformer)) +} + +func (f *workloadInformer) Lister() schedulingv1beta1.WorkloadLister { + return schedulingv1beta1.NewWorkloadLister(f.Informer().GetIndexer()) +} + +// ToTypedWorkloadInformer converts an untyped informer into a TypedWorkloadInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Workload. If that is not the case, calling type-safe methods of the returned +// TypedWorkloadInformer leads to runtime panics. A safer alternative is to pass +// around a TypedWorkloadInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedWorkloadInformer(informer WorkloadInformer) TypedWorkloadInformer { + if informer, ok := informer.(TypedWorkloadInformer); ok { + return informer + } + return &workloadTypedInformerAdapter{informer} +} + +type workloadTypedInformerAdapter struct { + WorkloadInformer +} + +func (a *workloadTypedInformerAdapter) TypedInformer() WorkloadIndexInformer { + return cache.NewTypedSharedIndexInformer[*apischedulingv1beta1.Workload](a.Informer()) +} + +// ToWorkloadIndexInformer converts an untyped informer into a WorkloadIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *Workload. If that is not the case, calling type-safe methods of the returned +// WorkloadIndexInformer leads to runtime panics. A safer alternative is to pass +// around a WorkloadIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToWorkloadIndexInformer(informer cache.SharedIndexInformer) WorkloadIndexInformer { + if informer, ok := informer.(WorkloadIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apischedulingv1beta1.Workload](informer) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1/csidriver.go b/vendor/k8s.io/client-go/informers/storage/v1/csidriver.go index 56ed349e26..f7b4d393ea 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1/csidriver.go +++ b/vendor/k8s.io/client-go/informers/storage/v1/csidriver.go @@ -34,12 +34,40 @@ import ( ) // CSIDriverInformer provides access to a shared informer and lister for -// CSIDrivers. +// CSIDrivers. Prefer using the type-safe variant (see [TypedCSIDriverInformer]). type CSIDriverInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1.CSIDriverLister } +// TypedCSIDriverInformer provides access to a shared informer and lister for +// CSIDrivers, including the type-safe TypedInformer variant. +// It is a superset of CSIDriverInformer. +type TypedCSIDriverInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() CSIDriverIndexInformer + Lister() storagev1.CSIDriverLister +} + +// CSIDriverIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type CSIDriverIndexInformer cache.TypedSharedIndexInformer[*apistoragev1.CSIDriver] + +// CSIDriverHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for CSIDriver. +type CSIDriverHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apistoragev1.CSIDriver] + +// CSIDriverDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for CSIDriver. +type CSIDriverDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apistoragev1.CSIDriver] + +// CSIDriverFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for CSIDriver. +type CSIDriverFilteringHandler = cache.TypedFilteringResourceEventHandler[*apistoragev1.CSIDriver] + +// CSIDriverIndexers is a specialization of [cache.TypedIndexers] for CSIDriver. +type CSIDriverIndexers = cache.TypedIndexers[*apistoragev1.CSIDriver] + +// DeletedCSIDriver is a specialization of [cache.DeletedObject] for CSIDriver. +type DeletedCSIDriver = cache.DeletedObject[*apistoragev1.CSIDriver] + type cSIDriverInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type cSIDriverInformer struct { // NewCSIDriverInformer constructs a new informer for CSIDriver type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCSIDriverInformer]). func NewCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedCSIDriverInformer constructs a new informer for CSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers CSIDriverIndexers) CSIDriverIndexInformer { + return NewTypedCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredCSIDriverInformer constructs a new informer for CSIDriver type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredCSIDriverInformer]). func NewFilteredCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredCSIDriverInformer constructs a new informer for CSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers CSIDriverIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) CSIDriverIndexInformer { + return NewTypedCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewCSIDriverInformerWithOptions constructs a new informer for CSIDriver type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCSIDriverInformerWithOptions]). func NewCSIDriverInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedCSIDriverInformerWithOptions(client, options) +} + +// NewTypedCSIDriverInformerWithOptions constructs a new informer for CSIDriver type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCSIDriverInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) CSIDriverIndexInformer { gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "csidrivers"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apistoragev1.CSIDriver](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewCSIDriverInformerWithOptions(client kubernetes.Interface, options intern Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *cSIDriverInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *cSIDriverInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apistoragev1.CSIDriver{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *cSIDriverInformer) TypedInformer() CSIDriverIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1.CSIDriver](f.factory.InformerFor(&apistoragev1.CSIDriver{}, f.defaultInformer)) } func (f *cSIDriverInformer) Lister() storagev1.CSIDriverLister { return storagev1.NewCSIDriverLister(f.Informer().GetIndexer()) } + +// ToTypedCSIDriverInformer converts an untyped informer into a TypedCSIDriverInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CSIDriver. If that is not the case, calling type-safe methods of the returned +// TypedCSIDriverInformer leads to runtime panics. A safer alternative is to pass +// around a TypedCSIDriverInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedCSIDriverInformer(informer CSIDriverInformer) TypedCSIDriverInformer { + if informer, ok := informer.(TypedCSIDriverInformer); ok { + return informer + } + return &cSIDriverTypedInformerAdapter{informer} +} + +type cSIDriverTypedInformerAdapter struct { + CSIDriverInformer +} + +func (a *cSIDriverTypedInformerAdapter) TypedInformer() CSIDriverIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1.CSIDriver](a.Informer()) +} + +// ToCSIDriverIndexInformer converts an untyped informer into a CSIDriverIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CSIDriver. If that is not the case, calling type-safe methods of the returned +// CSIDriverIndexInformer leads to runtime panics. A safer alternative is to pass +// around a CSIDriverIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToCSIDriverIndexInformer(informer cache.SharedIndexInformer) CSIDriverIndexInformer { + if informer, ok := informer.(CSIDriverIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apistoragev1.CSIDriver](informer) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1/csinode.go b/vendor/k8s.io/client-go/informers/storage/v1/csinode.go index c90686bf78..8a841028ba 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1/csinode.go +++ b/vendor/k8s.io/client-go/informers/storage/v1/csinode.go @@ -34,12 +34,40 @@ import ( ) // CSINodeInformer provides access to a shared informer and lister for -// CSINodes. +// CSINodes. Prefer using the type-safe variant (see [TypedCSINodeInformer]). type CSINodeInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1.CSINodeLister } +// TypedCSINodeInformer provides access to a shared informer and lister for +// CSINodes, including the type-safe TypedInformer variant. +// It is a superset of CSINodeInformer. +type TypedCSINodeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() CSINodeIndexInformer + Lister() storagev1.CSINodeLister +} + +// CSINodeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type CSINodeIndexInformer cache.TypedSharedIndexInformer[*apistoragev1.CSINode] + +// CSINodeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for CSINode. +type CSINodeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apistoragev1.CSINode] + +// CSINodeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for CSINode. +type CSINodeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apistoragev1.CSINode] + +// CSINodeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for CSINode. +type CSINodeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apistoragev1.CSINode] + +// CSINodeIndexers is a specialization of [cache.TypedIndexers] for CSINode. +type CSINodeIndexers = cache.TypedIndexers[*apistoragev1.CSINode] + +// DeletedCSINode is a specialization of [cache.DeletedObject] for CSINode. +type DeletedCSINode = cache.DeletedObject[*apistoragev1.CSINode] + type cSINodeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type cSINodeInformer struct { // NewCSINodeInformer constructs a new informer for CSINode type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCSINodeInformer]). func NewCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedCSINodeInformer constructs a new informer for CSINode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers CSINodeIndexers) CSINodeIndexInformer { + return NewTypedCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredCSINodeInformer constructs a new informer for CSINode type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredCSINodeInformer]). func NewFilteredCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredCSINodeInformer constructs a new informer for CSINode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers CSINodeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) CSINodeIndexInformer { + return NewTypedCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewCSINodeInformerWithOptions constructs a new informer for CSINode type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCSINodeInformerWithOptions]). func NewCSINodeInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedCSINodeInformerWithOptions(client, options) +} + +// NewTypedCSINodeInformerWithOptions constructs a new informer for CSINode type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCSINodeInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) CSINodeIndexInformer { gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "csinodes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apistoragev1.CSINode](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewCSINodeInformerWithOptions(client kubernetes.Interface, options internal Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *cSINodeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *cSINodeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apistoragev1.CSINode{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *cSINodeInformer) TypedInformer() CSINodeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1.CSINode](f.factory.InformerFor(&apistoragev1.CSINode{}, f.defaultInformer)) } func (f *cSINodeInformer) Lister() storagev1.CSINodeLister { return storagev1.NewCSINodeLister(f.Informer().GetIndexer()) } + +// ToTypedCSINodeInformer converts an untyped informer into a TypedCSINodeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CSINode. If that is not the case, calling type-safe methods of the returned +// TypedCSINodeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedCSINodeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedCSINodeInformer(informer CSINodeInformer) TypedCSINodeInformer { + if informer, ok := informer.(TypedCSINodeInformer); ok { + return informer + } + return &cSINodeTypedInformerAdapter{informer} +} + +type cSINodeTypedInformerAdapter struct { + CSINodeInformer +} + +func (a *cSINodeTypedInformerAdapter) TypedInformer() CSINodeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1.CSINode](a.Informer()) +} + +// ToCSINodeIndexInformer converts an untyped informer into a CSINodeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CSINode. If that is not the case, calling type-safe methods of the returned +// CSINodeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a CSINodeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToCSINodeIndexInformer(informer cache.SharedIndexInformer) CSINodeIndexInformer { + if informer, ok := informer.(CSINodeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apistoragev1.CSINode](informer) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1/csistoragecapacity.go b/vendor/k8s.io/client-go/informers/storage/v1/csistoragecapacity.go index 52c0e281ac..3052b40d9a 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1/csistoragecapacity.go +++ b/vendor/k8s.io/client-go/informers/storage/v1/csistoragecapacity.go @@ -34,12 +34,40 @@ import ( ) // CSIStorageCapacityInformer provides access to a shared informer and lister for -// CSIStorageCapacities. +// CSIStorageCapacities. Prefer using the type-safe variant (see [TypedCSIStorageCapacityInformer]). type CSIStorageCapacityInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1.CSIStorageCapacityLister } +// TypedCSIStorageCapacityInformer provides access to a shared informer and lister for +// CSIStorageCapacities, including the type-safe TypedInformer variant. +// It is a superset of CSIStorageCapacityInformer. +type TypedCSIStorageCapacityInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() CSIStorageCapacityIndexInformer + Lister() storagev1.CSIStorageCapacityLister +} + +// CSIStorageCapacityIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type CSIStorageCapacityIndexInformer cache.TypedSharedIndexInformer[*apistoragev1.CSIStorageCapacity] + +// CSIStorageCapacityHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for CSIStorageCapacity. +type CSIStorageCapacityHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apistoragev1.CSIStorageCapacity] + +// CSIStorageCapacityDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for CSIStorageCapacity. +type CSIStorageCapacityDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apistoragev1.CSIStorageCapacity] + +// CSIStorageCapacityFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for CSIStorageCapacity. +type CSIStorageCapacityFilteringHandler = cache.TypedFilteringResourceEventHandler[*apistoragev1.CSIStorageCapacity] + +// CSIStorageCapacityIndexers is a specialization of [cache.TypedIndexers] for CSIStorageCapacity. +type CSIStorageCapacityIndexers = cache.TypedIndexers[*apistoragev1.CSIStorageCapacity] + +// DeletedCSIStorageCapacity is a specialization of [cache.DeletedObject] for CSIStorageCapacity. +type DeletedCSIStorageCapacity = cache.DeletedObject[*apistoragev1.CSIStorageCapacity] + type cSIStorageCapacityInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type cSIStorageCapacityInformer struct { // NewCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCSIStorageCapacityInformer]). func NewCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers CSIStorageCapacityIndexers) CSIStorageCapacityIndexInformer { + return NewTypedCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredCSIStorageCapacityInformer]). func NewFilteredCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers CSIStorageCapacityIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) CSIStorageCapacityIndexInformer { + return NewTypedCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewCSIStorageCapacityInformerWithOptions constructs a new informer for CSIStorageCapacity type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCSIStorageCapacityInformerWithOptions]). func NewCSIStorageCapacityInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedCSIStorageCapacityInformerWithOptions(client, namespace, options) +} + +// NewTypedCSIStorageCapacityInformerWithOptions constructs a new informer for CSIStorageCapacity type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCSIStorageCapacityInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) CSIStorageCapacityIndexInformer { gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "csistoragecapacitys"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apistoragev1.CSIStorageCapacity](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewCSIStorageCapacityInformerWithOptions(client kubernetes.Interface, names Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *cSIStorageCapacityInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewCSIStorageCapacityInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedCSIStorageCapacityInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *cSIStorageCapacityInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apistoragev1.CSIStorageCapacity{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *cSIStorageCapacityInformer) TypedInformer() CSIStorageCapacityIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1.CSIStorageCapacity](f.factory.InformerFor(&apistoragev1.CSIStorageCapacity{}, f.defaultInformer)) } func (f *cSIStorageCapacityInformer) Lister() storagev1.CSIStorageCapacityLister { return storagev1.NewCSIStorageCapacityLister(f.Informer().GetIndexer()) } + +// ToTypedCSIStorageCapacityInformer converts an untyped informer into a TypedCSIStorageCapacityInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CSIStorageCapacity. If that is not the case, calling type-safe methods of the returned +// TypedCSIStorageCapacityInformer leads to runtime panics. A safer alternative is to pass +// around a TypedCSIStorageCapacityInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedCSIStorageCapacityInformer(informer CSIStorageCapacityInformer) TypedCSIStorageCapacityInformer { + if informer, ok := informer.(TypedCSIStorageCapacityInformer); ok { + return informer + } + return &cSIStorageCapacityTypedInformerAdapter{informer} +} + +type cSIStorageCapacityTypedInformerAdapter struct { + CSIStorageCapacityInformer +} + +func (a *cSIStorageCapacityTypedInformerAdapter) TypedInformer() CSIStorageCapacityIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1.CSIStorageCapacity](a.Informer()) +} + +// ToCSIStorageCapacityIndexInformer converts an untyped informer into a CSIStorageCapacityIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CSIStorageCapacity. If that is not the case, calling type-safe methods of the returned +// CSIStorageCapacityIndexInformer leads to runtime panics. A safer alternative is to pass +// around a CSIStorageCapacityIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToCSIStorageCapacityIndexInformer(informer cache.SharedIndexInformer) CSIStorageCapacityIndexInformer { + if informer, ok := informer.(CSIStorageCapacityIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apistoragev1.CSIStorageCapacity](informer) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1/interface.go b/vendor/k8s.io/client-go/informers/storage/v1/interface.go index aff778e05c..532e79b5f1 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1/interface.go +++ b/vendor/k8s.io/client-go/informers/storage/v1/interface.go @@ -25,17 +25,17 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // CSIDrivers returns a CSIDriverInformer. - CSIDrivers() CSIDriverInformer + CSIDrivers() TypedCSIDriverInformer // CSINodes returns a CSINodeInformer. - CSINodes() CSINodeInformer + CSINodes() TypedCSINodeInformer // CSIStorageCapacities returns a CSIStorageCapacityInformer. - CSIStorageCapacities() CSIStorageCapacityInformer + CSIStorageCapacities() TypedCSIStorageCapacityInformer // StorageClasses returns a StorageClassInformer. - StorageClasses() StorageClassInformer + StorageClasses() TypedStorageClassInformer // VolumeAttachments returns a VolumeAttachmentInformer. - VolumeAttachments() VolumeAttachmentInformer + VolumeAttachments() TypedVolumeAttachmentInformer // VolumeAttributesClasses returns a VolumeAttributesClassInformer. - VolumeAttributesClasses() VolumeAttributesClassInformer + VolumeAttributesClasses() TypedVolumeAttributesClassInformer } type version struct { @@ -49,32 +49,32 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// CSIDrivers returns a CSIDriverInformer. -func (v *version) CSIDrivers() CSIDriverInformer { +// CSIDrivers returns a TypedCSIDriverInformer. +func (v *version) CSIDrivers() TypedCSIDriverInformer { return &cSIDriverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// CSINodes returns a CSINodeInformer. -func (v *version) CSINodes() CSINodeInformer { +// CSINodes returns a TypedCSINodeInformer. +func (v *version) CSINodes() TypedCSINodeInformer { return &cSINodeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// CSIStorageCapacities returns a CSIStorageCapacityInformer. -func (v *version) CSIStorageCapacities() CSIStorageCapacityInformer { +// CSIStorageCapacities returns a TypedCSIStorageCapacityInformer. +func (v *version) CSIStorageCapacities() TypedCSIStorageCapacityInformer { return &cSIStorageCapacityInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// StorageClasses returns a StorageClassInformer. -func (v *version) StorageClasses() StorageClassInformer { +// StorageClasses returns a TypedStorageClassInformer. +func (v *version) StorageClasses() TypedStorageClassInformer { return &storageClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// VolumeAttachments returns a VolumeAttachmentInformer. -func (v *version) VolumeAttachments() VolumeAttachmentInformer { +// VolumeAttachments returns a TypedVolumeAttachmentInformer. +func (v *version) VolumeAttachments() TypedVolumeAttachmentInformer { return &volumeAttachmentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// VolumeAttributesClasses returns a VolumeAttributesClassInformer. -func (v *version) VolumeAttributesClasses() VolumeAttributesClassInformer { +// VolumeAttributesClasses returns a TypedVolumeAttributesClassInformer. +func (v *version) VolumeAttributesClasses() TypedVolumeAttributesClassInformer { return &volumeAttributesClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/storage/v1/storageclass.go b/vendor/k8s.io/client-go/informers/storage/v1/storageclass.go index 533d02fc86..ea123c61a3 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1/storageclass.go +++ b/vendor/k8s.io/client-go/informers/storage/v1/storageclass.go @@ -34,12 +34,40 @@ import ( ) // StorageClassInformer provides access to a shared informer and lister for -// StorageClasses. +// StorageClasses. Prefer using the type-safe variant (see [TypedStorageClassInformer]). type StorageClassInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1.StorageClassLister } +// TypedStorageClassInformer provides access to a shared informer and lister for +// StorageClasses, including the type-safe TypedInformer variant. +// It is a superset of StorageClassInformer. +type TypedStorageClassInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() StorageClassIndexInformer + Lister() storagev1.StorageClassLister +} + +// StorageClassIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type StorageClassIndexInformer cache.TypedSharedIndexInformer[*apistoragev1.StorageClass] + +// StorageClassHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for StorageClass. +type StorageClassHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apistoragev1.StorageClass] + +// StorageClassDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for StorageClass. +type StorageClassDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apistoragev1.StorageClass] + +// StorageClassFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for StorageClass. +type StorageClassFilteringHandler = cache.TypedFilteringResourceEventHandler[*apistoragev1.StorageClass] + +// StorageClassIndexers is a specialization of [cache.TypedIndexers] for StorageClass. +type StorageClassIndexers = cache.TypedIndexers[*apistoragev1.StorageClass] + +// DeletedStorageClass is a specialization of [cache.DeletedObject] for StorageClass. +type DeletedStorageClass = cache.DeletedObject[*apistoragev1.StorageClass] + type storageClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type storageClassInformer struct { // NewStorageClassInformer constructs a new informer for StorageClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedStorageClassInformer]). func NewStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedStorageClassInformer constructs a new informer for StorageClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers StorageClassIndexers) StorageClassIndexInformer { + return NewTypedStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredStorageClassInformer constructs a new informer for StorageClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredStorageClassInformer]). func NewFilteredStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredStorageClassInformer constructs a new informer for StorageClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers StorageClassIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) StorageClassIndexInformer { + return NewTypedStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewStorageClassInformerWithOptions constructs a new informer for StorageClass type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedStorageClassInformerWithOptions]). func NewStorageClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedStorageClassInformerWithOptions(client, options) +} + +// NewTypedStorageClassInformerWithOptions constructs a new informer for StorageClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedStorageClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) StorageClassIndexInformer { gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "storageclasss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apistoragev1.StorageClass](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewStorageClassInformerWithOptions(client kubernetes.Interface, options int Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *storageClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *storageClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apistoragev1.StorageClass{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *storageClassInformer) TypedInformer() StorageClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1.StorageClass](f.factory.InformerFor(&apistoragev1.StorageClass{}, f.defaultInformer)) } func (f *storageClassInformer) Lister() storagev1.StorageClassLister { return storagev1.NewStorageClassLister(f.Informer().GetIndexer()) } + +// ToTypedStorageClassInformer converts an untyped informer into a TypedStorageClassInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *StorageClass. If that is not the case, calling type-safe methods of the returned +// TypedStorageClassInformer leads to runtime panics. A safer alternative is to pass +// around a TypedStorageClassInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedStorageClassInformer(informer StorageClassInformer) TypedStorageClassInformer { + if informer, ok := informer.(TypedStorageClassInformer); ok { + return informer + } + return &storageClassTypedInformerAdapter{informer} +} + +type storageClassTypedInformerAdapter struct { + StorageClassInformer +} + +func (a *storageClassTypedInformerAdapter) TypedInformer() StorageClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1.StorageClass](a.Informer()) +} + +// ToStorageClassIndexInformer converts an untyped informer into a StorageClassIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *StorageClass. If that is not the case, calling type-safe methods of the returned +// StorageClassIndexInformer leads to runtime panics. A safer alternative is to pass +// around a StorageClassIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToStorageClassIndexInformer(informer cache.SharedIndexInformer) StorageClassIndexInformer { + if informer, ok := informer.(StorageClassIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apistoragev1.StorageClass](informer) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1/volumeattachment.go b/vendor/k8s.io/client-go/informers/storage/v1/volumeattachment.go index 49444340ad..fdd91fd740 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1/volumeattachment.go +++ b/vendor/k8s.io/client-go/informers/storage/v1/volumeattachment.go @@ -34,12 +34,40 @@ import ( ) // VolumeAttachmentInformer provides access to a shared informer and lister for -// VolumeAttachments. +// VolumeAttachments. Prefer using the type-safe variant (see [TypedVolumeAttachmentInformer]). type VolumeAttachmentInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1.VolumeAttachmentLister } +// TypedVolumeAttachmentInformer provides access to a shared informer and lister for +// VolumeAttachments, including the type-safe TypedInformer variant. +// It is a superset of VolumeAttachmentInformer. +type TypedVolumeAttachmentInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() VolumeAttachmentIndexInformer + Lister() storagev1.VolumeAttachmentLister +} + +// VolumeAttachmentIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type VolumeAttachmentIndexInformer cache.TypedSharedIndexInformer[*apistoragev1.VolumeAttachment] + +// VolumeAttachmentHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for VolumeAttachment. +type VolumeAttachmentHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apistoragev1.VolumeAttachment] + +// VolumeAttachmentDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for VolumeAttachment. +type VolumeAttachmentDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apistoragev1.VolumeAttachment] + +// VolumeAttachmentFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for VolumeAttachment. +type VolumeAttachmentFilteringHandler = cache.TypedFilteringResourceEventHandler[*apistoragev1.VolumeAttachment] + +// VolumeAttachmentIndexers is a specialization of [cache.TypedIndexers] for VolumeAttachment. +type VolumeAttachmentIndexers = cache.TypedIndexers[*apistoragev1.VolumeAttachment] + +// DeletedVolumeAttachment is a specialization of [cache.DeletedObject] for VolumeAttachment. +type DeletedVolumeAttachment = cache.DeletedObject[*apistoragev1.VolumeAttachment] + type volumeAttachmentInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type volumeAttachmentInformer struct { // NewVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedVolumeAttachmentInformer]). func NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers VolumeAttachmentIndexers) VolumeAttachmentIndexInformer { + return NewTypedVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredVolumeAttachmentInformer]). func NewFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers VolumeAttachmentIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) VolumeAttachmentIndexInformer { + return NewTypedVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewVolumeAttachmentInformerWithOptions constructs a new informer for VolumeAttachment type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedVolumeAttachmentInformerWithOptions]). func NewVolumeAttachmentInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedVolumeAttachmentInformerWithOptions(client, options) +} + +// NewTypedVolumeAttachmentInformerWithOptions constructs a new informer for VolumeAttachment type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedVolumeAttachmentInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) VolumeAttachmentIndexInformer { gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "volumeattachments"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apistoragev1.VolumeAttachment](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewVolumeAttachmentInformerWithOptions(client kubernetes.Interface, options Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apistoragev1.VolumeAttachment{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *volumeAttachmentInformer) TypedInformer() VolumeAttachmentIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1.VolumeAttachment](f.factory.InformerFor(&apistoragev1.VolumeAttachment{}, f.defaultInformer)) } func (f *volumeAttachmentInformer) Lister() storagev1.VolumeAttachmentLister { return storagev1.NewVolumeAttachmentLister(f.Informer().GetIndexer()) } + +// ToTypedVolumeAttachmentInformer converts an untyped informer into a TypedVolumeAttachmentInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *VolumeAttachment. If that is not the case, calling type-safe methods of the returned +// TypedVolumeAttachmentInformer leads to runtime panics. A safer alternative is to pass +// around a TypedVolumeAttachmentInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedVolumeAttachmentInformer(informer VolumeAttachmentInformer) TypedVolumeAttachmentInformer { + if informer, ok := informer.(TypedVolumeAttachmentInformer); ok { + return informer + } + return &volumeAttachmentTypedInformerAdapter{informer} +} + +type volumeAttachmentTypedInformerAdapter struct { + VolumeAttachmentInformer +} + +func (a *volumeAttachmentTypedInformerAdapter) TypedInformer() VolumeAttachmentIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1.VolumeAttachment](a.Informer()) +} + +// ToVolumeAttachmentIndexInformer converts an untyped informer into a VolumeAttachmentIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *VolumeAttachment. If that is not the case, calling type-safe methods of the returned +// VolumeAttachmentIndexInformer leads to runtime panics. A safer alternative is to pass +// around a VolumeAttachmentIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToVolumeAttachmentIndexInformer(informer cache.SharedIndexInformer) VolumeAttachmentIndexInformer { + if informer, ok := informer.(VolumeAttachmentIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apistoragev1.VolumeAttachment](informer) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1/volumeattributesclass.go b/vendor/k8s.io/client-go/informers/storage/v1/volumeattributesclass.go index fa8acccfbd..e41eafe3ba 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1/volumeattributesclass.go +++ b/vendor/k8s.io/client-go/informers/storage/v1/volumeattributesclass.go @@ -34,12 +34,40 @@ import ( ) // VolumeAttributesClassInformer provides access to a shared informer and lister for -// VolumeAttributesClasses. +// VolumeAttributesClasses. Prefer using the type-safe variant (see [TypedVolumeAttributesClassInformer]). type VolumeAttributesClassInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1.VolumeAttributesClassLister } +// TypedVolumeAttributesClassInformer provides access to a shared informer and lister for +// VolumeAttributesClasses, including the type-safe TypedInformer variant. +// It is a superset of VolumeAttributesClassInformer. +type TypedVolumeAttributesClassInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() VolumeAttributesClassIndexInformer + Lister() storagev1.VolumeAttributesClassLister +} + +// VolumeAttributesClassIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type VolumeAttributesClassIndexInformer cache.TypedSharedIndexInformer[*apistoragev1.VolumeAttributesClass] + +// VolumeAttributesClassHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for VolumeAttributesClass. +type VolumeAttributesClassHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apistoragev1.VolumeAttributesClass] + +// VolumeAttributesClassDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for VolumeAttributesClass. +type VolumeAttributesClassDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apistoragev1.VolumeAttributesClass] + +// VolumeAttributesClassFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for VolumeAttributesClass. +type VolumeAttributesClassFilteringHandler = cache.TypedFilteringResourceEventHandler[*apistoragev1.VolumeAttributesClass] + +// VolumeAttributesClassIndexers is a specialization of [cache.TypedIndexers] for VolumeAttributesClass. +type VolumeAttributesClassIndexers = cache.TypedIndexers[*apistoragev1.VolumeAttributesClass] + +// DeletedVolumeAttributesClass is a specialization of [cache.DeletedObject] for VolumeAttributesClass. +type DeletedVolumeAttributesClass = cache.DeletedObject[*apistoragev1.VolumeAttributesClass] + type volumeAttributesClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type volumeAttributesClassInformer struct { // NewVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedVolumeAttributesClassInformer]). func NewVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers VolumeAttributesClassIndexers) VolumeAttributesClassIndexInformer { + return NewTypedVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredVolumeAttributesClassInformer]). func NewFilteredVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers VolumeAttributesClassIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) VolumeAttributesClassIndexInformer { + return NewTypedVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewVolumeAttributesClassInformerWithOptions constructs a new informer for VolumeAttributesClass type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedVolumeAttributesClassInformerWithOptions]). func NewVolumeAttributesClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedVolumeAttributesClassInformerWithOptions(client, options) +} + +// NewTypedVolumeAttributesClassInformerWithOptions constructs a new informer for VolumeAttributesClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedVolumeAttributesClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) VolumeAttributesClassIndexInformer { gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "volumeattributesclasss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apistoragev1.VolumeAttributesClass](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewVolumeAttributesClassInformerWithOptions(client kubernetes.Interface, op Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *volumeAttributesClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *volumeAttributesClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apistoragev1.VolumeAttributesClass{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *volumeAttributesClassInformer) TypedInformer() VolumeAttributesClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1.VolumeAttributesClass](f.factory.InformerFor(&apistoragev1.VolumeAttributesClass{}, f.defaultInformer)) } func (f *volumeAttributesClassInformer) Lister() storagev1.VolumeAttributesClassLister { return storagev1.NewVolumeAttributesClassLister(f.Informer().GetIndexer()) } + +// ToTypedVolumeAttributesClassInformer converts an untyped informer into a TypedVolumeAttributesClassInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *VolumeAttributesClass. If that is not the case, calling type-safe methods of the returned +// TypedVolumeAttributesClassInformer leads to runtime panics. A safer alternative is to pass +// around a TypedVolumeAttributesClassInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedVolumeAttributesClassInformer(informer VolumeAttributesClassInformer) TypedVolumeAttributesClassInformer { + if informer, ok := informer.(TypedVolumeAttributesClassInformer); ok { + return informer + } + return &volumeAttributesClassTypedInformerAdapter{informer} +} + +type volumeAttributesClassTypedInformerAdapter struct { + VolumeAttributesClassInformer +} + +func (a *volumeAttributesClassTypedInformerAdapter) TypedInformer() VolumeAttributesClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1.VolumeAttributesClass](a.Informer()) +} + +// ToVolumeAttributesClassIndexInformer converts an untyped informer into a VolumeAttributesClassIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *VolumeAttributesClass. If that is not the case, calling type-safe methods of the returned +// VolumeAttributesClassIndexInformer leads to runtime panics. A safer alternative is to pass +// around a VolumeAttributesClassIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToVolumeAttributesClassIndexInformer(informer cache.SharedIndexInformer) VolumeAttributesClassIndexInformer { + if informer, ok := informer.(VolumeAttributesClassIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apistoragev1.VolumeAttributesClass](informer) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go b/vendor/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go index 2f7accab3d..bfdcc62e31 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go +++ b/vendor/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go @@ -34,12 +34,40 @@ import ( ) // CSIStorageCapacityInformer provides access to a shared informer and lister for -// CSIStorageCapacities. +// CSIStorageCapacities. Prefer using the type-safe variant (see [TypedCSIStorageCapacityInformer]). type CSIStorageCapacityInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1alpha1.CSIStorageCapacityLister } +// TypedCSIStorageCapacityInformer provides access to a shared informer and lister for +// CSIStorageCapacities, including the type-safe TypedInformer variant. +// It is a superset of CSIStorageCapacityInformer. +type TypedCSIStorageCapacityInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() CSIStorageCapacityIndexInformer + Lister() storagev1alpha1.CSIStorageCapacityLister +} + +// CSIStorageCapacityIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type CSIStorageCapacityIndexInformer cache.TypedSharedIndexInformer[*apistoragev1alpha1.CSIStorageCapacity] + +// CSIStorageCapacityHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for CSIStorageCapacity. +type CSIStorageCapacityHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apistoragev1alpha1.CSIStorageCapacity] + +// CSIStorageCapacityDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for CSIStorageCapacity. +type CSIStorageCapacityDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apistoragev1alpha1.CSIStorageCapacity] + +// CSIStorageCapacityFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for CSIStorageCapacity. +type CSIStorageCapacityFilteringHandler = cache.TypedFilteringResourceEventHandler[*apistoragev1alpha1.CSIStorageCapacity] + +// CSIStorageCapacityIndexers is a specialization of [cache.TypedIndexers] for CSIStorageCapacity. +type CSIStorageCapacityIndexers = cache.TypedIndexers[*apistoragev1alpha1.CSIStorageCapacity] + +// DeletedCSIStorageCapacity is a specialization of [cache.DeletedObject] for CSIStorageCapacity. +type DeletedCSIStorageCapacity = cache.DeletedObject[*apistoragev1alpha1.CSIStorageCapacity] + type cSIStorageCapacityInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type cSIStorageCapacityInformer struct { // NewCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCSIStorageCapacityInformer]). func NewCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers CSIStorageCapacityIndexers) CSIStorageCapacityIndexInformer { + return NewTypedCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredCSIStorageCapacityInformer]). func NewFilteredCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers CSIStorageCapacityIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) CSIStorageCapacityIndexInformer { + return NewTypedCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewCSIStorageCapacityInformerWithOptions constructs a new informer for CSIStorageCapacity type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCSIStorageCapacityInformerWithOptions]). func NewCSIStorageCapacityInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedCSIStorageCapacityInformerWithOptions(client, namespace, options) +} + +// NewTypedCSIStorageCapacityInformerWithOptions constructs a new informer for CSIStorageCapacity type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCSIStorageCapacityInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) CSIStorageCapacityIndexInformer { gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1alpha1", Resource: "csistoragecapacitys"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apistoragev1alpha1.CSIStorageCapacity](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewCSIStorageCapacityInformerWithOptions(client kubernetes.Interface, names Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *cSIStorageCapacityInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewCSIStorageCapacityInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedCSIStorageCapacityInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *cSIStorageCapacityInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apistoragev1alpha1.CSIStorageCapacity{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *cSIStorageCapacityInformer) TypedInformer() CSIStorageCapacityIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1alpha1.CSIStorageCapacity](f.factory.InformerFor(&apistoragev1alpha1.CSIStorageCapacity{}, f.defaultInformer)) } func (f *cSIStorageCapacityInformer) Lister() storagev1alpha1.CSIStorageCapacityLister { return storagev1alpha1.NewCSIStorageCapacityLister(f.Informer().GetIndexer()) } + +// ToTypedCSIStorageCapacityInformer converts an untyped informer into a TypedCSIStorageCapacityInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CSIStorageCapacity. If that is not the case, calling type-safe methods of the returned +// TypedCSIStorageCapacityInformer leads to runtime panics. A safer alternative is to pass +// around a TypedCSIStorageCapacityInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedCSIStorageCapacityInformer(informer CSIStorageCapacityInformer) TypedCSIStorageCapacityInformer { + if informer, ok := informer.(TypedCSIStorageCapacityInformer); ok { + return informer + } + return &cSIStorageCapacityTypedInformerAdapter{informer} +} + +type cSIStorageCapacityTypedInformerAdapter struct { + CSIStorageCapacityInformer +} + +func (a *cSIStorageCapacityTypedInformerAdapter) TypedInformer() CSIStorageCapacityIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1alpha1.CSIStorageCapacity](a.Informer()) +} + +// ToCSIStorageCapacityIndexInformer converts an untyped informer into a CSIStorageCapacityIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CSIStorageCapacity. If that is not the case, calling type-safe methods of the returned +// CSIStorageCapacityIndexInformer leads to runtime panics. A safer alternative is to pass +// around a CSIStorageCapacityIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToCSIStorageCapacityIndexInformer(informer cache.SharedIndexInformer) CSIStorageCapacityIndexInformer { + if informer, ok := informer.(CSIStorageCapacityIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apistoragev1alpha1.CSIStorageCapacity](informer) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/storage/v1alpha1/interface.go index bda3b1add9..5ed95b0efc 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1alpha1/interface.go +++ b/vendor/k8s.io/client-go/informers/storage/v1alpha1/interface.go @@ -25,11 +25,11 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // CSIStorageCapacities returns a CSIStorageCapacityInformer. - CSIStorageCapacities() CSIStorageCapacityInformer + CSIStorageCapacities() TypedCSIStorageCapacityInformer // VolumeAttachments returns a VolumeAttachmentInformer. - VolumeAttachments() VolumeAttachmentInformer + VolumeAttachments() TypedVolumeAttachmentInformer // VolumeAttributesClasses returns a VolumeAttributesClassInformer. - VolumeAttributesClasses() VolumeAttributesClassInformer + VolumeAttributesClasses() TypedVolumeAttributesClassInformer } type version struct { @@ -43,17 +43,17 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// CSIStorageCapacities returns a CSIStorageCapacityInformer. -func (v *version) CSIStorageCapacities() CSIStorageCapacityInformer { +// CSIStorageCapacities returns a TypedCSIStorageCapacityInformer. +func (v *version) CSIStorageCapacities() TypedCSIStorageCapacityInformer { return &cSIStorageCapacityInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// VolumeAttachments returns a VolumeAttachmentInformer. -func (v *version) VolumeAttachments() VolumeAttachmentInformer { +// VolumeAttachments returns a TypedVolumeAttachmentInformer. +func (v *version) VolumeAttachments() TypedVolumeAttachmentInformer { return &volumeAttachmentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// VolumeAttributesClasses returns a VolumeAttributesClassInformer. -func (v *version) VolumeAttributesClasses() VolumeAttributesClassInformer { +// VolumeAttributesClasses returns a TypedVolumeAttributesClassInformer. +func (v *version) VolumeAttributesClasses() TypedVolumeAttributesClassInformer { return &volumeAttributesClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go b/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go index 1ab135906f..f270fecec0 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go +++ b/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go @@ -34,12 +34,40 @@ import ( ) // VolumeAttachmentInformer provides access to a shared informer and lister for -// VolumeAttachments. +// VolumeAttachments. Prefer using the type-safe variant (see [TypedVolumeAttachmentInformer]). type VolumeAttachmentInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1alpha1.VolumeAttachmentLister } +// TypedVolumeAttachmentInformer provides access to a shared informer and lister for +// VolumeAttachments, including the type-safe TypedInformer variant. +// It is a superset of VolumeAttachmentInformer. +type TypedVolumeAttachmentInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() VolumeAttachmentIndexInformer + Lister() storagev1alpha1.VolumeAttachmentLister +} + +// VolumeAttachmentIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type VolumeAttachmentIndexInformer cache.TypedSharedIndexInformer[*apistoragev1alpha1.VolumeAttachment] + +// VolumeAttachmentHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for VolumeAttachment. +type VolumeAttachmentHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apistoragev1alpha1.VolumeAttachment] + +// VolumeAttachmentDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for VolumeAttachment. +type VolumeAttachmentDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apistoragev1alpha1.VolumeAttachment] + +// VolumeAttachmentFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for VolumeAttachment. +type VolumeAttachmentFilteringHandler = cache.TypedFilteringResourceEventHandler[*apistoragev1alpha1.VolumeAttachment] + +// VolumeAttachmentIndexers is a specialization of [cache.TypedIndexers] for VolumeAttachment. +type VolumeAttachmentIndexers = cache.TypedIndexers[*apistoragev1alpha1.VolumeAttachment] + +// DeletedVolumeAttachment is a specialization of [cache.DeletedObject] for VolumeAttachment. +type DeletedVolumeAttachment = cache.DeletedObject[*apistoragev1alpha1.VolumeAttachment] + type volumeAttachmentInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type volumeAttachmentInformer struct { // NewVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedVolumeAttachmentInformer]). func NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers VolumeAttachmentIndexers) VolumeAttachmentIndexInformer { + return NewTypedVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredVolumeAttachmentInformer]). func NewFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers VolumeAttachmentIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) VolumeAttachmentIndexInformer { + return NewTypedVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewVolumeAttachmentInformerWithOptions constructs a new informer for VolumeAttachment type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedVolumeAttachmentInformerWithOptions]). func NewVolumeAttachmentInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedVolumeAttachmentInformerWithOptions(client, options) +} + +// NewTypedVolumeAttachmentInformerWithOptions constructs a new informer for VolumeAttachment type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedVolumeAttachmentInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) VolumeAttachmentIndexInformer { gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1alpha1", Resource: "volumeattachments"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apistoragev1alpha1.VolumeAttachment](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewVolumeAttachmentInformerWithOptions(client kubernetes.Interface, options Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apistoragev1alpha1.VolumeAttachment{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *volumeAttachmentInformer) TypedInformer() VolumeAttachmentIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1alpha1.VolumeAttachment](f.factory.InformerFor(&apistoragev1alpha1.VolumeAttachment{}, f.defaultInformer)) } func (f *volumeAttachmentInformer) Lister() storagev1alpha1.VolumeAttachmentLister { return storagev1alpha1.NewVolumeAttachmentLister(f.Informer().GetIndexer()) } + +// ToTypedVolumeAttachmentInformer converts an untyped informer into a TypedVolumeAttachmentInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *VolumeAttachment. If that is not the case, calling type-safe methods of the returned +// TypedVolumeAttachmentInformer leads to runtime panics. A safer alternative is to pass +// around a TypedVolumeAttachmentInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedVolumeAttachmentInformer(informer VolumeAttachmentInformer) TypedVolumeAttachmentInformer { + if informer, ok := informer.(TypedVolumeAttachmentInformer); ok { + return informer + } + return &volumeAttachmentTypedInformerAdapter{informer} +} + +type volumeAttachmentTypedInformerAdapter struct { + VolumeAttachmentInformer +} + +func (a *volumeAttachmentTypedInformerAdapter) TypedInformer() VolumeAttachmentIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1alpha1.VolumeAttachment](a.Informer()) +} + +// ToVolumeAttachmentIndexInformer converts an untyped informer into a VolumeAttachmentIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *VolumeAttachment. If that is not the case, calling type-safe methods of the returned +// VolumeAttachmentIndexInformer leads to runtime panics. A safer alternative is to pass +// around a VolumeAttachmentIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToVolumeAttachmentIndexInformer(informer cache.SharedIndexInformer) VolumeAttachmentIndexInformer { + if informer, ok := informer.(VolumeAttachmentIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apistoragev1alpha1.VolumeAttachment](informer) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattributesclass.go b/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattributesclass.go index e649c665ee..0ba63295c8 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattributesclass.go +++ b/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattributesclass.go @@ -34,12 +34,40 @@ import ( ) // VolumeAttributesClassInformer provides access to a shared informer and lister for -// VolumeAttributesClasses. +// VolumeAttributesClasses. Prefer using the type-safe variant (see [TypedVolumeAttributesClassInformer]). type VolumeAttributesClassInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1alpha1.VolumeAttributesClassLister } +// TypedVolumeAttributesClassInformer provides access to a shared informer and lister for +// VolumeAttributesClasses, including the type-safe TypedInformer variant. +// It is a superset of VolumeAttributesClassInformer. +type TypedVolumeAttributesClassInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() VolumeAttributesClassIndexInformer + Lister() storagev1alpha1.VolumeAttributesClassLister +} + +// VolumeAttributesClassIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type VolumeAttributesClassIndexInformer cache.TypedSharedIndexInformer[*apistoragev1alpha1.VolumeAttributesClass] + +// VolumeAttributesClassHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for VolumeAttributesClass. +type VolumeAttributesClassHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apistoragev1alpha1.VolumeAttributesClass] + +// VolumeAttributesClassDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for VolumeAttributesClass. +type VolumeAttributesClassDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apistoragev1alpha1.VolumeAttributesClass] + +// VolumeAttributesClassFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for VolumeAttributesClass. +type VolumeAttributesClassFilteringHandler = cache.TypedFilteringResourceEventHandler[*apistoragev1alpha1.VolumeAttributesClass] + +// VolumeAttributesClassIndexers is a specialization of [cache.TypedIndexers] for VolumeAttributesClass. +type VolumeAttributesClassIndexers = cache.TypedIndexers[*apistoragev1alpha1.VolumeAttributesClass] + +// DeletedVolumeAttributesClass is a specialization of [cache.DeletedObject] for VolumeAttributesClass. +type DeletedVolumeAttributesClass = cache.DeletedObject[*apistoragev1alpha1.VolumeAttributesClass] + type volumeAttributesClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type volumeAttributesClassInformer struct { // NewVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedVolumeAttributesClassInformer]). func NewVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers VolumeAttributesClassIndexers) VolumeAttributesClassIndexInformer { + return NewTypedVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredVolumeAttributesClassInformer]). func NewFilteredVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers VolumeAttributesClassIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) VolumeAttributesClassIndexInformer { + return NewTypedVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewVolumeAttributesClassInformerWithOptions constructs a new informer for VolumeAttributesClass type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedVolumeAttributesClassInformerWithOptions]). func NewVolumeAttributesClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedVolumeAttributesClassInformerWithOptions(client, options) +} + +// NewTypedVolumeAttributesClassInformerWithOptions constructs a new informer for VolumeAttributesClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedVolumeAttributesClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) VolumeAttributesClassIndexInformer { gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1alpha1", Resource: "volumeattributesclasss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apistoragev1alpha1.VolumeAttributesClass](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewVolumeAttributesClassInformerWithOptions(client kubernetes.Interface, op Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *volumeAttributesClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *volumeAttributesClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apistoragev1alpha1.VolumeAttributesClass{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *volumeAttributesClassInformer) TypedInformer() VolumeAttributesClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1alpha1.VolumeAttributesClass](f.factory.InformerFor(&apistoragev1alpha1.VolumeAttributesClass{}, f.defaultInformer)) } func (f *volumeAttributesClassInformer) Lister() storagev1alpha1.VolumeAttributesClassLister { return storagev1alpha1.NewVolumeAttributesClassLister(f.Informer().GetIndexer()) } + +// ToTypedVolumeAttributesClassInformer converts an untyped informer into a TypedVolumeAttributesClassInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *VolumeAttributesClass. If that is not the case, calling type-safe methods of the returned +// TypedVolumeAttributesClassInformer leads to runtime panics. A safer alternative is to pass +// around a TypedVolumeAttributesClassInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedVolumeAttributesClassInformer(informer VolumeAttributesClassInformer) TypedVolumeAttributesClassInformer { + if informer, ok := informer.(TypedVolumeAttributesClassInformer); ok { + return informer + } + return &volumeAttributesClassTypedInformerAdapter{informer} +} + +type volumeAttributesClassTypedInformerAdapter struct { + VolumeAttributesClassInformer +} + +func (a *volumeAttributesClassTypedInformerAdapter) TypedInformer() VolumeAttributesClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1alpha1.VolumeAttributesClass](a.Informer()) +} + +// ToVolumeAttributesClassIndexInformer converts an untyped informer into a VolumeAttributesClassIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *VolumeAttributesClass. If that is not the case, calling type-safe methods of the returned +// VolumeAttributesClassIndexInformer leads to runtime panics. A safer alternative is to pass +// around a VolumeAttributesClassIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToVolumeAttributesClassIndexInformer(informer cache.SharedIndexInformer) VolumeAttributesClassIndexInformer { + if informer, ok := informer.(VolumeAttributesClassIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apistoragev1alpha1.VolumeAttributesClass](informer) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/csidriver.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/csidriver.go index 283dc6b17c..33c0f5551a 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1beta1/csidriver.go +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/csidriver.go @@ -34,12 +34,40 @@ import ( ) // CSIDriverInformer provides access to a shared informer and lister for -// CSIDrivers. +// CSIDrivers. Prefer using the type-safe variant (see [TypedCSIDriverInformer]). type CSIDriverInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1beta1.CSIDriverLister } +// TypedCSIDriverInformer provides access to a shared informer and lister for +// CSIDrivers, including the type-safe TypedInformer variant. +// It is a superset of CSIDriverInformer. +type TypedCSIDriverInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() CSIDriverIndexInformer + Lister() storagev1beta1.CSIDriverLister +} + +// CSIDriverIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type CSIDriverIndexInformer cache.TypedSharedIndexInformer[*apistoragev1beta1.CSIDriver] + +// CSIDriverHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for CSIDriver. +type CSIDriverHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apistoragev1beta1.CSIDriver] + +// CSIDriverDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for CSIDriver. +type CSIDriverDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apistoragev1beta1.CSIDriver] + +// CSIDriverFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for CSIDriver. +type CSIDriverFilteringHandler = cache.TypedFilteringResourceEventHandler[*apistoragev1beta1.CSIDriver] + +// CSIDriverIndexers is a specialization of [cache.TypedIndexers] for CSIDriver. +type CSIDriverIndexers = cache.TypedIndexers[*apistoragev1beta1.CSIDriver] + +// DeletedCSIDriver is a specialization of [cache.DeletedObject] for CSIDriver. +type DeletedCSIDriver = cache.DeletedObject[*apistoragev1beta1.CSIDriver] + type cSIDriverInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type cSIDriverInformer struct { // NewCSIDriverInformer constructs a new informer for CSIDriver type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCSIDriverInformer]). func NewCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedCSIDriverInformer constructs a new informer for CSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers CSIDriverIndexers) CSIDriverIndexInformer { + return NewTypedCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredCSIDriverInformer constructs a new informer for CSIDriver type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredCSIDriverInformer]). func NewFilteredCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredCSIDriverInformer constructs a new informer for CSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers CSIDriverIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) CSIDriverIndexInformer { + return NewTypedCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewCSIDriverInformerWithOptions constructs a new informer for CSIDriver type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCSIDriverInformerWithOptions]). func NewCSIDriverInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedCSIDriverInformerWithOptions(client, options) +} + +// NewTypedCSIDriverInformerWithOptions constructs a new informer for CSIDriver type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCSIDriverInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) CSIDriverIndexInformer { gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1beta1", Resource: "csidrivers"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.CSIDriver](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewCSIDriverInformerWithOptions(client kubernetes.Interface, options intern Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *cSIDriverInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *cSIDriverInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apistoragev1beta1.CSIDriver{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *cSIDriverInformer) TypedInformer() CSIDriverIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.CSIDriver](f.factory.InformerFor(&apistoragev1beta1.CSIDriver{}, f.defaultInformer)) } func (f *cSIDriverInformer) Lister() storagev1beta1.CSIDriverLister { return storagev1beta1.NewCSIDriverLister(f.Informer().GetIndexer()) } + +// ToTypedCSIDriverInformer converts an untyped informer into a TypedCSIDriverInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CSIDriver. If that is not the case, calling type-safe methods of the returned +// TypedCSIDriverInformer leads to runtime panics. A safer alternative is to pass +// around a TypedCSIDriverInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedCSIDriverInformer(informer CSIDriverInformer) TypedCSIDriverInformer { + if informer, ok := informer.(TypedCSIDriverInformer); ok { + return informer + } + return &cSIDriverTypedInformerAdapter{informer} +} + +type cSIDriverTypedInformerAdapter struct { + CSIDriverInformer +} + +func (a *cSIDriverTypedInformerAdapter) TypedInformer() CSIDriverIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.CSIDriver](a.Informer()) +} + +// ToCSIDriverIndexInformer converts an untyped informer into a CSIDriverIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CSIDriver. If that is not the case, calling type-safe methods of the returned +// CSIDriverIndexInformer leads to runtime panics. A safer alternative is to pass +// around a CSIDriverIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToCSIDriverIndexInformer(informer cache.SharedIndexInformer) CSIDriverIndexInformer { + if informer, ok := informer.(CSIDriverIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.CSIDriver](informer) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/csinode.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/csinode.go index f304906ce7..4e7fa6f560 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1beta1/csinode.go +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/csinode.go @@ -34,12 +34,40 @@ import ( ) // CSINodeInformer provides access to a shared informer and lister for -// CSINodes. +// CSINodes. Prefer using the type-safe variant (see [TypedCSINodeInformer]). type CSINodeInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1beta1.CSINodeLister } +// TypedCSINodeInformer provides access to a shared informer and lister for +// CSINodes, including the type-safe TypedInformer variant. +// It is a superset of CSINodeInformer. +type TypedCSINodeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() CSINodeIndexInformer + Lister() storagev1beta1.CSINodeLister +} + +// CSINodeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type CSINodeIndexInformer cache.TypedSharedIndexInformer[*apistoragev1beta1.CSINode] + +// CSINodeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for CSINode. +type CSINodeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apistoragev1beta1.CSINode] + +// CSINodeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for CSINode. +type CSINodeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apistoragev1beta1.CSINode] + +// CSINodeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for CSINode. +type CSINodeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apistoragev1beta1.CSINode] + +// CSINodeIndexers is a specialization of [cache.TypedIndexers] for CSINode. +type CSINodeIndexers = cache.TypedIndexers[*apistoragev1beta1.CSINode] + +// DeletedCSINode is a specialization of [cache.DeletedObject] for CSINode. +type DeletedCSINode = cache.DeletedObject[*apistoragev1beta1.CSINode] + type cSINodeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type cSINodeInformer struct { // NewCSINodeInformer constructs a new informer for CSINode type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCSINodeInformer]). func NewCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedCSINodeInformer constructs a new informer for CSINode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers CSINodeIndexers) CSINodeIndexInformer { + return NewTypedCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredCSINodeInformer constructs a new informer for CSINode type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredCSINodeInformer]). func NewFilteredCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredCSINodeInformer constructs a new informer for CSINode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers CSINodeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) CSINodeIndexInformer { + return NewTypedCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewCSINodeInformerWithOptions constructs a new informer for CSINode type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCSINodeInformerWithOptions]). func NewCSINodeInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedCSINodeInformerWithOptions(client, options) +} + +// NewTypedCSINodeInformerWithOptions constructs a new informer for CSINode type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCSINodeInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) CSINodeIndexInformer { gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1beta1", Resource: "csinodes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.CSINode](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewCSINodeInformerWithOptions(client kubernetes.Interface, options internal Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *cSINodeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *cSINodeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apistoragev1beta1.CSINode{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *cSINodeInformer) TypedInformer() CSINodeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.CSINode](f.factory.InformerFor(&apistoragev1beta1.CSINode{}, f.defaultInformer)) } func (f *cSINodeInformer) Lister() storagev1beta1.CSINodeLister { return storagev1beta1.NewCSINodeLister(f.Informer().GetIndexer()) } + +// ToTypedCSINodeInformer converts an untyped informer into a TypedCSINodeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CSINode. If that is not the case, calling type-safe methods of the returned +// TypedCSINodeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedCSINodeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedCSINodeInformer(informer CSINodeInformer) TypedCSINodeInformer { + if informer, ok := informer.(TypedCSINodeInformer); ok { + return informer + } + return &cSINodeTypedInformerAdapter{informer} +} + +type cSINodeTypedInformerAdapter struct { + CSINodeInformer +} + +func (a *cSINodeTypedInformerAdapter) TypedInformer() CSINodeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.CSINode](a.Informer()) +} + +// ToCSINodeIndexInformer converts an untyped informer into a CSINodeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CSINode. If that is not the case, calling type-safe methods of the returned +// CSINodeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a CSINodeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToCSINodeIndexInformer(informer cache.SharedIndexInformer) CSINodeIndexInformer { + if informer, ok := informer.(CSINodeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.CSINode](informer) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go index 5b24a8c32b..26c7cdb54d 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go @@ -34,12 +34,40 @@ import ( ) // CSIStorageCapacityInformer provides access to a shared informer and lister for -// CSIStorageCapacities. +// CSIStorageCapacities. Prefer using the type-safe variant (see [TypedCSIStorageCapacityInformer]). type CSIStorageCapacityInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1beta1.CSIStorageCapacityLister } +// TypedCSIStorageCapacityInformer provides access to a shared informer and lister for +// CSIStorageCapacities, including the type-safe TypedInformer variant. +// It is a superset of CSIStorageCapacityInformer. +type TypedCSIStorageCapacityInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() CSIStorageCapacityIndexInformer + Lister() storagev1beta1.CSIStorageCapacityLister +} + +// CSIStorageCapacityIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type CSIStorageCapacityIndexInformer cache.TypedSharedIndexInformer[*apistoragev1beta1.CSIStorageCapacity] + +// CSIStorageCapacityHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for CSIStorageCapacity. +type CSIStorageCapacityHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apistoragev1beta1.CSIStorageCapacity] + +// CSIStorageCapacityDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for CSIStorageCapacity. +type CSIStorageCapacityDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apistoragev1beta1.CSIStorageCapacity] + +// CSIStorageCapacityFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for CSIStorageCapacity. +type CSIStorageCapacityFilteringHandler = cache.TypedFilteringResourceEventHandler[*apistoragev1beta1.CSIStorageCapacity] + +// CSIStorageCapacityIndexers is a specialization of [cache.TypedIndexers] for CSIStorageCapacity. +type CSIStorageCapacityIndexers = cache.TypedIndexers[*apistoragev1beta1.CSIStorageCapacity] + +// DeletedCSIStorageCapacity is a specialization of [cache.DeletedObject] for CSIStorageCapacity. +type DeletedCSIStorageCapacity = cache.DeletedObject[*apistoragev1beta1.CSIStorageCapacity] + type cSIStorageCapacityInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type cSIStorageCapacityInformer struct { // NewCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCSIStorageCapacityInformer]). func NewCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers CSIStorageCapacityIndexers) CSIStorageCapacityIndexInformer { + return NewTypedCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredCSIStorageCapacityInformer]). func NewFilteredCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers CSIStorageCapacityIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) CSIStorageCapacityIndexInformer { + return NewTypedCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewCSIStorageCapacityInformerWithOptions constructs a new informer for CSIStorageCapacity type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedCSIStorageCapacityInformerWithOptions]). func NewCSIStorageCapacityInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedCSIStorageCapacityInformerWithOptions(client, namespace, options) +} + +// NewTypedCSIStorageCapacityInformerWithOptions constructs a new informer for CSIStorageCapacity type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedCSIStorageCapacityInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) CSIStorageCapacityIndexInformer { gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1beta1", Resource: "csistoragecapacitys"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.CSIStorageCapacity](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewCSIStorageCapacityInformerWithOptions(client kubernetes.Interface, names Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *cSIStorageCapacityInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewCSIStorageCapacityInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedCSIStorageCapacityInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *cSIStorageCapacityInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apistoragev1beta1.CSIStorageCapacity{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *cSIStorageCapacityInformer) TypedInformer() CSIStorageCapacityIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.CSIStorageCapacity](f.factory.InformerFor(&apistoragev1beta1.CSIStorageCapacity{}, f.defaultInformer)) } func (f *cSIStorageCapacityInformer) Lister() storagev1beta1.CSIStorageCapacityLister { return storagev1beta1.NewCSIStorageCapacityLister(f.Informer().GetIndexer()) } + +// ToTypedCSIStorageCapacityInformer converts an untyped informer into a TypedCSIStorageCapacityInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CSIStorageCapacity. If that is not the case, calling type-safe methods of the returned +// TypedCSIStorageCapacityInformer leads to runtime panics. A safer alternative is to pass +// around a TypedCSIStorageCapacityInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedCSIStorageCapacityInformer(informer CSIStorageCapacityInformer) TypedCSIStorageCapacityInformer { + if informer, ok := informer.(TypedCSIStorageCapacityInformer); ok { + return informer + } + return &cSIStorageCapacityTypedInformerAdapter{informer} +} + +type cSIStorageCapacityTypedInformerAdapter struct { + CSIStorageCapacityInformer +} + +func (a *cSIStorageCapacityTypedInformerAdapter) TypedInformer() CSIStorageCapacityIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.CSIStorageCapacity](a.Informer()) +} + +// ToCSIStorageCapacityIndexInformer converts an untyped informer into a CSIStorageCapacityIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *CSIStorageCapacity. If that is not the case, calling type-safe methods of the returned +// CSIStorageCapacityIndexInformer leads to runtime panics. A safer alternative is to pass +// around a CSIStorageCapacityIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToCSIStorageCapacityIndexInformer(informer cache.SharedIndexInformer) CSIStorageCapacityIndexInformer { + if informer, ok := informer.(CSIStorageCapacityIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.CSIStorageCapacity](informer) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/interface.go index 7433951855..a1a312170c 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1beta1/interface.go +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/interface.go @@ -25,17 +25,17 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // CSIDrivers returns a CSIDriverInformer. - CSIDrivers() CSIDriverInformer + CSIDrivers() TypedCSIDriverInformer // CSINodes returns a CSINodeInformer. - CSINodes() CSINodeInformer + CSINodes() TypedCSINodeInformer // CSIStorageCapacities returns a CSIStorageCapacityInformer. - CSIStorageCapacities() CSIStorageCapacityInformer + CSIStorageCapacities() TypedCSIStorageCapacityInformer // StorageClasses returns a StorageClassInformer. - StorageClasses() StorageClassInformer + StorageClasses() TypedStorageClassInformer // VolumeAttachments returns a VolumeAttachmentInformer. - VolumeAttachments() VolumeAttachmentInformer + VolumeAttachments() TypedVolumeAttachmentInformer // VolumeAttributesClasses returns a VolumeAttributesClassInformer. - VolumeAttributesClasses() VolumeAttributesClassInformer + VolumeAttributesClasses() TypedVolumeAttributesClassInformer } type version struct { @@ -49,32 +49,32 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// CSIDrivers returns a CSIDriverInformer. -func (v *version) CSIDrivers() CSIDriverInformer { +// CSIDrivers returns a TypedCSIDriverInformer. +func (v *version) CSIDrivers() TypedCSIDriverInformer { return &cSIDriverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// CSINodes returns a CSINodeInformer. -func (v *version) CSINodes() CSINodeInformer { +// CSINodes returns a TypedCSINodeInformer. +func (v *version) CSINodes() TypedCSINodeInformer { return &cSINodeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// CSIStorageCapacities returns a CSIStorageCapacityInformer. -func (v *version) CSIStorageCapacities() CSIStorageCapacityInformer { +// CSIStorageCapacities returns a TypedCSIStorageCapacityInformer. +func (v *version) CSIStorageCapacities() TypedCSIStorageCapacityInformer { return &cSIStorageCapacityInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// StorageClasses returns a StorageClassInformer. -func (v *version) StorageClasses() StorageClassInformer { +// StorageClasses returns a TypedStorageClassInformer. +func (v *version) StorageClasses() TypedStorageClassInformer { return &storageClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// VolumeAttachments returns a VolumeAttachmentInformer. -func (v *version) VolumeAttachments() VolumeAttachmentInformer { +// VolumeAttachments returns a TypedVolumeAttachmentInformer. +func (v *version) VolumeAttachments() TypedVolumeAttachmentInformer { return &volumeAttachmentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// VolumeAttributesClasses returns a VolumeAttributesClassInformer. -func (v *version) VolumeAttributesClasses() VolumeAttributesClassInformer { +// VolumeAttributesClasses returns a TypedVolumeAttributesClassInformer. +func (v *version) VolumeAttributesClasses() TypedVolumeAttributesClassInformer { return &volumeAttributesClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/storageclass.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/storageclass.go index 2052da70e9..55bbe4446b 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1beta1/storageclass.go +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/storageclass.go @@ -34,12 +34,40 @@ import ( ) // StorageClassInformer provides access to a shared informer and lister for -// StorageClasses. +// StorageClasses. Prefer using the type-safe variant (see [TypedStorageClassInformer]). type StorageClassInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1beta1.StorageClassLister } +// TypedStorageClassInformer provides access to a shared informer and lister for +// StorageClasses, including the type-safe TypedInformer variant. +// It is a superset of StorageClassInformer. +type TypedStorageClassInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() StorageClassIndexInformer + Lister() storagev1beta1.StorageClassLister +} + +// StorageClassIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type StorageClassIndexInformer cache.TypedSharedIndexInformer[*apistoragev1beta1.StorageClass] + +// StorageClassHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for StorageClass. +type StorageClassHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apistoragev1beta1.StorageClass] + +// StorageClassDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for StorageClass. +type StorageClassDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apistoragev1beta1.StorageClass] + +// StorageClassFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for StorageClass. +type StorageClassFilteringHandler = cache.TypedFilteringResourceEventHandler[*apistoragev1beta1.StorageClass] + +// StorageClassIndexers is a specialization of [cache.TypedIndexers] for StorageClass. +type StorageClassIndexers = cache.TypedIndexers[*apistoragev1beta1.StorageClass] + +// DeletedStorageClass is a specialization of [cache.DeletedObject] for StorageClass. +type DeletedStorageClass = cache.DeletedObject[*apistoragev1beta1.StorageClass] + type storageClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type storageClassInformer struct { // NewStorageClassInformer constructs a new informer for StorageClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedStorageClassInformer]). func NewStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedStorageClassInformer constructs a new informer for StorageClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers StorageClassIndexers) StorageClassIndexInformer { + return NewTypedStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredStorageClassInformer constructs a new informer for StorageClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredStorageClassInformer]). func NewFilteredStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredStorageClassInformer constructs a new informer for StorageClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers StorageClassIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) StorageClassIndexInformer { + return NewTypedStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewStorageClassInformerWithOptions constructs a new informer for StorageClass type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedStorageClassInformerWithOptions]). func NewStorageClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedStorageClassInformerWithOptions(client, options) +} + +// NewTypedStorageClassInformerWithOptions constructs a new informer for StorageClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedStorageClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) StorageClassIndexInformer { gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1beta1", Resource: "storageclasss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.StorageClass](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewStorageClassInformerWithOptions(client kubernetes.Interface, options int Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *storageClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *storageClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apistoragev1beta1.StorageClass{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *storageClassInformer) TypedInformer() StorageClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.StorageClass](f.factory.InformerFor(&apistoragev1beta1.StorageClass{}, f.defaultInformer)) } func (f *storageClassInformer) Lister() storagev1beta1.StorageClassLister { return storagev1beta1.NewStorageClassLister(f.Informer().GetIndexer()) } + +// ToTypedStorageClassInformer converts an untyped informer into a TypedStorageClassInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *StorageClass. If that is not the case, calling type-safe methods of the returned +// TypedStorageClassInformer leads to runtime panics. A safer alternative is to pass +// around a TypedStorageClassInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedStorageClassInformer(informer StorageClassInformer) TypedStorageClassInformer { + if informer, ok := informer.(TypedStorageClassInformer); ok { + return informer + } + return &storageClassTypedInformerAdapter{informer} +} + +type storageClassTypedInformerAdapter struct { + StorageClassInformer +} + +func (a *storageClassTypedInformerAdapter) TypedInformer() StorageClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.StorageClass](a.Informer()) +} + +// ToStorageClassIndexInformer converts an untyped informer into a StorageClassIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *StorageClass. If that is not the case, calling type-safe methods of the returned +// StorageClassIndexInformer leads to runtime panics. A safer alternative is to pass +// around a StorageClassIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToStorageClassIndexInformer(informer cache.SharedIndexInformer) StorageClassIndexInformer { + if informer, ok := informer.(StorageClassIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.StorageClass](informer) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go index 11f9840b04..d288cba131 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go @@ -34,12 +34,40 @@ import ( ) // VolumeAttachmentInformer provides access to a shared informer and lister for -// VolumeAttachments. +// VolumeAttachments. Prefer using the type-safe variant (see [TypedVolumeAttachmentInformer]). type VolumeAttachmentInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1beta1.VolumeAttachmentLister } +// TypedVolumeAttachmentInformer provides access to a shared informer and lister for +// VolumeAttachments, including the type-safe TypedInformer variant. +// It is a superset of VolumeAttachmentInformer. +type TypedVolumeAttachmentInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() VolumeAttachmentIndexInformer + Lister() storagev1beta1.VolumeAttachmentLister +} + +// VolumeAttachmentIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type VolumeAttachmentIndexInformer cache.TypedSharedIndexInformer[*apistoragev1beta1.VolumeAttachment] + +// VolumeAttachmentHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for VolumeAttachment. +type VolumeAttachmentHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apistoragev1beta1.VolumeAttachment] + +// VolumeAttachmentDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for VolumeAttachment. +type VolumeAttachmentDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apistoragev1beta1.VolumeAttachment] + +// VolumeAttachmentFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for VolumeAttachment. +type VolumeAttachmentFilteringHandler = cache.TypedFilteringResourceEventHandler[*apistoragev1beta1.VolumeAttachment] + +// VolumeAttachmentIndexers is a specialization of [cache.TypedIndexers] for VolumeAttachment. +type VolumeAttachmentIndexers = cache.TypedIndexers[*apistoragev1beta1.VolumeAttachment] + +// DeletedVolumeAttachment is a specialization of [cache.DeletedObject] for VolumeAttachment. +type DeletedVolumeAttachment = cache.DeletedObject[*apistoragev1beta1.VolumeAttachment] + type volumeAttachmentInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type volumeAttachmentInformer struct { // NewVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedVolumeAttachmentInformer]). func NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers VolumeAttachmentIndexers) VolumeAttachmentIndexInformer { + return NewTypedVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredVolumeAttachmentInformer]). func NewFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers VolumeAttachmentIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) VolumeAttachmentIndexInformer { + return NewTypedVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewVolumeAttachmentInformerWithOptions constructs a new informer for VolumeAttachment type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedVolumeAttachmentInformerWithOptions]). func NewVolumeAttachmentInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedVolumeAttachmentInformerWithOptions(client, options) +} + +// NewTypedVolumeAttachmentInformerWithOptions constructs a new informer for VolumeAttachment type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedVolumeAttachmentInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) VolumeAttachmentIndexInformer { gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1beta1", Resource: "volumeattachments"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.VolumeAttachment](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewVolumeAttachmentInformerWithOptions(client kubernetes.Interface, options Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apistoragev1beta1.VolumeAttachment{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *volumeAttachmentInformer) TypedInformer() VolumeAttachmentIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.VolumeAttachment](f.factory.InformerFor(&apistoragev1beta1.VolumeAttachment{}, f.defaultInformer)) } func (f *volumeAttachmentInformer) Lister() storagev1beta1.VolumeAttachmentLister { return storagev1beta1.NewVolumeAttachmentLister(f.Informer().GetIndexer()) } + +// ToTypedVolumeAttachmentInformer converts an untyped informer into a TypedVolumeAttachmentInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *VolumeAttachment. If that is not the case, calling type-safe methods of the returned +// TypedVolumeAttachmentInformer leads to runtime panics. A safer alternative is to pass +// around a TypedVolumeAttachmentInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedVolumeAttachmentInformer(informer VolumeAttachmentInformer) TypedVolumeAttachmentInformer { + if informer, ok := informer.(TypedVolumeAttachmentInformer); ok { + return informer + } + return &volumeAttachmentTypedInformerAdapter{informer} +} + +type volumeAttachmentTypedInformerAdapter struct { + VolumeAttachmentInformer +} + +func (a *volumeAttachmentTypedInformerAdapter) TypedInformer() VolumeAttachmentIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.VolumeAttachment](a.Informer()) +} + +// ToVolumeAttachmentIndexInformer converts an untyped informer into a VolumeAttachmentIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *VolumeAttachment. If that is not the case, calling type-safe methods of the returned +// VolumeAttachmentIndexInformer leads to runtime panics. A safer alternative is to pass +// around a VolumeAttachmentIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToVolumeAttachmentIndexInformer(informer cache.SharedIndexInformer) VolumeAttachmentIndexInformer { + if informer, ok := informer.(VolumeAttachmentIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.VolumeAttachment](informer) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattributesclass.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattributesclass.go index c91dfff0d1..c37a0a22d8 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattributesclass.go +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattributesclass.go @@ -34,12 +34,40 @@ import ( ) // VolumeAttributesClassInformer provides access to a shared informer and lister for -// VolumeAttributesClasses. +// VolumeAttributesClasses. Prefer using the type-safe variant (see [TypedVolumeAttributesClassInformer]). type VolumeAttributesClassInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1beta1.VolumeAttributesClassLister } +// TypedVolumeAttributesClassInformer provides access to a shared informer and lister for +// VolumeAttributesClasses, including the type-safe TypedInformer variant. +// It is a superset of VolumeAttributesClassInformer. +type TypedVolumeAttributesClassInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() VolumeAttributesClassIndexInformer + Lister() storagev1beta1.VolumeAttributesClassLister +} + +// VolumeAttributesClassIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type VolumeAttributesClassIndexInformer cache.TypedSharedIndexInformer[*apistoragev1beta1.VolumeAttributesClass] + +// VolumeAttributesClassHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for VolumeAttributesClass. +type VolumeAttributesClassHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apistoragev1beta1.VolumeAttributesClass] + +// VolumeAttributesClassDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for VolumeAttributesClass. +type VolumeAttributesClassDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apistoragev1beta1.VolumeAttributesClass] + +// VolumeAttributesClassFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for VolumeAttributesClass. +type VolumeAttributesClassFilteringHandler = cache.TypedFilteringResourceEventHandler[*apistoragev1beta1.VolumeAttributesClass] + +// VolumeAttributesClassIndexers is a specialization of [cache.TypedIndexers] for VolumeAttributesClass. +type VolumeAttributesClassIndexers = cache.TypedIndexers[*apistoragev1beta1.VolumeAttributesClass] + +// DeletedVolumeAttributesClass is a specialization of [cache.DeletedObject] for VolumeAttributesClass. +type DeletedVolumeAttributesClass = cache.DeletedObject[*apistoragev1beta1.VolumeAttributesClass] + type volumeAttributesClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type volumeAttributesClassInformer struct { // NewVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedVolumeAttributesClassInformer]). func NewVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers VolumeAttributesClassIndexers) VolumeAttributesClassIndexInformer { + return NewTypedVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredVolumeAttributesClassInformer]). func NewFilteredVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers VolumeAttributesClassIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) VolumeAttributesClassIndexInformer { + return NewTypedVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewVolumeAttributesClassInformerWithOptions constructs a new informer for VolumeAttributesClass type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedVolumeAttributesClassInformerWithOptions]). func NewVolumeAttributesClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedVolumeAttributesClassInformerWithOptions(client, options) +} + +// NewTypedVolumeAttributesClassInformerWithOptions constructs a new informer for VolumeAttributesClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedVolumeAttributesClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) VolumeAttributesClassIndexInformer { gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1beta1", Resource: "volumeattributesclasss"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.VolumeAttributesClass](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewVolumeAttributesClassInformerWithOptions(client kubernetes.Interface, op Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *volumeAttributesClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *volumeAttributesClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apistoragev1beta1.VolumeAttributesClass{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *volumeAttributesClassInformer) TypedInformer() VolumeAttributesClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.VolumeAttributesClass](f.factory.InformerFor(&apistoragev1beta1.VolumeAttributesClass{}, f.defaultInformer)) } func (f *volumeAttributesClassInformer) Lister() storagev1beta1.VolumeAttributesClassLister { return storagev1beta1.NewVolumeAttributesClassLister(f.Informer().GetIndexer()) } + +// ToTypedVolumeAttributesClassInformer converts an untyped informer into a TypedVolumeAttributesClassInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *VolumeAttributesClass. If that is not the case, calling type-safe methods of the returned +// TypedVolumeAttributesClassInformer leads to runtime panics. A safer alternative is to pass +// around a TypedVolumeAttributesClassInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedVolumeAttributesClassInformer(informer VolumeAttributesClassInformer) TypedVolumeAttributesClassInformer { + if informer, ok := informer.(TypedVolumeAttributesClassInformer); ok { + return informer + } + return &volumeAttributesClassTypedInformerAdapter{informer} +} + +type volumeAttributesClassTypedInformerAdapter struct { + VolumeAttributesClassInformer +} + +func (a *volumeAttributesClassTypedInformerAdapter) TypedInformer() VolumeAttributesClassIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.VolumeAttributesClass](a.Informer()) +} + +// ToVolumeAttributesClassIndexInformer converts an untyped informer into a VolumeAttributesClassIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *VolumeAttributesClass. If that is not the case, calling type-safe methods of the returned +// VolumeAttributesClassIndexInformer leads to runtime panics. A safer alternative is to pass +// around a VolumeAttributesClassIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToVolumeAttributesClassIndexInformer(informer cache.SharedIndexInformer) VolumeAttributesClassIndexInformer { + if informer, ok := informer.(VolumeAttributesClassIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apistoragev1beta1.VolumeAttributesClass](informer) +} diff --git a/vendor/k8s.io/client-go/informers/storagemigration/interface.go b/vendor/k8s.io/client-go/informers/storagemigration/interface.go index 426e50fd57..5996e36529 100644 --- a/vendor/k8s.io/client-go/informers/storagemigration/interface.go +++ b/vendor/k8s.io/client-go/informers/storagemigration/interface.go @@ -20,11 +20,14 @@ package storagemigration import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/informers/storagemigration/v1" v1beta1 "k8s.io/client-go/informers/storagemigration/v1beta1" ) // Interface provides access to each of this group's versions. type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface } @@ -40,6 +43,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + // V1beta1 returns a new v1beta1.Interface. func (g *group) V1beta1() v1beta1.Interface { return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) diff --git a/vendor/k8s.io/client-go/informers/storagemigration/v1/interface.go b/vendor/k8s.io/client-go/informers/storagemigration/v1/interface.go new file mode 100644 index 0000000000..41854207c1 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storagemigration/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // StorageVersionMigrations returns a StorageVersionMigrationInformer. + StorageVersionMigrations() TypedStorageVersionMigrationInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// StorageVersionMigrations returns a TypedStorageVersionMigrationInformer. +func (v *version) StorageVersionMigrations() TypedStorageVersionMigrationInformer { + return &storageVersionMigrationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/storagemigration/v1/storageversionmigration.go b/vendor/k8s.io/client-go/informers/storagemigration/v1/storageversionmigration.go new file mode 100644 index 0000000000..8036df40b2 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storagemigration/v1/storageversionmigration.go @@ -0,0 +1,207 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + time "time" + + apistoragemigrationv1 "k8s.io/api/storagemigration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + storagemigrationv1 "k8s.io/client-go/listers/storagemigration/v1" + cache "k8s.io/client-go/tools/cache" +) + +// StorageVersionMigrationInformer provides access to a shared informer and lister for +// StorageVersionMigrations. Prefer using the type-safe variant (see [TypedStorageVersionMigrationInformer]). +type StorageVersionMigrationInformer interface { + Informer() cache.SharedIndexInformer + Lister() storagemigrationv1.StorageVersionMigrationLister +} + +// TypedStorageVersionMigrationInformer provides access to a shared informer and lister for +// StorageVersionMigrations, including the type-safe TypedInformer variant. +// It is a superset of StorageVersionMigrationInformer. +type TypedStorageVersionMigrationInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() StorageVersionMigrationIndexInformer + Lister() storagemigrationv1.StorageVersionMigrationLister +} + +// StorageVersionMigrationIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type StorageVersionMigrationIndexInformer cache.TypedSharedIndexInformer[*apistoragemigrationv1.StorageVersionMigration] + +// StorageVersionMigrationHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for StorageVersionMigration. +type StorageVersionMigrationHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apistoragemigrationv1.StorageVersionMigration] + +// StorageVersionMigrationDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for StorageVersionMigration. +type StorageVersionMigrationDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apistoragemigrationv1.StorageVersionMigration] + +// StorageVersionMigrationFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for StorageVersionMigration. +type StorageVersionMigrationFilteringHandler = cache.TypedFilteringResourceEventHandler[*apistoragemigrationv1.StorageVersionMigration] + +// StorageVersionMigrationIndexers is a specialization of [cache.TypedIndexers] for StorageVersionMigration. +type StorageVersionMigrationIndexers = cache.TypedIndexers[*apistoragemigrationv1.StorageVersionMigration] + +// DeletedStorageVersionMigration is a specialization of [cache.DeletedObject] for StorageVersionMigration. +type DeletedStorageVersionMigration = cache.DeletedObject[*apistoragemigrationv1.StorageVersionMigration] + +type storageVersionMigrationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewStorageVersionMigrationInformer constructs a new informer for StorageVersionMigration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedStorageVersionMigrationInformer]). +func NewStorageVersionMigrationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewStorageVersionMigrationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewTypedStorageVersionMigrationInformer constructs a new informer for StorageVersionMigration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedStorageVersionMigrationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers StorageVersionMigrationIndexers) StorageVersionMigrationIndexInformer { + return NewTypedStorageVersionMigrationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + +// NewFilteredStorageVersionMigrationInformer constructs a new informer for StorageVersionMigration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredStorageVersionMigrationInformer]). +func NewFilteredStorageVersionMigrationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewTypedStorageVersionMigrationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredStorageVersionMigrationInformer constructs a new informer for StorageVersionMigration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredStorageVersionMigrationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers StorageVersionMigrationIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) StorageVersionMigrationIndexInformer { + return NewTypedStorageVersionMigrationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) +} + +// NewStorageVersionMigrationInformerWithOptions constructs a new informer for StorageVersionMigration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedStorageVersionMigrationInformerWithOptions]). +func NewStorageVersionMigrationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedStorageVersionMigrationInformerWithOptions(client, options) +} + +// NewTypedStorageVersionMigrationInformerWithOptions constructs a new informer for StorageVersionMigration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedStorageVersionMigrationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) StorageVersionMigrationIndexInformer { + gvr := schema.GroupVersionResource{Group: "storagemigration.k8s.io", Version: "v1", Resource: "storageversionmigrations"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewTypedSharedIndexInformer[*apistoragemigrationv1.StorageVersionMigration](cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.StoragemigrationV1().StorageVersionMigrations().List(context.Background(), opts) + }, + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.StoragemigrationV1().StorageVersionMigrations().Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.StoragemigrationV1().StorageVersionMigrations().List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.StoragemigrationV1().StorageVersionMigrations().Watch(ctx, opts) + }, + }, client), + &apistoragemigrationv1.StorageVersionMigration{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + )) +} + +func (f *storageVersionMigrationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewTypedStorageVersionMigrationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *storageVersionMigrationInformer) Informer() cache.SharedIndexInformer { + return f.TypedInformer() +} + +func (f *storageVersionMigrationInformer) TypedInformer() StorageVersionMigrationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragemigrationv1.StorageVersionMigration](f.factory.InformerFor(&apistoragemigrationv1.StorageVersionMigration{}, f.defaultInformer)) +} + +func (f *storageVersionMigrationInformer) Lister() storagemigrationv1.StorageVersionMigrationLister { + return storagemigrationv1.NewStorageVersionMigrationLister(f.Informer().GetIndexer()) +} + +// ToTypedStorageVersionMigrationInformer converts an untyped informer into a TypedStorageVersionMigrationInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *StorageVersionMigration. If that is not the case, calling type-safe methods of the returned +// TypedStorageVersionMigrationInformer leads to runtime panics. A safer alternative is to pass +// around a TypedStorageVersionMigrationInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedStorageVersionMigrationInformer(informer StorageVersionMigrationInformer) TypedStorageVersionMigrationInformer { + if informer, ok := informer.(TypedStorageVersionMigrationInformer); ok { + return informer + } + return &storageVersionMigrationTypedInformerAdapter{informer} +} + +type storageVersionMigrationTypedInformerAdapter struct { + StorageVersionMigrationInformer +} + +func (a *storageVersionMigrationTypedInformerAdapter) TypedInformer() StorageVersionMigrationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragemigrationv1.StorageVersionMigration](a.Informer()) +} + +// ToStorageVersionMigrationIndexInformer converts an untyped informer into a StorageVersionMigrationIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *StorageVersionMigration. If that is not the case, calling type-safe methods of the returned +// StorageVersionMigrationIndexInformer leads to runtime panics. A safer alternative is to pass +// around a StorageVersionMigrationIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToStorageVersionMigrationIndexInformer(informer cache.SharedIndexInformer) StorageVersionMigrationIndexInformer { + if informer, ok := informer.(StorageVersionMigrationIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apistoragemigrationv1.StorageVersionMigration](informer) +} diff --git a/vendor/k8s.io/client-go/informers/storagemigration/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/storagemigration/v1beta1/interface.go index 220e1f5c8c..0035d43b1e 100644 --- a/vendor/k8s.io/client-go/informers/storagemigration/v1beta1/interface.go +++ b/vendor/k8s.io/client-go/informers/storagemigration/v1beta1/interface.go @@ -25,7 +25,7 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // StorageVersionMigrations returns a StorageVersionMigrationInformer. - StorageVersionMigrations() StorageVersionMigrationInformer + StorageVersionMigrations() TypedStorageVersionMigrationInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// StorageVersionMigrations returns a StorageVersionMigrationInformer. -func (v *version) StorageVersionMigrations() StorageVersionMigrationInformer { +// StorageVersionMigrations returns a TypedStorageVersionMigrationInformer. +func (v *version) StorageVersionMigrations() TypedStorageVersionMigrationInformer { return &storageVersionMigrationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/k8s.io/client-go/informers/storagemigration/v1beta1/storageversionmigration.go b/vendor/k8s.io/client-go/informers/storagemigration/v1beta1/storageversionmigration.go index 50e271e6fe..3b8d5f7c9e 100644 --- a/vendor/k8s.io/client-go/informers/storagemigration/v1beta1/storageversionmigration.go +++ b/vendor/k8s.io/client-go/informers/storagemigration/v1beta1/storageversionmigration.go @@ -34,12 +34,40 @@ import ( ) // StorageVersionMigrationInformer provides access to a shared informer and lister for -// StorageVersionMigrations. +// StorageVersionMigrations. Prefer using the type-safe variant (see [TypedStorageVersionMigrationInformer]). type StorageVersionMigrationInformer interface { Informer() cache.SharedIndexInformer Lister() storagemigrationv1beta1.StorageVersionMigrationLister } +// TypedStorageVersionMigrationInformer provides access to a shared informer and lister for +// StorageVersionMigrations, including the type-safe TypedInformer variant. +// It is a superset of StorageVersionMigrationInformer. +type TypedStorageVersionMigrationInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() StorageVersionMigrationIndexInformer + Lister() storagemigrationv1beta1.StorageVersionMigrationLister +} + +// StorageVersionMigrationIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type StorageVersionMigrationIndexInformer cache.TypedSharedIndexInformer[*apistoragemigrationv1beta1.StorageVersionMigration] + +// StorageVersionMigrationHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for StorageVersionMigration. +type StorageVersionMigrationHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apistoragemigrationv1beta1.StorageVersionMigration] + +// StorageVersionMigrationDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for StorageVersionMigration. +type StorageVersionMigrationDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apistoragemigrationv1beta1.StorageVersionMigration] + +// StorageVersionMigrationFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for StorageVersionMigration. +type StorageVersionMigrationFilteringHandler = cache.TypedFilteringResourceEventHandler[*apistoragemigrationv1beta1.StorageVersionMigration] + +// StorageVersionMigrationIndexers is a specialization of [cache.TypedIndexers] for StorageVersionMigration. +type StorageVersionMigrationIndexers = cache.TypedIndexers[*apistoragemigrationv1beta1.StorageVersionMigration] + +// DeletedStorageVersionMigration is a specialization of [cache.DeletedObject] for StorageVersionMigration. +type DeletedStorageVersionMigration = cache.DeletedObject[*apistoragemigrationv1beta1.StorageVersionMigration] + type storageVersionMigrationInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -48,25 +76,49 @@ type storageVersionMigrationInformer struct { // NewStorageVersionMigrationInformer constructs a new informer for StorageVersionMigration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedStorageVersionMigrationInformer]). func NewStorageVersionMigrationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewStorageVersionMigrationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedStorageVersionMigrationInformer constructs a new informer for StorageVersionMigration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedStorageVersionMigrationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers StorageVersionMigrationIndexers) StorageVersionMigrationIndexInformer { + return NewTypedStorageVersionMigrationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredStorageVersionMigrationInformer constructs a new informer for StorageVersionMigration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredStorageVersionMigrationInformer]). func NewFilteredStorageVersionMigrationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewStorageVersionMigrationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedStorageVersionMigrationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredStorageVersionMigrationInformer constructs a new informer for StorageVersionMigration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredStorageVersionMigrationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers StorageVersionMigrationIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) StorageVersionMigrationIndexInformer { + return NewTypedStorageVersionMigrationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewStorageVersionMigrationInformerWithOptions constructs a new informer for StorageVersionMigration type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedStorageVersionMigrationInformerWithOptions]). func NewStorageVersionMigrationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedStorageVersionMigrationInformerWithOptions(client, options) +} + +// NewTypedStorageVersionMigrationInformerWithOptions constructs a new informer for StorageVersionMigration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedStorageVersionMigrationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) StorageVersionMigrationIndexInformer { gvr := schema.GroupVersionResource{Group: "storagemigration.k8s.io", Version: "v1beta1", Resource: "storageversionmigrations"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apistoragemigrationv1beta1.StorageVersionMigration](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -99,17 +151,57 @@ func NewStorageVersionMigrationInformerWithOptions(client kubernetes.Interface, Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *storageVersionMigrationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewStorageVersionMigrationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedStorageVersionMigrationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *storageVersionMigrationInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apistoragemigrationv1beta1.StorageVersionMigration{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *storageVersionMigrationInformer) TypedInformer() StorageVersionMigrationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragemigrationv1beta1.StorageVersionMigration](f.factory.InformerFor(&apistoragemigrationv1beta1.StorageVersionMigration{}, f.defaultInformer)) } func (f *storageVersionMigrationInformer) Lister() storagemigrationv1beta1.StorageVersionMigrationLister { return storagemigrationv1beta1.NewStorageVersionMigrationLister(f.Informer().GetIndexer()) } + +// ToTypedStorageVersionMigrationInformer converts an untyped informer into a TypedStorageVersionMigrationInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *StorageVersionMigration. If that is not the case, calling type-safe methods of the returned +// TypedStorageVersionMigrationInformer leads to runtime panics. A safer alternative is to pass +// around a TypedStorageVersionMigrationInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedStorageVersionMigrationInformer(informer StorageVersionMigrationInformer) TypedStorageVersionMigrationInformer { + if informer, ok := informer.(TypedStorageVersionMigrationInformer); ok { + return informer + } + return &storageVersionMigrationTypedInformerAdapter{informer} +} + +type storageVersionMigrationTypedInformerAdapter struct { + StorageVersionMigrationInformer +} + +func (a *storageVersionMigrationTypedInformerAdapter) TypedInformer() StorageVersionMigrationIndexInformer { + return cache.NewTypedSharedIndexInformer[*apistoragemigrationv1beta1.StorageVersionMigration](a.Informer()) +} + +// ToStorageVersionMigrationIndexInformer converts an untyped informer into a StorageVersionMigrationIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *StorageVersionMigration. If that is not the case, calling type-safe methods of the returned +// StorageVersionMigrationIndexInformer leads to runtime panics. A safer alternative is to pass +// around a StorageVersionMigrationIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToStorageVersionMigrationIndexInformer(informer cache.SharedIndexInformer) StorageVersionMigrationIndexInformer { + if informer, ok := informer.(StorageVersionMigrationIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apistoragemigrationv1beta1.StorageVersionMigration](informer) +} diff --git a/vendor/k8s.io/client-go/kubernetes/clientset.go b/vendor/k8s.io/client-go/kubernetes/clientset.go index 537609b718..4bc28060ad 100644 --- a/vendor/k8s.io/client-go/kubernetes/clientset.go +++ b/vendor/k8s.io/client-go/kubernetes/clientset.go @@ -55,6 +55,7 @@ import ( flowcontrolv1beta1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1" flowcontrolv1beta2 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2" flowcontrolv1beta3 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3" + lifecyclev1alpha1 "k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1" networkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1" networkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1" nodev1 "k8s.io/client-go/kubernetes/typed/node/v1" @@ -70,18 +71,19 @@ import ( resourcev1beta1 "k8s.io/client-go/kubernetes/typed/resource/v1beta1" resourcev1beta2 "k8s.io/client-go/kubernetes/typed/resource/v1beta2" schedulingv1 "k8s.io/client-go/kubernetes/typed/scheduling/v1" - schedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2" + schedulingv1alpha3 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3" schedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1" storagev1 "k8s.io/client-go/kubernetes/typed/storage/v1" storagev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1" storagev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1" + storagemigrationv1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1" storagemigrationv1beta1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1beta1" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" ) type Interface interface { - Discovery() discovery.DiscoveryInterface + Discovery() discovery.DiscoveryInterfaces AdmissionregistrationV1() admissionregistrationv1.AdmissionregistrationV1Interface AdmissionregistrationV1alpha1() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface AdmissionregistrationV1beta1() admissionregistrationv1beta1.AdmissionregistrationV1beta1Interface @@ -114,6 +116,7 @@ type Interface interface { FlowcontrolV1beta1() flowcontrolv1beta1.FlowcontrolV1beta1Interface FlowcontrolV1beta2() flowcontrolv1beta2.FlowcontrolV1beta2Interface FlowcontrolV1beta3() flowcontrolv1beta3.FlowcontrolV1beta3Interface + LifecycleV1alpha1() lifecyclev1alpha1.LifecycleV1alpha1Interface NetworkingV1() networkingv1.NetworkingV1Interface NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface NodeV1() nodev1.NodeV1Interface @@ -128,12 +131,13 @@ type Interface interface { ResourceV1beta2() resourcev1beta2.ResourceV1beta2Interface ResourceV1beta1() resourcev1beta1.ResourceV1beta1Interface ResourceV1alpha3() resourcev1alpha3.ResourceV1alpha3Interface - SchedulingV1alpha2() schedulingv1alpha2.SchedulingV1alpha2Interface + SchedulingV1alpha3() schedulingv1alpha3.SchedulingV1alpha3Interface SchedulingV1beta1() schedulingv1beta1.SchedulingV1beta1Interface SchedulingV1() schedulingv1.SchedulingV1Interface StorageV1beta1() storagev1beta1.StorageV1beta1Interface StorageV1() storagev1.StorageV1Interface StorageV1alpha1() storagev1alpha1.StorageV1alpha1Interface + StoragemigrationV1() storagemigrationv1.StoragemigrationV1Interface StoragemigrationV1beta1() storagemigrationv1beta1.StoragemigrationV1beta1Interface } @@ -172,6 +176,7 @@ type Clientset struct { flowcontrolV1beta1 *flowcontrolv1beta1.FlowcontrolV1beta1Client flowcontrolV1beta2 *flowcontrolv1beta2.FlowcontrolV1beta2Client flowcontrolV1beta3 *flowcontrolv1beta3.FlowcontrolV1beta3Client + lifecycleV1alpha1 *lifecyclev1alpha1.LifecycleV1alpha1Client networkingV1 *networkingv1.NetworkingV1Client networkingV1beta1 *networkingv1beta1.NetworkingV1beta1Client nodeV1 *nodev1.NodeV1Client @@ -186,12 +191,13 @@ type Clientset struct { resourceV1beta2 *resourcev1beta2.ResourceV1beta2Client resourceV1beta1 *resourcev1beta1.ResourceV1beta1Client resourceV1alpha3 *resourcev1alpha3.ResourceV1alpha3Client - schedulingV1alpha2 *schedulingv1alpha2.SchedulingV1alpha2Client + schedulingV1alpha3 *schedulingv1alpha3.SchedulingV1alpha3Client schedulingV1beta1 *schedulingv1beta1.SchedulingV1beta1Client schedulingV1 *schedulingv1.SchedulingV1Client storageV1beta1 *storagev1beta1.StorageV1beta1Client storageV1 *storagev1.StorageV1Client storageV1alpha1 *storagev1alpha1.StorageV1alpha1Client + storagemigrationV1 *storagemigrationv1.StoragemigrationV1Client storagemigrationV1beta1 *storagemigrationv1beta1.StoragemigrationV1beta1Client } @@ -355,6 +361,11 @@ func (c *Clientset) FlowcontrolV1beta3() flowcontrolv1beta3.FlowcontrolV1beta3In return c.flowcontrolV1beta3 } +// LifecycleV1alpha1 retrieves the LifecycleV1alpha1Client +func (c *Clientset) LifecycleV1alpha1() lifecyclev1alpha1.LifecycleV1alpha1Interface { + return c.lifecycleV1alpha1 +} + // NetworkingV1 retrieves the NetworkingV1Client func (c *Clientset) NetworkingV1() networkingv1.NetworkingV1Interface { return c.networkingV1 @@ -425,9 +436,9 @@ func (c *Clientset) ResourceV1alpha3() resourcev1alpha3.ResourceV1alpha3Interfac return c.resourceV1alpha3 } -// SchedulingV1alpha2 retrieves the SchedulingV1alpha2Client -func (c *Clientset) SchedulingV1alpha2() schedulingv1alpha2.SchedulingV1alpha2Interface { - return c.schedulingV1alpha2 +// SchedulingV1alpha3 retrieves the SchedulingV1alpha3Client +func (c *Clientset) SchedulingV1alpha3() schedulingv1alpha3.SchedulingV1alpha3Interface { + return c.schedulingV1alpha3 } // SchedulingV1beta1 retrieves the SchedulingV1beta1Client @@ -455,13 +466,18 @@ func (c *Clientset) StorageV1alpha1() storagev1alpha1.StorageV1alpha1Interface { return c.storageV1alpha1 } +// StoragemigrationV1 retrieves the StoragemigrationV1Client +func (c *Clientset) StoragemigrationV1() storagemigrationv1.StoragemigrationV1Interface { + return c.storagemigrationV1 +} + // StoragemigrationV1beta1 retrieves the StoragemigrationV1beta1Client func (c *Clientset) StoragemigrationV1beta1() storagemigrationv1beta1.StoragemigrationV1beta1Interface { return c.storagemigrationV1beta1 } // Discovery retrieves the DiscoveryClient -func (c *Clientset) Discovery() discovery.DiscoveryInterface { +func (c *Clientset) Discovery() discovery.DiscoveryInterfaces { if c == nil { return nil } @@ -632,6 +648,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.lifecycleV1alpha1, err = lifecyclev1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.networkingV1, err = networkingv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -688,7 +708,7 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } - cs.schedulingV1alpha2, err = schedulingv1alpha2.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.schedulingV1alpha3, err = schedulingv1alpha3.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } @@ -712,6 +732,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.storagemigrationV1, err = storagemigrationv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.storagemigrationV1beta1, err = storagemigrationv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -769,6 +793,7 @@ func New(c rest.Interface) *Clientset { cs.flowcontrolV1beta1 = flowcontrolv1beta1.New(c) cs.flowcontrolV1beta2 = flowcontrolv1beta2.New(c) cs.flowcontrolV1beta3 = flowcontrolv1beta3.New(c) + cs.lifecycleV1alpha1 = lifecyclev1alpha1.New(c) cs.networkingV1 = networkingv1.New(c) cs.networkingV1beta1 = networkingv1beta1.New(c) cs.nodeV1 = nodev1.New(c) @@ -783,12 +808,13 @@ func New(c rest.Interface) *Clientset { cs.resourceV1beta2 = resourcev1beta2.New(c) cs.resourceV1beta1 = resourcev1beta1.New(c) cs.resourceV1alpha3 = resourcev1alpha3.New(c) - cs.schedulingV1alpha2 = schedulingv1alpha2.New(c) + cs.schedulingV1alpha3 = schedulingv1alpha3.New(c) cs.schedulingV1beta1 = schedulingv1beta1.New(c) cs.schedulingV1 = schedulingv1.New(c) cs.storageV1beta1 = storagev1beta1.New(c) cs.storageV1 = storagev1.New(c) cs.storageV1alpha1 = storagev1alpha1.New(c) + cs.storagemigrationV1 = storagemigrationv1.New(c) cs.storagemigrationV1beta1 = storagemigrationv1beta1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) diff --git a/vendor/k8s.io/client-go/kubernetes/fake/clientset_generated.go b/vendor/k8s.io/client-go/kubernetes/fake/clientset_generated.go index 618dd57511..db6c9e1dd1 100644 --- a/vendor/k8s.io/client-go/kubernetes/fake/clientset_generated.go +++ b/vendor/k8s.io/client-go/kubernetes/fake/clientset_generated.go @@ -90,6 +90,8 @@ import ( fakeflowcontrolv1beta2 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/fake" flowcontrolv1beta3 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3" fakeflowcontrolv1beta3 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3/fake" + lifecyclev1alpha1 "k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1" + fakelifecyclev1alpha1 "k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/fake" networkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1" fakenetworkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1/fake" networkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1" @@ -120,8 +122,8 @@ import ( fakeresourcev1beta2 "k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake" schedulingv1 "k8s.io/client-go/kubernetes/typed/scheduling/v1" fakeschedulingv1 "k8s.io/client-go/kubernetes/typed/scheduling/v1/fake" - schedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2" - fakeschedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake" + schedulingv1alpha3 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3" + fakeschedulingv1alpha3 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/fake" schedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1" fakeschedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake" storagev1 "k8s.io/client-go/kubernetes/typed/storage/v1" @@ -130,6 +132,8 @@ import ( fakestoragev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake" storagev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1" fakestoragev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake" + storagemigrationv1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1" + fakestoragemigrationv1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1/fake" storagemigrationv1beta1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1beta1" fakestoragemigrationv1beta1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1beta1/fake" "k8s.io/client-go/testing" @@ -176,7 +180,7 @@ type Clientset struct { tracker testing.ObjectTracker } -func (c *Clientset) Discovery() discovery.DiscoveryInterface { +func (c *Clientset) Discovery() discovery.DiscoveryInterfaces { return c.discovery } @@ -400,6 +404,11 @@ func (c *Clientset) FlowcontrolV1beta3() flowcontrolv1beta3.FlowcontrolV1beta3In return &fakeflowcontrolv1beta3.FakeFlowcontrolV1beta3{Fake: &c.Fake} } +// LifecycleV1alpha1 retrieves the LifecycleV1alpha1Client +func (c *Clientset) LifecycleV1alpha1() lifecyclev1alpha1.LifecycleV1alpha1Interface { + return &fakelifecyclev1alpha1.FakeLifecycleV1alpha1{Fake: &c.Fake} +} + // NetworkingV1 retrieves the NetworkingV1Client func (c *Clientset) NetworkingV1() networkingv1.NetworkingV1Interface { return &fakenetworkingv1.FakeNetworkingV1{Fake: &c.Fake} @@ -470,9 +479,9 @@ func (c *Clientset) ResourceV1alpha3() resourcev1alpha3.ResourceV1alpha3Interfac return &fakeresourcev1alpha3.FakeResourceV1alpha3{Fake: &c.Fake} } -// SchedulingV1alpha2 retrieves the SchedulingV1alpha2Client -func (c *Clientset) SchedulingV1alpha2() schedulingv1alpha2.SchedulingV1alpha2Interface { - return &fakeschedulingv1alpha2.FakeSchedulingV1alpha2{Fake: &c.Fake} +// SchedulingV1alpha3 retrieves the SchedulingV1alpha3Client +func (c *Clientset) SchedulingV1alpha3() schedulingv1alpha3.SchedulingV1alpha3Interface { + return &fakeschedulingv1alpha3.FakeSchedulingV1alpha3{Fake: &c.Fake} } // SchedulingV1beta1 retrieves the SchedulingV1beta1Client @@ -500,6 +509,11 @@ func (c *Clientset) StorageV1alpha1() storagev1alpha1.StorageV1alpha1Interface { return &fakestoragev1alpha1.FakeStorageV1alpha1{Fake: &c.Fake} } +// StoragemigrationV1 retrieves the StoragemigrationV1Client +func (c *Clientset) StoragemigrationV1() storagemigrationv1.StoragemigrationV1Interface { + return &fakestoragemigrationv1.FakeStoragemigrationV1{Fake: &c.Fake} +} + // StoragemigrationV1beta1 retrieves the StoragemigrationV1beta1Client func (c *Clientset) StoragemigrationV1beta1() storagemigrationv1beta1.StoragemigrationV1beta1Interface { return &fakestoragemigrationv1beta1.FakeStoragemigrationV1beta1{Fake: &c.Fake} diff --git a/vendor/k8s.io/client-go/kubernetes/fake/register.go b/vendor/k8s.io/client-go/kubernetes/fake/register.go index 3b5d98c6a8..ad580ed381 100644 --- a/vendor/k8s.io/client-go/kubernetes/fake/register.go +++ b/vendor/k8s.io/client-go/kubernetes/fake/register.go @@ -51,6 +51,7 @@ import ( flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" flowcontrolv1beta3 "k8s.io/api/flowcontrol/v1beta3" + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" networkingv1 "k8s.io/api/networking/v1" networkingv1beta1 "k8s.io/api/networking/v1beta1" nodev1 "k8s.io/api/node/v1" @@ -66,11 +67,12 @@ import ( resourcev1beta1 "k8s.io/api/resource/v1beta1" resourcev1beta2 "k8s.io/api/resource/v1beta2" schedulingv1 "k8s.io/api/scheduling/v1" - schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" storagev1 "k8s.io/api/storage/v1" storagev1alpha1 "k8s.io/api/storage/v1alpha1" storagev1beta1 "k8s.io/api/storage/v1beta1" + storagemigrationv1 "k8s.io/api/storagemigration/v1" storagemigrationv1beta1 "k8s.io/api/storagemigration/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -115,6 +117,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ flowcontrolv1beta1.AddToScheme, flowcontrolv1beta2.AddToScheme, flowcontrolv1beta3.AddToScheme, + lifecyclev1alpha1.AddToScheme, networkingv1.AddToScheme, networkingv1beta1.AddToScheme, nodev1.AddToScheme, @@ -129,12 +132,13 @@ var localSchemeBuilder = runtime.SchemeBuilder{ resourcev1beta2.AddToScheme, resourcev1beta1.AddToScheme, resourcev1alpha3.AddToScheme, - schedulingv1alpha2.AddToScheme, + schedulingv1alpha3.AddToScheme, schedulingv1beta1.AddToScheme, schedulingv1.AddToScheme, storagev1beta1.AddToScheme, storagev1.AddToScheme, storagev1alpha1.AddToScheme, + storagemigrationv1.AddToScheme, storagemigrationv1beta1.AddToScheme, } diff --git a/vendor/k8s.io/client-go/kubernetes/scheme/register.go b/vendor/k8s.io/client-go/kubernetes/scheme/register.go index c36fe7eda4..d2304c94ff 100644 --- a/vendor/k8s.io/client-go/kubernetes/scheme/register.go +++ b/vendor/k8s.io/client-go/kubernetes/scheme/register.go @@ -51,6 +51,7 @@ import ( flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" flowcontrolv1beta3 "k8s.io/api/flowcontrol/v1beta3" + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" networkingv1 "k8s.io/api/networking/v1" networkingv1beta1 "k8s.io/api/networking/v1beta1" nodev1 "k8s.io/api/node/v1" @@ -66,11 +67,12 @@ import ( resourcev1beta1 "k8s.io/api/resource/v1beta1" resourcev1beta2 "k8s.io/api/resource/v1beta2" schedulingv1 "k8s.io/api/scheduling/v1" - schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" storagev1 "k8s.io/api/storage/v1" storagev1alpha1 "k8s.io/api/storage/v1alpha1" storagev1beta1 "k8s.io/api/storage/v1beta1" + storagemigrationv1 "k8s.io/api/storagemigration/v1" storagemigrationv1beta1 "k8s.io/api/storagemigration/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -115,6 +117,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ flowcontrolv1beta1.AddToScheme, flowcontrolv1beta2.AddToScheme, flowcontrolv1beta3.AddToScheme, + lifecyclev1alpha1.AddToScheme, networkingv1.AddToScheme, networkingv1beta1.AddToScheme, nodev1.AddToScheme, @@ -129,12 +132,13 @@ var localSchemeBuilder = runtime.SchemeBuilder{ resourcev1beta2.AddToScheme, resourcev1beta1.AddToScheme, resourcev1alpha3.AddToScheme, - schedulingv1alpha2.AddToScheme, + schedulingv1alpha3.AddToScheme, schedulingv1beta1.AddToScheme, schedulingv1.AddToScheme, storagev1beta1.AddToScheme, storagev1.AddToScheme, storagev1alpha1.AddToScheme, + storagemigrationv1.AddToScheme, storagemigrationv1beta1.AddToScheme, } diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/certificates_client.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/certificates_client.go index a13c3559db..ed84f79e8f 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/certificates_client.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/certificates_client.go @@ -29,6 +29,8 @@ import ( type CertificatesV1Interface interface { RESTClient() rest.Interface CertificateSigningRequestsGetter + ClusterTrustBundlesGetter + PodCertificateRequestsGetter } // CertificatesV1Client is used to interact with features provided by the certificates.k8s.io group. @@ -40,6 +42,14 @@ func (c *CertificatesV1Client) CertificateSigningRequests() CertificateSigningRe return newCertificateSigningRequests(c) } +func (c *CertificatesV1Client) ClusterTrustBundles() ClusterTrustBundleInterface { + return newClusterTrustBundles(c) +} + +func (c *CertificatesV1Client) PodCertificateRequests(namespace string) PodCertificateRequestInterface { + return newPodCertificateRequests(c, namespace) +} + // NewForConfig creates a new CertificatesV1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/clustertrustbundle.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/clustertrustbundle.go new file mode 100644 index 0000000000..23a5c80bac --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/clustertrustbundle.go @@ -0,0 +1,71 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + + certificatesv1 "k8s.io/api/certificates/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + applyconfigurationscertificatesv1 "k8s.io/client-go/applyconfigurations/certificates/v1" + gentype "k8s.io/client-go/gentype" + scheme "k8s.io/client-go/kubernetes/scheme" +) + +// ClusterTrustBundlesGetter has a method to return a ClusterTrustBundleInterface. +// A group's client should implement this interface. +type ClusterTrustBundlesGetter interface { + ClusterTrustBundles() ClusterTrustBundleInterface +} + +// ClusterTrustBundleInterface has methods to work with ClusterTrustBundle resources. +type ClusterTrustBundleInterface interface { + Create(ctx context.Context, clusterTrustBundle *certificatesv1.ClusterTrustBundle, opts metav1.CreateOptions) (*certificatesv1.ClusterTrustBundle, error) + Update(ctx context.Context, clusterTrustBundle *certificatesv1.ClusterTrustBundle, opts metav1.UpdateOptions) (*certificatesv1.ClusterTrustBundle, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*certificatesv1.ClusterTrustBundle, error) + List(ctx context.Context, opts metav1.ListOptions) (*certificatesv1.ClusterTrustBundleList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *certificatesv1.ClusterTrustBundle, err error) + Apply(ctx context.Context, clusterTrustBundle *applyconfigurationscertificatesv1.ClusterTrustBundleApplyConfiguration, opts metav1.ApplyOptions) (result *certificatesv1.ClusterTrustBundle, err error) + ClusterTrustBundleExpansion +} + +// clusterTrustBundles implements ClusterTrustBundleInterface +type clusterTrustBundles struct { + *gentype.ClientWithListAndApply[*certificatesv1.ClusterTrustBundle, *certificatesv1.ClusterTrustBundleList, *applyconfigurationscertificatesv1.ClusterTrustBundleApplyConfiguration] +} + +// newClusterTrustBundles returns a ClusterTrustBundles +func newClusterTrustBundles(c *CertificatesV1Client) *clusterTrustBundles { + return &clusterTrustBundles{ + gentype.NewClientWithListAndApply[*certificatesv1.ClusterTrustBundle, *certificatesv1.ClusterTrustBundleList, *applyconfigurationscertificatesv1.ClusterTrustBundleApplyConfiguration]( + "clustertrustbundles", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *certificatesv1.ClusterTrustBundle { return &certificatesv1.ClusterTrustBundle{} }, + func() *certificatesv1.ClusterTrustBundleList { return &certificatesv1.ClusterTrustBundleList{} }, + gentype.PrefersProtobuf[*certificatesv1.ClusterTrustBundle](), + ), + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/fake_certificates_client.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/fake_certificates_client.go index 782ebd95ee..a935016f95 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/fake_certificates_client.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/fake_certificates_client.go @@ -32,6 +32,14 @@ func (c *FakeCertificatesV1) CertificateSigningRequests() v1.CertificateSigningR return newFakeCertificateSigningRequests(c) } +func (c *FakeCertificatesV1) ClusterTrustBundles() v1.ClusterTrustBundleInterface { + return newFakeClusterTrustBundles(c) +} + +func (c *FakeCertificatesV1) PodCertificateRequests(namespace string) v1.PodCertificateRequestInterface { + return newFakePodCertificateRequests(c, namespace) +} + // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeCertificatesV1) RESTClient() rest.Interface { diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/fake_clustertrustbundle.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/fake_clustertrustbundle.go new file mode 100644 index 0000000000..7cf2667b9f --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/fake_clustertrustbundle.go @@ -0,0 +1,53 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/api/certificates/v1" + certificatesv1 "k8s.io/client-go/applyconfigurations/certificates/v1" + gentype "k8s.io/client-go/gentype" + typedcertificatesv1 "k8s.io/client-go/kubernetes/typed/certificates/v1" +) + +// fakeClusterTrustBundles implements ClusterTrustBundleInterface +type fakeClusterTrustBundles struct { + *gentype.FakeClientWithListAndApply[*v1.ClusterTrustBundle, *v1.ClusterTrustBundleList, *certificatesv1.ClusterTrustBundleApplyConfiguration] + Fake *FakeCertificatesV1 +} + +func newFakeClusterTrustBundles(fake *FakeCertificatesV1) typedcertificatesv1.ClusterTrustBundleInterface { + return &fakeClusterTrustBundles{ + gentype.NewFakeClientWithListAndApply[*v1.ClusterTrustBundle, *v1.ClusterTrustBundleList, *certificatesv1.ClusterTrustBundleApplyConfiguration]( + fake.Fake, + "", + v1.SchemeGroupVersion.WithResource("clustertrustbundles"), + v1.SchemeGroupVersion.WithKind("ClusterTrustBundle"), + func() *v1.ClusterTrustBundle { return &v1.ClusterTrustBundle{} }, + func() *v1.ClusterTrustBundleList { return &v1.ClusterTrustBundleList{} }, + func(dst, src *v1.ClusterTrustBundleList) { dst.ListMeta = src.ListMeta }, + func(list *v1.ClusterTrustBundleList) []*v1.ClusterTrustBundle { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1.ClusterTrustBundleList, items []*v1.ClusterTrustBundle) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/fake_podcertificaterequest.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/fake_podcertificaterequest.go new file mode 100644 index 0000000000..2b05be5374 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/fake_podcertificaterequest.go @@ -0,0 +1,53 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/api/certificates/v1" + certificatesv1 "k8s.io/client-go/applyconfigurations/certificates/v1" + gentype "k8s.io/client-go/gentype" + typedcertificatesv1 "k8s.io/client-go/kubernetes/typed/certificates/v1" +) + +// fakePodCertificateRequests implements PodCertificateRequestInterface +type fakePodCertificateRequests struct { + *gentype.FakeClientWithListAndApply[*v1.PodCertificateRequest, *v1.PodCertificateRequestList, *certificatesv1.PodCertificateRequestApplyConfiguration] + Fake *FakeCertificatesV1 +} + +func newFakePodCertificateRequests(fake *FakeCertificatesV1, namespace string) typedcertificatesv1.PodCertificateRequestInterface { + return &fakePodCertificateRequests{ + gentype.NewFakeClientWithListAndApply[*v1.PodCertificateRequest, *v1.PodCertificateRequestList, *certificatesv1.PodCertificateRequestApplyConfiguration]( + fake.Fake, + namespace, + v1.SchemeGroupVersion.WithResource("podcertificaterequests"), + v1.SchemeGroupVersion.WithKind("PodCertificateRequest"), + func() *v1.PodCertificateRequest { return &v1.PodCertificateRequest{} }, + func() *v1.PodCertificateRequestList { return &v1.PodCertificateRequestList{} }, + func(dst, src *v1.PodCertificateRequestList) { dst.ListMeta = src.ListMeta }, + func(list *v1.PodCertificateRequestList) []*v1.PodCertificateRequest { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1.PodCertificateRequestList, items []*v1.PodCertificateRequest) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/generated_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/generated_expansion.go index 95fad02126..9024405353 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/generated_expansion.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/generated_expansion.go @@ -19,3 +19,7 @@ limitations under the License. package v1 type CertificateSigningRequestExpansion interface{} + +type ClusterTrustBundleExpansion interface{} + +type PodCertificateRequestExpansion interface{} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/podcertificaterequest.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/podcertificaterequest.go new file mode 100644 index 0000000000..128d1e5ff2 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/podcertificaterequest.go @@ -0,0 +1,75 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + + certificatesv1 "k8s.io/api/certificates/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + applyconfigurationscertificatesv1 "k8s.io/client-go/applyconfigurations/certificates/v1" + gentype "k8s.io/client-go/gentype" + scheme "k8s.io/client-go/kubernetes/scheme" +) + +// PodCertificateRequestsGetter has a method to return a PodCertificateRequestInterface. +// A group's client should implement this interface. +type PodCertificateRequestsGetter interface { + PodCertificateRequests(namespace string) PodCertificateRequestInterface +} + +// PodCertificateRequestInterface has methods to work with PodCertificateRequest resources. +type PodCertificateRequestInterface interface { + Create(ctx context.Context, podCertificateRequest *certificatesv1.PodCertificateRequest, opts metav1.CreateOptions) (*certificatesv1.PodCertificateRequest, error) + Update(ctx context.Context, podCertificateRequest *certificatesv1.PodCertificateRequest, opts metav1.UpdateOptions) (*certificatesv1.PodCertificateRequest, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, podCertificateRequest *certificatesv1.PodCertificateRequest, opts metav1.UpdateOptions) (*certificatesv1.PodCertificateRequest, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*certificatesv1.PodCertificateRequest, error) + List(ctx context.Context, opts metav1.ListOptions) (*certificatesv1.PodCertificateRequestList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *certificatesv1.PodCertificateRequest, err error) + Apply(ctx context.Context, podCertificateRequest *applyconfigurationscertificatesv1.PodCertificateRequestApplyConfiguration, opts metav1.ApplyOptions) (result *certificatesv1.PodCertificateRequest, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, podCertificateRequest *applyconfigurationscertificatesv1.PodCertificateRequestApplyConfiguration, opts metav1.ApplyOptions) (result *certificatesv1.PodCertificateRequest, err error) + PodCertificateRequestExpansion +} + +// podCertificateRequests implements PodCertificateRequestInterface +type podCertificateRequests struct { + *gentype.ClientWithListAndApply[*certificatesv1.PodCertificateRequest, *certificatesv1.PodCertificateRequestList, *applyconfigurationscertificatesv1.PodCertificateRequestApplyConfiguration] +} + +// newPodCertificateRequests returns a PodCertificateRequests +func newPodCertificateRequests(c *CertificatesV1Client, namespace string) *podCertificateRequests { + return &podCertificateRequests{ + gentype.NewClientWithListAndApply[*certificatesv1.PodCertificateRequest, *certificatesv1.PodCertificateRequestList, *applyconfigurationscertificatesv1.PodCertificateRequestApplyConfiguration]( + "podcertificaterequests", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *certificatesv1.PodCertificateRequest { return &certificatesv1.PodCertificateRequest{} }, + func() *certificatesv1.PodCertificateRequestList { return &certificatesv1.PodCertificateRequestList{} }, + gentype.PrefersProtobuf[*certificatesv1.PodCertificateRequest](), + ), + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/doc.go similarity index 97% rename from vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/doc.go rename to vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/doc.go index baaf2d9853..df51baa4d4 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/doc.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/doc.go @@ -17,4 +17,4 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. -package v1alpha2 +package v1alpha1 diff --git a/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/eviction.go b/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/eviction.go new file mode 100644 index 0000000000..10a359c29b --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/eviction.go @@ -0,0 +1,75 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + applyconfigurationslifecyclev1alpha1 "k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1" + gentype "k8s.io/client-go/gentype" + scheme "k8s.io/client-go/kubernetes/scheme" +) + +// EvictionsGetter has a method to return a EvictionInterface. +// A group's client should implement this interface. +type EvictionsGetter interface { + Evictions(namespace string) EvictionInterface +} + +// EvictionInterface has methods to work with Eviction resources. +type EvictionInterface interface { + Create(ctx context.Context, eviction *lifecyclev1alpha1.Eviction, opts v1.CreateOptions) (*lifecyclev1alpha1.Eviction, error) + Update(ctx context.Context, eviction *lifecyclev1alpha1.Eviction, opts v1.UpdateOptions) (*lifecyclev1alpha1.Eviction, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, eviction *lifecyclev1alpha1.Eviction, opts v1.UpdateOptions) (*lifecyclev1alpha1.Eviction, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*lifecyclev1alpha1.Eviction, error) + List(ctx context.Context, opts v1.ListOptions) (*lifecyclev1alpha1.EvictionList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *lifecyclev1alpha1.Eviction, err error) + Apply(ctx context.Context, eviction *applyconfigurationslifecyclev1alpha1.EvictionApplyConfiguration, opts v1.ApplyOptions) (result *lifecyclev1alpha1.Eviction, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, eviction *applyconfigurationslifecyclev1alpha1.EvictionApplyConfiguration, opts v1.ApplyOptions) (result *lifecyclev1alpha1.Eviction, err error) + EvictionExpansion +} + +// evictions implements EvictionInterface +type evictions struct { + *gentype.ClientWithListAndApply[*lifecyclev1alpha1.Eviction, *lifecyclev1alpha1.EvictionList, *applyconfigurationslifecyclev1alpha1.EvictionApplyConfiguration] +} + +// newEvictions returns a Evictions +func newEvictions(c *LifecycleV1alpha1Client, namespace string) *evictions { + return &evictions{ + gentype.NewClientWithListAndApply[*lifecyclev1alpha1.Eviction, *lifecyclev1alpha1.EvictionList, *applyconfigurationslifecyclev1alpha1.EvictionApplyConfiguration]( + "evictions", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *lifecyclev1alpha1.Eviction { return &lifecyclev1alpha1.Eviction{} }, + func() *lifecyclev1alpha1.EvictionList { return &lifecyclev1alpha1.EvictionList{} }, + gentype.PrefersProtobuf[*lifecyclev1alpha1.Eviction](), + ), + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/evictionrequest.go b/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/evictionrequest.go new file mode 100644 index 0000000000..4a21127bb4 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/evictionrequest.go @@ -0,0 +1,75 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + applyconfigurationslifecyclev1alpha1 "k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1" + gentype "k8s.io/client-go/gentype" + scheme "k8s.io/client-go/kubernetes/scheme" +) + +// EvictionRequestsGetter has a method to return a EvictionRequestInterface. +// A group's client should implement this interface. +type EvictionRequestsGetter interface { + EvictionRequests(namespace string) EvictionRequestInterface +} + +// EvictionRequestInterface has methods to work with EvictionRequest resources. +type EvictionRequestInterface interface { + Create(ctx context.Context, evictionRequest *lifecyclev1alpha1.EvictionRequest, opts v1.CreateOptions) (*lifecyclev1alpha1.EvictionRequest, error) + Update(ctx context.Context, evictionRequest *lifecyclev1alpha1.EvictionRequest, opts v1.UpdateOptions) (*lifecyclev1alpha1.EvictionRequest, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, evictionRequest *lifecyclev1alpha1.EvictionRequest, opts v1.UpdateOptions) (*lifecyclev1alpha1.EvictionRequest, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*lifecyclev1alpha1.EvictionRequest, error) + List(ctx context.Context, opts v1.ListOptions) (*lifecyclev1alpha1.EvictionRequestList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *lifecyclev1alpha1.EvictionRequest, err error) + Apply(ctx context.Context, evictionRequest *applyconfigurationslifecyclev1alpha1.EvictionRequestApplyConfiguration, opts v1.ApplyOptions) (result *lifecyclev1alpha1.EvictionRequest, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, evictionRequest *applyconfigurationslifecyclev1alpha1.EvictionRequestApplyConfiguration, opts v1.ApplyOptions) (result *lifecyclev1alpha1.EvictionRequest, err error) + EvictionRequestExpansion +} + +// evictionRequests implements EvictionRequestInterface +type evictionRequests struct { + *gentype.ClientWithListAndApply[*lifecyclev1alpha1.EvictionRequest, *lifecyclev1alpha1.EvictionRequestList, *applyconfigurationslifecyclev1alpha1.EvictionRequestApplyConfiguration] +} + +// newEvictionRequests returns a EvictionRequests +func newEvictionRequests(c *LifecycleV1alpha1Client, namespace string) *evictionRequests { + return &evictionRequests{ + gentype.NewClientWithListAndApply[*lifecyclev1alpha1.EvictionRequest, *lifecyclev1alpha1.EvictionRequestList, *applyconfigurationslifecyclev1alpha1.EvictionRequestApplyConfiguration]( + "evictionrequests", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *lifecyclev1alpha1.EvictionRequest { return &lifecyclev1alpha1.EvictionRequest{} }, + func() *lifecyclev1alpha1.EvictionRequestList { return &lifecyclev1alpha1.EvictionRequestList{} }, + gentype.PrefersProtobuf[*lifecyclev1alpha1.EvictionRequest](), + ), + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/doc.go similarity index 100% rename from vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/doc.go rename to vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/doc.go diff --git a/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/fake_eviction.go b/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/fake_eviction.go new file mode 100644 index 0000000000..1c23bee191 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/fake_eviction.go @@ -0,0 +1,51 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "k8s.io/api/lifecycle/v1alpha1" + lifecyclev1alpha1 "k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1" + gentype "k8s.io/client-go/gentype" + typedlifecyclev1alpha1 "k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1" +) + +// fakeEvictions implements EvictionInterface +type fakeEvictions struct { + *gentype.FakeClientWithListAndApply[*v1alpha1.Eviction, *v1alpha1.EvictionList, *lifecyclev1alpha1.EvictionApplyConfiguration] + Fake *FakeLifecycleV1alpha1 +} + +func newFakeEvictions(fake *FakeLifecycleV1alpha1, namespace string) typedlifecyclev1alpha1.EvictionInterface { + return &fakeEvictions{ + gentype.NewFakeClientWithListAndApply[*v1alpha1.Eviction, *v1alpha1.EvictionList, *lifecyclev1alpha1.EvictionApplyConfiguration]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("evictions"), + v1alpha1.SchemeGroupVersion.WithKind("Eviction"), + func() *v1alpha1.Eviction { return &v1alpha1.Eviction{} }, + func() *v1alpha1.EvictionList { return &v1alpha1.EvictionList{} }, + func(dst, src *v1alpha1.EvictionList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.EvictionList) []*v1alpha1.Eviction { return gentype.ToPointerSlice(list.Items) }, + func(list *v1alpha1.EvictionList, items []*v1alpha1.Eviction) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/fake_evictionrequest.go b/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/fake_evictionrequest.go new file mode 100644 index 0000000000..9fe2633df5 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/fake_evictionrequest.go @@ -0,0 +1,53 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "k8s.io/api/lifecycle/v1alpha1" + lifecyclev1alpha1 "k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1" + gentype "k8s.io/client-go/gentype" + typedlifecyclev1alpha1 "k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1" +) + +// fakeEvictionRequests implements EvictionRequestInterface +type fakeEvictionRequests struct { + *gentype.FakeClientWithListAndApply[*v1alpha1.EvictionRequest, *v1alpha1.EvictionRequestList, *lifecyclev1alpha1.EvictionRequestApplyConfiguration] + Fake *FakeLifecycleV1alpha1 +} + +func newFakeEvictionRequests(fake *FakeLifecycleV1alpha1, namespace string) typedlifecyclev1alpha1.EvictionRequestInterface { + return &fakeEvictionRequests{ + gentype.NewFakeClientWithListAndApply[*v1alpha1.EvictionRequest, *v1alpha1.EvictionRequestList, *lifecyclev1alpha1.EvictionRequestApplyConfiguration]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("evictionrequests"), + v1alpha1.SchemeGroupVersion.WithKind("EvictionRequest"), + func() *v1alpha1.EvictionRequest { return &v1alpha1.EvictionRequest{} }, + func() *v1alpha1.EvictionRequestList { return &v1alpha1.EvictionRequestList{} }, + func(dst, src *v1alpha1.EvictionRequestList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.EvictionRequestList) []*v1alpha1.EvictionRequest { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.EvictionRequestList, items []*v1alpha1.EvictionRequest) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/fake_lifecycle_client.go b/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/fake_lifecycle_client.go new file mode 100644 index 0000000000..2b69ec4701 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/fake_lifecycle_client.go @@ -0,0 +1,44 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeLifecycleV1alpha1 struct { + *testing.Fake +} + +func (c *FakeLifecycleV1alpha1) Evictions(namespace string) v1alpha1.EvictionInterface { + return newFakeEvictions(c, namespace) +} + +func (c *FakeLifecycleV1alpha1) EvictionRequests(namespace string) v1alpha1.EvictionRequestInterface { + return newFakeEvictionRequests(c, namespace) +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeLifecycleV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/generated_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/generated_expansion.go new file mode 100644 index 0000000000..4be788fdf2 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/generated_expansion.go @@ -0,0 +1,23 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +type EvictionExpansion interface{} + +type EvictionRequestExpansion interface{} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/lifecycle_client.go b/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/lifecycle_client.go new file mode 100644 index 0000000000..02c050b829 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1/lifecycle_client.go @@ -0,0 +1,106 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + http "net/http" + + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" + scheme "k8s.io/client-go/kubernetes/scheme" + rest "k8s.io/client-go/rest" +) + +type LifecycleV1alpha1Interface interface { + RESTClient() rest.Interface + EvictionsGetter + EvictionRequestsGetter +} + +// LifecycleV1alpha1Client is used to interact with features provided by the lifecycle.k8s.io group. +type LifecycleV1alpha1Client struct { + restClient rest.Interface +} + +func (c *LifecycleV1alpha1Client) Evictions(namespace string) EvictionInterface { + return newEvictions(c, namespace) +} + +func (c *LifecycleV1alpha1Client) EvictionRequests(namespace string) EvictionRequestInterface { + return newEvictionRequests(c, namespace) +} + +// NewForConfig creates a new LifecycleV1alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*LifecycleV1alpha1Client, error) { + config := *c + setConfigDefaults(&config) + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new LifecycleV1alpha1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*LifecycleV1alpha1Client, error) { + config := *c + setConfigDefaults(&config) + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &LifecycleV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new LifecycleV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *LifecycleV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new LifecycleV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *LifecycleV1alpha1Client { + return &LifecycleV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) { + gv := lifecyclev1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *LifecycleV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/devicetaintrule.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/devicetaintrule.go new file mode 100644 index 0000000000..43074f75a7 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/devicetaintrule.go @@ -0,0 +1,75 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + + resourcev1 "k8s.io/api/resource/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + applyconfigurationsresourcev1 "k8s.io/client-go/applyconfigurations/resource/v1" + gentype "k8s.io/client-go/gentype" + scheme "k8s.io/client-go/kubernetes/scheme" +) + +// DeviceTaintRulesGetter has a method to return a DeviceTaintRuleInterface. +// A group's client should implement this interface. +type DeviceTaintRulesGetter interface { + DeviceTaintRules() DeviceTaintRuleInterface +} + +// DeviceTaintRuleInterface has methods to work with DeviceTaintRule resources. +type DeviceTaintRuleInterface interface { + Create(ctx context.Context, deviceTaintRule *resourcev1.DeviceTaintRule, opts metav1.CreateOptions) (*resourcev1.DeviceTaintRule, error) + Update(ctx context.Context, deviceTaintRule *resourcev1.DeviceTaintRule, opts metav1.UpdateOptions) (*resourcev1.DeviceTaintRule, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, deviceTaintRule *resourcev1.DeviceTaintRule, opts metav1.UpdateOptions) (*resourcev1.DeviceTaintRule, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*resourcev1.DeviceTaintRule, error) + List(ctx context.Context, opts metav1.ListOptions) (*resourcev1.DeviceTaintRuleList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *resourcev1.DeviceTaintRule, err error) + Apply(ctx context.Context, deviceTaintRule *applyconfigurationsresourcev1.DeviceTaintRuleApplyConfiguration, opts metav1.ApplyOptions) (result *resourcev1.DeviceTaintRule, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, deviceTaintRule *applyconfigurationsresourcev1.DeviceTaintRuleApplyConfiguration, opts metav1.ApplyOptions) (result *resourcev1.DeviceTaintRule, err error) + DeviceTaintRuleExpansion +} + +// deviceTaintRules implements DeviceTaintRuleInterface +type deviceTaintRules struct { + *gentype.ClientWithListAndApply[*resourcev1.DeviceTaintRule, *resourcev1.DeviceTaintRuleList, *applyconfigurationsresourcev1.DeviceTaintRuleApplyConfiguration] +} + +// newDeviceTaintRules returns a DeviceTaintRules +func newDeviceTaintRules(c *ResourceV1Client) *deviceTaintRules { + return &deviceTaintRules{ + gentype.NewClientWithListAndApply[*resourcev1.DeviceTaintRule, *resourcev1.DeviceTaintRuleList, *applyconfigurationsresourcev1.DeviceTaintRuleApplyConfiguration]( + "devicetaintrules", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *resourcev1.DeviceTaintRule { return &resourcev1.DeviceTaintRule{} }, + func() *resourcev1.DeviceTaintRuleList { return &resourcev1.DeviceTaintRuleList{} }, + gentype.PrefersProtobuf[*resourcev1.DeviceTaintRule](), + ), + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_devicetaintrule.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_devicetaintrule.go new file mode 100644 index 0000000000..da7782d7dd --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_devicetaintrule.go @@ -0,0 +1,51 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/api/resource/v1" + resourcev1 "k8s.io/client-go/applyconfigurations/resource/v1" + gentype "k8s.io/client-go/gentype" + typedresourcev1 "k8s.io/client-go/kubernetes/typed/resource/v1" +) + +// fakeDeviceTaintRules implements DeviceTaintRuleInterface +type fakeDeviceTaintRules struct { + *gentype.FakeClientWithListAndApply[*v1.DeviceTaintRule, *v1.DeviceTaintRuleList, *resourcev1.DeviceTaintRuleApplyConfiguration] + Fake *FakeResourceV1 +} + +func newFakeDeviceTaintRules(fake *FakeResourceV1) typedresourcev1.DeviceTaintRuleInterface { + return &fakeDeviceTaintRules{ + gentype.NewFakeClientWithListAndApply[*v1.DeviceTaintRule, *v1.DeviceTaintRuleList, *resourcev1.DeviceTaintRuleApplyConfiguration]( + fake.Fake, + "", + v1.SchemeGroupVersion.WithResource("devicetaintrules"), + v1.SchemeGroupVersion.WithKind("DeviceTaintRule"), + func() *v1.DeviceTaintRule { return &v1.DeviceTaintRule{} }, + func() *v1.DeviceTaintRuleList { return &v1.DeviceTaintRuleList{} }, + func(dst, src *v1.DeviceTaintRuleList) { dst.ListMeta = src.ListMeta }, + func(list *v1.DeviceTaintRuleList) []*v1.DeviceTaintRule { return gentype.ToPointerSlice(list.Items) }, + func(list *v1.DeviceTaintRuleList, items []*v1.DeviceTaintRule) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_resource_client.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_resource_client.go index 53a2954294..5e669b4e6d 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_resource_client.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_resource_client.go @@ -32,6 +32,10 @@ func (c *FakeResourceV1) DeviceClasses() v1.DeviceClassInterface { return newFakeDeviceClasses(c) } +func (c *FakeResourceV1) DeviceTaintRules() v1.DeviceTaintRuleInterface { + return newFakeDeviceTaintRules(c) +} + func (c *FakeResourceV1) ResourceClaims(namespace string) v1.ResourceClaimInterface { return newFakeResourceClaims(c, namespace) } diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/generated_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/generated_expansion.go index ea30968587..6cd11a8051 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/generated_expansion.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/generated_expansion.go @@ -20,6 +20,8 @@ package v1 type DeviceClassExpansion interface{} +type DeviceTaintRuleExpansion interface{} + type ResourceClaimExpansion interface{} type ResourceClaimTemplateExpansion interface{} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/resource_client.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/resource_client.go index e610012dde..0267cb68a8 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/resource_client.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/resource_client.go @@ -29,6 +29,7 @@ import ( type ResourceV1Interface interface { RESTClient() rest.Interface DeviceClassesGetter + DeviceTaintRulesGetter ResourceClaimsGetter ResourceClaimTemplatesGetter ResourceSlicesGetter @@ -43,6 +44,10 @@ func (c *ResourceV1Client) DeviceClasses() DeviceClassInterface { return newDeviceClasses(c) } +func (c *ResourceV1Client) DeviceTaintRules() DeviceTaintRuleInterface { + return newDeviceTaintRules(c) +} + func (c *ResourceV1Client) ResourceClaims(namespace string) ResourceClaimInterface { return newResourceClaims(c, namespace) } diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_podgroup.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_podgroup.go deleted file mode 100644 index 3709cf5214..0000000000 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_podgroup.go +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1alpha2 "k8s.io/api/scheduling/v1alpha2" - schedulingv1alpha2 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha2" - gentype "k8s.io/client-go/gentype" - typedschedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2" -) - -// fakePodGroups implements PodGroupInterface -type fakePodGroups struct { - *gentype.FakeClientWithListAndApply[*v1alpha2.PodGroup, *v1alpha2.PodGroupList, *schedulingv1alpha2.PodGroupApplyConfiguration] - Fake *FakeSchedulingV1alpha2 -} - -func newFakePodGroups(fake *FakeSchedulingV1alpha2, namespace string) typedschedulingv1alpha2.PodGroupInterface { - return &fakePodGroups{ - gentype.NewFakeClientWithListAndApply[*v1alpha2.PodGroup, *v1alpha2.PodGroupList, *schedulingv1alpha2.PodGroupApplyConfiguration]( - fake.Fake, - namespace, - v1alpha2.SchemeGroupVersion.WithResource("podgroups"), - v1alpha2.SchemeGroupVersion.WithKind("PodGroup"), - func() *v1alpha2.PodGroup { return &v1alpha2.PodGroup{} }, - func() *v1alpha2.PodGroupList { return &v1alpha2.PodGroupList{} }, - func(dst, src *v1alpha2.PodGroupList) { dst.ListMeta = src.ListMeta }, - func(list *v1alpha2.PodGroupList) []*v1alpha2.PodGroup { return gentype.ToPointerSlice(list.Items) }, - func(list *v1alpha2.PodGroupList, items []*v1alpha2.PodGroup) { - list.Items = gentype.FromPointerSlice(items) - }, - ), - fake, - } -} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_workload.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_workload.go deleted file mode 100644 index 29768874cf..0000000000 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_workload.go +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1alpha2 "k8s.io/api/scheduling/v1alpha2" - schedulingv1alpha2 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha2" - gentype "k8s.io/client-go/gentype" - typedschedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2" -) - -// fakeWorkloads implements WorkloadInterface -type fakeWorkloads struct { - *gentype.FakeClientWithListAndApply[*v1alpha2.Workload, *v1alpha2.WorkloadList, *schedulingv1alpha2.WorkloadApplyConfiguration] - Fake *FakeSchedulingV1alpha2 -} - -func newFakeWorkloads(fake *FakeSchedulingV1alpha2, namespace string) typedschedulingv1alpha2.WorkloadInterface { - return &fakeWorkloads{ - gentype.NewFakeClientWithListAndApply[*v1alpha2.Workload, *v1alpha2.WorkloadList, *schedulingv1alpha2.WorkloadApplyConfiguration]( - fake.Fake, - namespace, - v1alpha2.SchemeGroupVersion.WithResource("workloads"), - v1alpha2.SchemeGroupVersion.WithKind("Workload"), - func() *v1alpha2.Workload { return &v1alpha2.Workload{} }, - func() *v1alpha2.WorkloadList { return &v1alpha2.WorkloadList{} }, - func(dst, src *v1alpha2.WorkloadList) { dst.ListMeta = src.ListMeta }, - func(list *v1alpha2.WorkloadList) []*v1alpha2.Workload { return gentype.ToPointerSlice(list.Items) }, - func(list *v1alpha2.WorkloadList, items []*v1alpha2.Workload) { - list.Items = gentype.FromPointerSlice(items) - }, - ), - fake, - } -} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/compositepodgroup.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/compositepodgroup.go new file mode 100644 index 0000000000..a301cbd35e --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/compositepodgroup.go @@ -0,0 +1,75 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + context "context" + + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + applyconfigurationsschedulingv1alpha3 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha3" + gentype "k8s.io/client-go/gentype" + scheme "k8s.io/client-go/kubernetes/scheme" +) + +// CompositePodGroupsGetter has a method to return a CompositePodGroupInterface. +// A group's client should implement this interface. +type CompositePodGroupsGetter interface { + CompositePodGroups(namespace string) CompositePodGroupInterface +} + +// CompositePodGroupInterface has methods to work with CompositePodGroup resources. +type CompositePodGroupInterface interface { + Create(ctx context.Context, compositePodGroup *schedulingv1alpha3.CompositePodGroup, opts v1.CreateOptions) (*schedulingv1alpha3.CompositePodGroup, error) + Update(ctx context.Context, compositePodGroup *schedulingv1alpha3.CompositePodGroup, opts v1.UpdateOptions) (*schedulingv1alpha3.CompositePodGroup, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, compositePodGroup *schedulingv1alpha3.CompositePodGroup, opts v1.UpdateOptions) (*schedulingv1alpha3.CompositePodGroup, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*schedulingv1alpha3.CompositePodGroup, error) + List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha3.CompositePodGroupList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *schedulingv1alpha3.CompositePodGroup, err error) + Apply(ctx context.Context, compositePodGroup *applyconfigurationsschedulingv1alpha3.CompositePodGroupApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1alpha3.CompositePodGroup, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, compositePodGroup *applyconfigurationsschedulingv1alpha3.CompositePodGroupApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1alpha3.CompositePodGroup, err error) + CompositePodGroupExpansion +} + +// compositePodGroups implements CompositePodGroupInterface +type compositePodGroups struct { + *gentype.ClientWithListAndApply[*schedulingv1alpha3.CompositePodGroup, *schedulingv1alpha3.CompositePodGroupList, *applyconfigurationsschedulingv1alpha3.CompositePodGroupApplyConfiguration] +} + +// newCompositePodGroups returns a CompositePodGroups +func newCompositePodGroups(c *SchedulingV1alpha3Client, namespace string) *compositePodGroups { + return &compositePodGroups{ + gentype.NewClientWithListAndApply[*schedulingv1alpha3.CompositePodGroup, *schedulingv1alpha3.CompositePodGroupList, *applyconfigurationsschedulingv1alpha3.CompositePodGroupApplyConfiguration]( + "compositepodgroups", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *schedulingv1alpha3.CompositePodGroup { return &schedulingv1alpha3.CompositePodGroup{} }, + func() *schedulingv1alpha3.CompositePodGroupList { return &schedulingv1alpha3.CompositePodGroupList{} }, + gentype.PrefersProtobuf[*schedulingv1alpha3.CompositePodGroup](), + ), + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/doc.go new file mode 100644 index 0000000000..fdb23fd37c --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha3 diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/fake/doc.go new file mode 100644 index 0000000000..16f4439906 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/fake/fake_compositepodgroup.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/fake/fake_compositepodgroup.go new file mode 100644 index 0000000000..658c5fe539 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/fake/fake_compositepodgroup.go @@ -0,0 +1,53 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha3 "k8s.io/api/scheduling/v1alpha3" + schedulingv1alpha3 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha3" + gentype "k8s.io/client-go/gentype" + typedschedulingv1alpha3 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3" +) + +// fakeCompositePodGroups implements CompositePodGroupInterface +type fakeCompositePodGroups struct { + *gentype.FakeClientWithListAndApply[*v1alpha3.CompositePodGroup, *v1alpha3.CompositePodGroupList, *schedulingv1alpha3.CompositePodGroupApplyConfiguration] + Fake *FakeSchedulingV1alpha3 +} + +func newFakeCompositePodGroups(fake *FakeSchedulingV1alpha3, namespace string) typedschedulingv1alpha3.CompositePodGroupInterface { + return &fakeCompositePodGroups{ + gentype.NewFakeClientWithListAndApply[*v1alpha3.CompositePodGroup, *v1alpha3.CompositePodGroupList, *schedulingv1alpha3.CompositePodGroupApplyConfiguration]( + fake.Fake, + namespace, + v1alpha3.SchemeGroupVersion.WithResource("compositepodgroups"), + v1alpha3.SchemeGroupVersion.WithKind("CompositePodGroup"), + func() *v1alpha3.CompositePodGroup { return &v1alpha3.CompositePodGroup{} }, + func() *v1alpha3.CompositePodGroupList { return &v1alpha3.CompositePodGroupList{} }, + func(dst, src *v1alpha3.CompositePodGroupList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha3.CompositePodGroupList) []*v1alpha3.CompositePodGroup { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha3.CompositePodGroupList, items []*v1alpha3.CompositePodGroup) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/fake/fake_podgroup.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/fake/fake_podgroup.go new file mode 100644 index 0000000000..bc8ab4806d --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/fake/fake_podgroup.go @@ -0,0 +1,51 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha3 "k8s.io/api/scheduling/v1alpha3" + schedulingv1alpha3 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha3" + gentype "k8s.io/client-go/gentype" + typedschedulingv1alpha3 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3" +) + +// fakePodGroups implements PodGroupInterface +type fakePodGroups struct { + *gentype.FakeClientWithListAndApply[*v1alpha3.PodGroup, *v1alpha3.PodGroupList, *schedulingv1alpha3.PodGroupApplyConfiguration] + Fake *FakeSchedulingV1alpha3 +} + +func newFakePodGroups(fake *FakeSchedulingV1alpha3, namespace string) typedschedulingv1alpha3.PodGroupInterface { + return &fakePodGroups{ + gentype.NewFakeClientWithListAndApply[*v1alpha3.PodGroup, *v1alpha3.PodGroupList, *schedulingv1alpha3.PodGroupApplyConfiguration]( + fake.Fake, + namespace, + v1alpha3.SchemeGroupVersion.WithResource("podgroups"), + v1alpha3.SchemeGroupVersion.WithKind("PodGroup"), + func() *v1alpha3.PodGroup { return &v1alpha3.PodGroup{} }, + func() *v1alpha3.PodGroupList { return &v1alpha3.PodGroupList{} }, + func(dst, src *v1alpha3.PodGroupList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha3.PodGroupList) []*v1alpha3.PodGroup { return gentype.ToPointerSlice(list.Items) }, + func(list *v1alpha3.PodGroupList, items []*v1alpha3.PodGroup) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/fake/fake_scheduling_client.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/fake/fake_scheduling_client.go new file mode 100644 index 0000000000..920c242afc --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/fake/fake_scheduling_client.go @@ -0,0 +1,48 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha3 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeSchedulingV1alpha3 struct { + *testing.Fake +} + +func (c *FakeSchedulingV1alpha3) CompositePodGroups(namespace string) v1alpha3.CompositePodGroupInterface { + return newFakeCompositePodGroups(c, namespace) +} + +func (c *FakeSchedulingV1alpha3) PodGroups(namespace string) v1alpha3.PodGroupInterface { + return newFakePodGroups(c, namespace) +} + +func (c *FakeSchedulingV1alpha3) Workloads(namespace string) v1alpha3.WorkloadInterface { + return newFakeWorkloads(c, namespace) +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeSchedulingV1alpha3) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/fake/fake_workload.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/fake/fake_workload.go new file mode 100644 index 0000000000..b491a40273 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/fake/fake_workload.go @@ -0,0 +1,51 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha3 "k8s.io/api/scheduling/v1alpha3" + schedulingv1alpha3 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha3" + gentype "k8s.io/client-go/gentype" + typedschedulingv1alpha3 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3" +) + +// fakeWorkloads implements WorkloadInterface +type fakeWorkloads struct { + *gentype.FakeClientWithListAndApply[*v1alpha3.Workload, *v1alpha3.WorkloadList, *schedulingv1alpha3.WorkloadApplyConfiguration] + Fake *FakeSchedulingV1alpha3 +} + +func newFakeWorkloads(fake *FakeSchedulingV1alpha3, namespace string) typedschedulingv1alpha3.WorkloadInterface { + return &fakeWorkloads{ + gentype.NewFakeClientWithListAndApply[*v1alpha3.Workload, *v1alpha3.WorkloadList, *schedulingv1alpha3.WorkloadApplyConfiguration]( + fake.Fake, + namespace, + v1alpha3.SchemeGroupVersion.WithResource("workloads"), + v1alpha3.SchemeGroupVersion.WithKind("Workload"), + func() *v1alpha3.Workload { return &v1alpha3.Workload{} }, + func() *v1alpha3.WorkloadList { return &v1alpha3.WorkloadList{} }, + func(dst, src *v1alpha3.WorkloadList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha3.WorkloadList) []*v1alpha3.Workload { return gentype.ToPointerSlice(list.Items) }, + func(list *v1alpha3.WorkloadList, items []*v1alpha3.Workload) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/generated_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/generated_expansion.go similarity index 91% rename from vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/generated_expansion.go rename to vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/generated_expansion.go index 60668af04d..a222ec4604 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/generated_expansion.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/generated_expansion.go @@ -16,7 +16,9 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 + +type CompositePodGroupExpansion interface{} type PodGroupExpansion interface{} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/podgroup.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/podgroup.go similarity index 59% rename from vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/podgroup.go rename to vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/podgroup.go index bbe91d35ab..81024d7e6c 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/podgroup.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/podgroup.go @@ -16,16 +16,16 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 import ( context "context" - schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - applyconfigurationsschedulingv1alpha2 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha2" + applyconfigurationsschedulingv1alpha3 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha3" gentype "k8s.io/client-go/gentype" scheme "k8s.io/client-go/kubernetes/scheme" ) @@ -38,38 +38,38 @@ type PodGroupsGetter interface { // PodGroupInterface has methods to work with PodGroup resources. type PodGroupInterface interface { - Create(ctx context.Context, podGroup *schedulingv1alpha2.PodGroup, opts v1.CreateOptions) (*schedulingv1alpha2.PodGroup, error) - Update(ctx context.Context, podGroup *schedulingv1alpha2.PodGroup, opts v1.UpdateOptions) (*schedulingv1alpha2.PodGroup, error) + Create(ctx context.Context, podGroup *schedulingv1alpha3.PodGroup, opts v1.CreateOptions) (*schedulingv1alpha3.PodGroup, error) + Update(ctx context.Context, podGroup *schedulingv1alpha3.PodGroup, opts v1.UpdateOptions) (*schedulingv1alpha3.PodGroup, error) // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - UpdateStatus(ctx context.Context, podGroup *schedulingv1alpha2.PodGroup, opts v1.UpdateOptions) (*schedulingv1alpha2.PodGroup, error) + UpdateStatus(ctx context.Context, podGroup *schedulingv1alpha3.PodGroup, opts v1.UpdateOptions) (*schedulingv1alpha3.PodGroup, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*schedulingv1alpha2.PodGroup, error) - List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha2.PodGroupList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*schedulingv1alpha3.PodGroup, error) + List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha3.PodGroupList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *schedulingv1alpha2.PodGroup, err error) - Apply(ctx context.Context, podGroup *applyconfigurationsschedulingv1alpha2.PodGroupApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1alpha2.PodGroup, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *schedulingv1alpha3.PodGroup, err error) + Apply(ctx context.Context, podGroup *applyconfigurationsschedulingv1alpha3.PodGroupApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1alpha3.PodGroup, err error) // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). - ApplyStatus(ctx context.Context, podGroup *applyconfigurationsschedulingv1alpha2.PodGroupApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1alpha2.PodGroup, err error) + ApplyStatus(ctx context.Context, podGroup *applyconfigurationsschedulingv1alpha3.PodGroupApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1alpha3.PodGroup, err error) PodGroupExpansion } // podGroups implements PodGroupInterface type podGroups struct { - *gentype.ClientWithListAndApply[*schedulingv1alpha2.PodGroup, *schedulingv1alpha2.PodGroupList, *applyconfigurationsschedulingv1alpha2.PodGroupApplyConfiguration] + *gentype.ClientWithListAndApply[*schedulingv1alpha3.PodGroup, *schedulingv1alpha3.PodGroupList, *applyconfigurationsschedulingv1alpha3.PodGroupApplyConfiguration] } // newPodGroups returns a PodGroups -func newPodGroups(c *SchedulingV1alpha2Client, namespace string) *podGroups { +func newPodGroups(c *SchedulingV1alpha3Client, namespace string) *podGroups { return &podGroups{ - gentype.NewClientWithListAndApply[*schedulingv1alpha2.PodGroup, *schedulingv1alpha2.PodGroupList, *applyconfigurationsschedulingv1alpha2.PodGroupApplyConfiguration]( + gentype.NewClientWithListAndApply[*schedulingv1alpha3.PodGroup, *schedulingv1alpha3.PodGroupList, *applyconfigurationsschedulingv1alpha3.PodGroupApplyConfiguration]( "podgroups", c.RESTClient(), scheme.ParameterCodec, namespace, - func() *schedulingv1alpha2.PodGroup { return &schedulingv1alpha2.PodGroup{} }, - func() *schedulingv1alpha2.PodGroupList { return &schedulingv1alpha2.PodGroupList{} }, - gentype.PrefersProtobuf[*schedulingv1alpha2.PodGroup](), + func() *schedulingv1alpha3.PodGroup { return &schedulingv1alpha3.PodGroup{} }, + func() *schedulingv1alpha3.PodGroupList { return &schedulingv1alpha3.PodGroupList{} }, + gentype.PrefersProtobuf[*schedulingv1alpha3.PodGroup](), ), } } diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/scheduling_client.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/scheduling_client.go similarity index 65% rename from vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/scheduling_client.go rename to vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/scheduling_client.go index 8ccdc178b9..8c99d51ca5 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/scheduling_client.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/scheduling_client.go @@ -16,39 +16,44 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 import ( http "net/http" - schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" scheme "k8s.io/client-go/kubernetes/scheme" rest "k8s.io/client-go/rest" ) -type SchedulingV1alpha2Interface interface { +type SchedulingV1alpha3Interface interface { RESTClient() rest.Interface + CompositePodGroupsGetter PodGroupsGetter WorkloadsGetter } -// SchedulingV1alpha2Client is used to interact with features provided by the scheduling.k8s.io group. -type SchedulingV1alpha2Client struct { +// SchedulingV1alpha3Client is used to interact with features provided by the scheduling.k8s.io group. +type SchedulingV1alpha3Client struct { restClient rest.Interface } -func (c *SchedulingV1alpha2Client) PodGroups(namespace string) PodGroupInterface { +func (c *SchedulingV1alpha3Client) CompositePodGroups(namespace string) CompositePodGroupInterface { + return newCompositePodGroups(c, namespace) +} + +func (c *SchedulingV1alpha3Client) PodGroups(namespace string) PodGroupInterface { return newPodGroups(c, namespace) } -func (c *SchedulingV1alpha2Client) Workloads(namespace string) WorkloadInterface { +func (c *SchedulingV1alpha3Client) Workloads(namespace string) WorkloadInterface { return newWorkloads(c, namespace) } -// NewForConfig creates a new SchedulingV1alpha2Client for the given config. +// NewForConfig creates a new SchedulingV1alpha3Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*SchedulingV1alpha2Client, error) { +func NewForConfig(c *rest.Config) (*SchedulingV1alpha3Client, error) { config := *c setConfigDefaults(&config) httpClient, err := rest.HTTPClientFor(&config) @@ -58,21 +63,21 @@ func NewForConfig(c *rest.Config) (*SchedulingV1alpha2Client, error) { return NewForConfigAndClient(&config, httpClient) } -// NewForConfigAndClient creates a new SchedulingV1alpha2Client for the given config and http client. +// NewForConfigAndClient creates a new SchedulingV1alpha3Client for the given config and http client. // Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*SchedulingV1alpha2Client, error) { +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*SchedulingV1alpha3Client, error) { config := *c setConfigDefaults(&config) client, err := rest.RESTClientForConfigAndClient(&config, h) if err != nil { return nil, err } - return &SchedulingV1alpha2Client{client}, nil + return &SchedulingV1alpha3Client{client}, nil } -// NewForConfigOrDie creates a new SchedulingV1alpha2Client for the given config and +// NewForConfigOrDie creates a new SchedulingV1alpha3Client for the given config and // panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *SchedulingV1alpha2Client { +func NewForConfigOrDie(c *rest.Config) *SchedulingV1alpha3Client { client, err := NewForConfig(c) if err != nil { panic(err) @@ -80,13 +85,13 @@ func NewForConfigOrDie(c *rest.Config) *SchedulingV1alpha2Client { return client } -// New creates a new SchedulingV1alpha2Client for the given RESTClient. -func New(c rest.Interface) *SchedulingV1alpha2Client { - return &SchedulingV1alpha2Client{c} +// New creates a new SchedulingV1alpha3Client for the given RESTClient. +func New(c rest.Interface) *SchedulingV1alpha3Client { + return &SchedulingV1alpha3Client{c} } func setConfigDefaults(config *rest.Config) { - gv := schedulingv1alpha2.SchemeGroupVersion + gv := schedulingv1alpha3.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() @@ -98,7 +103,7 @@ func setConfigDefaults(config *rest.Config) { // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *SchedulingV1alpha2Client) RESTClient() rest.Interface { +func (c *SchedulingV1alpha3Client) RESTClient() rest.Interface { if c == nil { return nil } diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/workload.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/workload.go similarity index 62% rename from vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/workload.go rename to vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/workload.go index 89790940bc..f4c9d7cf68 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/workload.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3/workload.go @@ -16,16 +16,16 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 import ( context "context" - schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - applyconfigurationsschedulingv1alpha2 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha2" + applyconfigurationsschedulingv1alpha3 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha3" gentype "k8s.io/client-go/gentype" scheme "k8s.io/client-go/kubernetes/scheme" ) @@ -38,34 +38,34 @@ type WorkloadsGetter interface { // WorkloadInterface has methods to work with Workload resources. type WorkloadInterface interface { - Create(ctx context.Context, workload *schedulingv1alpha2.Workload, opts v1.CreateOptions) (*schedulingv1alpha2.Workload, error) - Update(ctx context.Context, workload *schedulingv1alpha2.Workload, opts v1.UpdateOptions) (*schedulingv1alpha2.Workload, error) + Create(ctx context.Context, workload *schedulingv1alpha3.Workload, opts v1.CreateOptions) (*schedulingv1alpha3.Workload, error) + Update(ctx context.Context, workload *schedulingv1alpha3.Workload, opts v1.UpdateOptions) (*schedulingv1alpha3.Workload, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*schedulingv1alpha2.Workload, error) - List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha2.WorkloadList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*schedulingv1alpha3.Workload, error) + List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha3.WorkloadList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *schedulingv1alpha2.Workload, err error) - Apply(ctx context.Context, workload *applyconfigurationsschedulingv1alpha2.WorkloadApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1alpha2.Workload, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *schedulingv1alpha3.Workload, err error) + Apply(ctx context.Context, workload *applyconfigurationsschedulingv1alpha3.WorkloadApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1alpha3.Workload, err error) WorkloadExpansion } // workloads implements WorkloadInterface type workloads struct { - *gentype.ClientWithListAndApply[*schedulingv1alpha2.Workload, *schedulingv1alpha2.WorkloadList, *applyconfigurationsschedulingv1alpha2.WorkloadApplyConfiguration] + *gentype.ClientWithListAndApply[*schedulingv1alpha3.Workload, *schedulingv1alpha3.WorkloadList, *applyconfigurationsschedulingv1alpha3.WorkloadApplyConfiguration] } // newWorkloads returns a Workloads -func newWorkloads(c *SchedulingV1alpha2Client, namespace string) *workloads { +func newWorkloads(c *SchedulingV1alpha3Client, namespace string) *workloads { return &workloads{ - gentype.NewClientWithListAndApply[*schedulingv1alpha2.Workload, *schedulingv1alpha2.WorkloadList, *applyconfigurationsschedulingv1alpha2.WorkloadApplyConfiguration]( + gentype.NewClientWithListAndApply[*schedulingv1alpha3.Workload, *schedulingv1alpha3.WorkloadList, *applyconfigurationsschedulingv1alpha3.WorkloadApplyConfiguration]( "workloads", c.RESTClient(), scheme.ParameterCodec, namespace, - func() *schedulingv1alpha2.Workload { return &schedulingv1alpha2.Workload{} }, - func() *schedulingv1alpha2.WorkloadList { return &schedulingv1alpha2.WorkloadList{} }, - gentype.PrefersProtobuf[*schedulingv1alpha2.Workload](), + func() *schedulingv1alpha3.Workload { return &schedulingv1alpha3.Workload{} }, + func() *schedulingv1alpha3.WorkloadList { return &schedulingv1alpha3.WorkloadList{} }, + gentype.PrefersProtobuf[*schedulingv1alpha3.Workload](), ), } } diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/fake_podgroup.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/fake_podgroup.go new file mode 100644 index 0000000000..0874dfd5b5 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/fake_podgroup.go @@ -0,0 +1,51 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "k8s.io/api/scheduling/v1beta1" + schedulingv1beta1 "k8s.io/client-go/applyconfigurations/scheduling/v1beta1" + gentype "k8s.io/client-go/gentype" + typedschedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1" +) + +// fakePodGroups implements PodGroupInterface +type fakePodGroups struct { + *gentype.FakeClientWithListAndApply[*v1beta1.PodGroup, *v1beta1.PodGroupList, *schedulingv1beta1.PodGroupApplyConfiguration] + Fake *FakeSchedulingV1beta1 +} + +func newFakePodGroups(fake *FakeSchedulingV1beta1, namespace string) typedschedulingv1beta1.PodGroupInterface { + return &fakePodGroups{ + gentype.NewFakeClientWithListAndApply[*v1beta1.PodGroup, *v1beta1.PodGroupList, *schedulingv1beta1.PodGroupApplyConfiguration]( + fake.Fake, + namespace, + v1beta1.SchemeGroupVersion.WithResource("podgroups"), + v1beta1.SchemeGroupVersion.WithKind("PodGroup"), + func() *v1beta1.PodGroup { return &v1beta1.PodGroup{} }, + func() *v1beta1.PodGroupList { return &v1beta1.PodGroupList{} }, + func(dst, src *v1beta1.PodGroupList) { dst.ListMeta = src.ListMeta }, + func(list *v1beta1.PodGroupList) []*v1beta1.PodGroup { return gentype.ToPointerSlice(list.Items) }, + func(list *v1beta1.PodGroupList, items []*v1beta1.PodGroup) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/fake_scheduling_client.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/fake_scheduling_client.go index f06fdab114..8f81b08983 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/fake_scheduling_client.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/fake_scheduling_client.go @@ -28,10 +28,18 @@ type FakeSchedulingV1beta1 struct { *testing.Fake } +func (c *FakeSchedulingV1beta1) PodGroups(namespace string) v1beta1.PodGroupInterface { + return newFakePodGroups(c, namespace) +} + func (c *FakeSchedulingV1beta1) PriorityClasses() v1beta1.PriorityClassInterface { return newFakePriorityClasses(c) } +func (c *FakeSchedulingV1beta1) Workloads(namespace string) v1beta1.WorkloadInterface { + return newFakeWorkloads(c, namespace) +} + // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeSchedulingV1beta1) RESTClient() rest.Interface { diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/fake_workload.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/fake_workload.go new file mode 100644 index 0000000000..355b228abe --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/fake_workload.go @@ -0,0 +1,51 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "k8s.io/api/scheduling/v1beta1" + schedulingv1beta1 "k8s.io/client-go/applyconfigurations/scheduling/v1beta1" + gentype "k8s.io/client-go/gentype" + typedschedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1" +) + +// fakeWorkloads implements WorkloadInterface +type fakeWorkloads struct { + *gentype.FakeClientWithListAndApply[*v1beta1.Workload, *v1beta1.WorkloadList, *schedulingv1beta1.WorkloadApplyConfiguration] + Fake *FakeSchedulingV1beta1 +} + +func newFakeWorkloads(fake *FakeSchedulingV1beta1, namespace string) typedschedulingv1beta1.WorkloadInterface { + return &fakeWorkloads{ + gentype.NewFakeClientWithListAndApply[*v1beta1.Workload, *v1beta1.WorkloadList, *schedulingv1beta1.WorkloadApplyConfiguration]( + fake.Fake, + namespace, + v1beta1.SchemeGroupVersion.WithResource("workloads"), + v1beta1.SchemeGroupVersion.WithKind("Workload"), + func() *v1beta1.Workload { return &v1beta1.Workload{} }, + func() *v1beta1.WorkloadList { return &v1beta1.WorkloadList{} }, + func(dst, src *v1beta1.WorkloadList) { dst.ListMeta = src.ListMeta }, + func(list *v1beta1.WorkloadList) []*v1beta1.Workload { return gentype.ToPointerSlice(list.Items) }, + func(list *v1beta1.WorkloadList, items []*v1beta1.Workload) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/generated_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/generated_expansion.go index 3bab873e6f..719e1e0e57 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/generated_expansion.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/generated_expansion.go @@ -18,4 +18,8 @@ limitations under the License. package v1beta1 +type PodGroupExpansion interface{} + type PriorityClassExpansion interface{} + +type WorkloadExpansion interface{} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/podgroup.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/podgroup.go new file mode 100644 index 0000000000..4eb85b94c7 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/podgroup.go @@ -0,0 +1,75 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + context "context" + + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + applyconfigurationsschedulingv1beta1 "k8s.io/client-go/applyconfigurations/scheduling/v1beta1" + gentype "k8s.io/client-go/gentype" + scheme "k8s.io/client-go/kubernetes/scheme" +) + +// PodGroupsGetter has a method to return a PodGroupInterface. +// A group's client should implement this interface. +type PodGroupsGetter interface { + PodGroups(namespace string) PodGroupInterface +} + +// PodGroupInterface has methods to work with PodGroup resources. +type PodGroupInterface interface { + Create(ctx context.Context, podGroup *schedulingv1beta1.PodGroup, opts v1.CreateOptions) (*schedulingv1beta1.PodGroup, error) + Update(ctx context.Context, podGroup *schedulingv1beta1.PodGroup, opts v1.UpdateOptions) (*schedulingv1beta1.PodGroup, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, podGroup *schedulingv1beta1.PodGroup, opts v1.UpdateOptions) (*schedulingv1beta1.PodGroup, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*schedulingv1beta1.PodGroup, error) + List(ctx context.Context, opts v1.ListOptions) (*schedulingv1beta1.PodGroupList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *schedulingv1beta1.PodGroup, err error) + Apply(ctx context.Context, podGroup *applyconfigurationsschedulingv1beta1.PodGroupApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1beta1.PodGroup, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, podGroup *applyconfigurationsschedulingv1beta1.PodGroupApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1beta1.PodGroup, err error) + PodGroupExpansion +} + +// podGroups implements PodGroupInterface +type podGroups struct { + *gentype.ClientWithListAndApply[*schedulingv1beta1.PodGroup, *schedulingv1beta1.PodGroupList, *applyconfigurationsschedulingv1beta1.PodGroupApplyConfiguration] +} + +// newPodGroups returns a PodGroups +func newPodGroups(c *SchedulingV1beta1Client, namespace string) *podGroups { + return &podGroups{ + gentype.NewClientWithListAndApply[*schedulingv1beta1.PodGroup, *schedulingv1beta1.PodGroupList, *applyconfigurationsschedulingv1beta1.PodGroupApplyConfiguration]( + "podgroups", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *schedulingv1beta1.PodGroup { return &schedulingv1beta1.PodGroup{} }, + func() *schedulingv1beta1.PodGroupList { return &schedulingv1beta1.PodGroupList{} }, + gentype.PrefersProtobuf[*schedulingv1beta1.PodGroup](), + ), + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/scheduling_client.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/scheduling_client.go index 0b2aa0e1ac..b2d7e6d261 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/scheduling_client.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/scheduling_client.go @@ -28,7 +28,9 @@ import ( type SchedulingV1beta1Interface interface { RESTClient() rest.Interface + PodGroupsGetter PriorityClassesGetter + WorkloadsGetter } // SchedulingV1beta1Client is used to interact with features provided by the scheduling.k8s.io group. @@ -36,10 +38,18 @@ type SchedulingV1beta1Client struct { restClient rest.Interface } +func (c *SchedulingV1beta1Client) PodGroups(namespace string) PodGroupInterface { + return newPodGroups(c, namespace) +} + func (c *SchedulingV1beta1Client) PriorityClasses() PriorityClassInterface { return newPriorityClasses(c) } +func (c *SchedulingV1beta1Client) Workloads(namespace string) WorkloadInterface { + return newWorkloads(c, namespace) +} + // NewForConfig creates a new SchedulingV1beta1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/workload.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/workload.go new file mode 100644 index 0000000000..e5313ab593 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/workload.go @@ -0,0 +1,71 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + context "context" + + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + applyconfigurationsschedulingv1beta1 "k8s.io/client-go/applyconfigurations/scheduling/v1beta1" + gentype "k8s.io/client-go/gentype" + scheme "k8s.io/client-go/kubernetes/scheme" +) + +// WorkloadsGetter has a method to return a WorkloadInterface. +// A group's client should implement this interface. +type WorkloadsGetter interface { + Workloads(namespace string) WorkloadInterface +} + +// WorkloadInterface has methods to work with Workload resources. +type WorkloadInterface interface { + Create(ctx context.Context, workload *schedulingv1beta1.Workload, opts v1.CreateOptions) (*schedulingv1beta1.Workload, error) + Update(ctx context.Context, workload *schedulingv1beta1.Workload, opts v1.UpdateOptions) (*schedulingv1beta1.Workload, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*schedulingv1beta1.Workload, error) + List(ctx context.Context, opts v1.ListOptions) (*schedulingv1beta1.WorkloadList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *schedulingv1beta1.Workload, err error) + Apply(ctx context.Context, workload *applyconfigurationsschedulingv1beta1.WorkloadApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1beta1.Workload, err error) + WorkloadExpansion +} + +// workloads implements WorkloadInterface +type workloads struct { + *gentype.ClientWithListAndApply[*schedulingv1beta1.Workload, *schedulingv1beta1.WorkloadList, *applyconfigurationsschedulingv1beta1.WorkloadApplyConfiguration] +} + +// newWorkloads returns a Workloads +func newWorkloads(c *SchedulingV1beta1Client, namespace string) *workloads { + return &workloads{ + gentype.NewClientWithListAndApply[*schedulingv1beta1.Workload, *schedulingv1beta1.WorkloadList, *applyconfigurationsschedulingv1beta1.WorkloadApplyConfiguration]( + "workloads", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *schedulingv1beta1.Workload { return &schedulingv1beta1.Workload{} }, + func() *schedulingv1beta1.WorkloadList { return &schedulingv1beta1.WorkloadList{} }, + gentype.PrefersProtobuf[*schedulingv1beta1.Workload](), + ), + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/csinode.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/csinode.go index a4fe6a0ee5..05d7302ba3 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/csinode.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/csinode.go @@ -40,6 +40,8 @@ type CSINodesGetter interface { type CSINodeInterface interface { Create(ctx context.Context, cSINode *storagev1.CSINode, opts metav1.CreateOptions) (*storagev1.CSINode, error) Update(ctx context.Context, cSINode *storagev1.CSINode, opts metav1.UpdateOptions) (*storagev1.CSINode, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, cSINode *storagev1.CSINode, opts metav1.UpdateOptions) (*storagev1.CSINode, error) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error Get(ctx context.Context, name string, opts metav1.GetOptions) (*storagev1.CSINode, error) @@ -47,6 +49,8 @@ type CSINodeInterface 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 *storagev1.CSINode, err error) Apply(ctx context.Context, cSINode *applyconfigurationsstoragev1.CSINodeApplyConfiguration, opts metav1.ApplyOptions) (result *storagev1.CSINode, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, cSINode *applyconfigurationsstoragev1.CSINodeApplyConfiguration, opts metav1.ApplyOptions) (result *storagev1.CSINode, err error) CSINodeExpansion } diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/csinode.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/csinode.go index 5e8eb2e376..6009d0d9a9 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/csinode.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/csinode.go @@ -40,6 +40,8 @@ type CSINodesGetter interface { type CSINodeInterface interface { Create(ctx context.Context, cSINode *storagev1beta1.CSINode, opts v1.CreateOptions) (*storagev1beta1.CSINode, error) Update(ctx context.Context, cSINode *storagev1beta1.CSINode, opts v1.UpdateOptions) (*storagev1beta1.CSINode, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, cSINode *storagev1beta1.CSINode, opts v1.UpdateOptions) (*storagev1beta1.CSINode, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error Get(ctx context.Context, name string, opts v1.GetOptions) (*storagev1beta1.CSINode, error) @@ -47,6 +49,8 @@ type CSINodeInterface 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 *storagev1beta1.CSINode, err error) Apply(ctx context.Context, cSINode *applyconfigurationsstoragev1beta1.CSINodeApplyConfiguration, opts v1.ApplyOptions) (result *storagev1beta1.CSINode, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, cSINode *applyconfigurationsstoragev1beta1.CSINodeApplyConfiguration, opts v1.ApplyOptions) (result *storagev1beta1.CSINode, err error) CSINodeExpansion } diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/doc.go new file mode 100644 index 0000000000..3af5d054f1 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/fake/doc.go new file mode 100644 index 0000000000..16f4439906 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_scheduling_client.go b/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/fake/fake_storagemigration_client.go similarity index 67% rename from vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_scheduling_client.go rename to vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/fake/fake_storagemigration_client.go index 1d21b2d914..c125b3b3bd 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_scheduling_client.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/fake/fake_storagemigration_client.go @@ -19,26 +19,22 @@ limitations under the License. package fake import ( - v1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2" + v1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) -type FakeSchedulingV1alpha2 struct { +type FakeStoragemigrationV1 struct { *testing.Fake } -func (c *FakeSchedulingV1alpha2) PodGroups(namespace string) v1alpha2.PodGroupInterface { - return newFakePodGroups(c, namespace) -} - -func (c *FakeSchedulingV1alpha2) Workloads(namespace string) v1alpha2.WorkloadInterface { - return newFakeWorkloads(c, namespace) +func (c *FakeStoragemigrationV1) StorageVersionMigrations() v1.StorageVersionMigrationInterface { + return newFakeStorageVersionMigrations(c) } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *FakeSchedulingV1alpha2) RESTClient() rest.Interface { +func (c *FakeStoragemigrationV1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret } diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/fake/fake_storageversionmigration.go b/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/fake/fake_storageversionmigration.go new file mode 100644 index 0000000000..9192f914ab --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/fake/fake_storageversionmigration.go @@ -0,0 +1,53 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/api/storagemigration/v1" + storagemigrationv1 "k8s.io/client-go/applyconfigurations/storagemigration/v1" + gentype "k8s.io/client-go/gentype" + typedstoragemigrationv1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1" +) + +// fakeStorageVersionMigrations implements StorageVersionMigrationInterface +type fakeStorageVersionMigrations struct { + *gentype.FakeClientWithListAndApply[*v1.StorageVersionMigration, *v1.StorageVersionMigrationList, *storagemigrationv1.StorageVersionMigrationApplyConfiguration] + Fake *FakeStoragemigrationV1 +} + +func newFakeStorageVersionMigrations(fake *FakeStoragemigrationV1) typedstoragemigrationv1.StorageVersionMigrationInterface { + return &fakeStorageVersionMigrations{ + gentype.NewFakeClientWithListAndApply[*v1.StorageVersionMigration, *v1.StorageVersionMigrationList, *storagemigrationv1.StorageVersionMigrationApplyConfiguration]( + fake.Fake, + "", + v1.SchemeGroupVersion.WithResource("storageversionmigrations"), + v1.SchemeGroupVersion.WithKind("StorageVersionMigration"), + func() *v1.StorageVersionMigration { return &v1.StorageVersionMigration{} }, + func() *v1.StorageVersionMigrationList { return &v1.StorageVersionMigrationList{} }, + func(dst, src *v1.StorageVersionMigrationList) { dst.ListMeta = src.ListMeta }, + func(list *v1.StorageVersionMigrationList) []*v1.StorageVersionMigration { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1.StorageVersionMigrationList, items []*v1.StorageVersionMigration) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/generated_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/generated_expansion.go new file mode 100644 index 0000000000..65521b370a --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/generated_expansion.go @@ -0,0 +1,21 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +type StorageVersionMigrationExpansion interface{} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/storagemigration_client.go b/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/storagemigration_client.go new file mode 100644 index 0000000000..600e7904e5 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/storagemigration_client.go @@ -0,0 +1,101 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + http "net/http" + + storagemigrationv1 "k8s.io/api/storagemigration/v1" + scheme "k8s.io/client-go/kubernetes/scheme" + rest "k8s.io/client-go/rest" +) + +type StoragemigrationV1Interface interface { + RESTClient() rest.Interface + StorageVersionMigrationsGetter +} + +// StoragemigrationV1Client is used to interact with features provided by the storagemigration.k8s.io group. +type StoragemigrationV1Client struct { + restClient rest.Interface +} + +func (c *StoragemigrationV1Client) StorageVersionMigrations() StorageVersionMigrationInterface { + return newStorageVersionMigrations(c) +} + +// NewForConfig creates a new StoragemigrationV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*StoragemigrationV1Client, error) { + config := *c + setConfigDefaults(&config) + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new StoragemigrationV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*StoragemigrationV1Client, error) { + config := *c + setConfigDefaults(&config) + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &StoragemigrationV1Client{client}, nil +} + +// NewForConfigOrDie creates a new StoragemigrationV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *StoragemigrationV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new StoragemigrationV1Client for the given RESTClient. +func New(c rest.Interface) *StoragemigrationV1Client { + return &StoragemigrationV1Client{c} +} + +func setConfigDefaults(config *rest.Config) { + gv := storagemigrationv1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *StoragemigrationV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/storageversionmigration.go b/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/storageversionmigration.go new file mode 100644 index 0000000000..ecc5658d16 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1/storageversionmigration.go @@ -0,0 +1,79 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + + storagemigrationv1 "k8s.io/api/storagemigration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + applyconfigurationsstoragemigrationv1 "k8s.io/client-go/applyconfigurations/storagemigration/v1" + gentype "k8s.io/client-go/gentype" + scheme "k8s.io/client-go/kubernetes/scheme" +) + +// StorageVersionMigrationsGetter has a method to return a StorageVersionMigrationInterface. +// A group's client should implement this interface. +type StorageVersionMigrationsGetter interface { + StorageVersionMigrations() StorageVersionMigrationInterface +} + +// StorageVersionMigrationInterface has methods to work with StorageVersionMigration resources. +type StorageVersionMigrationInterface interface { + Create(ctx context.Context, storageVersionMigration *storagemigrationv1.StorageVersionMigration, opts metav1.CreateOptions) (*storagemigrationv1.StorageVersionMigration, error) + Update(ctx context.Context, storageVersionMigration *storagemigrationv1.StorageVersionMigration, opts metav1.UpdateOptions) (*storagemigrationv1.StorageVersionMigration, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, storageVersionMigration *storagemigrationv1.StorageVersionMigration, opts metav1.UpdateOptions) (*storagemigrationv1.StorageVersionMigration, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*storagemigrationv1.StorageVersionMigration, error) + List(ctx context.Context, opts metav1.ListOptions) (*storagemigrationv1.StorageVersionMigrationList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *storagemigrationv1.StorageVersionMigration, err error) + Apply(ctx context.Context, storageVersionMigration *applyconfigurationsstoragemigrationv1.StorageVersionMigrationApplyConfiguration, opts metav1.ApplyOptions) (result *storagemigrationv1.StorageVersionMigration, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, storageVersionMigration *applyconfigurationsstoragemigrationv1.StorageVersionMigrationApplyConfiguration, opts metav1.ApplyOptions) (result *storagemigrationv1.StorageVersionMigration, err error) + StorageVersionMigrationExpansion +} + +// storageVersionMigrations implements StorageVersionMigrationInterface +type storageVersionMigrations struct { + *gentype.ClientWithListAndApply[*storagemigrationv1.StorageVersionMigration, *storagemigrationv1.StorageVersionMigrationList, *applyconfigurationsstoragemigrationv1.StorageVersionMigrationApplyConfiguration] +} + +// newStorageVersionMigrations returns a StorageVersionMigrations +func newStorageVersionMigrations(c *StoragemigrationV1Client) *storageVersionMigrations { + return &storageVersionMigrations{ + gentype.NewClientWithListAndApply[*storagemigrationv1.StorageVersionMigration, *storagemigrationv1.StorageVersionMigrationList, *applyconfigurationsstoragemigrationv1.StorageVersionMigrationApplyConfiguration]( + "storageversionmigrations", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *storagemigrationv1.StorageVersionMigration { + return &storagemigrationv1.StorageVersionMigration{} + }, + func() *storagemigrationv1.StorageVersionMigrationList { + return &storagemigrationv1.StorageVersionMigrationList{} + }, + gentype.PrefersProtobuf[*storagemigrationv1.StorageVersionMigration](), + ), + } +} diff --git a/vendor/k8s.io/client-go/listers/certificates/v1/clustertrustbundle.go b/vendor/k8s.io/client-go/listers/certificates/v1/clustertrustbundle.go new file mode 100644 index 0000000000..18f6e15fcb --- /dev/null +++ b/vendor/k8s.io/client-go/listers/certificates/v1/clustertrustbundle.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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + certificatesv1 "k8s.io/api/certificates/v1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterTrustBundleLister helps list ClusterTrustBundles. +// All objects returned here must be treated as read-only. +type ClusterTrustBundleLister interface { + // List lists all ClusterTrustBundles in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*certificatesv1.ClusterTrustBundle, err error) + // Get retrieves the ClusterTrustBundle from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*certificatesv1.ClusterTrustBundle, error) + ClusterTrustBundleListerExpansion +} + +// clusterTrustBundleLister implements the ClusterTrustBundleLister interface. +type clusterTrustBundleLister struct { + listers.ResourceIndexer[*certificatesv1.ClusterTrustBundle] +} + +// NewClusterTrustBundleLister returns a new ClusterTrustBundleLister. +func NewClusterTrustBundleLister(indexer cache.Indexer) ClusterTrustBundleLister { + return &clusterTrustBundleLister{listers.New[*certificatesv1.ClusterTrustBundle](indexer, certificatesv1.Resource("clustertrustbundle"))} +} diff --git a/vendor/k8s.io/client-go/listers/certificates/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/certificates/v1/expansion_generated.go index 616a1f1a09..36a04381e7 100644 --- a/vendor/k8s.io/client-go/listers/certificates/v1/expansion_generated.go +++ b/vendor/k8s.io/client-go/listers/certificates/v1/expansion_generated.go @@ -21,3 +21,15 @@ package v1 // CertificateSigningRequestListerExpansion allows custom methods to be added to // CertificateSigningRequestLister. type CertificateSigningRequestListerExpansion interface{} + +// ClusterTrustBundleListerExpansion allows custom methods to be added to +// ClusterTrustBundleLister. +type ClusterTrustBundleListerExpansion interface{} + +// PodCertificateRequestListerExpansion allows custom methods to be added to +// PodCertificateRequestLister. +type PodCertificateRequestListerExpansion interface{} + +// PodCertificateRequestNamespaceListerExpansion allows custom methods to be added to +// PodCertificateRequestNamespaceLister. +type PodCertificateRequestNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/certificates/v1/podcertificaterequest.go b/vendor/k8s.io/client-go/listers/certificates/v1/podcertificaterequest.go new file mode 100644 index 0000000000..71a7a545d8 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/certificates/v1/podcertificaterequest.go @@ -0,0 +1,70 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + certificatesv1 "k8s.io/api/certificates/v1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// PodCertificateRequestLister helps list PodCertificateRequests. +// All objects returned here must be treated as read-only. +type PodCertificateRequestLister interface { + // List lists all PodCertificateRequests in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*certificatesv1.PodCertificateRequest, err error) + // PodCertificateRequests returns an object that can list and get PodCertificateRequests. + PodCertificateRequests(namespace string) PodCertificateRequestNamespaceLister + PodCertificateRequestListerExpansion +} + +// podCertificateRequestLister implements the PodCertificateRequestLister interface. +type podCertificateRequestLister struct { + listers.ResourceIndexer[*certificatesv1.PodCertificateRequest] +} + +// NewPodCertificateRequestLister returns a new PodCertificateRequestLister. +func NewPodCertificateRequestLister(indexer cache.Indexer) PodCertificateRequestLister { + return &podCertificateRequestLister{listers.New[*certificatesv1.PodCertificateRequest](indexer, certificatesv1.Resource("podcertificaterequest"))} +} + +// PodCertificateRequests returns an object that can list and get PodCertificateRequests. +func (s *podCertificateRequestLister) PodCertificateRequests(namespace string) PodCertificateRequestNamespaceLister { + return podCertificateRequestNamespaceLister{listers.NewNamespaced[*certificatesv1.PodCertificateRequest](s.ResourceIndexer, namespace)} +} + +// PodCertificateRequestNamespaceLister helps list and get PodCertificateRequests. +// All objects returned here must be treated as read-only. +type PodCertificateRequestNamespaceLister interface { + // List lists all PodCertificateRequests in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*certificatesv1.PodCertificateRequest, err error) + // Get retrieves the PodCertificateRequest from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*certificatesv1.PodCertificateRequest, error) + PodCertificateRequestNamespaceListerExpansion +} + +// podCertificateRequestNamespaceLister implements the PodCertificateRequestNamespaceLister +// interface. +type podCertificateRequestNamespaceLister struct { + listers.ResourceIndexer[*certificatesv1.PodCertificateRequest] +} diff --git a/vendor/k8s.io/client-go/listers/lifecycle/v1alpha1/eviction.go b/vendor/k8s.io/client-go/listers/lifecycle/v1alpha1/eviction.go new file mode 100644 index 0000000000..33f3c663cb --- /dev/null +++ b/vendor/k8s.io/client-go/listers/lifecycle/v1alpha1/eviction.go @@ -0,0 +1,70 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// EvictionLister helps list Evictions. +// All objects returned here must be treated as read-only. +type EvictionLister interface { + // List lists all Evictions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*lifecyclev1alpha1.Eviction, err error) + // Evictions returns an object that can list and get Evictions. + Evictions(namespace string) EvictionNamespaceLister + EvictionListerExpansion +} + +// evictionLister implements the EvictionLister interface. +type evictionLister struct { + listers.ResourceIndexer[*lifecyclev1alpha1.Eviction] +} + +// NewEvictionLister returns a new EvictionLister. +func NewEvictionLister(indexer cache.Indexer) EvictionLister { + return &evictionLister{listers.New[*lifecyclev1alpha1.Eviction](indexer, lifecyclev1alpha1.Resource("eviction"))} +} + +// Evictions returns an object that can list and get Evictions. +func (s *evictionLister) Evictions(namespace string) EvictionNamespaceLister { + return evictionNamespaceLister{listers.NewNamespaced[*lifecyclev1alpha1.Eviction](s.ResourceIndexer, namespace)} +} + +// EvictionNamespaceLister helps list and get Evictions. +// All objects returned here must be treated as read-only. +type EvictionNamespaceLister interface { + // List lists all Evictions in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*lifecyclev1alpha1.Eviction, err error) + // Get retrieves the Eviction from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*lifecyclev1alpha1.Eviction, error) + EvictionNamespaceListerExpansion +} + +// evictionNamespaceLister implements the EvictionNamespaceLister +// interface. +type evictionNamespaceLister struct { + listers.ResourceIndexer[*lifecyclev1alpha1.Eviction] +} diff --git a/vendor/k8s.io/client-go/listers/lifecycle/v1alpha1/evictionrequest.go b/vendor/k8s.io/client-go/listers/lifecycle/v1alpha1/evictionrequest.go new file mode 100644 index 0000000000..97caab9cd2 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/lifecycle/v1alpha1/evictionrequest.go @@ -0,0 +1,70 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// EvictionRequestLister helps list EvictionRequests. +// All objects returned here must be treated as read-only. +type EvictionRequestLister interface { + // List lists all EvictionRequests in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*lifecyclev1alpha1.EvictionRequest, err error) + // EvictionRequests returns an object that can list and get EvictionRequests. + EvictionRequests(namespace string) EvictionRequestNamespaceLister + EvictionRequestListerExpansion +} + +// evictionRequestLister implements the EvictionRequestLister interface. +type evictionRequestLister struct { + listers.ResourceIndexer[*lifecyclev1alpha1.EvictionRequest] +} + +// NewEvictionRequestLister returns a new EvictionRequestLister. +func NewEvictionRequestLister(indexer cache.Indexer) EvictionRequestLister { + return &evictionRequestLister{listers.New[*lifecyclev1alpha1.EvictionRequest](indexer, lifecyclev1alpha1.Resource("evictionrequest"))} +} + +// EvictionRequests returns an object that can list and get EvictionRequests. +func (s *evictionRequestLister) EvictionRequests(namespace string) EvictionRequestNamespaceLister { + return evictionRequestNamespaceLister{listers.NewNamespaced[*lifecyclev1alpha1.EvictionRequest](s.ResourceIndexer, namespace)} +} + +// EvictionRequestNamespaceLister helps list and get EvictionRequests. +// All objects returned here must be treated as read-only. +type EvictionRequestNamespaceLister interface { + // List lists all EvictionRequests in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*lifecyclev1alpha1.EvictionRequest, err error) + // Get retrieves the EvictionRequest from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*lifecyclev1alpha1.EvictionRequest, error) + EvictionRequestNamespaceListerExpansion +} + +// evictionRequestNamespaceLister implements the EvictionRequestNamespaceLister +// interface. +type evictionRequestNamespaceLister struct { + listers.ResourceIndexer[*lifecyclev1alpha1.EvictionRequest] +} diff --git a/vendor/k8s.io/client-go/listers/lifecycle/v1alpha1/expansion_generated.go b/vendor/k8s.io/client-go/listers/lifecycle/v1alpha1/expansion_generated.go new file mode 100644 index 0000000000..dba8bb0555 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/lifecycle/v1alpha1/expansion_generated.go @@ -0,0 +1,35 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// EvictionListerExpansion allows custom methods to be added to +// EvictionLister. +type EvictionListerExpansion interface{} + +// EvictionNamespaceListerExpansion allows custom methods to be added to +// EvictionNamespaceLister. +type EvictionNamespaceListerExpansion interface{} + +// EvictionRequestListerExpansion allows custom methods to be added to +// EvictionRequestLister. +type EvictionRequestListerExpansion interface{} + +// EvictionRequestNamespaceListerExpansion allows custom methods to be added to +// EvictionRequestNamespaceLister. +type EvictionRequestNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/resource/v1/devicetaintrule.go b/vendor/k8s.io/client-go/listers/resource/v1/devicetaintrule.go new file mode 100644 index 0000000000..150ca4f644 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/resource/v1/devicetaintrule.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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + resourcev1 "k8s.io/api/resource/v1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// DeviceTaintRuleLister helps list DeviceTaintRules. +// All objects returned here must be treated as read-only. +type DeviceTaintRuleLister interface { + // List lists all DeviceTaintRules in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*resourcev1.DeviceTaintRule, err error) + // Get retrieves the DeviceTaintRule from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*resourcev1.DeviceTaintRule, error) + DeviceTaintRuleListerExpansion +} + +// deviceTaintRuleLister implements the DeviceTaintRuleLister interface. +type deviceTaintRuleLister struct { + listers.ResourceIndexer[*resourcev1.DeviceTaintRule] +} + +// NewDeviceTaintRuleLister returns a new DeviceTaintRuleLister. +func NewDeviceTaintRuleLister(indexer cache.Indexer) DeviceTaintRuleLister { + return &deviceTaintRuleLister{listers.New[*resourcev1.DeviceTaintRule](indexer, resourcev1.Resource("devicetaintrule"))} +} diff --git a/vendor/k8s.io/client-go/listers/resource/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/resource/v1/expansion_generated.go index 6e6e22dcd5..53e789fee6 100644 --- a/vendor/k8s.io/client-go/listers/resource/v1/expansion_generated.go +++ b/vendor/k8s.io/client-go/listers/resource/v1/expansion_generated.go @@ -22,6 +22,10 @@ package v1 // DeviceClassLister. type DeviceClassListerExpansion interface{} +// DeviceTaintRuleListerExpansion allows custom methods to be added to +// DeviceTaintRuleLister. +type DeviceTaintRuleListerExpansion interface{} + // ResourceClaimListerExpansion allows custom methods to be added to // ResourceClaimLister. type ResourceClaimListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1alpha3/compositepodgroup.go b/vendor/k8s.io/client-go/listers/scheduling/v1alpha3/compositepodgroup.go new file mode 100644 index 0000000000..b5cfe9752f --- /dev/null +++ b/vendor/k8s.io/client-go/listers/scheduling/v1alpha3/compositepodgroup.go @@ -0,0 +1,70 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// CompositePodGroupLister helps list CompositePodGroups. +// All objects returned here must be treated as read-only. +type CompositePodGroupLister interface { + // List lists all CompositePodGroups in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*schedulingv1alpha3.CompositePodGroup, err error) + // CompositePodGroups returns an object that can list and get CompositePodGroups. + CompositePodGroups(namespace string) CompositePodGroupNamespaceLister + CompositePodGroupListerExpansion +} + +// compositePodGroupLister implements the CompositePodGroupLister interface. +type compositePodGroupLister struct { + listers.ResourceIndexer[*schedulingv1alpha3.CompositePodGroup] +} + +// NewCompositePodGroupLister returns a new CompositePodGroupLister. +func NewCompositePodGroupLister(indexer cache.Indexer) CompositePodGroupLister { + return &compositePodGroupLister{listers.New[*schedulingv1alpha3.CompositePodGroup](indexer, schedulingv1alpha3.Resource("compositepodgroup"))} +} + +// CompositePodGroups returns an object that can list and get CompositePodGroups. +func (s *compositePodGroupLister) CompositePodGroups(namespace string) CompositePodGroupNamespaceLister { + return compositePodGroupNamespaceLister{listers.NewNamespaced[*schedulingv1alpha3.CompositePodGroup](s.ResourceIndexer, namespace)} +} + +// CompositePodGroupNamespaceLister helps list and get CompositePodGroups. +// All objects returned here must be treated as read-only. +type CompositePodGroupNamespaceLister interface { + // List lists all CompositePodGroups in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*schedulingv1alpha3.CompositePodGroup, err error) + // Get retrieves the CompositePodGroup from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*schedulingv1alpha3.CompositePodGroup, error) + CompositePodGroupNamespaceListerExpansion +} + +// compositePodGroupNamespaceLister implements the CompositePodGroupNamespaceLister +// interface. +type compositePodGroupNamespaceLister struct { + listers.ResourceIndexer[*schedulingv1alpha3.CompositePodGroup] +} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1alpha2/expansion_generated.go b/vendor/k8s.io/client-go/listers/scheduling/v1alpha3/expansion_generated.go similarity index 77% rename from vendor/k8s.io/client-go/listers/scheduling/v1alpha2/expansion_generated.go rename to vendor/k8s.io/client-go/listers/scheduling/v1alpha3/expansion_generated.go index 3a63d7891c..cd99f2d084 100644 --- a/vendor/k8s.io/client-go/listers/scheduling/v1alpha2/expansion_generated.go +++ b/vendor/k8s.io/client-go/listers/scheduling/v1alpha3/expansion_generated.go @@ -16,7 +16,15 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 + +// CompositePodGroupListerExpansion allows custom methods to be added to +// CompositePodGroupLister. +type CompositePodGroupListerExpansion interface{} + +// CompositePodGroupNamespaceListerExpansion allows custom methods to be added to +// CompositePodGroupNamespaceLister. +type CompositePodGroupNamespaceListerExpansion interface{} // PodGroupListerExpansion allows custom methods to be added to // PodGroupLister. diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1alpha2/podgroup.go b/vendor/k8s.io/client-go/listers/scheduling/v1alpha3/podgroup.go similarity index 80% rename from vendor/k8s.io/client-go/listers/scheduling/v1alpha2/podgroup.go rename to vendor/k8s.io/client-go/listers/scheduling/v1alpha3/podgroup.go index 292e5d62be..0215a7e39f 100644 --- a/vendor/k8s.io/client-go/listers/scheduling/v1alpha2/podgroup.go +++ b/vendor/k8s.io/client-go/listers/scheduling/v1alpha3/podgroup.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 import ( - schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" @@ -30,7 +30,7 @@ import ( type PodGroupLister interface { // List lists all PodGroups in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*schedulingv1alpha2.PodGroup, err error) + List(selector labels.Selector) (ret []*schedulingv1alpha3.PodGroup, err error) // PodGroups returns an object that can list and get PodGroups. PodGroups(namespace string) PodGroupNamespaceLister PodGroupListerExpansion @@ -38,17 +38,17 @@ type PodGroupLister interface { // podGroupLister implements the PodGroupLister interface. type podGroupLister struct { - listers.ResourceIndexer[*schedulingv1alpha2.PodGroup] + listers.ResourceIndexer[*schedulingv1alpha3.PodGroup] } // NewPodGroupLister returns a new PodGroupLister. func NewPodGroupLister(indexer cache.Indexer) PodGroupLister { - return &podGroupLister{listers.New[*schedulingv1alpha2.PodGroup](indexer, schedulingv1alpha2.Resource("podgroup"))} + return &podGroupLister{listers.New[*schedulingv1alpha3.PodGroup](indexer, schedulingv1alpha3.Resource("podgroup"))} } // PodGroups returns an object that can list and get PodGroups. func (s *podGroupLister) PodGroups(namespace string) PodGroupNamespaceLister { - return podGroupNamespaceLister{listers.NewNamespaced[*schedulingv1alpha2.PodGroup](s.ResourceIndexer, namespace)} + return podGroupNamespaceLister{listers.NewNamespaced[*schedulingv1alpha3.PodGroup](s.ResourceIndexer, namespace)} } // PodGroupNamespaceLister helps list and get PodGroups. @@ -56,15 +56,15 @@ func (s *podGroupLister) PodGroups(namespace string) PodGroupNamespaceLister { type PodGroupNamespaceLister interface { // List lists all PodGroups in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*schedulingv1alpha2.PodGroup, err error) + List(selector labels.Selector) (ret []*schedulingv1alpha3.PodGroup, err error) // Get retrieves the PodGroup from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*schedulingv1alpha2.PodGroup, error) + Get(name string) (*schedulingv1alpha3.PodGroup, error) PodGroupNamespaceListerExpansion } // podGroupNamespaceLister implements the PodGroupNamespaceLister // interface. type podGroupNamespaceLister struct { - listers.ResourceIndexer[*schedulingv1alpha2.PodGroup] + listers.ResourceIndexer[*schedulingv1alpha3.PodGroup] } diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1alpha2/workload.go b/vendor/k8s.io/client-go/listers/scheduling/v1alpha3/workload.go similarity index 80% rename from vendor/k8s.io/client-go/listers/scheduling/v1alpha2/workload.go rename to vendor/k8s.io/client-go/listers/scheduling/v1alpha3/workload.go index 9526da3b5a..4919ca4ad9 100644 --- a/vendor/k8s.io/client-go/listers/scheduling/v1alpha2/workload.go +++ b/vendor/k8s.io/client-go/listers/scheduling/v1alpha3/workload.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 import ( - schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" @@ -30,7 +30,7 @@ import ( type WorkloadLister interface { // List lists all Workloads in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*schedulingv1alpha2.Workload, err error) + List(selector labels.Selector) (ret []*schedulingv1alpha3.Workload, err error) // Workloads returns an object that can list and get Workloads. Workloads(namespace string) WorkloadNamespaceLister WorkloadListerExpansion @@ -38,17 +38,17 @@ type WorkloadLister interface { // workloadLister implements the WorkloadLister interface. type workloadLister struct { - listers.ResourceIndexer[*schedulingv1alpha2.Workload] + listers.ResourceIndexer[*schedulingv1alpha3.Workload] } // NewWorkloadLister returns a new WorkloadLister. func NewWorkloadLister(indexer cache.Indexer) WorkloadLister { - return &workloadLister{listers.New[*schedulingv1alpha2.Workload](indexer, schedulingv1alpha2.Resource("workload"))} + return &workloadLister{listers.New[*schedulingv1alpha3.Workload](indexer, schedulingv1alpha3.Resource("workload"))} } // Workloads returns an object that can list and get Workloads. func (s *workloadLister) Workloads(namespace string) WorkloadNamespaceLister { - return workloadNamespaceLister{listers.NewNamespaced[*schedulingv1alpha2.Workload](s.ResourceIndexer, namespace)} + return workloadNamespaceLister{listers.NewNamespaced[*schedulingv1alpha3.Workload](s.ResourceIndexer, namespace)} } // WorkloadNamespaceLister helps list and get Workloads. @@ -56,15 +56,15 @@ func (s *workloadLister) Workloads(namespace string) WorkloadNamespaceLister { type WorkloadNamespaceLister interface { // List lists all Workloads in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*schedulingv1alpha2.Workload, err error) + List(selector labels.Selector) (ret []*schedulingv1alpha3.Workload, err error) // Get retrieves the Workload from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*schedulingv1alpha2.Workload, error) + Get(name string) (*schedulingv1alpha3.Workload, error) WorkloadNamespaceListerExpansion } // workloadNamespaceLister implements the WorkloadNamespaceLister // interface. type workloadNamespaceLister struct { - listers.ResourceIndexer[*schedulingv1alpha2.Workload] + listers.ResourceIndexer[*schedulingv1alpha3.Workload] } diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/scheduling/v1beta1/expansion_generated.go index b806e8cf80..449ba455bb 100644 --- a/vendor/k8s.io/client-go/listers/scheduling/v1beta1/expansion_generated.go +++ b/vendor/k8s.io/client-go/listers/scheduling/v1beta1/expansion_generated.go @@ -18,6 +18,22 @@ limitations under the License. package v1beta1 +// PodGroupListerExpansion allows custom methods to be added to +// PodGroupLister. +type PodGroupListerExpansion interface{} + +// PodGroupNamespaceListerExpansion allows custom methods to be added to +// PodGroupNamespaceLister. +type PodGroupNamespaceListerExpansion interface{} + // PriorityClassListerExpansion allows custom methods to be added to // PriorityClassLister. type PriorityClassListerExpansion interface{} + +// WorkloadListerExpansion allows custom methods to be added to +// WorkloadLister. +type WorkloadListerExpansion interface{} + +// WorkloadNamespaceListerExpansion allows custom methods to be added to +// WorkloadNamespaceLister. +type WorkloadNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1beta1/podgroup.go b/vendor/k8s.io/client-go/listers/scheduling/v1beta1/podgroup.go new file mode 100644 index 0000000000..32ef1ac6eb --- /dev/null +++ b/vendor/k8s.io/client-go/listers/scheduling/v1beta1/podgroup.go @@ -0,0 +1,70 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// PodGroupLister helps list PodGroups. +// All objects returned here must be treated as read-only. +type PodGroupLister interface { + // List lists all PodGroups in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*schedulingv1beta1.PodGroup, err error) + // PodGroups returns an object that can list and get PodGroups. + PodGroups(namespace string) PodGroupNamespaceLister + PodGroupListerExpansion +} + +// podGroupLister implements the PodGroupLister interface. +type podGroupLister struct { + listers.ResourceIndexer[*schedulingv1beta1.PodGroup] +} + +// NewPodGroupLister returns a new PodGroupLister. +func NewPodGroupLister(indexer cache.Indexer) PodGroupLister { + return &podGroupLister{listers.New[*schedulingv1beta1.PodGroup](indexer, schedulingv1beta1.Resource("podgroup"))} +} + +// PodGroups returns an object that can list and get PodGroups. +func (s *podGroupLister) PodGroups(namespace string) PodGroupNamespaceLister { + return podGroupNamespaceLister{listers.NewNamespaced[*schedulingv1beta1.PodGroup](s.ResourceIndexer, namespace)} +} + +// PodGroupNamespaceLister helps list and get PodGroups. +// All objects returned here must be treated as read-only. +type PodGroupNamespaceLister interface { + // List lists all PodGroups in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*schedulingv1beta1.PodGroup, err error) + // Get retrieves the PodGroup from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*schedulingv1beta1.PodGroup, error) + PodGroupNamespaceListerExpansion +} + +// podGroupNamespaceLister implements the PodGroupNamespaceLister +// interface. +type podGroupNamespaceLister struct { + listers.ResourceIndexer[*schedulingv1beta1.PodGroup] +} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1beta1/workload.go b/vendor/k8s.io/client-go/listers/scheduling/v1beta1/workload.go new file mode 100644 index 0000000000..9f20d5a063 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/scheduling/v1beta1/workload.go @@ -0,0 +1,70 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// WorkloadLister helps list Workloads. +// All objects returned here must be treated as read-only. +type WorkloadLister interface { + // List lists all Workloads in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*schedulingv1beta1.Workload, err error) + // Workloads returns an object that can list and get Workloads. + Workloads(namespace string) WorkloadNamespaceLister + WorkloadListerExpansion +} + +// workloadLister implements the WorkloadLister interface. +type workloadLister struct { + listers.ResourceIndexer[*schedulingv1beta1.Workload] +} + +// NewWorkloadLister returns a new WorkloadLister. +func NewWorkloadLister(indexer cache.Indexer) WorkloadLister { + return &workloadLister{listers.New[*schedulingv1beta1.Workload](indexer, schedulingv1beta1.Resource("workload"))} +} + +// Workloads returns an object that can list and get Workloads. +func (s *workloadLister) Workloads(namespace string) WorkloadNamespaceLister { + return workloadNamespaceLister{listers.NewNamespaced[*schedulingv1beta1.Workload](s.ResourceIndexer, namespace)} +} + +// WorkloadNamespaceLister helps list and get Workloads. +// All objects returned here must be treated as read-only. +type WorkloadNamespaceLister interface { + // List lists all Workloads in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*schedulingv1beta1.Workload, err error) + // Get retrieves the Workload from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*schedulingv1beta1.Workload, error) + WorkloadNamespaceListerExpansion +} + +// workloadNamespaceLister implements the WorkloadNamespaceLister +// interface. +type workloadNamespaceLister struct { + listers.ResourceIndexer[*schedulingv1beta1.Workload] +} diff --git a/vendor/k8s.io/client-go/listers/storagemigration/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/storagemigration/v1/expansion_generated.go new file mode 100644 index 0000000000..324da1ffa6 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storagemigration/v1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// StorageVersionMigrationListerExpansion allows custom methods to be added to +// StorageVersionMigrationLister. +type StorageVersionMigrationListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/storagemigration/v1/storageversionmigration.go b/vendor/k8s.io/client-go/listers/storagemigration/v1/storageversionmigration.go new file mode 100644 index 0000000000..37f7afb073 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storagemigration/v1/storageversionmigration.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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + storagemigrationv1 "k8s.io/api/storagemigration/v1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// StorageVersionMigrationLister helps list StorageVersionMigrations. +// All objects returned here must be treated as read-only. +type StorageVersionMigrationLister interface { + // List lists all StorageVersionMigrations in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*storagemigrationv1.StorageVersionMigration, err error) + // Get retrieves the StorageVersionMigration from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*storagemigrationv1.StorageVersionMigration, error) + StorageVersionMigrationListerExpansion +} + +// storageVersionMigrationLister implements the StorageVersionMigrationLister interface. +type storageVersionMigrationLister struct { + listers.ResourceIndexer[*storagemigrationv1.StorageVersionMigration] +} + +// NewStorageVersionMigrationLister returns a new StorageVersionMigrationLister. +func NewStorageVersionMigrationLister(indexer cache.Indexer) StorageVersionMigrationLister { + return &storageVersionMigrationLister{listers.New[*storagemigrationv1.StorageVersionMigration](indexer, storagemigrationv1.Resource("storageversionmigration"))} +} diff --git a/vendor/k8s.io/client-go/openapi/OWNERS b/vendor/k8s.io/client-go/openapi/OWNERS index e610094242..8bea129e9a 100644 --- a/vendor/k8s.io/client-go/openapi/OWNERS +++ b/vendor/k8s.io/client-go/openapi/OWNERS @@ -1,4 +1,7 @@ # See the OWNERS docs at https://go.k8s.io/owners approvers: + - jpbetz + - api-approvers +emeritus_approvers: - apelisse diff --git a/vendor/k8s.io/client-go/openapi/cached/client.go b/vendor/k8s.io/client-go/openapi/cached/client.go index 17f63ed267..5ce47af6fb 100644 --- a/vendor/k8s.io/client-go/openapi/cached/client.go +++ b/vendor/k8s.io/client-go/openapi/cached/client.go @@ -17,34 +17,71 @@ limitations under the License. package cached import ( + "context" "sync" "k8s.io/client-go/openapi" ) -type client struct { - delegate openapi.Client +type Client struct { + delegate openapi.ClientWithContext once sync.Once - result map[string]openapi.GroupVersion + result map[string]openapi.GroupVersionWithContext err error } +var ( + //nolint:staticcheck // Intentionally using the old interface here. + _ openapi.Client = &Client{} + _ openapi.ClientWithContext = &Client{} +) + +// NewClientWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use NewClientWithContext instead. func NewClient(other openapi.Client) openapi.Client { - return &client{ + return newClient(openapi.ToClientWithContext(other)) +} + +func NewClientWithContext(other openapi.ClientWithContext) *Client { + return newClient(other) +} + +func newClient(other openapi.ClientWithContext) *Client { + return &Client{ delegate: other, } } -func (c *client) Paths() (map[string]openapi.GroupVersion, error) { +// PathsWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use PathsWithContext instead. +func (c *Client) Paths() (map[string]openapi.GroupVersion, error) { + // For efficiency reasons in the *WithContext case this is a map to + // openapi.GroupVersionWithContext. But we know that all entries + // also implement openapi.GroupVersion. + resultWithContext, err := c.PathsWithContext(context.Background()) + result := make(map[string]openapi.GroupVersion, len(resultWithContext)) + for key, entry := range resultWithContext { + result[key] = entry.(openapi.GroupVersion) + } + return result, err +} + +func (c *Client) PathsWithContext(ctx context.Context) (map[string]openapi.GroupVersionWithContext, error) { + if err := ctx.Err(); err != nil { + return nil, err + } + c.once.Do(func() { - uncached, err := c.delegate.Paths() + uncached, err := c.delegate.PathsWithContext(ctx) if err != nil { c.err = err return } - result := make(map[string]openapi.GroupVersion, len(uncached)) + result := make(map[string]openapi.GroupVersionWithContext, len(uncached)) for k, v := range uncached { result[k] = newGroupVersion(v) } diff --git a/vendor/k8s.io/client-go/openapi/cached/groupversion.go b/vendor/k8s.io/client-go/openapi/cached/groupversion.go index 73730c51be..94fe7f056b 100644 --- a/vendor/k8s.io/client-go/openapi/cached/groupversion.go +++ b/vendor/k8s.io/client-go/openapi/cached/groupversion.go @@ -17,30 +17,48 @@ limitations under the License. package cached import ( + "context" "sync" "k8s.io/client-go/openapi" ) type groupversion struct { - delegate openapi.GroupVersion + delegate openapi.GroupVersionWithContext lock sync.Mutex docs map[string]docInfo } +var ( + //nolint:staticcheck // Intentionally using the old interface here. + _ openapi.GroupVersion = &groupversion{} + _ openapi.GroupVersionWithContext = &groupversion{} +) + type docInfo struct { data []byte err error } -func newGroupVersion(delegate openapi.GroupVersion) *groupversion { +func newGroupVersion(delegate openapi.GroupVersionWithContext) *groupversion { return &groupversion{ delegate: delegate, } } +// SchemaWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use SchemaWithContext instead. func (g *groupversion) Schema(contentType string) ([]byte, error) { + return g.SchemaWithContext(context.Background(), contentType) +} + +func (g *groupversion) SchemaWithContext(ctx context.Context, contentType string) ([]byte, error) { + if err := ctx.Err(); err != nil { + return nil, err + } + g.lock.Lock() defer g.lock.Unlock() @@ -50,7 +68,7 @@ func (g *groupversion) Schema(contentType string) ([]byte, error) { g.docs = make(map[string]docInfo) } - cachedInfo.data, cachedInfo.err = g.delegate.Schema(contentType) + cachedInfo.data, cachedInfo.err = g.delegate.SchemaWithContext(ctx, contentType) g.docs[contentType] = cachedInfo } diff --git a/vendor/k8s.io/client-go/openapi/client.go b/vendor/k8s.io/client-go/openapi/client.go index d32895a2f5..6e9a55e848 100644 --- a/vendor/k8s.io/client-go/openapi/client.go +++ b/vendor/k8s.io/client-go/openapi/client.go @@ -25,25 +25,81 @@ import ( "k8s.io/kube-openapi/pkg/handler3" ) +// ClientWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ClientWithContext instead. type Client interface { Paths() (map[string]GroupVersion, error) } +type ClientWithContext interface { + PathsWithContext(ctx context.Context) (map[string]GroupVersionWithContext, error) +} + +func ToClientWithContext(c Client) ClientWithContext { + if c == nil { + return nil + } + if c, ok := c.(ClientWithContext); ok { + return c + } + return &clientWrapper{ + delegate: c, + } +} + +type clientWrapper struct { + delegate Client +} + +func (c *clientWrapper) PathsWithContext(ctx context.Context) (map[string]GroupVersionWithContext, error) { + resultWithoutContext, err := c.delegate.Paths() + result := make(map[string]GroupVersionWithContext, len(resultWithoutContext)) + for key, entry := range resultWithoutContext { + result[key] = ToGroupVersionWithContext(entry) + } + return result, err +} + type client struct { // URL includes the `hash` query param to take advantage of cache busting restClient rest.Interface } +// NewClientWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use NewClientWithContext instead. func NewClient(restClient rest.Interface) Client { + return newClient(restClient) +} + +func NewClientWithContext(restClient rest.Interface) ClientWithContext { + return newClient(restClient) +} + +func newClient(restClient rest.Interface) *client { return &client{ restClient: restClient, } } +// PathsWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use PathsWithContext instead. func (c *client) Paths() (map[string]GroupVersion, error) { + resultWithContext, err := c.PathsWithContext(context.Background()) + result := make(map[string]GroupVersion, len(resultWithContext)) + for key, entry := range resultWithContext { + // We know that this is a *groupversion which implements GroupVersion. + result[key] = entry.(GroupVersion) + } + return result, err +} + +func (c *client) PathsWithContext(ctx context.Context) (map[string]GroupVersionWithContext, error) { data, err := c.restClient.Get(). AbsPath("/openapi/v3"). - Do(context.TODO()). + Do(ctx). Raw() if err != nil { @@ -59,7 +115,7 @@ func (c *client) Paths() (map[string]GroupVersion, error) { // Calculate the client-side prefix for a "root" request rootPrefix := strings.TrimSuffix(c.restClient.Get().AbsPath("/").URL().Path, "/") // Create GroupVersions for each element of the result - result := map[string]GroupVersion{} + result := make(map[string]GroupVersionWithContext, len(discoMap.Paths)) for k, v := range discoMap.Paths { // Trim off the prefix that will always be added in client-side v.ServerRelativeURL = strings.TrimPrefix(v.ServerRelativeURL, rootPrefix) diff --git a/vendor/k8s.io/client-go/openapi/groupversion.go b/vendor/k8s.io/client-go/openapi/groupversion.go index 40d91b9a53..0e0b593990 100644 --- a/vendor/k8s.io/client-go/openapi/groupversion.go +++ b/vendor/k8s.io/client-go/openapi/groupversion.go @@ -25,6 +25,9 @@ import ( const ContentTypeOpenAPIV3PB = "application/com.github.proto-openapi.spec.v3@v1.0+protobuf" +// GroupVersionWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use GroupVersionWithContext instead. type GroupVersion interface { Schema(contentType string) ([]byte, error) @@ -35,22 +38,61 @@ type GroupVersion interface { ServerRelativeURL() string } +type GroupVersionWithContext interface { + SchemaWithContext(ctx context.Context, contentType string) ([]byte, error) + + // ServerRelativeURL. Returns the path and parameters used to fetch the schema. + // You should use the Schema method to fetch it, but this value can be used + // to key the current version of the schema in a cache since it contains a + // hash string which changes upon schema update. + ServerRelativeURL() string +} + +func ToGroupVersionWithContext(gv GroupVersion) GroupVersionWithContext { + if gv == nil { + return nil + } + if gv, ok := gv.(GroupVersionWithContext); ok { + return gv + } + return &groupVersionWrapper{ + GroupVersion: gv, + } +} + +type groupVersionWrapper struct { + GroupVersion +} + +func (gv *groupVersionWrapper) SchemaWithContext(ctx context.Context, contentType string) ([]byte, error) { + return gv.Schema(contentType) +} + type groupversion struct { client *client item handler3.OpenAPIV3DiscoveryGroupVersion useClientPrefix bool } +var ( + _ GroupVersion = &groupversion{} + _ GroupVersionWithContext = &groupversion{} +) + func newGroupVersion(client *client, item handler3.OpenAPIV3DiscoveryGroupVersion, useClientPrefix bool) *groupversion { return &groupversion{client: client, item: item, useClientPrefix: useClientPrefix} } func (g *groupversion) Schema(contentType string) ([]byte, error) { + return g.SchemaWithContext(context.Background(), contentType) +} + +func (g *groupversion) SchemaWithContext(ctx context.Context, contentType string) ([]byte, error) { if !g.useClientPrefix { return g.client.restClient.Get(). RequestURI(g.item.ServerRelativeURL). SetHeader("Accept", contentType). - Do(context.TODO()). + Do(ctx). Raw() } @@ -72,7 +114,7 @@ func (g *groupversion) Schema(contentType string) ([]byte, error) { } } - return path.Do(context.TODO()).Raw() + return path.Do(ctx).Raw() } // URL used for fetching the schema. The URL includes a hash and can be used diff --git a/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/types.go b/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/types.go index b9082e8145..6e0c84aeab 100644 --- a/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/types.go +++ b/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/types.go @@ -26,7 +26,7 @@ import ( // ExecCredential is used by exec-based plugins to communicate credentials to // HTTP transports. type ExecCredential struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Spec holds information passed to the plugin by the transport. Spec ExecCredentialSpec `json:"spec,omitempty"` diff --git a/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/zz_generated.conversion.go b/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/zz_generated.conversion.go index 9c3f63fca8..bec865c481 100644 --- a/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/zz_generated.conversion.go +++ b/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/zz_generated.conversion.go @@ -24,7 +24,6 @@ package v1 import ( unsafe "unsafe" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" conversion "k8s.io/apimachinery/pkg/conversion" runtime "k8s.io/apimachinery/pkg/runtime" clientauthentication "k8s.io/client-go/pkg/apis/clientauthentication" @@ -181,10 +180,7 @@ func Convert_clientauthentication_ExecCredentialSpec_To_v1_ExecCredentialSpec(in } func autoConvert_v1_ExecCredentialStatus_To_clientauthentication_ExecCredentialStatus(in *ExecCredentialStatus, out *clientauthentication.ExecCredentialStatus, s conversion.Scope) error { - out.ExpirationTimestamp = (*metav1.Time)(unsafe.Pointer(in.ExpirationTimestamp)) - out.Token = in.Token - out.ClientCertificateData = in.ClientCertificateData - out.ClientKeyData = in.ClientKeyData + *out = *(*clientauthentication.ExecCredentialStatus)(unsafe.Pointer(in)) return nil } @@ -194,10 +190,7 @@ func Convert_v1_ExecCredentialStatus_To_clientauthentication_ExecCredentialStatu } func autoConvert_clientauthentication_ExecCredentialStatus_To_v1_ExecCredentialStatus(in *clientauthentication.ExecCredentialStatus, out *ExecCredentialStatus, s conversion.Scope) error { - out.ExpirationTimestamp = (*metav1.Time)(unsafe.Pointer(in.ExpirationTimestamp)) - out.Token = in.Token - out.ClientCertificateData = in.ClientCertificateData - out.ClientKeyData = in.ClientKeyData + *out = *(*ExecCredentialStatus)(unsafe.Pointer(in)) return nil } diff --git a/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/types.go b/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/types.go index 918eb11e14..d2f2b50791 100644 --- a/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/types.go +++ b/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/types.go @@ -26,7 +26,7 @@ import ( // ExecCredential is used by exec-based plugins to communicate credentials to // HTTP transports. type ExecCredential struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:""` // Spec holds information passed to the plugin by the transport. Spec ExecCredentialSpec `json:"spec,omitempty"` diff --git a/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/zz_generated.conversion.go b/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/zz_generated.conversion.go index 5372da1513..4e7be35154 100644 --- a/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/zz_generated.conversion.go +++ b/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/zz_generated.conversion.go @@ -24,7 +24,6 @@ package v1beta1 import ( unsafe "unsafe" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" conversion "k8s.io/apimachinery/pkg/conversion" runtime "k8s.io/apimachinery/pkg/runtime" clientauthentication "k8s.io/client-go/pkg/apis/clientauthentication" @@ -181,10 +180,7 @@ func Convert_clientauthentication_ExecCredentialSpec_To_v1beta1_ExecCredentialSp } func autoConvert_v1beta1_ExecCredentialStatus_To_clientauthentication_ExecCredentialStatus(in *ExecCredentialStatus, out *clientauthentication.ExecCredentialStatus, s conversion.Scope) error { - out.ExpirationTimestamp = (*v1.Time)(unsafe.Pointer(in.ExpirationTimestamp)) - out.Token = in.Token - out.ClientCertificateData = in.ClientCertificateData - out.ClientKeyData = in.ClientKeyData + *out = *(*clientauthentication.ExecCredentialStatus)(unsafe.Pointer(in)) return nil } @@ -194,10 +190,7 @@ func Convert_v1beta1_ExecCredentialStatus_To_clientauthentication_ExecCredential } func autoConvert_clientauthentication_ExecCredentialStatus_To_v1beta1_ExecCredentialStatus(in *clientauthentication.ExecCredentialStatus, out *ExecCredentialStatus, s conversion.Scope) error { - out.ExpirationTimestamp = (*v1.Time)(unsafe.Pointer(in.ExpirationTimestamp)) - out.Token = in.Token - out.ClientCertificateData = in.ClientCertificateData - out.ClientKeyData = in.ClientKeyData + *out = *(*ExecCredentialStatus)(unsafe.Pointer(in)) return nil } diff --git a/vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go b/vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go index b2393f4dd3..60f9da50d8 100644 --- a/vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go +++ b/vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go @@ -159,6 +159,7 @@ func (s *sometimes) Do(f func()) { // GetAuthenticator returns an exec-based plugin for providing client credentials. func GetAuthenticator(config *api.ExecConfig, cluster *clientauthentication.Cluster) (*Authenticator, error) { + metrics.EnsureRegistered() return newAuthenticator(globalCache, term.IsTerminal, config, cluster) } diff --git a/vendor/k8s.io/client-go/rest/OWNERS b/vendor/k8s.io/client-go/rest/OWNERS index 7b23294c45..c057852b75 100644 --- a/vendor/k8s.io/client-go/rest/OWNERS +++ b/vendor/k8s.io/client-go/rest/OWNERS @@ -3,7 +3,6 @@ reviewers: - thockin - smarterclayton - - caesarxuchao - wojtek-t - deads2k - liggitt diff --git a/vendor/k8s.io/client-go/rest/client.go b/vendor/k8s.io/client-go/rest/client.go index a085c334f9..d92c1b647e 100644 --- a/vendor/k8s.io/client-go/rest/client.go +++ b/vendor/k8s.io/client-go/rest/client.go @@ -32,6 +32,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" clientfeatures "k8s.io/client-go/features" + "k8s.io/client-go/tools/metrics" "k8s.io/client-go/util/flowcontrol" ) @@ -110,6 +111,8 @@ type RESTClient struct { // NewRESTClient creates a new RESTClient. This client performs generic REST functions // such as Get, Put, Post, and Delete on specified paths. func NewRESTClient(baseURL *url.URL, versionedAPIPath string, config ClientContentConfig, rateLimiter flowcontrol.RateLimiter, client *http.Client) (*RESTClient, error) { + metrics.EnsureRegistered() + base := *baseURL if !strings.HasSuffix(base.Path, "/") { base.Path += "/" diff --git a/vendor/k8s.io/client-go/rest/config.go b/vendor/k8s.io/client-go/rest/config.go index 82d4f7136a..3d4fb720c4 100644 --- a/vendor/k8s.io/client-go/rest/config.go +++ b/vendor/k8s.io/client-go/rest/config.go @@ -37,6 +37,7 @@ import ( "k8s.io/client-go/features" "k8s.io/client-go/pkg/version" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" + "k8s.io/client-go/tools/metrics" "k8s.io/client-go/transport" certutil "k8s.io/client-go/util/cert" "k8s.io/client-go/util/flowcontrol" @@ -355,6 +356,8 @@ func RESTClientFor(config *Config) (*RESTClient, error) { // Note that the http client takes precedence over the transport values configured. // The http client defaults to the `http.DefaultClient` if nil. func RESTClientForConfigAndClient(config *Config, httpClient *http.Client) (*RESTClient, error) { + metrics.EnsureRegistered() + if config.GroupVersion == nil { return nil, fmt.Errorf("GroupVersion is required when initializing a RESTClient") } diff --git a/vendor/k8s.io/client-go/rest/request.go b/vendor/k8s.io/client-go/rest/request.go index fb57216927..fe3c066729 100644 --- a/vendor/k8s.io/client-go/rest/request.go +++ b/vendor/k8s.io/client-go/rest/request.go @@ -20,6 +20,7 @@ import ( "bytes" "context" "encoding/hex" + stderrors "errors" "fmt" "io" "mime" @@ -671,7 +672,8 @@ func (r *Request) tryThrottleWithInfo(ctx context.Context, retryInfo string) err now := time.Now() err := r.rateLimiter.Wait(ctx) - if err != nil { + // Don't wrap context errors as caller initiated ctx cancellations is not a rate limiter error. + if err != nil && !stderrors.Is(err, context.Canceled) && !stderrors.Is(err, context.DeadlineExceeded) { err = fmt.Errorf("client rate limiter Wait returned an error: %w", err) } latency := time.Since(now) diff --git a/vendor/k8s.io/client-go/rest/transport.go b/vendor/k8s.io/client-go/rest/transport.go index 53f986cbf3..c958240401 100644 --- a/vendor/k8s.io/client-go/rest/transport.go +++ b/vendor/k8s.io/client-go/rest/transport.go @@ -23,6 +23,7 @@ import ( "k8s.io/client-go/pkg/apis/clientauthentication" "k8s.io/client-go/plugin/pkg/client/auth/exec" + "k8s.io/client-go/tools/metrics" "k8s.io/client-go/transport" ) @@ -82,6 +83,7 @@ func HTTPWrappersForConfig(config *Config, rt http.RoundTripper) (http.RoundTrip // TransportConfig converts a client config to an appropriate transport config. func (c *Config) TransportConfig() (*transport.Config, error) { + metrics.EnsureRegistered() conf := &transport.Config{ UserAgent: c.UserAgent, Transport: c.Transport, diff --git a/vendor/k8s.io/client-go/restmapper/category_expansion.go b/vendor/k8s.io/client-go/restmapper/category_expansion.go index 484e4c8393..265cc7c6a5 100644 --- a/vendor/k8s.io/client-go/restmapper/category_expansion.go +++ b/vendor/k8s.io/client-go/restmapper/category_expansion.go @@ -17,38 +17,97 @@ limitations under the License. package restmapper import ( + "context" + "iter" + "slices" + "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/discovery" ) // CategoryExpander maps category strings to GroupResources. // Categories are classification or 'tag' of a group of resources. +// +// CategoryExpanderWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use CategoryExpanderWithContext instead. type CategoryExpander interface { Expand(category string) ([]schema.GroupResource, bool) } -// SimpleCategoryExpander implements CategoryExpander interface +// CategoryExpanderWithContext maps category strings to GroupResources. +// Categories are classification or 'tag' of a group of resources. +type CategoryExpanderWithContext interface { + ExpandWithContext(ctx context.Context, category string) ([]schema.GroupResource, bool) +} + +func ToCategoryExpanderWithContext(c CategoryExpander) CategoryExpanderWithContext { + if c == nil { + return nil + } + if c, ok := c.(CategoryExpanderWithContext); ok { + return c + } + return &categoryExpanderWrapper{ + delegate: c, + } +} + +type categoryExpanderWrapper struct { + delegate CategoryExpander +} + +func (c *categoryExpanderWrapper) ExpandWithContext(ctx context.Context, category string) ([]schema.GroupResource, bool) { + return c.delegate.Expand(category) +} + +// SimpleCategoryExpander implements CategoryExpander and CategoryExpanderWithContext interface // using a static mapping of categories to GroupResource mapping. type SimpleCategoryExpander struct { Expansions map[string][]schema.GroupResource } +var ( + _ CategoryExpander = SimpleCategoryExpander{} + _ CategoryExpanderWithContext = SimpleCategoryExpander{} +) + // Expand fulfills CategoryExpander func (e SimpleCategoryExpander) Expand(category string) ([]schema.GroupResource, bool) { ret, ok := e.Expansions[category] return ret, ok } +// ExpandWithContext fulfills CategoryExpanderWithContext +func (e SimpleCategoryExpander) ExpandWithContext(ctx context.Context, category string) ([]schema.GroupResource, bool) { + return e.Expand(category) +} + // discoveryCategoryExpander struct lets a REST Client wrapper (discoveryClient) to retrieve list of APIResourceList, // and then convert to fallbackExpander type discoveryCategoryExpander struct { - discoveryClient discovery.DiscoveryInterface + discoveryClient discovery.DiscoveryInterfaceWithContext } // NewDiscoveryCategoryExpander returns a category expander that makes use of the "categories" fields from // the API, found through the discovery client. In case of any error or no category found (which likely // means we're at a cluster prior to categories support, fallback to the expander provided. +// +// NewDiscoveryCategoryExpanderWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use NewDiscoveryCategoryExpanderWithContext instead. func NewDiscoveryCategoryExpander(client discovery.DiscoveryInterface) CategoryExpander { + return newDiscoveryCategoryExpander(discovery.ToDiscoveryInterfaceWithContext(client)) +} + +// NewDiscoveryCategoryExpanderWithContext returns a category expander that makes use of the "categories" fields from +// the API, found through the discovery client. In case of any error or no category found (which likely +// means we're at a cluster prior to categories support, fallback to the expander provided. +func NewDiscoveryCategoryExpanderWithContext(client discovery.DiscoveryInterfaceWithContext) CategoryExpanderWithContext { + return newDiscoveryCategoryExpander(client) +} + +func newDiscoveryCategoryExpander(client discovery.DiscoveryInterfaceWithContext) discoveryCategoryExpander { if client == nil { panic("Please provide discovery client to shortcut expander") } @@ -56,9 +115,18 @@ func NewDiscoveryCategoryExpander(client discovery.DiscoveryInterface) CategoryE } // Expand fulfills CategoryExpander +// +// ExpandWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ExpandWithContext instead. func (e discoveryCategoryExpander) Expand(category string) ([]schema.GroupResource, bool) { + return e.ExpandWithContext(context.Background(), category) +} + +// ExpandWithContext fulfills CategoryExpanderWithContext +func (e discoveryCategoryExpander) ExpandWithContext(ctx context.Context, category string) ([]schema.GroupResource, bool) { // Get all supported resources for groups and versions from server, if no resource found, fallback anyway. - _, apiResourceLists, _ := e.discoveryClient.ServerGroupsAndResources() + _, apiResourceLists, _ := e.discoveryClient.ServerGroupsAndResourcesWithContext(ctx) if len(apiResourceLists) == 0 { return nil, false } @@ -89,16 +157,43 @@ func (e discoveryCategoryExpander) Expand(category string) ([]schema.GroupResour // UnionCategoryExpander implements CategoryExpander interface. // It maps given category string to union of expansions returned by all the CategoryExpanders in the list. +// +// UnionCategoryExpanderWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use UnionCategoryExpanderWithContext instead. type UnionCategoryExpander []CategoryExpander +var _ CategoryExpander = UnionCategoryExpander{} + // Expand fulfills CategoryExpander func (u UnionCategoryExpander) Expand(category string) ([]schema.GroupResource, bool) { + return unionExpand(context.Background(), func(yield func(i int, expander CategoryExpanderWithContext) bool) { + for i, expander := range u { + if !yield(i, ToCategoryExpanderWithContext(expander)) { + break + } + } + }, category) +} + +// UnionCategoryExpanderWithContext implements CategoryExpanderWithContext interface. +// It maps given category string to union of expansions returned by all the CategoryExpanders in the list. +type UnionCategoryExpanderWithContext []CategoryExpanderWithContext + +var _ CategoryExpanderWithContext = UnionCategoryExpanderWithContext{} + +// ExpandWithContext fulfills CategoryExpanderWithContext +func (u UnionCategoryExpanderWithContext) ExpandWithContext(ctx context.Context, category string) ([]schema.GroupResource, bool) { + return unionExpand(ctx, slices.All(u), category) +} + +func unionExpand(ctx context.Context, expanders iter.Seq2[int, CategoryExpanderWithContext], category string) ([]schema.GroupResource, bool) { ret := []schema.GroupResource{} ok := false // Expand the category for each CategoryExpander in the list and merge/combine the results. - for _, expansion := range u { - curr, currOk := expansion.Expand(category) + for _, expansion := range expanders { + curr, currOk := expansion.ExpandWithContext(ctx, category) for _, currGR := range curr { found := false diff --git a/vendor/k8s.io/client-go/restmapper/discovery.go b/vendor/k8s.io/client-go/restmapper/discovery.go index 3505178b66..9457cccd3f 100644 --- a/vendor/k8s.io/client-go/restmapper/discovery.go +++ b/vendor/k8s.io/client-go/restmapper/discovery.go @@ -17,6 +17,7 @@ limitations under the License. package restmapper import ( + "context" "fmt" "strings" "sync" @@ -40,8 +41,40 @@ type APIGroupResources struct { // NewDiscoveryRESTMapper returns a PriorityRESTMapper based on the discovered // groups and resources passed in. +// +// NewDiscoveryRESTMapperWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use NewDiscoveryRESTMapperWithContext instead. func NewDiscoveryRESTMapper(groupResources []*APIGroupResources) meta.RESTMapper { - unionMapper := meta.MultiRESTMapper{} + mappers, resourcePriority, kindPriority := newDiscoveryRESTMapper(groupResources) + multiMapper := make(meta.MultiRESTMapper, len(mappers)) + for i, m := range mappers { + multiMapper[i] = m + } + return &meta.PriorityRESTMapper{ + Delegate: multiMapper, + ResourcePriority: resourcePriority, + KindPriority: kindPriority, + } +} + +// NewDiscoveryRESTMapperWithContext returns a PriorityRESTMapper based on the discovered +// groups and resources passed in. +func NewDiscoveryRESTMapperWithContext(groupResources []*APIGroupResources) meta.RESTMapperWithContext { + mappers, resourcePriority, kindPriority := newDiscoveryRESTMapper(groupResources) + multiMapper := make(meta.MultiRESTMapperWithContext, len(mappers)) + for i, m := range mappers { + multiMapper[i] = m + } + return &meta.PriorityRESTMapperWithContext{ + Delegate: multiMapper, + ResourcePriority: resourcePriority, + KindPriority: kindPriority, + } +} + +func newDiscoveryRESTMapper(groupResources []*APIGroupResources) ([]*meta.DefaultRESTMapper, []schema.GroupVersionResource, []schema.GroupVersionKind) { + var unionMapper []*meta.DefaultRESTMapper var groupPriority []string // /v1 is special. It should always come first @@ -135,17 +168,23 @@ func NewDiscoveryRESTMapper(groupResources []*APIGroupResources) meta.RESTMapper }) } - return meta.PriorityRESTMapper{ - Delegate: unionMapper, - ResourcePriority: resourcePriority, - KindPriority: kindPriority, - } + return unionMapper, resourcePriority, kindPriority } // GetAPIGroupResources uses the provided discovery client to gather // discovery information and populate a slice of APIGroupResources. +// +// GetAPIGroupResourcesWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use GetAPIGroupResourcesWithContext instead. func GetAPIGroupResources(cl discovery.DiscoveryInterface) ([]*APIGroupResources, error) { - gs, rs, err := cl.ServerGroupsAndResources() + return GetAPIGroupResourcesWithContext(context.Background(), discovery.ToDiscoveryInterfaceWithContext(cl)) +} + +// GetAPIGroupResourcesWithContext uses the provided discovery client to gather +// discovery information and populate a slice of APIGroupResources. +func GetAPIGroupResourcesWithContext(ctx context.Context, cl discovery.DiscoveryInterfaceWithContext) ([]*APIGroupResources, error) { + gs, rs, err := cl.ServerGroupsAndResourcesWithContext(ctx) if rs == nil || gs == nil { return nil, err // TODO track the errors and update callers to handle partial errors. @@ -173,25 +212,45 @@ func GetAPIGroupResources(cl discovery.DiscoveryInterface) ([]*APIGroupResources return result, nil } -// DeferredDiscoveryRESTMapper is a RESTMapper that will defer +// DeferredDiscoveryRESTMapper is a RESTMapper and RESTMapperContext that will defer // initialization of the RESTMapper until the first mapping is // requested. type DeferredDiscoveryRESTMapper struct { initMu sync.Mutex - delegate meta.RESTMapper - cl discovery.CachedDiscoveryInterface + delegate meta.RESTMapperWithContext + cl discovery.CachedDiscoveryInterfaceWithContext } +var ( + //nolint:staticcheck // Intentionally using the old interface here. + _ meta.ResettableRESTMapper = &DeferredDiscoveryRESTMapper{} + _ meta.ResettableRESTMapperWithContext = &DeferredDiscoveryRESTMapper{} + _ fmt.Stringer = &DeferredDiscoveryRESTMapper{} +) + // NewDeferredDiscoveryRESTMapper returns a // DeferredDiscoveryRESTMapper that will lazily query the provided // client for discovery information to do REST mappings. +// +// NewDeferredDiscoveryRESTMapperWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use NewDeferredDiscoveryRESTMapperWithContext instead. NewDeferredDiscoveryRESTMapper will try to convert cl to discovery.CachedDiscoveryInterfaceWithContext and use a wrapper if that is not possible, but NewDeferredDiscoveryRESTMapperWithContext ensures that no such conversion is necessary. func NewDeferredDiscoveryRESTMapper(cl discovery.CachedDiscoveryInterface) *DeferredDiscoveryRESTMapper { + return &DeferredDiscoveryRESTMapper{ + cl: discovery.ToCachedDiscoveryInterfaceWithContext(cl), + } +} + +// NewDeferredDiscoveryRESTMapperWithContext returns a +// DeferredDiscoveryRESTMapper that will lazily query the provided +// client for discovery information to do REST mappings. +func NewDeferredDiscoveryRESTMapperWithContext(cl discovery.CachedDiscoveryInterfaceWithContext) *DeferredDiscoveryRESTMapper { return &DeferredDiscoveryRESTMapper{ cl: cl, } } -func (d *DeferredDiscoveryRESTMapper) getDelegate() (meta.RESTMapper, error) { +func (d *DeferredDiscoveryRESTMapper) getDelegate(ctx context.Context) (meta.RESTMapperWithContext, error) { d.initMu.Lock() defer d.initMu.Unlock() @@ -199,98 +258,154 @@ func (d *DeferredDiscoveryRESTMapper) getDelegate() (meta.RESTMapper, error) { return d.delegate, nil } - groupResources, err := GetAPIGroupResources(d.cl) + groupResources, err := GetAPIGroupResourcesWithContext(ctx, d.cl) if err != nil { return nil, err } - d.delegate = NewDiscoveryRESTMapper(groupResources) + d.delegate = NewDiscoveryRESTMapperWithContext(groupResources) return d.delegate, nil } // Reset resets the internally cached Discovery information and will // cause the next mapping request to re-discover. func (d *DeferredDiscoveryRESTMapper) Reset() { - klog.V(5).Info("Invalidating discovery information") + d.ResetWithContext(context.Background()) +} + +// ResetWithContext resets the internally cached Discovery information and will +// cause the next mapping request to re-discover. +func (d *DeferredDiscoveryRESTMapper) ResetWithContext(ctx context.Context) { + klog.FromContext(ctx).V(5).Info("Invalidating discovery information") d.initMu.Lock() defer d.initMu.Unlock() - d.cl.Invalidate() + d.cl.InvalidateWithContext(ctx) d.delegate = nil } // KindFor takes a partial resource and returns back the single match. // It returns an error if there are multiple matches. +// +// KindForWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use KindForWithContext instead. func (d *DeferredDiscoveryRESTMapper) KindFor(resource schema.GroupVersionResource) (gvk schema.GroupVersionKind, err error) { - del, err := d.getDelegate() + return d.KindForWithContext(context.Background(), resource) +} + +// KindForWithContext takes a partial resource and returns back the single match. +// It returns an error if there are multiple matches. +func (d *DeferredDiscoveryRESTMapper) KindForWithContext(ctx context.Context, resource schema.GroupVersionResource) (gvk schema.GroupVersionKind, err error) { + del, err := d.getDelegate(ctx) if err != nil { return schema.GroupVersionKind{}, err } - gvk, err = del.KindFor(resource) - if err != nil && !d.cl.Fresh() { - d.Reset() - gvk, err = d.KindFor(resource) + gvk, err = del.KindForWithContext(ctx, resource) + if err != nil && !d.cl.FreshWithContext(ctx) { + d.ResetWithContext(ctx) + gvk, err = d.KindForWithContext(ctx, resource) } return } // KindsFor takes a partial resource and returns back the list of // potential kinds in priority order. +// +// KindsForWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use KindsForWithContext instead. func (d *DeferredDiscoveryRESTMapper) KindsFor(resource schema.GroupVersionResource) (gvks []schema.GroupVersionKind, err error) { - del, err := d.getDelegate() + return d.KindsForWithContext(context.Background(), resource) +} + +// KindsForWithContext takes a partial resource and returns back the list of +// potential kinds in priority order. +func (d *DeferredDiscoveryRESTMapper) KindsForWithContext(ctx context.Context, resource schema.GroupVersionResource) (gvks []schema.GroupVersionKind, err error) { + del, err := d.getDelegate(ctx) if err != nil { return nil, err } - gvks, err = del.KindsFor(resource) - if len(gvks) == 0 && !d.cl.Fresh() { - d.Reset() - gvks, err = d.KindsFor(resource) + gvks, err = del.KindsForWithContext(ctx, resource) + if len(gvks) == 0 && !d.cl.FreshWithContext(ctx) { + d.ResetWithContext(ctx) + gvks, err = d.KindsForWithContext(ctx, resource) } return } // ResourceFor takes a partial resource and returns back the single // match. It returns an error if there are multiple matches. +// +// ResourceForWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ResourceForWithContext instead. func (d *DeferredDiscoveryRESTMapper) ResourceFor(input schema.GroupVersionResource) (gvr schema.GroupVersionResource, err error) { - del, err := d.getDelegate() + return d.ResourceForWithContext(context.Background(), input) +} + +// ResourceForWithContext takes a partial resource and returns back the single +// match. It returns an error if there are multiple matches. +func (d *DeferredDiscoveryRESTMapper) ResourceForWithContext(ctx context.Context, input schema.GroupVersionResource) (gvr schema.GroupVersionResource, err error) { + del, err := d.getDelegate(ctx) if err != nil { return schema.GroupVersionResource{}, err } - gvr, err = del.ResourceFor(input) - if err != nil && !d.cl.Fresh() { - d.Reset() - gvr, err = d.ResourceFor(input) + gvr, err = del.ResourceForWithContext(ctx, input) + if err != nil && !d.cl.FreshWithContext(ctx) { + d.ResetWithContext(ctx) + gvr, err = d.ResourceForWithContext(ctx, input) } return } // ResourcesFor takes a partial resource and returns back the list of // potential resource in priority order. +// +// ResourcesForWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ResourcesForWithContext instead. func (d *DeferredDiscoveryRESTMapper) ResourcesFor(input schema.GroupVersionResource) (gvrs []schema.GroupVersionResource, err error) { - del, err := d.getDelegate() + return d.ResourcesForWithContext(context.Background(), input) +} + +// ResourcesForWithContext takes a partial resource and returns back the list of +// potential resource in priority order. +func (d *DeferredDiscoveryRESTMapper) ResourcesForWithContext(ctx context.Context, input schema.GroupVersionResource) (gvrs []schema.GroupVersionResource, err error) { + del, err := d.getDelegate(ctx) if err != nil { return nil, err } - gvrs, err = del.ResourcesFor(input) - if len(gvrs) == 0 && !d.cl.Fresh() { - d.Reset() - gvrs, err = d.ResourcesFor(input) + gvrs, err = del.ResourcesForWithContext(ctx, input) + if len(gvrs) == 0 && !d.cl.FreshWithContext(ctx) { + d.ResetWithContext(ctx) + gvrs, err = d.ResourcesForWithContext(ctx, input) } return } // RESTMapping identifies a preferred resource mapping for the // provided group kind. +// +// RESTMappingWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use RESTMappingWithContext instead. func (d *DeferredDiscoveryRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (m *meta.RESTMapping, err error) { - del, err := d.getDelegate() + return d.RESTMappingWithContext(context.Background(), gk, versions...) +} + +// RESTMappingWithContext identifies a preferred resource mapping for the +// provided group kind. +func (d *DeferredDiscoveryRESTMapper) RESTMappingWithContext(ctx context.Context, gk schema.GroupKind, versions ...string) (m *meta.RESTMapping, err error) { + del, err := d.getDelegate(ctx) if err != nil { return nil, err } - m, err = del.RESTMapping(gk, versions...) - if err != nil && !d.cl.Fresh() { - d.Reset() - m, err = d.RESTMapping(gk, versions...) + m, err = del.RESTMappingWithContext(ctx, gk, versions...) + if err != nil && !d.cl.FreshWithContext(ctx) { + d.ResetWithContext(ctx) + m, err = d.RESTMappingWithContext(ctx, gk, versions...) } return } @@ -298,41 +413,59 @@ func (d *DeferredDiscoveryRESTMapper) RESTMapping(gk schema.GroupKind, versions // RESTMappings returns the RESTMappings for the provided group kind // in a rough internal preferred order. If no kind is found, it will // return a NoResourceMatchError. +// +// RESTMappingsWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use RESTMappingsWithContext instead. func (d *DeferredDiscoveryRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) (ms []*meta.RESTMapping, err error) { - del, err := d.getDelegate() + return d.RESTMappingsWithContext(context.Background(), gk, versions...) +} + +// RESTMappingsWithContext returns the RESTMappings for the provided group kind +// in a rough internal preferred order. If no kind is found, it will +// return a NoResourceMatchError. +func (d *DeferredDiscoveryRESTMapper) RESTMappingsWithContext(ctx context.Context, gk schema.GroupKind, versions ...string) (ms []*meta.RESTMapping, err error) { + del, err := d.getDelegate(ctx) if err != nil { return nil, err } - ms, err = del.RESTMappings(gk, versions...) - if len(ms) == 0 && !d.cl.Fresh() { - d.Reset() - ms, err = d.RESTMappings(gk, versions...) + ms, err = del.RESTMappingsWithContext(ctx, gk, versions...) + if len(ms) == 0 && !d.cl.FreshWithContext(ctx) { + d.ResetWithContext(ctx) + ms, err = d.RESTMappingsWithContext(ctx, gk, versions...) } return } // ResourceSingularizer converts a resource name from plural to // singular (e.g., from pods to pod). +// +// ResourceSingularizerWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ResourceSingularizerWithContext instead. func (d *DeferredDiscoveryRESTMapper) ResourceSingularizer(resource string) (singular string, err error) { - del, err := d.getDelegate() + return d.ResourceSingularizerWithContext(context.Background(), resource) +} + +// ResourceSingularizerWithContext converts a resource name from plural to +// singular (e.g., from pods to pod). +func (d *DeferredDiscoveryRESTMapper) ResourceSingularizerWithContext(ctx context.Context, resource string) (singular string, err error) { + del, err := d.getDelegate(ctx) if err != nil { return resource, err } - singular, err = del.ResourceSingularizer(resource) - if err != nil && !d.cl.Fresh() { - d.Reset() - singular, err = d.ResourceSingularizer(resource) + singular, err = del.ResourceSingularizerWithContext(ctx, resource) + if err != nil && !d.cl.FreshWithContext(ctx) { + d.ResetWithContext(ctx) + singular, err = d.ResourceSingularizerWithContext(ctx, resource) } return } func (d *DeferredDiscoveryRESTMapper) String() string { - del, err := d.getDelegate() + del, err := d.getDelegate(context.Background() /* hopefully we already have a delegate and don't need the context */) if err != nil { return fmt.Sprintf("DeferredDiscoveryRESTMapper{%v}", err) } return fmt.Sprintf("DeferredDiscoveryRESTMapper{\n\t%v\n}", del) } - -// Make sure it satisfies the interface -var _ meta.ResettableRESTMapper = &DeferredDiscoveryRESTMapper{} diff --git a/vendor/k8s.io/client-go/restmapper/shortcut.go b/vendor/k8s.io/client-go/restmapper/shortcut.go index 0afc8689d7..4dbeea07d8 100644 --- a/vendor/k8s.io/client-go/restmapper/shortcut.go +++ b/vendor/k8s.io/client-go/restmapper/shortcut.go @@ -17,6 +17,7 @@ limitations under the License. package restmapper import ( + "context" "fmt" "strings" @@ -30,22 +31,41 @@ import ( // shortcutExpander is a RESTMapper that can be used for Kubernetes resources. It expands the resource first, then invokes the wrapped type shortcutExpander struct { - RESTMapper meta.RESTMapper + RESTMapper meta.RESTMapperWithContext - discoveryClient discovery.DiscoveryInterface + discoveryClient discovery.DiscoveryInterfaceWithContext warningHandler func(string) } var _ meta.ResettableRESTMapper = shortcutExpander{} +var _ meta.ResettableRESTMapperWithContext = shortcutExpander{} // NewShortcutExpander wraps a restmapper in a layer that expands shortcuts found via discovery +// +// NewShortcutExpanderWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use NewShortcutExpanderWithContext instead. func NewShortcutExpander(delegate meta.RESTMapper, client discovery.DiscoveryInterface, warningHandler func(string)) meta.RESTMapper { + return newShortcutExpander(meta.ToRESTMapperWithContext(delegate), discovery.ToDiscoveryInterfaceWithContext(client), warningHandler) +} + +// NewShortcutExpanderWithContext wraps a restmapper in a layer that expands shortcuts found via discovery +func NewShortcutExpanderWithContext(delegate meta.RESTMapperWithContext, client discovery.DiscoveryInterfaceWithContext, warningHandler func(string)) meta.RESTMapperWithContext { + return newShortcutExpander(delegate, client, warningHandler) +} + +func newShortcutExpander(delegate meta.RESTMapperWithContext, client discovery.DiscoveryInterfaceWithContext, warningHandler func(string)) shortcutExpander { return shortcutExpander{RESTMapper: delegate, discoveryClient: client, warningHandler: warningHandler} } // KindFor fulfills meta.RESTMapper func (e shortcutExpander) KindFor(resource schema.GroupVersionResource) (schema.GroupVersionKind, error) { + return e.KindForWithContext(context.Background(), resource) +} + +// KindForWithContext fulfills meta.RESTMapperWithContext +func (e shortcutExpander) KindForWithContext(ctx context.Context, resource schema.GroupVersionResource) (schema.GroupVersionKind, error) { // expandResourceShortcut works with current API resources as read from discovery cache. // In case of new CRDs this means we potentially don't have current state of discovery. // In the current wiring in k8s.io/cli-runtime/pkg/genericclioptions/config_flags.go#toRESTMapper, @@ -53,59 +73,113 @@ func (e shortcutExpander) KindFor(resource schema.GroupVersionResource) (schema. // cache and fetch all data from a cluster (see k8s.io/client-go/restmapper/discovery.go#KindFor). // Thus another call to expandResourceShortcut, after a NoMatchError should successfully // read Kind to the user or an error. - gvk, err := e.RESTMapper.KindFor(e.expandResourceShortcut(resource)) + gvk, err := e.RESTMapper.KindForWithContext(ctx, e.expandResourceShortcut(ctx, resource)) if meta.IsNoMatchError(err) { - return e.RESTMapper.KindFor(e.expandResourceShortcut(resource)) + return e.RESTMapper.KindForWithContext(ctx, e.expandResourceShortcut(ctx, resource)) } return gvk, err } // KindsFor fulfills meta.RESTMapper +// +// KindsForWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use KindsForWithContext instead. func (e shortcutExpander) KindsFor(resource schema.GroupVersionResource) ([]schema.GroupVersionKind, error) { - return e.RESTMapper.KindsFor(e.expandResourceShortcut(resource)) + return e.KindsForWithContext(context.Background(), resource) +} + +// KindsForWithContext fulfills meta.RESTMapperWithContext +func (e shortcutExpander) KindsForWithContext(ctx context.Context, resource schema.GroupVersionResource) ([]schema.GroupVersionKind, error) { + return e.RESTMapper.KindsForWithContext(ctx, e.expandResourceShortcut(ctx, resource)) } // ResourcesFor fulfills meta.RESTMapper +// +// ResourcesForWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ResourcesForWithContext instead. func (e shortcutExpander) ResourcesFor(resource schema.GroupVersionResource) ([]schema.GroupVersionResource, error) { - return e.RESTMapper.ResourcesFor(e.expandResourceShortcut(resource)) + return e.ResourcesForWithContext(context.Background(), resource) +} + +// ResourcesForWithContext fulfills meta.RESTMapperWithContext +func (e shortcutExpander) ResourcesForWithContext(ctx context.Context, resource schema.GroupVersionResource) ([]schema.GroupVersionResource, error) { + return e.RESTMapper.ResourcesForWithContext(ctx, e.expandResourceShortcut(ctx, resource)) } // ResourceFor fulfills meta.RESTMapper +// +// ResourceForWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ResourceForWithContext instead. func (e shortcutExpander) ResourceFor(resource schema.GroupVersionResource) (schema.GroupVersionResource, error) { - return e.RESTMapper.ResourceFor(e.expandResourceShortcut(resource)) + return e.ResourceForWithContext(context.Background(), resource) +} + +// ResourceForWithContext fulfills meta.RESTMapperWithContext +func (e shortcutExpander) ResourceForWithContext(ctx context.Context, resource schema.GroupVersionResource) (schema.GroupVersionResource, error) { + return e.RESTMapper.ResourceForWithContext(ctx, e.expandResourceShortcut(ctx, resource)) } // ResourceSingularizer fulfills meta.RESTMapper +// +// ResourceSingularizerWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ResourceSingularizerWithContext instead. func (e shortcutExpander) ResourceSingularizer(resource string) (string, error) { - return e.RESTMapper.ResourceSingularizer(e.expandResourceShortcut(schema.GroupVersionResource{Resource: resource}).Resource) + return e.ResourceSingularizerWithContext(context.Background(), resource) +} + +// ResourceSingularizerWithContext fulfills meta.RESTMapperWithContext +func (e shortcutExpander) ResourceSingularizerWithContext(ctx context.Context, resource string) (string, error) { + return e.RESTMapper.ResourceSingularizerWithContext(ctx, e.expandResourceShortcut(ctx, schema.GroupVersionResource{Resource: resource}).Resource) } // RESTMapping fulfills meta.RESTMapper +// +// RESTMappingWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use RESTMappingWithContext instead. func (e shortcutExpander) RESTMapping(gk schema.GroupKind, versions ...string) (*meta.RESTMapping, error) { - return e.RESTMapper.RESTMapping(gk, versions...) + return e.RESTMappingWithContext(context.Background(), gk, versions...) +} + +// RESTMappingWithContext fulfills meta.RESTMapperWithContext +func (e shortcutExpander) RESTMappingWithContext(ctx context.Context, gk schema.GroupKind, versions ...string) (*meta.RESTMapping, error) { + return e.RESTMapper.RESTMappingWithContext(ctx, gk, versions...) } // RESTMappings fulfills meta.RESTMapper +// +// RESTMappingsWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use RESTMappingsWithContext instead. func (e shortcutExpander) RESTMappings(gk schema.GroupKind, versions ...string) ([]*meta.RESTMapping, error) { - return e.RESTMapper.RESTMappings(gk, versions...) + return e.RESTMappingsWithContext(context.Background(), gk, versions...) +} + +// RESTMappingsWithContext fulfills meta.RESTMapperWithContext +func (e shortcutExpander) RESTMappingsWithContext(ctx context.Context, gk schema.GroupKind, versions ...string) ([]*meta.RESTMapping, error) { + return e.RESTMapper.RESTMappingsWithContext(ctx, gk, versions...) } // getShortcutMappings returns a set of tuples which holds short names for resources. // First the list of potential resources will be taken from the API server. // Next we will append the hardcoded list of resources - to be backward compatible with old servers. // NOTE that the list is ordered by group priority. -func (e shortcutExpander) getShortcutMappings() ([]*metav1.APIResourceList, []resourceShortcuts, error) { +func (e shortcutExpander) getShortcutMappings(ctx context.Context) ([]*metav1.APIResourceList, []resourceShortcuts, error) { res := []resourceShortcuts{} // get server resources // This can return an error *and* the results it was able to find. We don't need to fail on the error. - _, apiResList, err := e.discoveryClient.ServerGroupsAndResources() + _, apiResList, err := e.discoveryClient.ServerGroupsAndResourcesWithContext(ctx) if err != nil { - klog.V(1).Infof("Error loading discovery information: %v", err) + klog.FromContext(ctx).V(1).Info("Error loading discovery information", "err", err) } for _, apiResources := range apiResList { gv, err := schema.ParseGroupVersion(apiResources.GroupVersion) if err != nil { - klog.V(1).Infof("Unable to parse groupversion = %s due to = %s", apiResources.GroupVersion, err.Error()) + klog.FromContext(ctx).V(1).Info("Unable to parse group/version", "groupVersion", apiResources.GroupVersion, "err", err.Error()) continue } for _, apiRes := range apiResources.APIResources { @@ -126,9 +200,9 @@ func (e shortcutExpander) getShortcutMappings() ([]*metav1.APIResourceList, []re // (something that a pkg/api/meta.RESTMapper can understand), if it is // indeed a shortcut. If no match has been found, we will match on group prefixing. // Lastly we will return resource unmodified. -func (e shortcutExpander) expandResourceShortcut(resource schema.GroupVersionResource) schema.GroupVersionResource { +func (e shortcutExpander) expandResourceShortcut(ctx context.Context, resource schema.GroupVersionResource) schema.GroupVersionResource { // get the shortcut mappings and return on first match. - if allResources, shortcutResources, err := e.getShortcutMappings(); err == nil { + if allResources, shortcutResources, err := e.getShortcutMappings(ctx); err == nil { // avoid expanding if there's an exact match to a full resource name for _, apiResources := range allResources { gv, err := schema.ParseGroupVersion(apiResources.GroupVersion) @@ -199,8 +273,15 @@ func (e shortcutExpander) expandResourceShortcut(resource schema.GroupVersionRes return resource } +// ResetWithContext is a better alternative because it supports contextual logging and cancellation. +// +// Contextual logging: Use ResetWithContext instead. func (e shortcutExpander) Reset() { - meta.MaybeResetRESTMapper(e.RESTMapper) + e.ResetWithContext(context.Background()) +} + +func (e shortcutExpander) ResetWithContext(ctx context.Context) { + meta.MaybeResetRESTMapperWithContext(ctx, e.RESTMapper) } // ResourceShortcuts represents a structure that holds the information how to diff --git a/vendor/k8s.io/client-go/tools/cache/OWNERS b/vendor/k8s.io/client-go/tools/cache/OWNERS index 77d7e4d28a..f62d5e3c51 100644 --- a/vendor/k8s.io/client-go/tools/cache/OWNERS +++ b/vendor/k8s.io/client-go/tools/cache/OWNERS @@ -5,7 +5,6 @@ approvers: - smarterclayton - wojtek-t - deads2k - - caesarxuchao - liggitt reviewers: - thockin @@ -13,8 +12,6 @@ reviewers: - wojtek-t - deads2k - derekwaynecarr - - caesarxuchao - - mikedanese - liggitt - janetkuo - justinsb @@ -24,5 +21,6 @@ reviewers: - ingvagabund - michaelasp emeritus_approvers: + - caesarxuchao - lavalamp - ncdc diff --git a/vendor/k8s.io/client-go/tools/cache/controller.go b/vendor/k8s.io/client-go/tools/cache/controller.go index b78ed522e2..adb1fb9308 100644 --- a/vendor/k8s.io/client-go/tools/cache/controller.go +++ b/vendor/k8s.io/client-go/tools/cache/controller.go @@ -20,9 +20,11 @@ import ( "context" "errors" "fmt" + "strings" "sync" "time" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" @@ -282,6 +284,126 @@ type ResourceEventHandler interface { OnDelete(obj interface{}) } +// Object is the subset of metav1.Object that is needed to determine the +// name and, if applicable, namespace of an object. All standard Kubernetes +// API types satisfy this interface through their embedded ObjectMeta. +// +// comparable is required so that a zero T can be compared against +// OptionalObj to detect a missing object (e.g. a nil pointer). +type Object interface { + comparable + + GetName() string + GetNamespace() string +} + +// TypedResourceEventHandler is a type-safe variant of ResourceEventHandler. +type TypedResourceEventHandler[T Object] interface { + OnAdd(obj T, isInInitialList bool) + OnUpdate(oldObj, newObj T) + OnDelete(obj DeletedObject[T]) +} + +// DeletedObject provides information about a deleted object. +// +// It implements GetObjectName and GetKey, which replace +// [DeletionHandlingObjectToName] and [DeletionHandlingMetaNamespaceKeyFunc] +// +// It implements the GetName and GetNamespace methods for use +// with klog.KObj: an OnDelete event handler can log +// it's parameter directly and is guaranteed to produce the same +// log output as with klog.KObj applied to the actual object. +// +// All of these methods work regardless whether DeletedObject actually has +// the deleted object. +type DeletedObject[T Object] struct { + // OptionalObj is the deleted object. + // + // It can be: + // - stale: it is some *older* revision, not the one which got deleted + // - nil: the informer noticed a deletion without finding *any* copy of the deleted object + // + // The only guaranteed information is the key under which the deleted + // object was stored in the informer cache. Use [DeletedObject.GetObjectName] + // and [DeletedObject.GetKey] to extract the namespace and name resp. + // the key under which the deleted object was stored. They work in + // all cases. + OptionalObj T + + // FinalStateUnknown is nil if the deleted object is available and up-to-date. + // Otherwise FinalStateUnknown is non-nil to provide the key. + // The untyped object inside it matches OptionalObj. + FinalStateUnknown *DeletedFinalStateUnknown +} + +// GetObjectName returns the object name (= namespace if available and name) +// for the deleted object. Note that this is slightly different from +// GetName which returns just that name without the namespace. +// +// This is a type-safe variant of [DeletionHandlingObjectToName] which +// cannot fail because T is guaranteed to have a name and namespace and +// the key of FinalStateUnknown, if invalid, is simply treated as a +// name without a namespace. +func (d DeletedObject[T]) GetObjectName() ObjectName { + if d.FinalStateUnknown != nil { + // Same splitting as SplitMetaNamespaceKey and ParseObjectName, + // except that a key with more than one "/" is not treated as an error: + // the extra "/" become part of the name. + namespace, name, found := strings.Cut(d.FinalStateUnknown.Key, "/") + if !found { + return ObjectName{Name: namespace} + } + return ObjectName{Namespace: namespace, Name: name} + } + var null T + if d.OptionalObj == null { + // Avoid calling GetName/GetNamespace on a zero OptionalObj (e.g. a + // nil pointer), which could panic. A nil pointer boxed behind a + // further layer of indirection is not detected here and is not + // handled. + return ObjectName{} + } + // Same logic as MetaObjectToName, adapted to use T's own + // GetNamespace and GetName methods instead of going through + // meta.Accessor as ObjectToName does. + if namespace := d.OptionalObj.GetNamespace(); len(namespace) > 0 { + return ObjectName{Namespace: namespace, Name: d.OptionalObj.GetName()} + } + return ObjectName{Name: d.OptionalObj.GetName()} +} + +// GetName returns the name without the namespace. Note that this is slightly +// different from GetObjectName which returns the combination of namespace and name in a +// struct. +func (d DeletedObject[T]) GetName() string { + return d.GetObjectName().Name +} + +// GetNamespace returns the namespace if there is one, otherwise the empty string. +func (d DeletedObject[T]) GetNamespace() string { + return d.GetObjectName().Namespace +} + +// GetKey returns the key under which the deleted object was stored. +// +// This is a type-safe variant of [DeletionHandlingMetaNamespaceKeyFunc] +// which cannot fail because T is guaranteed to have a name and namespace. +func (d DeletedObject[T]) GetKey() string { + if d.FinalStateUnknown != nil { + return d.FinalStateUnknown.Key + } + var null T + if d.OptionalObj == null { + return "" + } + // Same encoding as MetaNamespaceKeyFunc via ObjectName.String, + // adapted to use T's own GetNamespace and GetName methods. + if namespace := d.OptionalObj.GetNamespace(); len(namespace) > 0 { + return namespace + "/" + d.OptionalObj.GetName() + } + return d.OptionalObj.GetName() +} + // ResourceEventHandlerFuncs is an adaptor to let you easily specify as many or // as few of the notification functions as you want while still implementing // ResourceEventHandler. This adapter does not remove the prohibition against @@ -316,6 +438,32 @@ func (r ResourceEventHandlerFuncs) OnDelete(obj interface{}) { } } +type TypedResourceEventHandlerFuncs[T Object] struct { + AddFunc func(obj T) + UpdateFunc func(oldObj, newObj T) + DeleteFunc func(obj DeletedObject[T]) +} + +var _ TypedResourceEventHandler[*metav1.ObjectMeta] = TypedResourceEventHandlerFuncs[*metav1.ObjectMeta]{} + +func (r TypedResourceEventHandlerFuncs[T]) OnAdd(obj T, isInInitialList bool) { + if r.AddFunc != nil { + r.AddFunc(obj) + } +} + +func (r TypedResourceEventHandlerFuncs[T]) OnUpdate(oldObj, newObj T) { + if r.UpdateFunc != nil { + r.UpdateFunc(oldObj, newObj) + } +} + +func (r TypedResourceEventHandlerFuncs[T]) OnDelete(obj DeletedObject[T]) { + if r.DeleteFunc != nil { + r.DeleteFunc(obj) + } +} + // ResourceEventHandlerDetailedFuncs is exactly like ResourceEventHandlerFuncs // except its AddFunc accepts the isInInitialList parameter, for propagating // HasSynced. @@ -346,6 +494,32 @@ func (r ResourceEventHandlerDetailedFuncs) OnDelete(obj interface{}) { } } +type TypedResourceEventHandlerDetailedFuncs[T Object] struct { + AddFunc func(obj T, isInInitialList bool) + UpdateFunc func(oldObj, newObj T) + DeleteFunc func(obj DeletedObject[T]) +} + +var _ TypedResourceEventHandler[*metav1.ObjectMeta] = TypedResourceEventHandlerDetailedFuncs[*metav1.ObjectMeta]{} + +func (r TypedResourceEventHandlerDetailedFuncs[T]) OnAdd(obj T, isInInitialList bool) { + if r.AddFunc != nil { + r.AddFunc(obj, isInInitialList) + } +} + +func (r TypedResourceEventHandlerDetailedFuncs[T]) OnUpdate(oldObj, newObj T) { + if r.UpdateFunc != nil { + r.UpdateFunc(oldObj, newObj) + } +} + +func (r TypedResourceEventHandlerDetailedFuncs[T]) OnDelete(obj DeletedObject[T]) { + if r.DeleteFunc != nil { + r.DeleteFunc(obj) + } +} + // FilteringResourceEventHandler applies the provided filter to all events coming // in, ensuring the appropriate nested handler method is invoked. An object // that starts passing the filter after an update is considered an add, and an @@ -388,6 +562,48 @@ func (r FilteringResourceEventHandler) OnDelete(obj interface{}) { r.Handler.OnDelete(obj) } +// TypedFilteringResourceEventHandler is a type-safe variant of +// [FilteringResourceEventHandler]. +type TypedFilteringResourceEventHandler[T Object] struct { + FilterFunc func(obj T) bool + Handler TypedResourceEventHandler[T] +} + +// OnAdd calls the nested handler only if the filter succeeds +func (r TypedFilteringResourceEventHandler[T]) OnAdd(obj T, isInInitialList bool) { + if !r.FilterFunc(obj) { + return + } + r.Handler.OnAdd(obj, isInInitialList) +} + +// OnUpdate ensures the proper handler is called depending on whether the filter matches +func (r TypedFilteringResourceEventHandler[T]) OnUpdate(oldObj, newObj T) { + newer := r.FilterFunc(newObj) + older := r.FilterFunc(oldObj) + switch { + case newer && older: + r.Handler.OnUpdate(oldObj, newObj) + case newer && !older: + r.Handler.OnAdd(newObj, false) + case !newer && older: + r.Handler.OnDelete(DeletedObject[T]{OptionalObj: oldObj}) + default: + // do nothing + } +} + +// OnDelete calls the nested handler only if the filter succeeds. The filter +// is applied to [DeletedObject.OptionalObj], which may be the zero value of T +// if the deleted object could not be recovered; a FilterFunc that relies on T +// having a valid state must handle that case itself. +func (r TypedFilteringResourceEventHandler[T]) OnDelete(obj DeletedObject[T]) { + if !r.FilterFunc(obj.OptionalObj) { + return + } + r.Handler.OnDelete(obj) +} + // DeletionHandlingMetaNamespaceKeyFunc checks for // DeletedFinalStateUnknown objects before calling // MetaNamespaceKeyFunc. diff --git a/vendor/k8s.io/client-go/tools/cache/index.go b/vendor/k8s.io/client-go/tools/cache/index.go index 395268f68c..ca0d904e65 100644 --- a/vendor/k8s.io/client-go/tools/cache/index.go +++ b/vendor/k8s.io/client-go/tools/cache/index.go @@ -98,3 +98,37 @@ type Indexers map[string]IndexFunc // Indices maps a name to an Index type Indices map[string]index + +type TypedIndexers[T any] map[string]TypedIndexFunc[T] +type TypedIndexFunc[T any] func(obj T) ([]string, error) +type TypedIndexer[T any] interface { + Indexer + + TypedIndex(indexName string, obj T) ([]T, error) + ByTypedIndex(indexName, indexedValue string) ([]T, error) + AddTypedIndexers(newIndexers TypedIndexers[T]) error +} + +// TypedIndexersToIndexers wraps several indexer functions which expect objects +// of a certain type so that they can be used in an [Indexer]. +// This is needed primarily for setting up [SharedIndexInformerOptions.Indexers]. +// When using one of the typed APIs for installing an indexer function +// the conversion is done automatically. +func TypedIndexersToIndexers[T any](indexers TypedIndexers[T]) Indexers { + untyped := make(Indexers, len(indexers)) + for i, indexer := range indexers { + untyped[i] = TypedIndexerFuncToIndexerFunc(indexer) + } + return untyped +} + +// TypedIndexersFuncToIndexerFunc wraps one indexer function which expect objects +// of a certain type so that they can be used in an [Indexer]. +// This is needed primarily for setting up [SharedIndexInformerOptions.Indexers]. +// When using one of the typed APIs for installing an indexer function +// the conversion is done automatically. +func TypedIndexerFuncToIndexerFunc[T any](indexer TypedIndexFunc[T]) IndexFunc { + return func(obj any) ([]string, error) { + return indexer(obj.(T)) + } +} diff --git a/vendor/k8s.io/client-go/tools/cache/fifo_metrics.go b/vendor/k8s.io/client-go/tools/cache/informer_metrics.go similarity index 98% rename from vendor/k8s.io/client-go/tools/cache/fifo_metrics.go rename to vendor/k8s.io/client-go/tools/cache/informer_metrics.go index 7a67817240..e0d3b6e930 100644 --- a/vendor/k8s.io/client-go/tools/cache/fifo_metrics.go +++ b/vendor/k8s.io/client-go/tools/cache/informer_metrics.go @@ -70,7 +70,7 @@ type storeMetrics struct { } // SetInformerMetricsProvider sets the metrics provider for all subsequently created -// FIFOs. Only the first call has an effect. +// informers. Only the first call has an effect. func SetInformerMetricsProvider(metricsProvider InformerMetricsProvider) { setInformerMetricsProviderOnce.Do(func() { globalInformerMetricsProvider = metricsProvider diff --git a/vendor/k8s.io/client-go/tools/cache/mutation_cache.go b/vendor/k8s.io/client-go/tools/cache/mutation_cache.go index 6800a62508..e70b721a83 100644 --- a/vendor/k8s.io/client-go/tools/cache/mutation_cache.go +++ b/vendor/k8s.io/client-go/tools/cache/mutation_cache.go @@ -25,7 +25,10 @@ import ( "k8s.io/klog/v2" "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" utilcache "k8s.io/apimachinery/pkg/util/cache" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/sets" @@ -35,11 +38,19 @@ import ( // that can be used to provide a more current view of a requested object. It requires interpreting // resourceVersions for comparisons. // Implementations must be thread-safe. -// TODO find a way to layer this into an informer/lister +// OnAddOrupdate and OnDelete should be called from informer event handlers to increase +// the accuracy of the cache. type MutationCache interface { GetByKey(key string) (interface{}, bool, error) ByIndex(indexName, indexKey string) ([]interface{}, error) Mutation(interface{}) + OnAddOrUpdate(obj runtime.Object) + OnDelete(obj runtime.Object) + + // This interface is not meant to be implemented elsewhere. + // Marking it as internal enables future changes without + // triggering apidiff. + internal() } // ResourceVersionComparator is able to compare object versions. @@ -47,7 +58,28 @@ type ResourceVersionComparator interface { CompareResourceVersion(lhs, rhs runtime.Object) int } -// NewIntegerResourceVersionMutationCache returns a MutationCache that understands how to +// MutationCacheOptions configures the MutationCache returned by NewIntegerResourceVersionMutationCacheWithOptions. +type MutationCacheOptions struct { + // Indexer is used by ByIndex to look up objects. May be nil, in which case ByIndex returns an error. + Indexer Indexer + + // TTL controls how long an item remains in the mutation cache before it is removed. + // Zero means the default of 5 minutes. + TTL time.Duration + + // IncludeAdds makes the cache return objects even if they don't exist + // in the underlying store. This is only safe if your use of the cache + // can handle mutation entries remaining in the cache for up to TTL + // when mutations and deletes occur very closely in time. + IncludeAdds bool + + // MaxCacheSize limits how many mutated objects are tracked; the least + // recently used entries are evicted once the limit is reached. + // Zero means the default of 100. + MaxCacheSize int +} + +// NewIntegerResourceVersionMutationCacheWithOptions returns a MutationCache that understands how to // deal with objects that have a resource version that: // // - is an integer @@ -60,18 +92,55 @@ type ResourceVersionComparator interface { // If includeAdds is true, objects in the mutation cache will be returned even if they don't exist // in the underlying store. This is only safe if your use of the cache can handle mutation entries // remaining in the cache for up to ttl when mutations and deletes occur very closely in time. -func NewIntegerResourceVersionMutationCache(logger klog.Logger, backingCache Store, indexer Indexer, ttl time.Duration, includeAdds bool) MutationCache { +// +// Note that this also applies to objects updated by the caller, not just +// objects added by it. That's because the MutationCache may hold an updated +// object at a time when the underlying store already removed it because it was +// deleted in the apiserver after the update. To address this, the caller +// can call OnAddOrUpdate and OnDelete from informer event handlers. +// +// This informs the MutationCache about all changes observed by the store +// and enables it to remove a locally added or updated object immediately once +// it appears in the store, which prevents the "stale updated object" problem. +// +// This does not solve the "stale added object" problem reliably because +// the informer might never see the added object when the add is followed +// quickly by a delete. The caller has to handle stale added objects by +// checking whether they still exist once the TTL is over. +func NewIntegerResourceVersionMutationCacheWithOptions(logger klog.Logger, backingCache Store, options MutationCacheOptions) MutationCache { + var ( + maxCacheSize = 100 + ttl = 5 * time.Minute + ) + + if options.MaxCacheSize != 0 { + maxCacheSize = options.MaxCacheSize + } + if options.TTL != 0 { + ttl = options.TTL + } + return &mutationCache{ backingCache: backingCache, - indexer: indexer, - mutationCache: utilcache.NewLRUExpireCache(100), + indexer: options.Indexer, + mutationCache: utilcache.NewLRUExpireCache(maxCacheSize), comparator: etcdObjectVersioner{}, ttl: ttl, - includeAdds: includeAdds, + includeAdds: options.IncludeAdds, logger: logger, } } +// NewIntegerResourceVersionMutationCache is like NewIntegerResourceVersionMutationCacheWithOptions with a fixed cache size of 100. +func NewIntegerResourceVersionMutationCache(logger klog.Logger, backingCache Store, indexer Indexer, ttl time.Duration, includeAdds bool) MutationCache { + return NewIntegerResourceVersionMutationCacheWithOptions(logger, backingCache, MutationCacheOptions{ + TTL: ttl, + Indexer: indexer, + IncludeAdds: includeAdds, + MaxCacheSize: 100, + }) +} + // mutationCache doesn't guarantee that it returns values added via Mutation since they can page out and // since you can't distinguish between, "didn't observe create" and "was deleted after create", // if the key is missing from the backing cache, we always return it as missing @@ -108,11 +177,24 @@ func (c *mutationCache) GetByKey(key string) (interface{}, bool, error) { if !exists { return nil, false, nil } + // Don't return the tombstone. + if _, ok := obj.(*tombstone); ok { + return nil, false, nil + } } objRuntime, ok := obj.(runtime.Object) if !ok { return obj, true, nil } + // If the object is from the store, + // then this will remove the obsolete tombstone. + // + // The newer object can never be the tombstone + // because a) we don't get here if only the tombstone + // exists (early return above) and b) the store's + // object must be more recent than the tombstone + // (the tombstone was created by an earlier store + // deletion). return c.newerObject(key, objRuntime), true, nil } @@ -157,6 +239,9 @@ func (c *mutationCache) ByIndex(name string, indexKey string) ([]interface{}, er if keySet.Has(key.(string)) { continue } + if _, ok := updated.(*tombstone); ok { + continue + } elements, err := fn(updated) if err != nil { c.logger.V(4).Info("Unable to calculate an index entry for mutation cache entry", "key", key, "err", err) @@ -213,15 +298,114 @@ func (c *mutationCache) Mutation(obj interface{}) { if objRuntime, ok := obj.(runtime.Object); ok { if mutatedObj, exists := c.mutationCache.Get(key); exists { if mutatedObjRuntime, ok := mutatedObj.(runtime.Object); ok { - if c.comparator.CompareResourceVersion(objRuntime, mutatedObjRuntime) < 0 { + cmp := c.comparator.CompareResourceVersion(objRuntime, mutatedObjRuntime) + if cmp < 0 { return } + if t, ok := mutatedObj.(*tombstone); ok { + if cmp == 0 { + // Exactly this object instance is known to be deleted. + // Don't store it, keep the tombstone. + return + } + objMeta, err := meta.Accessor(obj) + if err == nil && t.GetUID() == objMeta.GetUID() { + // Some other revision of this object instance + // is known to be deleted. Also don't store it. + return + } + } } } } c.mutationCache.Add(key, obj, c.ttl) } +// OnAddOrUpdate can be called to informer the cache about an object added to +// the store or updated in in. If the object is as recent as the cached object +// or newer, the cached object gets removed because it is no longer +// needed. This keeps the cache smaller. +func (c *mutationCache) OnAddOrUpdate(obj runtime.Object) { + key, err := DeletionHandlingMetaNamespaceKeyFunc(obj) + if err != nil { + // this is a "nice to have", so failures shouldn't do anything weird + utilruntime.HandleErrorWithLogger(c.logger, err, "DeletionHandlingMetaNamespaceKeyFunc") + return + } + + c.lock.Lock() + defer c.lock.Unlock() + + if mutatedObj, exists := c.mutationCache.Get(key); exists { + if mutatedObj, ok := mutatedObj.(runtime.Object); ok { + // No need to compare the UID here: resource versions can be compared + // between different instances. If it's newer or equal, then the mutation + // cache is out-dated. + if c.comparator.CompareResourceVersion(obj, mutatedObj) >= 0 { + c.mutationCache.Remove(key) + } + } + } +} + +// OnDelete can be called to informer the cache about an object deleted in the store. +// If there is a cached object with the same UID or an older RV, it gets removed. +func (c *mutationCache) OnDelete(obj runtime.Object) { + objMeta, err := meta.Accessor(obj) + if err != nil { + return + } + + key, err := DeletionHandlingMetaNamespaceKeyFunc(obj) + if err != nil { + // this is a "nice to have", so failures shouldn't do anything weird + utilruntime.HandleErrorWithLogger(c.logger, err, "DeletionHandlingMetaNamespaceKeyFunc") + return + } + + c.lock.Lock() + defer c.lock.Unlock() + + if mutatedObj, exists := c.mutationCache.Get(key); exists { + if mutatedObj, ok := mutatedObj.(runtime.Object); ok { + mutatedObjMeta, err := meta.Accessor(mutatedObj) + if err != nil { + return + } + // If the deleted object is known to be more recent than the + // mutated one, then the mutated one must have been removed + // because resource versions are incremented by type, not by + // object instance. + // + // If the UID matches, then we can also be sure that it got + // removed. + // + // If neither of this is true, then the caller has added + // a mutated object that may or may not still exist. They + // have to check after the TTL. + if c.comparator.CompareResourceVersion(obj, mutatedObj) >= 0 || + mutatedObjMeta.GetUID() == objMeta.GetUID() { + c.mutationCache.Remove(key) + } else { + return + } + } + } + + // Store a tombstone object in the mutation cache. + // A future Mutation call is outdated if it has a RV + // which is lower or equal or has the same UID. + t := &tombstone{ + namespace: objMeta.GetNamespace(), + name: objMeta.GetName(), + uid: objMeta.GetUID(), + rv: objMeta.GetResourceVersion(), + } + c.mutationCache.Add(key, t, c.ttl) +} + +func (c *mutationCache) internal() {} + // etcdObjectVersioner implements versioning and extracting etcd node information // for objects that have an embedded ObjectMeta or ListMeta field. type etcdObjectVersioner struct{} @@ -262,3 +446,57 @@ func (a etcdObjectVersioner) CompareResourceVersion(lhs, rhs runtime.Object) int return 1 } + +// tombstone is a replacement for a deleted object. It has the same key as it +// and the ResourceVersion at which the deletion was detected. +// +// It implements GetName, GetNamespace, GetResourceVersion and GetUID and thus +// the code above can compare it against other, normal objects. The difference +// is that it never gets returned by ByIndex or GetByKey. +type tombstone struct { + namespace, name, rv string + uid types.UID +} + +var _ metav1.Object = &tombstone{} +var _ runtime.Object = &tombstone{} + +func (t *tombstone) DeepCopyObject() runtime.Object { + clone := *t + return &clone +} + +func (t *tombstone) GetObjectKind() schema.ObjectKind { panic("not implemented") } + +func (t *tombstone) GetNamespace() string { return t.namespace } +func (t *tombstone) SetNamespace(namespace string) { panic("not implemented") } +func (t *tombstone) GetName() string { return t.name } +func (t *tombstone) SetName(name string) { panic("not implemented") } +func (t *tombstone) GetGenerateName() string { panic("not implemented") } +func (t *tombstone) SetGenerateName(name string) { panic("not implemented") } +func (t *tombstone) GetUID() types.UID { return t.uid } +func (t *tombstone) SetUID(uid types.UID) { panic("not implemented") } +func (t *tombstone) GetResourceVersion() string { return t.rv } +func (t *tombstone) SetResourceVersion(version string) { panic("not implemented") } +func (t *tombstone) GetGeneration() int64 { panic("not implemented") } +func (t *tombstone) SetGeneration(generation int64) { panic("not implemented") } +func (t *tombstone) GetSelfLink() string { panic("not implemented") } +func (t *tombstone) SetSelfLink(selfLink string) { panic("not implemented") } +func (t *tombstone) GetCreationTimestamp() metav1.Time { panic("not implemented") } +func (t *tombstone) SetCreationTimestamp(timestamp metav1.Time) { panic("not implemented") } +func (t *tombstone) GetDeletionTimestamp() *metav1.Time { panic("not implemented") } +func (t *tombstone) SetDeletionTimestamp(timestamp *metav1.Time) { panic("not implemented") } +func (t *tombstone) GetDeletionGracePeriodSeconds() *int64 { panic("not implemented") } +func (t *tombstone) SetDeletionGracePeriodSeconds(*int64) { panic("not implemented") } +func (t *tombstone) GetLabels() map[string]string { panic("not implemented") } +func (t *tombstone) SetLabels(labels map[string]string) { panic("not implemented") } +func (t *tombstone) GetAnnotations() map[string]string { panic("not implemented") } +func (t *tombstone) SetAnnotations(annotations map[string]string) { panic("not implemented") } +func (t *tombstone) GetFinalizers() []string { panic("not implemented") } +func (t *tombstone) SetFinalizers(finalizers []string) { panic("not implemented") } +func (t *tombstone) GetOwnerReferences() []metav1.OwnerReference { panic("not implemented") } +func (t *tombstone) SetOwnerReferences([]metav1.OwnerReference) { panic("not implemented") } +func (t *tombstone) GetManagedFields() []metav1.ManagedFieldsEntry { panic("not implemented") } +func (t *tombstone) SetManagedFields(managedFields []metav1.ManagedFieldsEntry) { + panic("not implemented") +} diff --git a/vendor/k8s.io/client-go/tools/cache/reflector.go b/vendor/k8s.io/client-go/tools/cache/reflector.go index a0e3a701cd..82de01f9ae 100644 --- a/vendor/k8s.io/client-go/tools/cache/reflector.go +++ b/vendor/k8s.io/client-go/tools/cache/reflector.go @@ -742,7 +742,7 @@ func (r *Reflector) list(ctx context.Context) error { case <-listCh: } - initTrace.Step("Objects listed", trace.Field{Key: "error", Value: err}) + initTrace.Step("Objects listed", trace.Field{Key: "error", Value: err}, trace.Field{Key: "count", Value: meta.LenList(list)}) if err != nil { return fmt.Errorf("failed to list %v: %w", r.typeDescription, err) } diff --git a/vendor/k8s.io/client-go/tools/cache/shared_informer.go b/vendor/k8s.io/client-go/tools/cache/shared_informer.go index 4cec4283f1..c259cdd9af 100644 --- a/vendor/k8s.io/client-go/tools/cache/shared_informer.go +++ b/vendor/k8s.io/client-go/tools/cache/shared_informer.go @@ -28,6 +28,7 @@ import ( "time" "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" @@ -177,6 +178,15 @@ type SharedInformer interface { // RemoveEventHandler removes a formerly added event handler given by // its registration handle. // This function is guaranteed to be idempotent, and thread-safe. + // + // Note: RemoveEventHandler is asynchronous. It stops queueing new events + // but does not wait for already-queued events to finish executing. + // Goroutines processing the remaining events may still be running and + // invoking callbacks after this function returns. + // + // If the caller needs to wait for all handlers to finish executing (for + // example, to safely close channels or release resources used by the handler), + // they should use [ShutDownEventHandler]. RemoveEventHandler(handle ResourceEventHandlerRegistration) error // GetStore returns the informer's local cache as a Store. GetStore() Store @@ -287,6 +297,118 @@ type SharedIndexInformer interface { GetIndexer() Indexer } +// TypedSharedIndexInformer adds type-safe variants for non-type-safe methods +// in SharedIndexInformer. No type casts are needed when using those variants. +type TypedSharedIndexInformer[T Object] interface { + SharedIndexInformer + + // AddTypedEventHandler is a type-safe replacement for + // SharedIndexInformer.AddEventHandlerWithOptions + // and SharedIndexInformer.AddEventHandler. + // + // Without options, it uses the same defaults as AddEventHandler + // or AddEventHandlerWithOptions with empty HandlerOptions. + // Passing one instance corresponds to AddEventHandlerWithOptions. + // Passing more than one is invalid and returns an error. + AddTypedEventHandler(handler TypedResourceEventHandler[T], options ...HandlerOptions) (ResourceEventHandlerRegistration, error) + AddTypedIndexers(indexers TypedIndexers[T]) error + GetTypedIndexer() TypedIndexer[T] +} + +func NewTypedSharedIndexInformer[T Object](informer SharedIndexInformer) TypedSharedIndexInformer[T] { + return &typedSharedIndexInformer[T]{SharedIndexInformer: informer} +} + +type typedSharedIndexInformer[T Object] struct { + SharedIndexInformer +} + +func (s typedSharedIndexInformer[T]) AddTypedEventHandler(handler TypedResourceEventHandler[T], options ...HandlerOptions) (ResourceEventHandlerRegistration, error) { + var o HandlerOptions + switch len(options) { + case 0: + case 1: + o = options[0] + default: + return nil, fmt.Errorf("at most one HandlerOptions may be passed, got %d", len(options)) + } + return s.AddEventHandlerWithOptions(&typedResourceEventHandler[T]{handler}, o) +} + +func (s typedSharedIndexInformer[T]) AddTypedIndexers(indexers TypedIndexers[T]) error { + return s.AddIndexers(TypedIndexersToIndexers(indexers)) +} + +func (s typedSharedIndexInformer[T]) GetTypedIndexer() TypedIndexer[T] { + return &typedIndexer[T]{s.GetIndexer()} +} + +// typedResourceEventHandler implements the untyped ResourceEventHandler interface +// by invoking the methods of a TypedResourceEventHandler instance. +type typedResourceEventHandler[T Object] struct { + handler TypedResourceEventHandler[T] +} + +var _ ResourceEventHandler = &typedResourceEventHandler[*metav1.ObjectMeta]{} + +func (h *typedResourceEventHandler[T]) OnAdd(obj any, isInitialList bool) { + h.handler.OnAdd(obj.(T), isInitialList) +} + +func (h *typedResourceEventHandler[T]) OnUpdate(oldObj, newObj any) { + h.handler.OnUpdate(oldObj.(T), newObj.(T)) +} + +func (h *typedResourceEventHandler[T]) OnDelete(obj any) { + if tomb, ok := obj.(DeletedFinalStateUnknown); ok { + if tomb.Obj == nil { + h.handler.OnDelete(DeletedObject[T]{FinalStateUnknown: &tomb}) + return + } + h.handler.OnDelete(DeletedObject[T]{OptionalObj: tomb.Obj.(T), FinalStateUnknown: &tomb}) + return + } + h.handler.OnDelete(DeletedObject[T]{OptionalObj: obj.(T)}) +} + +type typedIndexer[T any] struct { + Indexer +} + +func (i typedIndexer[T]) TypedIndex(indexName string, obj T) ([]T, error) { + untyped, err := i.Index(indexName, obj) + if err != nil { + return nil, err + } + typed := make([]T, len(untyped)) + for i, obj := range untyped { + typed[i] = obj.(T) + } + return typed, nil +} + +func (i typedIndexer[T]) ByTypedIndex(indexName, indexedValue string) ([]T, error) { + untyped, err := i.ByIndex(indexName, indexedValue) + if err != nil { + return nil, err + } + typed := make([]T, len(untyped)) + for i, obj := range untyped { + typed[i] = obj.(T) + } + return typed, nil +} + +func (i typedIndexer[T]) AddTypedIndexers(newIndexers TypedIndexers[T]) error { + untyped := make(Indexers, len(newIndexers)) + for i, indexer := range newIndexers { + untyped[i] = func(obj any) ([]string, error) { + return indexer(obj.(T)) + } + } + return i.AddIndexers(untyped) +} + // NewSharedInformer creates a new instance for the ListerWatcher. See NewSharedIndexInformerWithOptions for full details. func NewSharedInformer(lw ListerWatcher, exampleObject runtime.Object, defaultEventHandlerResyncPeriod time.Duration) SharedInformer { return NewSharedIndexInformer(lw, exampleObject, defaultEventHandlerResyncPeriod, Indexers{}) @@ -1014,6 +1136,24 @@ func (s *sharedIndexInformer) RemoveEventHandler(handle ResourceEventHandlerRegi return s.processor.removeListener(handle) } +// ShutDownEventHandler removes the event handler and blocks until it has fully +// stopped processing events. +// +// Like RemoveEventHandler, it is idempotent and thread-safe. However, it MUST NOT +// be called from within the event handler's own callbacks, as that will result +// in a deadlock. +func ShutDownEventHandler(informer SharedInformer, handle ResourceEventHandlerRegistration) error { + if err := informer.RemoveEventHandler(handle); err != nil { + return err + } + if s, ok := handle.(interface{ ShutdownChan() <-chan struct{} }); ok { + <-s.ShutdownChan() + } else { + return fmt.Errorf("handle does not support ShutdownChan()") + } + return nil +} + // sharedProcessor has a collection of processorListener and can // distribute a notification object to its listeners. There are two // kinds of distribute operations. The sync distributions go to a @@ -1086,6 +1226,8 @@ func (p *sharedProcessor) removeListener(handle ResourceEventHandlerRegistration if p.listenersStarted { close(listener.addCh) + } else { + close(listener.runFinished) } return nil @@ -1209,10 +1351,11 @@ func (p *sharedProcessor) resyncCheckPeriodChanged(logger klog.Logger, resyncChe // processorListener also keeps track of the adjusted requested resync // period of the listener. type processorListener struct { - logger klog.Logger - nextCh chan interface{} - addCh chan interface{} - done chan struct{} + logger klog.Logger + nextCh chan interface{} + addCh chan interface{} + done chan struct{} + runFinished chan struct{} handler ResourceEventHandler handlerName string @@ -1265,6 +1408,10 @@ func (p *processorListener) HasSyncedChecker() DoneChecker { return p.syncTracker } +func (p *processorListener) ShutdownChan() <-chan struct{} { + return p.runFinished +} + func newProcessListener(logger klog.Logger, handler ResourceEventHandler, requestedResyncPeriod, resyncPeriod time.Duration, now time.Time, bufferSize int, hasSynced DoneChecker) *processorListener { handlerName := nameForHandler(handler) ret := &processorListener{ @@ -1272,6 +1419,7 @@ func newProcessListener(logger klog.Logger, handler ResourceEventHandler, reques nextCh: make(chan interface{}), addCh: make(chan interface{}), done: make(chan struct{}), + runFinished: make(chan struct{}), upstreamHasSynced: hasSynced, handler: handler, handlerName: handlerName, @@ -1328,6 +1476,7 @@ func (p *processorListener) pop() { } func (p *processorListener) run() { + defer close(p.runFinished) // this call blocks until the channel is closed. When a panic happens during the notification // we will catch it, **the offending item will be skipped!**, and after a short delay (one second) // the next notification will be attempted. This is usually better than the alternative of never diff --git a/vendor/k8s.io/client-go/tools/cache/store.go b/vendor/k8s.io/client-go/tools/cache/store.go index 261ed60d9c..76cb70c569 100644 --- a/vendor/k8s.io/client-go/tools/cache/store.go +++ b/vendor/k8s.io/client-go/tools/cache/store.go @@ -402,6 +402,9 @@ func WithTransformer(transformer TransformFunc) StoreOption { func WithStoreMetrics(identifier InformerNameAndResource, metrics InformerMetricsProvider) StoreOption { return func(c *cache) { c.identifier = identifier + if metrics == nil { + metrics = globalInformerMetricsProvider + } c.metrics = metrics } } diff --git a/vendor/k8s.io/client-go/tools/clientcmd/api/v1/doc.go b/vendor/k8s.io/client-go/tools/clientcmd/api/v1/doc.go index 3ccdebc1c3..b5a686a4c1 100644 --- a/vendor/k8s.io/client-go/tools/clientcmd/api/v1/doc.go +++ b/vendor/k8s.io/client-go/tools/clientcmd/api/v1/doc.go @@ -17,5 +17,6 @@ limitations under the License. // +k8s:conversion-gen=k8s.io/client-go/tools/clientcmd/api // +k8s:deepcopy-gen=package // +k8s:defaulter-gen=Kind +// +k8s:validation-gen=false package v1 diff --git a/vendor/k8s.io/client-go/tools/clientcmd/api/v1/zz_generated.conversion.go b/vendor/k8s.io/client-go/tools/clientcmd/api/v1/zz_generated.conversion.go index ef1e9b8eb2..f4a48d071e 100644 --- a/vendor/k8s.io/client-go/tools/clientcmd/api/v1/zz_generated.conversion.go +++ b/vendor/k8s.io/client-go/tools/clientcmd/api/v1/zz_generated.conversion.go @@ -229,8 +229,7 @@ func Convert_api_AuthInfo_To_v1_AuthInfo(in *api.AuthInfo, out *AuthInfo, s conv } func autoConvert_v1_AuthProviderConfig_To_api_AuthProviderConfig(in *AuthProviderConfig, out *api.AuthProviderConfig, s conversion.Scope) error { - out.Name = in.Name - out.Config = *(*map[string]string)(unsafe.Pointer(&in.Config)) + *out = *(*api.AuthProviderConfig)(unsafe.Pointer(in)) return nil } @@ -240,8 +239,7 @@ func Convert_v1_AuthProviderConfig_To_api_AuthProviderConfig(in *AuthProviderCon } func autoConvert_api_AuthProviderConfig_To_v1_AuthProviderConfig(in *api.AuthProviderConfig, out *AuthProviderConfig, s conversion.Scope) error { - out.Name = in.Name - out.Config = *(*map[string]string)(unsafe.Pointer(&in.Config)) + *out = *(*AuthProviderConfig)(unsafe.Pointer(in)) return nil } @@ -411,8 +409,7 @@ func Convert_api_ExecConfig_To_v1_ExecConfig(in *api.ExecConfig, out *ExecConfig } func autoConvert_v1_ExecEnvVar_To_api_ExecEnvVar(in *ExecEnvVar, out *api.ExecEnvVar, s conversion.Scope) error { - out.Name = in.Name - out.Value = in.Value + *out = *(*api.ExecEnvVar)(unsafe.Pointer(in)) return nil } @@ -422,8 +419,7 @@ func Convert_v1_ExecEnvVar_To_api_ExecEnvVar(in *ExecEnvVar, out *api.ExecEnvVar } func autoConvert_api_ExecEnvVar_To_v1_ExecEnvVar(in *api.ExecEnvVar, out *ExecEnvVar, s conversion.Scope) error { - out.Name = in.Name - out.Value = in.Value + *out = *(*ExecEnvVar)(unsafe.Pointer(in)) return nil } diff --git a/vendor/k8s.io/client-go/tools/clientcmd/loader.go b/vendor/k8s.io/client-go/tools/clientcmd/loader.go index d1d0a82954..e6e35a8abe 100644 --- a/vendor/k8s.io/client-go/tools/clientcmd/loader.go +++ b/vendor/k8s.io/client-go/tools/clientcmd/loader.go @@ -300,7 +300,8 @@ func (rules *ClientConfigLoadingRules) Migrate() error { return err } - if sourceInfo, err := os.Stat(source); err != nil { + sourceInfo, err := os.Stat(source) + if err != nil { if os.IsNotExist(err) || os.IsPermission(err) { // if the source file doesn't exist or we can't access it, there's no work to do. continue @@ -316,8 +317,8 @@ func (rules *ClientConfigLoadingRules) Migrate() error { if err != nil { return err } - // destination is created with mode 0666 before umask - err = os.WriteFile(destination, data, 0666) + // destination created with source perm, but never executable, and subject to umask + err = os.WriteFile(destination, data, sourceInfo.Mode().Perm()&0666) if err != nil { return err } @@ -641,7 +642,7 @@ func RelativizePathWithNoBacksteps(refs []*string, base string) error { } // if we have a backstep, don't mess with the path - if strings.HasPrefix(rel, "../") { + if strings.HasPrefix(rel, "../") || strings.HasPrefix(rel, ".."+string(os.PathSeparator)) { if filepath.IsAbs(*ref) { continue } diff --git a/vendor/k8s.io/client-go/tools/events/event_broadcaster.go b/vendor/k8s.io/client-go/tools/events/event_broadcaster.go index ff6b2c4fab..0987523205 100644 --- a/vendor/k8s.io/client-go/tools/events/event_broadcaster.go +++ b/vendor/k8s.io/client-go/tools/events/event_broadcaster.go @@ -328,7 +328,7 @@ func (e *eventBroadcasterImpl) StartStructuredLogging(verbosity klog.Level) func // To adjust verbosity, use the logger's V method (i.e. pass `logger.V(3)` instead of `logger`). // The returned function can be ignored or used to stop recording, if desired. func (e *eventBroadcasterImpl) StartLogging(logger klog.Logger) (func(), error) { - return e.StartEventWatcher( + return e.startEventWatcher(logger, func(obj runtime.Object) { event, ok := obj.(*eventsv1.Event) if !ok { @@ -342,12 +342,16 @@ func (e *eventBroadcasterImpl) StartLogging(logger klog.Logger) (func(), error) // StartEventWatcher starts sending events received from this EventBroadcaster to the given event handler function. // The return value is used to stop recording func (e *eventBroadcasterImpl) StartEventWatcher(eventHandler func(event runtime.Object)) (func(), error) { + return e.startEventWatcher(klog.Background(), eventHandler) +} + +func (e *eventBroadcasterImpl) startEventWatcher(logger klog.Logger, eventHandler func(event runtime.Object)) (func(), error) { watcher, err := e.Watch() if err != nil { return nil, err } go func() { - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithLogger(logger) for { watchEvent, ok := <-watcher.ResultChan() if !ok { @@ -414,7 +418,7 @@ func NewEventBroadcasterAdapter(client clientset.Interface) EventBroadcasterAdap // migration of individual components to the new Event API. func NewEventBroadcasterAdapterWithContext(ctx context.Context, client clientset.Interface) EventBroadcasterAdapter { eventClient := &eventBroadcasterAdapterImpl{} - if _, err := client.Discovery().ServerResourcesForGroupVersion(eventsv1.SchemeGroupVersion.String()); err == nil { + if _, err := client.Discovery().ServerResourcesForGroupVersionWithContext(ctx, eventsv1.SchemeGroupVersion.String()); err == nil { eventClient.eventsv1Client = client.EventsV1() eventClient.eventsv1Broadcaster = NewBroadcaster(&EventSinkImpl{Interface: eventClient.eventsv1Client}) } diff --git a/vendor/k8s.io/client-go/tools/events/event_recorder.go b/vendor/k8s.io/client-go/tools/events/event_recorder.go index ba2ec7be4e..08fa57d9f5 100644 --- a/vendor/k8s.io/client-go/tools/events/event_recorder.go +++ b/vendor/k8s.io/client-go/tools/events/event_recorder.go @@ -41,9 +41,14 @@ type recorderImpl struct { } var _ EventRecorder = &recorderImpl{} +var _ AnnotatedEventRecorder = &recorderImpl{} func (recorder *recorderImpl) Eventf(regarding runtime.Object, related runtime.Object, eventtype, reason, action, note string, args ...interface{}) { - recorder.eventf(klog.Background(), regarding, related, eventtype, reason, action, note, args...) + recorder.eventf(klog.Background(), regarding, related, nil, eventtype, reason, action, note, args...) +} + +func (recorder *recorderImpl) AnnotatedEventf(regarding runtime.Object, related runtime.Object, annotations map[string]string, eventtype, reason, action, note string, args ...interface{}) { + recorder.eventf(klog.Background(), regarding, related, annotations, eventtype, reason, action, note, args...) } type recorderImplLogger struct { @@ -54,14 +59,18 @@ type recorderImplLogger struct { var _ EventRecorderLogger = &recorderImplLogger{} func (recorder *recorderImplLogger) Eventf(regarding runtime.Object, related runtime.Object, eventtype, reason, action, note string, args ...interface{}) { - recorder.eventf(recorder.logger, regarding, related, eventtype, reason, action, note, args...) + recorder.eventf(recorder.logger, regarding, related, nil, eventtype, reason, action, note, args...) +} + +func (recorder *recorderImplLogger) AnnotatedEventf(regarding runtime.Object, related runtime.Object, annotations map[string]string, eventtype, reason, action, note string, args ...interface{}) { + recorder.eventf(recorder.logger, regarding, related, annotations, eventtype, reason, action, note, args...) } func (recorder *recorderImplLogger) WithLogger(logger klog.Logger) EventRecorderLogger { return &recorderImplLogger{recorderImpl: recorder.recorderImpl, logger: logger} } -func (recorder *recorderImpl) eventf(logger klog.Logger, regarding runtime.Object, related runtime.Object, eventtype, reason, action, note string, args ...interface{}) { +func (recorder *recorderImpl) eventf(logger klog.Logger, regarding runtime.Object, related runtime.Object, annotations map[string]string, eventtype, reason, action, note string, args ...interface{}) { timestamp := metav1.MicroTime{Time: time.Now()} message := fmt.Sprintf(note, args...) refRegarding, err := reference.GetReference(recorder.scheme, regarding) @@ -81,14 +90,14 @@ func (recorder *recorderImpl) eventf(logger klog.Logger, regarding runtime.Objec logger.Error(nil, "Unsupported event type", "eventType", eventtype) return } - event := recorder.makeEvent(refRegarding, refRelated, timestamp, eventtype, reason, message, recorder.reportingController, recorder.reportingInstance, action) + event := recorder.makeEvent(refRegarding, refRelated, timestamp, annotations, eventtype, reason, message, recorder.reportingController, recorder.reportingInstance, action) go func() { defer utilruntime.HandleCrash() recorder.Action(watch.Added, event) }() } -func (recorder *recorderImpl) makeEvent(refRegarding *v1.ObjectReference, refRelated *v1.ObjectReference, timestamp metav1.MicroTime, eventtype, reason, message string, reportingController string, reportingInstance string, action string) *eventsv1.Event { +func (recorder *recorderImpl) makeEvent(refRegarding *v1.ObjectReference, refRelated *v1.ObjectReference, timestamp metav1.MicroTime, annotations map[string]string, eventtype, reason, message string, reportingController string, reportingInstance string, action string) *eventsv1.Event { t := metav1.Time{Time: recorder.clock.Now()} namespace := refRegarding.Namespace if namespace == "" { @@ -96,8 +105,9 @@ func (recorder *recorderImpl) makeEvent(refRegarding *v1.ObjectReference, refRel } return &eventsv1.Event{ ObjectMeta: metav1.ObjectMeta{ - Name: util.GenerateEventName(refRegarding.Name, t.UnixNano()), - Namespace: namespace, + Name: util.GenerateEventName(refRegarding.Name, t.UnixNano()), + Namespace: namespace, + Annotations: annotations, }, EventTime: timestamp, Series: nil, diff --git a/vendor/k8s.io/client-go/tools/events/fake.go b/vendor/k8s.io/client-go/tools/events/fake.go index e26826d6c8..5c1892a766 100644 --- a/vendor/k8s.io/client-go/tools/events/fake.go +++ b/vendor/k8s.io/client-go/tools/events/fake.go @@ -27,26 +27,71 @@ import ( // when created manually and not by NewFakeRecorder, however all events may be // thrown away in this case. type FakeRecorder struct { - Events chan string + Events chan string + Verbose bool } var _ EventRecorderLogger = &FakeRecorder{} +var _ AnnotatedEventRecorder = &FakeRecorder{} // Eventf emits an event func (f *FakeRecorder) Eventf(regarding runtime.Object, related runtime.Object, eventtype, reason, action, note string, args ...interface{}) { - if f.Events != nil { - f.Events <- fmt.Sprintf(eventtype+" "+reason+" "+note, args...) - } + f.writeEvent(regarding, related, nil, eventtype, reason, action, note, args...) +} + +// AnnotatedEventf emits an event like Eventf, but with annotations attached +func (f *FakeRecorder) AnnotatedEventf(regarding runtime.Object, related runtime.Object, annotations map[string]string, eventtype, reason, action, note string, args ...interface{}) { + f.writeEvent(regarding, related, annotations, eventtype, reason, action, note, args...) } func (f *FakeRecorder) WithLogger(logger klog.Logger) EventRecorderLogger { return f } +// writeEvent constructs a string from the event parameters and sends +// it to the Events channel +func (f *FakeRecorder) writeEvent(regarding runtime.Object, related runtime.Object, annotations map[string]string, eventtype, reason, action, note string, args ...interface{}) { + if f.Events != nil { + msg := fmt.Sprintf(eventtype+" "+reason+" "+note, args...) + if f.Verbose { + msg = eventtype + " " + reason + " " + action + " " + fmt.Sprintf(note, args...) + + objectString(regarding) + objectString(related) + annotationsString(annotations) + } + f.Events <- msg + } +} + +// annotationsString returns a formatted string of the annotations map, +// or empty string if none +func annotationsString(annotations map[string]string) string { + annotationString := "" + if len(annotations) > 0 { + annotationString = " " + fmt.Sprint(annotations) + } + return annotationString +} + +// objectString returns a formatted string with the object's kind and +// apiVersion +func objectString(object runtime.Object) string { + objectString := "" + if object != nil { + gvk := object.GetObjectKind().GroupVersionKind() + if !gvk.Empty() { + objectString = fmt.Sprintf(" {kind=%s,apiVersion=%s}", + gvk.Kind, + gvk.GroupVersion(), + ) + } + } + return objectString +} + // NewFakeRecorder creates new fake event recorder with event channel with // buffer of given size. func NewFakeRecorder(bufferSize int) *FakeRecorder { return &FakeRecorder{ - Events: make(chan string, bufferSize), + Events: make(chan string, bufferSize), + Verbose: false, } } diff --git a/vendor/k8s.io/client-go/tools/events/interfaces.go b/vendor/k8s.io/client-go/tools/events/interfaces.go index bb6109f623..209b3c0d51 100644 --- a/vendor/k8s.io/client-go/tools/events/interfaces.go +++ b/vendor/k8s.io/client-go/tools/events/interfaces.go @@ -28,6 +28,7 @@ import ( type EventRecorder = internalevents.EventRecorder type EventRecorderLogger = internalevents.EventRecorderLogger +type AnnotatedEventRecorder = internalevents.AnnotatedEventRecorder // EventBroadcaster knows how to receive events and send them to any EventSink, watcher, or log. type EventBroadcaster interface { diff --git a/vendor/k8s.io/client-go/tools/internal/events/interfaces.go b/vendor/k8s.io/client-go/tools/internal/events/interfaces.go index be6261b531..50bb4d2e80 100644 --- a/vendor/k8s.io/client-go/tools/internal/events/interfaces.go +++ b/vendor/k8s.io/client-go/tools/internal/events/interfaces.go @@ -43,6 +43,15 @@ type EventRecorder interface { Eventf(regarding runtime.Object, related runtime.Object, eventtype, reason, action, note string, args ...interface{}) } +// AnnotatedEventRecorder is an optional extension of EventRecorder that +// supports attaching annotations to events at creation time. +// Annotations are intended for low-frequency correlation metadata, not as a general purpose structured-data channel. +// Kubernetes events are best-effort, supplemental observability data and may be dropped, deduped or aggregated at any +// point in pipeline. Do not rely on annotations for event-driven control flow. +type AnnotatedEventRecorder interface { + AnnotatedEventf(regarding runtime.Object, related runtime.Object, annotations map[string]string, eventtype, reason, action, note string, args ...interface{}) +} + // EventRecorderLogger extends EventRecorder such that a logger can // be set for methods in EventRecorder. Normally, those methods // uses the global default logger to record errors and debug messages. diff --git a/vendor/k8s.io/client-go/tools/leaderelection/OWNERS b/vendor/k8s.io/client-go/tools/leaderelection/OWNERS index 70787f2b52..0aa6fd9a44 100644 --- a/vendor/k8s.io/client-go/tools/leaderelection/OWNERS +++ b/vendor/k8s.io/client-go/tools/leaderelection/OWNERS @@ -1,13 +1,12 @@ # See the OWNERS docs at https://go.k8s.io/owners approvers: - - mikedanese - jefftree reviewers: - wojtek-t - deads2k - - mikedanese - ingvagabund - jefftree emeritus_approvers: - timothysc + - mikedanese diff --git a/vendor/k8s.io/client-go/tools/leaderelection/leaderelection.go b/vendor/k8s.io/client-go/tools/leaderelection/leaderelection.go index 00798d82ac..b4e70a6c7a 100644 --- a/vendor/k8s.io/client-go/tools/leaderelection/leaderelection.go +++ b/vendor/k8s.io/client-go/tools/leaderelection/leaderelection.go @@ -312,12 +312,20 @@ func (le *LeaderElector) renew(ctx context.Context) { } // release attempts to release the leader lease if we have acquired it. +// It retries on conflict, which may occur if the context cancellation +// races with an inflight renew() operation. The client will see a ctx +// cancellation error while the apiserver completes the update and bumps +// the resource version. func (le *LeaderElector) release(logger klog.Logger) bool { - ctx := context.Background() + ctx := klog.NewContext(context.Background(), logger) timeoutCtx, timeoutCancel := context.WithTimeout(ctx, le.config.RenewDeadline) defer timeoutCancel() - // update the resourceVersion of lease - oldLeaderElectionRecord, _, err := le.config.Lock.Get(timeoutCtx) + return le.tryRelease(timeoutCtx) +} + +func (le *LeaderElector) tryRelease(ctx context.Context) bool { + logger := klog.FromContext(ctx) + oldLeaderElectionRecord, _, err := le.config.Lock.Get(ctx) if err != nil { if !errors.IsNotFound(err) { logger.Error(err, "error retrieving resource lock", "lock", le.config.Lock.Describe()) @@ -337,7 +345,11 @@ func (le *LeaderElector) release(logger klog.Logger) bool { RenewTime: now, AcquireTime: now, } - if err := le.config.Lock.Update(timeoutCtx, leaderElectionRecord); err != nil { + if err := le.config.Lock.Update(ctx, leaderElectionRecord); err != nil { + if errors.IsConflict(err) { + logger.V(4).Info("Conflict when releasing lease, retrying", "lock", le.config.Lock.Describe()) + return le.tryRelease(ctx) + } logger.Error(err, "Failed to release lease", "lock", le.config.Lock.Describe()) return false } diff --git a/vendor/k8s.io/client-go/tools/leaderelection/resourcelock/multilock.go b/vendor/k8s.io/client-go/tools/leaderelection/resourcelock/multilock.go index 5ee1dcbb50..e2ba21d37e 100644 --- a/vendor/k8s.io/client-go/tools/leaderelection/resourcelock/multilock.go +++ b/vendor/k8s.io/client-go/tools/leaderelection/resourcelock/multilock.go @@ -25,10 +25,14 @@ import ( ) const ( + // Deprecated: UnknownLeader is only used by MultiLock, which is deprecated. UnknownLeader = "leaderelection.k8s.io/unknown" ) -// MultiLock is used for lock's migration +// Deprecated: MultiLock was used to facilitate migration from non-lease +// based leader election to lease-based leader election. Support for +// non-lease locks was removed in Kubernetes 1.28, making MultiLock +// non-functional. Use LeaseLock directly instead. type MultiLock struct { Primary Interface Secondary Interface @@ -99,6 +103,7 @@ func (ml *MultiLock) Identity() string { return ml.Primary.Identity() } +// Deprecated: ConcatRawRecord is only used by MultiLock, which is deprecated. func ConcatRawRecord(primaryRaw, secondaryRaw []byte) []byte { return bytes.Join([][]byte{primaryRaw, secondaryRaw}, []byte(",")) } diff --git a/vendor/k8s.io/client-go/tools/metrics/metrics.go b/vendor/k8s.io/client-go/tools/metrics/metrics.go index 2f626475b2..bac15ae140 100644 --- a/vendor/k8s.io/client-go/tools/metrics/metrics.go +++ b/vendor/k8s.io/client-go/tools/metrics/metrics.go @@ -25,7 +25,37 @@ import ( "time" ) -var registerMetrics sync.Once +var ( + registerMetrics sync.Once + ensureRegisteredOnce sync.Once + // ensureRegisteredFn, if set via RegisterOpts.RegisterFn, is invoked + // exactly once before any rest client is constructed. Adapter packages + // (e.g. k8s.io/component-base/metrics/prometheus/restclient) install + // this callback in their init() so that the actual registration with + // legacyregistry — and the metric Create() that reads + // feature-gate-derived options like NativeHistograms — happens at + // runtime rather than at init() time. See EnsureRegistered for the + // caller-side contract. + ensureRegisteredFn func() +) + +// EnsureRegistered invokes the callback installed via RegisterOpts.RegisterFn (if +// any) exactly once. Callers should treat it as idempotent; subsequent calls are +// effectively free. +// +// New public constructors or entry points for packages in client-go that create +// a REST client, HTTP transport, or credential provider should invoke EnsureRegistered() +// at the very beginning of the function. Adapter Observe methods +// also call EnsureRegistered(), so no observations are lost if a constructor +// forgets to invoke it, but if invoked, the entrypoint call shifts registration from +// "first-observation" to "first client construction", meaning the metric +// series is visible to Promteheus scrapes from process startup rather than +// appearing only after the first request. +func EnsureRegistered() { + if ensureRegisteredFn != nil { + ensureRegisteredOnce.Do(ensureRegisteredFn) + } +} // DurationMetric is a measurement of some amount of time. type DurationMetric interface { @@ -163,6 +193,12 @@ type RegisterOpts struct { TransportCAReloads TransportCAReloadsMetric TransportCertRotationGCCalls TransportCertRotationGCCallsMetric TransportCacheGCCalls TransportCacheGCCallsMetric + + // RegisterFn, if non-nil, is invoked exactly once by EnsureRegistered(). + // before the first rest client is constructed. Adapters use this to defer + // registrations that depend on runtime state (eg., feature gates read my metric + // Create() without changing the import side contract of the adapter package.) + RegisterFn func() } // Register registers metrics for the rest client to use. This can @@ -197,7 +233,7 @@ func Register(opts RegisterOpts) { ExecPluginCalls = opts.ExecPluginCalls } if opts.ExecPluginPolicyCalls != nil { - ExecPluginCalls = opts.ExecPluginCalls + ExecPluginPolicyCalls = opts.ExecPluginPolicyCalls } if opts.RequestRetry != nil { RequestRetry = opts.RequestRetry @@ -217,6 +253,9 @@ func Register(opts RegisterOpts) { if opts.TransportCacheGCCalls != nil { TransportCacheGCCalls = opts.TransportCacheGCCalls } + if opts.RegisterFn != nil { + ensureRegisteredFn = opts.RegisterFn + } }) } diff --git a/vendor/k8s.io/client-go/tools/pager/pager.go b/vendor/k8s.io/client-go/tools/pager/pager.go index 3c77cc37fa..500923e28f 100644 --- a/vendor/k8s.io/client-go/tools/pager/pager.go +++ b/vendor/k8s.io/client-go/tools/pager/pager.go @@ -219,7 +219,7 @@ func (p *ListPager) eachListChunkBuffered(ctx context.Context, options metav1.Li chunkC := make(chan runtime.Object, p.PageBufferSize) bgResultC := make(chan error, 1) go func() { - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithContext(ctx) var err error defer func() { diff --git a/vendor/k8s.io/client-go/tools/record/event.go b/vendor/k8s.io/client-go/tools/record/event.go index 305a924388..8f8e3ebf78 100644 --- a/vendor/k8s.io/client-go/tools/record/event.go +++ b/vendor/k8s.io/client-go/tools/record/event.go @@ -176,6 +176,12 @@ func (a *EventRecorderAdapter) Eventf(regarding, _ runtime.Object, eventtype, re a.recorder.Eventf(regarding, eventtype, reason, note, args...) } +// AnnotatedEventf is a wrapper around v1 AnnotatedEventf +func (a *EventRecorderAdapter) AnnotatedEventf(regarding, _ runtime.Object, annotations map[string]string, eventtype, reason, action, note string, args ...interface{}) { + //nolint:forbidigo // Legacy usage + a.recorder.AnnotatedEventf(regarding, annotations, eventtype, reason, note, args...) +} + func (a *EventRecorderAdapter) WithLogger(logger klog.Logger) internalevents.EventRecorderLogger { return &EventRecorderAdapter{ recorder: a.recorder.WithLogger(logger), @@ -292,7 +298,7 @@ func (e *eventBroadcasterImpl) recordToSink(sink EventSink, event *v1.Event, eve event = &eventCopy result, err := eventCorrelator.EventCorrelate(event) if err != nil { - utilruntime.HandleError(err) + utilruntime.HandleErrorWithContext(e.cancelationCtx, err, "Event correlation failed") } if result.Skip { return @@ -402,7 +408,7 @@ func (e *eventBroadcasterImpl) StartEventWatcher(eventHandler func(*v1.Event)) w return watch.NewEmptyWatch() } go func() { - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithContext(e.cancelationCtx) for { select { case <-e.cancelationCtx.Done(): diff --git a/vendor/k8s.io/client-go/tools/record/events_cache.go b/vendor/k8s.io/client-go/tools/record/events_cache.go index 9eae6971c1..4b87383011 100644 --- a/vendor/k8s.io/client-go/tools/record/events_cache.go +++ b/vendor/k8s.io/client-go/tools/record/events_cache.go @@ -48,7 +48,7 @@ const ( defaultSpamQPS = 1. / 300. ) -// getEventKey builds unique event key based on source, involvedObject, reason, message +// getEventKey builds unique event key based on source, involvedObject, reason, message. func getEventKey(event *v1.Event) string { return strings.Join([]string{ event.Source.Component, @@ -66,7 +66,7 @@ func getEventKey(event *v1.Event) string { "") } -// getSpamKey builds unique event key based on source, involvedObject +// getSpamKey builds unique event key based on source, involvedObject. func getSpamKey(event *v1.Event) string { return strings.Join([]string{ event.Source.Component, @@ -124,6 +124,7 @@ type spamRecord struct { } // Filter controls that a given source+object are not exceeding the allowed rate. +// The event parameter must not be nil. func (f *EventSourceObjectSpamFilter) Filter(event *v1.Event) bool { var record spamRecord @@ -157,7 +158,8 @@ func (f *EventSourceObjectSpamFilter) Filter(event *v1.Event) bool { type EventAggregatorKeyFunc func(event *v1.Event) (aggregateKey string, localKey string) // EventAggregatorByReasonFunc aggregates events by exact match on event.Source, event.InvolvedObject, event.Type, -// event.Reason, event.ReportingController and event.ReportingInstance +// event.Reason, event.ReportingController and event.ReportingInstance. +// The event parameter must not be nil. func EventAggregatorByReasonFunc(event *v1.Event) (string, string) { return strings.Join([]string{ event.Source.Component, @@ -235,6 +237,8 @@ type aggregateRecord struct { // - The cache key for the event, for correlation purposes. This will be set to // the full key for normal events, and to the result of // EventAggregatorMessageFunc for aggregate events. +// +// The newEvent parameter must not be nil. func (e *EventAggregator) EventAggregate(newEvent *v1.Event) (*v1.Event, string) { now := metav1.NewTime(e.clock.Now()) var record aggregateRecord @@ -515,7 +519,8 @@ func (c *EventCorrelator) EventCorrelate(newEvent *v1.Event) (*EventCorrelateRes return &EventCorrelateResult{Event: observedEvent, Patch: patch}, err } -// UpdateState based on the latest observed state from server +// UpdateState based on the latest observed state from server. +// The event parameter must not be nil. func (c *EventCorrelator) UpdateState(event *v1.Event) { c.logger.updateState(event) } diff --git a/vendor/k8s.io/client-go/transport/OWNERS b/vendor/k8s.io/client-go/transport/OWNERS index 34adee5ec5..17c96a91ef 100644 --- a/vendor/k8s.io/client-go/transport/OWNERS +++ b/vendor/k8s.io/client-go/transport/OWNERS @@ -5,4 +5,3 @@ reviewers: - wojtek-t - deads2k - liggitt - - caesarxuchao diff --git a/vendor/k8s.io/client-go/transport/transport.go b/vendor/k8s.io/client-go/transport/transport.go index be97b76210..c4595da308 100644 --- a/vendor/k8s.io/client-go/transport/transport.go +++ b/vendor/k8s.io/client-go/transport/transport.go @@ -29,12 +29,14 @@ import ( utilnet "k8s.io/apimachinery/pkg/util/net" clientgofeaturegate "k8s.io/client-go/features" + "k8s.io/client-go/tools/metrics" "k8s.io/klog/v2" ) // New returns an http.RoundTripper that will provide the authentication // or transport level security defined by the provided Config. func New(config *Config) (http.RoundTripper, error) { + metrics.EnsureRegistered() // Set transport level security if config.Transport != nil && (config.HasCA() || config.HasCertAuth() || config.HasCertCallback() || config.TLS.Insecure) { return nil, fmt.Errorf("using a custom transport with TLS certificate options or the insecure flag is not allowed") diff --git a/vendor/k8s.io/client-go/util/consistencydetector/data_consistency_detector.go b/vendor/k8s.io/client-go/util/consistencydetector/data_consistency_detector.go index 72c0124a0f..d46c429e75 100644 --- a/vendor/k8s.io/client-go/util/consistencydetector/data_consistency_detector.go +++ b/vendor/k8s.io/client-go/util/consistencydetector/data_consistency_detector.go @@ -66,12 +66,19 @@ type TransformFunc func(interface{}) (interface{}, error) // it is guarded by an environmental variable. // we cannot manipulate the environmental variable because // it will affect other tests in this package. +// +// The identity string can be left empty if the logger in the context already +// identifies what is being watched. func CheckDataConsistency[T runtime.Object, U any](ctx context.Context, identity string, lastSyncedResourceVersion string, listFn ListFunc[T], listItemTransformFunc TransformFunc, listOptions metav1.ListOptions, retrieveItemsFn RetrieveItemsFunc[U]) { + logger := klog.FromContext(ctx) + if identity != "" { + logger = klog.LoggerWithName(logger, identity) + } if !canFormAdditionalListCall(lastSyncedResourceVersion, listOptions) { - klog.V(4).Infof("data consistency check for %s is enabled but the parameters (RV, ListOptions) doesn't allow for creating a valid LIST request. Skipping the data consistency check.", identity) + logger.V(4).Info("Data consistency check is enabled but the parameters (RV, ListOptions) doesn't allow for creating a valid LIST request. Skipping the data consistency check.") return } - klog.Warningf("data consistency check for %s is enabled, this will result in an additional call to the API server.", identity) + logger.Info("Warning: data consistency check is enabled, this will result in an additional call to the API server.") retrievedItems := toMetaObjectSliceOrDie(retrieveItemsFn()) listOptions = prepareListCallOptions(lastSyncedResourceVersion, listOptions, len(retrievedItems)) @@ -82,13 +89,13 @@ func CheckDataConsistency[T runtime.Object, U any](ctx context.Context, identity // the consistency check will only be enabled in the CI // and LIST calls in general will be retired by the client-go library // if we fail simply log and retry - klog.Errorf("failed to list data from the server, retrying until stopCh is closed, err: %v", err) + logger.Info("Failed to list data from the server, retrying until context is canceled", "err", err) return false, nil } return true, nil }) if err != nil { - klog.Errorf("failed to list data from the server, the data consistency check for %s won't be performed, stopCh was closed, err: %v", identity, err) + logger.Error(err, "Failed to list data from the server, the data consistency check won't be performed, stopCh was closed") return } @@ -111,7 +118,7 @@ func CheckDataConsistency[T runtime.Object, U any](ctx context.Context, identity sort.Sort(byUID(retrievedItems)) if !reflect.DeepEqual(listItems, retrievedItems) { - klog.Infof("previously received data for %s is different than received by the standard list api call against etcd, diff: %v", identity, diff.Diff(listItems, retrievedItems)) + logger.Info("Previously received data is different than received by the standard list api call against etcd", "diff", diff.Diff(listItems, retrievedItems)) msg := fmt.Sprintf("data inconsistency detected for %s, panicking!", identity) panic(msg) } diff --git a/vendor/k8s.io/client-go/util/retry/OWNERS b/vendor/k8s.io/client-go/util/retry/OWNERS deleted file mode 100644 index 75736b5aac..0000000000 --- a/vendor/k8s.io/client-go/util/retry/OWNERS +++ /dev/null @@ -1,4 +0,0 @@ -# See the OWNERS docs at https://go.k8s.io/owners - -reviewers: - - caesarxuchao diff --git a/vendor/k8s.io/client-go/util/retry/util.go b/vendor/k8s.io/client-go/util/retry/util.go index 57d3cd49c1..fd2a959ec6 100644 --- a/vendor/k8s.io/client-go/util/retry/util.go +++ b/vendor/k8s.io/client-go/util/retry/util.go @@ -59,7 +59,7 @@ func OnError(backoff wait.Backoff, retriable func(error) bool, fn func() error) return false, err } }) - if wait.Interrupted(err) { + if wait.Interrupted(err) && lastErr != nil { err = lastErr } return err diff --git a/vendor/k8s.io/code-generator/cmd/applyconfiguration-gen/args/args.go b/vendor/k8s.io/code-generator/cmd/applyconfiguration-gen/args/args.go index 36aa7a3710..487b936e6f 100644 --- a/vendor/k8s.io/code-generator/cmd/applyconfiguration-gen/args/args.go +++ b/vendor/k8s.io/code-generator/cmd/applyconfiguration-gen/args/args.go @@ -20,6 +20,7 @@ import ( "fmt" "github.com/spf13/pflag" + "k8s.io/code-generator/pkg/apidefinitions" "k8s.io/gengo/v2/types" ) @@ -43,6 +44,8 @@ type Args struct { ExternalApplyConfigurations map[types.Name]string OpenAPISchemaFilePath string + + apidefinitions.LintArgs } // New returns default arguments for the generator. @@ -74,6 +77,7 @@ func (args *Args) AddFlags(fs *pflag.FlagSet, inputBase string) { "For example: k8s.io/api/apps/v1.Deployment:k8s.io/client-go/applyconfigurations/apps/v1") fs.StringVar(&args.OpenAPISchemaFilePath, "openapi-schema", "", "path to the openapi schema containing all the types that apply configurations will be generated for") + apidefinitions.AddFlags(&args.LintArgs, fs) } // Validate checks the given arguments. @@ -84,5 +88,8 @@ func (args *Args) Validate() error { if len(args.OutputPkg) == 0 { return fmt.Errorf("--output-pkg must be specified") } + if err := apidefinitions.ValidateFlags(args.LintRules); err != nil { + return err + } return nil } diff --git a/vendor/k8s.io/code-generator/cmd/applyconfiguration-gen/generators/jsontagutil.go b/vendor/k8s.io/code-generator/cmd/applyconfiguration-gen/generators/jsontagutil.go index c11d05deef..e400e0c750 100644 --- a/vendor/k8s.io/code-generator/cmd/applyconfiguration-gen/generators/jsontagutil.go +++ b/vendor/k8s.io/code-generator/cmd/applyconfiguration-gen/generators/jsontagutil.go @@ -42,25 +42,23 @@ func (t JSONTags) String() string { if t.omitempty { tag += ",omitempty" } - if t.inline { - tag += ",inline" - } return tag } func lookupJSONTags(m types.Member) (JSONTags, bool) { - tag := reflect.StructTag(m.Tags).Get("json") - if tag == "" || tag == "-" { + tag, exists := reflect.StructTag(m.Tags).Lookup("json") + if !exists || tag == "-" { return JSONTags{}, false } name, opts := parseTag(tag) + inline := m.Embedded && name == "" if name == "" { name = m.Name } return JSONTags{ name: name, omit: false, - inline: opts.Contains("inline"), + inline: inline, omitempty: opts.Contains("omitempty"), }, true } diff --git a/vendor/k8s.io/code-generator/cmd/applyconfiguration-gen/generators/targets.go b/vendor/k8s.io/code-generator/cmd/applyconfiguration-gen/generators/targets.go index e37d58a1be..73c3f2cb27 100644 --- a/vendor/k8s.io/code-generator/cmd/applyconfiguration-gen/generators/targets.go +++ b/vendor/k8s.io/code-generator/cmd/applyconfiguration-gen/generators/targets.go @@ -32,6 +32,7 @@ import ( "k8s.io/code-generator/cmd/applyconfiguration-gen/args" "k8s.io/code-generator/cmd/client-gen/generators/util" clientgentypes "k8s.io/code-generator/cmd/client-gen/types" + "k8s.io/code-generator/pkg/apidefinitions" genutil "k8s.io/code-generator/pkg/util" ) @@ -62,7 +63,12 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target klog.Fatalf("Failed loading boilerplate: %v", err) } - pkgTypes := packageTypesForInputs(context, args.OutputPkg) + var idOpts []apidefinitions.Option + if len(args.LintRules) > 0 { + idOpts = append(idOpts, apidefinitions.WithLintRules(args.LintRules...)) + } + + pkgTypes := packageTypesForInputs(context, args.OutputPkg, idOpts) initialTypes := args.ExternalApplyConfigurations refs := refGraphForReachableTypes(context.Universe, pkgTypes, initialTypes) typeModels, err := newTypeModels(args.OpenAPISchemaFilePath, pkgTypes) @@ -252,10 +258,17 @@ func goName(gv clientgentypes.GroupVersion, p *types.Package) (string, error) { return goName, nil } -func packageTypesForInputs(context *generator.Context, outPkgBase string) map[string]*types.Package { +func packageTypesForInputs(context *generator.Context, outPkgBase string, idOpts []apidefinitions.Option) map[string]*types.Package { pkgTypes := map[string]*types.Package{} for _, inputDir := range context.Inputs { p := context.Universe.Package(inputDir) + info, err := apidefinitions.Identify(p, apidefinitions.ApplyConfiguration, idOpts...) + if err != nil { + klog.Fatal(err) + } + if !info.ShouldGenerate() { + continue + } internal := isInternalPackage(p) if internal { klog.Warningf("Skipping internal package: %s", p.Path) @@ -280,13 +293,12 @@ func groupVersion(p *types.Package) (gv clientgentypes.GroupVersion, err error) // If there's a comment of the form "// +groupName=somegroup" or // "// +groupName=somegroup.foo.bar.io", use the first field (somegroup) as the name of the // group when generating. - override, err := genutil.ExtractCommentTagsWithoutArguments("+", []string{"groupName"}, p.Comments) - + override, ok, err := apidefinitions.GroupNameForPackage(p.Comments) if err != nil { return gv, err } - if values, ok := override["groupName"]; ok { - gv.Group = clientgentypes.Group(values[0]) + if ok { + gv.Group = clientgentypes.Group(override) } return gv, nil diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/args/args.go b/vendor/k8s.io/code-generator/cmd/client-gen/args/args.go index 2c6abfd3fc..9ea1d0bf36 100644 --- a/vendor/k8s.io/code-generator/cmd/client-gen/args/args.go +++ b/vendor/k8s.io/code-generator/cmd/client-gen/args/args.go @@ -22,6 +22,7 @@ import ( "github.com/spf13/pflag" "k8s.io/code-generator/cmd/client-gen/types" + "k8s.io/code-generator/pkg/apidefinitions" ) type Args struct { @@ -64,6 +65,8 @@ type Args struct { // PrefersProtobuf determines if the generated clientset uses protobuf for API requests. PrefersProtobuf bool + + apidefinitions.LintArgs } func New() *Args { @@ -104,6 +107,7 @@ func (args *Args) AddFlags(fs *pflag.FlagSet, inputBase string) { "optional package of apply configurations, generated by applyconfiguration-gen, that are required to generate Apply functions for each type in the clientset. By default Apply functions are not generated.") fs.BoolVar(&args.PrefersProtobuf, "prefers-protobuf", args.PrefersProtobuf, "when set, client-gen will generate a clientset that uses protobuf for API requests") + apidefinitions.AddFlags(&args.LintArgs, fs) // support old flags fs.SetNormalizeFunc(mapFlagName("clientset-path", "output-pkg", fs.GetNormalizeFunc())) @@ -122,6 +126,9 @@ func (args *Args) Validate() error { if len(args.ClientsetAPIPath) == 0 { return fmt.Errorf("--clientset-api-path cannot be empty") } + if err := apidefinitions.ValidateFlags(args.LintRules); err != nil { + return err + } return nil } diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go index c81e358db9..65dafc82ec 100644 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go +++ b/vendor/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go @@ -28,6 +28,7 @@ import ( "k8s.io/code-generator/cmd/client-gen/generators/scheme" "k8s.io/code-generator/cmd/client-gen/generators/util" clientgentypes "k8s.io/code-generator/cmd/client-gen/types" + "k8s.io/code-generator/pkg/apidefinitions" codegennamer "k8s.io/code-generator/pkg/namer" genutil "k8s.io/code-generator/pkg/util" "k8s.io/gengo/v2" @@ -274,20 +275,18 @@ NextGroup: // applyGroupOverrides applies group name overrides to each package, if applicable. If there is a // comment of the form "// +groupName=somegroup" or "// +groupName=somegroup.foo.bar.io", use the // first field (somegroup) as the name of the group in Go code, e.g. as the func name in a clientset. -// -// If the first field of the groupName is not unique within the clientset, use "// +groupName=unique func applyGroupOverrides(universe types.Universe, args *args.Args) error { // Create a map from "old GV" to "new GV" so we know what changes we need to make. changes := make(map[clientgentypes.GroupVersion]clientgentypes.GroupVersion) for gv, inputDir := range args.GroupVersionPackages() { p := universe.Package(inputDir) - override, err := genutil.ExtractCommentTagsWithoutArguments("+", []string{"groupName"}, p.Comments) + override, ok, err := apidefinitions.GroupNameForPackage(p.Comments) if err != nil { - return fmt.Errorf("cannot extract groupName tags: %w", err) + return err } - if override["groupName"] != nil { + if ok { newGV := clientgentypes.GroupVersion{ - Group: clientgentypes.Group(override["groupName"][0]), + Group: clientgentypes.Group(override), Version: gv.Version, } changes[gv] = newGV @@ -363,11 +362,24 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target klog.Fatalf("cannot apply group overrides: %v", err) } + var idOpts []apidefinitions.Option + if len(args.LintRules) > 0 { + idOpts = append(idOpts, apidefinitions.WithLintRules(args.LintRules...)) + } + gvToTypes := map[clientgentypes.GroupVersion][]*types.Type{} groupGoNames := make(map[clientgentypes.GroupVersion]string) for gv, inputDir := range args.GroupVersionPackages() { p := context.Universe.Package(inputDir) + info, err := apidefinitions.Identify(p, apidefinitions.Client, idOpts...) + if err != nil { + klog.Fatal(err) + } + if !info.ShouldGenerate() { + continue + } + // If there's a comment of the form "// +groupGoName=SomeUniqueShortName", use that as // the Go group identifier in CamelCase. It defaults groupGoNames[gv] = namer.IC(strings.Split(gv.Group.NonEmpty(), ".")[0]) diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_clientset.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_clientset.go index bf49841944..3343942cf6 100644 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_clientset.go +++ b/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_clientset.go @@ -203,7 +203,7 @@ type Clientset struct { tracker testing.ObjectTracker } -func (c *Clientset) Discovery() discovery.DiscoveryInterface { +func (c *Clientset) Discovery() discovery.DiscoveryInterfaces { return c.discovery } diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_clientset.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_clientset.go index e84205604d..7609c907b2 100644 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_clientset.go +++ b/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_clientset.go @@ -78,7 +78,7 @@ func (g *genClientset) GenerateType(c *generator.Context, t *types.Type, w io.Wr "DefaultKubernetesUserAgent": c.Universe.Function(types.Name{Package: "k8s.io/client-go/rest", Name: "DefaultKubernetesUserAgent"}), "RESTClientInterface": c.Universe.Type(types.Name{Package: "k8s.io/client-go/rest", Name: "Interface"}), "RESTHTTPClientFor": c.Universe.Function(types.Name{Package: "k8s.io/client-go/rest", Name: "HTTPClientFor"}), - "DiscoveryInterface": c.Universe.Type(types.Name{Package: "k8s.io/client-go/discovery", Name: "DiscoveryInterface"}), + "DiscoveryInterfaces": c.Universe.Type(types.Name{Package: "k8s.io/client-go/discovery", Name: "DiscoveryInterfaces"}), "DiscoveryClient": c.Universe.Type(types.Name{Package: "k8s.io/client-go/discovery", Name: "DiscoveryClient"}), "httpClient": c.Universe.Type(types.Name{Package: "net/http", Name: "Client"}), "NewDiscoveryClientForConfigAndClient": c.Universe.Function(types.Name{Package: "k8s.io/client-go/discovery", Name: "NewDiscoveryClientForConfigAndClient"}), @@ -102,7 +102,7 @@ func (g *genClientset) GenerateType(c *generator.Context, t *types.Type, w io.Wr var clientsetInterface = ` type Interface interface { - Discovery() $.DiscoveryInterface|raw$ + Discovery() $.DiscoveryInterfaces|raw$ $range .allGroups$$.GroupGoName$$.Version$() $.PackageAlias$.$.GroupGoName$$.Version$Interface $end$ } @@ -126,7 +126,7 @@ func (c *Clientset) $.GroupGoName$$.Version$() $.PackageAlias$.$.GroupGoName$$.V var getDiscoveryTemplate = ` // Discovery retrieves the DiscoveryClient -func (c *Clientset) Discovery() $.DiscoveryInterface|raw$ { +func (c *Clientset) Discovery() $.DiscoveryInterfaces|raw$ { if c == nil { return nil } diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_group.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_group.go index 9f40a790eb..ae86da8380 100644 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_group.go +++ b/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_group.go @@ -20,12 +20,11 @@ import ( "io" "path" - genutil "k8s.io/code-generator/pkg/util" + "k8s.io/code-generator/cmd/client-gen/generators/util" + "k8s.io/code-generator/pkg/apidefinitions" "k8s.io/gengo/v2/generator" "k8s.io/gengo/v2/namer" "k8s.io/gengo/v2/types" - - "k8s.io/code-generator/cmd/client-gen/generators/util" ) // genGroup produces a file for a group client, e.g. ExtensionsClient for the extension group. @@ -73,12 +72,12 @@ func (g *genGroup) GenerateType(c *generator.Context, t *types.Type, w io.Writer // allow user to define a group name that's different from the one parsed from the directory. p := c.Universe.Package(g.inputPackage) groupName := g.group - override, err := genutil.ExtractCommentTagsWithoutArguments("+", []string{"groupName"}, p.Comments) + override, ok, err := apidefinitions.GroupNameForPackage(p.Comments) if err != nil { return err } - if values, ok := override["groupName"]; ok { - groupName = values[0] + if ok { + groupName = override } apiPath := `"` + g.apiPath + `"` diff --git a/vendor/k8s.io/code-generator/cmd/conversion-gen/args/args.go b/vendor/k8s.io/code-generator/cmd/conversion-gen/args/args.go index eaadaa1b93..5727858326 100644 --- a/vendor/k8s.io/code-generator/cmd/conversion-gen/args/args.go +++ b/vendor/k8s.io/code-generator/cmd/conversion-gen/args/args.go @@ -21,6 +21,7 @@ import ( "github.com/spf13/pflag" + "k8s.io/code-generator/pkg/apidefinitions" "k8s.io/gengo/v2" ) @@ -60,6 +61,8 @@ type Args struct { // groups of generators (external API that depends on Kube generations) should // keep tags distinct as well. GeneratedBuildTag string + + apidefinitions.LintArgs } // New returns default arguments for the generator. @@ -84,6 +87,7 @@ func (args *Args) AddFlags(fs *pflag.FlagSet) { fs.StringVar(&args.GoHeaderFile, "go-header-file", "", "the path to a file containing boilerplate header text; the string \"YEAR\" will be replaced with the current 4-digit year") fs.StringVar(&args.GeneratedBuildTag, "build-tag", args.GeneratedBuildTag, "A Go build tag to use to identify files generated by this command. Should be unique.") + apidefinitions.AddFlags(&args.LintArgs, fs) } // Validate checks the given arguments. @@ -91,5 +95,8 @@ func (args *Args) Validate() error { if len(args.OutputFile) == 0 { return fmt.Errorf("--output-file must be specified") } + if err := apidefinitions.ValidateFlags(args.LintRules); err != nil { + return err + } return nil } diff --git a/vendor/k8s.io/code-generator/cmd/conversion-gen/generators/conversion.go b/vendor/k8s.io/code-generator/cmd/conversion-gen/generators/conversion.go index 8ce11392d6..f6e5c0d6e4 100644 --- a/vendor/k8s.io/code-generator/cmd/conversion-gen/generators/conversion.go +++ b/vendor/k8s.io/code-generator/cmd/conversion-gen/generators/conversion.go @@ -26,6 +26,7 @@ import ( "strings" "k8s.io/code-generator/cmd/conversion-gen/args" + "k8s.io/code-generator/pkg/apidefinitions" "k8s.io/gengo/v2" "k8s.io/gengo/v2/generator" "k8s.io/gengo/v2/namer" @@ -43,9 +44,6 @@ const ( // e.g. "+k8s:conversion-gen:explicit-from=net/url.Values" in the type comment // will result in generating conversion from net/url.Values. explicitFromTagName = "k8s:conversion-gen:explicit-from" - // e.g., "+k8s:conversion-gen-external-types=" in doc.go, where - // is the relative path to the package the types are defined in. - externalTypesTagName = "k8s:conversion-gen-external-types" ) func extractTagValues(tagName string, comments []string) ([]string, error) { @@ -72,10 +70,6 @@ func extractExplicitFromTag(comments []string) ([]string, error) { return extractTagValues(explicitFromTagName, comments) } -func extractExternalTypesTag(comments []string) ([]string, error) { - return extractTagValues(externalTypesTagName, comments) -} - func isCopyOnly(comments []string) (bool, error) { values, err := extractTagValues("k8s:conversion-fn", comments) if err != nil { @@ -223,7 +217,12 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target klog.Fatalf("Failed loading boilerplate: %v", err) } - targets := []generator.Target{} + var idOpts []apidefinitions.Option + if len(args.LintRules) > 0 { + idOpts = append(idOpts, apidefinitions.WithLintRules(args.LintRules...)) + } + + targetList := []generator.Target{} // Accumulate pre-existing conversion functions. // TODO: This is too ad-hoc. We need a better way. @@ -243,54 +242,36 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target otherPkgs := make([]string, 0, len(context.Inputs)) pkgToPeers := map[string][]string{} pkgToExternal := map[string]string{} - for _, i := range context.Inputs { - klog.V(3).Infof("pre-processing pkg %q", i) + for _, i := range context.Inputs { + klog.V(3).Infof("considering pkg %q", i) pkg := context.Universe[i] - // Only generate conversions for packages which explicitly request it - // by specifying one or more "+k8s:conversion-gen=" - // in their doc.go file. - peerPkgs, err := extractTag(pkg.Comments) - if peerPkgs == nil { - klog.V(3).Infof(" no tag") - continue - } + info, err := apidefinitions.Identify(pkg, apidefinitions.Conversion, idOpts...) if err != nil { - klog.Errorf("failed to extract tag %s", err) - continue + klog.Fatal(err) } - klog.V(3).Infof(" tags: %q", peerPkgs) - if len(peerPkgs) == 1 && peerPkgs[0] == "false" { - // If a single +k8s:conversion-gen=false tag is defined, we still want - // the generator to fire for this package for explicit conversions, but - // we are clearing the peerPkgs to not generate any standard conversions. - peerPkgs = nil - } else { - // Save peers for each input - pkgToPeers[i] = peerPkgs + if !info.ShouldGenerate() { + klog.V(3).Infof(" no tag") + continue } - otherPkgs = append(otherPkgs, peerPkgs...) - // Keep this one for further processing. filteredInputs = append(filteredInputs, i) - // if the external types are not in the same package where the - // conversion functions to be generated - externalTypesValues, err := extractExternalTypesTag(pkg.Comments) - if err != nil { - klog.Fatalf("Failed to extract external types tag for package %q: %v", i, err) + // Sole +k8s:conversion-gen=false: emit only the package's + // hand-written conversions, no peer-driven standard conversions. + if !info.IsExplicitOnly() { + peerPkgs := info.PeerPackages() + klog.V(3).Infof(" peers: %q", peerPkgs) + pkgToPeers[i] = peerPkgs + otherPkgs = append(otherPkgs, peerPkgs...) } - if externalTypesValues != nil { - if len(externalTypesValues) != 1 { - klog.Fatalf(" expect only one value for %q tag, got: %q", externalTypesTagName, externalTypesValues) - } - externalTypes := externalTypesValues[0] - klog.V(3).Infof(" external types tags: %q", externalTypes) + + externalTypes := info.ExternalTypes() + if externalTypes != i { + klog.V(3).Infof(" external types: %q", externalTypes) otherPkgs = append(otherPkgs, externalTypes) - pkgToExternal[i] = externalTypes - } else { - pkgToExternal[i] = i } + pkgToExternal[i] = externalTypes } // Make sure explicit peer-packages are added. @@ -346,7 +327,7 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target unsafeEquality = noEquality{} } - targets = append(targets, + targetList = append(targetList, &generator.SimpleTarget{ PkgName: path.Base(pkg.Path), PkgPath: pkg.Path, @@ -377,7 +358,7 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target memoryEquivalentTypes.Skip(k.inType, k.outType) } - return targets + return targetList } type equalMemoryTypes map[conversionPair]bool @@ -957,6 +938,16 @@ func (g *genConversion) doSlice(inType, outType *types.Type, sw *generator.Snipp } func (g *genConversion) doStruct(inType, outType *types.Type, sw *generator.SnippetWriter) { + ok, err := g.canUseMemoryCopyConversion(inType, outType) + if err != nil { + klog.Errorf("Type %v: error checking for direct-copy conversion: %v", inType, err) + } + if ok { + args := argsFromType(inType, outType). + With("Pointer", types.Ref("unsafe", "Pointer")) + sw.Do("*out = *(*$.outType|raw$)($.Pointer|raw$(in))\n", args) + return + } for _, inMember := range inType.Members { tagvals, err := extractTag(inMember.CommentLines) if err != nil { @@ -1133,6 +1124,44 @@ func (g *genConversion) doStruct(inType, outType *types.Type, sw *generator.Snip } } +// canUseMemoryCopyConversion reports whether two struct types can be converted +// with a single unsafe memory copy rather than field-by-field conversion. This +// returns true only for structs that are both memory-identical and do not have any +// manual conversions (except copy-only conversions, which are allowed). +func (g *genConversion) canUseMemoryCopyConversion(inType, outType *types.Type) (bool, error) { + if !g.useUnsafe.Equal(inType, outType) { + return false, nil + } + for _, inMember := range inType.Members { + tagvals, err := extractTag(inMember.CommentLines) + if err != nil { + return false, err + } + if len(tagvals) > 0 && tagvals[0] == "false" { + return false, nil // opted out of conversion-gen + } + outMember, found := findMember(outType, inMember.Name) + if !found { + return false, nil + } + + if namer.IsPrivateGoName(inMember.Name) && g.outputPackage != inType.Name.Package { + return false, nil + } + if namer.IsPrivateGoName(outMember.Name) && g.outputPackage != outType.Name.Package { + return false, nil + } + // Bail out if there is a manual conversion other than 'copy-only'. + if function, ok := g.preexists(inMember.Type, outMember.Type); ok { + copyOnly, err := isCopyOnly(function.CommentLines) + if err != nil || !copyOnly { + return false, err + } + } + } + return true, nil +} + func (g *genConversion) isFastConversion(inType, outType *types.Type) bool { switch inType.Kind { case types.Builtin: diff --git a/vendor/k8s.io/code-generator/cmd/deepcopy-gen/args/args.go b/vendor/k8s.io/code-generator/cmd/deepcopy-gen/args/args.go index a437189b58..90080c391d 100644 --- a/vendor/k8s.io/code-generator/cmd/deepcopy-gen/args/args.go +++ b/vendor/k8s.io/code-generator/cmd/deepcopy-gen/args/args.go @@ -20,11 +20,15 @@ import ( "fmt" "github.com/spf13/pflag" + + "k8s.io/code-generator/pkg/apidefinitions" ) type Args struct { OutputFile string GoHeaderFile string + + apidefinitions.LintArgs } // New returns default arguments for the generator. @@ -38,6 +42,7 @@ func (args *Args) AddFlags(fs *pflag.FlagSet) { "the name of the file to be generated") fs.StringVar(&args.GoHeaderFile, "go-header-file", "", "the path to a file containing boilerplate header text; the string \"YEAR\" will be replaced with the current 4-digit year") + apidefinitions.AddFlags(&args.LintArgs, fs) } // Validate checks the given arguments. @@ -45,5 +50,8 @@ func (args *Args) Validate() error { if len(args.OutputFile) == 0 { return fmt.Errorf("--output-file must be specified") } + if err := apidefinitions.ValidateFlags(args.LintRules); err != nil { + return err + } return nil } diff --git a/vendor/k8s.io/code-generator/cmd/deepcopy-gen/generators/deepcopy.go b/vendor/k8s.io/code-generator/cmd/deepcopy-gen/generators/deepcopy.go index ace09baa23..e1ed4f3c0d 100644 --- a/vendor/k8s.io/code-generator/cmd/deepcopy-gen/generators/deepcopy.go +++ b/vendor/k8s.io/code-generator/cmd/deepcopy-gen/generators/deepcopy.go @@ -24,6 +24,7 @@ import ( "strings" "k8s.io/code-generator/cmd/deepcopy-gen/args" + "k8s.io/code-generator/pkg/apidefinitions" genutil "k8s.io/code-generator/pkg/util" "k8s.io/gengo/v2" "k8s.io/gengo/v2/generator" @@ -128,13 +129,28 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target klog.Fatalf("Failed loading boilerplate: %v", err) } - targets := []generator.Target{} + var idOpts []apidefinitions.Option + if len(args.LintRules) > 0 { + idOpts = append(idOpts, apidefinitions.WithLintRules(args.LintRules...)) + } - for _, i := range context.Inputs { - klog.V(3).Infof("Considering pkg %q", i) + targetList := []generator.Target{} + for _, i := range context.Inputs { + klog.V(3).Infof("considering pkg %q", i) pkg := context.Universe[i] + info, err := apidefinitions.Identify(pkg, apidefinitions.Deepcopy, idOpts...) + if err != nil { + klog.Fatal(err) + } + if !info.ShouldGenerate() { + klog.V(3).Infof(" inactive (no +k8s:deepcopy-gen, no type-level opt-in, or =false)") + continue + } + + // extractEnabledTag also parses the comma-separated subparams + // (e.g. ",register=true"), which Target.Values does not. ptag := extractEnabledTag(pkg.Comments) ptagValue := "" ptagRegister := false @@ -172,11 +188,24 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target klog.Fatalf("Types requested deepcopy generation but are not copyable: %s", strings.Join(uncopyable, ", ")) } + } else { + // Don't write empty files + hasCopyable := false + for _, t := range pkg.Types { + if copyableType(t) { + hasCopyable = true + break + } + } + if !hasCopyable { + klog.V(3).Infof(" no copyable types; skipping") + pkgNeedsGeneration = false + } } if pkgNeedsGeneration { klog.V(3).Infof("Package %q needs generation", i) - targets = append(targets, + targetList = append(targetList, &generator.SimpleTarget{ PkgName: strings.Split(path.Base(pkg.Path), ".")[0], PkgPath: pkg.Path, @@ -193,7 +222,7 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target }) } } - return targets + return targetList } // genDeepCopy produces a file with autogenerated deep-copy functions. diff --git a/vendor/k8s.io/code-generator/cmd/defaulter-gen/args/args.go b/vendor/k8s.io/code-generator/cmd/defaulter-gen/args/args.go index 8d8dfe97f4..1163a2bd28 100644 --- a/vendor/k8s.io/code-generator/cmd/defaulter-gen/args/args.go +++ b/vendor/k8s.io/code-generator/cmd/defaulter-gen/args/args.go @@ -21,6 +21,7 @@ import ( "github.com/spf13/pflag" + "k8s.io/code-generator/pkg/apidefinitions" "k8s.io/gengo/v2" ) @@ -34,6 +35,8 @@ type Args struct { // groups of generators (external API that depends on Kube generations) should // keep tags distinct as well. GeneratedBuildTag string + + apidefinitions.LintArgs } // New returns default arguments for the generator. @@ -52,6 +55,7 @@ func (args *Args) AddFlags(fs *pflag.FlagSet) { fs.StringVar(&args.GoHeaderFile, "go-header-file", "", "the path to a file containing boilerplate header text; the string \"YEAR\" will be replaced with the current 4-digit year") fs.StringVar(&args.GeneratedBuildTag, "build-tag", args.GeneratedBuildTag, "A Go build tag to use to identify files generated by this command. Should be unique.") + apidefinitions.AddFlags(&args.LintArgs, fs) } // Validate checks the given arguments. @@ -59,6 +63,9 @@ func (args *Args) Validate() error { if len(args.OutputFile) == 0 { return fmt.Errorf("--output-file must be specified") } + if err := apidefinitions.ValidateFlags(args.LintRules); err != nil { + return err + } return nil } diff --git a/vendor/k8s.io/code-generator/cmd/defaulter-gen/generators/defaulter.go b/vendor/k8s.io/code-generator/cmd/defaulter-gen/generators/defaulter.go index 0ce7d17f7d..488f88714e 100644 --- a/vendor/k8s.io/code-generator/cmd/defaulter-gen/generators/defaulter.go +++ b/vendor/k8s.io/code-generator/cmd/defaulter-gen/generators/defaulter.go @@ -28,6 +28,7 @@ import ( "strings" "k8s.io/code-generator/cmd/defaulter-gen/args" + "k8s.io/code-generator/pkg/apidefinitions" genutil "k8s.io/code-generator/pkg/util" "k8s.io/gengo/v2" "k8s.io/gengo/v2/generator" @@ -62,7 +63,6 @@ var typeZeroValue = map[string]interface{}{ // These are the comment tags that carry parameters for defaulter generation. const tagName = "k8s:defaulter-gen" -const inputTagName = "k8s:defaulter-gen-input" const defaultTagName = "default" func extractDefaultTag(comments []string) ([]string, error) { @@ -87,12 +87,17 @@ func extractTag(comments []string) ([]string, bool) { return values, true } -func extractInputTag(comments []string) ([]string, error) { - tags, err := genutil.ExtractCommentTagsWithoutArguments("+", []string{inputTagName}, comments) +// defaulterMatchType returns the values to be defaulted for pkg, or false +// if defaulter-gen should not run. +func defaulterMatchType(pkg *types.Package, idOpts []apidefinitions.Option) ([]string, bool) { + info, err := apidefinitions.Identify(pkg, apidefinitions.Defaulter, idOpts...) if err != nil { - return nil, err + klog.Fatal(err) + } + if !info.ShouldGenerate() { + return nil, false } - return tags[inputTagName], nil + return info.TypeFilters(), true } func checkTag(comments []string, require ...string) (bool, error) { @@ -250,7 +255,12 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target klog.Fatalf("Failed loading boilerplate: %v", err) } - targets := []generator.Target{} + var idOpts []apidefinitions.Option + if len(args.LintRules) > 0 { + idOpts = append(idOpts, apidefinitions.WithLintRules(args.LintRules...)) + } + + targetList := []generator.Target{} // Accumulate pre-existing default functions. // TODO: This is too ad-hoc. We need a better way. @@ -265,26 +275,20 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target pkgToInput := map[string]string{} for _, i := range context.Inputs { klog.V(5).Infof("considering pkg %q", i) - pkg := context.Universe[i] - // if the types are not in the same package where the defaulter functions to be generated - inputTags, err := extractInputTag(pkg.Comments) + info, err := apidefinitions.Identify(pkg, apidefinitions.Defaulter, idOpts...) if err != nil { - panic(fmt.Sprintf("error extracting input tag: %v", err)) + klog.Fatal(err) } - if len(inputTags) > 1 { - panic(fmt.Sprintf("there may only be one input tag, got %#v", inputTags)) + if !info.ShouldGenerate() { + continue } - if len(inputTags) == 1 { - inputPath := inputTags[0] - if strings.HasPrefix(inputPath, "./") || strings.HasPrefix(inputPath, "../") { - // this is a relative dir, which will not work under gomodules. - // join with the local package path, but warn - klog.Warningf("relative path %s=%s will not work under gomodule mode; use full package path (as used by 'import') instead", inputTagName, inputPath) - inputPath = path.Join(pkg.Path, inputTags[0]) - } + // +k8s:defaulter-gen-input may direct the generator at types in + // a different package than the one where defaulters will be emitted. + inputPath := info.ExternalTypes() + if inputPath != pkg.Path { klog.V(5).Infof(" input pkg %v", inputPath) inputPkgs = append(inputPkgs, inputPath) pkgToInput[i] = inputPath @@ -336,7 +340,7 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target getManualDefaultingFunctions(context, context.Universe[pp], existingDefaulters) } - typesWith, found := extractTag(pkg.Comments) + typesWith, found := defaulterMatchType(pkg, idOpts) if !found { klog.V(2).InfoS(" did not find required tag", "tag", tagName) continue @@ -443,9 +447,12 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target if len(newDefaulters) == 0 { klog.V(5).Infof("no defaulters in package %s", pkg.Name) + if _, hasTag := extractTag(pkg.Comments); !hasTag { + continue + } } - targets = append(targets, + targetList = append(targetList, &generator.SimpleTarget{ PkgName: path.Base(pkg.Path), PkgPath: pkg.Path, @@ -463,7 +470,7 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target }, }) } - return targets + return targetList } // callTreeForType contains fields necessary to build a tree for types. diff --git a/vendor/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/generator.go b/vendor/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/generator.go index c92c7cec02..64634da849 100644 --- a/vendor/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/generator.go +++ b/vendor/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/generator.go @@ -652,7 +652,7 @@ func membersToFields(locator ProtobufLocator, t *types.Type, localPackage types. } // extract information from JSON field tag - if tag := tags.Get("json"); len(tag) > 0 { + if tag, _ := tags.Lookup("json"); len(tag) > 0 { parts := strings.Split(tag, ",") if len(field.Name) == 0 && len(parts[0]) != 0 { field.Name = parts[0] diff --git a/vendor/k8s.io/code-generator/cmd/informer-gen/args/args.go b/vendor/k8s.io/code-generator/cmd/informer-gen/args/args.go index 8052578c54..a3b6dd9079 100644 --- a/vendor/k8s.io/code-generator/cmd/informer-gen/args/args.go +++ b/vendor/k8s.io/code-generator/cmd/informer-gen/args/args.go @@ -20,6 +20,8 @@ import ( "fmt" "github.com/spf13/pflag" + + "k8s.io/code-generator/pkg/apidefinitions" ) // Args is used by the gengo framework to pass args specific to this generator. @@ -35,6 +37,8 @@ type Args struct { // PluralExceptions define a list of pluralizer exceptions in Type:PluralType format. // The default list is "Endpoints:Endpoints" PluralExceptions []string + + apidefinitions.LintArgs } // New returns default arguments for the generator. @@ -62,6 +66,7 @@ func (args *Args) AddFlags(fs *pflag.FlagSet) { "if true, omit the intermediate \"internalversion\" and \"externalversions\" subdirectories") fs.StringSliceVar(&args.PluralExceptions, "plural-exceptions", args.PluralExceptions, "list of comma separated plural exception definitions in Type:PluralizedType format") + apidefinitions.AddFlags(&args.LintArgs, fs) } // Validate checks the given arguments. @@ -78,5 +83,8 @@ func (args *Args) Validate() error { if len(args.ListersPackage) == 0 { return fmt.Errorf("--listers-package must be specified") } + if err := apidefinitions.ValidateFlags(args.LintRules); err != nil { + return err + } return nil } diff --git a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/factory.go b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/factory.go index 237de9342f..b8157d36b0 100644 --- a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/factory.go +++ b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/factory.go @@ -331,7 +331,7 @@ var sharedInformerFactoryInterface = ` // ctx, cancel := context.WithCancel(context.Background()) // defer cancel() // factory := NewSharedInformerFactory(client, resyncPeriod) -// defer factory.WaitForStop() // Returns immediately if nothing was started. +// defer factory.Shutdown() // Returns immediately if nothing was started. // genericInformer := factory.ForResource(resource) // typedInformer := factory.SomeAPIGroup().V1().SomeType() // handle, err := typeInformer.Informer().AddEventHandler(...) @@ -389,7 +389,7 @@ type SharedInformerFactory interface { // WaitForCacheSync blocks until all started informers' caches were synced // or the stop channel gets closed. // - // Contextual logging: WaitForCacheSync should be used instead of WaitForCacheSync in code which supports contextual logging. It also returns a more useful result. + // Contextual logging: WaitForCacheSyncWithContext should be used instead of WaitForCacheSync in code which supports contextual logging. It also returns a more useful result. WaitForCacheSync(stopCh <-chan struct{}) map[{{.reflectType|raw}}]bool // WaitForCacheSyncWithContext blocks until all started informers' caches were synced diff --git a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/informer.go b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/informer.go index ced706a64b..4a95162d33 100644 --- a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/informer.go +++ b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/informer.go @@ -78,40 +78,48 @@ func (g *informerGenerator) GenerateType(c *generator.Context, t *types.Type, w } m := map[string]interface{}{ - "apiScheme": c.Universe.Type(apiScheme), - "cacheIndexers": c.Universe.Type(cacheIndexers), - "cacheListWatch": c.Universe.Type(cacheListWatch), - "cacheMetaNamespaceIndexFunc": c.Universe.Function(cacheMetaNamespaceIndexFunc), - "cacheNamespaceIndex": c.Universe.Variable(cacheNamespaceIndex), - "cacheNewSharedIndexInformer": c.Universe.Function(cacheNewSharedIndexInformer), - "cacheNewSharedIndexInformerWithOptions": c.Universe.Function(cacheNewSharedIndexInformerWithOptions), - "cacheSharedIndexInformer": c.Universe.Type(cacheSharedIndexInformer), - "cacheSharedIndexInformerOptions": c.Universe.Type(cacheSharedIndexInformerOptions), - "cacheToListWatcherWithWatchListSemantics": c.Universe.Function(cacheToListWatcherWithWatchListSemanticsFunc), - "cacheInformerName": c.Universe.Type(cacheInformerName), - "clientSetInterface": clientSetInterface, - "contextContext": c.Universe.Type(contextContext), - "contextBackground": c.Universe.Function(contextBackgroundFunc), - "group": namer.IC(g.groupGoName), - "groupName": g.groupVersion.Group.String(), - "informerFor": informerFor, - "interfacesInformerOptions": c.Universe.Type(types.Name{Package: g.internalInterfacesPackage, Name: "InformerOptions"}), - "interfacesTweakListOptionsFunc": c.Universe.Type(types.Name{Package: g.internalInterfacesPackage, Name: "TweakListOptionsFunc"}), - "interfacesSharedInformerFactory": c.Universe.Type(types.Name{Package: g.internalInterfacesPackage, Name: "SharedInformerFactory"}), - "listOptions": c.Universe.Type(listOptions), - "lister": c.Universe.Type(types.Name{Package: listerPackage, Name: t.Name.Name + "Lister"}), - "namespaceAll": c.Universe.Type(metav1NamespaceAll), - "namespaced": !tags.NonNamespaced, - "newLister": c.Universe.Function(types.Name{Package: listerPackage, Name: "New" + t.Name.Name + "Lister"}), - "resourceName": strings.ToLower(t.Name.Name) + "s", - "runtimeObject": c.Universe.Type(runtimeObject), - "schemaGroupVersionResource": c.Universe.Type(schemaGroupVersionResource), - "timeDuration": c.Universe.Type(timeDuration), - "type": t, - "v1ListOptions": c.Universe.Type(v1ListOptions), - "version": namer.IC(g.groupVersion.Version.String()), - "versionName": g.groupVersion.Version.String(), - "watchInterface": c.Universe.Type(watchInterface), + "apiScheme": c.Universe.Type(apiScheme), + "cacheDeletedObject": c.Universe.Type(cacheDeletedObject), + "cacheIndexers": c.Universe.Type(cacheIndexers), + "cacheListWatch": c.Universe.Type(cacheListWatch), + "cacheMetaNamespaceIndexFunc": c.Universe.Function(cacheMetaNamespaceIndexFunc), + "cacheNamespaceIndex": c.Universe.Variable(cacheNamespaceIndex), + "cacheNewSharedIndexInformer": c.Universe.Function(cacheNewSharedIndexInformer), + "cacheNewTypedSharedIndexInformer": c.Universe.Function(cacheNewTypedSharedIndexInformer), + "cacheNewSharedIndexInformerWithOptions": c.Universe.Function(cacheNewSharedIndexInformerWithOptions), + "cacheSharedIndexInformer": c.Universe.Type(cacheSharedIndexInformer), + "cacheTypedFilteringResourceEventHandler": c.Universe.Type(cacheTypedFilteringResourceEventHandler), + "cacheTypedResourceEventHandlerDetailedFuncs": c.Universe.Type(cacheTypedResourceEventHandlerDetailedFuncs), + "cacheTypedResourceEventHandlerFuncs": c.Universe.Type(cacheTypedResourceEventHandlerFuncs), + "cacheTypedIndexers": c.Universe.Type(cacheTypedIndexers), + "cacheTypedIndexersToIndexers": c.Universe.Type(cacheTypedIndexersToIndexers), + "cacheTypedSharedIndexInformer": c.Universe.Type(cacheTypedSharedIndexInformer), + "cacheSharedIndexInformerOptions": c.Universe.Type(cacheSharedIndexInformerOptions), + "cacheToListWatcherWithWatchListSemantics": c.Universe.Function(cacheToListWatcherWithWatchListSemanticsFunc), + "cacheInformerName": c.Universe.Type(cacheInformerName), + "clientSetInterface": clientSetInterface, + "contextContext": c.Universe.Type(contextContext), + "contextBackground": c.Universe.Function(contextBackgroundFunc), + "group": namer.IC(g.groupGoName), + "groupName": g.groupVersion.Group.String(), + "informerFor": informerFor, + "interfacesInformerOptions": c.Universe.Type(types.Name{Package: g.internalInterfacesPackage, Name: "InformerOptions"}), + "interfacesTweakListOptionsFunc": c.Universe.Type(types.Name{Package: g.internalInterfacesPackage, Name: "TweakListOptionsFunc"}), + "interfacesSharedInformerFactory": c.Universe.Type(types.Name{Package: g.internalInterfacesPackage, Name: "SharedInformerFactory"}), + "listOptions": c.Universe.Type(listOptions), + "lister": c.Universe.Type(types.Name{Package: listerPackage, Name: t.Name.Name + "Lister"}), + "namespaceAll": c.Universe.Type(metav1NamespaceAll), + "namespaced": !tags.NonNamespaced, + "newLister": c.Universe.Function(types.Name{Package: listerPackage, Name: "New" + t.Name.Name + "Lister"}), + "resourceName": strings.ToLower(t.Name.Name) + "s", + "runtimeObject": c.Universe.Type(runtimeObject), + "schemaGroupVersionResource": c.Universe.Type(schemaGroupVersionResource), + "timeDuration": c.Universe.Type(timeDuration), + "type": t, + "v1ListOptions": c.Universe.Type(v1ListOptions), + "version": namer.IC(g.groupVersion.Version.String()), + "versionName": g.groupVersion.Version.String(), + "watchInterface": c.Universe.Type(watchInterface), } sw.Do(typeInformerInterface, m) @@ -122,17 +130,47 @@ func (g *informerGenerator) GenerateType(c *generator.Context, t *types.Type, w sw.Do(typeInformerConstructor, m) sw.Do(typeInformerInformer, m) sw.Do(typeInformerLister, m) + sw.Do(typeInformerToTypedInformer, m) + sw.Do(typeInformerToIndexInformer, m) return sw.Error() } var typeInformerInterface = ` // $.type|public$Informer provides access to a shared informer and lister for -// $.type|publicPlural$. +// $.type|publicPlural$. Prefer using the type-safe variant (see [Typed$.type|public$Informer]). type $.type|public$Informer interface { Informer() $.cacheSharedIndexInformer|raw$ Lister() $.lister|raw$ } + +// Typed$.type|public$Informer provides access to a shared informer and lister for +// $.type|publicPlural$, including the type-safe TypedInformer variant. +// It is a superset of $.type|public$Informer. +type Typed$.type|public$Informer interface { + Informer() $.cacheSharedIndexInformer|raw$ + TypedInformer() $.type|public$IndexInformer + Lister() $.lister|raw$ +} + +// $.type|public$IndexInformer is a wrapper around the underlying [$.cacheSharedIndexInformer|raw$] +// with type-safe variants of several methods. +type $.type|public$IndexInformer $.cacheTypedSharedIndexInformer|raw$[*$.type|raw$] + +// $.type|public$HandlerFuncs is a specialization of [$.cacheTypedResourceEventHandlerFuncs|raw$] for $.type|public$. +type $.type|public$HandlerFuncs = $.cacheTypedResourceEventHandlerFuncs|raw$[*$.type|raw$] + +// $.type|public$DetailedHandlerFuncs is a specialization of [$.cacheTypedResourceEventHandlerDetailedFuncs|raw$] for $.type|public$. +type $.type|public$DetailedHandlerFuncs = $.cacheTypedResourceEventHandlerDetailedFuncs|raw$[*$.type|raw$] + +// $.type|public$FilteringHandler is a specialization of [$.cacheTypedFilteringResourceEventHandler|raw$] for $.type|public$. +type $.type|public$FilteringHandler = $.cacheTypedFilteringResourceEventHandler|raw$[*$.type|raw$] + +// $.type|public$Indexers is a specialization of [$.cacheTypedIndexers|raw$] for $.type|public$. +type $.type|public$Indexers = $.cacheTypedIndexers|raw$[*$.type|raw$] + +// Deleted$.type|public$ is a specialization of [$.cacheDeletedObject|raw$] for $.type|public$. +type Deleted$.type|public$ = $.cacheDeletedObject|raw$[*$.type|raw$] ` var typeInformerStruct = ` @@ -147,17 +185,33 @@ var typeInformerPublicConstructor = ` // New$.type|public$Informer constructs a new informer for $.type|public$ type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTyped$.type|public$Informer]). func New$.type|public$Informer(client $.clientSetInterface|raw$$if .namespaced$, namespace string$end$, resyncPeriod $.timeDuration|raw$, indexers $.cacheIndexers|raw$) $.cacheSharedIndexInformer|raw$ { return New$.type|public$InformerWithOptions(client$if .namespaced$, namespace$end$, $.interfacesInformerOptions|raw${ResyncPeriod: resyncPeriod, Indexers: indexers}) } + +// NewTyped$.type|public$Informer constructs a new informer for $.type|public$ type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTyped$.type|public$Informer(client $.clientSetInterface|raw$$if .namespaced$, namespace string$end$, resyncPeriod $.timeDuration|raw$, indexers $.type|public$Indexers) $.type|public$IndexInformer { + return NewTyped$.type|public$InformerWithOptions(client$if .namespaced$, namespace$end$, $.interfacesInformerOptions|raw${ResyncPeriod: resyncPeriod, Indexers: $.cacheTypedIndexersToIndexers|raw$(indexers)}) +} ` var typeFilteredInformerPublicConstructor = ` // NewFiltered$.type|public$Informer constructs a new informer for $.type|public$ type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFiltered$.type|public$Informer]). func NewFiltered$.type|public$Informer(client $.clientSetInterface|raw$$if .namespaced$, namespace string$end$, resyncPeriod $.timeDuration|raw$, indexers $.cacheIndexers|raw$, tweakListOptions $.interfacesTweakListOptionsFunc|raw$) $.cacheSharedIndexInformer|raw$ { - return New$.type|public$InformerWithOptions(client$if .namespaced$, namespace$end$, $.interfacesInformerOptions|raw${ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTyped$.type|public$InformerWithOptions(client$if .namespaced$, namespace$end$, $.interfacesInformerOptions|raw${ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFiltered$.type|public$Informer constructs a new informer for $.type|public$ type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFiltered$.type|public$Informer(client $.clientSetInterface|raw$$if .namespaced$, namespace string$end$, resyncPeriod $.timeDuration|raw$, indexers $.type|public$Indexers, tweakListOptions $.interfacesTweakListOptionsFunc|raw$) $.type|public$IndexInformer { + return NewTyped$.type|public$InformerWithOptions(client$if .namespaced$, namespace$end$, $.interfacesInformerOptions|raw${ResyncPeriod: resyncPeriod, Indexers: $.cacheTypedIndexersToIndexers|raw$(indexers), TweakListOptions: tweakListOptions}) } ` @@ -165,11 +219,19 @@ var typeInformerPublicConstructorWithOptions = ` // New$.type|public$InformerWithOptions constructs a new informer for $.type|public$ type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTyped$.type|public$InformerWithOptions]). func New$.type|public$InformerWithOptions(client $.clientSetInterface|raw$$if .namespaced$, namespace string$end$, options $.interfacesInformerOptions|raw$) $.cacheSharedIndexInformer|raw$ { + return NewTyped$.type|public$InformerWithOptions(client$if .namespaced$, namespace$end$, options) +} + +// NewTyped$.type|public$InformerWithOptions constructs a new informer for $.type|public$ type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTyped$.type|public$InformerWithOptions(client $.clientSetInterface|raw$$if .namespaced$, namespace string$end$, options $.interfacesInformerOptions|raw$) $.type|public$IndexInformer { gvr := $.schemaGroupVersionResource|raw${Group: "$.groupName$", Version: "$.versionName$", Resource: "$.resourceName$"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return $.cacheNewSharedIndexInformerWithOptions|raw$( + return $.cacheNewTypedSharedIndexInformer|raw$[*$.type|raw$]($.cacheNewSharedIndexInformerWithOptions|raw$( $.cacheToListWatcherWithWatchListSemantics|raw$(&$.cacheListWatch|raw${ ListFunc: func(opts $.v1ListOptions|raw$) ($.runtimeObject|raw$, error) { if tweakListOptions != nil { @@ -202,19 +264,23 @@ func New$.type|public$InformerWithOptions(client $.clientSetInterface|raw$$if .n Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } ` var typeInformerConstructor = ` func (f *$.type|private$Informer) defaultInformer(client $.clientSetInterface|raw$, resyncPeriod $.timeDuration|raw$) $.cacheSharedIndexInformer|raw$ { - return New$.type|public$InformerWithOptions(client$if .namespaced$, f.namespace$end$, $.interfacesInformerOptions|raw${ResyncPeriod: resyncPeriod, Indexers: $.cacheIndexers|raw${$.cacheNamespaceIndex|raw$: $.cacheMetaNamespaceIndexFunc|raw$}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTyped$.type|public$InformerWithOptions(client$if .namespaced$, f.namespace$end$, $.interfacesInformerOptions|raw${ResyncPeriod: resyncPeriod, Indexers: $.cacheIndexers|raw${$.cacheNamespaceIndex|raw$: $.cacheMetaNamespaceIndexFunc|raw$}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } ` var typeInformerInformer = ` func (f *$.type|private$Informer) Informer() $.cacheSharedIndexInformer|raw$ { - return f.factory.$.informerFor$(&$.type|raw${}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *$.type|private$Informer) TypedInformer() $.type|public$IndexInformer { + return $.cacheNewTypedSharedIndexInformer|raw$[*$.type|raw$](f.factory.$.informerFor$(&$.type|raw${}, f.defaultInformer)) } ` @@ -223,3 +289,43 @@ func (f *$.type|private$Informer) Lister() $.lister|raw$ { return $.newLister|raw$(f.Informer().GetIndexer()) } ` + +var typeInformerToTypedInformer = ` +// ToTyped$.type|public$Informer converts an untyped informer into a Typed$.type|public$Informer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *$.type|public$. If that is not the case, calling type-safe methods of the returned +// Typed$.type|public$Informer leads to runtime panics. A safer alternative is to pass +// around a Typed$.type|public$Informer instances that was obtained from a +// SharedInformerFactory. +func ToTyped$.type|public$Informer(informer $.type|public$Informer) Typed$.type|public$Informer { + if informer, ok := informer.(Typed$.type|public$Informer); ok { + return informer + } + return &$.type|private$TypedInformerAdapter{informer} +} + +type $.type|private$TypedInformerAdapter struct { + $.type|public$Informer +} + +func (a *$.type|private$TypedInformerAdapter) TypedInformer() $.type|public$IndexInformer { + return $.cacheNewTypedSharedIndexInformer|raw$[*$.type|raw$](a.Informer()) +} +` + +var typeInformerToIndexInformer = ` +// To$.type|public$IndexInformer converts an untyped informer into a $.type|public$IndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *$.type|public$. If that is not the case, calling type-safe methods of the returned +// $.type|public$IndexInformer leads to runtime panics. A safer alternative is to pass +// around a $.type|public$IndexInformer instances that was obtained from a +// SharedInformerFactory. +func To$.type|public$IndexInformer(informer $.cacheSharedIndexInformer|raw$) $.type|public$IndexInformer { + if informer, ok := informer.($.type|public$IndexInformer); ok { + return informer + } + return $.cacheNewTypedSharedIndexInformer|raw$[*$.type|raw$](informer) +} +` diff --git a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/targets.go b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/targets.go index cdba8e8356..0f916d6bf1 100644 --- a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/targets.go +++ b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/targets.go @@ -25,6 +25,7 @@ import ( "k8s.io/code-generator/cmd/client-gen/generators/util" clientgentypes "k8s.io/code-generator/cmd/client-gen/types" "k8s.io/code-generator/cmd/informer-gen/args" + "k8s.io/code-generator/pkg/apidefinitions" genutil "k8s.io/code-generator/pkg/util" "k8s.io/gengo/v2" "k8s.io/gengo/v2/generator" @@ -104,6 +105,11 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target externalVersionOutputPkg = path.Join(externalVersionOutputPkg, "externalversions") } + var idOpts []apidefinitions.Option + if len(args.LintRules) > 0 { + idOpts = append(idOpts, apidefinitions.WithLintRules(args.LintRules...)) + } + var targetList []generator.Target typesForGroupVersion := make(map[clientgentypes.GroupVersion][]*types.Type) @@ -113,6 +119,14 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target for _, inputPkg := range context.Inputs { p := context.Universe.Package(inputPkg) + info, err := apidefinitions.Identify(p, apidefinitions.Informer, idOpts...) + if err != nil { + klog.Fatal(err) + } + if !info.ShouldGenerate() { + continue + } + objectMeta, internal, err := objectMetaForPackage(p) if err != nil { klog.Fatal(err) @@ -144,23 +158,23 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target // If there's a comment of the form "// +groupName=somegroup" or // "// +groupName=somegroup.foo.bar.io", use the first field (somegroup) as the name of the // group when generating. - override, err := genutil.ExtractCommentTagsWithoutArguments("+", []string{"groupName"}, p.Comments) + override, ok, err := apidefinitions.GroupNameForPackage(p.Comments) if err != nil { - klog.Fatalf("error extracting groupName tags: %v", err) + klog.Fatalf("error resolving group name: %v", err) } - if override["groupName"] != nil { - gv.Group = clientgentypes.Group(override["groupName"][0]) + if ok { + gv.Group = clientgentypes.Group(override) } // If there's a comment of the form "// +groupGoName=SomeUniqueShortName", use that as // the Go group identifier in CamelCase. It defaults groupGoNames[groupPackageName] = namer.IC(strings.Split(gv.Group.NonEmpty(), ".")[0]) - override, err = genutil.ExtractCommentTagsWithoutArguments("+", []string{"groupGoName"}, p.Comments) + goName, err := genutil.ExtractCommentTagsWithoutArguments("+", []string{"groupGoName"}, p.Comments) if err != nil { klog.Fatalf("error extracting groupGoName tags: %v", err) } - if override["groupGoName"] != nil { - groupGoNames[groupPackageName] = namer.IC(override["groupGoName"][0]) + if goName["groupGoName"] != nil { + groupGoNames[groupPackageName] = namer.IC(goName["groupGoName"][0]) } var typesToGenerate []*types.Type diff --git a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/types.go b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/types.go index 445b4604fc..b0e7302fad 100644 --- a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/types.go +++ b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/types.go @@ -20,6 +20,7 @@ import "k8s.io/gengo/v2/types" var ( apiScheme = types.Name{Package: "k8s.io/kubernetes/pkg/api/legacyscheme", Name: "Scheme"} + cacheDeletedObject = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "DeletedObject"} cacheDoneChecker = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "DoneChecker"} cacheGenericLister = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "GenericLister"} cacheIndexers = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "Indexers"} @@ -30,7 +31,14 @@ var ( cacheNewGenericLister = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "NewGenericLister"} cacheNewSharedIndexInformer = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "NewSharedIndexInformer"} cacheNewSharedIndexInformerWithOptions = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "NewSharedIndexInformerWithOptions"} + cacheNewTypedSharedIndexInformer = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "NewTypedSharedIndexInformer"} cacheSharedIndexInformer = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "SharedIndexInformer"} + cacheTypedFilteringResourceEventHandler = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "TypedFilteringResourceEventHandler"} + cacheTypedResourceEventHandlerDetailedFuncs = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "TypedResourceEventHandlerDetailedFuncs"} + cacheTypedResourceEventHandlerFuncs = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "TypedResourceEventHandlerFuncs"} + cacheTypedIndexers = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "TypedIndexers"} + cacheTypedIndexersToIndexers = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "TypedIndexersToIndexers"} + cacheTypedSharedIndexInformer = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "TypedSharedIndexInformer"} cacheSharedIndexInformerOptions = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "SharedIndexInformerOptions"} cacheSyncResult = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "SyncResult"} cacheTransformFunc = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "TransformFunc"} diff --git a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/versioninterface.go b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/versioninterface.go index 5f9a0c218d..d130ba5b3a 100644 --- a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/versioninterface.go +++ b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/versioninterface.go @@ -85,7 +85,7 @@ var versionTemplate = ` type Interface interface { $range .types -$ // $.|publicPlural$ returns a $.|public$Informer. - $.|publicPlural$() $.|public$Informer + $.|publicPlural$() Typed$.|public$Informer $end$ } @@ -102,8 +102,8 @@ func New(f $.interfacesSharedInformerFactory|raw$, namespace string, tweakListOp ` var versionFuncTemplate = ` -// $.type|publicPlural$ returns a $.type|public$Informer. -func (v *version) $.type|publicPlural$() $.type|public$Informer { +// $.type|publicPlural$ returns a Typed$.type|public$Informer. +func (v *version) $.type|publicPlural$() Typed$.type|public$Informer { return &$.type|private$Informer{factory: v.factory$if .namespaced$, namespace: v.namespace$end$, tweakListOptions: v.tweakListOptions} } ` diff --git a/vendor/k8s.io/code-generator/cmd/lister-gen/args/args.go b/vendor/k8s.io/code-generator/cmd/lister-gen/args/args.go index e6b9e00ab9..899ea6c664 100644 --- a/vendor/k8s.io/code-generator/cmd/lister-gen/args/args.go +++ b/vendor/k8s.io/code-generator/cmd/lister-gen/args/args.go @@ -20,6 +20,8 @@ import ( "fmt" "github.com/spf13/pflag" + + "k8s.io/code-generator/pkg/apidefinitions" ) // Args is used by the gengo framework to pass args specific to this generator. @@ -31,6 +33,8 @@ type Args struct { // PluralExceptions specify list of exceptions used when pluralizing certain types. // For example 'Endpoints:Endpoints', otherwise the pluralizer will generate 'Endpointes'. PluralExceptions []string + + apidefinitions.LintArgs } // New returns default arguments for the generator. @@ -48,6 +52,7 @@ func (args *Args) AddFlags(fs *pflag.FlagSet) { "list of comma separated plural exception definitions in Type:PluralizedType format") fs.StringVar(&args.GoHeaderFile, "go-header-file", "", "the path to a file containing boilerplate header text; the string \"YEAR\" will be replaced with the current 4-digit year") + apidefinitions.AddFlags(&args.LintArgs, fs) } // Validate checks the given arguments. @@ -58,5 +63,8 @@ func (args *Args) Validate() error { if len(args.OutputPkg) == 0 { return fmt.Errorf("--output-pkg must be specified") } + if err := apidefinitions.ValidateFlags(args.LintRules); err != nil { + return err + } return nil } diff --git a/vendor/k8s.io/code-generator/cmd/lister-gen/generators/lister.go b/vendor/k8s.io/code-generator/cmd/lister-gen/generators/lister.go index 3a28115fa5..8f9623bcb2 100644 --- a/vendor/k8s.io/code-generator/cmd/lister-gen/generators/lister.go +++ b/vendor/k8s.io/code-generator/cmd/lister-gen/generators/lister.go @@ -26,7 +26,7 @@ import ( "k8s.io/code-generator/cmd/client-gen/generators/util" clientgentypes "k8s.io/code-generator/cmd/client-gen/types" "k8s.io/code-generator/cmd/lister-gen/args" - genutil "k8s.io/code-generator/pkg/util" + "k8s.io/code-generator/pkg/apidefinitions" "k8s.io/gengo/v2" "k8s.io/gengo/v2/generator" "k8s.io/gengo/v2/namer" @@ -67,10 +67,23 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target klog.Fatalf("Failed loading boilerplate: %v", err) } + var idOpts []apidefinitions.Option + if len(args.LintRules) > 0 { + idOpts = append(idOpts, apidefinitions.WithLintRules(args.LintRules...)) + } + var targetList []generator.Target for _, inputPkg := range context.Inputs { p := context.Universe.Package(inputPkg) + info, err := apidefinitions.Identify(p, apidefinitions.Lister, idOpts...) + if err != nil { + klog.Fatal(err) + } + if !info.ShouldGenerate() { + continue + } + objectMeta, internal, err := objectMetaForPackage(p) if err != nil { klog.Fatal(err) @@ -102,12 +115,12 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target // If there's a comment of the form "// +groupName=somegroup" or // "// +groupName=somegroup.foo.bar.io", use the first field (somegroup) as the name of the // group when generating. - override, err := genutil.ExtractCommentTagsWithoutArguments("+", []string{"groupName"}, p.Comments) + override, ok, err := apidefinitions.GroupNameForPackage(p.Comments) if err != nil { - klog.Fatalf("error extracting groupName tags: %v", err) + klog.Fatalf("error resolving group name: %v", err) } - if override["groupName"] != nil { - gv.Group = clientgentypes.Group(strings.SplitN(override["groupName"][0], ".", 2)[0]) + if ok { + gv.Group = clientgentypes.Group(strings.SplitN(override, ".", 2)[0]) } var typesToGenerate []*types.Type diff --git a/vendor/k8s.io/code-generator/cmd/register-gen/args/args.go b/vendor/k8s.io/code-generator/cmd/register-gen/args/args.go index cc1fdafc83..70e2b1d739 100644 --- a/vendor/k8s.io/code-generator/cmd/register-gen/args/args.go +++ b/vendor/k8s.io/code-generator/cmd/register-gen/args/args.go @@ -20,11 +20,14 @@ import ( "fmt" "github.com/spf13/pflag" + "k8s.io/code-generator/pkg/apidefinitions" ) type Args struct { OutputFile string GoHeaderFile string + + apidefinitions.LintArgs } // New returns default arguments for the generator. @@ -38,6 +41,7 @@ func (args *Args) AddFlags(fs *pflag.FlagSet) { "the name of the file to be generated") fs.StringVar(&args.GoHeaderFile, "go-header-file", "", "the path to a file containing boilerplate header text; the string \"YEAR\" will be replaced with the current 4-digit year") + apidefinitions.AddFlags(&args.LintArgs, fs) } // Validate checks the given arguments. @@ -45,6 +49,9 @@ func (args *Args) Validate() error { if len(args.OutputFile) == 0 { return fmt.Errorf("output file base name cannot be empty") } + if err := apidefinitions.ValidateFlags(args.LintRules); err != nil { + return err + } return nil } diff --git a/vendor/k8s.io/code-generator/cmd/register-gen/generators/targets.go b/vendor/k8s.io/code-generator/cmd/register-gen/generators/targets.go index ac465f91bb..9d66e20d96 100644 --- a/vendor/k8s.io/code-generator/cmd/register-gen/generators/targets.go +++ b/vendor/k8s.io/code-generator/cmd/register-gen/generators/targets.go @@ -26,7 +26,7 @@ import ( clientgentypes "k8s.io/code-generator/cmd/client-gen/types" "k8s.io/code-generator/cmd/register-gen/args" - genutil "k8s.io/code-generator/pkg/util" + "k8s.io/code-generator/pkg/apidefinitions" "k8s.io/gengo/v2" "k8s.io/gengo/v2/generator" "k8s.io/gengo/v2/namer" @@ -51,9 +51,17 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target klog.Fatalf("Failed loading boilerplate: %v", err) } - targets := []generator.Target{} + var idOpts []apidefinitions.Option + if len(args.LintRules) > 0 { + idOpts = append(idOpts, apidefinitions.WithLintRules(args.LintRules...)) + } + + targetList := []generator.Target{} for _, input := range context.Inputs { pkg := context.Universe.Package(input) + if !isRegisterGenTarget(pkg, idOpts) { + continue + } internal, err := isInternal(pkg) if err != nil { klog.V(5).Infof("skipping the generation of %s file, due to err %v", args.OutputFile, err) @@ -84,15 +92,13 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target // if there is a comment of the form "// +groupName=somegroup" or "// +groupName=somegroup.foo.bar.io", // extract the fully qualified API group name from it and overwrite the group inferred from the package path - override, err := genutil.ExtractCommentTagsWithoutArguments("+", []string{"groupName"}, pkg.Comments) + override, ok, err := apidefinitions.GroupNameForPackage(pkg.Comments) if err != nil { - klog.Errorf("error extracting groupName tags: %v", err) - continue + klog.Fatalf("error resolving group name: %v", err) } - if override["groupName"] != nil { - groupName := override["groupName"][0] - klog.V(5).Infof("overriding the group name with = %s", groupName) - gv.Group = clientgentypes.Group(groupName) + if ok { + klog.V(5).Infof("overriding the group name with = %s", override) + gv.Group = clientgentypes.Group(override) } } @@ -106,7 +112,7 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target } } - targets = append(targets, + targetList = append(targetList, &generator.SimpleTarget{ PkgName: pkg.Name, PkgPath: pkg.Path, // output to same pkg as input @@ -128,7 +134,18 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target }) } - return targets + return targetList +} + +// isRegisterGenTarget reports whether pkg has opted in to register-gen. +// Activation rules are encoded in apidefinitions.Register's Spec +// (Boolean ActivationTag with a +groupName= fallback). +func isRegisterGenTarget(pkg *types.Package, idOpts []apidefinitions.Option) bool { + info, err := apidefinitions.Identify(pkg, apidefinitions.Register, idOpts...) + if err != nil { + klog.Fatal(err) + } + return info.ShouldGenerate() } // isInternal determines whether the given package diff --git a/vendor/k8s.io/code-generator/cmd/validation-gen/lint.go b/vendor/k8s.io/code-generator/cmd/validation-gen/lint.go new file mode 100644 index 0000000000..63e54e755e --- /dev/null +++ b/vendor/k8s.io/code-generator/cmd/validation-gen/lint.go @@ -0,0 +1,157 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "fmt" + "sort" + + "k8s.io/gengo/v2/codetags" + "k8s.io/gengo/v2/types" + "k8s.io/klog/v2" +) + +// linter is a struct that holds the state of the linting process. +// It contains a map of types that have been linted, a list of linting rules, +// and a list of errors that occurred during the linting process. +type linter struct { + linted map[*types.Type]bool + rules []lintRule + // lintErrors is all the errors, grouped by type, that occurred during the + // linting process. + lintErrors map[*types.Type][]error +} + +// lintRule is a function that validates a slice of comments. +// container is the type containing the element being linted (e.g. the Struct when linting a Field). +// It may be nil if the element is top-level (e.g. a Type definition). +// t is the type of the element being linted (e.g. the Field's type, or the Type itself). +// It returns a string as an error message if the comments are invalid, +// and an error there is an error happened during the linting process. +type lintRule func(container *types.Type, t *types.Type, tags []codetags.Tag) (string, error) + +func (l *linter) AddError(t *types.Type, field, msg string) { + var err error + if field == "" { + err = fmt.Errorf("%s", msg) + } else { + err = fmt.Errorf("field %s: %s", field, msg) + } + l.lintErrors[t] = append(l.lintErrors[t], err) +} + +func newLinter(rules ...lintRule) *linter { + if len(rules) == 0 { + klog.Errorf("rules are not passed to the linter") + } + return &linter{ + linted: make(map[*types.Type]bool), + rules: rules, + lintErrors: map[*types.Type][]error{}, + } +} + +func (l *linter) lintType(t *types.Type) error { + if _, ok := l.linted[t]; ok { + return nil + } + l.linted[t] = true + + if t.CommentLines != nil { + extracted := codetags.Extract("+", t.CommentLines) + if _, ok := extracted["k8s:validation-gen-nolint"]; ok { + return nil + } + klog.V(5).Infof("linting type %s", t.Name.String()) + lintErrs, err := l.lintComments(t, t, t.CommentLines) + if err != nil { + return err + } + for _, lintErr := range lintErrs { + l.AddError(t, "", lintErr) + } + } + switch t.Kind { + case types.Alias: + // Recursively lint the underlying type of the alias. + if err := l.lintType(t.Underlying); err != nil { + return err + } + case types.Struct: + // Recursively lint each member of the struct. + for _, member := range t.Members { + klog.V(5).Infof("linting comments for field %s of type %s", member.String(), t.Name.String()) + lintErrs, err := l.lintComments(t, member.Type, member.CommentLines) + if err != nil { + return err + } + for _, lintErr := range lintErrs { + l.AddError(t, member.Name, lintErr) + } + if err := l.lintType(member.Type); err != nil { + return err + } + } + case types.Slice, types.Array, types.Pointer: + // Recursively lint the element type of the slice or array. + if err := l.lintType(t.Elem); err != nil { + return err + } + case types.Map: + // Recursively lint the key and element types of the map. + if err := l.lintType(t.Key); err != nil { + return err + } + if err := l.lintType(t.Elem); err != nil { + return err + } + } + return nil +} + +// lintComments runs all registered rules on a slice of comments. +func (l *linter) lintComments(container *types.Type, t *types.Type, comments []string) ([]string, error) { + var lintErrs []string + var tags []codetags.Tag + + extracted := codetags.Extract("+", comments) + keys := make([]string, 0, len(extracted)) + for k := range extracted { + keys = append(keys, k) + } + sort.Strings(keys) + + for _, tagName := range keys { + lines := extracted[tagName] + t, err := codetags.ParseAll(lines) + if err != nil { + // If parsing fails, it means it is not a valid tag. + continue + } + tags = append(tags, t...) + } + + for _, rule := range l.rules { + if msg, err := rule(container, t, tags); err != nil { + return nil, err + } else if msg != "" { + lintErrs = append(lintErrs, msg) + } + } + + return lintErrs, nil +} diff --git a/vendor/k8s.io/code-generator/cmd/validation-gen/lint_rules.go b/vendor/k8s.io/code-generator/cmd/validation-gen/lint_rules.go new file mode 100644 index 0000000000..7320369498 --- /dev/null +++ b/vendor/k8s.io/code-generator/cmd/validation-gen/lint_rules.go @@ -0,0 +1,379 @@ +/* +Copyright 2025 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "fmt" + "path" + "strings" + + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/code-generator/cmd/validation-gen/validators" + "k8s.io/gengo/v2/codetags" + "k8s.io/gengo/v2/types" +) + +func checkAlphaBetaUsage(tag codetags.Tag, isRoot bool) (string, error) { + if tag.Name == "k8s:alpha" || tag.Name == "k8s:beta" { + if !isRoot { + return fmt.Sprintf("tag %q can't be used in between", tag.Name), nil + } + if tag.ValueTag == nil { + return fmt.Sprintf("tag %q requires a validation tag as its value payload", tag.Name), nil + } + } + + if tag.ValueTag != nil { + return checkAlphaBetaUsage(*tag.ValueTag, false) + } + return "", nil +} + +// alphaBetaPrefix enforces that +k8s:alpha and +k8s:beta tags are always used as prefix to +func alphaBetaPrefix() lintRule { + return func(container *types.Type, t *types.Type, tags []codetags.Tag) (string, error) { + for _, tag := range tags { + // Only check alpha/beta tags or validation tags. + if msg, err := checkAlphaBetaUsage(tag, true); err != nil || msg != "" { + return msg, err + } + } + return "", nil + } +} + +// checkTagStability recursively checks that a tag and its nested tags +// satisfy the stability requirements of the context. +func checkTagStability(tag codetags.Tag, contextLevel validators.TagStabilityLevel) (string, error) { + tagStability, err := validators.GetStability(tag.Name) + // all DV tags have stability, if a tag doesn't have stability then it is not a valid DV tag. + if err != nil { + return "", nil + } + cmpOrder, err := tagStability.Compare(contextLevel) + if err != nil { + return "", err + } + if cmpOrder < 0 { + return fmt.Sprintf("tag %q with stability level %q cannot be used in %s validation", tag.Name, tagStability, contextLevel), nil + } + if tag.ValueTag != nil { + return checkTagStability(*tag.ValueTag, contextLevel) + } + return "", nil +} + +// validationStability enforces stability level constraints on tags. +func validationStability() lintRule { + return func(container *types.Type, t *types.Type, tags []codetags.Tag) (string, error) { + pkgPath := t.Name.Package + if container != nil { + pkgPath = container.Name.Package + } + + // Unprefixed validations are normally required to be Stable. + // In Alpha packages, we allow Alpha-level and Beta-level validations + // without a prefix. In Beta packages, we allow Beta-level validations + // without a prefix. + defaultContextLevel := validators.TagStabilityLevelStable + // APIVersion is the last element of the package path. + apiVersion := path.Base(pkgPath) + if strings.Contains(apiVersion, "alpha") { + defaultContextLevel = validators.TagStabilityLevelAlpha + } else if strings.Contains(apiVersion, "beta") { + defaultContextLevel = validators.TagStabilityLevelBeta + } + + for _, tag := range tags { + contextLevel := defaultContextLevel + tagToCheck := tag + + // For stability level tags, set the stability context for the inner validation, + // overriding the package-level default. + if tag.Name == "k8s:alpha" || tag.Name == "k8s:beta" { + if tag.Name == "k8s:alpha" { + contextLevel = validators.TagStabilityLevelAlpha + } else { + contextLevel = validators.TagStabilityLevelBeta + } + if tag.ValueTag == nil { + continue + } + tagToCheck = *tag.ValueTag + } + + // For feature gate tags, we allow developers to use nested beta validation tags + // without forcing validation authors to write redundant handwritten code (bypassing the + // declarative validation equivalence check), we automatically relax the stability + // context to Beta if the current context is Stable. + if tagToCheck.Name == "k8s:ifEnabled" || tagToCheck.Name == "k8s:ifDisabled" { + if contextLevel == validators.TagStabilityLevelStable { + contextLevel = validators.TagStabilityLevelBeta + } + } + + msg, err := checkTagStability(tagToCheck, contextLevel) + if err != nil { + return "", err + } + if msg != "" { + return msg, nil + } + } + return "", nil + } +} + +// hasTag recursively checks if a tag with given name exists in the tag tree. +func hasTag(tags []codetags.Tag, name string) bool { + for _, tag := range tags { + if tag.Name == name { + return true + } + // Also check conditional tags value + if tag.ValueTag != nil && hasTag([]codetags.Tag{*tag.ValueTag}, name) { + return true + } + } + return false +} + +// hasRequirednessTag returns true if tags contain +k8s:optional, +k8s:required, or +k8s:forbidden. +func hasRequirednessTag(tags []codetags.Tag) bool { + return hasTag(tags, "k8s:optional") || hasTag(tags, "k8s:required") || hasTag(tags, "k8s:forbidden") +} + +// hasNonOpaqueValidationTag returns true if tags contain any registered validation tag that is not opaqueType. +func hasNonOpaqueValidationTag(extractor validators.ValidationExtractor, chainTags sets.Set[string], tags []codetags.Tag) bool { + for _, tag := range tags { + if tag.Name == "k8s:optional" || tag.Name == "k8s:opaqueType" { + continue + } + if chainTags.Has(tag.Name) { + if tag.ValueTag != nil && hasNonOpaqueValidationTag(extractor, chainTags, []codetags.Tag{*tag.ValueTag}) { + return true + } + continue + } + // Check if it's a known validation tag. + if extractor.IsKnownTag(tag.Name) { + return true + } + } + return false +} + +// requiredAndOptional checks that fields (pointers, slices, maps, arrays) with validation +// (either direct or transitive) explicitly declare +k8s:optional or +k8s:required. +func requiredAndOptional(extractor validators.ValidationExtractor) lintRule { + chainTags := sets.New[string]() + for _, doc := range extractor.Docs() { + if doc.PayloadsType == codetags.ValueTypeTag { + chainTags.Insert(doc.Tag) + } + } + + type opacity struct { + typ, key, val bool + } + + filterTags := func(tags []codetags.Tag) []codetags.Tag { + var filtered []codetags.Tag + for _, tag := range tags { + if extractor.IsKnownTag(tag.Name) { + filtered = append(filtered, tag) + } + } + return filtered + } + + type cacheKey struct { + t *types.Type + op opacity + } + hasValidation := make(map[cacheKey]*bool) + + // returns hasValidation, hasCycle, error + var hasTransitiveValidation func(t *types.Type, op opacity) (bool, bool, error) + hasTransitiveValidation = func(t *types.Type, op opacity) (bool, bool, error) { + if op.typ { + return false, false, nil + } + + ck := cacheKey{t, op} + visitedVal, visited := hasValidation[ck] + if visited { + if visitedVal == nil { + return false, true, nil // cycle detected + } + return *visitedVal, false, nil + } + hasValidation[ck] = nil + + tTags, err := extractor.ExtractTags(validators.Context{Scope: validators.ScopeType, Type: t}, t.CommentLines) + if err != nil { + return false, false, err + } + + typeVals, err := extractor.ExtractValidations( + validators.Context{Scope: validators.ScopeType, Type: t}, + filterTags(tTags)..., + ) + if err != nil { + return false, false, err + } + + op.typ = op.typ || typeVals.OpaqueType + op.key = op.key || typeVals.OpaqueKeyType + op.val = op.val || typeVals.OpaqueValType + + if op.typ { + hasVal := false + hasValidation[ck] = &hasVal + return false, false, nil + } + + if typeVals.HasEmitable() { + hasVal := true + hasValidation[ck] = &hasVal + return true, false, nil + } + + var hasVal, cycleBroken bool + switch t.Kind { + case types.Alias: + hasVal, cycleBroken, err = hasTransitiveValidation(t.Underlying, op) + case types.Slice, types.Array: + hasVal, cycleBroken, err = hasTransitiveValidation(t.Elem, opacity{typ: op.val}) + case types.Map: + kVal, cbKey, err := hasTransitiveValidation(t.Key, opacity{typ: op.key}) + if err != nil { + return false, false, err + } + eVal, cbVal, err := hasTransitiveValidation(t.Elem, opacity{typ: op.val}) + if err != nil { + return false, false, err + } + hasVal = kVal || eVal + cycleBroken = cbKey || cbVal + case types.Pointer: + hasVal, cycleBroken, err = hasTransitiveValidation(t.Elem, op) + case types.Struct: + for _, m := range t.Members { + mTags, err := extractor.ExtractTags(validators.Context{Scope: validators.ScopeField, Type: m.Type}, m.CommentLines) + if err != nil { + return false, false, err + } + if hasNonOpaqueValidationTag(extractor, chainTags, mTags) { + hasVal = true + break + } + fieldVals, err := extractor.ExtractValidations( + validators.Context{Scope: validators.ScopeField, Type: m.Type}, + filterTags(mTags)..., + ) + if err != nil { + return false, false, err + } + mOp := opacity{ + typ: op.typ || fieldVals.OpaqueType, + key: op.key || fieldVals.OpaqueKeyType, + val: op.val || fieldVals.OpaqueValType, + } + hv, cb, err := hasTransitiveValidation(m.Type, mOp) + if err != nil { + return false, false, err + } + cycleBroken = cycleBroken || cb + if hv { + hasVal = true + break + } + } + } + + if err != nil { + return false, false, err + } + + if !cycleBroken { + hasValidation[ck] = &hasVal + } else { + delete(hasValidation, ck) + } + return hasVal, cycleBroken, nil + } + + return func(container *types.Type, t *types.Type, tags []codetags.Tag) (string, error) { + // We only care about fields in a struct. Skip if linting the struct itself. + if container == nil || container.Kind != types.Struct || container == t { + return "", nil + } + + // Skip non-pointer structs (and aliases to them) as they don't support requiredness tags. + underlying := t + for underlying.Kind == types.Alias { + underlying = underlying.Underlying + } + if underlying.Kind == types.Struct { + return "", nil + } + + // Check if already has requiredness tag + if hasRequirednessTag(tags) { + return "", nil + } + + // Check if it has validation (direct or active transitive) + if hasNonOpaqueValidationTag(extractor, chainTags, tags) { + return "field with validation must have +k8s:optional, +k8s:required or +k8s:forbidden", nil + } + + fieldVals, err := extractor.ExtractValidations( + validators.Context{Scope: validators.ScopeField, Type: t}, + filterTags(tags)..., + ) + if err != nil { + return fmt.Sprintf("invalid validation tags: %v", err), nil + } + + topOp := opacity{ + typ: fieldVals.OpaqueType, + key: fieldVals.OpaqueKeyType, + val: fieldVals.OpaqueValType, + } + + hasTransitiveVal, _, err := hasTransitiveValidation(t, topOp) + if err != nil { + return fmt.Sprintf("invalid validation tags: %v", err), nil + } + + if hasTransitiveVal { + return "field with validation must have +k8s:optional, +k8s:required or +k8s:forbidden", nil + } + + return "", nil + } +} + +func lintRules(extractor validators.ValidationExtractor) []lintRule { + return []lintRule{ + alphaBetaPrefix(), + validationStability(), + requiredAndOptional(extractor), + } +} diff --git a/vendor/k8s.io/code-generator/cmd/validation-gen/main.go b/vendor/k8s.io/code-generator/cmd/validation-gen/main.go new file mode 100644 index 0000000000..4385d38381 --- /dev/null +++ b/vendor/k8s.io/code-generator/cmd/validation-gen/main.go @@ -0,0 +1,193 @@ +/* +Copyright 2024 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. +*/ + +// validation-gen is a tool for auto-generating Validation functions. +package main + +import ( + "bytes" + "cmp" + "encoding/json" + "flag" + "fmt" + "os" + "slices" + + "github.com/spf13/pflag" + + "k8s.io/code-generator/cmd/validation-gen/validators" + "k8s.io/code-generator/pkg/apidefinitions" + "k8s.io/gengo/v2" + "k8s.io/gengo/v2/generator" + "k8s.io/gengo/v2/namer" + "k8s.io/gengo/v2/types" + "k8s.io/klog/v2" +) + +func main() { + klog.InitFlags(nil) + args := &Args{} + + args.AddFlags(pflag.CommandLine) + if err := flag.Set("logtostderr", "true"); err != nil { + klog.Fatalf("Error: %v", err) + } + pflag.CommandLine.AddGoFlagSet(flag.CommandLine) + pflag.Parse() + + if err := args.Validate(); err != nil { + klog.Fatalf("Error: %v", err) + } + + if args.PrintDocs { + printDocs() + os.Exit(0) + } + + myTargets := func(context *generator.Context) []generator.Target { + return GetTargets(context, args) + } + + // Run it. + if err := gengo.Execute( + NameSystems(), + DefaultNameSystem(), + myTargets, + gengo.StdBuildTag, + pflag.Args(), + ); err != nil { + klog.Fatalf("Error: %v", err) + } + klog.V(2).Info("Completed successfully.") +} + +type Args struct { + OutputFile string + ReadOnlyPkgs []string // Always consider these as last-ditch possibilities for validations. + GoHeaderFile string + PrintDocs bool + // TestOutputRoot, when non-empty, enables coverage test fixture + // generation. For each Kind with declared rules, emits a test directory + // at /// containing one + // _test.go per version plus a shared + // main_test.go. + TestOutputRoot string + + // TestOutputFilePrefix is prepended to every emitted test fixture + // filename. Empty by default; consumers that mark generated files via a + // linguist-generated gitattributes pattern (e.g. "zz_generated.") set + // this to that prefix. + TestOutputFilePrefix string + + // TestAllowlist, when non-empty, is the path to a YAML file of + // rule-level filters to exclude from fixture generation. Each entry has + // fields apiVersion, kind, path, errorType, origin (use "*" to wildcard + // kind/path/errorType/origin) plus a required reason. + TestAllowlist string + + apidefinitions.LintArgs +} + +// AddFlags add the generator flags to the flag set. +func (args *Args) AddFlags(fs *pflag.FlagSet) { + fs.StringVar(&args.OutputFile, "output-file", "generated.validations.go", + "the name of the file to be generated") + fs.StringSliceVar(&args.ReadOnlyPkgs, "readonly-pkg", args.ReadOnlyPkgs, + "the import path of a package whose validation can be used by generated code, but is not being generated for") + fs.StringVar(&args.GoHeaderFile, "go-header-file", "", + "the path to a file containing boilerplate header text; the string \"YEAR\" will be replaced with the current 4-digit year") + fs.BoolVar(&args.PrintDocs, "docs", false, + "print documentation for supported declarative validations, and then exit") + fs.StringVar(&args.TestOutputRoot, "test-output-root", "", + "if non-empty, also emit declarative-validation coverage test fixtures under this path, organized as ///{,main}_test.go") + fs.StringVar(&args.TestOutputFilePrefix, "test-output-file-prefix", "", + "prefix prepended to every emitted test fixture filename; useful for marking files via a linguist-generated gitattributes pattern (e.g. \"zz_generated.\")") + fs.StringVar(&args.TestAllowlist, "test-allowlist", "", + "path to a YAML config file of rule-level filters to exclude from coverage fixture generation; only meaningful with --test-output-root") + apidefinitions.AddFlags(&args.LintArgs, fs) +} + +// Validate checks the given arguments. +func (args *Args) Validate() error { + if len(args.OutputFile) == 0 { + return fmt.Errorf("--output-file must be specified") + } + if args.TestAllowlist != "" && args.TestOutputRoot == "" { + return fmt.Errorf("--test-allowlist is only meaningful with --test-output-root") + } + if args.TestOutputFilePrefix != "" && args.TestOutputRoot == "" { + return fmt.Errorf("--test-output-file-prefix is only meaningful with --test-output-root") + } + + if err := apidefinitions.ValidateFlags(args.LintRules); err != nil { + return err + } + return nil +} + +func printDocs() { + // We need a fake context to init the validator plugins. + c := &generator.Context{ + Namers: namer.NameSystems{}, + Universe: types.Universe{}, + FileTypes: map[string]generator.FileType{}, + } + + // Initialize all registered validators. + validator := validators.InitGlobalValidator(c, nil) + + docs := validator.Docs() + for i := range docs { + d := &docs[i] + slices.Sort(d.Scopes) + if d.Usage == "" { + // Try to generate a usage string if none was provided. + usage := d.Tag + if len(d.Args) > 0 { + usage += "(" + for i := range d.Args { + if i > 0 { + usage += ", " + } + usage += d.Args[i].Description + } + usage += ")" + } + if len(d.Payloads) > 0 { + usage += "=" + if len(d.Payloads) == 1 { + usage += d.Payloads[0].Description + } else { + usage += "" + } + } + d.Usage = usage + } + } + slices.SortFunc(docs, func(a, b validators.TagDoc) int { + return cmp.Compare(a.Tag, b.Tag) + }) + + var buf bytes.Buffer + encoder := json.NewEncoder(&buf) + encoder.SetEscapeHTML(false) + encoder.SetIndent("", " ") + if err := encoder.Encode(docs); err != nil { + klog.Fatalf("failed to marshal docs: %v", err) + } + + fmt.Println(buf.String()) +} diff --git a/vendor/k8s.io/code-generator/cmd/validation-gen/targets.go b/vendor/k8s.io/code-generator/cmd/validation-gen/targets.go new file mode 100644 index 0000000000..29a676b040 --- /dev/null +++ b/vendor/k8s.io/code-generator/cmd/validation-gen/targets.go @@ -0,0 +1,569 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "cmp" + "fmt" + "reflect" + "slices" + "strings" + + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/code-generator/cmd/validation-gen/validators" + "k8s.io/code-generator/pkg/apidefinitions" + "k8s.io/gengo/v2" + "k8s.io/gengo/v2/codetags" + "k8s.io/gengo/v2/generator" + "k8s.io/gengo/v2/namer" + "k8s.io/gengo/v2/types" + "k8s.io/klog/v2" +) + +// These are the comment tags that carry parameters for validation generation. +const ( + // Defines which types to generate validation for. There are two places + // this can be used: + // Per-package: + // * "*": generate validation for all types in this package + // * "TypesWithField=FooBar": generate validation for all types with a + // field named "FooBar" + // * "TypesWithSuffix=FooBar": generate validation for all types whose + // name ends with "FooBar" + // Per-type: + // * "true": generate validation for this type + // * "false": do not generate validation for this type + mainTagName = "k8s:validation-gen" + // Defines the type of the scheme used to register validations. Defaults to + // "k8s.io/apimachinery/pkg.runtime.Scheme", but can be set to another type + // (e.g. in tests), or set to "nil" to disable scheme registration for this + // package. + schemeRegistryTagName = "k8s:validation-gen-scheme-registry" + // If set, generate go test files for test fixtures. Supported values: "validateFalse". + testFixtureTagName = "k8s:validation-gen-test-fixture" + + // name of the subresource that this type represents and can validate declaratively. + isSubresourceTagName = "k8s:isSubresource" + + // name of a subresource that this type can validate declaratively, tag may be + // repeated to support multiple subresources. + supportsSubresourceTagName = "k8s:supportsSubresource" + + // if set on a package, generates declarative coverage test targets even if it's not a versioned API package. + generateTestTargetsTagName = "k8s:validation-gen-test-targets" +) + +var ( + runtimePkg = "k8s.io/apimachinery/pkg/runtime" + schemeType = types.Name{Package: runtimePkg, Name: "Scheme"} + metav1Pkg = "k8s.io/apimachinery/pkg/apis/meta/v1" + listMetaType = types.Name{Package: metav1Pkg, Name: "ListMeta"} +) + +// extractAndParseTag extracts all the values for a given tag, according to the +// tag grammar. +func extractAndParseTag(tagName string, comments []string) ([]codetags.Tag, error) { + extracted := codetags.Extract("+", comments) + var tags []codetags.Tag + for key, lines := range extracted { + if key != tagName { + continue + } + t, err := codetags.ParseAll(lines) + if err != nil { + return nil, fmt.Errorf("failed to parse tags: %w: %s", err, lines) + } + tags = append(tags, t...) + } + return tags, nil +} + +// validationTypeMatch returns the +k8s:validation-gen tag values for pkg, +// or false if validation-gen should not run. +func validationTypeMatch(pkg *types.Package, idOpts []apidefinitions.Option) ([]string, bool) { + info, err := apidefinitions.Identify(pkg, apidefinitions.Validation, idOpts...) + if err != nil { + klog.Fatal(err) + } + if !info.ShouldGenerate() { + return nil, false + } + return info.TypeFilters(), true +} + +// TODO: this can just accept a single bool +func checkMainTag(comments []string, require ...string) bool { + // TODO: convert to extractAndParseTag() and update all callers to use quoted values + tags, err := gengo.ExtractFunctionStyleCommentTags("+", []string{mainTagName}, comments) + if err != nil { + klog.Fatalf("Failed to extract tags: %v", err) + } + values, found := tags[mainTagName] + if !found { + return false + } + + if len(require) == 0 { + return len(values) == 1 && values[0].Value == "" + } + + valueStrings := make([]string, len(values)) + for i, tag := range values { + valueStrings[i] = tag.Value + } + + return reflect.DeepEqual(valueStrings, require) +} + +func schemeRegistryTag(pkg *types.Package) (types.Name, bool) { + // TODO: convert to extractAndParseTag() and update all callers to use quoted values + tags, err := gengo.ExtractFunctionStyleCommentTags("+", []string{schemeRegistryTagName}, pkg.Comments) + if err != nil { + klog.Fatalf("Failed to extract scheme registry tags: %v", err) + } + values, found := tags[schemeRegistryTagName] + if !found || len(values) == 0 { + return schemeType, true // default + } + if len(values) > 1 { + panic(fmt.Sprintf("Package %q contains more than one usage of %q", pkg.Path, schemeRegistryTagName)) + } + val := values[0].Value + if val == "nil" { + // no registration wanted for this package + return types.Name{}, false + } + return types.ParseFullyQualifiedName(val), true +} + +// registerScheme reports whether pkg registers its validations with a scheme. +func registerScheme(pkg *types.Package) bool { + _, ok := schemeRegistryTag(pkg) + return ok +} + +func isSubresourceTag(t *types.Type) (string, bool) { + var comments []string + comments = append(comments, t.SecondClosestCommentLines...) + comments = append(comments, t.CommentLines...) + tags, err := extractAndParseTag(isSubresourceTagName, comments) + if err != nil { + klog.Fatalf("Failed to extract isSubresource tags: %v", err) + } + if len(tags) == 0 { + return "", false + } + if len(tags) > 1 { + panic(fmt.Sprintf("Type %q contains more than one usage of %q", t.Name.String(), isSubresourceTagName)) + } + return tags[0].Value, true +} + +func supportedSubresourceTags(t *types.Type) sets.Set[string] { + var comments []string + comments = append(comments, t.SecondClosestCommentLines...) + comments = append(comments, t.CommentLines...) + tags, err := extractAndParseTag(supportsSubresourceTagName, comments) + if err != nil { + klog.Fatalf("Failed to extract supportedSubresource tags: %v", err) + } + if len(tags) == 0 { + return sets.New[string]() + } + subresources := sets.New[string]() + for _, tag := range tags { + subresources.Insert(tag.Value) + } + return subresources +} + +var testFixtureTagValues = sets.New("validateFalse") + +func testFixtureTag(pkg *types.Package) sets.Set[string] { + result := sets.New[string]() + // TODO: convert to extractAndParseTag() and update all callers to use quoted values + tags, err := gengo.ExtractFunctionStyleCommentTags("+", []string{testFixtureTagName}, pkg.Comments) + if err != nil { + klog.Fatalf("Failed to extract test fixture tags: %v", err) + } + values, found := tags[testFixtureTagName] + if !found { + return result + } + + for _, tag := range values { + if !testFixtureTagValues.Has(tag.Value) { + panic(fmt.Sprintf("Package %q: %s must be one of '%s', but got: %s", pkg.Path, testFixtureTagName, testFixtureTagValues.UnsortedList(), tag.Value)) + } + result.Insert(tag.Value) + } + return result +} + +func generateTestTargetsTag(pkg *types.Package) bool { + tags, err := gengo.ExtractFunctionStyleCommentTags("+", []string{generateTestTargetsTagName}, pkg.Comments) + if err != nil { + klog.Fatalf("Failed to extract %s tags: %v", generateTestTargetsTagName, err) + } + _, found := tags[generateTestTargetsTagName] + return found +} + +// NameSystems returns the name system used by the generators in this package. +func NameSystems() namer.NameSystems { + return namer.NameSystems{ + "public": namer.NewPublicNamer(1), + "raw": namer.NewRawNamer("", nil), + "objectvalidationfn": validationFnNamer(), + "private": namer.NewPrivateNamer(0), + "name": namer.NewPublicNamer(0), + } +} + +func validationFnNamer() *namer.NameStrategy { + return &namer.NameStrategy{ + Prefix: "Validate_", + Join: func(pre string, in []string, post string) string { + return pre + strings.Join(in, "_") + post + }, + } +} + +// DefaultNameSystem returns the default name system for ordering the types to be +// processed by the generators in this package. +func DefaultNameSystem() string { + return "public" +} + +func GetTargets(context *generator.Context, args *Args) []generator.Target { + boilerplate, err := gengo.GoBoilerplate(args.GoHeaderFile, gengo.StdBuildTag, gengo.StdGeneratedBy) + if err != nil { + klog.Fatalf("Failed loading boilerplate: %v", err) + } + + var idOpts []apidefinitions.Option + if len(args.LintRules) > 0 { + idOpts = append(idOpts, apidefinitions.WithLintRules(args.LintRules...)) + } + + var targetList []generator.Target + + // First load other "input" packages. We do this as a single call because + // it is MUCH faster. + inputPkgs := make([]string, 0, len(context.Inputs)) + pkgToInput := map[string]string{} + inputToCanonicalPkg := map[string]string{} // types package -> the output package cross-package references resolve to + for _, input := range context.Inputs { + klog.V(4).Infof("considering pkg %q", input) + pkg := context.Universe[input] + + info, err := apidefinitions.Identify(pkg, apidefinitions.Validation, idOpts...) + if err != nil { + klog.Fatal(err) + } + if !info.ShouldGenerate() { + continue + } + + // +k8s:validation-gen-input may direct the generator at types in + // a different package than the one where validators will be emitted. + inputPath := info.ExternalTypes() + pkgToInput[input] = inputPath + if inputPath != pkg.Path { + klog.V(4).Infof(" input pkg %v", inputPath) + inputPkgs = append(inputPkgs, inputPath) + } + // An input's validation may be generated into more than one package. One + // is canonical -- the package cross-package references resolve to. The + // registering package is canonical; if none registers, the first one seen + // wins. At most one package may register. + if prev, ok := inputToCanonicalPkg[inputPath]; !ok { + inputToCanonicalPkg[inputPath] = input + } else if registerScheme(pkg) { + if registerScheme(context.Universe[prev]) { + klog.Fatalf("input %q is generated into two registering packages (%q, %q); mark one +k8s:validation-gen-scheme-registry=nil", inputPath, prev, input) + } + inputToCanonicalPkg[inputPath] = input // a registering package displaces a non-registering one + } + } + + // Make sure explicit extra-packages are added. + var readOnlyPkgs []string + for _, pkg := range args.ReadOnlyPkgs { + // In case someone specifies an extra as a path into vendor, convert + // it to its "real" package path. + if i := strings.Index(pkg, "/vendor/"); i != -1 { + pkg = pkg[i+len("/vendor/"):] + } + readOnlyPkgs = append(readOnlyPkgs, pkg) + } + if expanded, err := context.FindPackages(readOnlyPkgs...); err != nil { + klog.Fatalf("cannot find extra packages: %v", err) + } else { + readOnlyPkgs = expanded // now in fully canonical form + } + for _, extra := range readOnlyPkgs { + inputPkgs = append(inputPkgs, extra) + pkgToInput[extra] = extra + // Don't let a read-only package override a generation mapping. + if _, ok := inputToCanonicalPkg[extra]; !ok { + inputToCanonicalPkg[extra] = extra + } + } + + if len(inputPkgs) > 0 { + if _, err := context.LoadPackages(inputPkgs...); err != nil { + klog.Fatalf("cannot load packages: %v", err) + } + } + // update context.Order to the latest context.Universe + orderer := namer.Orderer{Namer: namer.NewPublicNamer(1)} + context.Order = orderer.OrderUniverse(context.Universe) + + // Initialize all validator plugins exactly once. + validator := validators.InitGlobalValidator(context, inputToCanonicalPkg) + + // Create a type discoverer for all types of all inputs. + td := NewTypeDiscoverer(validator, inputToCanonicalPkg) + if err := td.Init(context); err != nil { + klog.Fatalf("Error discovering constants: %v", err) + } + + // Create a linter to collect errors as we go. + linter := newLinter(lintRules(validator)...) + + // groupKindReports accumulates Reports across every input, keyed by + // GroupKind so testTargets emits exactly one SimpleTarget per Kind. + groupKindReports := map[schema.GroupKind][]*report{} + + // Build a cache of type->callNode for every type we need. + for _, input := range context.Inputs { + klog.V(2).InfoS("processing", "pkg", input) + + pkg := context.Universe[input] + + schemeRegistry, registerThisPkg := schemeRegistryTag(pkg) + + criteria, found := validationTypeMatch(pkg, idOpts) + if !found { + klog.V(2).InfoS(" did not find required tag", "tag", mainTagName) + continue + } + if len(criteria) == 1 && criteria[0] == "" { + klog.Fatalf("%s: found package tag %q with no value", input, mainTagName) + } + for _, crit := range criteria { + if crit == "*" { + continue + } + if val, found := strings.CutPrefix(crit, "TypesWithField="); found { + if val == "" { + klog.Fatalf("%s: found package tag \"%s=%s\" with empty value", input, mainTagName, crit) + } + continue + } + if val, found := strings.CutPrefix(crit, "TypesWithSuffix="); found { + if val == "" { + klog.Fatalf("%s: found package tag \"%s=%s\" with empty value", input, mainTagName, crit) + } + continue + } + klog.Fatalf("%s: unknown value for package tag %q: %q", input, mainTagName, crit) + } + shouldCreateObjectValidationFn := func(t *types.Type) bool { + // Never generate validation for unexported types. + if namer.IsPrivateGoName(t.Name.Name) { + return false + } + // opt-out + if checkMainTag(t.CommentLines, "false") { + return false + } + if checkMainTag(t.SecondClosestCommentLines, "false") { + return false + } + // opt-in + if checkMainTag(t.CommentLines, "true") { + return true + } + if checkMainTag(t.SecondClosestCommentLines, "true") { + return true + } + + // skip types that embed metav1.ListMeta + if t.Kind == types.Struct { + for _, member := range t.Members { + if member.Embedded && member.Type.Name == listMetaType { + return false + } + } + } + + // all types + for _, v := range criteria { + if v == "*" { + return true + } + if field, found := strings.CutPrefix(v, "TypesWithField="); found { + if isTypeWithField(t, field) { + return true + } + } + if field, found := strings.CutPrefix(v, "TypesWithSuffix="); found { + if isTypeWithSuffix(t, field) { + return true + } + } + } + return false + } + + // Find the right input pkg, which might not be this one. + inputPath := pkgToInput[input] + // typesPkg is where the types that need validation are defined. + // Sometimes it is different from pkg. For example, kubernetes core/v1 + // types are defined in k8s.io/api/core/v1, while the pkg which holds + // defaulter code is at k/k/pkg/api/v1. + typesPkg := context.Universe[inputPath] + + // Figure out which types we should be considering further. + var rootTypes []*types.Type + for _, t := range typesPkg.Types { + if shouldCreateObjectValidationFn(t) { + rootTypes = append(rootTypes, t) + } else { + klog.V(6).InfoS("skipping type", "type", t) + } + } + // Deterministic ordering helps in logs and debugging. + slices.SortFunc(rootTypes, func(a, b *types.Type) int { + return cmp.Compare(a.Name.String(), b.Name.String()) + }) + + for _, t := range rootTypes { + klog.V(3).InfoS("pre-processing", "type", t) + if err := td.DiscoverType(t); err != nil { + klog.Fatalf("failed to generate validations: %v", err) + } + } + + extracted := codetags.Extract("+", pkg.Comments) + if _, ok := extracted["k8s:validation-gen-nolint"]; !ok { + for _, t := range rootTypes { + klog.V(3).InfoS("linting root-type", "type", t) + if err := linter.lintType(t); err != nil { + klog.Fatalf("failed to lint type %q: %v", t.Name, err) + } + } + } + + targetList = append(targetList, + &generator.SimpleTarget{ + PkgName: pkg.Name, + PkgPath: pkg.Path, + PkgDir: pkg.Dir, // output pkg is the same as the input + HeaderComment: boilerplate, + + FilterFunc: func(c *generator.Context, t *types.Type) bool { + return t.Name.Package == typesPkg.Path + }, + + GeneratorsFunc: func(c *generator.Context) (generators []generator.Generator) { + generators = []generator.Generator{ + NewGenValidations(args.OutputFile, pkg.Path, typesPkg.Path, rootTypes, td, inputToCanonicalPkg, schemeRegistry, registerThisPkg), + } + testFixtureTags := testFixtureTag(pkg) + if testFixtureTags.Len() > 0 { + if !strings.HasSuffix(args.OutputFile, ".go") { + panic(fmt.Sprintf("%s requires that output file have .go suffix", testFixtureTagName)) + } + filename := args.OutputFile[0:len(args.OutputFile)-3] + "_test.go" + generators = append(generators, FixtureTests(filename, testFixtureTags)) + } + if generateTestTargetsTag(pkg) { + var reports []*report + for _, t := range rootTypes { + rules := collectRules(td.typeNodes[t]) + if len(rules) == 0 { + continue + } + reports = append(reports, &report{ + Group: pkg.Path, + Version: pkg.Name, + Kind: t.Name.Name, + Rules: rules, + }) + } + if len(reports) > 0 { + filename := args.OutputFile[0:len(args.OutputFile)-3] + "_coverage_test.go" + generators = append(generators, newCoverageTestGen(pkg.Path, filename, reports, true, nil)) + } + } + return generators + }, + }) + + // Accumulate per-Kind rules; testTargets emits after the loop. + // Only the registering package contributes coverage; a non-registering + // package generated from the same input has identical rules, so counting + // it too would double-list the version for the Kind. + if args.TestOutputRoot != "" && registerThisPkg { + collectReports(typesPkg, rootTypes, td, groupKindReports) + } + } + + // All inputs processed: fail if a ValidateCustom_* function lacks a tag. + if err := validators.VerifyCustomValidationsHaveTags(); err != nil { + klog.Fatalf("%v", err) + } + + // Emit per-Kind coverage test targets. No-op when --test-output-root is empty. + allowlist, err := loadAllowlist(args.TestAllowlist) + if err != nil { + klog.Fatalf("loading allowlist: %v", err) + } + targetList = append(targetList, testTargets(args.TestOutputRoot, args.TestOutputFilePrefix, groupKindReports, allowlist, boilerplate)...) + + if len(linter.lintErrors) > 0 { + buf := strings.Builder{} + + for t, errs := range linter.lintErrors { + buf.WriteString(fmt.Sprintf(" type %v:\n", t)) + for _, err := range errs { + buf.WriteString(fmt.Sprintf(" %s\n", err.Error())) + } + } + klog.Fatalf("lint failed:\n%s", buf.String()) + } + return targetList +} + +func isTypeWithField(t *types.Type, fieldName string) bool { + if t.Kind == types.Struct { + for _, field := range t.Members { + if field.Name == fieldName { + return true + } + } + } + return false +} + +func isTypeWithSuffix(t *types.Type, suffix string) bool { + return strings.HasSuffix(t.Name.Name, suffix) +} diff --git a/vendor/k8s.io/code-generator/cmd/validation-gen/test_targets.go b/vendor/k8s.io/code-generator/cmd/validation-gen/test_targets.go new file mode 100644 index 0000000000..8d9c1d34bc --- /dev/null +++ b/vendor/k8s.io/code-generator/cmd/validation-gen/test_targets.go @@ -0,0 +1,480 @@ +/* +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. +*/ + +package main + +import ( + "cmp" + "fmt" + "io" + "os" + "path/filepath" + "regexp" + "slices" + "strconv" + "strings" + + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/code-generator/cmd/validation-gen/validators" + "k8s.io/gengo/v2/generator" + "k8s.io/gengo/v2/namer" + "k8s.io/gengo/v2/types" + "sigs.k8s.io/yaml" +) + +// Package symbols referenced in emitted test fixtures. fmtPkgSymbols (shared +// with validation.go) covers Fprintln. +var ( + schemaPkg = "k8s.io/apimachinery/pkg/runtime/schema" + schemaPkgSymbols = mkPkgNames(schemaPkg, "GroupVersionKind") + osPkgSymbols = mkPkgNames("os", "Stderr", "Exit") + testingSymbols = mkPkgNames("testing", "M") + runtimeTestPkg = "k8s.io/apimachinery/pkg/test/coverage" + runtimeRegisterSymbols = mkPkgNames(runtimeTestPkg, "RegisterDeclaredRules", "FieldRules") + runtimeAssertCovSymbols = mkPkgNames(runtimeTestPkg, "AssertDeclarativeCoverage") +) + +// apiVersionRe matches Kubernetes-style API versions: v1, v1alpha1, v2beta3. +// Used to detect whether an input package is a versioned API package (vs. a +// helper or main package, which we skip). +var apiVersionRe = regexp.MustCompile(`^v\d+(alpha\d+|beta\d+)?$`) + +// rule is one declared field-validation error. +type rule struct { + ErrorType string + Origin string +} + +// fieldRules maps field path → declared rules for a single Kind. +type fieldRules map[string][]rule + +// report is one GVK's declared rules. Used as in-memory scaffolding while +// emitting per-Kind test fixtures; not serialized. +type report struct { + Group string + Version string + Kind string + Rules fieldRules +} + +// allowlistEntry filters a declared rule out of coverage fixture generation. +// Every field is required: apiVersion matches by literal equality (in the +// "/" form, or just "" for core); kind/path/ +// errorType/origin match literally or wildcard with "*". Empty is rejected +// at load time so an entry can never silently overexclude. +type allowlistEntry struct { + APIVersion string `json:"apiVersion"` + Kind string `json:"kind"` + Path string `json:"path"` + ErrorType string `json:"errorType"` + Origin string `json:"origin"` + Reason string `json:"reason"` +} + +// groupVersion splits e.APIVersion into (group, version). "v1" → ("", "v1"); +// "apps/v1" → ("apps", "v1"). +func (e *allowlistEntry) groupVersion() (string, string) { + if i := strings.IndexByte(e.APIVersion, '/'); i >= 0 { + return e.APIVersion[:i], e.APIVersion[i+1:] + } + return "", e.APIVersion +} + +// matches reports whether the entry filters out the given rule. apiVersion +// must match exactly; the remaining fields match by literal equality or +// wildcard with "*". +func (e *allowlistEntry) matches(group, version, kind, path string, rule rule) bool { + g, v := e.groupVersion() + return g == group && + v == version && + (e.Kind == "*" || e.Kind == kind) && + (e.Path == "*" || e.Path == path) && + (e.ErrorType == "*" || e.ErrorType == rule.ErrorType) && + (e.Origin == "*" || e.Origin == rule.Origin) +} + +// filterReports returns reports with allowlisted rules removed. Reports +// left with no rules are dropped. Returns reports unchanged if allowlist is empty. +func filterReports(reports []*report, allowlist []allowlistEntry) []*report { + if len(allowlist) == 0 { + return reports + } + out := make([]*report, 0, len(reports)) + for _, r := range reports { + filtered := fieldRules{} + for path, rs := range r.Rules { + for _, rule := range rs { + if slices.ContainsFunc(allowlist, func(e allowlistEntry) bool { + return e.matches(r.Group, r.Version, r.Kind, path, rule) + }) { + continue + } + filtered[path] = append(filtered[path], rule) + } + } + if len(filtered) == 0 { + continue + } + out = append(out, &report{ + Group: r.Group, Version: r.Version, Kind: r.Kind, Rules: filtered, + }) + } + return out +} + +// loadAllowlist reads the YAML file at path. Returns nil when path is empty. +// Errors on read/parse failure or any entry missing the required reason. +func loadAllowlist(path string) ([]allowlistEntry, error) { + if path == "" { + return nil, nil + } + data, err := os.ReadFile(path) + if err != nil { + return nil, fmt.Errorf("reading allowlist %q: %w", path, err) + } + var entries []allowlistEntry + if err := yaml.Unmarshal(data, &entries); err != nil { + return nil, fmt.Errorf("parsing allowlist %q: %w", path, err) + } + for i, e := range entries { + for _, f := range []struct{ name, val string }{ + {"apiVersion", e.APIVersion}, + {"kind", e.Kind}, + {"path", e.Path}, + {"errorType", e.ErrorType}, + {"origin", e.Origin}, + {"reason", e.Reason}, + } { + if strings.TrimSpace(f.val) == "" { + return nil, fmt.Errorf("allowlist %q entry %d: %s is required (use %q to wildcard)", path, i, f.name, "*") + } + } + } + return entries, nil +} + +// coverageTestGen emits test files for validation-gen coverage. +// It can emit rule registrations (init func), apiVersions variable, and TestMain. +type coverageTestGen struct { + generator.GoGenerator + outputPackage string + imports namer.ImportTracker + reports []*report + emitMain bool + versions []string +} + +func newCoverageTestGen(outputPackage, filename string, reports []*report, emitMain bool, versions []string) generator.Generator { + return &coverageTestGen{ + GoGenerator: generator.GoGenerator{ + OutputFilename: filename, + }, + outputPackage: outputPackage, + imports: generator.NewImportTrackerForPackage(outputPackage), + reports: reports, + emitMain: emitMain, + versions: versions, + } +} + +func (g *coverageTestGen) Namers(*generator.Context) namer.NameSystems { + return namer.NameSystems{"raw": namer.NewRawNamer(g.outputPackage, g.imports)} +} + +func (g *coverageTestGen) Imports(*generator.Context) []string { return g.imports.ImportLines() } + +func (g *coverageTestGen) Filter(*generator.Context, *types.Type) bool { return false } + +func emitRegisterDeclaredRules(sw *generator.SnippetWriter, c *generator.Context, reports []*report) { + for _, r := range reports { + args := generator.Args{ + "schema": mkSymbolArgs(c, schemaPkgSymbols), + "runtime": mkSymbolArgs(c, runtimeRegisterSymbols), + "group": strconv.Quote(r.Group), + "version": strconv.Quote(r.Version), + "kind": strconv.Quote(r.Kind), + } + sw.Do("func init() {\n", nil) + sw.Do(" $.runtime.RegisterDeclaredRules|raw$(\n", args) + sw.Do(" $.schema.GroupVersionKind|raw${Group: $.group$, Version: $.version$, Kind: $.kind$},\n", args) + sw.Do(" $.runtime.FieldRules|raw${\n", args) + + paths := make([]string, 0, len(r.Rules)) + for p := range r.Rules { + paths = append(paths, p) + } + slices.Sort(paths) + for _, path := range paths { + rules := slices.Clone(r.Rules[path]) + slices.SortFunc(rules, func(a, b rule) int { + if c := cmp.Compare(a.ErrorType, b.ErrorType); c != 0 { + return c + } + return cmp.Compare(a.Origin, b.Origin) + }) + sw.Do(" $.path$: {\n", generator.Args{"path": strconv.Quote(path)}) + for _, r := range rules { + ruleArgs := generator.Args{"errorType": strconv.Quote(r.ErrorType)} + if r.Origin != "" { + ruleArgs["origin"] = strconv.Quote(r.Origin) + sw.Do(" {ErrorType: $.errorType$, Origin: $.origin$},\n", ruleArgs) + } else { + sw.Do(" {ErrorType: $.errorType$},\n", ruleArgs) + } + } + sw.Do(" },\n", nil) + } + sw.Do(" },\n )\n}\n\n", nil) + } +} + +func emitTestMain(sw *generator.SnippetWriter, c *generator.Context) { + args := generator.Args{ + "testing": mkSymbolArgs(c, testingSymbols), + "fmt": mkSymbolArgs(c, fmtPkgSymbols), + "os": mkSymbolArgs(c, osPkgSymbols), + "runtime": mkSymbolArgs(c, runtimeAssertCovSymbols), + } + sw.Do("func TestMain(m *$.testing.M|raw$) {\n", args) + sw.Do(" code := m.Run()\n", nil) + sw.Do(" if err := $.runtime.AssertDeclarativeCoverage|raw$(); err != nil {\n", args) + sw.Do(" $.fmt.Fprintln|raw$($.os.Stderr|raw$, err)\n", args) + sw.Do(" if code == 0 {\n code = 1\n }\n }\n", nil) + sw.Do(" $.os.Exit|raw$(code)\n}\n", args) +} + +func (g *coverageTestGen) Init(c *generator.Context, w io.Writer) error { + sw := generator.NewSnippetWriter(w, c, "$", "$") + if len(g.reports) > 0 { + emitRegisterDeclaredRules(sw, c, g.reports) + } + + if g.emitMain { + if len(g.versions) > 0 { + versions := slices.Clone(g.versions) + slices.Sort(versions) + sw.Do("var apiVersions = []string{", nil) + for i, v := range versions { + if i > 0 { + sw.Do(", ", nil) + } + sw.Do("$.v$", generator.Args{"v": strconv.Quote(v)}) + } + sw.Do("}\n\n", nil) + } + emitTestMain(sw, c) + } + return sw.Error() +} + +// collectReports appends a *report into groupKindReports for each +// Kind in pkg with at least one declared rule. Records all packages; testTargets +// filters out non-API packages (empty Version) at emit time. +func collectReports(pkg *types.Package, rootTypes []*types.Type, td *typeDiscoverer, groupKindReports map[schema.GroupKind][]*report) { + // Derive (group, version) from the input package: + // group: the GroupName const if defined (the established API + // convention); otherwise the package path as a fallback. + // version: the package name when it looks like an API version + // (vN[alphaM|betaM]); empty otherwise — testTargets uses the + // empty version to skip non-API packages. + var group, version string + if c, ok := pkg.Constants["GroupName"]; ok && c.ConstValue != nil { + group = *c.ConstValue + } else { + group = pkg.Path + } + if apiVersionRe.MatchString(pkg.Name) { + version = pkg.Name + } + + for _, t := range rootTypes { + rules := collectRules(td.typeNodes[t]) + if len(rules) == 0 { + continue + } + kind := t.Name.Name + gk := schema.GroupKind{Group: group, Kind: kind} + groupKindReports[gk] = append(groupKindReports[gk], &report{ + Group: group, + Version: version, + Kind: kind, + Rules: rules, + }) + } +} + +// testTargets returns one SimpleTarget per Kind in groupKindReports. Each +// target's directory is /// +// and contains one _test.go per version plus a +// shared main_test.go. Skips Kinds with empty Version +// (non-API packages) and Kinds whose every rule is allowlisted. +func testTargets(testOutputRoot, filePrefix string, groupKindReports map[schema.GroupKind][]*report, allowlist []allowlistEntry, boilerplate []byte) []generator.Target { + if testOutputRoot == "" || len(groupKindReports) == 0 { + return nil + } + out := make([]generator.Target, 0, len(groupKindReports)) + for _, reports := range groupKindReports { + // reports is non-empty by construction in collectReports. + first := reports[0] + if first.Version == "" { + continue // not a real API package + } + reports = filterReports(reports, allowlist) + if len(reports) == 0 { + continue // every rule was allowlisted away + } + lowerKind := strings.ToLower(first.Kind) + // Short group name (first DNS label) as the directory; "core" for the + // empty legacy group — matches client-gen / informer-gen convention. + group := first.Group + if group == "" { + group = "core" + } + pkgDir := filepath.Join(testOutputRoot, strings.Split(group, ".")[0], lowerKind) + + out = append(out, &generator.SimpleTarget{ + PkgName: lowerKind, + PkgPath: pkgDir, // informational; gengo writes to PkgDir + PkgDir: pkgDir, + HeaderComment: boilerplate, + GeneratorsFunc: func(*generator.Context) []generator.Generator { + gens := make([]generator.Generator, 0, len(reports)+1) // +1 for main_test.go + versions := make([]string, 0, len(reports)) + for _, r := range reports { + gens = append(gens, newCoverageTestGen(pkgDir, filePrefix+r.Version+"_test.go", []*report{r}, false, nil)) + versions = append(versions, r.Version) + } + gens = append(gens, newCoverageTestGen(pkgDir, filePrefix+"main_test.go", nil, true, versions)) + return gens + }}) + } + return out +} + +// collectRules walks node's type tree and returns its declared FieldRules. +func collectRules(node *typeNode) fieldRules { + if node == nil { + return nil + } + rules := fieldRules{} + seen := map[*typeNode]bool{} + + record := func(path string, fns []validators.FunctionGen) { + for _, fn := range fns { + recordRules(rules, path, fn, "") + } + } + + var walkNode func(*typeNode, string, bool, bool) + var walkChild func(*childNode, string, bool, bool) + walkNode = func(n *typeNode, path string, skipElem, skipKey bool) { + if n == nil || seen[n] { + return + } + seen[n] = true + defer delete(seen, n) + + record(path, n.typeValidations.Functions) + if n.valueType == nil { + return + } + + if n.typeValidations.OpaqueType { + return + } + + skipElem = skipElem || n.typeValidations.OpaqueValType + skipKey = skipKey || n.typeValidations.OpaqueKeyType + + record(joinPath(path, "[*]"), n.typeValIterations.Functions) + record(path, n.typeKeyIterations.Functions) // keys validate at parent path + + for _, fld := range n.fields { + walkChild(fld, joinPath(path, fld.jsonName), false, false) + } + if n.elem != nil && !skipElem { + walkChild(n.elem, joinPath(path, "[*]"), false, false) + } + if n.key != nil && !skipKey { + walkChild(n.key, path, false, false) + } + if n.underlying != nil { + walkChild(n.underlying, path, skipElem, skipKey) + } + } + walkChild = func(c *childNode, path string, skipElem, skipKey bool) { + if c == nil { + return + } + record(path, c.fieldValidations.Functions) + record(joinPath(path, "[*]"), c.fieldValIterations.Functions) + record(path, c.fieldKeyIterations.Functions) + + if c.fieldValidations.OpaqueType { + return + } + + skipElem = skipElem || c.fieldValidations.OpaqueValType + skipKey = skipKey || c.fieldValidations.OpaqueKeyType + + walkNode(c.node, path, skipElem, skipKey) + } + walkNode(node, "", false, false) + return rules +} + +// recordRules descends fg, accumulating Wrapper/MultiWrapperFunction +// PathFragments into suffix, and records (basePath+suffix, Rule) at each +// emitting leaf. A FunctionGen may declare multiple Emissions when the +// runtime emits errors of different types or at different path fragments +// from the same call (e.g. ValSliceUpdate with NoAddItem and NoRemoveItem). +func recordRules(rules fieldRules, basePath string, fg validators.FunctionGen, suffix string) { + if len(fg.Emits) > 0 { + for _, e := range fg.Emits { + path := basePath + suffix + e.PathFragment + rules[path] = append(rules[path], rule{ + ErrorType: string(e.Type), + Origin: e.Origin, + }) + } + return + } + for _, arg := range fg.Args { + switch a := arg.(type) { + case validators.WrapperFunction: + recordRules(rules, basePath, a.Function, suffix+a.PathFragment) + case validators.MultiWrapperFunction: + for _, child := range a.Functions { + recordRules(rules, basePath, child, suffix+a.PathFragment) + } + } + } +} + +// joinPath joins seg onto base; empty seg is a no-op so inline-embedded +// struct fields (jsonName "") stay transparent. +func joinPath(base, seg string) string { + if seg == "" { + return base + } + if base == "" { + return seg + } + if strings.HasPrefix(seg, "[") { + return base + seg + } + return base + "." + seg +} diff --git a/vendor/k8s.io/code-generator/cmd/validation-gen/util/util.go b/vendor/k8s.io/code-generator/cmd/validation-gen/util/util.go new file mode 100644 index 0000000000..6b11730682 --- /dev/null +++ b/vendor/k8s.io/code-generator/cmd/validation-gen/util/util.go @@ -0,0 +1,228 @@ +/* +Copyright 2025 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package util + +import ( + "fmt" + "math" + "strconv" + + "k8s.io/gengo/v2/parser/tags" + "k8s.io/gengo/v2/types" +) + +// GetMemberByJSON returns the child member of the type that has the given JSON +// name. It returns nil if no such member exists. +func GetMemberByJSON(t *types.Type, jsonName string) *types.Member { + for i := range t.Members { + if jsonTag, ok := tags.LookupJSON(t.Members[i]); ok { + if jsonTag.Name == jsonName { + return &t.Members[i] + } + } + } + return nil +} + +// IsNilableType returns true if the argument type can be compared to nil. +func IsNilableType(t *types.Type) bool { + t = NativeType(t) + + switch t.Kind { + case types.Pointer, types.Map, types.Slice, types.Interface: // Note: Arrays are not nilable + return true + } + return false +} + +// NativeType returns the Go native type of the argument type, with any +// intermediate typedefs removed. Go itself already flattens typedefs, but this +// handles it in the unlikely event that we ever fix that. +// +// Examples: +// * Trivial: +// - given `int`, returns `int` +// - given `*int`, returns `*int` +// - given `[]int`, returns `[]int` +// +// * Typedefs +// - given `type X int; X`, returns `int` +// - given `type X int; []X`, returns `[]X` +// +// * Typedefs and pointers: +// - given `type X int; *X`, returns `*int` +// - given `type X *int; *X`, returns `**int` +// - given `type X []int; X`, returns `[]int` +// - given `type X []int; *X`, returns `*[]int` +func NativeType(t *types.Type) *types.Type { + ptrs := 0 + conditionMet := false + for !conditionMet { + switch t.Kind { + case types.Alias: + t = t.Underlying + case types.Pointer: + ptrs++ + t = t.Elem + default: + conditionMet = true + } + } + for range ptrs { + t = types.PointerTo(t) + } + return t +} + +// NonPointer returns the value-type of a possibly pointer type. If type is not +// a pointer, it returns the input type. +func NonPointer(t *types.Type) *types.Type { + for t.Kind == types.Pointer { + t = t.Elem + } + return t +} + +// IsDirectComparable returns true if the type is safe to compare using "==". +// It is similar to gengo.IsComparable, but it doesn't consider Pointers to be +// comparable (we don't want shallow compare). +func IsDirectComparable(t *types.Type) bool { + switch t.Kind { + case types.Builtin: + return true + case types.Struct: + for _, f := range t.Members { + if !IsDirectComparable(f.Type) { + return false + } + } + return true + case types.Array: + return IsDirectComparable(t.Elem) + case types.Alias: + return IsDirectComparable(t.Underlying) + } + return false +} + +// ParseInt strictly parses an int from a string input, +// ensuring that when converted back to a string, the resulting +// int and the input string have the exact same representation. +// This prevents scenarios where an input like "0100" parses +// as 100 and would be re-stringed as "100". +func ParseInt(val string) (int, error) { + intVal, err := strconv.Atoi(val) + if err != nil { + return 0, fmt.Errorf("parsing %q as int: %w", val, err) + } + + strVal := strconv.Itoa(intVal) + if strVal != val { + return 0, fmt.Errorf("%q is not a valid int value", val) + } + + return intVal, nil +} + +// ParseSignedInt strictly parses a signed integer from a string input and +// validates that the result fits within the specified bit size. The bitSize +// parameter should be 8, 16, 32, or 64, corresponding to the target Go type. +// Values outside the representable range for the target type are rejected at +// parse time with a descriptive error. +func ParseSignedInt(val string, bitSize int) (int64, error) { + intVal, err := strconv.ParseInt(val, 10, 64) + if err != nil { + return 0, fmt.Errorf("parsing %q as int: %w", val, err) + } + + // Verify canonical form: reject leading zeros, unary plus, etc. + strVal := strconv.FormatInt(intVal, 10) + if strVal != val { + return 0, fmt.Errorf("%q is not a valid int value", val) + } + + // Validate the parsed value fits in the target type's range. + var minVal, maxVal int64 + switch bitSize { + case 8: + minVal, maxVal = math.MinInt8, math.MaxInt8 + case 16: + minVal, maxVal = math.MinInt16, math.MaxInt16 + case 32: + minVal, maxVal = math.MinInt32, math.MaxInt32 + case 64: + minVal, maxVal = math.MinInt64, math.MaxInt64 + default: + return 0, fmt.Errorf("unsupported bitSize %d; must be 8, 16, 32, or 64", bitSize) + } + if intVal < minVal || intVal > maxVal { + return 0, fmt.Errorf("value %d does not fit in int%d (range [%d, %d])", intVal, bitSize, minVal, maxVal) + } + + return intVal, nil +} + +// ParseUnsignedInt strictly parses an unsigned integer from a string input and +// validates that the result fits within the specified bit size. The bitSize +// parameter should be 8, 16, 32, or 64, corresponding to the target Go type. +func ParseUnsignedInt(val string, bitSize int) (uint64, error) { + uintVal, err := strconv.ParseUint(val, 10, 64) + if err != nil { + return 0, fmt.Errorf("parsing %q as uint: %w", val, err) + } + + // Verify canonical form: reject leading zeros, unary plus, etc. + strVal := strconv.FormatUint(uintVal, 10) + if strVal != val { + return 0, fmt.Errorf("%q is not a valid uint value", val) + } + + // Validate the parsed value fits in the target type's range. + var maxVal uint64 + switch bitSize { + case 8: + maxVal = math.MaxUint8 + case 16: + maxVal = math.MaxUint16 + case 32: + maxVal = math.MaxUint32 + case 64: + maxVal = math.MaxUint64 + default: + return 0, fmt.Errorf("unsupported bitSize %d; must be 8, 16, 32, or 64", bitSize) + } + if uintVal > maxVal { + return 0, fmt.Errorf("value %d does not fit in uint%d (range [0, %d])", uintVal, bitSize, maxVal) + } + + return uintVal, nil +} + +// ParseBool strictly parses a bool from a string input, +// ensuring that when converted back to a string, the resulting +// bool and the input string have the exact same representation. +// This prevents scenarios where an input like "TRUE" parses +// as true and would be re-stringed as "true". +func ParseBool(val string) (bool, error) { + switch val { + case "true": + return true, nil + case "false": + return false, nil + } + return false, fmt.Errorf("%q is not a valid bool value", val) +} diff --git a/vendor/k8s.io/code-generator/cmd/validation-gen/validation.go b/vendor/k8s.io/code-generator/cmd/validation-gen/validation.go new file mode 100644 index 0000000000..16725be28c --- /dev/null +++ b/vendor/k8s.io/code-generator/cmd/validation-gen/validation.go @@ -0,0 +1,2116 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "bytes" + "cmp" + "fmt" + "io" + "reflect" + "slices" + "strconv" + "strings" + "unicode" + + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/code-generator/cmd/validation-gen/util" + "k8s.io/code-generator/cmd/validation-gen/validators" + "k8s.io/gengo/v2/generator" + "k8s.io/gengo/v2/namer" + "k8s.io/gengo/v2/parser/tags" + "k8s.io/gengo/v2/types" + "k8s.io/klog/v2" +) + +func mkPkgNames(pkg string, names ...string) []types.Name { + result := make([]types.Name, 0, len(names)) + for _, name := range names { + result = append(result, types.Name{Package: pkg, Name: name}) + } + return result +} + +var ( + fieldPkg = "k8s.io/apimachinery/pkg/util/validation/field" + fieldPkgSymbols = mkPkgNames(fieldPkg, "ErrorList", "InternalError", "Path") + fmtPkgSymbols = mkPkgNames("fmt", "Errorf", "Fprintln") + safePkg = "k8s.io/apimachinery/pkg/api/safe" + safePkgSymbols = mkPkgNames(safePkg, "Field", "Cast", "Value") + operationPkg = "k8s.io/apimachinery/pkg/api/operation" + operationPkgSymbols = mkPkgNames(operationPkg, "Operation", "MatchesSubresource", "Update") + contextPkg = "context" + contextPkgSymbols = mkPkgNames(contextPkg, "Context") + equalityPkg = "k8s.io/apimachinery/pkg/api/equality" + equalityPkgSymbols = mkPkgNames(equalityPkg, "Semantic") +) + +// genValidations produces a file with autogenerated validations. +type genValidations struct { + generator.GoGenerator + outputPackage string + inputPackage string + inputToCanonicalPkg map[string]string // input package -> the generated package cross-package references resolve to + rootTypes []*types.Type + discovered *typeDiscoverer + imports namer.ImportTracker + schemeRegistry types.Name + emitRegisterFunc bool +} + +// NewGenValidations creates a new generator for the specified package. +func NewGenValidations(outputFilename, outputPackage, inputPackage string, rootTypes []*types.Type, discovered *typeDiscoverer, inputToCanonicalPkg map[string]string, schemeRegistry types.Name, emitRegisterFunc bool) generator.Generator { + return &genValidations{ + GoGenerator: generator.GoGenerator{ + OutputFilename: outputFilename, + }, + outputPackage: outputPackage, + inputPackage: inputPackage, + inputToCanonicalPkg: inputToCanonicalPkg, + rootTypes: rootTypes, + discovered: discovered, + imports: generator.NewImportTrackerForPackage(outputPackage), + schemeRegistry: schemeRegistry, + emitRegisterFunc: emitRegisterFunc, + } +} + +// resolveFunc maps a validator reference to the package it should be called +// from, applying the first rule that matches (local wins over canonical): +// 1. if this generator validates the reference's input package, the +// generator's own output package (the local copy); +// 2. else the input's canonical package, if one exists; +// 3. otherwise the reference is returned unchanged. +func (g *genValidations) resolveFunc(name types.Name) types.Name { + if name.Package == g.inputPackage { + name.Package = g.outputPackage + } else if pkg, ok := g.inputToCanonicalPkg[name.Package]; ok { + name.Package = pkg + } + return name +} + +func (g *genValidations) Namers(_ *generator.Context) namer.NameSystems { + // Have the raw namer for this file track what it imports. + return namer.NameSystems{ + "raw": namer.NewRawNamer(g.outputPackage, g.imports), + } +} + +func (g *genValidations) Filter(_ *generator.Context, t *types.Type) bool { + // We want to emit code for all root types. + if slices.Contains(g.rootTypes, t) { + return true + } + // We want to emit for any other type that is referenced by a root type's + // graph and has validations. Types that were only discovered as another + // package's root (selected there, referenced by nothing) are skipped so a + // generator does not emit validators it never calls. + n := g.discovered.typeNodes[t] + return n != nil && n.referenced && g.hasValidations(n) +} + +func (g *genValidations) Imports(_ *generator.Context) (imports []string) { + var importLines []string + for _, singleImport := range g.imports.ImportLines() { + if g.isOtherPackage(singleImport) { + importLines = append(importLines, singleImport) + } + } + return importLines +} + +func (g *genValidations) isOtherPackage(pkg string) bool { + if pkg == g.outputPackage { + return false + } + if strings.HasSuffix(pkg, `"`+g.outputPackage+`"`) { + return false + } + return true +} + +func (g *genValidations) Init(c *generator.Context, w io.Writer) error { + klog.V(5).Infof("emitting registration code") + sw := generator.NewSnippetWriter(w, c, "$", "$") + if g.emitRegisterFunc { + g.emitRegisterFunction(c, g.schemeRegistry, sw) + } + if err := sw.Error(); err != nil { + return err + } + return nil +} + +func (g *genValidations) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { + klog.V(5).Infof("emitting validation code for type %v", t) + + sw := generator.NewSnippetWriter(w, c, "$", "$") + g.emitValidationVariables(c, t, sw) + g.emitValidationFunction(c, t, sw) + if err := sw.Error(); err != nil { + return err + } + return nil +} + +// typeDiscoverer contains fields necessary to build graphs of types. +type typeDiscoverer struct { + initialized bool + validator validators.ValidationExtractor + inputToCanonicalPkg map[string]string + + // constantsByType holds a map of type to constants of that type. + constantsByType map[*types.Type][]*validators.Constant + + // typeNodes holds a map of gengo Type to typeNode for all of the types + // encountered during discovery. + typeNodes map[*types.Type]*typeNode +} + +// NewTypeDiscoverer creates a NewTypeDiscoverer. +// Init must be called before calling DiscoverType. +func NewTypeDiscoverer(validator validators.ValidationExtractor, inputToCanonicalPkg map[string]string) *typeDiscoverer { + return &typeDiscoverer{ + validator: validator, + inputToCanonicalPkg: inputToCanonicalPkg, + constantsByType: map[*types.Type][]*validators.Constant{}, + typeNodes: map[*types.Type]*typeNode{}, + } +} + +// Init uses the generator context to prepare for type discovery. +func (td *typeDiscoverer) Init(c *generator.Context) error { + packages := c.Universe + for _, pkg := range packages { + // We only care about packages we are generating for or are readonly. + if _, ok := td.inputToCanonicalPkg[pkg.Path]; !ok { + continue + } + for _, cnst := range pkg.Constants { + context := validators.Context{ + Scope: validators.ScopeConst, + Type: cnst.Underlying, + Path: nil, // NA when discovering a constant + Member: nil, // NA when discovering a constant + ParentPath: nil, // NA when discovering a constant + ListSelector: nil, // NA for constants + ParentType: nil, // NA for constants + Constants: nil, // NA for constants + StabilityLevel: "", // Default to stable unless overridden + } + tgs, err := td.validator.ExtractTags(context, cnst.CommentLines) + if err != nil { + return fmt.Errorf("constant %s: %w", cnst.Name, err) + } + if len(tgs) > 0 { + // Also check that the tgs are valid. + if _, err := td.validator.ExtractValidations(context, tgs...); err != nil { + return fmt.Errorf("constant %s: %w", cnst.Name, err) + } + } + td.constantsByType[cnst.Underlying] = append(td.constantsByType[cnst.Underlying], &validators.Constant{Constant: cnst, Tags: tgs}) + } + } + td.initialized = true + return nil +} + +// childNode represents a type which is used in another type (e.g. a struct +// field). +type childNode struct { + name string // the field name in the parent, populated when this node is a struct field + jsonName string // always populated when name is populated + childType *types.Type // the real type of the child (may be a pointer) + node *typeNode // the node of the child's value type, or nil if it is in a foreign package + + fieldValidations validators.Validations // validations on the field + + // These are not the same as fieldValidations, and are not considered in + // hasValidations. These let us emit the iteration code for list and + // map types, but we might not have enough information to know if we can + // skip them at discovery time. + fieldValIterations validators.Validations // validations on each val + fieldKeyIterations validators.Validations // validations on each key +} + +// typeNode represents a node in the type-graph, annotated with information +// about validations. Everything in this type, transitively, is assoctiated +// with the type, and not any specific instance of that type (e.g. when used as +// a field in a struct. +type typeNode struct { + valueType *types.Type // never a pointer, but may be a map, slice, struct, etc. + funcName types.Name // populated when this type is has a validation function + referenced bool // true if used as a field/element/key/underlying of another type (set by discoverChild) + + fields []*childNode // populated when this type is a struct + key *childNode // populated when this type is a map + elem *childNode // populated when this type is a map or slice + underlying *childNode // populated when this type is an alias + + typeValidations validators.Validations // validations on the type + + // These are not the same as typeValidations, and are not considered in + // hasValidations. These let us emit the iteration code for list and + // map types, but we might not have enough information to know if we can + // skip them at discovery time. + typeValIterations validators.Validations // validations on each val + typeKeyIterations validators.Validations // validations on each key +} + +// resolveElemNode traverses underlying alias nodes to find the concrete element node (for slices/maps). +func (n *typeNode) resolveElemNode() *typeNode { + if n.elem != nil { + return n.elem.node + } + if n.underlying != nil && n.underlying.node != nil && n.underlying.node.elem != nil { + return n.underlying.node.elem.node + } + return nil +} + +// resolveKeyNode traverses underlying alias nodes to find the concrete key node (for maps). +func (n *typeNode) resolveKeyNode() *typeNode { + if n.key != nil { + return n.key.node + } + if n.underlying != nil && n.underlying.node != nil && n.underlying.node.key != nil { + return n.underlying.node.key.node + } + return nil +} + +// DiscoverType walks the given type recursively, building a type-graph in this +// typeDiscoverer. If this is called multiple times for different types, the +// graphs will be will be merged. +func (td *typeDiscoverer) DiscoverType(t *types.Type) error { + if !td.initialized { + return fmt.Errorf("typeDiscoverer not initialized") + } + if t.Kind == types.Pointer { + return fmt.Errorf("type %v: pointer root-types are not supported", t) + } + fldPath := field.NewPath(t.Name.String()) + if node, err := td.discoverType(t, fldPath); err != nil { + return err + } else if node == nil { + panic(fmt.Sprintf("discovered a nil node for type %v", t)) + } + return nil +} + +// discoverType walks the given type recursively and returns a typeNode +// representing it. This does not distinguish between discovering a type +// definition and discovering a field of a struct. The first time it +// encounters a type it has not seen before, it will explore that type. If it +// finds a type it has already processed, it will return the existing node. +func (td *typeDiscoverer) discoverType(t *types.Type, fldPath *field.Path) (*typeNode, error) { + // With the exception of builtins (which gengo puts in package ""), we + // can't traverse into packages which are not being processed by this tool. + if t.Name.Package != "" { + _, ok := td.inputToCanonicalPkg[t.Name.Package] + if !ok { + return nil, nil + } + } + + // Catch some cases that we don't want to handle (yet?). This happens + // as early as possible to make all the other code simpler. + if err := td.verifySupportedType(t); err != nil { + return nil, fmt.Errorf("field %s (%s): %w", fldPath.String(), t, err) + } + + // Discovery applies to values, not pointers. + if t.Kind == types.Pointer { + return td.discoverType(t.Elem, fldPath) + } + + // If we have done this type already, we can stop here and break any + // recursion. + if node, found := td.typeNodes[t]; found { + return node, nil + } + klog.V(4).InfoS("discoverType", "type", t, "kind", t.Kind, "path", fldPath.String()) + + // This is the type-node being assembled in the rest of this function. + thisNode := &typeNode{ + valueType: t, + } + td.typeNodes[t] = thisNode + + // If we are descending into a named type... + switch t.Kind { + case types.Alias, types.Struct: + // Reboot the field path for better logging. Otherwise the field path + // might come in as something like .. which is + // true, but not super useful. + fldPath = field.NewPath(t.Name.String()) + + // Find its validation function for later use. + if fn, ok := td.getValidationFunctionName(t); ok { + thisNode.funcName = fn + } + } + + // Discover into this type before extracting type validations. + switch t.Kind { + case types.Builtin, types.Interface: + // Nothing more to do. + case types.Alias: + // Discover the underlying type. + // + // Note: By the language definition, what gengo calls "Aliases" (really + // just "type definitions") have underlying types of the type literal. + // In other words, if we define `type T1 string` and `type T2 T1`, the + // underlying type of T2 is string, not T1. This means that: + // 1) We will emit code for both underlying types. If the underlying + // type is a struct with many fields, we will emit two identical + // functions. + // 2) Validating a field of type T2 will NOT call any validation + // defined on the type T1. + // 3) In the case of a type definition whose RHS is a struct which + // has fields with validation tags, the validation for those fields + // WILL be called from the generated for for the new type. + if node, err := td.discoverChild(t.Underlying, fldPath); err != nil { + return nil, err + } else { + thisNode.underlying = &childNode{ + childType: t.Underlying, + node: node, + } + } + case types.Struct: + // Discover into this struct, recursively. + if err := td.discoverStruct(thisNode, fldPath); err != nil { + return nil, err + } + case types.Slice: + // Discover the element type. + if node, err := td.discoverChild(t.Elem, fldPath.Key("vals")); err != nil { + return nil, err + } else { + thisNode.elem = &childNode{ + childType: t.Elem, + node: node, + } + } + case types.Map: + // Discover the key type. + if node, err := td.discoverChild(t.Key, fldPath.Key("keys")); err != nil { + return nil, err + } else { + thisNode.key = &childNode{ + childType: t.Key, + node: node, + } + } + + // Discover the element type. + if node, err := td.discoverChild(t.Elem, fldPath.Key("vals")); err != nil { + return nil, err + } else { + thisNode.elem = &childNode{ + childType: t.Elem, + node: node, + } + } + } + + // Extract any type-attached validation rules. We do this AFTER descending + // into the type, so that these validators have access to the full type. + // For example, all struct field validators get called before the type + // validators. This does not influence the order in which the validations + // are called in emitted code, just how we evaluate what to emit. + switch t.Kind { + case types.Alias, types.Struct: + if fldPath.String() != t.String() { + panic(fmt.Sprintf("path for type != the type name: %s, %s", t.String(), fldPath.String())) + } + consts := td.constantsByType[t] + context := validators.Context{ + Scope: validators.ScopeType, + Type: t, + Path: fldPath, + Member: nil, // NA when discovering a type + ParentPath: nil, // NA when discovering a type + Constants: consts, + ListSelector: nil, // NA for type scope + ParentType: nil, // NA for type scope + StabilityLevel: "", // Default to stable unless overridden + } + extractedTags, err := td.validator.ExtractTags(context, t.CommentLines) + if err != nil { + return nil, fmt.Errorf("%v: %w", fldPath, err) + } + if validations, err := td.validator.ExtractValidations(context, extractedTags...); err != nil { + return nil, fmt.Errorf("%v: %w", fldPath, err) + } else if validations.Empty() { + klog.V(6).InfoS("no type-attached validations", "type", t) + } else { + if util.NonPointer(util.NativeType(t)).Kind == types.Map && util.NonPointer(util.NativeType(t)).Elem.Kind == types.Slice { + return nil, fmt.Errorf("field %s: validation for map of slices is not supported", fldPath) + } + klog.V(5).InfoS("found type-attached validations", "n", len(validations.Functions), "type", t) + thisNode.typeValidations.Add(validations) + } + + // Handle type definitions whose output depends on the rest of type + // discovery being complete. In particular, aliases to lists and maps need + // iteration, but we don't want to iterate them if the key or value types + // don't actually have validations. We also want to handle non-included + // types and make users tell us what they intended. Lastly, we want to + // handle recursive types, but we need to finish discovering the type + // before we know if there are other validations, again so we don't emit + // empty functions. + if t.Kind == types.Alias { + switch util.NonPointer(util.NativeType(t)).Kind { + case types.Slice: + // Validate each value. + elemNode := thisNode.resolveElemNode() + if elemNode == nil { + if !thisNode.typeValidations.OpaqueValType { + return nil, fmt.Errorf("%v: value type %v is in a non-included package; "+ + "either add this package to validation-gen's --readonly-pkg flag, "+ + "or add +k8s:eachVal=+k8s:opaqueType to the field to skip validation", + fldPath, util.NativeType(t).Elem) + } + } else if thisNode.typeValidations.OpaqueValType { + // If the type is marked as opaque, we can treat it as it is + // were in a non-included package. + } else { + // If the value type is a named type, call the validation + // function for each element. + if funcName := elemNode.funcName; funcName.Name != "" { + // Save the iteration validation while we have all the + // information we need. Later we can check if we + // actually need it. + // + // Note: the first argument to Function() is really + // only for debugging. + v, err := validators.ForEachVal(fldPath, thisNode.valueType, + validators.Function("iterateListValues", validators.DefaultFlags, funcName). + WithComment("iterate the list and call the type's validation function")) + if err != nil { + return nil, fmt.Errorf("generating list iteration: %w", err) + } else { + thisNode.typeValIterations.Add(v) + } + } + } + case types.Map: + // Validate each key. + keyNode := thisNode.resolveKeyNode() + if keyNode == nil { + if !thisNode.typeValidations.OpaqueKeyType { + return nil, fmt.Errorf("%v: key type %v is in a non-included package; "+ + "either add this package to validation-gen's --readonly-pkg flag, "+ + "or add +k8s:eachKey=+k8s:opaqueType to the field to skip validation", + fldPath, util.NativeType(t).Key) + } + } else if thisNode.typeValidations.OpaqueKeyType { + // If the type is marked as opaque, we can treat it as it is + // were in a non-included package. + } else { + // If the key type is a named type, call the validation + // function for each key. + if funcName := keyNode.funcName; funcName.Name != "" { + // Save the iteration validation while we have all the + // information we need. Later we can check if we + // actually need it. + // + // Note: the first argument to Function() is really + // only for debugging. + v, err := validators.ForEachKey(fldPath, thisNode.valueType, + validators.Function("iterateMapKeys", validators.DefaultFlags, funcName). + WithComment("iterate the map and call the key type's validation function")) + if err != nil { + return nil, fmt.Errorf("generating map key iteration: %w", err) + } else { + thisNode.typeKeyIterations.Add(v) + } + } + } + // Validate each value. + elemNode := thisNode.resolveElemNode() + if elemNode == nil { + if !thisNode.typeValidations.OpaqueValType { + return nil, fmt.Errorf("%v: value type %v is in a non-included package; "+ + "either add this package to validation-gen's --readonly-pkg flag, "+ + "or add +k8s:eachVal=+k8s:opaqueType to the field to skip validation", + fldPath, util.NativeType(t).Elem) + } + } else if thisNode.typeValidations.OpaqueValType { + // If the type is marked as opaque, we can treat it as it is + // were in a non-included package. + } else { + // If the value type is a named type, call the validation + // function for each element. + if funcName := elemNode.funcName; funcName.Name != "" { + // Save the iteration validation while we have all the + // information we need. Later we can check if we + // actually need it. + // + // Note: the first argument to Function() is really + // only for debugging. + v, err := validators.ForEachVal(fldPath, thisNode.valueType, + validators.Function("iterateMapValues", validators.DefaultFlags, funcName). + WithComment("iterate the map and call the value type's validation function")) + if err != nil { + return nil, fmt.Errorf("generating map value iteration: %w", err) + } else { + thisNode.typeValIterations.Add(v) + } + } + } + } + } + } + + // These are validations that could not be fully resolved during tag extraction + // (e.g., because they need to wrap inner validations or depend on the full + // type graph being discovered). We resolve them iteratively because a + // deferred validation may yield further deferred validations. + deferred := thisNode.typeValidations.Deferred + thisNode.typeValidations.Deferred = nil + depth := 0 + for len(deferred) > 0 { + depth++ + if depth > 10 { + return nil, fmt.Errorf("deferred validation recursion depth exceeded "+ + "10 for type %s at path %s", thisNode.valueType.String(), fldPath.String()) + } + var nextDeferred []validators.DeferredGen + for _, def := range deferred { + res, err := def.Callback() + if err != nil { + return nil, err + } + if len(res.Deferred) > 0 { + nextDeferred = append(nextDeferred, res.Deferred...) + res.Deferred = nil + } + // Deferred validations can originate from fields with ParentContext scope (e.g., UnionValidations) + // or from validations on type definitions with ThisContext scope (e.g., eachVal on a slice type). + if def.Scope == validators.ThisContext || def.Scope == validators.ParentContext { + thisNode.typeValidations.Add(res) + } else { + return nil, fmt.Errorf("unexpected scope %v", def.Scope) + } + } + deferred = nextDeferred + } + + return thisNode, nil +} + +// discoverChild is discoverType for a type reached as a child (a field, +// element, key, or underlying type) of another type. It additionally marks the +// discovered node as referenced. See typeNode.referenced. +func (td *typeDiscoverer) discoverChild(t *types.Type, fldPath *field.Path) (*typeNode, error) { + node, err := td.discoverType(t, fldPath) + if node != nil { + node.referenced = true + } + return node, err +} + +// verifySupportedType checks whether the given type is supported. +func (td *typeDiscoverer) verifySupportedType(t *types.Type) error { + switch t.Kind { + case types.Builtin, types.Struct: + // Allowed + case types.Interface: + // We can't do much with interfaces, but they pop up in some places + // like RawExtension. + case types.Alias: + if t.Underlying.Kind == types.Pointer { + return fmt.Errorf("typedefs to pointers are not supported") + } + case types.Pointer: + pointee := util.NativeType(t.Elem) + switch pointee.Kind { + case types.Pointer: + return fmt.Errorf("pointers to pointers are not supported") + case types.Slice, types.Array: + return fmt.Errorf("pointers to lists are not supported") + case types.Map: + return fmt.Errorf("pointers to maps are not supported") + } + case types.Array: + return fmt.Errorf("fixed-size arrays are not supported") + case types.Slice: + elem := util.NativeType(t.Elem) + switch elem.Kind { + case types.Slice: + if util.NativeType(elem.Elem) != types.Byte { + return fmt.Errorf("lists of lists are not supported") + } + case types.Map: + return fmt.Errorf("lists of maps are not supported") + } + case types.Map: + key := util.NativeType(t.Key) + if key != types.String { + return fmt.Errorf("maps with non-string keys are not supported") + } + elem := util.NativeType(t.Elem) + switch elem.Kind { + case types.Pointer: + return fmt.Errorf("maps of pointers are not supported") + case types.Map: + return fmt.Errorf("maps of maps are not supported") + } + default: + return fmt.Errorf("kind %v is not supported", t.Kind) + } + + return nil +} + +// resolveFieldElemNode returns the element node for a slice/map field, falling +// back to the type cache when the field type's elem child is not yet wired up +// (a recursive type still under construction). +func (td *typeDiscoverer) resolveFieldElemNode(child *childNode, elemType *types.Type) *typeNode { + if child.node != nil && child.node.elem != nil { + return child.node.elem.node + } + return td.typeNodes[elemType] +} + +// resolveFieldKeyNode is resolveFieldElemNode for a map's key. +func (td *typeDiscoverer) resolveFieldKeyNode(child *childNode, keyType *types.Type) *typeNode { + if child.node != nil && child.node.key != nil { + return child.node.key.node + } + return td.typeNodes[keyType] +} + +// discoverStruct walks a struct type recursively. +func (td *typeDiscoverer) discoverStruct(thisNode *typeNode, fldPath *field.Path) error { + var fields []*childNode + + klog.V(5).InfoS("discoverStruct", "type", thisNode.valueType) + + // Discover into each field of this struct. + for _, memb := range thisNode.valueType.Members { + name := memb.Name + + // Only do exported fields. + if unicode.IsLower([]rune(name)[0]) { + continue + } + + // If we try to emit code for this field and find no JSON name, we + // will abort. + jsonName := "" + if commentTags, ok := tags.LookupJSON(memb); ok { + jsonName = commentTags.Name + } + + var childPath *field.Path + if jsonName != "" { + childPath = fldPath.Child(jsonName) + } else { + childPath = fldPath.Child(name) + } + + // Discover the field type. + klog.V(5).InfoS("field", "name", name, "jsonName", jsonName, "type", memb.Type, "path", childPath) + childType := memb.Type + var child *childNode + if node, err := td.discoverChild(childType, childPath); err != nil { + return err + } else { + child = &childNode{ + name: name, + jsonName: jsonName, + childType: childType, + node: node, + } + } + + // Extract any field-attached validation rules. + context := validators.Context{ + Scope: validators.ScopeField, + Type: childType, + Path: childPath, + Member: &memb, + ParentPath: fldPath, + ParentType: thisNode.valueType, + ListSelector: nil, // NA for fields + Constants: nil, // NA for fields + StabilityLevel: "", // Inherited or default + } + + tags, err := td.validator.ExtractTags(context, memb.CommentLines) + if err != nil { + return fmt.Errorf("field %s: %w", childPath.String(), err) + } + if validations, err := td.validator.ExtractValidations(context, tags...); err != nil { + return fmt.Errorf("field %s: %w", childPath.String(), err) + } else if validations.Empty() { + klog.V(6).InfoS("no field-attached validations", "field", childPath) + } else { + klog.V(5).InfoS("found field-attached validations", "n", len(validations.Functions), "field", childPath) + if util.NonPointer(util.NativeType(childType)).Kind == types.Map && util.NonPointer(util.NativeType(childType)).Elem.Kind == types.Slice { + return fmt.Errorf("field %s: validation for map of slices is not supported", childPath) + } + child.fieldValidations.Add(validations) + // TODO: re-visit erroring on specific cases where variable generation is not supported for field validations + // currently there are some cases where we want variable generation for field validations + } + + // Handle non-included types. + switch util.NonPointer(childType).Kind { + case types.Struct, types.Alias: + if child.node == nil { // a non-included type + if !child.fieldValidations.OpaqueType { + return fmt.Errorf("%v: type %v is in a non-included package; "+ + "either add this package to validation-gen's --readonly-pkg flag, "+ + "or add +k8s:opaqueType to the field to skip validation", + childPath, childType.String()) + } + } else if child.fieldValidations.OpaqueType { + // If the field is marked as opaque, we can treat it as it is + // were in a non-included package. + child.node = nil + } + } + + // Add any other field-attached "special" validators. We need to do + // this after all the other field validation has been processed, + // because some of this is conditional on whether other validations + // were emitted (to avoid emitting empty functions). + // + // We do this here, rather than in discoverType() because we need to + // know information about the field, not just the type. + switch childType.Kind { + case types.Slice: + // Validate each value of a list field. + if elemNode := td.resolveFieldElemNode(child, childType.Elem); elemNode == nil { + if !child.fieldValidations.OpaqueValType { + return fmt.Errorf("%v: value type %v is in a non-included package; "+ + "either add this package to validation-gen's --readonly-pkg flag, "+ + "or add +k8s:eachVal=+k8s:opaqueType to the field to skip validation", + childPath, childType.Elem.String()) + } + } else if child.fieldValidations.OpaqueValType { + // If the field is marked as opaque, we can treat it as it is + // were in a non-included package. + } else { + // If the list's value type is a named type, call the validation + // function for each element. + if funcName := elemNode.funcName; funcName.Name != "" { + // Save the iteration validation while we have all the + // information we need. Later we can check if we + // actually need it. + // + // Note: the first argument to Function() is really + // only for debugging. + v, err := validators.ForEachVal(childPath, childType, + validators.Function("iterateListValues", validators.DefaultFlags, funcName). + WithComment("iterate the list and call the type's validation function")) + if err != nil { + return fmt.Errorf("generating list iteration: %w", err) + } else { + child.fieldValIterations.Add(v) + } + } + } + case types.Map: + // Validate each key of a map field. + if keyNode := td.resolveFieldKeyNode(child, childType.Key); keyNode == nil { + if !child.fieldValidations.OpaqueKeyType { + return fmt.Errorf("%v: key type %v is in a non-included package; "+ + "either add this package to validation-gen's --readonly-pkg flag, "+ + "or add +k8s:eachKey=+k8s:opaqueType to the field to skip validation", + childPath, childType.Key.String()) + } + } else if child.fieldValidations.OpaqueKeyType { + // If the field is marked as opaque, we can treat it as it is + // were in a non-included package. + } else { + // If the map's key type is a named type, call the validation + // function for each key. + if funcName := keyNode.funcName; funcName.Name != "" { + // Save the iteration validation while we have all the + // information we need. Later we can check if we + // actually need it. + // + // Note: the first argument to Function() is really + // only for debugging. + v, err := validators.ForEachKey(childPath, childType, + validators.Function("iterateMapKeys", validators.DefaultFlags, funcName). + WithComment("iterate the map and call the key type's validation function")) + if err != nil { + return fmt.Errorf("generating map key iteration: %w", err) + } else { + child.fieldKeyIterations.Add(v) + } + } + } + // Validate each value of a map field. + if elemNode := td.resolveFieldElemNode(child, childType.Elem); elemNode == nil { + if !child.fieldValidations.OpaqueValType { + return fmt.Errorf("%v: value type %v is in a non-included package; "+ + "either add this package to validation-gen's --readonly-pkg flag, "+ + "or add +k8s:eachVal=+k8s:opaqueType to the field to skip validation", + childPath, childType.Elem.String()) + } + } else if child.fieldValidations.OpaqueValType { + // If the field is marked as opaque, we can treat it as it is + // were in a non-included package. + } else { + // If the map's value type is a named type, call the validation + // function for each element. + if funcName := elemNode.funcName; funcName.Name != "" { + // Save the iteration validation while we have all the + // information we need. Later we can check if we + // actually need it. + // + // Note: the first argument to Function() is really + // only for debugging. + v, err := validators.ForEachVal(childPath, childType, + validators.Function("iterateMapValues", validators.DefaultFlags, funcName). + WithComment("iterate the map and call the value type's validation function")) + if err != nil { + return fmt.Errorf("generating map value iteration: %w", err) + } else { + child.fieldValIterations.Add(v) + } + } + } + } + + fields = append(fields, child) + } + + for _, child := range fields { + // Process deferred validations for the field. Similar to type-level + // deferred validations, these are resolved iteratively until no more + // deferred validations are produced. + deferred := child.fieldValidations.Deferred + child.fieldValidations.Deferred = nil + depth := 0 + for len(deferred) > 0 { + depth++ + if depth > 10 { + return fmt.Errorf("deferred validation recursion depth exceeded "+ + "10 for field %s of type %s", child.name, thisNode.valueType.String()) + } + var nextDeferred []validators.DeferredGen + for _, def := range deferred { + res, err := def.Callback() + if err != nil { + return fmt.Errorf("deferred validation callback failed for field %s of type %s: %w", + child.name, thisNode.valueType.String(), err) + } + if len(res.Deferred) > 0 { + nextDeferred = append(nextDeferred, res.Deferred...) + res.Deferred = nil + } + // Map the resolved validations to the appropriate context: + // - ThisContext maps to the field's validations. + // - ParentContext maps to the containing type's validations. + // This occurs when a validation specified on a field actually applies to the + // entire struct (e.g., union validations that enforce rules across multiple fields). + switch def.Scope { + case validators.ThisContext: + child.fieldValidations.Add(res) + case validators.ParentContext: + thisNode.typeValidations.Add(res) + default: + return fmt.Errorf("unexpected scope %v", def.Scope) + } + } + deferred = nextDeferred + } + } + + thisNode.fields = fields + return nil +} + +// getValidationFunctionName returns a type's validator identity: (input +// package, Validate_T). Which package a call actually targets is output- +// dependent, so it's resolved at emit time (resolveFunc), not baked in here. +// +// TODO: Currently this is a "blind" call - we hope that the expected function +// exists, but we don't verify that, and we only emit calls into packages which +// are being processed by this generator. For cross-package calls we will need +// to verify the target, either by naming convention + fingerprint or by +// explicit comment-tags or something. +func (td *typeDiscoverer) getValidationFunctionName(t *types.Type) (types.Name, bool) { + if _, ok := td.inputToCanonicalPkg[t.Name.Package]; !ok { + return types.Name{}, false + } + return types.Name{Package: t.Name.Package, Name: "Validate_" + t.Name.Name}, true +} + +func mkSymbolArgs(c *generator.Context, names []types.Name) generator.Args { + args := generator.Args{} + for _, name := range names { + args[name.Name] = c.Universe.Type(name) + } + return args +} + +// hasValidations checks whether the given typeNode has any +// validations, transitively. +func (g *genValidations) hasValidations(n *typeNode) bool { + seen := map[*typeNode]bool{} + return g.hasValidationsImpl(n, seen) +} + +// hasValidationsImpl implements hasValidations without risk of infinite +// recursion. +func (g *genValidations) hasValidationsImpl(n *typeNode, seen map[*typeNode]bool) bool { + if n == nil { + return false + } + + if seen[n] { + return false + } + seen[n] = true + + if n.typeValidations.HasEmitable() { + return true + } + + if n.typeValidations.OpaqueType { + return false + } + + if n.underlying != nil { + if n.typeKeyIterations.HasEmitable() { + if keyNode := n.resolveKeyNode(); keyNode != nil && g.hasValidationsImpl(keyNode, seen) { + return true + } + } + if n.typeValIterations.HasEmitable() { + if elemNode := n.resolveElemNode(); elemNode != nil && g.hasValidationsImpl(elemNode, seen) { + return true + } + } + if g.hasValidationsImpl(n.underlying.node, seen) { + return true + } + } + + for _, c := range n.fields { + if c.fieldValidations.HasEmitable() { + return true + } + if c.fieldKeyIterations.HasEmitable() { + if keyNode := c.node.resolveKeyNode(); keyNode != nil && g.hasValidationsImpl(keyNode, seen) { + return true + } + } + if c.fieldValIterations.HasEmitable() { + if elemNode := c.node.resolveElemNode(); elemNode != nil && g.hasValidationsImpl(elemNode, seen) { + return true + } + } + if g.hasValidationsImpl(c.node, seen) { + return true + } + } + + return false +} + +// emitRegisterFunction emits the type-registration logic for validation +// functions. +func (g *genValidations) emitRegisterFunction(c *generator.Context, schemeRegistry types.Name, sw *generator.SnippetWriter) { + var targetTypes []*types.Type + for _, rootType := range g.rootTypes { + if g.hasValidations(g.discovered.typeNodes[rootType]) { + targetTypes = append(targetTypes, rootType) + } + } + if len(targetTypes) == 0 { + return + } + + scheme := c.Universe.Type(schemeRegistry) + schemePtr := &types.Type{ + Kind: types.Pointer, + Elem: scheme, + } + + sw.Do("func init() { localSchemeBuilder.Register(RegisterValidations)}\n\n", nil) + + sw.Do("// RegisterValidations adds validation functions to the given scheme.\n", nil) + sw.Do("// Public to allow building arbitrary schemes.\n", nil) + sw.Do("func RegisterValidations(scheme $.|raw$) error {\n", schemePtr) + for _, rootType := range targetTypes { + node := g.discovered.typeNodes[rootType] + if node == nil { + panic(fmt.Sprintf("found nil node for root-type %v", rootType)) + } + + targs := generator.Args{ + "rootType": rootType, + "typePfx": "", + "field": mkSymbolArgs(c, fieldPkgSymbols), + "fmt": mkSymbolArgs(c, fmtPkgSymbols), + "operation": mkSymbolArgs(c, operationPkgSymbols), + "safe": mkSymbolArgs(c, safePkgSymbols), + "context": mkSymbolArgs(c, contextPkgSymbols), + } + if !util.IsNilableType(rootType) { + targs["typePfx"] = "*" + } + + // This uses a typed nil pointer, rather than a real instance because + // we need the type information, but not an instance of the type. + sw.Do("// type $.rootType|name$\n", targs) + sw.Do("scheme.AddValidationFunc(\n", targs) + sw.Do(" ($.typePfx$$.rootType|raw$)(nil),\n", targs) + sw.Do(" func(ctx $.context.Context$, op $.operation.Operation|raw$, obj, oldObj interface{}) $.field.ErrorList|raw$ {\n", targs) + + sw.Do("switch op.Request.SubresourcePath() {\n", nil) + sw.Do("case ", nil) + for i, s := range g.toResourceList(rootType) { + if i > 0 { + sw.Do(", ", nil) + } + sw.Do("$.$", s) + } + sw.Do(":\n", nil) + sw.Do(" return $.rootType|objectvalidationfn$(\n", targs) + sw.Do(" ctx, ", targs) + sw.Do(" op, ", targs) + sw.Do(" nil /* fldPath */,\n", targs) + sw.Do(" obj.($.typePfx$$.rootType|raw$),\n", targs) + sw.Do(" $.safe.Cast|raw$[$.typePfx$$.rootType|raw$](oldObj))\n", targs) + sw.Do(" }\n", targs) + sw.Do(" return $.field.ErrorList|raw${\n", targs) + sw.Do(" $.field.InternalError|raw$(", targs) + sw.Do(" nil, ", targs) + sw.Do(" $.fmt.Errorf|raw$(\"no validation found for %T, subresource: %v\", obj, op.Request.SubresourcePath())),\n", targs) + sw.Do(" }\n", targs) + sw.Do("})\n", targs) + } + sw.Do("return nil\n", nil) + sw.Do("}\n\n", nil) +} + +// toResourceList returns a list of resources that are supported by a kind. +func (g *genValidations) toResourceList(rootType *types.Type) []string { + supportedSubresources := supportedSubresourceTags(rootType) + + if subresource, isSubresource := isSubresourceTag(rootType); isSubresource { + supportedSubresources.Insert(subresource) + } else { + supportedSubresources.Insert("/") + } + supported := supportedSubresources.UnsortedList() + slices.Sort(supported) + for i, subresource := range supported { + supported[i] = strconv.Quote(subresource) + } + return supported +} + +// emitValidationFunction emits a validation function for the specified type. +func (g *genValidations) emitValidationFunction(c *generator.Context, t *types.Type, sw *generator.SnippetWriter) { + if !g.hasValidations(g.discovered.typeNodes[t]) { + return + } + + targs := generator.Args{ + "inType": t, + "field": mkSymbolArgs(c, fieldPkgSymbols), + "operation": mkSymbolArgs(c, operationPkgSymbols), + "context": mkSymbolArgs(c, contextPkgSymbols), + "objTypePfx": "*", + } + if util.IsNilableType(t) { + targs["objTypePfx"] = "" + } + + node := g.discovered.typeNodes[t] + if node == nil { + panic(fmt.Sprintf("found nil node for root-type %v", t)) + } + sw.Do("// $.inType|objectvalidationfn$ validates an instance of $.inType|name$ according\n", targs) + sw.Do("// to declarative validation rules in the API schema.\n", targs) + sw.Do("func $.inType|objectvalidationfn$(\n", targs) + sw.Do(" ctx $.context.Context|raw$, ", targs) + sw.Do(" op $.operation.Operation|raw$, ", targs) + sw.Do(" fldPath *$.field.Path|raw$,\n", targs) + sw.Do(" obj, oldObj $.objTypePfx$$.inType|raw$) ", targs) + sw.Do("(errs $.field.ErrorList|raw$) {\n\n", targs) + fakeChild := &childNode{ + node: node, + childType: t, + } + g.emitValidationForChild(c, fakeChild, sw) + sw.Do("return errs\n", nil) + sw.Do("}\n\n", nil) +} + +// emitValidationForChild emits code for the specified childNode, calling +// type-attached validations and then descending into the type (e.g. struct +// fields). +// +// Emitted code assumes that the value in question is always a pair of nilable +// variables named "obj" and "oldObj", and the field path to this value is +// named "fldPath". +// +// This function assumes that thisChild.node is not nil. +func (g *genValidations) emitValidationForChild(c *generator.Context, thisChild *childNode, sw *generator.SnippetWriter) { + thisNode := thisChild.node + inType := thisNode.valueType + + targs := generator.Args{ + "inType": inType, + "field": mkSymbolArgs(c, fieldPkgSymbols), + "safe": mkSymbolArgs(c, safePkgSymbols), + } + + didSome := false // for prettier output later + + // Emit code for type-attached validations. + if validations := thisNode.typeValidations; !validations.Empty() { + switch thisNode.valueType.Kind { + case types.Struct, types.Alias: // OK + default: + panic(fmt.Sprintf("unexpected type-validations on type %v, kind %s", thisNode.valueType, thisNode.valueType.Kind)) + } + emitComments(validations.Comments, sw) + g.emitCallsToValidators(c, validations.Functions, sw) + sw.Do("\n", nil) + didSome = true + } + + if validations := thisNode.typeKeyIterations; !validations.Empty() { + keyNode := thisNode.resolveKeyNode() + if keyNode != nil && g.hasValidations(keyNode) { + emitComments(validations.Comments, sw) + g.emitCallsToValidators(c, validations.Functions, sw) + sw.Do("\n", nil) + didSome = true + } + } + + if validations := thisNode.typeValIterations; !validations.Empty() { + elemNode := thisNode.resolveElemNode() + if elemNode != nil && g.hasValidations(elemNode) { + emitComments(validations.Comments, sw) + g.emitCallsToValidators(c, validations.Functions, sw) + sw.Do("\n", nil) + didSome = true + } + } + + if thisNode.typeValidations.OpaqueType { + return + } + + // Descend into the type. + switch inType.Kind { + case types.Builtin: + // Nothing further. + case types.Slice: + // Nothing further + case types.Map: + // Nothing further + case types.Alias: + g.emitValidationForChild(c, thisNode.underlying, sw) + case types.Struct: + for _, fld := range thisNode.fields { + if len(fld.name) == 0 { + panic(fmt.Sprintf("missing field name in type %s (field-type %s)", thisNode.valueType, fld.childType)) + } + // Missing JSON name is checked iff we have code to emit. + + // Accumulate into a buffer so we don't emit empty functions. + buf := bytes.NewBuffer(nil) + bufsw := sw.Dup(buf) + + // On ratcheting checks: + // + // We emit ratcheting checks ONLY for struct fields and ONLY when + // that field has some validations to call. + // + // We DO NOT emit ratchet checks inside type-specific validation + // functions, because that leads to repeated ratchet checking which + // is almost never useful work (keep reading). + // + // The consequence of this is that a caller of a type's validation + // function is assumed to have already done a ratchet check (which + // is true for all generated code (except root types, keep + // reading)). For struct types (our most common case), the type's + // function will do ratchet checks on each sub-field anyway. + // + // This leaves one case where validation is executed unilaterally: + // non-pre-checked calls of validation functions for types which have + // type-attached validations. This can happen in two cases: + // 1. an external caller of a type's validation function + // 2. the generated register function for a package which calls a + // root-type's validation function + // + // TODO: We are leaving this as a problem for the future. If we + // find that we have a root type which has type-attached validation + // AND that validation is being ratcheted, then we will need to + // address this. Some options: + // 1. emit a ratchet check in the package's register function + // 2. emit a ratchet check in the type's validation function + // (IFF it has type-attached validation, perhaps only for root + // types) + // 3. emit both "safe" (ratchet check the whole object) and + // "fast" (assume the object was already ratchet checked) + // forms of each type's validation function, so that the + // generated code can call the "fast" form while external code + // calls the "safe" form. + // 4. implement depth-first traversal of validation, where each + // function returns an additional bool indicating "something + // changed", which gets propagated up the caller to decide if + // it needs to do higher-level validations (e.g. if any field + // in a struct changes, the struct's type-attached validations + // need to be executed, but if no fields changed they can be + // skipped). + // + // For the same reasons, in the specific case of lists of pointers, + // we do not emit nil-checks inside type-specific validation + // functions. If we solve for the duplicative ratcheting, then we + // should also solve for nil-checks. + + if nt := util.NativeType(fld.childType); nt.Kind == types.Slice && nt.Elem.Kind == types.Pointer { + hasFieldValidations := len(fld.fieldValidations.Functions) > 0 + hasPropagation := fld.node != nil && g.hasValidations(fld.node) + hasKeyIterations := len(fld.fieldKeyIterations.Functions) > 0 && hasPropagation + hasValIterations := len(fld.fieldValIterations.Functions) > 0 && hasPropagation + + if hasFieldValidations || hasPropagation || hasKeyIterations || hasValIterations { + // Prepend the nil-check so it runs before any other + // validations. This is important because the other + // validations may assume that the slice has no nil values. + nilCheck := validators.PtrSliceNoNils(nt.Elem.Elem.Name) + fld.fieldValidations.Functions = append([]validators.FunctionGen{nilCheck}, fld.fieldValidations.Functions...) + } + } + + validations := fld.fieldValidations + fldRatchetingChecked := false + if !validations.Empty() { + emitComments(validations.Comments, bufsw) + if len(validations.Functions) > 0 { + emitRatchetingCheck(c, fld.childType, bufsw) + fldRatchetingChecked = true + bufsw.Do("// call field-attached validations\n", nil) + g.emitCallsToValidators(c, validations.Functions, bufsw) + } + } + + // If the node is nil, this must be a type in a package we are not + // handling - it's effectively opaque to us. + if fld.node != nil { + // Get to the real type. + switch fld.node.valueType.Kind { + case types.Alias, types.Struct: + // If this field is another type, we may need to call its + // validation function. If it has no validations + // (transitively) then we don't need to do anything. + if g.hasValidations(fld.node) { + if !fldRatchetingChecked { + emitRatchetingCheck(c, fld.childType, bufsw) + fldRatchetingChecked = true + } + g.emitCallToOtherTypeFunc(c, fld.node, bufsw) + } + } + + emitIterations := func(iterations validators.Validations, node *typeNode) { + if iterations.Empty() { + return + } + if node != nil && g.hasValidations(node) { + emitComments(iterations.Comments, bufsw) + if len(iterations.Functions) > 0 { + if !fldRatchetingChecked { + emitRatchetingCheck(c, fld.childType, bufsw) + fldRatchetingChecked = true + } + g.emitCallsToValidators(c, iterations.Functions, bufsw) + } + } + } + + emitIterations(fld.fieldKeyIterations, fld.node.resolveKeyNode()) + emitIterations(fld.fieldValIterations, fld.node.resolveElemNode()) + + if fld.node.valueType.Kind == types.Slice || fld.node.valueType.Kind == types.Map { + // Descend into this field. + g.emitValidationForChild(c, fld, bufsw) + } + } + + if buf.Len() > 0 { + leafType, typePfx, exprPfx := getLeafTypeAndPrefixes(fld.childType) + targs := targs.WithArgs(generator.Args{ + "fieldName": fld.name, + "fieldJSON": fld.jsonName, + "fieldType": leafType, + "fieldTypePfx": typePfx, + "fieldExprPfx": exprPfx, + }) + + if didSome { + sw.Do("\n", nil) + } + sw.Do("{ // field $.inType|raw$.$.fieldName$\n", targs) + sw.Do(" fn := func(\n", targs) + sw.Do(" fldPath *$.field.Path|raw$,\n", targs) + sw.Do(" obj, oldObj $.fieldTypePfx$$.fieldType|raw$,\n", targs) + sw.Do(" oldValueCorrelated bool) (errs $.field.ErrorList|raw$) {\n", targs) + if err := sw.Merge(buf, bufsw); err != nil { + panic(fmt.Sprintf("failed to merge buffer: %v", err)) + } + sw.Do(" return\n", targs) + sw.Do(" }\n", targs) + // safe.Field returns a nil if the old object does not have a correlatable + // value, such as a map. + // This is ambiguous with the case where the field exists and is nil. + // This ambiguity is a problem for ratcheting, which needs to distinguish + // these cases. For example, if a required field is removed from a map, + // safe.Field will return nil for the old value, and the new value is also + // nil (because it doesn't exist). Ratcheting would normally allow this, + // but it's a validation failure because a required field is missing. + // + // To solve this, we pass an extra boolean parameter to the validation + // function, indicating whether the old value was correlated. If the old + // value was uncorrelated, it means the field was not present in the old + // object, and we should not apply ratcheting logic. `oldObj != nil` + // provides this bit of information. + // + // This bit is not currently propagated down to deeper levels of + // validation, but since the code generator only ever looks one level + // down, this is sufficient for now. + sw.Do(" oldVal := $.safe.Field|raw$(oldObj,\n", targs) + sw.Do(" func(oldObj *$.inType|raw$) $.fieldTypePfx$$.fieldType|raw$ {\n", targs) + sw.Do(" return $.fieldExprPfx$oldObj.$.fieldName$\n", targs) + sw.Do(" })\n", targs) + sw.Do(" errs = append(errs, fn(", targs) + if len(fld.jsonName) > 0 { + sw.Do("fldPath.Child(\"$.fieldJSON$\"), ", targs) + } else { + // If there is an embedded field in a root-type, fldPath + // will be nil, and we need SOMETHING for the field path. + sw.Do("$.safe.Value|raw$(fldPath, func() *$.field.Path|raw$ { return fldPath.Child(\"$.fieldType|raw$\") }), ", targs) + } + sw.Do(" $.fieldExprPfx$obj.$.fieldName$, oldVal, oldObj != nil)...)\n", targs) + sw.Do("}\n", targs) + sw.Do("\n", nil) + } else { + targs := targs.WithArgs(generator.Args{ + "fieldName": fld.name, + }) + sw.Do("// field $.inType|raw$.$.fieldName$ has no validation\n", targs) + } + didSome = true + } + default: + panic(fmt.Sprintf("unhandled type: %v (kind %s)", inType, inType.Kind)) + } +} + +// emitCallToOtherTypeFunc generates a call to the specified node's generated +// validation function for a field in some parent context. +// +// Emitted code assumes that the value in question is always a pair of nilable +// variables named "obj" and "oldObj", and the field path to this value is +// named "fldPath". +func (g *genValidations) emitCallToOtherTypeFunc(c *generator.Context, node *typeNode, sw *generator.SnippetWriter) { + targs := generator.Args{ + "funcName": c.Universe.Type(g.resolveFunc(node.funcName)), + } + sw.Do("// call the type's validation function\n", nil) + sw.Do("errs = append(errs, $.funcName|raw$(ctx, op, fldPath, obj, oldObj)...)\n", targs) +} + +// emitRatchetingCheck emits an equivalence check for default ratcheting. +func emitRatchetingCheck(c *generator.Context, t *types.Type, sw *generator.SnippetWriter) { + // Emit equivalence check for default ratcheting. + targs := generator.Args{ + "operation": mkSymbolArgs(c, operationPkgSymbols), + } + sw.Do("// don't revalidate unchanged data\n", nil) + sw.Do("if oldValueCorrelated && op.Type == $.operation.Update|raw$ {\n", targs) + // If the type is a builtin, we can use a simpler equality check when they are not nil. + if util.IsDirectComparable(util.NonPointer(util.NativeType(t))) { + // We should never get anything but pointers here, since every other + // nilable type is not Comparable. + // + // This condition looks overly complex, but each case is needed: + // - obj == oldObj : handle pointers which are nil in old and new + // - obj != nil : handle optional fields which are updated to nil + // - oldObj != nil : handle optional fields which are updated from nil + // - *obj == *oldObj : compare values + sw.Do(" if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {\n", targs) + } else { + targs["equality"] = mkSymbolArgs(c, equalityPkgSymbols) + sw.Do(" if $.equality.Semantic|raw$.DeepEqual(obj, oldObj) {\n", targs) + } + sw.Do(" return nil\n", nil) + sw.Do(" }\n", nil) + sw.Do("}\n", nil) +} + +// emitCallsToValidators emits calls to a list of validation functions for +// a single field or type. validations is a list of functions to call, with +// arguments. +// +// When calling registered validators, we always pass a nilable type. E.g. if +// the field's type is string, we pass *string, and if the field's type is +// *string, we also pass *string. This means that validators need to do +// nil-checks themselves, if they intend to dereference the pointer. This +// makes updates more consistent. +// +// Emitted code assumes that the value in question is always a pair of nilable +// variables named "obj" and "oldObj", and the field path to this value is +// named "fldPath". +func (g *genValidations) emitCallsToValidators(c *generator.Context, validations []validators.FunctionGen, sw *generator.SnippetWriter) { + // Group and sort the inputs. + cohorts := sortIntoCohorts(validations) + + for _, validations := range cohorts { + cohortName := validations[0].Cohort + if cohortName != "" { + sw.Do("func() { // cohort = \"$.$\"\n", cohortName) + } + + hasShortCircuits := false + lastShortCircuitIdx := -1 + for i, v := range validations { + if v.Flags.IsSet(validators.ShortCircuit) { + hasShortCircuits = true + lastShortCircuitIdx = i + } + } + + if hasShortCircuits { + sw.Do("earlyReturn := false\n", nil) + } + + for i, v := range validations { + isShortCircuit := v.Flags.IsSet(validators.ShortCircuit) + isNonError := v.Flags.IsSet(validators.NonError) + + targs := generator.Args{ + "funcName": c.Universe.Type(g.resolveFunc(v.Function)), + "field": mkSymbolArgs(c, fieldPkgSymbols), + "fmt": mkSymbolArgs(c, fmtPkgSymbols), + } + + emitCall := func() { + sw.Do("$.funcName|raw$", targs) + if typeArgs := v.TypeArgs; len(typeArgs) > 0 { + sw.Do("[", nil) + for i, typeArg := range typeArgs { + sw.Do("$.|raw$", c.Universe.Type(typeArg)) + if i < len(typeArgs)-1 { + sw.Do(",", nil) + } + } + sw.Do("]", nil) + } + sw.Do("(ctx, op, fldPath, obj, oldObj", targs) + for _, arg := range v.Args { + sw.Do(", ", nil) + g.toGolangSourceDataLiteral(sw, c, arg, flNewlineOK) + } + sw.Do(")", targs) + switch v.StabilityLevel { + case validators.ValidationStabilityLevelAlpha: + sw.Do(".MarkAlpha()", nil) + case validators.ValidationStabilityLevelBeta: + sw.Do(".MarkBeta()", nil) + } + if isShortCircuit { + sw.Do(".MarkShortCircuit()", nil) + } + } + + // If validation is conditional, wrap the validation function with a conditions check. + if !v.Conditions.Empty() { + emitBaseFunction := emitCall + emitCall = func() { + // emitOptionLookup emits ", defined := op.HasOption(